index : archweb32 | |
Archlinux32 website | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | buildmaster/statistics.php | 30 | ||||
-rw-r--r-- | lib/mysql.php | 11 |
diff --git a/buildmaster/statistics.php b/buildmaster/statistics.php index 05d06c6..7d706c6 100644 --- a/buildmaster/statistics.php +++ b/buildmaster/statistics.php @@ -2,29 +2,23 @@ require_once "../init.php"; require_once BASE . "/lib/mysql.php"; -if (array_key_exists("from",$_GET)) +if (array_key_exists("from", $_GET)) $min_time="from_base64(\"" . base64_encode("-".$_GET["from"]) . "\")"; else $min_time="\"-7 00:00:00\""; -if (array_key_exists("arch",$_GET)) { - $arch_filter="`architectures`.`name` IN (\"\""; - foreach (explode("&",$_SERVER["QUERY_STRING"]) as $param) { - if (strpos($param,"arch=")!==0) - continue; - $arch_filter .= ",from_base64(\"" . base64_encode(substr($param,5)) . "\")"; - } - $arch_filter .= ")"; - $combiner_left=""; - $combiner_right=""; - $grouper=""; - $joiner=" JOIN `architectures` ON `statistics`.`architecture`=`architectures`.`id`"; +if (array_key_exists("arch", $_GET)) { + $arch_filter = arch_filter_query("architectures"); + $combiner_left = ""; + $combiner_right = ""; + $grouper = ""; + $joiner = " JOIN `architectures` ON `statistics`.`architecture`=`architectures`.`id`"; } else { - $arch_filter="1"; - $combiner_left="SUM("; - $combiner_right=")"; - $grouper=" GROUP BY `statistics`.`date`"; - $joiner=""; + $arch_filter = "1"; + $combiner_left = "SUM("; + $combiner_right = ")"; + $grouper = " GROUP BY `statistics`.`date`"; + $joiner = ""; }; $column_list = array( diff --git a/lib/mysql.php b/lib/mysql.php index 2193ab1..ca683d8 100644 --- a/lib/mysql.php +++ b/lib/mysql.php @@ -87,3 +87,14 @@ function mysql_query_package_version($table) { ")" . ")"; } + +function arch_filter_query($table) { + $arch_filter="`" . $table . "`.`name` IN (\"\""; + foreach (explode("&", $_SERVER["QUERY_STRING"]) as $param) { + if (strpos($param, "arch=")!==0) + continue; + $arch_filter .= ",from_base64(\"" . base64_encode(substr($param,5)) . "\")"; + } + $arch_filter .= ")"; + return $arch_filter; +} |