From 1c3eb159945e8f4c0f9006498c93cdcc19724cb9 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 27 Mar 2019 11:46:35 +0100 Subject: buildmaster/statistics.php: arch_filter_query() separated into lib/mysel.php --- buildmaster/statistics.php | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'buildmaster') 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( -- cgit v1.2.3