Commit c68e9b82 authored by Marius Burkard's avatar Marius Burkard
Browse files

Merge branch 'stable-3.1' of git.ispconfig.org:ispconfig/ispconfig3 into stable-3.1

parents 91ada5fd 60e884ac
......@@ -803,7 +803,7 @@ class installer_base {
}
//* Create aliasaes
exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
if($status == 'install') exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
......
......@@ -261,7 +261,6 @@ class db extends mysqli
$aArgs = func_get_args();
$sQuery = call_user_func_array(array(&$this, '_build_query_string'), $aArgs);
$this->securityScan($sQuery);
$this->_iQueryId = @mysqli_query($this->_iConnId, $sQuery);
if (!$this->_iQueryId) {
$this->_sqlerror('Falsche Anfrage / Wrong Query', 'SQL-Query = ' . $sQuery);
......@@ -634,6 +633,7 @@ class db extends mysqli
$diffstr = serialize($diffrec_full);
$username = $_SESSION['s']['user']['username'];
$dbidx = $primary_field.':'.$primary_id;
if(trim($username) == '') $username = 'none';
if($action == 'INSERT') $action = 'i';
if($action == 'UPDATE') $action = 'u';
......
......@@ -404,10 +404,9 @@ class remoting_client extends remoting {
$app->db->query("DELETE FROM sys_user WHERE client_id = ?", $client_id);
//* Delete all records (sub-clients, mail, web, etc....) of this client.
$tables = 'cron,client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic,domain';
$tables = 'cron,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic,domain,mail_mailinglist,client';
$tables_array = explode(',', $tables);
$client_group_id = $app->functions->intval($client_group['groupid']);
if($client_group_id > 1) {
foreach($tables_array as $table) {
if($table != '') {
......@@ -418,7 +417,6 @@ class remoting_client extends remoting {
foreach($table_info as $tmp) {
if($tmp['option'] == 'primary') $index_field = $tmp['name'];
}
//* Delete the records
if($index_field != '') {
if(is_array($records)) {
......@@ -441,7 +439,6 @@ class remoting_client extends remoting {
}
}
if (!$this->checkPerm($session_id, 'client_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
......
<?php
/*
Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
Copyright (c) 2007 - 2016, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
......@@ -196,6 +196,37 @@ class remoting_dns extends remoting {
$app->remoting_lib->loadFormDef('../dns/form/dns_soa.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
//* Add a slave zone
public function dns_slave_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'dns_zone_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
return $this->insertQuery('../dns/form/dns_slave.tform.php', $client_id, $params);
}
//* Update a slave zone
public function dns_slave_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'dns_zone_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../dns/form/dns_slave.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
}
//* Delete a slave zone
public function dns_slave_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'dns_zone_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
return $this->deleteQuery('../dns/form/dns_slave.tform.php', $primary_id);
}
//* Get record id by origin
public function dns_zone_get_id($session_id, $origin)
......
......@@ -193,6 +193,10 @@ class page_action extends tform_actions {
"SELECT sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, domain " .
"FROM web_domain WHERE type NOT IN ('subdomain','vhostsubdomain')";
$app->db->query($sql);
$sql = "REPLACE INTO domain (sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, domain ) " .
"SELECT sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, SUBSTRING(origin, 1, CHAR_LENGTH(origin) - 1) " .
"FROM dns_soa";
$app->db->query($sql);
}
//die(print_r($_FILES));
......
......@@ -22,7 +22,7 @@
</select></div>
</div>
<div class="clear"><div class="right">
<button class="btn btn-default formbutton-success" type="button" onclick="ISPConfig.addAdditionalTemplate();">{tmpl_var name="add_additional_template_txt"}</button>
<button id="tpl_add_btn" class="btn btn-default formbutton-success" type="button" onclick="ISPConfig.addAdditionalTemplate();">{tmpl_var name="add_additional_template_txt"}</button>
</div></div>
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='active_template_additional_txt'}</label>
......@@ -471,9 +471,9 @@ $('div.panel_client')
.find('div.pnl_formsarea')
.find('fieldset')
.find('input,select,button')
.not('#template_master,#template_additional,#default_mailserver,#default_webserver,#default_dbserver,#default_dnsserver,#default_slave_dnsserver,#customer_no_template,#customer_no_start,#customer_no_counter,#parent_client_id,#reseller')
.not('#template_master,#template_additional,#default_mailserver,#tpl_add_btn,#default_webserver,#default_dbserver,#default_dnsserver,#default_slave_dnsserver,#customer_no_template,#customer_no_start,#customer_no_counter,#parent_client_id,#reseller')
.click(function(e) {
if(custom_template_selected()) return true;
if(custom_template_selected()) return true;
e.preventDefault();
alert('{tmpl_var name="err_msg_master_tpl_set"}');
})
......
......@@ -188,13 +188,13 @@ if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSIO
$dashlets_config[$role.'_dashlets_left'] = trim($dashlets_config[$role.'_dashlets_left']);
$dashlets_config[$role.'_dashlets_right'] = trim($dashlets_config[$role.'_dashlets_right']);
if($dashlets_config[$role.'_dashlets_left'] != ''){
if($dashlets_config[$role.'_dashlets_left'] != '' || $dashlets_config[$role.'_dashlets_right'] != ''){
preg_match_all('@\[(.*?)\]@', $dashlets_config[$role.'_dashlets_left'], $matches);
$leftcol_dashlets = $matches[1];
} else {
$leftcol_dashlets = $default_leftcol_dashlets;
}
if($dashlets_config[$role.'_dashlets_right'] != ''){
if($dashlets_config[$role.'_dashlets_right'] != '' || $dashlets_config[$role.'_dashlets_left'] != ''){
preg_match_all('@\[(.*?)\]@', $dashlets_config[$role.'_dashlets_right'], $matches);
$rightcol_dashlets = $matches[1];
} else {
......
......@@ -47,7 +47,7 @@ $ip_type = $_GET['ip_type'];
$tmp = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $client_group_id);
$sql = "SELECT ip_address FROM server_ip WHERE ip_type = ? AND server_id = ? AND (client_id = 0 OR client_id=?)";
$ips = $app->db->queryAllRecords($sql, $ip_type, $server_id, $tmp['groupid']);
$ips = $app->db->queryAllRecords($sql, $ip_type, $server_id, $tmp['client_id']);
// $ip_select = "<option value=''></option>";
if($ip_type == 'IPv4'){
$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"*#":"";
......
......@@ -544,7 +544,7 @@ var ISPConfig = {
newVal[newVal.length] = 'n' + ISPConfig.new_tpl_add_id + ':' + addTplId;
$('<li>' + addTplText + '</li>').attr('rel', 'n' + ISPConfig.new_tpl_add_id).append(delbtn).appendTo('#template_additional_list ul');
$('#template_additional').val(newVal.join('/'));
alert('additional template ' + addTplText + ' added to customer');
//alert('additional template ' + addTplText + ' added to customer');
} else {
alert('no additional template selcted');
}
......@@ -566,7 +566,7 @@ var ISPConfig = {
newVal[newVal.length] = oldVal[i];
}
$('#template_additional').val(newVal.join('/'));
alert('additional template ' + addTplText + ' deleted from customer');
//alert('additional template ' + addTplText + ' deleted from customer');
} else if(tpl_add != '') {
// old style
var addTemplate = document.getElementById('tpl_add_select').value.split('|',2);
......@@ -587,7 +587,7 @@ var ISPConfig = {
newVal = newVal.replace(repl, '');
newVal = newVal.replace('//', '/');
$('#template_additional').val(newVal);
alert('additional template ' + addTplText + ' deleted from customer');
//alert('additional template ' + addTplText + ' deleted from customer');
} else {
alert('no additional template selcted');
}
......
......@@ -6,8 +6,8 @@ listen.allowed_clients = 127.0.0.1
</tmpl_if>
<tmpl_if name='use_socket'>
listen = <tmpl_var name='fpm_socket'>
listen.owner = <tmpl_var name='fpm_user'>
listen.group = <tmpl_var name='fpm_group'>
listen.owner = <tmpl_var name='fpm_listen_user'>
listen.group = <tmpl_var name='fpm_listen_group'>
listen.mode = <tmpl_var name='fpm_listen_mode'>
</tmpl_if>
......
......@@ -37,11 +37,11 @@ if (is_file($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock')) {
$pid = trim(file_get_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock'));
if(preg_match('/^[0-9]+$/', $pid)) {
if(file_exists('/proc/' . $pid)) {
print @date('d.m.Y-H:i').' - WARNING - There is already an instance of server.php running with pid ' . $pid . '.' . "\n";
if($conf['log_priority'] <= LOGLEVEL_WARN) print @date('d.m.Y-H:i').' - WARNING - There is already an instance of server.php running with pid ' . $pid . '.' . "\n";
exit;
}
}
print @date('d.m.Y-H:i').' - WARNING - There is already a lockfile set, but no process running with this pid (' . $pid . '). Continuing.' . "\n";
if($conf['log_priority'] <= LOGLEVEL_WARN) print @date('d.m.Y-H:i').' - WARNING - There is already a lockfile set, but no process running with this pid (' . $pid . '). Continuing.' . "\n";
}
// Set Lockfile
......@@ -90,15 +90,15 @@ foreach($files as $f) {
if(class_exists($class_name, false)) {
$cronjob = new $class_name();
if(get_parent_class($cronjob) !== 'cronjob') {
print 'Invalid class ' . $class_name . ' not extending class cronjob (' . get_parent_class($cronjob) . ')!' . "\n";
if($conf['log_priority'] <= LOGLEVEL_WARN) print 'Invalid class ' . $class_name . ' not extending class cronjob (' . get_parent_class($cronjob) . ')!' . "\n";
unset($cronjob);
continue;
}
print 'Included ' . $class_name . ' from ' . $path . '/' . $f . ' -> will now run job.' . "\n";
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print 'Included ' . $class_name . ' from ' . $path . '/' . $f . ' -> will now run job.' . "\n";
$cronjob->run();
print 'run job (' . $class_name . ') done.' . "\n";
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print 'run job (' . $class_name . ') done.' . "\n";
unset($cronjob);
}
......@@ -109,6 +109,6 @@ unset($files);
@unlink($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock');
$app->log('Remove Lock: ' . $conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock', LOGLEVEL_DEBUG);
die("finished.\n");
if($conf['log_priority'] <= LOGLEVEL_DEBUG) die("finished.\n");
?>
......@@ -77,9 +77,10 @@ class cronjob {
/** run through cronjob sequence **/
public function run() {
print "Called run() for class " . get_class($this) . "\n";
print "Job has schedule: " . $this->getSchedule() . "\n";
global $conf;
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print "Called run() for class " . get_class($this) . "\n";
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print "Job has schedule: " . $this->getSchedule() . "\n";
$this->onPrepare();
$run_it = $this->onBeforeRun();
if($run_it == true) {
......@@ -93,9 +94,9 @@ class cronjob {
/* this function prepares some data for the job and sets next run time if first executed */
protected function onPrepare() {
global $app;
global $app, $conf;
print "Called onPrepare() for class " . get_class($this) . "\n";
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print "Called onPrepare() for class " . get_class($this) . "\n";
// check the run time and values for this job
// get previous run data
......@@ -120,15 +121,15 @@ class cronjob {
/* this function checks if a cron job's next runtime is reached and returns true or false */
protected function onBeforeRun() {
global $app;
global $app, $conf;
print "Called onBeforeRun() for class " . get_class($this) . "\n";
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print "Called onBeforeRun() for class " . get_class($this) . "\n";
if($this->_running == true) return false; // job is still marked as running!
print "Jobs next run is " . $this->_next_run . "\n";
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print "Jobs next run is " . $this->_next_run . "\n";
$reached = ISPConfigDateTime::compare($this->_next_run, ISPConfigDateTime::dbtime());
print "Date compare of " . ISPConfigDateTime::to_timestamp($this->_next_run) . " and " . ISPConfigDateTime::dbtime() . " is " . $reached . "\n";
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print "Date compare of " . ISPConfigDateTime::to_timestamp($this->_next_run) . " and " . ISPConfigDateTime::dbtime() . " is " . $reached . "\n";
if($reached === false) return false; // error!
if($reached === -1) {
......@@ -152,7 +153,7 @@ class cronjob {
$next_run = $app->cron->getNextRun(ISPConfigDateTime::dbtime());
}
print "Jobs next run is now " . $next_run . "\n";
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print "Jobs next run is now " . $next_run . "\n";
$app->db->query("REPLACE INTO `sys_cron` (`name`, `last_run`, `next_run`, `running`) VALUES (?, NOW(), ?, 1)", get_class($this), ($next_run === false ? "#NULL#" : $next_run));
return true;
......@@ -160,23 +161,23 @@ class cronjob {
// child classes should override this!
protected function onRunJob() {
global $app;
global $app, $conf;
print "Called onRun() for class " . get_class($this) . "\n";
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print "Called onRun() for class " . get_class($this) . "\n";
}
// child classes may override this!
protected function onAfterRun() {
global $app;
global $app, $conf;
print "Called onAfterRun() for class " . get_class($this) . "\n";
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print "Called onAfterRun() for class " . get_class($this) . "\n";
}
// child classes may NOT override this!
private function onCompleted() {
global $app;
global $app, $conf;
print "Called onCompleted() for class " . get_class($this) . "\n";
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print "Called onCompleted() for class " . get_class($this) . "\n";
$app->db->query("UPDATE `sys_cron` SET `running` = 0 WHERE `name` = ?", get_class($this));
}
......
......@@ -121,7 +121,7 @@ class apache2_plugin {
}
unset($tmp);
}
if(!$master_php_ini_path) {
if($web_data['php'] == 'fast-cgi' && file_exists($fastcgi_config["fastcgi_phpini_path"])) {
$master_php_ini_path = $fastcgi_config["fastcgi_phpini_path"];
......@@ -132,6 +132,13 @@ class apache2_plugin {
}
}
}
// Resolve inconsistant path settings
if($master_php_ini_path != '' && is_dir($master_php_ini_path) && is_file($master_php_ini_path.'/php.ini')) {
$master_php_ini_path .= '/php.ini';
}
// Load the custom php.ini content
if($master_php_ini_path != '' && substr($master_php_ini_path, -7) == 'php.ini' && is_file($master_php_ini_path)) {
$php_ini_content .= $app->system->file_get_contents($master_php_ini_path)."\n";
}
......@@ -3131,7 +3138,9 @@ class apache2_plugin {
$tpl->setVar('fpm_pool', $pool_name);
$tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1);
$tpl->setVar('fpm_user', $data['new']['system_user']);
$tpl->setVar('fpm_group', $web_config['group']);
$tpl->setVar('fpm_group', $data['new']['system_group']);
$tpl->setVar('fpm_listen_user', $data['new']['system_user']);
$tpl->setVar('fpm_listen_group', $web_config['group']);
$tpl->setVar('fpm_domain', $data['new']['domain']);
$tpl->setVar('pm', $data['new']['pm']);
$tpl->setVar('pm_max_children', $data['new']['pm_max_children']);
......
......@@ -38,7 +38,7 @@ class firewall_plugin {
public function onInstall() {
global $conf;
if($conf['bastille']['installed'] == true && $conf['services']['firewall'] == true) {
if(($conf['bastille']['installed'] == true || $conf['ufw']['installed'] == true || $conf['firewall']['installed'] == true) && $conf['services']['firewall'] == true) {
return true;
} else {
return false;
......
......@@ -2785,7 +2785,9 @@ class nginx_plugin {
$tpl->setVar('fpm_pool', $pool_name);
$tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1);
$tpl->setVar('fpm_user', $data['new']['system_user']);
$tpl->setVar('fpm_group', $web_config['group']);
$tpl->setVar('fpm_group', $data['new']['system_group']);
$tpl->setVar('fpm_listen_user', $data['new']['system_user']);
$tpl->setVar('fpm_listen_group', $web_config['group']);
$tpl->setVar('pm', $data['new']['pm']);
$tpl->setVar('pm_max_children', $data['new']['pm_max_children']);
$tpl->setVar('pm_start_servers', $data['new']['pm_start_servers']);
......
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