Added limits for websites and FTP users.
| | |
| | | 'rows' => '', |
| | | 'cols' => '' |
| | | ), |
| | | 'default_webserver' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'SELECT', |
| | | 'default' => '1', |
| | | 'datasource' => array ( 'type' => 'SQL', |
| | | 'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name', |
| | | 'keyfield'=> 'server_id', |
| | | 'valuefield'=> 'server_name' |
| | | ), |
| | | 'value' => '' |
| | | ), |
| | | 'limit_web_domain' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'validators' => array ( 0 => array ( 'type' => 'ISINT', |
| | | 'errmsg'=> 'limit_web_domain_error_notint'), |
| | | ), |
| | | 'default' => '-1', |
| | | 'value' => '', |
| | | 'separator' => '', |
| | | 'width' => '10', |
| | | 'maxlength' => '10', |
| | | 'rows' => '', |
| | | 'cols' => '' |
| | | ), |
| | | 'limit_web_aliasdomain' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'validators' => array ( 0 => array ( 'type' => 'ISINT', |
| | | 'errmsg'=> 'limit_web_aliasdomain_error_notint'), |
| | | ), |
| | | 'default' => '-1', |
| | | 'value' => '', |
| | | 'separator' => '', |
| | | 'width' => '10', |
| | | 'maxlength' => '10', |
| | | 'rows' => '', |
| | | 'cols' => '' |
| | | ), |
| | | 'limit_web_subdomain' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'validators' => array ( 0 => array ( 'type' => 'ISINT', |
| | | 'errmsg'=> 'limit_web_subdomain_error_notint'), |
| | | ), |
| | | 'default' => '-1', |
| | | 'value' => '', |
| | | 'separator' => '', |
| | | 'width' => '10', |
| | | 'maxlength' => '10', |
| | | 'rows' => '', |
| | | 'cols' => '' |
| | | ), |
| | | 'limit_ftp_user' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'validators' => array ( 0 => array ( 'type' => 'ISINT', |
| | | 'errmsg'=> 'limit_ftp_user_error_notint'), |
| | | ), |
| | | 'default' => '-1', |
| | | 'value' => '', |
| | | 'separator' => '', |
| | | 'width' => '10', |
| | | 'maxlength' => '10', |
| | | 'rows' => '', |
| | | 'cols' => '' |
| | | ), |
| | | ################################## |
| | | # END Datatable fields |
| | | ################################## |
| | |
| | | $wb["limit_client_error_notint"] = 'Client Limit is not a number.'; |
| | | $wb["firstname_error_empty"] = 'Firstname is empty.'; |
| | | $wb["contact_error_empty"] = 'Contact name is empty.'; |
| | | $wb["default_webserver_txt"] = 'Default Webserver'; |
| | | $wb["limit_web_domain_txt"] = 'Max. number of web domains'; |
| | | $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'; |
| | | |
| | | ?> |
| | |
| | | <td class="frmText11"><input name="limit_spamfilter_policy" type="text" class="text" value="{tmpl_var name='limit_spamfilter_policy'}" size="10" maxlength="10"></td> |
| | | </tr> |
| | | <tr> |
| | | <td><h2>Websites</h2></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='default_webserver_txt'}:</td> |
| | | <td class="frmText11"> |
| | | <select name="default_webserver" class="text"> |
| | | {tmpl_var name='default_webserver'} |
| | | </select> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11" width="280">{tmpl_var name='limit_web_domain_txt'}:</td> |
| | | <td class="frmText11" width="220"><input name="limit_web_domain" type="text" class="text" value="{tmpl_var name='limit_web_domain'}" size="10" maxlength="10"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11" width="280">{tmpl_var name='limit_web_subdomain_txt'}:</td> |
| | | <td class="frmText11" width="220"><input name="limit_web_subdomain" type="text" class="text" value="{tmpl_var name='limit_web_subdomain'}" size="10" maxlength="10"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11" width="280">{tmpl_var name='limit_web_aliasdomain_txt'}:</td> |
| | | <td class="frmText11" width="220"><input name="limit_web_aliasdomain" type="text" class="text" value="{tmpl_var name='limit_web_aliasdomain'}" size="10" maxlength="10"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11" width="280">{tmpl_var name='limit_ftp_user_txt'}:</td> |
| | | <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 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_ftp_user 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_ftp_user"] >= 0) { |
| | | $tmp = $app->db->queryOneRecord("SELECT count(ftp_user_id) as number FROM ftp_user WHERE sys_groupid = $client_group_id"); |
| | | if($tmp["number"] >= $client["limit_ftp_user"]) { |
| | | $app->error($app->tform->wordbook["limit_ftp_user_txt"]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | parent::onShowNew(); |
| | | } |
| | | |
| | | function onAfterInsert() { |
| | | global $app, $conf; |
| | |
| | | $wb["password_txt"] = 'Password'; |
| | | $wb["quota_size_txt"] = 'Harddisk-Quota'; |
| | | $wb["active_txt"] = 'Active'; |
| | | $wb["limit_ftp_user_txt"] = 'The max. number of FTP users for your account is reached.'; |
| | | ?> |
| | |
| | | <?php
|
| | | $wb["server_id_txt"] = 'Server';
|
| | | $wb["domain_txt"] = 'Domain';
|
| | | $wb["type_txt"] = 'Type';
|
| | | $wb["parent_domain_id_txt"] = 'Parent Website';
|
| | | $wb["redirect_type_txt"] = 'Redirect Type';
|
| | | $wb["redirect_path_txt"] = 'Redirect Path';
|
| | | $wb["active_txt"] = 'Active';
|
| | | $wb["btn_save_txt"] = 'Save';
|
| | | $wb["btn_cancel_txt"] = 'Cancel';
|
| | | $wb["document_root_txt"] = 'Documentroot';
|
| | | $wb["system_user_txt"] = 'Linux User';
|
| | | $wb["system_group_txt"] = 'Linux Group';
|
| | | $wb["ip_address_txt"] = 'IP-Address';
|
| | | $wb["vhost_type_txt"] = 'VHost Type';
|
| | | $wb["hd_quota_txt"] = 'Harddisk Quota';
|
| | | $wb["traffic_quota_txt"] = 'Traffic Quaota';
|
| | | $wb["cgi_txt"] = 'CGI';
|
| | | $wb["ssi_txt"] = 'SSI';
|
| | | $wb["suexec_txt"] = 'SuEXEC';
|
| | | $wb["php_txt"] = 'PHP';
|
| | | $wb["client_txt"] = 'Client';
|
| | | <?php |
| | | $wb["server_id_txt"] = 'Server'; |
| | | $wb["domain_txt"] = 'Domain'; |
| | | $wb["type_txt"] = 'Type'; |
| | | $wb["parent_domain_id_txt"] = 'Parent Website'; |
| | | $wb["redirect_type_txt"] = 'Redirect Type'; |
| | | $wb["redirect_path_txt"] = 'Redirect Path'; |
| | | $wb["active_txt"] = 'Active'; |
| | | $wb["btn_save_txt"] = 'Save'; |
| | | $wb["btn_cancel_txt"] = 'Cancel'; |
| | | $wb["document_root_txt"] = 'Documentroot'; |
| | | $wb["system_user_txt"] = 'Linux User'; |
| | | $wb["system_group_txt"] = 'Linux Group'; |
| | | $wb["ip_address_txt"] = 'IP-Address'; |
| | | $wb["vhost_type_txt"] = 'VHost Type'; |
| | | $wb["hd_quota_txt"] = 'Harddisk Quota'; |
| | | $wb["traffic_quota_txt"] = 'Traffic Quaota'; |
| | | $wb["cgi_txt"] = 'CGI'; |
| | | $wb["ssi_txt"] = 'SSI'; |
| | | $wb["suexec_txt"] = 'SuEXEC'; |
| | | $wb["php_txt"] = 'PHP'; |
| | | $wb["client_txt"] = 'Client'; |
| | | $wb["limit_web_domain_txt"] = 'The max. number of web domains for your account is reached.'; |
| | | $wb["limit_web_aliasdomain_txt"] = 'The max. number of aliasdomains for your account is reached.'; |
| | | $wb["limit_web_subdomain_txt"] = 'The max. number of web subdomains for your account is reached.'; |
| | | ?> |
| | |
| | | |
| | | 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_web_aliasdomain 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_web_aliasdomain"] >= 0) { |
| | | $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $client_group_id and type = 'alias'"); |
| | | if($tmp["number"] >= $client["limit_web_aliasdomain"]) { |
| | | $app->error($app->tform->wordbook["limit_web_aliasdomain_txt"]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | parent::onShowNew(); |
| | | } |
| | | |
| | | /* |
| | | function onShowEnd() { |
| | | global $app, $conf; |
| | |
| | | |
| | | 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_web_domain 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_web_domain"] >= 0) { |
| | | $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $client_group_id and type = 'vhost'"); |
| | | if($tmp["number"] >= $client["limit_web_domain"]) { |
| | | $app->error($app->tform->wordbook["limit_web_domain_txt"]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | parent::onShowNew(); |
| | | } |
| | | |
| | | function onShowEnd() { |
| | | global $app, $conf; |
| | | |
| | |
| | | if($_SESSION["s"]["user"]["typ"] != 'admin') { |
| | | // Get the limits of the client |
| | | $client_group_id = $_SESSION["s"]["user"]["default_group"]; |
| | | $client = $app->db->queryOneRecord("SELECT limit_maildomain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); |
| | | $client = $app->db->queryOneRecord("SELECT limit_web_domain, default_webserver 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) { |
| | |
| | | // set the server ID to the default mailserver of the client |
| | | $this->dataRecord["server_id"] = $client["default_webserver"]; |
| | | |
| | | /* |
| | | // Check if the user may add another mail_domain |
| | | if($client["limit_maildomain"] >= 0) { |
| | | $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM mail_domain WHERE sys_groupid = $client_group_id"); |
| | | if($tmp["number"] >= $client["limit_maildomain"]) { |
| | | $app->error($app->tform->wordbook["limit_webdomain_txt"]); |
| | | |
| | | // Check if the user may add another web_domain |
| | | if($client["limit_web_domain"] >= 0) { |
| | | $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $client_group_id and type = 'vhost'"); |
| | | if($tmp["number"] >= $client["limit_web_domain"]) { |
| | | $app->error($app->tform->wordbook["limit_web_domain_txt"]); |
| | | } |
| | | } |
| | | */ |
| | | |
| | | } |
| | | |
| | | // Clients may not set the client_group_id, so we unset them if user is not a admin |
| | |
| | | |
| | | 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_web_subdomain 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_web_subdomain"] >= 0) { |
| | | $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $client_group_id and type = 'subdomain'"); |
| | | if($tmp["number"] >= $client["limit_web_subdomain"]) { |
| | | $app->error($app->tform->wordbook["limit_web_subdomain_txt"]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | parent::onShowNew(); |
| | | } |
| | | |
| | | function onShowEnd() { |
| | | global $app, $conf; |
| | | |
| | | // Get the record of the parent domain |
| | | $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"])); |
| | | |
| | | // remove the parent domain part of the domain name before we show it in the text field. |
| | | $this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"],'',$this->dataRecord["domain"]); |
| | | $app->tpl->setVar("domain",$this->dataRecord["domain"]); |
| | | |
| | |
| | | if($data["new"]["type"] != "vhost" && $data["new"]["parent_domain_id"] > 0) { |
| | | // This is not a vhost, so we need to update the parent record instead. |
| | | $parent_domain_id = intval($data["new"]["parent_domain_id"]); |
| | | $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$parent_domain_id); |
| | | $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$parent_domain_id." AND active = 'y'"); |
| | | $data["new"] = $tmp; |
| | | $data["old"] = $tmp; |
| | | } |
| | |
| | | } |
| | | |
| | | // get alias domains (co-domains and subdomains) |
| | | $aliases = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ".$data["new"]["domain_id"]); |
| | | $aliases = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ".$data["new"]["domain_id"]." AND active = 'y'"); |
| | | $server_alias = ''; |
| | | if(is_array($aliases)) { |
| | | foreach($aliases as $alias) { |