Merge branch 'stable-3.1'
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | function apply_client_templates($clientId) { |
| | | global $app; |
| | | |
| | | include '../client/form/client.tform.php'; |
| | | |
| | | /* |
| | | * Get the master-template for the client |
| | | */ |
| | |
| | | $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 |
| | |
| | | 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 |
| | |
| | | } |
| | | |
| | | /* |
| | | * 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); |
| | |
| | | /* 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); |
| | |
| | | |
| | | $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'])){ |
| | |
| | | // 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); |
| | |
| | | $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']; |
| | |
| | | $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); |
| | | } |
| | |
| | | //$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); |