Commit a8b07fff authored by xaver's avatar xaver

php 5.4 fixes + bugfix interface/web/admin/list/remote_user.list.php...

php 5.4 fixes + bugfix interface/web/admin/list/remote_user.list.php ['table_idx'] from userid to remote_userid
parent 829b76b1
......@@ -35,7 +35,7 @@ class getconf {
public function get_server_config($server_id, $section = '') {
global $app;
if(!is_array($this->config[$server_id])) {
if(!isset($this->config[$server_id])) {
$app->uses('ini_parser');
$server_id = intval($server_id);
$server = $app->db->queryOneRecord('SELECT config FROM server WHERE server_id = '.$server_id);
......@@ -47,10 +47,12 @@ class getconf {
public function get_global_config($section = '') {
global $app;
if(!is_array($this->config['global'])) {
if(isset($this->config['global'])) {
$app->uses('ini_parser');
$tmp = $app->db->queryOneRecord('SELECT config FROM sys_ini WHERE sysini_id = 1');
$this->config['global'] = $app->ini_parser->parse_ini_string(stripslashes($tmp['config']));
} else {
$this->config['global'] = NULL;
}
return ($section == '') ? $this->config['global'] : $this->config['global'][$section];
}
......
......@@ -59,11 +59,10 @@ class plugin_listview extends plugin_base {
$listTpl->setVar('theme', $_SESSION['s']['theme']);
// Generate the SQL for searching
$sql_where = "";
if($app->listform->listDef["auth"] != 'no') {
if($_SESSION["s"]["user"]["typ"] == "admin") {
$sql_where = "";
} else {
$sql_where = $app->tform->getAuthSQL('r')." and";
if($_SESSION["s"]["user"]["typ"] != "admin") {
$sql_where = $app->tform->getAuthSQL('r')." and";
}
}
......@@ -87,6 +86,7 @@ class plugin_listview extends plugin_base {
$limits = array('5'=>'5','15'=>'15','25'=>'25','50'=>'50','100'=>'100','999999999' => 'all');
//* create options and set selected, if default -> 15 is selected
$options='';
foreach($limits as $key => $val){
$options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) && $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>';
}
......
......@@ -7,7 +7,7 @@ $liste['name'] = 'remote_user';
$liste['table'] = 'remote_user';
// Index index field of the database table
$liste['table_idx'] = 'userid';
$liste['table_idx'] = 'remote_userid';
// Search Field Prefix
$liste['search_prefix'] = 'search_';
......
......@@ -80,9 +80,9 @@ class page_action extends tform_actions {
$rec["type"] = $tmp_parts[0];
}
}
if(@$tmp_parts[2] != '') {
if(!empty($tmp_parts[2])) {
$dest = @$tmp_parts[1].':'.@$tmp_parts[2];
} elseif($tmp_parts[1] != '') {
} elseif(!empty($tmp_parts[1])) {
$dest = $tmp_parts[1];
} else {
$dest = $this->dataRecord["transport"];
......
......@@ -109,7 +109,7 @@ class page_action extends tform_actions {
if($this->dataRecord["quota"] != -1) $app->tpl->setVar("quota",$this->dataRecord["quota"] / 1024 / 1024);
// Is autoresponder set?
if ($this->dataRecord['autoresponder'] == 'y') {
if (!empty($this->dataRecord['autoresponder']) && $this->dataRecord['autoresponder'] == 'y') {
$app->tpl->setVar("ar_active", 'checked="checked"');
} else {
$app->tpl->setVar("ar_active", '');
......@@ -175,7 +175,7 @@ class page_action extends tform_actions {
$app->uses('getconf');
$mail_config = $app->getconf->get_server_config($domain["server_id"],'mail');
$mail_config = $app->getconf->get_server_config(!empty($domain["server_id"]) ? $domain["server_id"] : '','mail');
//* compose the email field
if(isset($_POST["email_local_part"]) && isset($_POST["email_domain"])) {
......@@ -210,7 +210,7 @@ class page_action extends tform_actions {
if(!isset($_POST["login"])) $this->dataRecord["login"] = $this->dataRecord["email"];
elseif(strpos($_POST["login"], '@') !== false && $_POST["login"] != $this->dataRecord["email"]) $app->tform->errorMessage .= $app->tform->lng("error_login_email_txt")."<br>";
} else {
$this->dataRecord["login"] = $this->dataRecord["email"];
$this->dataRecord["login"] = isset($this->dataRecord["email"]) ? $this->dataRecord["email"] : '';
}
//* if autoresponder checkbox not selected, do not save dates
if (!isset($_POST['autoresponder']) && array_key_exists('autoresponder_start_date', $_POST)) {
......@@ -287,8 +287,8 @@ class page_action extends tform_actions {
// Set the fields for dovecot
if(isset($this->dataRecord["email"])) {
$disableimap = ($this->dataRecord["disableimap"])?'y':'n';
$disablepop3 = ($this->dataRecord["disablepop3"])?'y':'n';
$disableimap = (isset($this->dataRecord["disableimap"]) && $this->dataRecord["disableimap"])?'y':'n';
$disablepop3 = (isset($this->dataRecord["disablepop3"]) && $this->dataRecord["disablepop3"])?'y':'n';
$disabledeliver = ($this->dataRecord["postfix"] == 'y')?'n':'y';
$disablesmtp = ($this->dataRecord["postfix"] == 'y')?'n':'y';
......
......@@ -41,7 +41,7 @@ class list_action extends listform_actions {
$rec['bgcolor'] = $this->DataRowColor;
$email = $rec['email'];
$rec['used'] = $monitor_data[$email]['used'];
$rec['used'] = isset($monitor_data[$email]['used']) ? $monitor_data[$email]['used'] : array(1 => 0);
if (!is_numeric($rec['used'])) $rec['used']=$rec['used'][1];
......
......@@ -69,7 +69,7 @@ else {
$app->tpl->setVar("state_data",$output);
$app->tpl->setVar("state_type",$stateType);
$app->tpl->setVar("list_head_txt",$title);
$app->tpl->setVar("list_desc_txt",$description);
$app->tpl->setVar("list_desc_txt",(isset($description) ? $description : ''));
$app->tpl->setVar("monTransRefreshsq", $monTransRefreshsq);
/*
......@@ -234,7 +234,7 @@ function _getServerState($serverId, $serverName) {
/*
* Info of a "normal" Server or a OpenVz-Host
*/
$html_server .= '<div class="systemmonitor-state state-' . $serverState . '">';
$html_server = '<div class="systemmonitor-state state-' . $serverState . '">';
$html_server .= '<div class="systemmonitor-device device-server">';
$html_server .= '<div class="systemmonitor-content icons32 ico-' . $serverState . '">';
$html_server .= $app->lng("monitor_serverstate_server_txt") . ': ' . $serverName;
......@@ -252,11 +252,11 @@ function _getServerState($serverId, $serverName) {
}
$html_server .= $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . ' (';
$html_server .= sizeof($messages[$app->lng("monitor_serverstate_listunknown_txt")]) . ' ' . $app->lng("monitor_serverstate_unknown_txt") . ', ';
$html_server .= sizeof($messages[$app->lng("monitor_serverstate_listinfo_txt")]) . ' ' . $app->lng("monitor_serverstate_info_txt") . ', ';
$html_server .= sizeof($messages[$app->lng("monitor_serverstate_listwarning_txt")]) . ' ' . $app->lng("monitor_serverstate_warning_txt") . ', ';
$html_server .= sizeof($messages[$app->lng("monitor_serverstate_listcritical_txt")]) . ' ' . $app->lng("monitor_serverstate_critical_txt") . ', ';
$html_server .= sizeof($messages[$app->lng("monitor_serverstate_listerror_txt")]) . ' ' . $app->lng("monitor_serverstate_error_txt") . '';
$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") . ', ';
$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") . ', ';
$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") . ', ';
$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") . ', ';
$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") . '';
$html_server .= ')<br />';
/*
......
......@@ -467,7 +467,7 @@ class page_action extends tform_actions {
//* get the server config for this server
$app->uses("getconf");
$web_config = $app->getconf->get_server_config(intval($this->dataRecord["server_id"]),'web');
$web_config = $app->getconf->get_server_config(intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0),'web');
//* Check for duplicate ssl certs per IP if SNI is disabled
if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') {
$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 @@ class page_action extends tform_actions {
$web_rec = $app->tform->getDataRecord($this->id);
$web_config = $app->getconf->get_server_config(intval($web_rec["server_id"]),'web');
$document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
$document_root = str_replace("[website_idhash_1]",$this->id_hash($page_form->id,1),$document_root);
$document_root = str_replace("[website_idhash_2]",$this->id_hash($page_form->id,1),$document_root);
$document_root = str_replace("[website_idhash_3]",$this->id_hash($page_form->id,1),$document_root);
$document_root = str_replace("[website_idhash_4]",$this->id_hash($page_form->id,1),$document_root);
$page_formid = isset($page_form->id) ? $page_form->id : '';
$document_root = str_replace("[website_idhash_1]",$this->id_hash($page_formid,1),$document_root);
$document_root = str_replace("[website_idhash_2]",$this->id_hash($page_formid,1),$document_root);
$document_root = str_replace("[website_idhash_3]",$this->id_hash($page_formid,1),$document_root);
$document_root = str_replace("[website_idhash_4]",$this->id_hash($page_formid,1),$document_root);
// get the ID of the client
if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
......@@ -666,7 +667,7 @@ class page_action extends tform_actions {
}
//* If the domain name has been changed, we will have to change all subdomains
if($this->dataRecord["domain"] != '' && $this->oldDataRecord["domain"] != '' && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) {
if(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) {
$records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE type = 'subdomain' AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'");
foreach($records as $rec) {
$subdomain = $app->db->quote(str_replace($this->oldDataRecord["domain"],$this->dataRecord["domain"],$rec['domain']));
......@@ -684,8 +685,8 @@ class page_action extends tform_actions {
}
//* Set php_open_basedir if empty or domain or client has been changed
if($web_rec['php_open_basedir'] == '' ||
($this->dataRecord["domain"] != '' && $this->oldDataRecord["domain"] != '' && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) ||
if(empty($web_rec['php_open_basedir']) ||
(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) ||
(isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"])) {
$document_root = $app->db->quote(str_replace("[client_id]",$client_id,$document_root));
$php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
......
......@@ -148,6 +148,7 @@ class page_action extends tform_actions {
$sql = 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name';
$records = $app->db->queryAllRecords($sql);
if(is_array($records)) {
$template_id_select='';
foreach( $records as $rec) {
$selected = @($rec["template_id"] == $this->dataRecord["template_id"])?'SELECTED':'';
$template_id_select .= "<option value='$rec[template_id]' $selected>$rec[template_name]</option>\r\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment