tbrehm
2007-08-02 ea379616f044da73c8f927e2ed4bbb23516c8fdb
Added client limits to the DNS module.
31 files modified
652 ■■■■■ changed files
interface/web/client/client_edit.php 2 ●●● patch | view | raw | blame | history
interface/web/client/form/client.tform.php 43 ●●●●● patch | view | raw | blame | history
interface/web/client/lib/lang/en_client.lng 4 ●●●● patch | view | raw | blame | history
interface/web/client/templates/client_edit_limits.htm 19 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_a_edit.php 41 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_alias_edit.php 41 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_cname_edit.php 41 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_hinfo_edit.php 41 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_mx_edit.php 41 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_ns_edit.php 41 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_ptr_edit.php 41 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_rp_edit.php 41 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_soa_edit.php 91 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_srv_edit.php 41 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_txt_edit.php 41 ●●●●● patch | view | raw | blame | history
interface/web/dns/form/dns_soa.tform.php 3 ●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_a.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_a_list.lng 1 ●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_alias.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_cname.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_hinfo.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_mx.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_ns.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_ptr.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_rp.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_soa.lng 33 ●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_srv.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_txt.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/dns/list/dns_a.list.php 9 ●●●●● patch | view | raw | blame | history
interface/web/dns/templates/dns_a_list.htm 7 ●●●● patch | view | raw | blame | history
interface/web/dns/templates/dns_soa_edit.htm 10 ●●●●● patch | view | raw | blame | history
interface/web/client/client_edit.php
@@ -66,7 +66,7 @@
        
        $username = addslashes($this->dataRecord["username"]);
        $password = addslashes($this->dataRecord["password"]);
        $modules = 'mail,sites';
        $modules = 'mail,sites,dns';
        $startmodule = 'mail';
        $usertheme = addslashes($this->dataRecord["usertheme"]);
        $type = 'user';
interface/web/client/form/client.tform.php
@@ -285,7 +285,7 @@
            'formtype'    => 'SELECT',
            'default'    => '1',
            'datasource'    => array (     'type'    => 'SQL',
                                        'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
                                        'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND {AUTHSQL} ORDER BY server_name',
                                        'keyfield'=> 'server_id',
                                        'valuefield'=> 'server_name'
                                     ),
@@ -464,7 +464,7 @@
            'formtype'    => 'SELECT',
            'default'    => '1',
            'datasource'    => array (     'type'    => 'SQL',
                                        'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
                                        'querystring' => 'SELECT server_id,server_name FROM server WHERE web_server = 1 AND {AUTHSQL} ORDER BY server_name',
                                        'keyfield'=> 'server_id',
                                        'valuefield'=> 'server_name'
                                     ),
@@ -526,6 +526,45 @@
            'rows'        => '',
            'cols'        => ''
        ),
        'default_dnsserver' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'SELECT',
            'default'    => '1',
            'datasource'    => array (     'type'    => 'SQL',
                                        'querystring' => 'SELECT server_id,server_name FROM server WHERE dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
                                        'keyfield'=> 'server_id',
                                        'valuefield'=> 'server_name'
                                     ),
            'value'        => ''
        ),
        'limit_dns_zone' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'ISINT',
                                                        'errmsg'=> 'limit_dns_zone_error_notint'),
                                    ),
            'default'    => '-1',
            'value'        => '',
            'separator'    => '',
            'width'        => '10',
            'maxlength'    => '10',
            'rows'        => '',
            'cols'        => ''
        ),
        'limit_dns_record' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'ISINT',
                                                        'errmsg'=> 'limit_dns_zone_error_notint'),
                                    ),
            'default'    => '-1',
            'value'        => '',
            'separator'    => '',
            'width'        => '10',
            'maxlength'    => '10',
            'rows'        => '',
            'cols'        => ''
        ),
    ##################################
    # END Datatable fields
    ##################################
interface/web/client/lib/lang/en_client.lng
@@ -50,5 +50,9 @@
$wb["limit_web_aliasdomain_txt"] = 'Max. number of web aliasdomains';
$wb["limit_web_subdomain_txt"] = 'Max. number of web subdomains';
$wb["limit_ftp_user_txt"] = 'Max. number of FTP users';
$wb["default_dnsserver_txt"] = 'Default DNS Server';
$wb["limit_dns_zone_txt"] = 'Max. number of DNS zones';
$wb["limit_dns_record_txt"] = 'Max. number DNS records';
?>
interface/web/client/templates/client_edit_limits.htm
@@ -91,6 +91,25 @@
    <td class="frmText11" width="220"><input name="limit_ftp_user" type="text" class="text" value="{tmpl_var name='limit_ftp_user'}" size="10" maxlength="10"></td>
  </tr>
  <tr>
    <td><h2>DNS</h2></td>
  </tr>
  <tr>
    <td class="frmText11">{tmpl_var name='default_dnsserver_txt'}:</td>
    <td class="frmText11">
        <select name="default_dnsserver" class="text">
            {tmpl_var name='default_dnsserver'}
        </select>
    </td>
  </tr>
  <tr>
    <td class="frmText11" width="280">{tmpl_var name='limit_dns_zone_txt'}:</td>
    <td class="frmText11" width="220"><input name="limit_dns_zone" type="text" class="text" value="{tmpl_var name='limit_dns_zone'}" size="10" maxlength="10"></td>
  </tr>
  <tr>
    <td class="frmText11" width="280">{tmpl_var name='limit_dns_record_txt'}:</td>
    <td class="frmText11" width="220"><input name="limit_dns_record" type="text" class="text" value="{tmpl_var name='limit_dns_record'}" size="10" maxlength="10"></td>
  </tr>
  <tr>
    <td class="frmText11">&nbsp;</td>
    <td class="frmText11">&nbsp;</td>
  </tr>
interface/web/dns/dns_a_edit.php
@@ -53,11 +53,52 @@
class page_action extends tform_actions {
    
