Commit 65c6095d authored by Leigh Stoller's avatar Leigh Stoller

Add argument to let you look for your own images/osids. For example:

	https://www.emulab.net/showosid_list.php3?creator=stoller
	https://www.emulab.net/showimageid_list.php3?creator=stoller

A quickie; it can be worked in better if we want.
parent e9e1b885
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -36,12 +36,28 @@ elseif (! strcmp($sortby, "desc"))
$order = "i.description";
else
$order = "i.imagename";
$extraclause = "";
#
# Allow for creator restriction
#
if (isset($creator) && $creator != "") {
if (! TBvalid_uid($creator)) {
PAGEARGERROR("Invalid characters in creator");
}
if ($isadmin)
$extraclause = "where i.creator='$creator' ";
else
$extraclause = "and i.creator='$creator' ";
}
#
# Get the list.
#
if ($isadmin) {
$query_result = DBQueryFatal("SELECT * FROM images as i order by $order");
$query_result = DBQueryFatal("SELECT * FROM images as i ".
"$extraclause ".
"order by $order");
}
else {
#
......@@ -55,7 +71,9 @@ else {
$query_result =
DBQueryFatal("select distinct i.* from images as i ".
"left join group_membership as g on g.pid=i.pid ".
"where g.uid='$uid' or i.global order by $order");
"where (g.uid='$uid' or i.global) ".
"$extraclause ".
"order by $order");
}
SUBPAGESTART();
......
......@@ -37,18 +37,35 @@ elseif (! strcmp($sortby, "desc"))
else
$order = "o.osname";
#
# Allow for creator restriction
#
$extraclause = "";
if (isset($creator) && $creator != "") {
if (! TBvalid_uid($creator)) {
PAGEARGERROR("Invalid characters in creator");
}
if ($isadmin)
$extraclause = "where o.creator='$creator' ";
else
$extraclause = "and o.creator='$creator' ";
}
#
# Get the project list.
#
if ($isadmin) {
$query_result =
DBQueryFatal("SELECT * FROM os_info as o order by $order");
DBQueryFatal("SELECT * FROM os_info as o ".
"$extraclause ".
"order by $order");
}
else {
$query_result =
DBQueryFatal("select distinct o.* from os_info as o ".
"left join group_membership as g on g.pid=o.pid ".
"where g.uid='$uid' or o.shared=1 ".
"where (g.uid='$uid' or o.shared=1) ".
"$extraclause ".
"order by $order");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment