"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "interface/lib/classes/functions.inc.php" between
ISPConfig-3.2.4.tar.gz and ISPConfig-3.2.5.tar.gz

About: ISPConfig is an ISP management and Hosting Control Panel (for different Managed Services).

functions.inc.php  (ISPConfig-3.2.4):functions.inc.php  (ISPConfig-3.2.5)
skipping to change at line 529 skipping to change at line 529
public function check_language($language) { public function check_language($language) {
global $app; global $app;
if(preg_match('/^[a-z]{2}$/',$language)) { if(preg_match('/^[a-z]{2}$/',$language)) {
return $language; return $language;
} else { } else {
$app->log('Wrong language string: '.$this->htmlentities($ language),1); $app->log('Wrong language string: '.$this->htmlentities($ language),1);
return 'en'; return 'en';
} }
} }
// Function to lock a client
public function func_client_lock($client_id,$locked) {
global $app;
$client_data = $app->db->queryOneRecord('SELECT `tmp_data` FROM `
client` WHERE `client_id` = ?', $client_id);
if($client_data['tmp_data'] == '') $tmp_data = array();
else $tmp_data = unserialize($client_data['tmp_data']);
if(!is_array($tmp_data)) $tmp_data = array();
$to_disable = array('cron' => 'id',
'ftp_user' => 'ftp_user_i
d',
'mail_domain' => 'domain_
id',
'mail_user' => 'mailuser_
id',
'mail_user_smtp' => 'mail
user_id',
'mail_forwarding' => 'for
warding_id',
'mail_get' => 'mailget_id
',
'openvz_vm' => 'vm_id',
'shell_user' => 'shell_us
er_id',
'webdav_user' => 'webdav_
user_id',
'web_database' => 'databa
se_id',
'web_domain' => 'domain_i
d',
'web_folder' => 'web_fold
er_id',
'web_folder_user' => 'web
_folder_user_id'
);
$udata = $app->db->queryOneRecord('SELECT `userid` FROM `sys_user
` WHERE `client_id` = ?', $client_id);
$gdata = $app->db->queryOneRecord('SELECT `groupid` FROM `sys_gro
up` WHERE `client_id` = ?', $client_id);
$sys_groupid = $gdata['groupid'];
$sys_userid = $udata['userid'];
if($locked == 'y') {
$prev_active = array();
$prev_sysuser = array();
foreach($to_disable as $current => $keycolumn) {
$active_col = 'active';
$reverse = false;
if($current == 'mail_user') {
$active_col = 'postfix';
} elseif($current == 'mail_user_smtp') {
$current = 'mail_user';
$active_col = 'disablesmtp';
$reverse = true;
}
if(!isset($prev_active[$current])) $prev_active[$
current] = array();
if(!isset($prev_sysuser[$current])) $prev_sysuser
[$current] = array();
$entries = $app->db->queryAllRecords('SELECT ?? a
s `id`, `sys_userid`, ?? FROM ?? WHERE `sys_groupid` = ?', $keycolumn, $active_c
ol, $current, $sys_groupid);
foreach($entries as $item) {
if($item[$active_col] != 'y' && $
reverse == false) $prev_active[$current][$item['id']][$active_col] = 'n';
elseif($item[$active_col] == 'y'
&& $reverse == true) $prev_active[$current][$item['id']][$active_col] = 'y';
if($item['sys_userid'] != $sys_us
erid) $prev_sysuser[$current][$item['id']] = $item['sys_userid'];
// we don't have to store these i
f y, as everything without previous state gets enabled later
//$app->db->datalogUpdate($curren
t, array($active_col => ($reverse == true ? 'y' : 'n'), 'sys_userid' => $_SESSIO
N["s"]["user"]["userid"]), $keycolumn, $item['id']);
$app->db->datalogUpdate($current,
array($active_col => ($reverse == true ? 'y' : 'n'), 'sys_userid' => $sys_useri
d), $keycolumn, $item['id']);
}
}
$tmp_data['prev_active'] = $prev_active;
$tmp_data['prev_sys_userid'] = $prev_sysuser;
$app->db->query("UPDATE `client` SET `tmp_data` = ? WHERE
`client_id` = ?", serialize($tmp_data), $client_id);
unset($prev_active);
unset($prev_sysuser);
} elseif ($locked == 'n') {
foreach($to_disable as $current => $keycolumn) {
$active_col = 'active';
$reverse = false;
if($current == 'mail_user') {
$active_col = 'postfix';
} elseif($current == 'mail_user_smtp') {
$current = 'mail_user';
$active_col = 'disablesmtp';
$reverse = true;
}
$entries = $app->db->queryAllRecords('SELECT ?? a
s `id` FROM ?? WHERE `sys_groupid` = ?', $keycolumn, $current, $sys_groupid);
foreach($entries as $item) {
$set_active = ($reverse == true ?
'n' : 'y');
$set_inactive = ($reverse == true
? 'y' : 'n');
$set_sysuser = $sys_userid;
if(array_key_exists('prev_active'
, $tmp_data) == true
&& array_key_exis
ts($current, $tmp_data['prev_active']) == true
&& array_key_exis
ts($item['id'], $tmp_data['prev_active'][$current]) == true
&& $tmp_data['pre
v_active'][$current][$item['id']][$active_col] == $set_inactive) $set_active = $
set_inactive;
if(array_key_exists('prev_sysuser
', $tmp_data) == true
&& array_key_exis
ts($current, $tmp_data['prev_sysuser']) == true
&& array_key_exis
ts($item['id'], $tmp_data['prev_sysuser'][$current]) == true
&& $tmp_data['pre
v_sysuser'][$current][$item['id']] != $sys_userid) $set_sysuser = $tmp_data['pre
v_sysuser'][$current][$item['id']];
$app->db->datalogUpdate($current,
array($active_col => $set_active, 'sys_userid' => $set_sysuser), $keycolumn, $i
tem['id']);
}
}
if(array_key_exists('prev_active', $tmp_data)) unset($tmp
_data['prev_active']);
$app->db->query("UPDATE `client` SET `tmp_data` = ? WHERE
`client_id` = ?", serialize($tmp_data), $client_id);
}
unset($tmp_data);
unset($entries);
unset($to_disable);
}
// Function to cancel disable/enable a client
public function func_client_cancel($client_id,$cancel) {
global $app;
if ($cancel == 'y') {
$sql = "UPDATE sys_user SET active = '0' WHERE client_id
= ?";
$result = $app->db->query($sql, $client_id);
} elseif($cancel == 'n') {
$sql = "UPDATE sys_user SET active = '1' WHERE client_id
= ?";
$result = $app->db->query($sql, $client_id);
} else {
$result = false;
}
return $result;
}
} }
?> ?>
 End of changes. 1 change blocks. 
0 lines changed or deleted 158 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)