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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
e.fryntov | Approve | ||
Review via email: mp+224893@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
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
1 | === added file 'trunk/sql/upgrades/upgrade-2.7.015.sql' | |||
2 | --- trunk/sql/upgrades/upgrade-2.7.015.sql 1970-01-01 00:00:00 +0000 | |||
3 | +++ trunk/sql/upgrades/upgrade-2.7.015.sql 2014-06-27 19:39:57 +0000 | |||
4 | @@ -0,0 +1,29 @@ | |||
5 | 1 | alter table stat_account_created add column date_old int after date; | ||
6 | 2 | update stat_account_created set date_old=date; | ||
7 | 3 | update stat_account_created set date=from_unixtime(date_old, "%Y%m%d"); | ||
8 | 4 | alter table stat_account_created change date date date; | ||
9 | 5 | alter table stat_account_created drop column date_old; | ||
10 | 6 | |||
11 | 7 | alter table stat_blue_bar_submit add column date_old int after date; | ||
12 | 8 | update stat_blue_bar_submit set date_old=date; | ||
13 | 9 | update stat_blue_bar_submit set date=from_unixtime(date_old, "%Y%m%d"); | ||
14 | 10 | alter table stat_blue_bar_submit change date date date; | ||
15 | 11 | alter table stat_blue_bar_submit drop column date_old; | ||
16 | 12 | |||
17 | 13 | alter table stat_client_download add column date_old int after date; | ||
18 | 14 | update stat_client_download set date_old=date; | ||
19 | 15 | update stat_client_download set date=from_unixtime(date_old, "%Y%m%d"); | ||
20 | 16 | alter table stat_client_download change date date date; | ||
21 | 17 | alter table stat_client_download drop column date_old; | ||
22 | 18 | |||
23 | 19 | alter table stat_region add column date_old int after date; | ||
24 | 20 | update stat_region set date_old=date; | ||
25 | 21 | update stat_region set date=from_unixtime(date_old, "%Y%m%d"); | ||
26 | 22 | alter table stat_region change date date date; | ||
27 | 23 | alter table stat_region drop column date_old; | ||
28 | 24 | |||
29 | 25 | alter table stat_site add column date_old int after date; | ||
30 | 26 | update stat_site set date_old=date; | ||
31 | 27 | update stat_site set date=from_unixtime(date_old, "%Y%m%d"); | ||
32 | 28 | alter table stat_site change date date date; | ||
33 | 29 | alter table stat_site drop column date_old; | ||
34 | 0 | 30 | ||
35 | === modified file 'trunk/www/admin/summary_report.php' | |||
36 | --- trunk/www/admin/summary_report.php 2011-09-23 16:53:03 +0000 | |||
37 | +++ trunk/www/admin/summary_report.php 2014-06-27 19:39:57 +0000 | |||
38 | @@ -150,7 +150,7 @@ | |||
39 | 150 | $common_where_clause .= " AND "; | 150 | $common_where_clause .= " AND "; |
40 | 151 | } | 151 | } |
41 | 152 | 152 | ||
43 | 153 | $common_date_from_clause = "(date >= UNIX_TIMESTAMP(DATE(:filter_date_from)))"; | 153 | $common_date_from_clause = "(date >= :filter_date_from)"; |
44 | 154 | $common_where_clause .= $common_date_from_clause; | 154 | $common_where_clause .= $common_date_from_clause; |
45 | 155 | $common_where_clause_params[':filter_date_from'] = $filter_date_from; | 155 | $common_where_clause_params[':filter_date_from'] = $filter_date_from; |
46 | 156 | } | 156 | } |
47 | @@ -162,7 +162,7 @@ | |||
48 | 162 | $common_where_clause .= " AND "; | 162 | $common_where_clause .= " AND "; |
49 | 163 | } | 163 | } |
50 | 164 | 164 | ||
52 | 165 | $common_date_to_clause = "(date < UNIX_TIMESTAMP(DATE(:filter_date_to)))"; | 165 | $common_date_to_clause = "(date <= :filter_date_to)"; |
53 | 166 | $common_where_clause .= $common_date_to_clause; | 166 | $common_where_clause .= $common_date_to_clause; |
54 | 167 | $common_where_clause_params[':filter_date_to'] = $filter_date_to; | 167 | $common_where_clause_params[':filter_date_to'] = $filter_date_to; |
55 | 168 | } | 168 | } |
56 | 169 | 169 | ||
57 | === modified file 'trunk/www/admin/usage_report.php' | |||
58 | --- trunk/www/admin/usage_report.php 2011-09-23 16:53:03 +0000 | |||
59 | +++ trunk/www/admin/usage_report.php 2014-06-27 19:39:57 +0000 | |||
60 | @@ -92,7 +92,7 @@ | |||
61 | 92 | $common_where_clause .= " AND "; | 92 | $common_where_clause .= " AND "; |
62 | 93 | } | 93 | } |
63 | 94 | 94 | ||
65 | 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"; |
66 | 96 | $common_where_clause .= $common_date_from_clause; | 96 | $common_where_clause .= $common_date_from_clause; |
67 | 97 | $common_where_clause_params[':filter_date_from'] = $filter_date_from; | 97 | $common_where_clause_params[':filter_date_from'] = $filter_date_from; |
68 | 98 | } | 98 | } |
69 | @@ -104,7 +104,7 @@ | |||
70 | 104 | $common_where_clause .= " AND "; | 104 | $common_where_clause .= " AND "; |
71 | 105 | } | 105 | } |
72 | 106 | 106 | ||
74 | 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"; |
75 | 108 | $common_where_clause .= $common_date_to_clause; | 108 | $common_where_clause .= $common_date_to_clause; |
76 | 109 | $common_where_clause_params[':filter_date_to'] = $filter_date_to; | 109 | $common_where_clause_params[':filter_date_to'] = $filter_date_to; |
77 | 110 | } | 110 | } |
78 | @@ -113,15 +113,15 @@ | |||
79 | 113 | $all_days_in_range = | 113 | $all_days_in_range = |
80 | 114 | get_seq_dates( | 114 | get_seq_dates( |
81 | 115 | $config, | 115 | $config, |
84 | 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 : "").")", |
85 | 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 : "").")", |
86 | 118 | strlen($common_date_from_clause) ? $common_where_clause_params : array(), | 118 | strlen($common_date_from_clause) ? $common_where_clause_params : array(), |
87 | 119 | false); | 119 | false); |
88 | 120 | $all_months_in_range = | 120 | $all_months_in_range = |
89 | 121 | get_seq_dates( | 121 | get_seq_dates( |
90 | 122 | $config, | 122 | $config, |
93 | 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 : "").")", |
94 | 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 : "").")", |
95 | 125 | strlen($common_date_from_clause) ? $common_where_clause_params : array(), | 125 | strlen($common_date_from_clause) ? $common_where_clause_params : array(), |
96 | 126 | true); | 126 | true); |
97 | 127 | 127 | ||
98 | @@ -134,7 +134,7 @@ | |||
99 | 134 | $query = | 134 | $query = |
100 | 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 (". |
101 | 136 | "SELECT ". | 136 | "SELECT ". |
103 | 137 | "FROM_UNIXTIME(date, '%Y-%m-%d') AS day, ". | 137 | "DATE_FORMAT(date, '%Y-%m-%d') AS day, ". |
104 | 138 | "SUM(COALESCE(cnt, 0)) AS count, ". | 138 | "SUM(COALESCE(cnt, 0)) AS count, ". |
105 | 139 | "region ". | 139 | "region ". |
106 | 140 | "FROM stat_region ". | 140 | "FROM stat_region ". |
107 | @@ -155,7 +155,7 @@ | |||
108 | 155 | 155 | ||
109 | 156 | $query = | 156 | $query = |
110 | 157 | "SELECT ". | 157 | "SELECT ". |
112 | 158 | "FROM_UNIXTIME(date, '%Y-%m-%d') AS day, ". | 158 | "DATE_FORMAT(date, '%Y-%m-%d') AS day, ". |
113 | 159 | "SUM(COALESCE(cnt, 0)) AS count, ". | 159 | "SUM(COALESCE(cnt, 0)) AS count, ". |
114 | 160 | "region ". | 160 | "region ". |
115 | 161 | "FROM stat_region ". | 161 | "FROM stat_region ". |
116 | @@ -175,7 +175,7 @@ | |||
117 | 175 | $query = | 175 | $query = |
118 | 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 (". |
119 | 177 | "SELECT ". | 177 | "SELECT ". |
121 | 178 | "FROM_UNIXTIME(date, '%Y-%m-%d') AS day, ". | 178 | "DATE_FORMAT(date, '%Y-%m-%d') AS day, ". |
122 | 179 | "SUM(COALESCE(cnt, 0)) AS count, ". | 179 | "SUM(COALESCE(cnt, 0)) AS count, ". |
123 | 180 | "region ". | 180 | "region ". |
124 | 181 | "FROM stat_region ". | 181 | "FROM stat_region ". |
125 | @@ -197,7 +197,7 @@ | |||
126 | 197 | $query = | 197 | $query = |
127 | 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 (". |
128 | 199 | "SELECT ". | 199 | "SELECT ". |
130 | 200 | "FROM_UNIXTIME(date, '%Y-%m-%d') AS day, ". | 200 | "DATE_FORMAT(date, '%Y-%m-%d') AS day, ". |
131 | 201 | "SUM(COALESCE(cnt, 0)) AS count, ". | 201 | "SUM(COALESCE(cnt, 0)) AS count, ". |
132 | 202 | "region ". | 202 | "region ". |
133 | 203 | "FROM stat_site ". | 203 | "FROM stat_site ". |
134 | 204 | 204 | ||
135 | === modified file 'trunk/www/download.php' | |||
136 | --- trunk/www/download.php 2011-08-18 19:27:14 +0000 | |||
137 | +++ trunk/www/download.php 2014-06-27 19:39:57 +0000 | |||
138 | @@ -46,7 +46,7 @@ | |||
139 | 46 | // existing record is found for that key, the counter is incremented. Otherwise, a new | 46 | // existing record is found for that key, the counter is incremented. Otherwise, a new |
140 | 47 | // record is created. | 47 | // record is created. |
141 | 48 | 48 | ||
143 | 49 | $date = mktime(0, 0, 1, date("m"), date("j"), date("Y")); | 49 | $date = strftime("%Y-%m-%d"); |
144 | 50 | 50 | ||
145 | 51 | $region = lookup_region($config); | 51 | $region = lookup_region($config); |
146 | 52 | 52 | ||
147 | 53 | 53 | ||
148 | === modified file 'trunk/www/includes/geoip_helpers.php' | |||
149 | --- trunk/www/includes/geoip_helpers.php 2013-01-16 18:47:58 +0000 | |||
150 | +++ trunk/www/includes/geoip_helpers.php 2014-06-27 19:39:57 +0000 | |||
151 | @@ -74,7 +74,7 @@ | |||
152 | 74 | // matching will reflect the keywords in place on the day of the event. Note | 74 | // matching will reflect the keywords in place on the day of the event. Note |
153 | 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. |
154 | 76 | 76 | ||
156 | 77 | $date = mktime(0, 0, 1, date("m"), date("j"), date("Y")); | 77 | $date = strftime("%Y-%m-%d"); |
157 | 78 | 78 | ||
158 | 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 " . |
159 | 80 | "SET cnt=cnt+1, ". | 80 | "SET cnt=cnt+1, ". |
160 | @@ -106,7 +106,7 @@ | |||
161 | 106 | // | 106 | // |
162 | 107 | // See comment above. Has an additional key attribute, the site visited. | 107 | // See comment above. Has an additional key attribute, the site visited. |
163 | 108 | 108 | ||
165 | 109 | $date = mktime(0, 0, 1, date("m"), date("j"), date("Y")); | 109 | $date = strftime("%Y-%m-%d"); |
166 | 110 | 110 | ||
167 | 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 " . |
168 | 112 | "SET cnt=cnt+1, ". | 112 | "SET cnt=cnt+1, ". |
169 | @@ -135,7 +135,7 @@ | |||
170 | 135 | // | 135 | // |
171 | 136 | // See comment above. Has an additional key attribute, the site visited. | 136 | // See comment above. Has an additional key attribute, the site visited. |
172 | 137 | 137 | ||
174 | 138 | $date = mktime(0, 0, 1, date("m"), date("j"), date("Y")); | 138 | $date = strftime("%Y-%m-%d"); |
175 | 139 | 139 | ||
176 | 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 " . |
177 | 141 | "SET cnt=cnt+1, ". | 141 | "SET cnt=cnt+1, ". |
178 | @@ -164,7 +164,7 @@ | |||
179 | 164 | // | 164 | // |
180 | 165 | // See comment above. | 165 | // See comment above. |
181 | 166 | 166 | ||
183 | 167 | $date = mktime(0, 0, 1, date("m"), date("j"), date("Y")); | 167 | $date = strftime("%Y-%m-%d"); |
184 | 168 | 168 | ||
185 | 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 " . |
186 | 170 | "SET cnt=cnt+1, ". | 170 | "SET cnt=cnt+1, ". |
187 | 171 | 171 | ||
188 | === modified file 'trunk/www/includes/html_helpers.php' | |||
189 | --- trunk/www/includes/html_helpers.php 2011-09-23 17:03:34 +0000 | |||
190 | +++ trunk/www/includes/html_helpers.php 2014-06-27 19:39:57 +0000 | |||
191 | @@ -58,7 +58,7 @@ | |||
192 | 58 | 58 | ||
193 | 59 | if (($selected_value !== Null) && ($selected_value == $value)) | 59 | if (($selected_value !== Null) && ($selected_value == $value)) |
194 | 60 | { | 60 | { |
196 | 61 | echo "selected=1"; | 61 | echo " selected"; |
197 | 62 | } | 62 | } |
198 | 63 | 63 | ||
199 | 64 | if ($transform_func) | 64 | if ($transform_func) |
200 | 65 | 65 | ||
201 | === modified file 'trunk/www/reports.php' | |||
202 | --- trunk/www/reports.php 2011-03-31 22:05:47 +0000 | |||
203 | +++ trunk/www/reports.php 2014-06-27 19:39:57 +0000 | |||
204 | @@ -26,20 +26,20 @@ | |||
205 | 26 | include($_SERVER[DOCUMENT_ROOT]."/http-errors/403.php"); | 26 | include($_SERVER[DOCUMENT_ROOT]."/http-errors/403.php"); |
206 | 27 | } | 27 | } |
207 | 28 | 28 | ||
211 | 29 | if (!$_GET["mf"]) { | 29 | if (!isset($_GET["rep"])) { |
212 | 30 | $_GET["mf"]=date("n"); $_GET["df"]=date("d"); $_GET["yf"]=date("Y"); | 30 | $_GET["df"]=strftime("%Y-%m-%d"); |
213 | 31 | $_GET["mt"]=date("n"); $_GET["dt"]=date("d"); $_GET["yt"]=date("Y"); | 31 | $_GET["dt"]=strftime("%Y-%m-%d"); |
214 | 32 | $_GET["ord"]=0; | 32 | $_GET["ord"]=0; |
215 | 33 | $_GET["proxy"]=0; | 33 | $_GET["proxy"]=0; |
216 | 34 | } | 34 | } |
217 | 35 | else { | 35 | else { |
219 | 36 | foreach (array("mf", "df", "yf", "mt", "dt", "yt", "rep", "ord", "proxy") as $var) { | 36 | foreach (array("rep", "ord", "proxy") as $var) { |
220 | 37 | $_GET[$var]=(int)$_GET[$var]; | 37 | $_GET[$var]=(int)$_GET[$var]; |
221 | 38 | } | 38 | } |
222 | 39 | // current report query | 39 | // current report query |
223 | 40 | $q="rep={$_GET["rep"]}&". | 40 | $q="rep={$_GET["rep"]}&". |
226 | 41 | $q.="mf={$_GET["mf"]}&df={$_GET["df"]}&yf={$_GET["yf"]}&"; | 41 | $q.="df={$_GET["df"]}&"; |
227 | 42 | $q.="mt={$_GET["mt"]}&dt={$_GET["dt"]}&yt={$_GET["yt"]}&"; | 42 | $q.="dt={$_GET["dt"]}&"; |
228 | 43 | $q.="proxy={$_GET["proxy"]}"; | 43 | $q.="proxy={$_GET["proxy"]}"; |
229 | 44 | } | 44 | } |
230 | 45 | 45 | ||
231 | @@ -47,11 +47,11 @@ | |||
232 | 47 | 47 | ||
233 | 48 | $sql_params = array(); | 48 | $sql_params = array(); |
234 | 49 | 49 | ||
237 | 50 | $from = mktime( 0, 0, 0,$_GET["mf"],$_GET["df"],$_GET["yf"]); | 50 | $from = $_GET["df"]; |
238 | 51 | $to = mktime(23,59,59,$_GET["mt"],$_GET["dt"],$_GET["yt"]); | 51 | $to = $_GET["dt"]; |
239 | 52 | 52 | ||
240 | 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. |
242 | 54 | $date_cond = "date > :dt_from AND date < :dt_to"; | 54 | $date_cond = "date >= :dt_from AND date <= :dt_to"; |
243 | 55 | $sql_params[':dt_from'] = $from; | 55 | $sql_params[':dt_from'] = $from; |
244 | 56 | $sql_params[':dt_to'] = $to; | 56 | $sql_params[':dt_to'] = $to; |
245 | 57 | 57 | ||
246 | @@ -91,84 +91,86 @@ | |||
247 | 91 | 91 | ||
248 | 92 | // Handle group 4, Anonymous Users | 92 | // Handle group 4, Anonymous Users |
249 | 93 | // The default_sort_field is a 1-based index. | 93 | // The default_sort_field is a 1-based index. |
250 | 94 | /* | ||
251 | 94 | array( | 95 | array( |
252 | 95 | "report_title" => ___("Last logins"), | 96 | "report_title" => ___("Last logins"), |
254 | 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", |
255 | 97 | "default_sort_field" => "2", | 98 | "default_sort_field" => "2", |
256 | 98 | "total_field_count" => "2"), | 99 | "total_field_count" => "2"), |
257 | 100 | */ | ||
258 | 99 | 101 | ||
259 | 100 | array( | 102 | array( |
260 | 101 | "report_title" => ___("Region logins by day"), | 103 | "report_title" => ___("Region logins by day"), |
262 | 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", |
263 | 103 | "default_sort_field" => "1", | 105 | "default_sort_field" => "1", |
264 | 104 | "total_field_count" => "3"), | 106 | "total_field_count" => "3"), |
265 | 105 | 107 | ||
266 | 106 | array( | 108 | array( |
267 | 107 | "report_title" => ___("Region logins by month"), | 109 | "report_title" => ___("Region logins by month"), |
269 | 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", |
270 | 109 | "default_sort_field" => "1", | 111 | "default_sort_field" => "1", |
271 | 110 | "total_field_count" => "3"), | 112 | "total_field_count" => "3"), |
272 | 111 | 113 | ||
273 | 112 | array( | 114 | array( |
274 | 113 | "report_title" => ___("Region logins by year"), | 115 | "report_title" => ___("Region logins by year"), |
276 | 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", |
277 | 115 | "default_sort_field" => "1", | 117 | "default_sort_field" => "1", |
278 | 116 | "total_field_count" => "3"), | 118 | "total_field_count" => "3"), |
279 | 117 | 119 | ||
280 | 118 | 120 | ||
281 | 119 | array( | 121 | array( |
282 | 120 | "report_title" => ___("Sites by day"), | 122 | "report_title" => ___("Sites by day"), |
284 | 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", |
285 | 122 | "default_sort_field" => "1", | 124 | "default_sort_field" => "1", |
286 | 123 | "total_field_count" => "3"), | 125 | "total_field_count" => "3"), |
287 | 124 | 126 | ||
288 | 125 | array( | 127 | array( |
289 | 126 | "report_title" => ___("Sites by month"), | 128 | "report_title" => ___("Sites by month"), |
291 | 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", |
292 | 128 | "default_sort_field" => "1", | 130 | "default_sort_field" => "1", |
293 | 129 | "total_field_count" => "3"), | 131 | "total_field_count" => "3"), |
294 | 130 | 132 | ||
295 | 131 | array( | 133 | array( |
296 | 132 | "report_title" => ___("Sites by year"), | 134 | "report_title" => ___("Sites by year"), |
298 | 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", |
299 | 134 | "default_sort_field" => "1", | 136 | "default_sort_field" => "1", |
300 | 135 | "total_field_count" => "3"), | 137 | "total_field_count" => "3"), |
301 | 136 | 138 | ||
302 | 137 | 139 | ||
303 | 138 | array( | 140 | array( |
304 | 139 | "report_title" => ___("Site, region by day"), | 141 | "report_title" => ___("Site, region by day"), |
306 | 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", |
307 | 141 | "default_sort_field" => "1", | 143 | "default_sort_field" => "1", |
308 | 142 | "total_field_count" => "4"), | 144 | "total_field_count" => "4"), |
309 | 143 | 145 | ||
310 | 144 | array( | 146 | array( |
311 | 145 | "report_title" => ___("Site, region by month"), | 147 | "report_title" => ___("Site, region by month"), |
313 | 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", |
314 | 147 | "default_sort_field" => "1", | 149 | "default_sort_field" => "1", |
315 | 148 | "total_field_count" => "4"), | 150 | "total_field_count" => "4"), |
316 | 149 | 151 | ||
317 | 150 | array( | 152 | array( |
318 | 151 | "report_title" => ___("Site, region by year"), | 153 | "report_title" => ___("Site, region by year"), |
320 | 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", |
321 | 153 | "default_sort_field" => "1", | 155 | "default_sort_field" => "1", |
322 | 154 | "total_field_count" => "4"), | 156 | "total_field_count" => "4"), |
323 | 155 | 157 | ||
324 | 156 | 158 | ||
325 | 157 | array( | 159 | array( |
326 | 158 | "report_title" => ___("Requests by region per day"), | 160 | "report_title" => ___("Requests by region per day"), |
328 | 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", |
329 | 160 | "default_sort_field" => "1", | 162 | "default_sort_field" => "1", |
330 | 161 | "total_field_count" => "3"), | 163 | "total_field_count" => "3"), |
331 | 162 | 164 | ||
332 | 163 | array( | 165 | array( |
333 | 164 | "report_title" => ___("Requests by region per month"), | 166 | "report_title" => ___("Requests by region per month"), |
335 | 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", |
336 | 166 | "default_sort_field" => "1", | 168 | "default_sort_field" => "1", |
337 | 167 | "total_field_count" => "3"), | 169 | "total_field_count" => "3"), |
338 | 168 | 170 | ||
339 | 169 | array( | 171 | array( |
340 | 170 | "report_title" => ___("Requests by region per year"), | 172 | "report_title" => ___("Requests by region per year"), |
342 | 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", |
343 | 172 | "default_sort_field" => "1", | 174 | "default_sort_field" => "1", |
344 | 173 | "total_field_count" => "3"), | 175 | "total_field_count" => "3"), |
345 | 174 | 176 | ||
346 | @@ -233,6 +235,7 @@ | |||
347 | 233 | $query.=" DESC"; | 235 | $query.=" DESC"; |
348 | 234 | } | 236 | } |
349 | 235 | 237 | ||
350 | 238 | //echo $query; | ||
351 | 236 | $result = db_query_execute($config, $query, convert_null_array($sql_params)); | 239 | $result = db_query_execute($config, $query, convert_null_array($sql_params)); |
352 | 237 | 240 | ||
353 | 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. |
354 | @@ -264,55 +267,17 @@ | |||
355 | 264 | echo_proxy_combo($config, "proxy", $_GET["proxy"], 1, ___("Any proxy")); | 267 | echo_proxy_combo($config, "proxy", $_GET["proxy"], 1, ___("Any proxy")); |
356 | 265 | 268 | ||
357 | 266 | echo ___("From")."\n"; | 269 | echo ___("From")."\n"; |
381 | 267 | echo "<select name=\"mf\">\n"; | 270 | |
382 | 268 | for ($j=1; $j<=12; $j++) { | 271 | echo "<input type=\"text\" size=\"7\" maxlength=\"10\" name=\"df\" title=\"YYYY-MM-DD\""; |
383 | 269 | echo "<option value=\"{$j}\""; | 272 | echo isset($_GET["df"]) ? " value=\"".htmlentities($_GET["df"], ENT_QUOTES, get_lang_xtra("charset"))."\"" : ""; |
384 | 270 | if ($_GET["mf"]==$j) echo " selected"; | 273 | echo ">\n\n"; |
362 | 271 | echo ">".strftime("%b",strtotime("{$j}/1/1970"))."</option>\n"; | ||
363 | 272 | } | ||
364 | 273 | echo "</select> \n\n"; | ||
365 | 274 | |||
366 | 275 | echo "<select name=\"df\">\n"; | ||
367 | 276 | for ($j=1; $j<=31; $j++) { | ||
368 | 277 | echo "<option value=\"{$j}\""; | ||
369 | 278 | if ($_GET["df"]==$j) echo " selected"; | ||
370 | 279 | echo ">{$j}</option>\n"; | ||
371 | 280 | } | ||
372 | 281 | echo "</select>, \n\n"; | ||
373 | 282 | |||
374 | 283 | echo "<select name=\"yf\">\n"; | ||
375 | 284 | for ($j=date("Y")-4; $j<=date("Y"); $j++) { | ||
376 | 285 | echo "<option value=\"$j\""; | ||
377 | 286 | if ($_GET["yf"]==$j) echo " selected"; | ||
378 | 287 | echo ">{$j}</option>\n"; | ||
379 | 288 | } | ||
380 | 289 | echo "</select> \n\n"; | ||
385 | 290 | 274 | ||
386 | 291 | 275 | ||
387 | 292 | echo ___("To")."\n"; | 276 | echo ___("To")."\n"; |
411 | 293 | echo "<select name=\"mt\">\n"; | 277 | echo "<input type=\"text\" size=\"7\" maxlength=\"10\" name=\"dt\" title=\"YYYY-MM-DD\""; |
412 | 294 | for ($j=1; $j<=12; $j++) { | 278 | echo isset($_GET["dt"]) ? " value=\"".htmlentities($_GET["dt"], ENT_QUOTES, get_lang_xtra("charset"))."\"" : ""; |
413 | 295 | echo "<option value=\"{$j}\""; | 279 | echo ">\n</b>\n\n"; |
414 | 296 | if ($_GET["mt"]==$j) echo " selected"; | 280 | |
392 | 297 | echo ">".strftime("%b",strtotime("{$j}/1/1970"))."</option>\n"; | ||
393 | 298 | } | ||
394 | 299 | echo "</select> \n\n"; | ||
395 | 300 | |||
396 | 301 | echo "<select name=\"dt\">\n"; | ||
397 | 302 | for ($j=1; $j<=31; $j++) { | ||
398 | 303 | echo "<option value=\"{$j}\""; | ||
399 | 304 | if ($_GET["dt"]==$j) echo " selected"; | ||
400 | 305 | echo ">{$j}</option>\n"; | ||
401 | 306 | } | ||
402 | 307 | echo "</select>, \n\n"; | ||
403 | 308 | |||
404 | 309 | echo "<select name=\"yt\">\n"; | ||
405 | 310 | for ($j=date("Y")-4; $j<=date("Y"); $j++) { | ||
406 | 311 | echo "<option value=\"$j\""; | ||
407 | 312 | if ($_GET["yt"]==$j) echo " selected"; | ||
408 | 313 | echo ">{$j}</option>\n"; | ||
409 | 314 | } | ||
410 | 315 | echo "</select></b>\n\n"; | ||
415 | 316 | 281 | ||
416 | 317 | echo "<input type=\"submit\" value=\"".___("Display")."\">\n"; | 282 | echo "<input type=\"submit\" value=\"".___("Display")."\">\n"; |
417 | 318 | echo "</form>\n\n"; | 283 | echo "</form>\n\n"; |
Looks fine to me