Skip to content

Commit a8b07ff

Browse files
author
xaver
committed
php 5.4 fixes + bugfix interface/web/admin/list/remote_user.list.php ['table_idx'] from userid to remote_userid
1 parent 829b76b commit a8b07ff

File tree

9 files changed

+34
-30
lines changed

9 files changed

+34
-30
lines changed

interface/lib/classes/getconf.inc.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class getconf {
3535
public function get_server_config($server_id, $section = '') {
3636
global $app;
3737

38-
if(!is_array($this->config[$server_id])) {
38+
if(!isset($this->config[$server_id])) {
3939
$app->uses('ini_parser');
4040
$server_id = intval($server_id);
4141
$server = $app->db->queryOneRecord('SELECT config FROM server WHERE server_id = '.$server_id);
@@ -47,10 +47,12 @@ public function get_server_config($server_id, $section = '') {
4747
public function get_global_config($section = '') {
4848
global $app;
4949

50-
if(!is_array($this->config['global'])) {
50+
if(isset($this->config['global'])) {
5151
$app->uses('ini_parser');
5252
$tmp = $app->db->queryOneRecord('SELECT config FROM sys_ini WHERE sysini_id = 1');
5353
$this->config['global'] = $app->ini_parser->parse_ini_string(stripslashes($tmp['config']));
54+
} else {
55+
$this->config['global'] = NULL;
5456
}
5557
return ($section == '') ? $this->config['global'] : $this->config['global'][$section];
5658
}

interface/lib/classes/plugin_listview.inc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,10 @@ function onShow() {
5959
$listTpl->setVar('theme', $_SESSION['s']['theme']);
6060

6161
// Generate the SQL for searching
62+
$sql_where = "";
6263
if($app->listform->listDef["auth"] != 'no') {
63-
if($_SESSION["s"]["user"]["typ"] == "admin") {
64-
$sql_where = "";
65-
} else {
66-
$sql_where = $app->tform->getAuthSQL('r')." and";
64+
if($_SESSION["s"]["user"]["typ"] != "admin") {
65+
$sql_where = $app->tform->getAuthSQL('r')." and";
6766
}
6867
}
6968

@@ -87,6 +86,7 @@ function onShow() {
8786
$limits = array('5'=>'5','15'=>'15','25'=>'25','50'=>'50','100'=>'100','999999999' => 'all');
8887

8988
//* create options and set selected, if default -> 15 is selected
89+
$options='';
9090
foreach($limits as $key => $val){
9191
$options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) && $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>';
9292
}

interface/web/admin/list/remote_user.list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
$liste['table'] = 'remote_user';
88

99
// Index index field of the database table
10-
$liste['table_idx'] = 'userid';
10+
$liste['table_idx'] = 'remote_userid';
1111

1212
// Search Field Prefix
1313
$liste['search_prefix'] = 'search_';

interface/web/mail/mail_transport_edit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ function onShowEnd() {
8080
$rec["type"] = $tmp_parts[0];
8181
}
8282
}
83-
if(@$tmp_parts[2] != '') {
83+
if(!empty($tmp_parts[2])) {
8484
$dest = @$tmp_parts[1].':'.@$tmp_parts[2];
85-
} elseif($tmp_parts[1] != '') {
85+
} elseif(!empty($tmp_parts[1])) {
8686
$dest = $tmp_parts[1];
8787
} else {
8888
$dest = $this->dataRecord["transport"];

interface/web/mail/mail_user_edit.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function onShowEnd() {
109109
if($this->dataRecord["quota"] != -1) $app->tpl->setVar("quota",$this->dataRecord["quota"] / 1024 / 1024);
110110

111111
// Is autoresponder set?
112-
if ($this->dataRecord['autoresponder'] == 'y') {
112+
if (!empty($this->dataRecord['autoresponder']) && $this->dataRecord['autoresponder'] == 'y') {
113113
$app->tpl->setVar("ar_active", 'checked="checked"');
114114
} else {
115115
$app->tpl->setVar("ar_active", '');
@@ -175,7 +175,7 @@ function onSubmit() {
175175

176176

177177
$app->uses('getconf');
178-
$mail_config = $app->getconf->get_server_config($domain["server_id"],'mail');
178+
$mail_config = $app->getconf->get_server_config(!empty($domain["server_id"]) ? $domain["server_id"] : '','mail');
179179

180180
//* compose the email field
181181
if(isset($_POST["email_local_part"]) && isset($_POST["email_domain"])) {
@@ -210,7 +210,7 @@ function onSubmit() {
210210
if(!isset($_POST["login"])) $this->dataRecord["login"] = $this->dataRecord["email"];
211211
elseif(strpos($_POST["login"], '@') !== false && $_POST["login"] != $this->dataRecord["email"]) $app->tform->errorMessage .= $app->tform->lng("error_login_email_txt")."<br>";
212212
} else {
213-
$this->dataRecord["login"] = $this->dataRecord["email"];
213+
$this->dataRecord["login"] = isset($this->dataRecord["email"]) ? $this->dataRecord["email"] : '';
214214
}
215215
//* if autoresponder checkbox not selected, do not save dates
216216
if (!isset($_POST['autoresponder']) && array_key_exists('autoresponder_start_date', $_POST)) {
@@ -287,8 +287,8 @@ function onAfterUpdate() {
287287

288288
// Set the fields for dovecot
289289
if(isset($this->dataRecord["email"])) {
290-
$disableimap = ($this->dataRecord["disableimap"])?'y':'n';
291-
$disablepop3 = ($this->dataRecord["disablepop3"])?'y':'n';
290+
$disableimap = (isset($this->dataRecord["disableimap"]) && $this->dataRecord["disableimap"])?'y':'n';
291+
$disablepop3 = (isset($this->dataRecord["disablepop3"]) && $this->dataRecord["disablepop3"])?'y':'n';
292292
$disabledeliver = ($this->dataRecord["postfix"] == 'y')?'n':'y';
293293
$disablesmtp = ($this->dataRecord["postfix"] == 'y')?'n':'y';
294294

interface/web/mail/user_quota_stats.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function prepareDataRow($rec)
4141
$rec['bgcolor'] = $this->DataRowColor;
4242
$email = $rec['email'];
4343

44-
$rec['used'] = $monitor_data[$email]['used'];
44+
$rec['used'] = isset($monitor_data[$email]['used']) ? $monitor_data[$email]['used'] : array(1 => 0);
4545

4646
if (!is_numeric($rec['used'])) $rec['used']=$rec['used'][1];
4747

interface/web/monitor/show_sys_state.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
$app->tpl->setVar("state_data",$output);
7070
$app->tpl->setVar("state_type",$stateType);
7171
$app->tpl->setVar("list_head_txt",$title);
72-
$app->tpl->setVar("list_desc_txt",$description);
72+
$app->tpl->setVar("list_desc_txt",(isset($description) ? $description : ''));
7373
$app->tpl->setVar("monTransRefreshsq", $monTransRefreshsq);
7474

7575
/*
@@ -234,7 +234,7 @@ function _getServerState($serverId, $serverName) {
234234
/*
235235
* Info of a "normal" Server or a OpenVz-Host
236236
*/
237-
$html_server .= '<div class="systemmonitor-state state-' . $serverState . '">';
237+
$html_server = '<div class="systemmonitor-state state-' . $serverState . '">';
238238
$html_server .= '<div class="systemmonitor-device device-server">';
239239
$html_server .= '<div class="systemmonitor-content icons32 ico-' . $serverState . '">';
240240
$html_server .= $app->lng("monitor_serverstate_server_txt") . ': ' . $serverName;
@@ -252,11 +252,11 @@ function _getServerState($serverId, $serverName) {
252252
}
253253

254254
$html_server .= $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . ' (';
255-
$html_server .= sizeof($messages[$app->lng("monitor_serverstate_listunknown_txt")]) . ' ' . $app->lng("monitor_serverstate_unknown_txt") . ', ';
256-
$html_server .= sizeof($messages[$app->lng("monitor_serverstate_listinfo_txt")]) . ' ' . $app->lng("monitor_serverstate_info_txt") . ', ';
257-
$html_server .= sizeof($messages[$app->lng("monitor_serverstate_listwarning_txt")]) . ' ' . $app->lng("monitor_serverstate_warning_txt") . ', ';
258-
$html_server .= sizeof($messages[$app->lng("monitor_serverstate_listcritical_txt")]) . ' ' . $app->lng("monitor_serverstate_critical_txt") . ', ';
259-
$html_server .= sizeof($messages[$app->lng("monitor_serverstate_listerror_txt")]) . ' ' . $app->lng("monitor_serverstate_error_txt") . '';
255+
$html_server .= sizeof((isset($messages[$app->lng("monitor_serverstate_listunknown_txt")]) ? $messages[$app->lng("monitor_serverstate_listunknown_txt")] : array())) . ' ' . $app->lng("monitor_serverstate_unknown_txt") . ', ';
256+
$html_server .= sizeof((isset($messages[$app->lng("monitor_serverstate_listinfo_txt")]) ? $messages[$app->lng("monitor_serverstate_listinfo_txt")] : array())) . ' ' . $app->lng("monitor_serverstate_info_txt") . ', ';
257+
$html_server .= sizeof((isset($messages[$app->lng("monitor_serverstate_listwarning_txt")]) ? $messages[$app->lng("monitor_serverstate_listwarning_txt")] : array())) . ' ' . $app->lng("monitor_serverstate_warning_txt") . ', ';
258+
$html_server .= sizeof((isset($messages[$app->lng("monitor_serverstate_listcritical_txt")]) ? $messages[$app->lng("monitor_serverstate_listcritical_txt")] : array())) . ' ' . $app->lng("monitor_serverstate_critical_txt") . ', ';
259+
$html_server .= sizeof((isset($messages[$app->lng("monitor_serverstate_listerror_txt")]) ? $messages[$app->lng("monitor_serverstate_listerror_txt")] : array())) . ' ' . $app->lng("monitor_serverstate_error_txt") . '';
260260
$html_server .= ')<br />';
261261

262262
/*

interface/web/sites/web_domain_edit.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ function onSubmit() {
467467

468468
//* get the server config for this server
469469
$app->uses("getconf");
470-
$web_config = $app->getconf->get_server_config(intval($this->dataRecord["server_id"]),'web');
470+
$web_config = $app->getconf->get_server_config(intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0),'web');
471471
//* Check for duplicate ssl certs per IP if SNI is disabled
472472
if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') {
473473
$sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id;
@@ -600,10 +600,11 @@ function onAfterUpdate() {
600600
$web_rec = $app->tform->getDataRecord($this->id);
601601
$web_config = $app->getconf->get_server_config(intval($web_rec["server_id"]),'web');
602602
$document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
603-
$document_root = str_replace("[website_idhash_1]",$this->id_hash($page_form->id,1),$document_root);
604-
$document_root = str_replace("[website_idhash_2]",$this->id_hash($page_form->id,1),$document_root);
605-
$document_root = str_replace("[website_idhash_3]",$this->id_hash($page_form->id,1),$document_root);
606-
$document_root = str_replace("[website_idhash_4]",$this->id_hash($page_form->id,1),$document_root);
603+
$page_formid = isset($page_form->id) ? $page_form->id : '';
604+
$document_root = str_replace("[website_idhash_1]",$this->id_hash($page_formid,1),$document_root);
605+
$document_root = str_replace("[website_idhash_2]",$this->id_hash($page_formid,1),$document_root);
606+
$document_root = str_replace("[website_idhash_3]",$this->id_hash($page_formid,1),$document_root);
607+
$document_root = str_replace("[website_idhash_4]",$this->id_hash($page_formid,1),$document_root);
607608

608609
// get the ID of the client
609610
if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -666,7 +667,7 @@ function onAfterUpdate() {
666667
}
667668

668669
//* If the domain name has been changed, we will have to change all subdomains
669-
if($this->dataRecord["domain"] != '' && $this->oldDataRecord["domain"] != '' && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) {
670+
if(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) {
670671
$records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE type = 'subdomain' AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'");
671672
foreach($records as $rec) {
672673
$subdomain = $app->db->quote(str_replace($this->oldDataRecord["domain"],$this->dataRecord["domain"],$rec['domain']));
@@ -684,8 +685,8 @@ function onAfterUpdate() {
684685
}
685686

686687
//* Set php_open_basedir if empty or domain or client has been changed
687-
if($web_rec['php_open_basedir'] == '' ||
688-
($this->dataRecord["domain"] != '' && $this->oldDataRecord["domain"] != '' && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) ||
688+
if(empty($web_rec['php_open_basedir']) ||
689+
(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) ||
689690
(isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"])) {
690691
$document_root = $app->db->quote(str_replace("[client_id]",$client_id,$document_root));
691692
$php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);

interface/web/vm/openvz_vm_edit.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ function onShowEnd() {
148148
$sql = 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name';
149149
$records = $app->db->queryAllRecords($sql);
150150
if(is_array($records)) {
151+
$template_id_select='';
151152
foreach( $records as $rec) {
152153
$selected = @($rec["template_id"] == $this->dataRecord["template_id"])?'SELECTED':'';
153154
$template_id_select .= "<option value='$rec[template_id]' $selected>$rec[template_name]</option>\r\n";

0 commit comments

Comments
 (0)