    function onShowNew() {
        global $app, $conf;
        // we will check only users, not admins
        if($_SESSION["s"]["user"]["typ"] == 'user') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        }
        parent::onShowNew();
    }
    function onSubmit() {
        global $app, $conf;
        
        // Get the parent soa record of the domain
        $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
        // Check if Domain belongs to user
        if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
        // Check the client limits, if user is not the admin
        if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($this->id == 0 && $client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        } // end if user is not admin
        
        // Set the server ID of the rr record to the same server ID as the parent record.
        $this->dataRecord["server_id"] = $soa["server_id"];
interface/web/dns/dns_alias_edit.php
@@ -53,11 +53,52 @@
class page_action extends tform_actions {
    
    function onShowNew() {
        global $app, $conf;
        // we will check only users, not admins
        if($_SESSION["s"]["user"]["typ"] == 'user') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        }
        parent::onShowNew();
    }
    function onSubmit() {
        global $app, $conf;
        
        // Get the parent soa record of the domain
        $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
        // Check if Domain belongs to user
        if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
        // Check the client limits, if user is not the admin
        if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        } // end if user is not admin
        
        // Set the server ID of the rr record to the same server ID as the parent record.
        $this->dataRecord["server_id"] = $soa["server_id"];
interface/web/dns/dns_cname_edit.php
@@ -53,11 +53,52 @@
class page_action extends tform_actions {
    
    function onShowNew() {
        global $app, $conf;
        // we will check only users, not admins
        if($_SESSION["s"]["user"]["typ"] == 'user') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        }
        parent::onShowNew();
    }
    function onSubmit() {
        global $app, $conf;
        
        // Get the parent soa record of the domain
        $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
        // Check if Domain belongs to user
        if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
        // Check the client limits, if user is not the admin
        if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($this->id == 0 && $client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        } // end if user is not admin
        
        // Set the server ID of the rr record to the same server ID as the parent record.
        $this->dataRecord["server_id"] = $soa["server_id"];
interface/web/dns/dns_hinfo_edit.php
@@ -53,11 +53,52 @@
class page_action extends tform_actions {
    
    function onShowNew() {
        global $app, $conf;
        // we will check only users, not admins
        if($_SESSION["s"]["user"]["typ"] == 'user') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        }
        parent::onShowNew();
    }
    function onSubmit() {
        global $app, $conf;
        
        // Get the parent soa record of the domain
        $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
        // Check if Domain belongs to user
        if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
        // Check the client limits, if user is not the admin
        if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($this->id == 0 && $client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        } // end if user is not admin
        
        // Set the server ID of the rr record to the same server ID as the parent record.
        $this->dataRecord["server_id"] = $soa["server_id"];
interface/web/dns/dns_mx_edit.php
@@ -53,11 +53,52 @@
class page_action extends tform_actions {
    
    function onShowNew() {
        global $app, $conf;
        // we will check only users, not admins
        if($_SESSION["s"]["user"]["typ"] == 'user') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        }
        parent::onShowNew();
    }
    function onSubmit() {
        global $app, $conf;
        
        // Get the parent soa record of the domain
        $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
        // Check if Domain belongs to user
        if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
        // Check the client limits, if user is not the admin
        if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($this->id == 0 && $client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        } // end if user is not admin
        
        // Set the server ID of the rr record to the same server ID as the parent record.
        $this->dataRecord["server_id"] = $soa["server_id"];
interface/web/dns/dns_ns_edit.php
@@ -53,11 +53,52 @@
class page_action extends tform_actions {
    
    function onShowNew() {
        global $app, $conf;
        // we will check only users, not admins
        if($_SESSION["s"]["user"]["typ"] == 'user') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        }
        parent::onShowNew();
    }
    function onSubmit() {
        global $app, $conf;
        
        // Get the parent soa record of the domain
        $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
        // Check if Domain belongs to user
        if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
        // Check the client limits, if user is not the admin
        if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($this->id == 0 && $client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        } // end if user is not admin
        
        // Set the server ID of the rr record to the same server ID as the parent record.
        $this->dataRecord["server_id"] = $soa["server_id"];
interface/web/dns/dns_ptr_edit.php
@@ -53,11 +53,52 @@
class page_action extends tform_actions {
    
    function onShowNew() {
        global $app, $conf;
        // we will check only users, not admins
        if($_SESSION["s"]["user"]["typ"] == 'user') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        }
        parent::onShowNew();
    }
    function onSubmit() {
        global $app, $conf;
        
        // Get the parent soa record of the domain
        $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
        // Check if Domain belongs to user
        if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
        // Check the client limits, if user is not the admin
        if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($this->id == 0 && $client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        } // end if user is not admin
        
        // Set the server ID of the rr record to the same server ID as the parent record.
        $this->dataRecord["server_id"] = $soa["server_id"];
interface/web/dns/dns_rp_edit.php
@@ -53,11 +53,52 @@
class page_action extends tform_actions {
    
    function onShowNew() {
        global $app, $conf;
        // we will check only users, not admins
        if($_SESSION["s"]["user"]["typ"] == 'user') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        }
        parent::onShowNew();
    }
    function onSubmit() {
        global $app, $conf;
        
        // Get the parent soa record of the domain
        $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
        // Check if Domain belongs to user
        if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
        // Check the client limits, if user is not the admin
        if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($this->id == 0 && $client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        } // end if user is not admin
        
        // Set the server ID of the rr record to the same server ID as the parent record.
        $this->dataRecord["server_id"] = $soa["server_id"];
interface/web/dns/dns_soa_edit.php
@@ -53,8 +53,75 @@
class page_action extends tform_actions {
    
    function onShowNew() {
        global $app, $conf;
        // we will check only users, not admins
        if($_SESSION["s"]["user"]["typ"] == 'user') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_zone 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 maildomain.
            if($client["limit_dns_zone"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_soa WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_zone"]) {
                    $app->error($app->tform->wordbook["limit_dns_zone_txt"]);
                }
            }
        }
        parent::onShowNew();
    }
    function onShowEnd() {
        global $app, $conf;
        // If user is admin, we will allow him to select to whom this record belongs
        if($_SESSION["s"]["user"]["typ"] == 'admin') {
            // Getting Domains of the user
            $sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0";
            $clients = $app->db->queryAllRecords($sql);
            $client_select = "<option value='0'></option>";
            if(is_array($clients)) {
                foreach( $clients as $client) {
                    $selected = ($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
                    $client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
                }
            }
        $app->tpl->setVar("client_group_id",$client_select);
        }
        parent::onShowEnd();
    }
    function onSubmit() {
        global $app, $conf;
        // Get the limits of the client
        $client_group_id = $_SESSION["s"]["user"]["default_group"];
        $client = $app->db->queryOneRecord("SELECT limit_dns_zone, default_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
        // When the record is updated
        if($this->id > 0) {
            // restore the server ID if the user is not admin and record is edited
            $tmp = $app->db->queryOneRecord("SELECT server_id FROM dns_soa WHERE id = ".intval($this->id));
            $this->dataRecord["server_id"] = $tmp["server_id"];
            unset($tmp);
        // When the record is inserted
        } else {
            // set the server ID to the default mailserver of the client
            $this->dataRecord["server_id"] = $client["default_dnsserver"];
            // Check if the user may add another maildomain.
            if($client["limit_dns_zone"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_soa WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_zone"]) {
                    $app->error($app->tform->wordbook["limit_dns_zone_txt"]);
                }
            }
        }
        
        // Set the serial
        $this->dataRecord["serial"] = time();
@@ -62,6 +129,30 @@
        parent::onSubmit();
    }
    
    function onAfterInsert() {
        global $app, $conf;
        // make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
        if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
            $client_group_id = intval($this->dataRecord["client_group_id"]);
            $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id WHERE id = ".$this->id);
            // And we want to update all rr records too, that belong to this record
            $app->db->query("UPDATE dns_rr SET sys_groupid = $client_group_id WHERE zone = ".$this->id);
        }
    }
    function onAfterUpdate() {
        global $app, $conf;
        // make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
        if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
            $client_group_id = intval($this->dataRecord["client_group_id"]);
            $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id WHERE id = ".$this->id);
            // And we want to update all rr records too, that belong to this record
            $app->db->query("UPDATE dns_rr SET sys_groupid = $client_group_id WHERE zone = ".$this->id);
        }
    }
}
$page = new page_action;
interface/web/dns/dns_srv_edit.php
@@ -53,11 +53,52 @@
class page_action extends tform_actions {
    
    function onShowNew() {
        global $app, $conf;
        // we will check only users, not admins
        if($_SESSION["s"]["user"]["typ"] == 'user') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        }
        parent::onShowNew();
    }
    function onSubmit() {
        global $app, $conf;
        
        // Get the parent soa record of the domain
        $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
        // Check if Domain belongs to user
        if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
        // Check the client limits, if user is not the admin
        if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($this->id == 0 && $client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        } // end if user is not admin
        
        // Set the server ID of the rr record to the same server ID as the parent record.
        $this->dataRecord["server_id"] = $soa["server_id"];
interface/web/dns/dns_txt_edit.php
@@ -53,11 +53,52 @@
class page_action extends tform_actions {
    
    function onShowNew() {
        global $app, $conf;
        // we will check only users, not admins
        if($_SESSION["s"]["user"]["typ"] == 'user') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        }
        parent::onShowNew();
    }
    function onSubmit() {
        global $app, $conf;
        
        // Get the parent soa record of the domain
        $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
        // Check if Domain belongs to user
        if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
        // Check the client limits, if user is not the admin
        if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_dns_record 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.
            if($this->id == 0 && $client["limit_dns_record"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
                if($tmp["number"] >= $client["limit_dns_record"]) {
                    $app->error($app->tform->wordbook["limit_dns_record_txt"]);
                }
            }
        } // end if user is not admin
        
        // Set the server ID of the rr record to the same server ID as the parent record.
        $this->dataRecord["server_id"] = $soa["server_id"];
interface/web/dns/form/dns_soa.tform.php
@@ -107,7 +107,8 @@
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'NOTEMPTY',
                                                        'errmsg'=> 'mbox_error_empty'),
                                        1 => array (    'type'    => 'ISEMAIL',
                                        0 => array (    'type'    => 'REGEX',
                                                        'regex' => '/^[\w\.\-]{0,64}$/',
                                                        'errmsg'=> 'mbox_error_regex'),
                                    ),
            'default'    => '',
interface/web/dns/lib/lang/en_dns_a.lng
@@ -8,4 +8,6 @@
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account is reached.';
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
?>
interface/web/dns/lib/lang/en_dns_a_list.lng
@@ -4,6 +4,7 @@
$wb["server_id_txt"] = 'Server';
$wb["zone_txt"] = 'Zone';
$wb["name_txt"] = 'Name';
$wb["data_txt"] = 'Data';
$wb["type_txt"] = 'Type';
$wb["page_txt"] = 'Page';
$wb["page_of_txt"] = 'of';
interface/web/dns/lib/lang/en_dns_alias.lng
@@ -8,4 +8,6 @@
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account is reached.';
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
?>
interface/web/dns/lib/lang/en_dns_cname.lng
@@ -8,4 +8,6 @@
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account is reached.';
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
?>
interface/web/dns/lib/lang/en_dns_hinfo.lng
@@ -8,4 +8,6 @@
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account is reached.';
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
?>
interface/web/dns/lib/lang/en_dns_mx.lng
@@ -9,4 +9,6 @@
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account is reached.';
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
?>
interface/web/dns/lib/lang/en_dns_ns.lng
@@ -8,4 +8,6 @@
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account is reached.';
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
?>
interface/web/dns/lib/lang/en_dns_ptr.lng
@@ -8,4 +8,6 @@
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account is reached.';
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
?>
interface/web/dns/lib/lang/en_dns_rp.lng
@@ -8,4 +8,6 @@
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account is reached.';
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
?>
interface/web/dns/lib/lang/en_dns_soa.lng
@@ -1,16 +1,19 @@
<?php
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["server_id_txt"] = 'Server';
$wb["origin_txt"] = 'Zone (SOA)';
$wb["ns_txt"] = 'NS';
$wb["mbox_txt"] = 'Email';
$wb["serial_txt"] = 'Serial';
$wb["refresh_txt"] = 'Refresh';
$wb["retry_txt"] = 'Retry';
$wb["expire_txt"] = 'Expire';
$wb["minimum_txt"] = 'Minimum';
$wb["ttl_txt"] = 'TTL';
$wb["xfer_txt"] = 'Xfer (IP)';
$wb["active_txt"] = 'Active';
<?php
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["server_id_txt"] = 'Server';
$wb["origin_txt"] = 'Zone (SOA)';
$wb["ns_txt"] = 'NS';
$wb["mbox_txt"] = 'Email';
$wb["serial_txt"] = 'Serial';
$wb["refresh_txt"] = 'Refresh';
$wb["retry_txt"] = 'Retry';
$wb["expire_txt"] = 'Expire';
$wb["minimum_txt"] = 'Minimum';
$wb["ttl_txt"] = 'TTL';
$wb["xfer_txt"] = 'Xfer (IP)';
$wb["active_txt"] = 'Active';
$wb["limit_dns_zone_txt"] = 'The max. number of DNS zones for your account is reached.';
$wb["client_txt"] = 'Client';
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
?>
interface/web/dns/lib/lang/en_dns_srv.lng
@@ -8,4 +8,6 @@
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account is reached.';
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
?>
interface/web/dns/lib/lang/en_dns_txt.lng
@@ -8,4 +8,6 @@
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account is reached.';
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
?>
interface/web/dns/list/dns_a.list.php
@@ -95,6 +95,15 @@
                            'width'        => "",
                            'value'        => "");
$liste["item"][] = array(    'field'        => "data",
                            'datatype'    => "VARCHAR",
                            'formtype'    => "TEXT",
                            'op'        => "like",
                            'prefix'    => "%",
                            'suffix'    => "%",
                            'width'        => "",
                            'value'        => "");
$liste["item"][] = array(    'field'        => "type",
                            'datatype'    => "VARCHAR",
interface/web/dns/templates/dns_a_list.htm
@@ -14,12 +14,14 @@
    <td class="tblHead"><tmpl_var name="active_txt"></td>
    <td class="tblHead"><tmpl_var name="type_txt"></td>
    <td class="tblHead"><tmpl_var name="name_txt"></td>
    <td class="tblHead"><tmpl_var name="data_txt"></td>
    <td class="tblHead">&nbsp;</td>
  </tr>
  <tr>
    <td class="frmText11"><select name="search_active" onChange="changeTab('dns_records','dns/dns_soa_edit.php');">{tmpl_var name='search_active'}</select></td>
    <td class="frmText11"><select name="search_type" onChange="changeTab('dns_records','dns/dns_soa_edit.php');">{tmpl_var name='search_type'}</select></td>
    <td class="frmText11"><input type="text" name="search_name" value="{tmpl_var name='search_name'}" class="text" /></td>
    <td class="frmText11"><input type="text" name="search_name" value="{tmpl_var name='search_name'}" class="text" width="10" /></td>
    <td class="frmText11"><input type="text" name="search_data" value="{tmpl_var name='search_data'}" class="text" width="10" /></td>
    <td class="frmText11" align="right"><input name="Filter" type="button" id="Filter" value="{tmpl_var name="filter_txt"}" class="button" onClick="changeTab('dns_records','dns/dns_soa_edit.php');"><div class="buttonEnding"></div></td>
  </tr>
  <tmpl_loop name="records">
@@ -27,10 +29,11 @@
    <td class="frmText11"><a href="#" onClick="loadContent('dns/dns_{tmpl_var name='type_lowercase'}_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="active"}</a></td>
    <td class="frmText11"><a href="#" onClick="loadContent('dns/dns_{tmpl_var name='type_lowercase'}_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="type"}</a></td>
    <td class="frmText11"><a href="#" onClick="loadContent('dns/dns_{tmpl_var name='type_lowercase'}_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="name"}</a></td>
    <td class="frmText11"><a href="#" onClick="loadContent('dns/dns_{tmpl_var name='type_lowercase'}_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="data"}</a></td>
    <td class="frmText11" align="right">[<a href="javascript: del_record('dns/dns_rr_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}');" class="frmText11">{tmpl_var name='delete_txt'}</a>]</td>
  </tr>
  </tmpl_loop>
  <tr>
      <td colspan="4" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
      <td colspan="5" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
  </tr>
</table>
interface/web/dns/templates/dns_soa_edit.htm
@@ -1,4 +1,5 @@
<table width="800" border="0" cellspacing="0" cellpadding="2">
  <tmpl_if name="is_admin">
  <tr>
    <td class="frmText11">{tmpl_var name='server_id_txt'}:</td>
    <td class="frmText11">
@@ -8,6 +9,15 @@
    </td>
  </tr>
  <tr>
    <td class="frmText11">{tmpl_var name='client_txt'}:</td>
    <td class="frmText11">
        <select name="client_group_id" class="text">
            {tmpl_var name='client_group_id'}
        </select>
    </td>
  </tr>
  </tmpl_if>
  <tr>
    <td class="frmText11">{tmpl_var name='origin_txt'}:</td>
    <td class="frmText11"><input name="origin" type="text" class="text" value="{tmpl_var name='origin'}" size="30" maxlength="255"> e.g. mydomain.com.</td>
  </tr>