From 2cc48a3ca950d1a5ea20135a0c92bb6f97486b39 Mon Sep 17 00:00:00 2001 From: Paul van Schayck Date: Sat, 8 Jan 2005 18:52:49 +0000 Subject: [PATCH] Remove unused files --- include/appbyvendor.php | 58 -------- include/appversion.php | 61 --------- include/pn_buttons.php | 73 ---------- include/qclass.php | 248 ---------------------------------- include/query.php | 183 ------------------------- include/query_appbyvendor.php | 151 --------------------- include/query_apps.php | 51 ------- include/query_vendors.php | 34 ----- stdquery.php | 131 ------------------ 9 files changed, 990 deletions(-) delete mode 100644 include/appbyvendor.php delete mode 100644 include/appversion.php delete mode 100644 include/pn_buttons.php delete mode 100644 include/qclass.php delete mode 100644 include/query.php delete mode 100644 include/query_appbyvendor.php delete mode 100644 include/query_apps.php delete mode 100644 include/query_vendors.php delete mode 100644 stdquery.php diff --git a/include/appbyvendor.php b/include/appbyvendor.php deleted file mode 100644 index fe0a21b..0000000 --- a/include/appbyvendor.php +++ /dev/null @@ -1,58 +0,0 @@ - - "; - - foreach($fields as $aField) - { - echo ""; - } - - echo ""; -} - -?> diff --git a/include/appversion.php b/include/appversion.php deleted file mode 100644 index 6591fa6..0000000 --- a/include/appversion.php +++ /dev/null @@ -1,61 +0,0 @@ - - "; - - foreach($fields as $aField) - { - echo ""; - } - - echo ""; -} - -?> diff --git a/include/pn_buttons.php b/include/pn_buttons.php deleted file mode 100644 index 15cd0dc..0000000 --- a/include/pn_buttons.php +++ /dev/null @@ -1,73 +0,0 @@ - 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 "
".html_small("listing $numRows record".($numRows == 1 ? "" : "s")." ".($curPos+1)." to $endpos of $totalCount total"); -} - -?> diff --git a/include/qclass.php b/include/qclass.php deleted file mode 100644 index f360187..0000000 --- a/include/qclass.php +++ /dev/null @@ -1,248 +0,0 @@ - "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
\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]
\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); - } -} diff --git a/include/query.php b/include/query.php deleted file mode 100644 index cab9d7a..0000000 --- a/include/query.php +++ /dev/null @@ -1,183 +0,0 @@ -"; - - // Only permit sql SELECT statements - if(!eregi("^select .*$", $query)) - { - echo " Invalid SQL Query "; - echo "
$query
"; - 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 " QUERY TIME: $tstamp seconds
\n"; - - // query error! - if(!$result) - { - echo "$query

\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)", - "
\\1
", $tmpq); - echo "
$str
\n"; - } - - echo html_echo("
"); - - 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[] = "
$val
"; - } 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("
"); - - mysql_free_result($result); - closedb(); -} - - -?> - diff --git a/include/query_appbyvendor.php b/include/query_appbyvendor.php deleted file mode 100644 index a250f59..0000000 --- a/include/query_appbyvendor.php +++ /dev/null @@ -1,151 +0,0 @@ - - "; - - foreach($fields as $aField) - { - echo ""; - } - - echo ""; -} - -?> - - "; - - foreach($fields as $aField) - { - echo ""; - } - - echo ""; -} - -?> - - - - - - - - -
Search Apps by Vendor -
-
- Vendor Name: - (leave blank to match all) - -

- Verbose query results
- Edit mode
\n"; ?> - -
Entries Per Page: - -
-
-
- diff --git a/include/query_apps.php b/include/query_apps.php deleted file mode 100644 index c5dd288..0000000 --- a/include/query_apps.php +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - -
Search Apps -
-
- - App Name: - (leave blank to match all) - - - - -

- Verbose query results
- Edit mode
\n"; ?> - -
Rating - or higher - - - -
Entries Per Page: - -
-
-
- diff --git a/include/query_vendors.php b/include/query_vendors.php deleted file mode 100644 index acf64fb..0000000 --- a/include/query_vendors.php +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - -
Search Vendors
-
- - Pattern: - (leave blank to match all) - - - - -

- Verbose query results
- Edit mode
\n"; ?> - -
Entries Per Page: - -
-
-
- diff --git a/stdquery.php b/stdquery.php deleted file mode 100644 index 1d53ea0..0000000 --- a/stdquery.php +++ /dev/null @@ -1,131 +0,0 @@ -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
\n"; - echo "An error occurred: ".mysql_error()."

"; - exit; - } - $totalCount = mysql_num_rows($tempResult); - $vars["totalCount"] = $totalCount; - mysql_free_result($tempResult); -} - -// No data -if($totalCount == 0) -{ - if(debugging()) - { - echo $query; - echo "

"; - } - - echo "Your query returned no data.\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

\n"; - - add_pn_buttons($vars, $endPos); - echo "
curPos: $curPos
linesPerPage: $linesPerPage
totalCount: $totalCount
"; - - 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(); -} - - -?>