Merge lp:~t7-vla7-lz/psiphon/psiphon into lp:psiphon

Proposed by Vlad
Status: Merged
Merged at revision: 345
Proposed branch: lp:~t7-vla7-lz/psiphon/psiphon
Merge into: lp:psiphon
Diff against target: 417 lines (+80/-86)
7 files modified
trunk/sql/upgrades/upgrade-2.7.015.sql (+29/-0)
trunk/www/admin/summary_report.php (+2/-2)
trunk/www/admin/usage_report.php (+10/-10)
trunk/www/download.php (+1/-1)
trunk/www/includes/geoip_helpers.php (+4/-4)
trunk/www/includes/html_helpers.php (+1/-1)
trunk/www/reports.php (+33/-68)
To merge this branch: bzr merge lp:~t7-vla7-lz/psiphon/psiphon
Reviewer Review Type Date Requested Status
e.fryntov Approve
Review via email: mp+224893@code.launchpad.net
To post a comment you must log in.
Revision history for this message
e.fryntov (e-fryntov) wrote :

Looks fine to me

review: Approve
lp:~t7-vla7-lz/psiphon/psiphon updated
345. By e-fryntov

Merged Vlad's date changes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'trunk/sql/upgrades/upgrade-2.7.015.sql'
--- trunk/sql/upgrades/upgrade-2.7.015.sql 1970-01-01 00:00:00 +0000
+++ trunk/sql/upgrades/upgrade-2.7.015.sql 2014-06-27 19:39:57 +0000
@@ -0,0 +1,29 @@
1alter table stat_account_created add column date_old int after date;
2update stat_account_created set date_old=date;
3update stat_account_created set date=from_unixtime(date_old, "%Y%m%d");
4alter table stat_account_created change date date date;
5alter table stat_account_created drop column date_old;
6
7alter table stat_blue_bar_submit add column date_old int after date;
8update stat_blue_bar_submit set date_old=date;
9update stat_blue_bar_submit set date=from_unixtime(date_old, "%Y%m%d");
10alter table stat_blue_bar_submit change date date date;
11alter table stat_blue_bar_submit drop column date_old;
12
13alter table stat_client_download add column date_old int after date;
14update stat_client_download set date_old=date;
15update stat_client_download set date=from_unixtime(date_old, "%Y%m%d");
16alter table stat_client_download change date date date;
17alter table stat_client_download drop column date_old;
18
19alter table stat_region add column date_old int after date;
20update stat_region set date_old=date;
21update stat_region set date=from_unixtime(date_old, "%Y%m%d");
22alter table stat_region change date date date;
23alter table stat_region drop column date_old;
24
25alter table stat_site add column date_old int after date;
26update stat_site set date_old=date;
27update stat_site set date=from_unixtime(date_old, "%Y%m%d");
28alter table stat_site change date date date;
29alter table stat_site drop column date_old;
030
=== modified file 'trunk/www/admin/summary_report.php'
--- trunk/www/admin/summary_report.php 2011-09-23 16:53:03 +0000
+++ trunk/www/admin/summary_report.php 2014-06-27 19:39:57 +0000
@@ -150,7 +150,7 @@
150 $common_where_clause .= " AND ";150 $common_where_clause .= " AND ";
151 }151 }
152152
153 $common_date_from_clause = "(date >= UNIX_TIMESTAMP(DATE(:filter_date_from)))";153 $common_date_from_clause = "(date >= :filter_date_from)";
154 $common_where_clause .= $common_date_from_clause;154 $common_where_clause .= $common_date_from_clause;
155 $common_where_clause_params[':filter_date_from'] = $filter_date_from;155 $common_where_clause_params[':filter_date_from'] = $filter_date_from;
156 }156 }
@@ -162,7 +162,7 @@
162 $common_where_clause .= " AND ";162 $common_where_clause .= " AND ";
163 }163 }
164164
165 $common_date_to_clause = "(date < UNIX_TIMESTAMP(DATE(:filter_date_to)))";165 $common_date_to_clause = "(date <= :filter_date_to)";
166 $common_where_clause .= $common_date_to_clause;166 $common_where_clause .= $common_date_to_clause;
167 $common_where_clause_params[':filter_date_to'] = $filter_date_to;167 $common_where_clause_params[':filter_date_to'] = $filter_date_to;
168 }168 }
169169
=== modified file 'trunk/www/admin/usage_report.php'
--- trunk/www/admin/usage_report.php 2011-09-23 16:53:03 +0000
+++ trunk/www/admin/usage_report.php 2014-06-27 19:39:57 +0000
@@ -92,7 +92,7 @@
92 $common_where_clause .= " AND ";92 $common_where_clause .= " AND ";
93 }93 }
9494
95 $common_date_from_clause = "FROM_UNIXTIME(date, '%Y-%m') >= :filter_date_from";95 $common_date_from_clause = "DATE_FORMAT(date, '%Y-%m') >= :filter_date_from";
96 $common_where_clause .= $common_date_from_clause;96 $common_where_clause .= $common_date_from_clause;
97 $common_where_clause_params[':filter_date_from'] = $filter_date_from;97 $common_where_clause_params[':filter_date_from'] = $filter_date_from;
98 }98 }
@@ -104,7 +104,7 @@
104 $common_where_clause .= " AND ";104 $common_where_clause .= " AND ";
105 }105 }
106106
107 $common_date_to_clause = "FROM_UNIXTIME(date, '%Y-%m') <= :filter_date_to";107 $common_date_to_clause = "DATE_FORMAT(date, '%Y-%m') <= :filter_date_to";
108 $common_where_clause .= $common_date_to_clause;108 $common_where_clause .= $common_date_to_clause;
109 $common_where_clause_params[':filter_date_to'] = $filter_date_to;109 $common_where_clause_params[':filter_date_to'] = $filter_date_to;
110 }110 }
@@ -113,15 +113,15 @@
113 $all_days_in_range =113 $all_days_in_range =
114 get_seq_dates(114 get_seq_dates(
115 $config,115 $config,
116 "(SELECT FROM_UNIXTIME(MIN(date), '%Y-%m-%d') FROM stat_region ".(strlen($common_date_from_clause) ? " WHERE ".$common_date_from_clause : "").")",116 "(SELECT DATE_FORMAT(MIN(date), '%Y-%m-%d') FROM stat_region ".(strlen($common_date_from_clause) ? " WHERE ".$common_date_from_clause : "").")",
117 "(SELECT FROM_UNIXTIME(MAX(date), '%Y-%m-%d') FROM stat_region ".(strlen($common_date_to_clause) ? " WHERE ".$common_date_to_clause : "").")",117 "(SELECT DATE_FORMAT(MAX(date), '%Y-%m-%d') FROM stat_region ".(strlen($common_date_to_clause) ? " WHERE ".$common_date_to_clause : "").")",
118 strlen($common_date_from_clause) ? $common_where_clause_params : array(),118 strlen($common_date_from_clause) ? $common_where_clause_params : array(),
119 false);119 false);
120 $all_months_in_range =120 $all_months_in_range =
121 get_seq_dates(121 get_seq_dates(
122 $config,122 $config,
123 "(SELECT FROM_UNIXTIME(MIN(date), '%Y-%m-%d') FROM stat_region ".(strlen($common_date_from_clause) ? " WHERE ".$common_date_from_clause : "").")",123 "(SELECT DATE_FORMAT(MIN(date), '%Y-%m-%d') FROM stat_region ".(strlen($common_date_from_clause) ? " WHERE ".$common_date_from_clause : "").")",
124 "(SELECT FROM_UNIXTIME(MAX(date), '%Y-%m-%d') FROM stat_region ".(strlen($common_date_to_clause) ? " WHERE ".$common_date_to_clause : "").")",124 "(SELECT DATE_FORMAT(MAX(date), '%Y-%m-%d') FROM stat_region ".(strlen($common_date_to_clause) ? " WHERE ".$common_date_to_clause : "").")",
125 strlen($common_date_from_clause) ? $common_where_clause_params : array(),125 strlen($common_date_from_clause) ? $common_where_clause_params : array(),
126 true);126 true);
127127
@@ -134,7 +134,7 @@
134 $query =134 $query =
135 "SELECT MAX(count) AS count, DATE_FORMAT(day, '%Y-%m') AS month, region FROM (".135 "SELECT MAX(count) AS count, DATE_FORMAT(day, '%Y-%m') AS month, region FROM (".
136 "SELECT ".136 "SELECT ".
137 "FROM_UNIXTIME(date, '%Y-%m-%d') AS day, ".137 "DATE_FORMAT(date, '%Y-%m-%d') AS day, ".
138 "SUM(COALESCE(cnt, 0)) AS count, ".138 "SUM(COALESCE(cnt, 0)) AS count, ".
139 "region ".139 "region ".
140 "FROM stat_region ".140 "FROM stat_region ".
@@ -155,7 +155,7 @@
155 155
156 $query =156 $query =
157 "SELECT ".157 "SELECT ".
158 "FROM_UNIXTIME(date, '%Y-%m-%d') AS day, ".158 "DATE_FORMAT(date, '%Y-%m-%d') AS day, ".
159 "SUM(COALESCE(cnt, 0)) AS count, ".159 "SUM(COALESCE(cnt, 0)) AS count, ".
160 "region ".160 "region ".
161 "FROM stat_region ".161 "FROM stat_region ".
@@ -175,7 +175,7 @@
175 $query =175 $query =
176 "SELECT SUM(count) AS count, DATE_FORMAT(day, '%Y-%m') AS month, region FROM (".176 "SELECT SUM(count) AS count, DATE_FORMAT(day, '%Y-%m') AS month, region FROM (".
177 "SELECT ".177 "SELECT ".
178 "FROM_UNIXTIME(date, '%Y-%m-%d') AS day, ".178 "DATE_FORMAT(date, '%Y-%m-%d') AS day, ".
179 "SUM(COALESCE(cnt, 0)) AS count, ".179 "SUM(COALESCE(cnt, 0)) AS count, ".
180 "region ".180 "region ".
181 "FROM stat_region ".181 "FROM stat_region ".
@@ -197,7 +197,7 @@
197 $query =197 $query =
198 "SELECT SUM(count) AS count, DATE_FORMAT(day, '%Y-%m') AS month, region FROM (".198 "SELECT SUM(count) AS count, DATE_FORMAT(day, '%Y-%m') AS month, region FROM (".
199 "SELECT ".199 "SELECT ".
200 "FROM_UNIXTIME(date, '%Y-%m-%d') AS day, ".200 "DATE_FORMAT(date, '%Y-%m-%d') AS day, ".
201 "SUM(COALESCE(cnt, 0)) AS count, ".201 "SUM(COALESCE(cnt, 0)) AS count, ".
202 "region ".202 "region ".
203 "FROM stat_site ".203 "FROM stat_site ".
204204
=== modified file 'trunk/www/download.php'
--- trunk/www/download.php 2011-08-18 19:27:14 +0000
+++ trunk/www/download.php 2014-06-27 19:39:57 +0000
@@ -46,7 +46,7 @@
46// existing record is found for that key, the counter is incremented. Otherwise, a new46// existing record is found for that key, the counter is incremented. Otherwise, a new
47// record is created.47// record is created.
4848
49$date = mktime(0, 0, 1, date("m"), date("j"), date("Y"));49$date = strftime("%Y-%m-%d");
5050
51$region = lookup_region($config);51$region = lookup_region($config);
5252
5353
=== modified file 'trunk/www/includes/geoip_helpers.php'
--- trunk/www/includes/geoip_helpers.php 2013-01-16 18:47:58 +0000
+++ trunk/www/includes/geoip_helpers.php 2014-06-27 19:39:57 +0000
@@ -74,7 +74,7 @@
74 // matching will reflect the keywords in place on the day of the event. Note74 // matching will reflect the keywords in place on the day of the event. Note
75 // the COALESCE as certain users may not have a valid assigned proxy id.75 // the COALESCE as certain users may not have a valid assigned proxy id.
7676
77 $date = mktime(0, 0, 1, date("m"), date("j"), date("Y"));77 $date = strftime("%Y-%m-%d");
7878
79 $query = "UPDATE stat_region JOIN proxy ON stat_region.proxy = proxy.id " .79 $query = "UPDATE stat_region JOIN proxy ON stat_region.proxy = proxy.id " .
80 "SET cnt=cnt+1, ".80 "SET cnt=cnt+1, ".
@@ -106,7 +106,7 @@
106 //106 //
107 // See comment above. Has an additional key attribute, the site visited.107 // See comment above. Has an additional key attribute, the site visited.
108108
109 $date = mktime(0, 0, 1, date("m"), date("j"), date("Y"));109 $date = strftime("%Y-%m-%d");
110110
111 $query = "UPDATE stat_site JOIN proxy ON stat_site.proxy = proxy.id " .111 $query = "UPDATE stat_site JOIN proxy ON stat_site.proxy = proxy.id " .
112 "SET cnt=cnt+1, ".112 "SET cnt=cnt+1, ".
@@ -135,7 +135,7 @@
135 //135 //
136 // See comment above. Has an additional key attribute, the site visited.136 // See comment above. Has an additional key attribute, the site visited.
137137
138 $date = mktime(0, 0, 1, date("m"), date("j"), date("Y"));138 $date = strftime("%Y-%m-%d");
139139
140 $query = "UPDATE stat_blue_bar_submit JOIN proxy ON stat_blue_bar_submit.proxy = proxy.id " .140 $query = "UPDATE stat_blue_bar_submit JOIN proxy ON stat_blue_bar_submit.proxy = proxy.id " .
141 "SET cnt=cnt+1, ".141 "SET cnt=cnt+1, ".
@@ -164,7 +164,7 @@
164 //164 //
165 // See comment above.165 // See comment above.
166166
167 $date = mktime(0, 0, 1, date("m"), date("j"), date("Y"));167 $date = strftime("%Y-%m-%d");
168168
169 $query = "UPDATE stat_account_created JOIN proxy ON stat_account_created.proxy = proxy.id " .169 $query = "UPDATE stat_account_created JOIN proxy ON stat_account_created.proxy = proxy.id " .
170 "SET cnt=cnt+1, ".170 "SET cnt=cnt+1, ".
171171
=== modified file 'trunk/www/includes/html_helpers.php'
--- trunk/www/includes/html_helpers.php 2011-09-23 17:03:34 +0000
+++ trunk/www/includes/html_helpers.php 2014-06-27 19:39:57 +0000
@@ -58,7 +58,7 @@
5858
59 if (($selected_value !== Null) && ($selected_value == $value))59 if (($selected_value !== Null) && ($selected_value == $value))
60 {60 {
61 echo "selected=1";61 echo " selected";
62 }62 }
6363
64 if ($transform_func)64 if ($transform_func)
6565
=== modified file 'trunk/www/reports.php'
--- trunk/www/reports.php 2011-03-31 22:05:47 +0000
+++ trunk/www/reports.php 2014-06-27 19:39:57 +0000
@@ -26,20 +26,20 @@
26 include($_SERVER[DOCUMENT_ROOT]."/http-errors/403.php");26 include($_SERVER[DOCUMENT_ROOT]."/http-errors/403.php");
27}27}
2828
29if (!$_GET["mf"]) {29if (!isset($_GET["rep"])) {
30 $_GET["mf"]=date("n"); $_GET["df"]=date("d"); $_GET["yf"]=date("Y");30 $_GET["df"]=strftime("%Y-%m-%d");
31 $_GET["mt"]=date("n"); $_GET["dt"]=date("d"); $_GET["yt"]=date("Y");31 $_GET["dt"]=strftime("%Y-%m-%d");
32 $_GET["ord"]=0;32 $_GET["ord"]=0;
33 $_GET["proxy"]=0;33 $_GET["proxy"]=0;
34 }34 }
35else {35else {
36 foreach (array("mf", "df", "yf", "mt", "dt", "yt", "rep", "ord", "proxy") as $var) {36 foreach (array("rep", "ord", "proxy") as $var) {
37 $_GET[$var]=(int)$_GET[$var];37 $_GET[$var]=(int)$_GET[$var];
38 }38 }
39 // current report query39 // current report query
40 $q="rep={$_GET["rep"]}&amp;".40 $q="rep={$_GET["rep"]}&amp;".
41 $q.="mf={$_GET["mf"]}&amp;df={$_GET["df"]}&amp;yf={$_GET["yf"]}&amp;";41 $q.="df={$_GET["df"]}&amp;";
42 $q.="mt={$_GET["mt"]}&amp;dt={$_GET["dt"]}&amp;yt={$_GET["yt"]}&amp;";42 $q.="dt={$_GET["dt"]}&amp;";
43 $q.="proxy={$_GET["proxy"]}";43 $q.="proxy={$_GET["proxy"]}";
44 }44 }
4545
@@ -47,11 +47,11 @@
4747
48$sql_params = array();48$sql_params = array();
4949
50$from = mktime( 0, 0, 0,$_GET["mf"],$_GET["df"],$_GET["yf"]);50$from = $_GET["df"];
51$to = mktime(23,59,59,$_GET["mt"],$_GET["dt"],$_GET["yt"]);51$to = $_GET["dt"];
5252
53// Don't use "date" in the param name, since there's a str_replace done on that string below.53// Don't use "date" in the param name, since there's a str_replace done on that string below.
54$date_cond = "date > :dt_from AND date < :dt_to";54$date_cond = "date >= :dt_from AND date <= :dt_to";
55$sql_params[':dt_from'] = $from;55$sql_params[':dt_from'] = $from;
56$sql_params[':dt_to'] = $to;56$sql_params[':dt_to'] = $to;
5757
@@ -91,84 +91,86 @@
9191
92// Handle group 4, Anonymous Users92// Handle group 4, Anonymous Users
93// The default_sort_field is a 1-based index.93// The default_sort_field is a 1-based index.
94/*
94array(95array(
95 "report_title" => ___("Last logins"),96 "report_title" => ___("Last logins"),
96 "query" => "SELECT IF(grp = '".get_anonymous_user_class_id()."', '".get_user_class_name(get_anonymous_user_class_id())."', uname) AS report_01_0, IF(last, FROM_UNIXTIME(last, \"%Y-%m-%d %H:%i:%S\"), \"-\") as report_01_1 from user LEFT OUTER JOIN userproxy ON user.id = userproxy.userid where ".str_replace("date", "last", $date_cond)." and {$user_table_proxy_cond} GROUP BY uname",97 "query" => "SELECT IF(grp = '".get_anonymous_user_class_id()."', '".get_user_class_name(get_anonymous_user_class_id())."', uname) AS report_01_0, IF(last, DATE_FORMAT(last, \"%Y-%m-%d\"), \"-\") as report_01_1 from user LEFT OUTER JOIN userproxy ON user.id = userproxy.userid where ".str_replace("date", "last", $date_cond)." and {$user_table_proxy_cond} GROUP BY uname",
97 "default_sort_field" => "2",98 "default_sort_field" => "2",
98 "total_field_count" => "2"),99 "total_field_count" => "2"),
100*/
99101
100array(102array(
101 "report_title" => ___("Region logins by day"),103 "report_title" => ___("Region logins by day"),
102 "query" => "SELECT FROM_UNIXTIME(date, '%Y-%m-%d') AS report_02_0, region AS report_02_1, SUM(cnt) AS report_02_2 FROM stat_region WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_02_0, region",104 "query" => "SELECT DATE_FORMAT(date, '%Y-%m-%d') AS report_02_0, region AS report_02_1, SUM(cnt) AS report_02_2 FROM stat_region WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_02_0, region",
103 "default_sort_field" => "1",105 "default_sort_field" => "1",
104 "total_field_count" => "3"),106 "total_field_count" => "3"),
105107
106array(108array(
107 "report_title" => ___("Region logins by month"),109 "report_title" => ___("Region logins by month"),
108 "query" => "SELECT FROM_UNIXTIME(date, '%Y-%m') AS report_02_0, region AS report_02_1, SUM(cnt) AS report_02_2 FROM stat_region WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_02_0, region",110 "query" => "SELECT DATE_FORMAT(date, '%Y-%m') AS report_02_0, region AS report_02_1, SUM(cnt) AS report_02_2 FROM stat_region WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_02_0, region",
109 "default_sort_field" => "1",111 "default_sort_field" => "1",
110 "total_field_count" => "3"),112 "total_field_count" => "3"),
111113
112array(114array(
113 "report_title" => ___("Region logins by year"), 115 "report_title" => ___("Region logins by year"),
114 "query" => "SELECT FROM_UNIXTIME(date, '%Y') AS report_02_0, region AS report_02_1, SUM(cnt) AS report_02_2 FROM stat_region WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_02_0, region",116 "query" => "SELECT DATE_FORMAT(date, '%Y') AS report_02_0, region AS report_02_1, SUM(cnt) AS report_02_2 FROM stat_region WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_02_0, region",
115 "default_sort_field" => "1",117 "default_sort_field" => "1",
116 "total_field_count" => "3"),118 "total_field_count" => "3"),
117119
118120
119array(121array(
120 "report_title" => ___("Sites by day"), 122 "report_title" => ___("Sites by day"),
121 "query" => "SELECT FROM_UNIXTIME(date, '%Y-%m-%d') AS report_03_0, domain AS report_03_1, SUM(cnt) AS report_03_2 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_03_0, domain",123 "query" => "SELECT DATE_FORMAT(date, '%Y-%m-%d') AS report_03_0, domain AS report_03_1, SUM(cnt) AS report_03_2 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_03_0, domain",
122 "default_sort_field" => "1",124 "default_sort_field" => "1",
123 "total_field_count" => "3"),125 "total_field_count" => "3"),
124126
125array(127array(
126 "report_title" => ___("Sites by month"), 128 "report_title" => ___("Sites by month"),
127 "query" => "SELECT FROM_UNIXTIME(date, '%Y-%m') AS report_03_0, domain AS report_03_1, SUM(cnt) AS report_03_2 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_03_0, domain",129 "query" => "SELECT DATE_FORMAT(date, '%Y-%m') AS report_03_0, domain AS report_03_1, SUM(cnt) AS report_03_2 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_03_0, domain",
128 "default_sort_field" => "1",130 "default_sort_field" => "1",
129 "total_field_count" => "3"),131 "total_field_count" => "3"),
130132
131array(133array(
132 "report_title" => ___("Sites by year"), 134 "report_title" => ___("Sites by year"),
133 "query" => "SELECT FROM_UNIXTIME(date, '%Y') AS report_03_0, domain AS report_03_1, SUM(cnt) AS report_03_2 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_03_0, domain",135 "query" => "SELECT DATE_FORMAT(date, '%Y') AS report_03_0, domain AS report_03_1, SUM(cnt) AS report_03_2 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_03_0, domain",
134 "default_sort_field" => "1",136 "default_sort_field" => "1",
135 "total_field_count" => "3"),137 "total_field_count" => "3"),
136138
137139
138array(140array(
139 "report_title" => ___("Site, region by day"), 141 "report_title" => ___("Site, region by day"),
140 "query" => "SELECT FROM_UNIXTIME(date, '%Y-%m-%d') AS report_04_0, domain AS report_04_1, region AS report_04_2, SUM(cnt) AS report_04_3 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_04_0, domain, region",142 "query" => "SELECT DATE_FORMAT(date, '%Y-%m-%d') AS report_04_0, domain AS report_04_1, region AS report_04_2, SUM(cnt) AS report_04_3 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_04_0, domain, region",
141 "default_sort_field" => "1",143 "default_sort_field" => "1",
142 "total_field_count" => "4"),144 "total_field_count" => "4"),
143145
144array(146array(
145 "report_title" => ___("Site, region by month"), 147 "report_title" => ___("Site, region by month"),
146 "query" => "SELECT FROM_UNIXTIME(date, '%Y-%m') AS report_04_0, domain AS report_04_1, region AS report_04_2, SUM(cnt) AS report_04_3 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_04_0, domain, region",148 "query" => "SELECT DATE_FORMAT(date, '%Y-%m') AS report_04_0, domain AS report_04_1, region AS report_04_2, SUM(cnt) AS report_04_3 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_04_0, domain, region",
147 "default_sort_field" => "1",149 "default_sort_field" => "1",
148 "total_field_count" => "4"),150 "total_field_count" => "4"),
149151
150array(152array(
151 "report_title" => ___("Site, region by year"), 153 "report_title" => ___("Site, region by year"),
152 "query" => "SELECT FROM_UNIXTIME(date, '%Y') AS report_04_0, domain AS report_04_1, region AS report_04_2, SUM(cnt) AS report_04_3 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_04_0, domain, region",154 "query" => "SELECT DATE_FORMAT(date, '%Y') AS report_04_0, domain AS report_04_1, region AS report_04_2, SUM(cnt) AS report_04_3 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_04_0, domain, region",
153 "default_sort_field" => "1",155 "default_sort_field" => "1",
154 "total_field_count" => "4"),156 "total_field_count" => "4"),
155157
156158
157array(159array(
158 "report_title" => ___("Requests by region per day"), 160 "report_title" => ___("Requests by region per day"),
159 "query" => "SELECT FROM_UNIXTIME(date, '%Y-%m-%d') AS report_05_0, region AS report_05_1, SUM(cnt) AS report_05_2 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_05_0, region",161 "query" => "SELECT DATE_FORMAT(date, '%Y-%m-%d') AS report_05_0, region AS report_05_1, SUM(cnt) AS report_05_2 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_05_0, region",
160 "default_sort_field" => "1",162 "default_sort_field" => "1",
161 "total_field_count" => "3"),163 "total_field_count" => "3"),
162164
163array(165array(
164 "report_title" => ___("Requests by region per month"), 166 "report_title" => ___("Requests by region per month"),
165 "query" => "SELECT FROM_UNIXTIME(date, '%Y-%m') AS report_05_0, region AS report_05_1, SUM(cnt) AS report_05_2 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_05_0, region",167 "query" => "SELECT DATE_FORMAT(date, '%Y-%m') AS report_05_0, region AS report_05_1, SUM(cnt) AS report_05_2 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_05_0, region",
166 "default_sort_field" => "1",168 "default_sort_field" => "1",
167 "total_field_count" => "3"),169 "total_field_count" => "3"),
168170
169array(171array(
170 "report_title" => ___("Requests by region per year"), 172 "report_title" => ___("Requests by region per year"),
171 "query" => "SELECT FROM_UNIXTIME(date, '%Y') AS report_05_0, region AS report_05_1, SUM(cnt) AS report_05_2 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_05_0, region",173 "query" => "SELECT DATE_FORMAT(date, '%Y') AS report_05_0, region AS report_05_1, SUM(cnt) AS report_05_2 FROM stat_site WHERE {$date_cond} AND {$proxy_cond} GROUP BY report_05_0, region",
172 "default_sort_field" => "1",174 "default_sort_field" => "1",
173 "total_field_count" => "3"),175 "total_field_count" => "3"),
174176
@@ -233,6 +235,7 @@
233 $query.=" DESC";235 $query.=" DESC";
234 }236 }
235237
238//echo $query;
236 $result = db_query_execute($config, $query, convert_null_array($sql_params));239 $result = db_query_execute($config, $query, convert_null_array($sql_params));
237240
238 // Get the first record, so we'll know if there are results or not.241 // Get the first record, so we'll know if there are results or not.
@@ -264,55 +267,17 @@
264 echo_proxy_combo($config, "proxy", $_GET["proxy"], 1, ___("Any proxy"));267 echo_proxy_combo($config, "proxy", $_GET["proxy"], 1, ___("Any proxy"));
265268
266 echo ___("From")."\n";269 echo ___("From")."\n";
267 echo "<select name=\"mf\">\n";270
268 for ($j=1; $j<=12; $j++) {271 echo "<input type=\"text\" size=\"7\" maxlength=\"10\" name=\"df\" title=\"YYYY-MM-DD\"";
269 echo "<option value=\"{$j}\"";272 echo isset($_GET["df"]) ? " value=\"".htmlentities($_GET["df"], ENT_QUOTES, get_lang_xtra("charset"))."\"" : "";
270 if ($_GET["mf"]==$j) echo " selected";273 echo ">\n\n";
271 echo ">".strftime("%b",strtotime("{$j}/1/1970"))."</option>\n";
272 }
273 echo "</select> \n\n";
274
275 echo "<select name=\"df\">\n";
276 for ($j=1; $j<=31; $j++) {
277 echo "<option value=\"{$j}\"";
278 if ($_GET["df"]==$j) echo " selected";
279 echo ">{$j}</option>\n";
280 }
281 echo "</select>, \n\n";
282
283 echo "<select name=\"yf\">\n";
284 for ($j=date("Y")-4; $j<=date("Y"); $j++) {
285 echo "<option value=\"$j\"";
286 if ($_GET["yf"]==$j) echo " selected";
287 echo ">{$j}</option>\n";
288 }
289 echo "</select> \n\n";
290274
291275
292 echo ___("To")."\n";276 echo ___("To")."\n";
293 echo "<select name=\"mt\">\n";277 echo "<input type=\"text\" size=\"7\" maxlength=\"10\" name=\"dt\" title=\"YYYY-MM-DD\"";
294 for ($j=1; $j<=12; $j++) {278 echo isset($_GET["dt"]) ? " value=\"".htmlentities($_GET["dt"], ENT_QUOTES, get_lang_xtra("charset"))."\"" : "";
295 echo "<option value=\"{$j}\"";279 echo ">\n</b>\n\n";
296 if ($_GET["mt"]==$j) echo " selected";280
297 echo ">".strftime("%b",strtotime("{$j}/1/1970"))."</option>\n";
298 }
299 echo "</select> \n\n";
300
301 echo "<select name=\"dt\">\n";
302 for ($j=1; $j<=31; $j++) {
303 echo "<option value=\"{$j}\"";
304 if ($_GET["dt"]==$j) echo " selected";
305 echo ">{$j}</option>\n";
306 }
307 echo "</select>, \n\n";
308
309 echo "<select name=\"yt\">\n";
310 for ($j=date("Y")-4; $j<=date("Y"); $j++) {
311 echo "<option value=\"$j\"";
312 if ($_GET["yt"]==$j) echo " selected";
313 echo ">{$j}</option>\n";
314 }
315 echo "</select></b>\n\n";
316281
317 echo "<input type=\"submit\" value=\"".___("Display")."\">\n";282 echo "<input type=\"submit\" value=\"".___("Display")."\">\n";
318 echo "</form>\n\n";283 echo "</form>\n\n";

Subscribers

People subscribed via source and target branches

to all changes: