default servers on client templates
6 files modified
1 files added
New file |
| | |
| | | ALTER TABLE `client_template` ADD `default_mailserver` INT(11) NOT NULL DEFAULT 1; |
| | | ALTER TABLE `client_template` ADD `default_webserver` INT(11) NOT NULL DEFAULT 1; |
| | | ALTER TABLE `client_template` ADD `default_dnsserver` INT(11) NOT NULL DEFAULT 1; |
| | | ALTER TABLE `client_template` ADD `default_slave_dnsserver` INT(11) NOT NULL DEFAULT 1; |
| | | ALTER TABLE `client_template` ADD `default_dbserver` INT(11) NOT NULL DEFAULT 1; |
| | |
| | | if (is_array($addLimits)){ |
| | | foreach($addLimits as $k => $v){ |
| | | /* we can remove this condition, but it is easier to debug with it (don't add ids and other non-limit values) */ |
| | | if (strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec'){ |
| | | if (strpos($k, 'limit') !== false or strpos($k, 'default') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec'){ |
| | | $app->log('Template processing key ' . $k . ' for client ' . $clientId, LOGLEVEL_DEBUG); |
| | | |
| | | /* process the numerical limits */ |
| | |
| | | /* silent adjustment of the minimum cron frequency to 1 minute */ |
| | | /* maybe this control test should be done via validator definition in tform.php file, but I don't know how */ |
| | | if ($limits[$k] < 1) $limits[$k] = 1; |
| | | break; |
| | | |
| | | case 'default_mailserver': |
| | | case 'default_webserver': |
| | | case 'default_dnsserver': |
| | | case 'default_slave_dnsserver': |
| | | case 'default_dbserver': |
| | | /* additional templates don't override default server from main template */ |
| | | if ($limits[$k] == 0) $limits[$k] = $v; |
| | | break; |
| | | |
| | | default: |
| | |
| | | $update = ''; |
| | | if(!$is_reseller) unset($limits['limit_client']); // Only Resellers may have limit_client set in template to ensure that we do not convert a client to reseller accidently. |
| | | foreach($limits as $k => $v){ |
| | | if ((strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){ |
| | | if (strpos($k, 'default') !== false and $v == 0) { |
| | | continue; // template doesn't define default server, client's default musn't be changed |
| | | } |
| | | if ((strpos($k, 'limit') !== false or strpos($k, 'default') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){ |
| | | if ($update != '') $update .= ', '; |
| | | $update .= '`' . $k . "`='" . $v . "'"; |
| | | } |
| | |
| | | global $app; |
| | | |
| | | $app->uses('client_templates'); |
| | | if (isset($this->dataRecord["template_type"])) { |
| | | $template_type = $this->dataRecord["template_type"]; |
| | | } else { |
| | | $tmp = $app->tform->getDataRecord($this->id); |
| | | $template_type = $tmp['template_type']; |
| | | } |
| | | |
| | | /* |
| | | * the template has changed. apply the new data to all clients |
| | | */ |
| | | if ($this->dataRecord["template_type"] == 'm'){ |
| | | if ($template_type == 'm'){ |
| | | $sql = "SELECT client_id FROM client WHERE template_master = " . $this->id; |
| | | } else { |
| | | $sql = "SELECT client_id FROM client WHERE template_additional LIKE '%/" . $this->id . "/%' OR template_additional LIKE '" . $this->id . "/%' OR template_additional LIKE '%/" . $this->id . "' UNION SELECT client_id FROM client_template_assigned WHERE client_template_id = " . $this->id; |
| | |
| | | 'rows' => '', |
| | | 'cols' => '' |
| | | ), |
| | | 'default_mailserver' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'SELECT', |
| | | 'default' => '0', |
| | | 'datasource' => array ( 'type' => 'CUSTOM', |
| | | 'class'=> 'custom_datasource', |
| | | 'function'=> 'client_servers' |
| | | ), |
| | | 'value' => array(''), |
| | | 'name' => 'default_mailserver' |
| | | ), |
| | | 'limit_maildomain' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | |
| | | 'rows' => '', |
| | | 'cols' => '' |
| | | ), |
| | | 'default_webserver' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'SELECT', |
| | | 'default' => '0', |
| | | 'datasource' => array ( 'type' => 'CUSTOM', |
| | | 'class'=> 'custom_datasource', |
| | | 'function'=> 'client_servers' |
| | | ), |
| | | 'value' => array(''), |
| | | 'name' => 'default_webserver' |
| | | ), |
| | | 'limit_web_domain' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | |
| | | 'default' => 'y', |
| | | 'value' => array(0 => 'n', 1 => 'y') |
| | | ), |
| | | 'default_dnsserver' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'SELECT', |
| | | 'default' => '0', |
| | | 'datasource' => array ( 'type' => 'CUSTOM', |
| | | 'class'=> 'custom_datasource', |
| | | 'function'=> 'client_servers' |
| | | ), |
| | | 'value' => array(''), |
| | | 'name' => 'default_dnsserver' |
| | | ), |
| | | 'limit_dns_zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | |
| | | 'maxlength' => '10', |
| | | 'rows' => '', |
| | | 'cols' => '' |
| | | ), |
| | | 'default_slave_dnsserver' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'SELECT', |
| | | 'default' => '0', |
| | | 'datasource' => array ( 'type' => 'CUSTOM', |
| | | 'class'=> 'custom_datasource', |
| | | 'function'=> 'client_servers' |
| | | ), |
| | | 'value' => array(''), |
| | | 'name' => 'default_slave_dnsserver' |
| | | ), |
| | | 'limit_dns_slave_zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | |
| | | 'cols' => '' |
| | | ), |
| | | */ |
| | | 'default_dbserver' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'SELECT', |
| | | 'default' => '0', |
| | | 'datasource' => array ( 'type' => 'CUSTOM', |
| | | 'class'=> 'custom_datasource', |
| | | 'function'=> 'client_servers' |
| | | ), |
| | | 'value' => array(''), |
| | | 'name' => 'default_dbserver' |
| | | ), |
| | | 'limit_database' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | |
| | | $wb["template_type_txt"] = 'Template type'; |
| | | $wb["template_name_txt"] = 'Template name'; |
| | | $wb["limit_client_error_notint"] = 'Client Limit is not a number.'; |
| | | $wb["default_mailserver_txt"] = 'Default Mailserver'; |
| | | $wb["limit_maildomain_txt"] = 'Max. number of email domains'; |
| | | $wb["limit_mailbox_txt"] = 'Max. number of mailboxes'; |
| | | $wb["limit_mailalias_txt"] = 'Max. number of email aliases'; |
| | |
| | | $wb["limit_cron_txt"] = 'Max. number of cron jobs'; |
| | | $wb["limit_cron_type_txt"] = 'Max. type of cron jobs (chrooted and full implies url)'; |
| | | $wb["limit_cron_frequency_txt"] = 'Min. delay between executions'; |
| | | $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'; |
| | | $wb["default_dnsserver_txt"] = 'Default DNS Server'; |
| | | $wb["limit_dns_zone_txt"] = 'Max. number of DNS zones'; |
| | | $wb["default_slave_dnsserver_txt"] = 'Default Secondary DNS Server'; |
| | | $wb["limit_dns_slave_zone_txt"] = 'Max. number of secondary DNS zones'; |
| | | $wb["limit_dns_record_txt"] = 'Max. number DNS records'; |
| | | $wb["limit_shell_user_txt"] = 'Max. number of Shell users'; |
| | |
| | | $wb["limit_dns_zone_error_notint"] = 'The dns zone limit must be a number.'; |
| | | $wb["limit_dns_slave_zone_error_notint"] = 'The dns slave zone limit must be a number.'; |
| | | $wb["limit_dns_record_error_notint"] = 'The dns record limit must be a number.'; |
| | | $wb["default_dbserver_txt"] = 'Default Database Server'; |
| | | $wb["limit_database_txt"] = 'Max. number of Databases'; |
| | | $wb["limit_database_error_notint"] = 'The database limit must be a number.'; |
| | | $wb["limit_cron_error_notint"] = 'The cron limit must be a number.'; |
| | |
| | | <?php |
| | | $wb['limit_client_error_notint'] = 'El límite de subclientes debe ser un número.'; |
| | | $wb['default_mailserver_txt'] = 'Servidor de correo por defecto'; |
| | | $wb['limit_maildomain_txt'] = 'Número máximo de dominios de correo'; |
| | | $wb['limit_mailbox_txt'] = 'Número máximo de buzones de correo'; |
| | | $wb['limit_mailalias_txt'] = 'Número máximo de alias de correo'; |
| | |
| | | $wb['limit_subdomain_txt'] = 'Número máximo de subdominios '; |
| | | $wb['limit_webquota_txt'] = 'Cuota de web'; |
| | | $wb['limit_database_txt'] = 'Número máximo de bases de datos'; |
| | | $wb['default_webserver_txt'] = 'Servidor web por defecto'; |
| | | $wb['limit_web_domain_txt'] = 'Número máximo de sitios web'; |
| | | $wb['limit_web_aliasdomain_txt'] = 'Número máximo de alias de dominios'; |
| | | $wb['limit_web_subdomain_txt'] = 'Número máximo de subdominios'; |
| | | $wb['limit_ftp_user_txt'] = 'Número máximo de usuarios FTP'; |
| | | $wb['default_dnsserver_txt'] = 'Servidor DNS por defecto'; |
| | | $wb['limit_dns_zone_txt'] = 'Número máximo de zonas DNS'; |
| | | $wb['default_slave_dnsserver_txt'] = 'Servidor DNS secundario por defecto'; |
| | | $wb['limit_dns_slave_zone_txt'] = 'Número máximo de zonas DNS secundarias'; |
| | | $wb['limit_dns_record_txt'] = 'Número máximo de registros DNS'; |
| | | $wb['limit_shell_user_txt'] = 'Número máximo de usuarios de consola'; |
| | |
| | | $wb['limit_dns_zone_error_notint'] = 'El límite de registros DNS debe ser un número.'; |
| | | $wb['limit_dns_slave_zone_error_notint'] = 'El límite de zonas DNS secundarias debe ser un número.'; |
| | | $wb['limit_dns_record_error_notint'] = 'El límite de registros DNS debe ser un número.'; |
| | | $wb['default_dbserver_txt'] = 'Servidor de bases de datos por defecto'; |
| | | $wb['limit_database_error_notint'] = 'El límite de bases de datos debe ser un número.'; |
| | | $wb['error_template_name_empty'] = 'Por favor, introduzca un nombre de plantilla'; |
| | | $wb['limit_cron_txt'] = 'Número máximo de tareas cron'; |
| | |
| | | <div class="subsectiontoggle"><span class="showing"></span>{tmpl_var name='web_limits_txt'}<em class="showing"></em></div> |
| | | <div> |
| | | <div class="ctrlHolder"> |
| | | <label for="default_webserver">{tmpl_var name='default_webserver_txt'}</label> |
| | | <select name="default_webserver" id="default_webserver" class="selectInput"> |
| | | {tmpl_var name='default_webserver'} |
| | | </select> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="limit_web_domain">{tmpl_var name='limit_web_domain_txt'}</label> |
| | | <input name="limit_web_domain" id="limit_web_domain" value="{tmpl_var name='limit_web_domain'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" /> |
| | | </div> |
| | |
| | | <div class="subsectiontoggle"><span></span>{tmpl_var name='email_limits_txt'}<em></em></div> |
| | | <div style="display:none;"> |
| | | <div class="ctrlHolder"> |
| | | <label for="default_mailserver">{tmpl_var name='default_mailserver_txt'}</label> |
| | | <select name="default_mailserver" id="default_mailserver" class="selectInput"> |
| | | {tmpl_var name='default_mailserver'} |
| | | </select> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="limit_maildomain">{tmpl_var name='limit_maildomain_txt'}</label> |
| | | <input name="limit_maildomain" id="limit_maildomain" value="{tmpl_var name='limit_maildomain'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" /> |
| | | </div> |
| | |
| | | <div class="subsectiontoggle"><span></span>{tmpl_var name='database_limits_txt'}<em></em></div> |
| | | <div style="display:none;"> |
| | | <div class="ctrlHolder"> |
| | | <label for="default_dbserver">{tmpl_var name='default_dbserver_txt'}</label> |
| | | <select name="default_dbserver" id="default_dbserver" class="selectInput"> |
| | | {tmpl_var name='default_dbserver'} |
| | | </select> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="limit_database">{tmpl_var name='limit_database_txt'}</label> |
| | | <input name="limit_database" id="limit_database" value="{tmpl_var name='limit_database'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" /> |
| | | </div> |
| | |
| | | <div class="subsectiontoggle"><span></span>{tmpl_var name='dns_limits_txt'}<em></em></div> |
| | | <div style="display:none;"> |
| | | <div class="ctrlHolder"> |
| | | <label for="default_dnsserver">{tmpl_var name='default_dnsserver_txt'}</label> |
| | | <select name="default_dnsserver" id="default_dnsserver" class="selectInput"> |
| | | {tmpl_var name='default_dnsserver'} |
| | | </select> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="limit_dns_zone">{tmpl_var name='limit_dns_zone_txt'}</label> |
| | | <input name="limit_dns_zone" id="limit_dns_zone" value="{tmpl_var name='limit_dns_zone'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" /> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="default_slave_dnsserver">{tmpl_var name='default_slave_dnsserver_txt'}</label> |
| | | <select name="default_slave_dnsserver" id="default_slave_dnsserver" class="selectInput"> |
| | | {tmpl_var name='default_slave_dnsserver'} |
| | | </select> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="limit_dns_slave_zone">{tmpl_var name='limit_dns_slave_zone_txt'}</label> |
| | | <input name="limit_dns_slave_zone" id="limit_dns_slave_zone" value="{tmpl_var name='limit_dns_slave_zone'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" /> |