Added client limits to the DNS module.
| | |
| | | |
| | | $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'; |
| | |
| | | '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' |
| | | ), |
| | |
| | | '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' |
| | | ), |
| | |
| | | '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 |
| | | ################################## |
| | |
| | | $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'; |
| | | |
| | | |
| | | ?> |
| | |
| | | <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"> </td> |
| | | <td class="frmText11"> </td> |
| | | </tr> |
| | |
| | | |
| | | 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"]; |
| | |
| | | |
| | | 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"]; |
| | |
| | | |
| | | 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"]; |
| | |
| | | |
| | | 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"]; |
| | |
| | | |
| | | 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"]; |
| | |
| | | |
| | | 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"]; |
| | |
| | | |
| | | 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"]; |
| | |
| | | |
| | | 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"]; |
| | |
| | | |
| | | 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(); |
| | |
| | | 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; |
| | |
| | | |
| | | 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"]; |
| | |
| | | |
| | | 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"]; |
| | |
| | | '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' => '', |
| | |
| | | $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.'; |
| | | ?> |
| | |
| | | $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'; |
| | |
| | | $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.'; |
| | | ?> |
| | |
| | | $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.'; |
| | | ?> |
| | |
| | | $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.'; |
| | | ?> |
| | |
| | | $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.'; |
| | | ?> |
| | |
| | | $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.'; |
| | | ?> |
| | |
| | | $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.'; |
| | | ?> |
| | |
| | | $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.'; |
| | | ?> |
| | |
| | | <?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.'; |
| | | ?> |
| | |
| | | $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.'; |
| | | ?> |
| | |
| | | $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.'; |
| | | ?> |
| | |
| | | 'width' => "", |
| | | 'value' => ""); |
| | | |
| | | $liste["item"][] = array( 'field' => "data", |
| | | 'datatype' => "VARCHAR", |
| | | 'formtype' => "TEXT", |
| | | 'op' => "like", |
| | | 'prefix' => "%", |
| | | 'suffix' => "%", |
| | | 'width' => "", |
| | | 'value' => ""); |
| | | |
| | | |
| | | $liste["item"][] = array( 'field' => "type", |
| | | 'datatype' => "VARCHAR", |
| | |
| | | <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"> </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"> |
| | |
| | | <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> |
| | |
| | | <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"> |
| | |
| | | </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> |