Commit d4d985e0 authored by tbrehm's avatar tbrehm

Data records are now assigned to the correct client group if they were created...

Data records are now assigned to the correct client group if they were created by the administrator.
parent c2d9267b
......@@ -444,7 +444,7 @@ CREATE TABLE `mail_user` (
`quota` int(11) NOT NULL default '0',
`homedir` varchar(255) NOT NULL,
`autoresponder` enum('n','y') NOT NULL default 'n',
`autoresponder_text` tinytext NOT NULL,
`autoresponder_text` tinytext NULL,
`custom_mailfilter` text,
`postfix` enum('y','n') NOT NULL,
`access` enum('y','n') NOT NULL,
......
This diff is collapsed.
This diff is collapsed.
......@@ -51,7 +51,7 @@ define('ISPC_THEMES_PATH', ISPC_ROOT_PATH.'/web/themes');
define('ISPC_WEB_TEMP_PATH', ISPC_WEB_PATH.'/temp'); // Path for downloads, accessible via browser
define('ISPC_CACHE_PATH', ISPC_ROOT_PATH.'/cache');
define('ISPC_INTERFACE_MODULES_ENABLED', 'mail,sites,dns');
define('ISPC_INTERFACE_MODULES_ENABLED', 'mail,sites,dns,tools');
//********************************************************************************
//** Future Code idea - pedro - rfc
......@@ -107,6 +107,7 @@ $conf['db_database'] = 'ispconfig3';
*/
//** External programs
//$conf["programs"]["convert"] = "/usr/bin/convert";
$conf['programs']['wput'] = ISPC_ROOT_PATH."\\tools\\wput\\wput.exe";
......
......@@ -110,6 +110,11 @@ class page_action extends tform_actions {
$soa_id = intval($_POST["zone"]);
$serial = time();
$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
// Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
$soa = $app->db->queryOneRecord("SELECT sys_groupid FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("UPDATE dns_rr SET sys_groupid = ".$soa['sys_groupid']." WHERE id = ".$this->id);
}
function onAfterUpdate() {
......
......@@ -110,6 +110,10 @@ class page_action extends tform_actions {
$soa_id = intval($_POST["zone"]);
$serial = time();
$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
// Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
$soa = $app->db->queryOneRecord("SELECT sys_groupid FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("UPDATE dns_rr SET sys_groupid = ".$soa['sys_groupid']." WHERE id = ".$this->id);
}
function onAfterUpdate() {
......
......@@ -110,6 +110,10 @@ class page_action extends tform_actions {
$soa_id = intval($_POST["zone"]);
$serial = time();
$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
// Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
$soa = $app->db->queryOneRecord("SELECT sys_groupid FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("UPDATE dns_rr SET sys_groupid = ".$soa['sys_groupid']." WHERE id = ".$this->id);
}
function onAfterUpdate() {
......
......@@ -110,6 +110,10 @@ class page_action extends tform_actions {
$soa_id = intval($_POST["zone"]);
$serial = time();
$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
// Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
$soa = $app->db->queryOneRecord("SELECT sys_groupid FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("UPDATE dns_rr SET sys_groupid = ".$soa['sys_groupid']." WHERE id = ".$this->id);
}
function onAfterUpdate() {
......
......@@ -110,6 +110,10 @@ class page_action extends tform_actions {
$soa_id = intval($_POST["zone"]);
$serial = time();
$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
// Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
$soa = $app->db->queryOneRecord("SELECT sys_groupid FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("UPDATE dns_rr SET sys_groupid = ".$soa['sys_groupid']." WHERE id = ".$this->id);
}
function onAfterUpdate() {
......
......@@ -110,6 +110,10 @@ class page_action extends tform_actions {
$soa_id = intval($_POST["zone"]);
$serial = time();
$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
// Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
$soa = $app->db->queryOneRecord("SELECT sys_groupid FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("UPDATE dns_rr SET sys_groupid = ".$soa['sys_groupid']." WHERE id = ".$this->id);
}
function onAfterUpdate() {
......
......@@ -110,6 +110,10 @@ class page_action extends tform_actions {
$soa_id = intval($_POST["zone"]);
$serial = time();
$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
// Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
$soa = $app->db->queryOneRecord("SELECT sys_groupid FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("UPDATE dns_rr SET sys_groupid = ".$soa['sys_groupid']." WHERE id = ".$this->id);
}
function onAfterUpdate() {
......
......@@ -110,6 +110,10 @@ class page_action extends tform_actions {
$soa_id = intval($_POST["zone"]);
$serial = time();
$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
// Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
$soa = $app->db->queryOneRecord("SELECT sys_groupid FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("UPDATE dns_rr SET sys_groupid = ".$soa['sys_groupid']." WHERE id = ".$this->id);
}
function onAfterUpdate() {
......
......@@ -110,6 +110,10 @@ class page_action extends tform_actions {
$soa_id = intval($_POST["zone"]);
$serial = time();
$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
// Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
$soa = $app->db->queryOneRecord("SELECT sys_groupid FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("UPDATE dns_rr SET sys_groupid = ".$soa['sys_groupid']." WHERE id = ".$this->id);
}
function onAfterUpdate() {
......
......@@ -110,6 +110,10 @@ class page_action extends tform_actions {
$soa_id = intval($_POST["zone"]);
$serial = time();
$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
// Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
$soa = $app->db->queryOneRecord("SELECT sys_groupid FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("UPDATE dns_rr SET sys_groupid = ".$soa['sys_groupid']." WHERE id = ".$this->id);
}
function onAfterUpdate() {
......
......@@ -129,6 +129,15 @@ class page_action extends tform_actions {
parent::onSubmit();
}
function onAfterInsert() {
global $app;
$domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("update mail_forwarding SET sys_groupid = ".$domain['sys_groupid']." WHERE forwarding_id = ".$this->id);
}
}
$page = new page_action;
......
......@@ -85,7 +85,7 @@ class page_action extends tform_actions {
$domain_select = '';
if(is_array($domains)) {
foreach( $domains as $domain) {
$selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
$selected = (isset($email_parts[1]) && $domain["domain"] == $email_parts[1])?'SELECTED':'';
$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
}
}
......@@ -107,7 +107,7 @@ class page_action extends tform_actions {
$client_group_id = $_SESSION["s"]["user"]["default_group"];
$client = $app->db->queryOneRecord("SELECT limit_mailcatchall FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
// Check if the user may add another mailbox.
// Check if the user may add another catchall
if($this->id == 0 && $client["limit_mailcatchall"] >= 0) {
$tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE sys_groupid = $client_group_id AND type = 'catchall'");
if($tmp["number"] >= $client["limit_mailcatchall"]) {
......@@ -128,6 +128,14 @@ class page_action extends tform_actions {
parent::onSubmit();
}
function onAfterInsert() {
global $app;
$domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("update mail_forwarding SET sys_groupid = ".$domain['sys_groupid']." WHERE forwarding_id = ".$this->id);
}
}
$page = new page_action;
......
......@@ -84,7 +84,7 @@ class page_action extends tform_actions {
$domains = $app->db->queryAllRecords($sql);
$domain_select = '';
foreach( $domains as $domain) {
$selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
$selected = (isset($email_parts[1]) && $domain["domain"] == $email_parts[1])?'SELECTED':'';
$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
}
$app->tpl->setVar("email_domain",$domain_select);
......@@ -126,6 +126,14 @@ class page_action extends tform_actions {
parent::onSubmit();
}
function onAfterInsert() {
global $app;
$domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->query("update mail_forwarding SET sys_groupid = ".$domain['sys_groupid']." WHERE forwarding_id = ".$this->id);
}
}
$page = new page_action;
......
......@@ -99,6 +99,14 @@ class page_action extends tform_actions {
parent::onSubmit();
}
function onAfterInsert() {
global $app;
$tmp = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_user WHERE email = '".mysql_real_escape_string($this->dataRecord["destination"])."'");
$app->db->query("update mail_get SET sys_groupid = ".$tmp['sys_groupid']." WHERE mailget_id = ".$this->id);
}
}
$page = new page_action;
......
......@@ -68,9 +68,12 @@ class page_action extends tform_actions {
function onAfterInsert() {
global $app, $conf;
$mailuser = $app->db->queryOneRecord("SELECT custom_mailfilter FROM mail_user WHERE mailuser_id = ".$this->dataRecord["mailuser_id"]);
$mailuser = $app->db->queryOneRecord("SELECT sys_groupid, custom_mailfilter FROM mail_user WHERE mailuser_id = ".$this->dataRecord["mailuser_id"]);
$rule_content = $mailuser['custom_mailfilter']."\n".$app->db->quote($this->getRule());
$app->db->datalogUpdate('mail_user', "custom_mailfilter = '$rule_content'", 'mailuser_id', $this->dataRecord["mailuser_id"]);
// set permissions
$app->db->query("UPDATE mail_user_filter SET sys_groupid = ".$mailuser['sys_groupid']." WHERE filter_id = "$this->id);
}
......
......@@ -50,6 +50,8 @@ $app->load('tform_actions');
class page_action extends tform_actions {
var $parent_domain_record;
function onShowNew() {
global $app, $conf;
......@@ -98,10 +100,18 @@ class page_action extends tform_actions {
$this->dataRecord["server_id"] = $parent_domain["server_id"];
//$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
$this->parent_domain_record = $parent_domain;
parent::onSubmit();
}
function onAfterInsert() {
global $app, $conf;
$app->db->query('UPDATE web_domain SET sys_groupid = '.intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id);
}
}
$page = new page_action;
......
......@@ -50,6 +50,8 @@ $app->load('tform_actions');
class page_action extends tform_actions {
var $parent_domain_record;
function onShowNew() {
global $app, $conf;
......@@ -97,10 +99,19 @@ class page_action extends tform_actions {
$this->dataRecord["server_id"] = $parent_domain["server_id"];
$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
$this->parent_domain_record = $parent_domain;
parent::onSubmit();
}
function onAfterInsert() {
global $app, $conf;
$app->db->query('UPDATE web_domain SET sys_groupid = '.intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id);
}
}
$page = new page_action;
......
......@@ -69,7 +69,7 @@ $form['db_table_idx'] = 'userid';
$form["db_history"] = "no";
$form['tab_default'] = 'users';
$form['list_default'] = 'index.php';
$form['auth'] = 'yes';
$form['auth'] = 'no';
//* 0 = id of the user, > 0 id must match with id of current user
$form['auth_preset']['userid'] = 0;
......
......@@ -64,6 +64,7 @@ class page_action extends tform_actions {
// Importing ID
$this->id = $_SESSION['s']['user']['userid'];
$_POST['id'] = $_SESSION['s']['user']['userid'];
if(count($_POST) > 1) {
$this->dataRecord = $_POST;
......@@ -72,6 +73,10 @@ class page_action extends tform_actions {
$this->onShow();
}
}
function onInsert() {
die('No inserts allowed.');
}
function onBeforeUpdate() {
global $app, $conf;
......
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