tbrehm
2008-11-17 d4d985e00f1f70dd390bd5aaf40062416d73f4e7
Data records are now assigned to the correct client group if they were created by the administrator.
23 files modified
128 ■■■■■ changed files
install/sql/ispconfig3.sql 2 ●●● patch | view | raw | blame | history
interface/lib/classes/tform.inc.php 10 ●●●●● patch | view | raw | blame | history
interface/lib/classes/tform_actions.inc.php patch | view | raw | blame | history
interface/lib/config.inc.php 3 ●●●● patch | view | raw | blame | history
interface/web/dns/dns_a_edit.php 5 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_alias_edit.php 4 ●●●● patch | view | raw | blame | history
interface/web/dns/dns_cname_edit.php 4 ●●●● patch | view | raw | blame | history
interface/web/dns/dns_hinfo_edit.php 4 ●●●● patch | view | raw | blame | history
interface/web/dns/dns_mx_edit.php 4 ●●●● patch | view | raw | blame | history
interface/web/dns/dns_ns_edit.php 4 ●●●● patch | view | raw | blame | history
interface/web/dns/dns_ptr_edit.php 4 ●●●● patch | view | raw | blame | history
interface/web/dns/dns_rp_edit.php 4 ●●●● patch | view | raw | blame | history
interface/web/dns/dns_srv_edit.php 4 ●●●● patch | view | raw | blame | history
interface/web/dns/dns_txt_edit.php 4 ●●●● patch | view | raw | blame | history
interface/web/mail/mail_alias_edit.php 9 ●●●●● patch | view | raw | blame | history
interface/web/mail/mail_domain_catchall_edit.php 12 ●●●● patch | view | raw | blame | history
interface/web/mail/mail_forward_edit.php 10 ●●●●● patch | view | raw | blame | history
interface/web/mail/mail_get_edit.php 8 ●●●●● patch | view | raw | blame | history
interface/web/mail/mail_user_filter_edit.php 5 ●●●● patch | view | raw | blame | history
interface/web/sites/web_aliasdomain_edit.php 10 ●●●●● patch | view | raw | blame | history
interface/web/sites/web_subdomain_edit.php 11 ●●●●● patch | view | raw | blame | history
interface/web/tools/form/user_settings.tform.php 2 ●●● patch | view | raw | blame | history
interface/web/tools/user_settings.php 5 ●●●●● patch | view | raw | blame | history
install/sql/ispconfig3.sql
@@ -444,7 +444,7 @@
  `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,
interface/lib/classes/tform.inc.php
@@ -800,6 +800,7 @@
                        $sql_insert_val = substr($sql_insert_val,0,-2);
                        $sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
                } else {
                    if($this->formDef['auth'] == 'yes') {
                        if($primary_id != 0) {
                                $sql_update = substr($sql_update,0,-2);
                                $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->getAuthSQL('u')." AND ".$this->formDef['db_table_idx']." = ".$primary_id;
@@ -807,6 +808,15 @@
                        } else {
                                $app->error("Primary ID fehlt!");
                        }
                    } else {
                        if($primary_id != 0) {
                                $sql_update = substr($sql_update,0,-2);
                                $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
                                if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
                        } else {
                                $app->error("Primary ID fehlt!");
                        }
                    }
                }
                
                return $sql;
interface/lib/classes/tform_actions.inc.php
interface/lib/config.inc.php
@@ -51,7 +51,7 @@
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 @@
*/
//**  External programs
//$conf["programs"]["convert"]    = "/usr/bin/convert";
$conf['programs']['wput']        = ISPC_ROOT_PATH."\\tools\\wput\\wput.exe";
interface/web/dns/dns_a_edit.php
@@ -110,6 +110,11 @@
        $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() {
interface/web/dns/dns_alias_edit.php
@@ -110,6 +110,10 @@
        $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() {
interface/web/dns/dns_cname_edit.php
@@ -110,6 +110,10 @@
        $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() {
interface/web/dns/dns_hinfo_edit.php
@@ -110,6 +110,10 @@
        $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() {
interface/web/dns/dns_mx_edit.php
@@ -110,6 +110,10 @@
        $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() {
interface/web/dns/dns_ns_edit.php
@@ -110,6 +110,10 @@
        $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() {
interface/web/dns/dns_ptr_edit.php
@@ -110,6 +110,10 @@
        $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() {
interface/web/dns/dns_rp_edit.php
@@ -110,6 +110,10 @@
        $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() {
interface/web/dns/dns_srv_edit.php
@@ -110,6 +110,10 @@
        $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() {
interface/web/dns/dns_txt_edit.php
@@ -110,6 +110,10 @@
        $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() {
interface/web/mail/mail_alias_edit.php
@@ -129,6 +129,15 @@
        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;
interface/web/mail/mail_domain_catchall_edit.php
@@ -85,7 +85,7 @@
        $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 @@
            $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 @@
        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;
interface/web/mail/mail_forward_edit.php
@@ -84,7 +84,7 @@
        $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 @@
        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;
interface/web/mail/mail_get_edit.php
@@ -99,6 +99,14 @@
        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;
interface/web/mail/mail_user_filter_edit.php
@@ -68,10 +68,13 @@
    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);
    }
    
    function onAfterUpdate() {
interface/web/sites/web_aliasdomain_edit.php
@@ -50,6 +50,8 @@
class page_action extends tform_actions {
    
    var $parent_domain_record;
    function onShowNew() {
        global $app, $conf;
        
@@ -98,10 +100,18 @@
        $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;
interface/web/sites/web_subdomain_edit.php
@@ -50,6 +50,8 @@
class page_action extends tform_actions {
    
    var $parent_domain_record;
    function onShowNew() {
        global $app, $conf;
        
@@ -97,10 +99,19 @@
        $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;
interface/web/tools/form/user_settings.tform.php
@@ -69,7 +69,7 @@
$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; 
interface/web/tools/user_settings.php
@@ -64,6 +64,7 @@
                
                // Importing ID
                $this->id = $_SESSION['s']['user']['userid'];
                $_POST['id'] = $_SESSION['s']['user']['userid'];
                if(count($_POST) > 1) {
                        $this->dataRecord = $_POST;
@@ -73,6 +74,10 @@
                }
        }
        
    function onInsert() {
        die('No inserts allowed.');
    }
    function onBeforeUpdate() {
        global $app, $conf;