From 294a7b557cd280749c94404ce4d75483741d229a Mon Sep 17 00:00:00 2001 From: Marius Burkard <m.burkard@pixcept.de> Date: Fri, 19 Feb 2016 07:37:56 -0500 Subject: [PATCH] Merge branch 'stable-3.1' --- interface/web/sites/web_vhost_domain_edit.php | 10 ++++------ interface/lib/classes/remote.d/sites.inc.php | 2 +- interface/lib/classes/client_templates.inc.php | 13 ++++++++++--- interface/web/client/client_edit.php | 8 +------- install/tpl/nginx_apps.vhost.master | 3 ++- install/tpl/nginx_ispconfig.vhost.master | 1 + server/plugins-available/backup_plugin.inc.php | 2 +- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/install/tpl/nginx_apps.vhost.master b/install/tpl/nginx_apps.vhost.master index c2d2aa0..6fad927 100644 --- a/install/tpl/nginx_apps.vhost.master +++ b/install/tpl/nginx_apps.vhost.master @@ -1,5 +1,6 @@ server { - listen {apps_vhost_ip}{apps_vhost_port}; + listen {apps_vhost_ip}; + listen [::]:{apps_vhost_port}; ssl {ssl_on}; {ssl_comment}ssl_protocols TLSv1 TLSv1.1 TLSv1.2; {ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt; diff --git a/install/tpl/nginx_ispconfig.vhost.master b/install/tpl/nginx_ispconfig.vhost.master index 80fc02e..6102cef 100644 --- a/install/tpl/nginx_ispconfig.vhost.master +++ b/install/tpl/nginx_ispconfig.vhost.master @@ -1,5 +1,6 @@ server { listen {vhost_port}; + listen [::]:{vhost_port} ssl {ssl_on}; {ssl_comment}ssl_protocols TLSv1 TLSv1.1 TLSv1.2; {ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt; diff --git a/interface/lib/classes/client_templates.inc.php b/interface/lib/classes/client_templates.inc.php index e3141d7..d88628b 100644 --- a/interface/lib/classes/client_templates.inc.php +++ b/interface/lib/classes/client_templates.inc.php @@ -101,8 +101,6 @@ function apply_client_templates($clientId) { global $app; - include '../client/form/client.tform.php'; - /* * Get the master-template for the client */ @@ -110,6 +108,8 @@ $record = $app->db->queryOneRecord($sql, $clientId); $masterTemplateId = $record['template_master']; $is_reseller = ($record['limit_client'] != 0)?true:false; + + include '../client/form/' . ($is_reseller ? 'reseller' : 'client') . '.tform.php'; if($record['template_additional'] != '') { // we have to call the update_client_templates function @@ -124,6 +124,8 @@ if ($masterTemplateId > 0){ $sql = "SELECT * FROM client_template WHERE template_id = ?"; $limits = $app->db->queryOneRecord($sql, $masterTemplateId); + if($is_reseller == true && $limits['limit_client'] == 0) $limits['limit_client'] = -1; + elseif($is_reseller == false && $limits['limit_client'] != 0) $limits['limit_client'] = 0; } else { // if there is no master template it makes NO SENSE adding sub templates. // adding subtemplates are stored in client limits, so they would add up @@ -132,7 +134,7 @@ } /* - * Process the additional tempaltes here (add them to the limits + * Process the additional templates here (add them to the limits * if != -1) */ $addTpl = explode('/', $additionalTemplateStr); @@ -145,6 +147,11 @@ /* maybe the template is deleted in the meantime */ if (is_array($addLimits)){ foreach($addLimits as $k => $v){ + if($k == 'limit_client') { + if($is_reseller == true && $v == 0) continue; + elseif($is_reseller == false && $v != 0) continue; + } + /* we can remove this condition, but it is easier to debug with it (don't add ids and other non-limit values) */ if (strpos($k, 'limit') !== false or strpos($k, 'default') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec'){ $app->log('Template processing key ' . $k . ' for client ' . $clientId, LOGLEVEL_DEBUG); diff --git a/interface/lib/classes/remote.d/sites.inc.php b/interface/lib/classes/remote.d/sites.inc.php index e52e91d..22c1657 100644 --- a/interface/lib/classes/remote.d/sites.inc.php +++ b/interface/lib/classes/remote.d/sites.inc.php @@ -127,9 +127,9 @@ $this->id = 0; $this->dataRecord = $params; - $app->sites_database_plugin->processDatabaseInsert($this); $retval = $this->insertQueryExecute($sql, $params); + $app->sites_database_plugin->processDatabaseInsert($this); // set correct values for backup_interval and backup_copies if(isset($params['backup_interval']) || isset($params['backup_copies'])){ diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php index d9afd57..219fdfa 100644 --- a/interface/web/client/client_edit.php +++ b/interface/web/client/client_edit.php @@ -408,13 +408,7 @@ // password changed if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') { $password = $this->dataRecord["password"]; - $salt="$1$"; - $base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - for ($n=0;$n<8;$n++) { - $salt.=$base64_alphabet[mt_rand(0, 63)]; - } - $salt.="$"; - $password = crypt(stripslashes($password), $salt); + $password = $app->auth->crypt_password($password); $client_id = $this->id; $sql = "UPDATE sys_user SET passwort = ? WHERE client_id = ?"; $app->db->query($sql, $password, $client_id); diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index 05d906f..476dfc7 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -1356,11 +1356,10 @@ $php_open_basedir = str_replace("[website_path]", $document_root, $web_config["php_open_basedir"]); $php_open_basedir = str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir); $htaccess_allow_override = $web_config["htaccess_allow_override"]; - $added_date = date($app->lng('conf_format_dateshort')); $added_by = $_SESSION['s']['user']['username']; - $sql = "UPDATE web_domain SET system_user = ?, system_group = ?, document_root = ?, allow_override = ?, php_open_basedir = ?, added_date = ?, added_by = ? WHERE domain_id = ?"; - $app->db->query($sql, $system_user, $system_group, $document_root, $htaccess_allow_override, $php_open_basedir, $added_date, $added_by, $this->id); + $sql = "UPDATE web_domain SET system_user = ?, system_group = ?, document_root = ?, allow_override = ?, php_open_basedir = ?, added_date = CURDATE(), added_by = ? WHERE domain_id = ?"; + $app->db->query($sql, $system_user, $system_group, $document_root, $htaccess_allow_override, $php_open_basedir, $added_by, $this->id); } else { // Set the values for document_root, system_user and system_group $system_user = $this->parent_domain_record['system_user']; @@ -1371,11 +1370,10 @@ $php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir); $php_open_basedir = str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir); $htaccess_allow_override = $this->parent_domain_record['allow_override']; - $added_date = date($app->lng('conf_format_dateshort')); $added_by = $_SESSION['s']['user']['username']; - $sql = "UPDATE web_domain SET sys_groupid = ?, system_user = ?, system_group = ?, document_root = ?, allow_override = ?, php_open_basedir = ?, added_date = ?, added_by = ? WHERE domain_id = ?"; - $app->db->query($sql, $this->parent_domain_record['sys_groupid'], $system_user, $system_group, $document_root, $htaccess_allow_override, $php_open_basedir, $added_date, $added_by, $this->id); + $sql = "UPDATE web_domain SET sys_groupid = ?, system_user = ?, system_group = ?, document_root = ?, allow_override = ?, php_open_basedir = ?, added_date = CURDATE(), added_by = ? WHERE domain_id = ?"; + $app->db->query($sql, $this->parent_domain_record['sys_groupid'], $system_user, $system_group, $document_root, $htaccess_allow_override, $php_open_basedir, $added_by, $this->id); } if(isset($this->dataRecord['folder_directive_snippets'])) $app->db->query("UPDATE web_domain SET folder_directive_snippets = ? WHERE domain_id = ?", $this->dataRecord['folder_directive_snippets'], $this->id); } diff --git a/server/plugins-available/backup_plugin.inc.php b/server/plugins-available/backup_plugin.inc.php index 167ef42..3e4fad6 100644 --- a/server/plugins-available/backup_plugin.inc.php +++ b/server/plugins-available/backup_plugin.inc.php @@ -127,7 +127,7 @@ //$db_name = $parts[1]; preg_match('@^db_(.+)_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}\.sql\.gz$@', $backup['filename'], $matches); $db_name = $matches[1]; - $command = "gunzip --stdout ".escapeshellarg($backup_dir.'/'.$backup['filename'])." | mysql -h '".escapeshellcmd($clientdb_host)."' -u '".escapeshellcmd($clientdb_user)."' -p'".escapeshellcmd($clientdb_password)."' '".$db_name."'"; + $command = "gunzip --stdout ".escapeshellarg($backup_dir.'/'.$backup['filename'])." | mysql -h '".escapeshellarg($clientdb_host)."' -u '".escapeshellarg($clientdb_user)."' -p'".escapeshellarg($clientdb_password)."' '".$db_name."'"; exec($command); } unset($clientdb_host); -- Gitblit v1.9.1