Skip to content

Commit 294a7b5

Browse files
author
Marius Burkard
committed
Merge branch 'stable-3.1'
2 parents 13d3911 + c1e0c66 commit 294a7b5

File tree

7 files changed

+20
-19
lines changed

7 files changed

+20
-19
lines changed

install/tpl/nginx_apps.vhost.master

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
server {
2-
listen {apps_vhost_ip}{apps_vhost_port};
2+
listen {apps_vhost_ip};
3+
listen [::]:{apps_vhost_port};
34
ssl {ssl_on};
45
{ssl_comment}ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
56
{ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt;

install/tpl/nginx_ispconfig.vhost.master

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
server {
22
listen {vhost_port};
3+
listen [::]:{vhost_port}
34
ssl {ssl_on};
45
{ssl_comment}ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
56
{ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt;

interface/lib/classes/client_templates.inc.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ function update_client_templates($clientId, $templates = array()) {
101101
function apply_client_templates($clientId) {
102102
global $app;
103103

104-
include '../client/form/client.tform.php';
105-
106104
/*
107105
* Get the master-template for the client
108106
*/
@@ -111,6 +109,8 @@ function apply_client_templates($clientId) {
111109
$masterTemplateId = $record['template_master'];
112110
$is_reseller = ($record['limit_client'] != 0)?true:false;
113111

112+
include '../client/form/' . ($is_reseller ? 'reseller' : 'client') . '.tform.php';
113+
114114
if($record['template_additional'] != '') {
115115
// we have to call the update_client_templates function
116116
$templates = explode('/', $record['template_additional']);
@@ -124,6 +124,8 @@ function apply_client_templates($clientId) {
124124
if ($masterTemplateId > 0){
125125
$sql = "SELECT * FROM client_template WHERE template_id = ?";
126126
$limits = $app->db->queryOneRecord($sql, $masterTemplateId);
127+
if($is_reseller == true && $limits['limit_client'] == 0) $limits['limit_client'] = -1;
128+
elseif($is_reseller == false && $limits['limit_client'] != 0) $limits['limit_client'] = 0;
127129
} else {
128130
// if there is no master template it makes NO SENSE adding sub templates.
129131
// adding subtemplates are stored in client limits, so they would add up
@@ -132,7 +134,7 @@ function apply_client_templates($clientId) {
132134
}
133135

134136
/*
135-
* Process the additional tempaltes here (add them to the limits
137+
* Process the additional templates here (add them to the limits
136138
* if != -1)
137139
*/
138140
$addTpl = explode('/', $additionalTemplateStr);
@@ -145,6 +147,11 @@ function apply_client_templates($clientId) {
145147
/* maybe the template is deleted in the meantime */
146148
if (is_array($addLimits)){
147149
foreach($addLimits as $k => $v){
150+
if($k == 'limit_client') {
151+
if($is_reseller == true && $v == 0) continue;
152+
elseif($is_reseller == false && $v != 0) continue;
153+
}
154+
148155
/* we can remove this condition, but it is easier to debug with it (don't add ids and other non-limit values) */
149156
if (strpos($k, 'limit') !== false or strpos($k, 'default') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec'){
150157
$app->log('Template processing key ' . $k . ' for client ' . $clientId, LOGLEVEL_DEBUG);

interface/lib/classes/remote.d/sites.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ public function sites_database_add($session_id, $client_id, $params)
127127

128128
$this->id = 0;
129129
$this->dataRecord = $params;
130-
$app->sites_database_plugin->processDatabaseInsert($this);
131130

132131
$retval = $this->insertQueryExecute($sql, $params);
132+
$app->sites_database_plugin->processDatabaseInsert($this);
133133

134134
// set correct values for backup_interval and backup_copies
135135
if(isset($params['backup_interval']) || isset($params['backup_copies'])){

interface/web/client/client_edit.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,7 @@ function onAfterUpdate() {
408408
// password changed
409409
if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
410410
$password = $this->dataRecord["password"];
411-
$salt="$1$";
412-
$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
413-
for ($n=0;$n<8;$n++) {
414-
$salt.=$base64_alphabet[mt_rand(0, 63)];
415-
}
416-
$salt.="$";
417-
$password = crypt(stripslashes($password), $salt);
411+
$password = $app->auth->crypt_password($password);
418412
$client_id = $this->id;
419413
$sql = "UPDATE sys_user SET passwort = ? WHERE client_id = ?";
420414
$app->db->query($sql, $password, $client_id);

interface/web/sites/web_vhost_domain_edit.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,11 +1356,10 @@ function onAfterInsert() {
13561356
$php_open_basedir = str_replace("[website_path]", $document_root, $web_config["php_open_basedir"]);
13571357
$php_open_basedir = str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir);
13581358
$htaccess_allow_override = $web_config["htaccess_allow_override"];
1359-
$added_date = date($app->lng('conf_format_dateshort'));
13601359
$added_by = $_SESSION['s']['user']['username'];
13611360

1362-
$sql = "UPDATE web_domain SET system_user = ?, system_group = ?, document_root = ?, allow_override = ?, php_open_basedir = ?, added_date = ?, added_by = ? WHERE domain_id = ?";
1363-
$app->db->query($sql, $system_user, $system_group, $document_root, $htaccess_allow_override, $php_open_basedir, $added_date, $added_by, $this->id);
1361+
$sql = "UPDATE web_domain SET system_user = ?, system_group = ?, document_root = ?, allow_override = ?, php_open_basedir = ?, added_date = CURDATE(), added_by = ? WHERE domain_id = ?";
1362+
$app->db->query($sql, $system_user, $system_group, $document_root, $htaccess_allow_override, $php_open_basedir, $added_by, $this->id);
13641363
} else {
13651364
// Set the values for document_root, system_user and system_group
13661365
$system_user = $this->parent_domain_record['system_user'];
@@ -1371,11 +1370,10 @@ function onAfterInsert() {
13711370
$php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir);
13721371
$php_open_basedir = str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir);
13731372
$htaccess_allow_override = $this->parent_domain_record['allow_override'];
1374-
$added_date = date($app->lng('conf_format_dateshort'));
13751373
$added_by = $_SESSION['s']['user']['username'];
13761374

1377-
$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 = ?";
1378-
$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);
1375+
$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 = ?";
1376+
$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);
13791377
}
13801378
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);
13811379
}

server/plugins-available/backup_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function backup_action($action_name, $data) {
127127
//$db_name = $parts[1];
128128
preg_match('@^db_(.+)_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}\.sql\.gz$@', $backup['filename'], $matches);
129129
$db_name = $matches[1];
130-
$command = "gunzip --stdout ".escapeshellarg($backup_dir.'/'.$backup['filename'])." | mysql -h '".escapeshellcmd($clientdb_host)."' -u '".escapeshellcmd($clientdb_user)."' -p'".escapeshellcmd($clientdb_password)."' '".$db_name."'";
130+
$command = "gunzip --stdout ".escapeshellarg($backup_dir.'/'.$backup['filename'])." | mysql -h '".escapeshellarg($clientdb_host)."' -u '".escapeshellarg($clientdb_user)."' -p'".escapeshellarg($clientdb_password)."' '".$db_name."'";
131131
exec($command);
132132
}
133133
unset($clientdb_host);

0 commit comments

Comments
 (0)