Skip to content

Commit 0d7f77f

Browse files
author
xaver
committed
fixed sorting from traffic, changed sessionvaribale because listDef[name] is by mail and web the same but different columes. Additional added table aliases in 'order by' by joins. Added table by log because server_id^C join server_id = sql error
1 parent 8145fbd commit 0d7f77f

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

interface/lib/classes/listform_actions.inc.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,39 +159,39 @@ private function getQueryString() {
159159

160160
$extselect = '';
161161
$join = '';
162-
if(!empty($_SESSION['search'][$app->listform->listDef["name"]]['order'])){
163-
$order = str_replace(' DESC','',$_SESSION['search'][$app->listform->listDef["name"]]['order']);
162+
if(!empty($_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
163+
$order = str_replace(' DESC','',$_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order']);
164164
if($order == 'server_id' && $app->listform->listDef['table'] != 'server'){
165165
$join .= ' LEFT JOIN server as s ON '.$app->listform->listDef['table'].'.server_id = s.server_id ';
166-
$order_by_sql = str_replace('server_id','server_name',$order_by_sql);
166+
$order_by_sql = str_replace('server_id','s.server_name',$order_by_sql);
167167
} elseif($order == 'client_id' && $app->listform->listDef['table'] != 'client'){
168168
$join .= ' LEFT JOIN client as c ON '.$app->listform->listDef['table'].'.client_id = c.client_id ';
169-
$order_by_sql = str_replace('client_id','contact_name',$order_by_sql);
169+
$order_by_sql = str_replace('client_id','c.contact_name',$order_by_sql);
170170
} elseif($order == 'parent_domain_id'){
171171
$join .= ' LEFT JOIN web_domain as wd ON '.$app->listform->listDef['table'].'.parent_domain_id = wd.domain_id ';
172172
$order_by_sql = str_replace('parent_domain_id','wd.domain',$order_by_sql);
173173
$sql_where = str_replace('type',$app->listform->listDef['table'].'.type',$sql_where);
174174
} elseif($order == 'sys_groupid'){
175175
$join .= ' LEFT JOIN sys_group as sg ON '.$app->listform->listDef['table'].'.sys_groupid = sg.groupid ';
176-
$order_by_sql = str_replace('sys_groupid','name',$order_by_sql);
176+
$order_by_sql = str_replace('sys_groupid','sg.name',$order_by_sql);
177177
} elseif($order == 'rid'){
178178
$join .= ' LEFT JOIN spamfilter_users as su ON '.$app->listform->listDef['table'].'.rid = su.id ';
179-
$order_by_sql = str_replace('rid','email',$order_by_sql);
179+
$order_by_sql = str_replace('rid','su.email',$order_by_sql);
180180
} elseif($order == 'policy_id'){
181181
$join .= ' LEFT JOIN spamfilter_policy as sp ON '.$app->listform->listDef['table'].'.policy_id = sp.id ';
182-
$order_by_sql = str_replace('policy_id','policy_name',$order_by_sql);
182+
$order_by_sql = str_replace('policy_id','sp.policy_name',$order_by_sql);
183183
} elseif($order == 'web_folder_id'){
184184
$join .= ' LEFT JOIN web_folder as wf ON '.$app->listform->listDef['table'].'.web_folder_id = wf.web_folder_id ';
185-
$order_by_sql = str_replace('web_folder_id','path',$order_by_sql);
185+
$order_by_sql = str_replace('web_folder_id','wf.path',$order_by_sql);
186186
} elseif($order == 'ostemplate_id' && $app->listform->listDef['table'] != 'openvz_ostemplate'){
187187
$join .= ' LEFT JOIN openvz_ostemplate as oo ON '.$app->listform->listDef['table'].'.ostemplate_id = oo.ostemplate_id ';
188-
$order_by_sql = str_replace('ostemplate_id','template_name',$order_by_sql);
188+
$order_by_sql = str_replace('ostemplate_id','oo.template_name',$order_by_sql);
189189
} elseif($order == 'template_id' && $app->listform->listDef['table'] != 'openvz_template'){
190190
$join .= ' LEFT JOIN openvz_template as ot ON '.$app->listform->listDef['table'].'.template_id = ot.template_id ';
191-
$order_by_sql = str_replace('template_id','template_name',$order_by_sql);
191+
$order_by_sql = str_replace('template_id','ot.template_name',$order_by_sql);
192192
} elseif($order == 'sender_id' && $app->listform->listDef['table'] != 'sys_user'){
193193
$join .= ' LEFT JOIN sys_user as su ON '.$app->listform->listDef['table'].'.sender_id = su.userid ';
194-
$order_by_sql = str_replace('sender_id','username',$order_by_sql);
194+
$order_by_sql = str_replace('sender_id','su.username',$order_by_sql);
195195
} elseif($order == 'web_traffic_last_month'){
196196
$tmp_year = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
197197
$tmp_month = date('m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));

interface/web/monitor/datalog_list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
$sql = '(';
5252
foreach($servers as $sv) {
53-
$sql .= " (datalog_id > ".$sv['updated']." AND server_id = ".$sv['server_id'].") OR ";
53+
$sql .= " (datalog_id > ".$sv['updated']." AND sys_datalog.server_id = ".$sv['server_id'].") OR ";
5454
}
5555
$sql = substr($sql,0,-4);
5656
$sql .= ')';

0 commit comments

Comments
 (0)