Remove unused files
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
function create_appbyvendorsearch_url($vName)
|
||||
{
|
||||
global $fields, $orderby, $join;
|
||||
|
||||
$orderby = "appId";
|
||||
$fields[] = "vendor.vendorId";
|
||||
$fields[] = "appFamily.appId";
|
||||
$fields[] = "appFamily.appName";
|
||||
$fields[] = "appFamily.webPage";
|
||||
$join = "appFamily.vendorId=vendor.vendorId";
|
||||
|
||||
$searchwhat = "vendor.vendorId";
|
||||
|
||||
$url = "stdquery.php";
|
||||
$url .= "?orderby=$orderby";
|
||||
$url .= "&searchfor=$vName";
|
||||
$url .= "&searchwhat=$searchwhat";
|
||||
$url .= "&join=$join";
|
||||
|
||||
foreach($fields as $aField)
|
||||
{
|
||||
$url .= "&fields[]=$aField";
|
||||
}
|
||||
|
||||
$url .= "&linesPerPage=$linesPerPage";
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
function output_appbyvendor_forminputs()
|
||||
{
|
||||
global $fields, $orderby, $join;
|
||||
|
||||
$orderby = "appId";
|
||||
$fields[] = "vendor.vendorId";
|
||||
$fields[] = "appFamily.appId";
|
||||
$fields[] = "appFamily.appName";
|
||||
$fields[] = "appFamily.webPage";
|
||||
$join = "appFamily.vendorId=vendor.vendorId";
|
||||
|
||||
|
||||
$searchwhat = "vendor.vendorName";
|
||||
|
||||
echo "<input TYPE=\"HIDDEN\" NAME=\"orderby\" VALUE=\"$orderby\">
|
||||
<input TYPE=\"HIDDEN\" NAME=\"searchwhat\" VALUE=\"$searchwhat\">";
|
||||
|
||||
foreach($fields as $aField)
|
||||
{
|
||||
echo "<input TYPE=\"HIDDEN\" NAME=\"fields[]\" VALUE=\"$aField\">";
|
||||
}
|
||||
|
||||
echo "<input TYPE=\"HIDDEN\" NAME=\"join\" VALUE=\"$join\">";
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
$fields = "";
|
||||
$join = "";
|
||||
$orderby = "";
|
||||
$searchfor = "";
|
||||
$searchwhat = "";
|
||||
|
||||
|
||||
|
||||
function create_appversionsearch_url($vName)
|
||||
{
|
||||
global $fields, $orderby, $searchwhat, $join;
|
||||
|
||||
$orderby = "appId";
|
||||
$searchwhat = "appVersion.appId";
|
||||
$fields[] = "appVersion.appId";
|
||||
$fields[] = "appVersion.versionId";
|
||||
$fields[] = "appVersion.versionName";
|
||||
|
||||
|
||||
$url = "stdquery.php";
|
||||
$url .= "?orderby=$orderby";
|
||||
$url .= "&searchfor=$vName";
|
||||
$url .= "&searchwhat=$searchwhat";
|
||||
|
||||
foreach($fields as $aField)
|
||||
{
|
||||
$url .= "&fields[]=$aField";
|
||||
}
|
||||
|
||||
$url .= "&join=$join";
|
||||
$url .= "&linesPerPage=$linesPerPage";
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
function output_appversion_forminputs()
|
||||
{
|
||||
global $fields, $orderby, $searchwhat, $join;
|
||||
|
||||
$orderby = "appId";
|
||||
$searchwhat = "appVersion.versionId";
|
||||
$fields[] = "appVersion.appId";
|
||||
$fields[] = "appVersion.versionId";
|
||||
$fields[] = "appVersion.versionName";
|
||||
|
||||
|
||||
echo "<input TYPE=\"HIDDEN\" NAME=\"orderby\" VALUE=\"$orderby\">
|
||||
<input TYPE=\"HIDDEN\" NAME=\"searchwhat\" VALUE=\"$searchwhat\">";
|
||||
|
||||
foreach($fields as $aField)
|
||||
{
|
||||
echo "<input TYPE=\"HIDDEN\" NAME=\"fields[]\" VALUE=\"$aField\">";
|
||||
}
|
||||
|
||||
echo "<input TYPE=\"HIDDEN\" NAME=\"join\" VALUE=\"$join\">";
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,73 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* add previous/next buttons
|
||||
*/
|
||||
function add_pn_buttons($vars, $endpos)
|
||||
{
|
||||
extract($vars);
|
||||
|
||||
if($linesPerPage == "ALL")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$curPage = $curPos / $linesPerPage;
|
||||
$numRows = $endpos - $curPos;
|
||||
$numButtons = $totalCount / $linesPerPage;
|
||||
$buttonCount = 1;
|
||||
|
||||
$prev_url = 0;
|
||||
$next_url = 0;
|
||||
|
||||
// define previous/next buttons
|
||||
if($curPos > 0)
|
||||
{
|
||||
$vars["curPos"] = $curPos - $linesPerPage;
|
||||
$prev_url = "stdquery.php?".build_urlarg($vars);
|
||||
}
|
||||
|
||||
if($endpos < $totalCount)
|
||||
{
|
||||
$vars["curPos"] = $curPos + $linesPerPage;
|
||||
$next_url = "stdquery.php?".build_urlarg($vars);
|
||||
}
|
||||
|
||||
// show prev button if nessessary
|
||||
if($prev_url)
|
||||
{
|
||||
echo html_b(html_ahref("<< Prev", $prev_url));
|
||||
}
|
||||
|
||||
// show numbered links
|
||||
if(!$useNextOnly && $endpos <= $totalCount)
|
||||
{
|
||||
while($buttonCount <= $numButtons + 1)
|
||||
{
|
||||
if($curPage == ($buttonCount - 1))
|
||||
{
|
||||
echo html_b("$buttonCount");
|
||||
} else
|
||||
{
|
||||
$vars["curPos"] = ($buttonCount - 1) * $linesPerPage;
|
||||
$url = "stdquery.php?".build_urlarg($vars);
|
||||
echo " ".html_ahref("$buttonCount", $url)." ";
|
||||
}
|
||||
|
||||
if(!($buttonCount % 40))
|
||||
{
|
||||
echo html_p();
|
||||
}
|
||||
$buttonCount++;
|
||||
}
|
||||
}
|
||||
// show next button if nessessary
|
||||
if($next_url)
|
||||
{
|
||||
echo html_b(html_ahref("Next >>", $next_url));
|
||||
}
|
||||
|
||||
echo "<br />".html_small("listing $numRows record".($numRows == 1 ? "" : "s")." ".($curPos+1)." to $endpos of $totalCount total");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,248 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************/
|
||||
/* query class */
|
||||
/* (de)compose/exec queries */
|
||||
/* this should have query.php's query preprocessing etc. */
|
||||
/*********************************************************/
|
||||
|
||||
class qclass {
|
||||
|
||||
var $fields;
|
||||
var $tables;
|
||||
var $where;
|
||||
var $limit;
|
||||
var $order;
|
||||
|
||||
var $table_ids = array("apimsdefinition" => "apiid",
|
||||
"apimslinks" => "apiid",
|
||||
"dlldefinition" => "dllid",
|
||||
"implementation" => "apiid",
|
||||
"user_list" => "userid",
|
||||
"project_list" => "id",
|
||||
"appFamily" => "appId",
|
||||
"appVersion" => "versionId",
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
function qclass()
|
||||
{
|
||||
$this->clear();
|
||||
}
|
||||
|
||||
|
||||
function clear()
|
||||
{
|
||||
$this->fields = array();
|
||||
$this->tables = array();
|
||||
$this->where = array();
|
||||
$this->limit = 10;
|
||||
$this->order = "";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* resolve used tables from fields
|
||||
*/
|
||||
function resolve_tables($fields)
|
||||
{
|
||||
$tables = array();
|
||||
while(list($idx, $field) = each($fields))
|
||||
{
|
||||
//echo "Field: $field <br>\n";
|
||||
if(!ereg("^(.+)\\.(.+)$", $field, $arr))
|
||||
continue;
|
||||
$tables[$arr[1]] = $arr[1];
|
||||
}
|
||||
return values($tables);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_id($table)
|
||||
{
|
||||
$id = $this->table_ids[$table];
|
||||
if($id)
|
||||
return $id;
|
||||
if(ereg("^impl_.*$", $table))
|
||||
return "apiid";
|
||||
return null;
|
||||
}
|
||||
|
||||
function get_rel($table1, $table2)
|
||||
{
|
||||
$id1 = $this->get_id($table1);
|
||||
$id2 = $this->get_id($table2);
|
||||
|
||||
if($id1 == "dllid" && $table2 == "apimsdefinition")
|
||||
return $id1;
|
||||
if($id2 == "dllid" && $table1 == "apimsdefinition")
|
||||
return $id2;
|
||||
|
||||
if($id1 == $id2)
|
||||
return $id1;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function resolve_where($tables)
|
||||
{
|
||||
$tables = values($tables);
|
||||
$arr = array();
|
||||
$have = array();
|
||||
while(list($idx, $table) = each($tables))
|
||||
{
|
||||
for($i = 0; $i < sizeof($tables); $i++)
|
||||
{
|
||||
//echo "Checking $table - $tables[$i] <br>\n";
|
||||
if($table == $tables[$i])
|
||||
continue;
|
||||
$id = $this->get_rel($table, $tables[$i]);
|
||||
if(!$id)
|
||||
continue;
|
||||
if($have[$id][$table])
|
||||
continue;
|
||||
$have[$id][$table] = 1;
|
||||
$have[$id][$tables[$i]] = 1;
|
||||
$arr[] = "$table.$id = $tables[$i].$id";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
apidb_header();
|
||||
echo "RESULT: ".implode(" AND ", $arr);
|
||||
apidb_footer();
|
||||
exit;
|
||||
*/
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function process($vars)
|
||||
{
|
||||
extract($vars);
|
||||
//var_dump($vars);
|
||||
|
||||
$sfields = $fields;
|
||||
|
||||
if(!$implementations)
|
||||
$implementations = array("wine"); //FIXME
|
||||
|
||||
while(list($idx, $impl) = each($implementations))
|
||||
{
|
||||
|
||||
// Check for quality?
|
||||
if($quality[$idx] && $quality[$idx] != "ALL")
|
||||
{
|
||||
if($quality[$idx] == "UNKNOWN")
|
||||
$this->where[] = "impl_$impl.quality IS NULL";
|
||||
else
|
||||
$this->where[] = "impl_$impl.quality >= $quality[$idx]";
|
||||
$sfields[] = "impl_$impl.quality";
|
||||
}
|
||||
|
||||
// Check for presence?
|
||||
if($presence[$idx] && $presence[$idx] != "ALL")
|
||||
{
|
||||
$this->where[] = "impl_$impl.presence = '$presence[$idx]'";
|
||||
$sfields[] = "impl_$impl.presence";
|
||||
}
|
||||
|
||||
// Check last modified?
|
||||
if($lastmod[$idx] > 0)
|
||||
{
|
||||
$time = time() - ($lastmod[$idx] * 24 * 3600);
|
||||
$this->where[] = "impl_$impl.lastmod > from_unixtime($time)";
|
||||
$sfields[] = "impl_$impl.lastmod";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Search in a specific DLL?
|
||||
if($dllid && $dllid != "ALL")
|
||||
$this->where[] = "dlldefinition.dllid = $dllid";
|
||||
|
||||
// Check for rating? (APPDB)
|
||||
if($rating && $rating != "ANY")
|
||||
{
|
||||
|
||||
$q = "";
|
||||
if($system == "ANY" || $system == "windows")
|
||||
{
|
||||
$q .= " appVersion.rating_windows >= $rating ";
|
||||
$sfields[] = "appVersion.rating_windows";
|
||||
}
|
||||
if($system == "ANY" || $system == "fake")
|
||||
{
|
||||
if($system == "ANY")
|
||||
$q .= " OR ";
|
||||
$q .= " appVersion.rating_fake >= $rating ";
|
||||
$sfields[] = "appVersion.rating_fake";
|
||||
}
|
||||
$this->where[] = "appVersion.appId = appFamily.appId AND ($q)";
|
||||
}
|
||||
|
||||
// Are we searching?
|
||||
if($searchfor)
|
||||
{
|
||||
if(ereg("^[0-9]+$", $searchfor))
|
||||
// exact match if we're searching for a number
|
||||
$this->where[] = "$searchwhat = $searchfor";
|
||||
else
|
||||
// patterns are case insensitive in MySQL
|
||||
$this->where[] = "$searchwhat LIKE '%$searchfor%'";
|
||||
}
|
||||
|
||||
// Must we join?
|
||||
if($join)
|
||||
{
|
||||
$this->where[] = $join;
|
||||
}
|
||||
|
||||
$this->fields = $fields;
|
||||
$this->tables = $this->resolve_tables($sfields);
|
||||
$this->where = array_merge($this->resolve_where($this->tables), $this->where);
|
||||
|
||||
}
|
||||
|
||||
function add_where($str)
|
||||
{
|
||||
$this->where[] = $str;
|
||||
}
|
||||
|
||||
function add_field($field)
|
||||
{
|
||||
$this->fields[] = $field;
|
||||
}
|
||||
|
||||
function add_fields($arr)
|
||||
{
|
||||
$this->fields = array_merge($this->fields, $arr);
|
||||
}
|
||||
|
||||
function resolve()
|
||||
{
|
||||
$this->tables = $this->resolve_tables($this->fields);
|
||||
$this->where = array_merge($this->resolve_where($this->tables), $this->where);
|
||||
}
|
||||
|
||||
|
||||
function get_query()
|
||||
{
|
||||
$query = array();
|
||||
$query[] = "SELECT";
|
||||
$query[] = implode(", ", $this->fields);
|
||||
$query[] = "FROM";
|
||||
$query[] = implode(", ", $this->tables);
|
||||
if(sizeof($this->where))
|
||||
{
|
||||
$query[] = "WHERE";
|
||||
$query[] = implode(" AND ", $this->where);
|
||||
}
|
||||
// add LIMIT etc.
|
||||
|
||||
return implode(" ", $query);
|
||||
}
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
include(BASE."include/"."appversion.php");
|
||||
include(BASE."include/"."appbyvendor.php");
|
||||
|
||||
function initFields()
|
||||
{
|
||||
global $fields, $orderby, $join, $searchfor, $searchwhat;
|
||||
|
||||
$fields = "";
|
||||
$searchfor = "";
|
||||
$searchwhat = "";
|
||||
$join = "";
|
||||
$orderby = "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* perform a sql query
|
||||
*/
|
||||
function twinedb_query($query, $vars)
|
||||
{
|
||||
// imports vars into symbol table
|
||||
extract($vars);
|
||||
|
||||
if(debugging())
|
||||
echo "QUERY: $query <p>";
|
||||
|
||||
// Only permit sql SELECT statements
|
||||
if(!eregi("^select .*$", $query))
|
||||
{
|
||||
echo "<b> Invalid SQL Query </b>";
|
||||
echo "<br /> $query <br />";
|
||||
return;
|
||||
}
|
||||
|
||||
opendb();
|
||||
$tmpq = str_replace("\\", "", $query);
|
||||
|
||||
$endPos=$curPos+$linesPerPage;
|
||||
$tcurpos = $curPos+$startapi;
|
||||
$tendpos = $endPos+$startapi;
|
||||
|
||||
// set a limit if not already set
|
||||
if(!stristr($query, "limit"))
|
||||
$tmpq .= " LIMIT $tcurpos,$linesPerPage";
|
||||
|
||||
// execute the db query
|
||||
$tstamp = time();
|
||||
$result = mysql_query($tmpq);
|
||||
$tstamp = time() - $tstamp;
|
||||
|
||||
if(debugging())
|
||||
echo "<b> QUERY TIME: $tstamp seconds </b><br />\n";
|
||||
|
||||
// query error!
|
||||
if(!$result)
|
||||
{
|
||||
echo "$query <br /><br />\n";
|
||||
echo "A QUERY error occurred: ".mysql_error()."\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$numRows = mysql_num_rows($result);
|
||||
$numCols = mysql_num_fields($result);
|
||||
|
||||
$curPage = $curPos/$linesPerPage;
|
||||
$tmendpos = $curPos + $numRows;
|
||||
$explain = "stdquery.php?query=".urlencode("EXPLAIN $tmpq");
|
||||
|
||||
|
||||
echo html_br(2);
|
||||
|
||||
// set $debug to enable query debugging
|
||||
if($debug || stristr($tmpq, "explain"))
|
||||
{
|
||||
$str = eregi_replace("(SELECT|EXPLAIN|DISTINCT|FROM|WHERE|AND".
|
||||
"|OR |IS NULL|IS NOT NULL|LIMIT|ORDER BY".
|
||||
"|GROUP BY)",
|
||||
"<br /><b>\\1</b><br />", $tmpq);
|
||||
echo "<br />$str<br />\n";
|
||||
}
|
||||
|
||||
echo html_echo("<div align=center>");
|
||||
|
||||
add_pn_buttons($vars, $tmendpos);
|
||||
echo html_br(2);
|
||||
|
||||
// output table header
|
||||
echo html_table_begin("width='80%' cellspacing=1 border=0 rules=rows frame=hsides");
|
||||
$helems = array();
|
||||
for($k = 0; $k < $numCols; $k++)
|
||||
{
|
||||
$name = mysql_field_name($result, $k);
|
||||
$helems[] = $name;
|
||||
if($name == "apiid")
|
||||
$have_apiid = 1;
|
||||
}
|
||||
echo html_th($helems, "title");
|
||||
|
||||
$curapiid=0;
|
||||
$curName="[NONAME]";
|
||||
|
||||
for($i = 0; $i < $numRows; $i++)
|
||||
{
|
||||
$row = mysql_fetch_array($result, MYSQL_BOTH);
|
||||
$color = ($i % 2);
|
||||
$arr = array();
|
||||
|
||||
for($k = 0; $k < $numCols; $k++)
|
||||
{
|
||||
$fname = mysql_field_name($result, $k);
|
||||
if($fname == "username")
|
||||
{
|
||||
$username = $row[$k];
|
||||
$userid = $row["userid"];
|
||||
$arr[] = html_ahref($username." ", apidb_url("edituser.php?userid=$userid&username=$username"));
|
||||
continue;
|
||||
}
|
||||
|
||||
if($fname == "vendorName")
|
||||
{
|
||||
initFields();
|
||||
$url = "vendorview.php?vendorId=".$row["vendorId"];
|
||||
$arr[] = html_ahref($row[$k], $url);
|
||||
continue;
|
||||
}
|
||||
|
||||
if($fname == "appName")
|
||||
{
|
||||
initFields();
|
||||
$url = "appview.php?appId=".$row["appId"];
|
||||
$arr[] = html_ahref($row[$k], $url);
|
||||
continue;
|
||||
}
|
||||
|
||||
if($fname == "versionName")
|
||||
{
|
||||
$versionId = $row["versionId"];
|
||||
$url = "admin/editAppVersion.php?versionId=$versionId";
|
||||
$arr[] = html_ahref($row[$k], $url);
|
||||
continue;
|
||||
}
|
||||
|
||||
if($fname == "webPage")
|
||||
{
|
||||
$url = $row[$k];
|
||||
$theLink = "$url";
|
||||
$arr[] = html_ahref($url, $theLink);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(mysql_field_type($result, $k) == "int")
|
||||
{
|
||||
$val = (int)$row[$k];
|
||||
$arr[] = "<div align=right>$val</div>";
|
||||
} else
|
||||
{
|
||||
if(!$row[$k])
|
||||
$arr[] = " ";
|
||||
else
|
||||
$arr[] = "$row[$k]";
|
||||
}
|
||||
}
|
||||
|
||||
echo html_tr($arr, "color$color");
|
||||
}
|
||||
|
||||
echo html_table_end();
|
||||
echo html_br();
|
||||
|
||||
add_pn_buttons($vars, $tmendpos);
|
||||
echo html_echo("</div>");
|
||||
|
||||
mysql_free_result($result);
|
||||
closedb();
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<!-- end of query.php -->
|
||||
@@ -1,151 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
function create_appbyvendorsearch_url($vName)
|
||||
{
|
||||
global $fields, $orderby, $join;
|
||||
|
||||
$orderby = "appId";
|
||||
$fields[] = "vendor.vendorId";
|
||||
$fields[] = "appFamily.appId";
|
||||
$fields[] = "appFamily.appName";
|
||||
$fields[] = "appFamily.webPage";
|
||||
$join = "appFamily.vendorId=vendor.vendorId";
|
||||
|
||||
$searchwhat = "vendor.vendorId";
|
||||
|
||||
$url = "stdquery.php";
|
||||
$url .= "?orderby=$orderby";
|
||||
$url .= "&searchfor=$vName";
|
||||
$url .= "&searchwhat=$searchwhat";
|
||||
$url .= "&join=$join";
|
||||
|
||||
foreach($fields as $aField)
|
||||
{
|
||||
$url .= "&fields[]=$aField";
|
||||
}
|
||||
|
||||
$url .= "&linesPerPage=$linesPerPage";
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
function output_appbyvendor_forminputs()
|
||||
{
|
||||
global $fields, $orderby, $join;
|
||||
|
||||
$orderby = "appId";
|
||||
$fields[] = "vendor.vendorId";
|
||||
$fields[] = "appFamily.appId";
|
||||
$fields[] = "appFamily.appName";
|
||||
$fields[] = "appFamily.webPage";
|
||||
$join = "appFamily.vendorId=vendor.vendorId";
|
||||
|
||||
|
||||
$searchwhat = "vendor.vendorName";
|
||||
|
||||
echo "<input TYPE=\"HIDDEN\" NAME=\"orderby\" VALUE=\"$orderby\">
|
||||
<input TYPE=\"HIDDEN\" NAME=\"searchwhat\" VALUE=\"$searchwhat\">";
|
||||
|
||||
foreach($fields as $aField)
|
||||
{
|
||||
echo "<input TYPE=\"HIDDEN\" NAME=\"fields[]\" VALUE=\"$aField\">";
|
||||
}
|
||||
|
||||
echo "<input TYPE=\"HIDDEN\" NAME=\"join\" VALUE=\"$join\">";
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
function create_appbyvendorsearch_url($vName)
|
||||
{
|
||||
global $fields, $orderby, $join;
|
||||
|
||||
$orderby = "appId";
|
||||
$fields[] = "vendor.vendorId";
|
||||
$fields[] = "appFamily.appId";
|
||||
$fields[] = "appFamily.appName";
|
||||
$fields[] = "appFamily.webPage";
|
||||
$join = "appFamily.vendorId=vendor.vendorId";
|
||||
|
||||
$searchwhat = "vendor.vendorId";
|
||||
|
||||
$url = "stdquery.php";
|
||||
$url .= "?orderby=$orderby";
|
||||
$url .= "&searchfor=$vName";
|
||||
$url .= "&searchwhat=$searchwhat";
|
||||
$url .= "&join=$join";
|
||||
|
||||
foreach($fields as $aField)
|
||||
{
|
||||
$url .= "&fields[]=$aField";
|
||||
}
|
||||
|
||||
$url .= "&linesPerPage=$linesPerPage";
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
function output_appbyvendor_forminputs()
|
||||
{
|
||||
global $fields, $orderby, $join;
|
||||
|
||||
$orderby = "appId";
|
||||
$fields[] = "vendor.vendorId";
|
||||
$fields[] = "appFamily.appId";
|
||||
$fields[] = "appFamily.appName";
|
||||
$fields[] = "appFamily.webPage";
|
||||
$join = "appFamily.vendorId=vendor.vendorId";
|
||||
|
||||
|
||||
$searchwhat = "vendor.vendorName";
|
||||
|
||||
echo "<input TYPE=\"HIDDEN\" NAME=\"orderby\" VALUE=\"$orderby\">
|
||||
<input TYPE=\"HIDDEN\" NAME=\"searchwhat\" VALUE=\"$searchwhat\">";
|
||||
|
||||
foreach($fields as $aField)
|
||||
{
|
||||
echo "<input TYPE=\"HIDDEN\" NAME=\"fields[]\" VALUE=\"$aField\">";
|
||||
}
|
||||
|
||||
echo "<input TYPE=\"HIDDEN\" NAME=\"join\" VALUE=\"$join\">";
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- start of App query -->
|
||||
<table border=1 width="100%" cellspacing=0 cellpadding=3 bordercolor=black>
|
||||
<tr>
|
||||
<th class="box-title">Search Apps by Vendor
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box-body">
|
||||
<form ACTION="stdquery.php" METHOD="get">
|
||||
Vendor Name:
|
||||
<input TYPE="TEXT" NAME="searchfor" /> (leave blank to match all)
|
||||
<?php
|
||||
include(BASE."include/"."appbyvendor.php");
|
||||
|
||||
output_appbyvendor_forminputs();
|
||||
|
||||
?>
|
||||
<br><br>
|
||||
<input type=checkbox name=verbose value=yes> Verbose query results <br>
|
||||
<? if(havepriv("admin")) echo "<input type=checkbox name=mode value=edit> Edit mode <br>\n"; ?>
|
||||
|
||||
<br>Entries Per Page:
|
||||
<select NAME="linesPerPage">
|
||||
<option>50
|
||||
<option>100
|
||||
<option>150
|
||||
<option>200
|
||||
<option>500
|
||||
<option>ALL
|
||||
</select>
|
||||
<br /> <input TYPE="SUBMIT" VALUE="List Apps" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- end of App query -->
|
||||
@@ -1,51 +0,0 @@
|
||||
<!-- start of App query -->
|
||||
<table border=1 width="100%" cellspacing=0 cellpadding=3 bordercolor=black>
|
||||
<tr>
|
||||
<th class="box-title">Search Apps
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box-body">
|
||||
<form ACTION="stdquery.php" METHOD="get">
|
||||
<input TYPE="HIDDEN" NAME="orderby" VALUE="appId" />
|
||||
App Name:
|
||||
<input TYPE="TEXT" NAME="searchfor" /> (leave blank to match all)
|
||||
<input TYPE="HIDDEN" NAME="searchwhat" VALUE="appFamily.appName" />
|
||||
<input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.appId" />
|
||||
<input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.appName" />
|
||||
<input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.webPage" />
|
||||
<br /><br />
|
||||
<input type=checkbox name=verbose value=yes /> Verbose query results <br />
|
||||
<?php if(havepriv("admin")) echo "<input type=checkbox name=mode value=edit /> Edit mode <br />\n"; ?>
|
||||
|
||||
<br />Rating
|
||||
<select NAME="rating">
|
||||
<option>ANY
|
||||
<option>1
|
||||
<option>2
|
||||
<option>3
|
||||
<option>4
|
||||
<option>5
|
||||
</select> or higher
|
||||
|
||||
<select NAME="system">
|
||||
<option>ANY
|
||||
<option value=windows> Windows
|
||||
<option value=fake> Fake Windows
|
||||
</select>
|
||||
|
||||
<br />Entries Per Page:
|
||||
<select NAME="linesPerPage">
|
||||
<option>50
|
||||
<option>100
|
||||
<option>150
|
||||
<option>200
|
||||
<option>500
|
||||
<option>ALL
|
||||
</select>
|
||||
<br /> <input TYPE="SUBMIT" VALUE="List Apps">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- end of App query -->
|
||||
@@ -1,34 +0,0 @@
|
||||
<!-- start of Vendor query -->
|
||||
<table border=1 width="100%" cellspacing=0 cellpadding=3 bordercolor=black>
|
||||
<tr>
|
||||
<th class="box-title">Search Vendors</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box-body">
|
||||
<form ACTION="stdquery.php" METHOD="get">
|
||||
<input TYPE="HIDDEN" NAME="orderby" VALUE="vendorId">
|
||||
Pattern:
|
||||
<input TYPE="TEXT" NAME="searchfor"> (leave blank to match all)
|
||||
<input TYPE="HIDDEN" NAME="searchwhat" VALUE="vendor.vendorName">
|
||||
<input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorId">
|
||||
<input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorName">
|
||||
<input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorURL">
|
||||
<br /><br />
|
||||
<input type=checkbox name=verbose value=yes> Verbose query results <br />
|
||||
<?php if(havepriv("admin")) echo "<input type=checkbox name=mode value=edit> Edit mode <br />\n"; ?>
|
||||
|
||||
<br />Entries Per Page:
|
||||
<select NAME="linesPerPage">
|
||||
<option>50
|
||||
<option>100
|
||||
<option>150
|
||||
<option>200
|
||||
<option>500
|
||||
<option>ALL
|
||||
</select>
|
||||
<br /> <input TYPE="SUBMIT" VALUE="List Vendors">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- end of Vendor query -->
|
||||
131
stdquery.php
131
stdquery.php
@@ -1,131 +0,0 @@
|
||||
<?php
|
||||
/**************************/
|
||||
/* FIXME: add description */
|
||||
/**************************/
|
||||
|
||||
/*
|
||||
* application environment
|
||||
*/
|
||||
include("path.php");
|
||||
require(BASE."include/"."incl.php");
|
||||
require(BASE."include/"."qclass.php");
|
||||
require(BASE."include/"."pn_buttons.php");
|
||||
|
||||
/*
|
||||
arguments to this script:
|
||||
|
||||
$fields[]
|
||||
$implementations[]
|
||||
*/
|
||||
|
||||
opendb();
|
||||
|
||||
|
||||
if(loggedin())
|
||||
{
|
||||
if($_SESSION['current']->getpref("query:hide_header") == "yes")
|
||||
disable_header();
|
||||
if($_SESSION['current']->getpref("query:hide_sidebar") == "yes")
|
||||
disable_sidebar();
|
||||
}
|
||||
|
||||
|
||||
// create $vars object
|
||||
$vars = $_GET;
|
||||
$qc = new qclass();
|
||||
$qc->process($vars);
|
||||
$query = $qc->get_query();
|
||||
|
||||
|
||||
// set default lines per page
|
||||
if(!$linesPerPage)
|
||||
{
|
||||
$linesPerPage = 20;
|
||||
}
|
||||
$vars["linesPerPage"] = $linesPerPage;
|
||||
|
||||
|
||||
// set default currrent posistion
|
||||
if(!$curPos)
|
||||
{
|
||||
$curPos = 0;
|
||||
}
|
||||
$vars["curPos"] = $curPos;
|
||||
|
||||
|
||||
// Get total count
|
||||
if($totalCount == 0)
|
||||
{
|
||||
$tempResult = mysql_query($query);
|
||||
if(!$tempResult)
|
||||
{
|
||||
echo "$query <br />\n";
|
||||
echo "An error occurred: ".mysql_error()."<p>";
|
||||
exit;
|
||||
}
|
||||
$totalCount = mysql_num_rows($tempResult);
|
||||
$vars["totalCount"] = $totalCount;
|
||||
mysql_free_result($tempResult);
|
||||
}
|
||||
|
||||
// No data
|
||||
if($totalCount == 0)
|
||||
{
|
||||
if(debugging())
|
||||
{
|
||||
echo $query;
|
||||
echo "<br /><br />";
|
||||
}
|
||||
|
||||
echo "Your query returned no data.</body></html>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$endPos=$curPos+$linesPerPage;
|
||||
|
||||
|
||||
if($verbose)
|
||||
{
|
||||
// verbose view (edit mode)
|
||||
|
||||
include(BASE."include/"."tableve.php");
|
||||
if(!$mode)
|
||||
$mode = "view";
|
||||
apidb_header(ucfirst($mode)." Query");
|
||||
|
||||
$t = new TableVE($mode);
|
||||
$query = str_replace("\\", "", $query);
|
||||
|
||||
$endPos = $curPos + $linesPerPage;
|
||||
$query .= " LIMIT $curPos,$endPos";
|
||||
|
||||
if(debugging())
|
||||
echo "$query <br /><br />\n";
|
||||
|
||||
add_pn_buttons($vars, $endPos);
|
||||
echo "<br /> curPos: $curPos <br /> linesPerPage: $linesPerPage <br /> totalCount: $totalCount <br />";
|
||||
|
||||
if($mode == "edit")
|
||||
$t->edit($query);
|
||||
else
|
||||
$t->view($query);
|
||||
|
||||
add_pn_buttons($vars, $endPos);
|
||||
|
||||
apidb_footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
// normal view (user view)
|
||||
|
||||
apidb_header("Query Results");
|
||||
|
||||
include(BASE."include/"."query.php");
|
||||
|
||||
twinedb_query($query, $vars);
|
||||
|
||||
apidb_footer();
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user