From 511ba5d03c8bba828b9096f13e14ec54c1ecbb87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20M=C3=BCller?= Date: Sun, 19 Jan 2014 21:04:38 +0100 Subject: [PATCH] New Feature VHost-Alias (FS#3296) Completly same functionality as VHost-Subdomain, not to disable if already existing vhostalias-somains in system. --- interface/lib/classes/remote.d/sites.inc.php | 69 + ...sites_web_vhost_aliasdomain_plugin.inc.php | 68 + .../web/admin/form/system_config.tform.php | 6 + .../web/admin/lib/lang/ar_system_config.lng | 4 +- .../web/admin/lib/lang/bg_system_config.lng | 2 + .../web/admin/lib/lang/br_system_config.lng | 4 +- .../web/admin/lib/lang/cz_system_config.lng | 2 + .../web/admin/lib/lang/de_system_config.lng | 2 + .../web/admin/lib/lang/el_system_config.lng | 2 + .../web/admin/lib/lang/en_system_config.lng | 4 +- .../web/admin/lib/lang/es_system_config.lng | 4 +- .../web/admin/lib/lang/fi_system_config.lng | 4 +- .../web/admin/lib/lang/fr_system_config.lng | 4 +- .../web/admin/lib/lang/hr_system_config.lng | 4 +- .../web/admin/lib/lang/hu_system_config.lng | 4 +- .../web/admin/lib/lang/id_system_config.lng | 4 +- .../web/admin/lib/lang/it_system_config.lng | 4 +- .../web/admin/lib/lang/ja_system_config.lng | 4 +- .../web/admin/lib/lang/nl_system_config.lng | 4 +- .../web/admin/lib/lang/pl_system_config.lng | 2 + .../web/admin/lib/lang/pt_system_config.lng | 4 +- .../web/admin/lib/lang/ro_system_config.lng | 4 +- .../web/admin/lib/lang/ru_system_config.lng | 4 +- .../web/admin/lib/lang/se_system_config.lng | 4 +- .../web/admin/lib/lang/sk_system_config.lng | 4 +- .../web/admin/lib/lang/tr_system_config.lng | 4 +- interface/web/admin/system_config_edit.php | 6 + .../web/admin/system_config_edit.php.bak | 205 +++ .../templates/system_config_sites_edit.htm | 6 + interface/web/dashboard/ajax_get_json.php | 3 + interface/web/dashboard/ajax_get_json.php.bak | 238 ++++ interface/web/dashboard/dashlets/limits.php | 2 +- .../web/dashboard/dashlets/limits.php.bak | 177 +++ interface/web/data.sql | 51 + interface/web/sites/aps_install_package.php | 2 +- .../web/sites/aps_install_package.php.bak | 211 ++++ interface/web/sites/form/web_folder.tform.php | 2 +- .../web/sites/form/web_folder.tform.php.bak | 110 ++ .../form/web_vhost_aliasdomain.tform.php | 735 +++++++++++ .../sites/form/web_vhost_subdomain.tform.php | 2 +- .../lib/lang/ar_web_vhost_aliasdomain.lng | 118 ++ .../lang/ar_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/bg_web_vhost_aliasdomain.lng | 118 ++ .../lang/bg_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/br_web_vhost_aliasdomain.lng | 118 ++ .../lang/br_web_vhost_aliasdomain_list.lng | 9 + .../lib/lang/cz_web_vhost_aliasdomain.lng | 119 ++ .../lang/cz_web_vhost_aliasdomain_list.lng | 9 + .../lib/lang/de_web_vhost_aliasdomain.lng | 126 ++ .../lang/de_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/el_web_vhost_aliasdomain.lng | 118 ++ .../lang/el_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/en_web_vhost_aliasdomain.lng | 127 ++ .../lang/en_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/es_web_vhost_aliasdomain.lng | 118 ++ .../lang/es_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/fi_web_vhost_aliasdomain.lng | 118 ++ .../lang/fi_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/fr_web_vhost_aliasdomain.lng | 118 ++ .../lang/fr_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/hr_web_vhost_aliasdomain.lng | 118 ++ .../lang/hr_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/hu_web_vhost_aliasdomain.lng | 118 ++ .../lang/hu_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/id_web_vhost_aliasdomain.lng | 118 ++ .../lang/id_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/it_web_vhost_aliasdomain.lng | 118 ++ .../lang/it_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/ja_web_vhost_aliasdomain.lng | 118 ++ .../lang/ja_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/nl_web_vhost_aliasdomain.lng | 118 ++ .../lang/nl_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/pl_web_vhost_aliasdomain.lng | 118 ++ .../lang/pl_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/pt_web_vhost_aliasdomain.lng | 118 ++ .../lang/pt_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/ro_web_vhost_aliasdomain.lng | 118 ++ .../lang/ro_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/ru_web_vhost_aliasdomain.lng | 118 ++ .../lang/ru_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/se_web_vhost_aliasdomain.lng | 118 ++ .../lang/se_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/sk_web_vhost_aliasdomain.lng | 118 ++ .../lang/sk_web_vhost_aliasdomain_list.lng | 8 + .../lib/lang/tr_web_vhost_aliasdomain.lng | 118 ++ .../lang/tr_web_vhost_aliasdomain_list.lng | 8 + interface/web/sites/lib/module.conf.php | 10 + interface/web/sites/list/web_folder.list.php | 2 +- .../web/sites/list/web_folder.list.php.bak | 102 ++ .../sites/templates/web_sites_stats_list.htm | 8 +- .../templates/web_sites_stats_list.htm.bak | 63 + .../web_vhost_aliasdomain_advanced.htm | 157 +++ .../web_vhost_aliasdomain_backup.htm | 36 + .../templates/web_vhost_aliasdomain_edit.htm | 234 ++++ .../templates/web_vhost_aliasdomain_list.htm | 79 ++ .../web_vhost_aliasdomain_redirect.htm | 84 ++ .../templates/web_vhost_aliasdomain_ssl.htm | 68 + .../templates/web_vhost_aliasdomain_stats.htm | 37 + interface/web/sites/web_aliasdomain_edit.php | 4 +- .../web/sites/web_aliasdomain_edit.php.bak | 191 +++ interface/web/sites/web_domain_edit.php | 8 +- interface/web/sites/web_domain_edit.php.bak | 1114 +++++++++++++++++ interface/web/sites/web_sites_stats.php | 2 +- interface/web/sites/web_sites_stats.php.bak | 188 +++ .../web/sites/web_vhost_aliasdomain_del.php | 73 ++ .../web/sites/web_vhost_aliasdomain_edit.php | 666 ++++++++++ .../web/sites/web_vhost_aliasdomain_list.php | 55 + .../admin/system_config_sites_edit.htm | 6 + .../sites/web_vhost_aliasdomain_advanced.htm | 146 +++ .../sites/web_vhost_aliasdomain_backup.htm | 32 + .../sites/web_vhost_aliasdomain_edit.htm | 208 +++ .../sites/web_vhost_aliasdomain_list.htm | 60 + .../sites/web_vhost_aliasdomain_redirect.htm | 76 ++ .../sites/web_vhost_aliasdomain_ssl.htm | 68 + .../sites/web_vhost_aliasdomain_stats.htm | 37 + server/lib/classes/aps_installer.inc.php | 3 +- server/lib/classes/aps_installer.inc.php.bak | 749 +++++++++++ server/lib/classes/cron.d/150-awstats.inc.php | 6 +- .../lib/classes/cron.d/150-webalizer.inc.php | 6 +- .../lib/classes/cron.d/200-logfiles.inc.php | 4 +- .../classes/cron.d/300-quota_notify.inc.php | 4 +- server/lib/classes/cron.d/500-backup.inc.php | 2 +- .../plugins-available/apache2_plugin.inc.php | 60 +- server/plugins-available/nginx_plugin.inc.php | 52 +- .../nginx_reverseproxy_plugin.inc.php | 6 +- 125 files changed, 9496 insertions(+), 103 deletions(-) create mode 100644 interface/lib/plugins/sites_web_vhost_aliasdomain_plugin.inc.php create mode 100644 interface/web/admin/system_config_edit.php.bak create mode 100644 interface/web/dashboard/ajax_get_json.php.bak create mode 100644 interface/web/dashboard/dashlets/limits.php.bak create mode 100644 interface/web/sites/aps_install_package.php.bak create mode 100644 interface/web/sites/form/web_folder.tform.php.bak create mode 100644 interface/web/sites/form/web_vhost_aliasdomain.tform.php create mode 100644 interface/web/sites/lib/lang/ar_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/ar_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/bg_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/bg_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/br_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/br_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/cz_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/cz_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/de_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/de_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/el_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/el_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/en_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/en_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/es_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/es_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/fi_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/fi_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/fr_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/fr_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/hr_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/hr_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/hu_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/hu_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/id_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/id_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/it_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/it_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/ja_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/ja_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/nl_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/nl_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/pl_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/pl_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/pt_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/pt_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/ro_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/ro_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/ru_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/ru_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/se_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/se_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/sk_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/sk_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/lib/lang/tr_web_vhost_aliasdomain.lng create mode 100644 interface/web/sites/lib/lang/tr_web_vhost_aliasdomain_list.lng create mode 100644 interface/web/sites/list/web_folder.list.php.bak create mode 100644 interface/web/sites/templates/web_sites_stats_list.htm.bak create mode 100644 interface/web/sites/templates/web_vhost_aliasdomain_advanced.htm create mode 100644 interface/web/sites/templates/web_vhost_aliasdomain_backup.htm create mode 100644 interface/web/sites/templates/web_vhost_aliasdomain_edit.htm create mode 100644 interface/web/sites/templates/web_vhost_aliasdomain_list.htm create mode 100644 interface/web/sites/templates/web_vhost_aliasdomain_redirect.htm create mode 100644 interface/web/sites/templates/web_vhost_aliasdomain_ssl.htm create mode 100644 interface/web/sites/templates/web_vhost_aliasdomain_stats.htm create mode 100644 interface/web/sites/web_aliasdomain_edit.php.bak create mode 100644 interface/web/sites/web_domain_edit.php.bak create mode 100644 interface/web/sites/web_sites_stats.php.bak create mode 100644 interface/web/sites/web_vhost_aliasdomain_del.php create mode 100644 interface/web/sites/web_vhost_aliasdomain_edit.php create mode 100644 interface/web/sites/web_vhost_aliasdomain_list.php create mode 100644 interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_advanced.htm create mode 100644 interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_backup.htm create mode 100644 interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_edit.htm create mode 100644 interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_list.htm create mode 100644 interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_redirect.htm create mode 100644 interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_ssl.htm create mode 100644 interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_stats.htm create mode 100644 server/lib/classes/aps_installer.inc.php.bak diff --git a/interface/lib/classes/remote.d/sites.inc.php b/interface/lib/classes/remote.d/sites.inc.php index 19958010be..5e5ac595b0 100644 --- a/interface/lib/classes/remote.d/sites.inc.php +++ b/interface/lib/classes/remote.d/sites.inc.php @@ -450,6 +450,75 @@ class remoting_sites extends remoting { // ---------------------------------------------------------------------------------------------------------- + //* Get record details + public function sites_web_vhost_aliasdomain_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_get')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../sites/form/web_vhost_aliasdomain.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function sites_web_vhost_aliasdomain_add($session_id, $client_id, $params) + { + global $app; + if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_add')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + //* Set a few params to "not empty" values which get overwritten by the sites_web_domain_plugin + if($params['document_root'] == '') $params['document_root'] = '-'; + if($params['system_user'] == '') $params['system_user'] = '-'; + if($params['system_group'] == '') $params['system_group'] = '-'; + + //* Set a few defaults for nginx servers + if($params['pm_max_children'] == '') $params['pm_max_children'] = 1; + if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1; + if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1; + if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1; + + $domain_id = $this->insertQuery('../sites/form/web_vhost_aliasdomain.tform.php', $client_id, $params, 'sites:web_vhost_aliasdomain:on_after_insert'); + return $domain_id; + } + + //* Update a record + public function sites_web_vhost_aliasdomain_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_update')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + //* Set a few defaults for nginx servers + if($params['pm_max_children'] == '') $params['pm_max_children'] = 1; + if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1; + if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1; + if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1; + + $affected_rows = $this->updateQuery('../sites/form/web_vhost_aliasdomain.tform.php', $client_id, $primary_id, $params, 'sites:web_vhost_aliasdomain:on_after_insert'); + return $affected_rows; + } + + //* Delete a record + public function sites_web_vhost_aliasdomain_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_delete')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../sites/form/web_vhost_aliasdomain.tform.php', $primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------- + //* Get record details public function sites_web_vhost_subdomain_get($session_id, $primary_id) { diff --git a/interface/lib/plugins/sites_web_vhost_aliasdomain_plugin.inc.php b/interface/lib/plugins/sites_web_vhost_aliasdomain_plugin.inc.php new file mode 100644 index 0000000000..c94db2a27d --- /dev/null +++ b/interface/lib/plugins/sites_web_vhost_aliasdomain_plugin.inc.php @@ -0,0 +1,68 @@ + pixcept KG 2012, copied and adapted from web_domain plugin by: + * @author Julio Montoya BeezNest 2010 + */ + + +class sites_web_vhost_aliasdomain_plugin { + + var $plugin_name = 'sites_web_vhost_aliasdomain_plugin'; + var $class_name = 'sites_web_vhost_aliasdomain_plugin'; + + // TODO: This function is a duplicate from the one in interface/web/sites/web_vhost_aliasdomain_edit.php + // There should be a single "token replacement" function to be called from modules and + // from the main code. + // Returna a "3/2/1" path hash from a numeric id '123' + function id_hash($id, $levels) { + $hash = "" . $id % 10 ; + $id /= 10 ; + $levels -- ; + while ( $levels > 0 ) { + $hash .= "/" . $id % 10 ; + $id /= 10 ; + $levels-- ; + } + return $hash; + } + + /* + This function is called when the plugin is loaded + */ + function onLoad() { + global $app; + //Register for the events + // both event call the same function as the things to do do not differ here + $app->plugin->registerEvent('sites:web_vhost_aliasdomain:on_after_insert', 'sites_web_vhost_aliasdomain_plugin', 'sites_web_vhost_aliasdomain_edit'); + $app->plugin->registerEvent('sites:web_vhost_aliasdomain:on_after_update', 'sites_web_vhost_aliasdomain_plugin', 'sites_web_vhost_aliasdomain_edit'); + } + + /* + Function to create the sites_web_vhost_aliasdomain rule and insert it into the custom rules + */ + function sites_web_vhost_aliasdomain_edit($event_name, $page_form) { + global $app, $conf; + + // Get configuration for the web system + $app->uses("getconf"); + $web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']), 'web'); + + $parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = '" . $app->functions->intval($page_form->dataRecord['parent_domain_id']) . "'"); + + // Set the values for document_root, system_user and system_group + $system_user = $app->db->quote($parent_domain['system_user']); + $system_group = $app->db->quote($parent_domain['system_group']); + $document_root = $app->db->quote($parent_domain['document_root']); + $php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$page_form->dataRecord['web_folder'], $web_config["php_open_basedir"]); + $php_open_basedir = str_replace("[website_domain]/web", $page_form->dataRecord['domain'].'/'.$page_form->dataRecord['web_folder'], $php_open_basedir); + $php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir); + $php_open_basedir = $app->db->quote(str_replace("[website_domain]", $page_form->dataRecord['domain'], $php_open_basedir)); + $htaccess_allow_override = $app->db->quote($parent_domain['allow_override']); + + $sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($parent_domain['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$page_form->id; + $app->db->query($sql); + } + +} diff --git a/interface/web/admin/form/system_config.tform.php b/interface/web/admin/form/system_config.tform.php index 6c0e8da284..eaa0f6f273 100644 --- a/interface/web/admin/form/system_config.tform.php +++ b/interface/web/admin/form/system_config.tform.php @@ -154,6 +154,12 @@ $form["tabs"]['sites'] = array ( 'default' => 'n', 'value' => array(0 => 'n', 1 => 'y') ), + 'vhost_aliasdomains' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), 'client_username_web_check_disabled' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'CHECKBOX', diff --git a/interface/web/admin/lib/lang/ar_system_config.lng b/interface/web/admin/lib/lang/ar_system_config.lng index a534fa7425..e5a4663f1e 100644 --- a/interface/web/admin/lib/lang/ar_system_config.lng +++ b/interface/web/admin/lib/lang/ar_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/bg_system_config.lng b/interface/web/admin/lib/lang/bg_system_config.lng index 282ab42c29..8d888d5515 100644 --- a/interface/web/admin/lib/lang/bg_system_config.lng +++ b/interface/web/admin/lib/lang/bg_system_config.lng @@ -41,6 +41,8 @@ $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; $wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create Aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/br_system_config.lng b/interface/web/admin/lib/lang/br_system_config.lng index 544fcc19d2..fd3be081dd 100644 --- a/interface/web/admin/lib/lang/br_system_config.lng +++ b/interface/web/admin/lib/lang/br_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/cz_system_config.lng b/interface/web/admin/lib/lang/cz_system_config.lng index 40804371ec..aa5960d837 100644 --- a/interface/web/admin/lib/lang/cz_system_config.lng +++ b/interface/web/admin/lib/lang/cz_system_config.lng @@ -41,6 +41,8 @@ $wb['tab_change_warning_txt'] = 'Záložka změna varování'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; $wb['vhost_subdomains_txt'] = 'Vytvořit subdomény jako webové stránky'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasbdomains_txt'] = 'Vytvořit aliasdomény jako webové stránky'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'phpmyadmin neplatné URL'; $wb['use_combobox_txt'] = 'Použití jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Použití indikátoru zatížení'; diff --git a/interface/web/admin/lib/lang/de_system_config.lng b/interface/web/admin/lib/lang/de_system_config.lng index 1c9f17db47..164903892c 100644 --- a/interface/web/admin/lib/lang/de_system_config.lng +++ b/interface/web/admin/lib/lang/de_system_config.lng @@ -11,6 +11,8 @@ $wb['shelluser_prefix_txt'] = 'Shell Benutzer Präfix'; $wb['ftpuser_prefix_txt'] = 'FTP Benutzer Präfix'; $wb['vhost_subdomains_txt'] = 'Subdomains als Webseite anlegen'; $wb['vhost_subdomains_note_txt'] = 'Diese Einstellung kann nicht wieder deaktiviert werden, wenn Vhost Subdomains im System vorhanden sind!'; +$wb['vhost_aliasbdomains_txt'] = 'Subdomains als Webseite anlegen'; +$wb['vhost_aliasdomains_note_txt'] = 'Diese Einstellung kann nicht wieder deaktiviert werden, wenn Vhost Aliasdomains im System vorhanden sind!'; $wb['dbname_prefix_error_regex'] = 'Zeichen nicht erlaubt in Datenbank Namen Präfix.'; $wb['dbuser_prefix_error_regex'] = 'Zeichen nicht erlaubt in Datenbank Benutzer Präfix.'; $wb['ftpuser_prefix_error_regex'] = 'Zeichen nicht erlaubt in FTP Benutzer Präfix.'; diff --git a/interface/web/admin/lib/lang/el_system_config.lng b/interface/web/admin/lib/lang/el_system_config.lng index 1660f18c60..3cbadd1110 100644 --- a/interface/web/admin/lib/lang/el_system_config.lng +++ b/interface/web/admin/lib/lang/el_system_config.lng @@ -41,6 +41,8 @@ $wb['tab_change_warning_txt'] = 'Προειδοποίηση αλλαγής κα $wb['tab_change_warning_note_txt'] = 'Εμφάνιση μιας προειδοποίησης κατα την αλλαγή καρτέλας σε φόρμες επεξεργασίας που έχουν τροποποιηθεί από τον χρήστη.'; $wb['vhost_subdomains_txt'] = 'Δημιουργία Subdomains ως web site'; $wb['vhost_subdomains_note_txt'] = 'Δεν μπορεί να γίνει απενεργοποίηση όσο υπάρχουν vhost subdomains στο σύστημα!'; +$wb['vhost_aliasdomains_txt'] = 'Δημιουργία aliasdomains ως web site'; +$wb['vhost_aliasdomains_note_txt'] = 'Δεν μπορεί να γίνει απενεργοποίηση όσο υπάρχουν vhost aliasdomains στο σύστημα!'; $wb['phpmyadmin_url_error_regex'] = 'Μη έγκυρο URL phpmyadmin'; $wb['use_combobox_txt'] = 'Χρήση jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Χρήση Load Indicator (ενδεικτή φόρτωσης)'; diff --git a/interface/web/admin/lib/lang/en_system_config.lng b/interface/web/admin/lib/lang/en_system_config.lng index 755efd9660..1c045cf272 100644 --- a/interface/web/admin/lib/lang/en_system_config.lng +++ b/interface/web/admin/lib/lang/en_system_config.lng @@ -13,8 +13,10 @@ $wb["dbuser_prefix_txt"] = 'Database user prefix'; $wb["shelluser_prefix_txt"] = 'Shell user prefix'; $wb["webdavuser_prefix_txt"] = 'Webdav user prefix'; $wb["ftpuser_prefix_txt"] = 'FTP user prefix'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb["dbname_prefix_error_regex"] = 'Char not allowed in database name prefix.'; $wb["dbuser_prefix_error_regex"] = 'Char not allowed in database user prefix.'; $wb["ftpuser_prefix_error_regex"] = 'Char not allowed in ftp user prefix.'; diff --git a/interface/web/admin/lib/lang/es_system_config.lng b/interface/web/admin/lib/lang/es_system_config.lng index a4d878cadd..293eceacb6 100644 --- a/interface/web/admin/lib/lang/es_system_config.lng +++ b/interface/web/admin/lib/lang/es_system_config.lng @@ -32,8 +32,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['maintenance_mode_txt'] = 'Maintenance Mode'; $wb['smtp_enabled_txt'] = 'Use SMTP to send system mails'; $wb['smtp_host_txt'] = 'SMTP host'; diff --git a/interface/web/admin/lib/lang/fi_system_config.lng b/interface/web/admin/lib/lang/fi_system_config.lng index 75658ee44e..a6021921dc 100755 --- a/interface/web/admin/lib/lang/fi_system_config.lng +++ b/interface/web/admin/lib/lang/fi_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/fr_system_config.lng b/interface/web/admin/lib/lang/fr_system_config.lng index 262bbe329e..cd4c16b7f8 100644 --- a/interface/web/admin/lib/lang/fr_system_config.lng +++ b/interface/web/admin/lib/lang/fr_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/hr_system_config.lng b/interface/web/admin/lib/lang/hr_system_config.lng index 63f816b79e..e81554a7bf 100644 --- a/interface/web/admin/lib/lang/hr_system_config.lng +++ b/interface/web/admin/lib/lang/hr_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/hu_system_config.lng b/interface/web/admin/lib/lang/hu_system_config.lng index 500828481c..4380d9dcc7 100644 --- a/interface/web/admin/lib/lang/hu_system_config.lng +++ b/interface/web/admin/lib/lang/hu_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/id_system_config.lng b/interface/web/admin/lib/lang/id_system_config.lng index 81997b708f..b4c5133eee 100644 --- a/interface/web/admin/lib/lang/id_system_config.lng +++ b/interface/web/admin/lib/lang/id_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/it_system_config.lng b/interface/web/admin/lib/lang/it_system_config.lng index bc26da23ea..8d2ceb031f 100644 --- a/interface/web/admin/lib/lang/it_system_config.lng +++ b/interface/web/admin/lib/lang/it_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/ja_system_config.lng b/interface/web/admin/lib/lang/ja_system_config.lng index df99e6e627..77fb47b61d 100644 --- a/interface/web/admin/lib/lang/ja_system_config.lng +++ b/interface/web/admin/lib/lang/ja_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/nl_system_config.lng b/interface/web/admin/lib/lang/nl_system_config.lng index 766ead2ee0..57464742fa 100644 --- a/interface/web/admin/lib/lang/nl_system_config.lng +++ b/interface/web/admin/lib/lang/nl_system_config.lng @@ -42,8 +42,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/pl_system_config.lng b/interface/web/admin/lib/lang/pl_system_config.lng index a3cd3c6bd9..a30fd04d29 100644 --- a/interface/web/admin/lib/lang/pl_system_config.lng +++ b/interface/web/admin/lib/lang/pl_system_config.lng @@ -34,6 +34,8 @@ $wb['tab_change_warning_txt'] = 'Ostrzegaj przy zmianie zakładki'; $wb['tab_change_warning_note_txt'] = 'Pokaż ostrzeżenie przy zmianie zakładki jeżeli zostały zmienione dane przez użytkownika.'; $wb['vhost_subdomains_txt'] = 'Twórz subdomeny jako strony web'; $wb['vhost_subdomains_note_txt'] = 'Nie możesz wyłączyć tego tak długo jak istnieją w systemie vhosty subdomen.'; +$wb['vhost_aliasdomains_txt'] = 'Twórz aliasdomeny jako strony web'; +$wb['vhost_aliasdomains_note_txt'] = 'Nie możesz wyłączyć tego tak długo jak istnieją w systemie vhosty aliasdomen.'; $wb['maintenance_mode_txt'] = 'Tryb serwisowy'; $wb['smtp_enabled_txt'] = 'Używaj SMTP do wysyłania powiadomień systemowych'; $wb['smtp_host_txt'] = 'Host SMTP'; diff --git a/interface/web/admin/lib/lang/pt_system_config.lng b/interface/web/admin/lib/lang/pt_system_config.lng index 49bd93e9cc..efaf567b29 100644 --- a/interface/web/admin/lib/lang/pt_system_config.lng +++ b/interface/web/admin/lib/lang/pt_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/ro_system_config.lng b/interface/web/admin/lib/lang/ro_system_config.lng index e2b701afc3..c688f608b2 100644 --- a/interface/web/admin/lib/lang/ro_system_config.lng +++ b/interface/web/admin/lib/lang/ro_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/ru_system_config.lng b/interface/web/admin/lib/lang/ru_system_config.lng index 612fe50539..e0926dd71e 100644 --- a/interface/web/admin/lib/lang/ru_system_config.lng +++ b/interface/web/admin/lib/lang/ru_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/se_system_config.lng b/interface/web/admin/lib/lang/se_system_config.lng index e2b701afc3..c688f608b2 100644 --- a/interface/web/admin/lib/lang/se_system_config.lng +++ b/interface/web/admin/lib/lang/se_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/sk_system_config.lng b/interface/web/admin/lib/lang/sk_system_config.lng index 1340eee8bb..bbebf4c402 100644 --- a/interface/web/admin/lib/lang/sk_system_config.lng +++ b/interface/web/admin/lib/lang/sk_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/lib/lang/tr_system_config.lng b/interface/web/admin/lib/lang/tr_system_config.lng index 8a5fd3a86f..0acf8832c4 100644 --- a/interface/web/admin/lib/lang/tr_system_config.lng +++ b/interface/web/admin/lib/lang/tr_system_config.lng @@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail $wb['tab_change_discard_txt'] = 'Discard changes on tab change'; $wb['tab_change_warning_txt'] = 'Tab change warning'; $wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.'; -$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; +$wb['vhost_subdomains_txt'] = 'Create subdomains as web site'; $wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; +$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site'; +$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!'; $wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL'; $wb['use_combobox_txt'] = 'Use jQuery UI Combobox'; $wb['use_loadindicator_txt'] = 'Use Load Indicator'; diff --git a/interface/web/admin/system_config_edit.php b/interface/web/admin/system_config_edit.php index 35140b459d..9c69cfa401 100644 --- a/interface/web/admin/system_config_edit.php +++ b/interface/web/admin/system_config_edit.php @@ -147,6 +147,12 @@ class page_action extends tform_actions { if($check['cnt'] > 0) { $new_config['vhost_subdomains'] = 'y'; } + } elseif($section == 'sites' && $new_config['vhost_aliasdomains'] != 'y' && $server_config_array['vhost_aliasdomains'] == 'y') { + // check for existing vhost aliasdomains, if found the mode cannot be disabled + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostalias'"); + if($check['cnt'] > 0) { + $new_config['vhost_aliasdomains'] = 'y'; + } } elseif($section == 'mail') { if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['mail']['smtp_pass']; } elseif($section == 'misc' && $new_config['session_timeout'] != $server_config_array['misc']['session_timeout']) { diff --git a/interface/web/admin/system_config_edit.php.bak b/interface/web/admin/system_config_edit.php.bak new file mode 100644 index 0000000000..35140b459d --- /dev/null +++ b/interface/web/admin/system_config_edit.php.bak @@ -0,0 +1,205 @@ +auth->check_module_permissions('admin'); + +// Loading classes +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + //var $_js_changed = false; + + function onShowEdit() { + global $app, $conf; + + if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges'); + + if($app->tform->errorMessage == '') { + $app->uses('ini_parser,getconf'); + + $section = $this->active_tab; + $server_id = $this->id; + + $this->dataRecord = $app->getconf->get_global_config($section); + if ($section == 'domains'){ + if (isset($this->dataRecord['use_domain_module'])){ + $_SESSION['use_domain_module_old_value'] = $this->dataRecord['use_domain_module']; + } + } + } + + $record = $app->tform->getHTML($this->dataRecord, $this->active_tab, 'EDIT'); + + $record['warning'] = $app->tform->lng('warning'); + $record['id'] = $this->id; + $app->tpl->setVar($record); + } + + function onShowEnd() { + global $app, $conf; + + // available dashlets + $available_dashlets_txt = ''; + $handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets'); + while ($file = @readdir($handle)) { + if ($file != '.' && $file != '..' && !is_dir($file)) { + $available_dashlets_txt .= '['.substr($file, 0, -4).'] '; + } + } + + if($available_dashlets_txt == '') $available_dashlets_txt = '------'; + $app->tpl->setVar("available_dashlets_txt", $available_dashlets_txt); + + parent::onShowEnd(); + } + + function onSubmit() { + global $app; + + $app->uses('ini_parser,getconf'); + + $section = $app->tform->getCurrentTab(); + + $server_config_array = $app->getconf->get_global_config(); + $new_config = $app->tform->encode($this->dataRecord, $section); + if($section == 'mail') { + if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['smtp_pass']; + if($new_config['smtp_enabled'] == 'y' && ($new_config['admin_mail'] == '' || $new_config['admin_name'] == '')) { + $app->tform->errorMessage .= $app->tform->lng("smtp_missing_admin_mail_txt"); + } + } + + parent::onSubmit(); + } + + function onUpdateSave($sql) { + global $app, $conf; + + if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges'); + $app->uses('ini_parser,getconf'); + + $section = $app->tform->getCurrentTab(); + + $server_config_array = $app->getconf->get_global_config(); + + foreach($app->tform->formDef['tabs'][$section]['fields'] as $key => $field) { + if ($field['formtype'] == 'CHECKBOX') { + if($this->dataRecord[$key] == '') { + // if a checkbox is not set, we set it to the unchecked value + $this->dataRecord[$key] = $field['value'][0]; + } + } + } + + /* + if((isset($this->dataRecord['use_loadindicator']) && $this->dataRecord['use_loadindicator'] != $server_config_array[$section]['use_loadindicator']) || (isset($this->dataRecord['use_combobox']) && $this->dataRecord['use_combobox'] != $server_config_array[$section]['use_combobox'])){ + $this->_js_changed = true; + } + */ + + $new_config = $app->tform->encode($this->dataRecord, $section); + if($section == 'sites' && $new_config['vhost_subdomains'] != 'y' && $server_config_array['sites']['vhost_subdomains'] == 'y') { + // check for existing vhost subdomains, if found the mode cannot be disabled + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain'"); + if($check['cnt'] > 0) { + $new_config['vhost_subdomains'] = 'y'; + } + } elseif($section == 'mail') { + if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['mail']['smtp_pass']; + } elseif($section == 'misc' && $new_config['session_timeout'] != $server_config_array['misc']['session_timeout']) { + $app->db->query("DELETE FROM sys_config WHERE `config_id` = 2 AND `group` = 'interface' AND `name` = 'session_timeout'"); + $app->db->query("INSERT INTO sys_config (`config_id`, `group`, `name`, `value`) VALUES (2, 'interface', 'session_timeout', '" . intval($new_config['session_timeout']) . "')"); + } + $server_config_array[$section] = $new_config; + $server_config_str = $app->ini_parser->get_ini_string($server_config_array); + + //$sql = "UPDATE sys_ini SET config = '".$app->db->quote($server_config_str)."' WHERE sysini_id = 1"; + //if($conf['demo_mode'] != true) $app->db->query($sql); + if($conf['demo_mode'] != true) $app->db->datalogUpdate('sys_ini', "config = '".$app->db->quote($server_config_str)."'", 'sysini_id', 1); + + /* + * If we should use the domain-module, we have to insert all existing domains into the table + * (only the first time!) + */ + if (($section == 'domains') && + ($_SESSION['use_domain_module_old_value'] == '') && + ($server_config_array['domains']['use_domain_module'] == 'y')){ + $sql = "REPLACE INTO domain (sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, domain ) " . + "SELECT sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, domain " . + "FROM mail_domain"; + $app->db->query($sql); + $sql = "REPLACE INTO domain (sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, domain ) " . + "SELECT sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, domain " . + "FROM web_domain WHERE type NOT IN ('subdomain','vhostsubdomain')"; + $app->db->query($sql); + } + + // Maintenance mode + if($server_config_array['misc']['maintenance_mode'] == 'y'){ + //print_r($_SESSION); + //echo $_SESSION['s']['id']; + $app->db->query("DELETE FROM sys_session WHERE session_id != '".$app->db->quote($_SESSION['s']['id'])."'"); + } + } + + /* + function onAfterUpdate() { + if($this->_js_changed == true) { + // not the best way, but it works + header('Content-Type: text/html'); + print ''; + exit; + } + } + */ + +} + +$app->tform_actions = new page_action; +$app->tform_actions->onLoad(); + + +?> diff --git a/interface/web/admin/templates/system_config_sites_edit.htm b/interface/web/admin/templates/system_config_sites_edit.htm index 65f37b7820..f98493ee79 100644 --- a/interface/web/admin/templates/system_config_sites_edit.htm +++ b/interface/web/admin/templates/system_config_sites_edit.htm @@ -45,6 +45,12 @@ {tmpl_var name='vhost_subdomains'} {tmpl_var name='vhost_subdomains_note_txt'} +
+

{tmpl_var name='vhost_aliasdomains_txt'}

+
+ {tmpl_var name='vhost_aliasdomains'} {tmpl_var name='vhost_aliasdomains_note_txt'} +
+

{tmpl_var name='client_username_web_check_disabled_txt'}

diff --git a/interface/web/dashboard/ajax_get_json.php b/interface/web/dashboard/ajax_get_json.php index 48294188de..2bc21d4e03 100644 --- a/interface/web/dashboard/ajax_get_json.php +++ b/interface/web/dashboard/ajax_get_json.php @@ -66,6 +66,9 @@ if($type == 'globalsearch'){ // vhostsubdomains $result[] = _search('sites', 'web_vhost_subdomain', "AND type = 'vhostsubdomain'"); + // vhostaliasdomains + $result[] = _search('sites', 'web_vhost_aliasdomain', "AND type = 'vhostalias'"); + // FTP users $result[] = _search('sites', 'ftp_user'); diff --git a/interface/web/dashboard/ajax_get_json.php.bak b/interface/web/dashboard/ajax_get_json.php.bak new file mode 100644 index 0000000000..48294188de --- /dev/null +++ b/interface/web/dashboard/ajax_get_json.php.bak @@ -0,0 +1,238 @@ +auth->check_module_permissions('dashboard'); + +$app->uses('tform'); + +$type = $_GET["type"]; + +//if($_SESSION["s"]["user"]["typ"] == 'admin') { + + +if($type == 'globalsearch'){ + $q = $app->db->quote(trim($_GET["q"])); + $authsql = " AND ".$app->tform->getAuthSQL('r'); + $modules = explode(',', $_SESSION['s']['user']['modules']); + + $result = array(); + + // clients + $result[] = _search('client', 'client', "AND limit_client = 0"); + + // resellers + $result[] = _search('client', 'reseller', "AND limit_client != 0"); + + // web sites + $result[] = _search('sites', 'web_domain', "AND type = 'vhost'"); + + // subdomains + $result[] = _search('sites', 'web_subdomain', "AND type = 'subdomain'"); + + // web site aliases + $result[] = _search('sites', 'web_aliasdomain', "AND type = 'alias'"); + + // vhostsubdomains + $result[] = _search('sites', 'web_vhost_subdomain', "AND type = 'vhostsubdomain'"); + + // FTP users + $result[] = _search('sites', 'ftp_user'); + + // shell users + $result[] = _search('sites', 'shell_user'); + + // databases + /* + $result_databases = array('cheader' => array(), 'cdata' => array()); + if(in_array('sites', $modules)){ + $sql = "SELECT * FROM web_database WHERE database_name LIKE '%".$q."%' OR database_user LIKE '%".$q."%' OR remote_ips LIKE '%".$q."%'".$authsql." ORDER BY database_name"; + $results = $app->db->queryAllRecords($sql); + + if(is_array($results) && !empty($results)){ + $result_databases['cheader'] = array('title' => 'Databases', + 'total' => count($results), + 'limit' => count($results) + ); + foreach($results as $result){ + $description = 'Database User: '.$result['database_user'].' - Remote IPs: '.$result['remote_ips']; + $result_databases['cdata'][] = array('title' => $result['database_name'], + 'description' => $description, + 'onclick' => 'capp(\'sites\',\'sites/database_edit.php?id='.$result['database_id'].'\');', + 'fill_text' => strtolower($result['database_name']) + ); + } + } + } + */ + $result[] = _search('sites', 'database'); + + // database users + $result[] = _search('sites', 'database_user'); + + // email domains + $result[] = _search('mail', 'mail_domain'); + + // email alias domains + $result[] = _search('mail', 'mail_aliasdomain', "AND type = 'aliasdomain'"); + + // email mailboxes + $result[] = _search('mail', 'mail_user'); + + // email aliases + $result[] = _search('mail', 'mail_alias', "AND type = 'alias'"); + + // email forwards + $result[] = _search('mail', 'mail_forward', "AND type = 'forward'"); + + // email catchalls + $result[] = _search('mail', 'mail_domain_catchall', "AND type = 'catchall'"); + + // email transports + $result[] = _search('mail', 'mail_transport'); + + // mailinglists + $result[] = _search('mail', 'mail_mailinglist'); + + // getmails + $result[] = _search('mail', 'mail_get'); + + // dns zones + $result[] = _search('dns', 'dns_soa'); + + // secondary dns zones + $result[] = _search('dns', 'dns_slave'); + + // virtual machines + $result[] = _search('vm', 'openvz_vm'); + + // virtual machines os templates + $result[] = _search('vm', 'openvz_ostemplate'); + + // virtual machines vm templates + $result[] = _search('vm', 'openvz_template'); + + // virtual machines ip addresses + $result[] = _search('vm', 'openvz_ip'); + + // directive snippets + $result[] = _search('admin', 'directive_snippets'); + + $json = $app->functions->json_encode($result); +} + +//} + +function _search($module, $section, $additional_sql = ''){ + global $app, $q, $authsql, $modules; + + $result_array = array('cheader' => array(), 'cdata' => array()); + if(in_array($module, $modules)){ + $search_fields = array(); + $desc_fields = array(); + if(is_file('../'.$module.'/form/'.$section.'.tform.php')){ + include_once '../'.$module.'/form/'.$section.'.tform.php'; + + $category_title = $form["title"]; + $form_file = $form["action"]; + $db_table = $form["db_table"]; + $db_table_idx = $form["db_table_idx"]; + $order_by = $db_table_idx; + + if(is_array($form["tabs"]) && !empty($form["tabs"])){ + foreach($form["tabs"] as $tab){ + if(is_array($tab['fields']) && !empty($tab['fields'])){ + foreach($tab['fields'] as $key => $val){ + if(isset($val['searchable']) && $val['searchable'] > 0){ + $search_fields[] = $key." LIKE '%".$q."%'"; + if($val['searchable'] == 1){ + $order_by = $key; + $title_key = $key; + } + if($val['searchable'] == 2){ + $desc_fields[] = $key; + } + } + } + } + } + } + } + unset($form); + + $where_clause = ''; + if(!empty($search_fields)){ + $where_clause = implode(' OR ', $search_fields); + } else { + // valid SQL query which returns an empty result set + $where_clause = '1 = 0'; + } + if($where_clause != '') $where_clause = '('.$where_clause.')'; + if($additional_sql != '') $where_clause .= ' '.$additional_sql.' '; + $order_clause = ''; + if($order_by != '') $order_clause = ' ORDER BY '.$order_by; + + $sql = "SELECT * FROM ".$db_table." WHERE ".$where_clause.$authsql.$order_clause." LIMIT 0,10"; + $results = $app->db->queryAllRecords($sql); + + if(is_array($results) && !empty($results)){ + $lng_file = '../'.$module.'/lib/lang/'.$_SESSION['s']['language'].'_'.$section.'.lng'; + if(is_file($lng_file)) include $lng_file; + $result_array['cheader'] = array('title' => $category_title, + 'total' => count($results), + 'limit' => count($results) + ); + foreach($results as $result){ + $description = ''; + if(!empty($desc_fields)){ + $desc_items = array(); + foreach($desc_fields as $desc_field){ + if($result[$desc_field] != '') $desc_items[] = $wb[$desc_field.'_txt'].': '.$result[$desc_field]; + } + if(!empty($desc_items)) $description = implode(' - ', $desc_items); + } + + $result_array['cdata'][] = array('title' => $wb[$title_key.'_txt'].': '.$result[$title_key], + 'description' => $description, + 'onclick' => "capp('".$module."','".$module."/".$form_file."?id=".$result[$db_table_idx]."');", + 'fill_text' => strtolower($result[$title_key]) + ); + } + } + } + return $result_array; +} + +header('Content-type: application/json'); +echo $json; +?> diff --git a/interface/web/dashboard/dashlets/limits.php b/interface/web/dashboard/dashlets/limits.php index b361f6e9ba..5ffa346277 100644 --- a/interface/web/dashboard/dashlets/limits.php +++ b/interface/web/dashboard/dashlets/limits.php @@ -71,7 +71,7 @@ class dashlet_limits { $limits[] = array('field' => 'limit_web_aliasdomain', 'db_table' => 'web_domain', - 'db_where' => "type = 'alias'"); + 'db_where' => "(type = 'alias' OR type = 'vhostalias'"); $limits[] = array('field' => 'limit_ftp_user', 'db_table' => 'ftp_user', diff --git a/interface/web/dashboard/dashlets/limits.php.bak b/interface/web/dashboard/dashlets/limits.php.bak new file mode 100644 index 0000000000..b361f6e9ba --- /dev/null +++ b/interface/web/dashboard/dashlets/limits.php.bak @@ -0,0 +1,177 @@ + 'limit_maildomain', + 'db_table' => 'mail_domain', + 'db_where' => ''); + + $limits[] = array('field' => 'limit_mailmailinglist', + 'db_table' => 'mail_mailinglist', + 'db_where' => ''); + + $limits[] = array('field' => 'limit_mailbox', + 'db_table' => 'mail_user', + 'db_where' => ''); + + $limits[] = array('field' => 'limit_mailalias', + 'db_table' => 'mail_forwarding', + 'db_where' => "type = 'alias'"); + + $limits[] = array('field' => 'limit_mailaliasdomain', + 'db_table' => 'mail_forwarding', + 'db_where' => "type = 'aliasdomain'"); + + $limits[] = array('field' => 'limit_mailforward', + 'db_table' => 'mail_forwarding', + 'db_where' => "type = 'forward'"); + + $limits[] = array('field' => 'limit_mailcatchall', + 'db_table' => 'mail_forwarding', + 'db_where' => "type = 'catchall'"); + + $limits[] = array('field' => 'limit_mailrouting', + 'db_table' => 'mail_transport', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_mailfilter', + 'db_table' => 'mail_user_filter', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_fetchmail', + 'db_table' => 'mail_get', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_spamfilter_wblist', + 'db_table' => 'spamfilter_wblist', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_spamfilter_user', + 'db_table' => 'spamfilter_users', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_spamfilter_policy', + 'db_table' => 'spamfilter_policy', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_web_domain', + 'db_table' => 'web_domain', + 'db_where' => "type = 'vhost'"); + + $limits[] = array('field' => 'limit_web_subdomain', + 'db_table' => 'web_domain', + 'db_where' => "(type = 'subdomain' OR type = 'vhostsubdomain')"); + + $limits[] = array('field' => 'limit_web_aliasdomain', + 'db_table' => 'web_domain', + 'db_where' => "type = 'alias'"); + + $limits[] = array('field' => 'limit_ftp_user', + 'db_table' => 'ftp_user', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_shell_user', + 'db_table' => 'shell_user', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_dns_zone', + 'db_table' => 'dns_soa', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_dns_slave_zone', + 'db_table' => 'dns_slave', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_dns_record', + 'db_table' => 'dns_rr', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_database', + 'db_table' => 'web_database', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_cron', + 'db_table' => 'cron', + 'db_where' => ""); + + $limits[] = array('field' => 'limit_client', + 'db_table' => 'client', + 'db_where' => ""); + + + + + //* Loading Template + $app->uses('tpl,tform'); + + $tpl = new tpl; + $tpl->newTemplate("dashlets/templates/limits.htm"); + + $wb = array(); + $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_limits.lng'; + if(is_file($lng_file)) include $lng_file; + $tpl->setVar($wb); + + if($app->auth->is_admin()) { + $user_is_admin = true; + } else { + $user_is_admin = false; + } + $tpl->setVar('is_admin', $user_is_admin); + + if($user_is_admin == false) { + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $client = $app->db->queryOneRecord("SELECT * FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + } + + $rows = array(); + foreach($limits as $limit) { + $field = $limit['field']; + if($user_is_admin) { + $value = $wb['unlimited_txt']; + } else { + $value = $client[$field]; + } + if($value != 0 || $value == $wb['unlimited_txt']) { + $value_formatted = ($value == '-1')?$wb['unlimited_txt']:$value; + $rows[] = array('field' => $field, + 'field_txt' => $wb[$field.'_txt'], + 'value' => $value_formatted, + 'usage' => $this->_get_limit_usage($limit)); + } + } + $tpl->setLoop('rows', $rows); + + + return $tpl->grab(); + + } + + function _get_limit_usage($limit) { + global $app; + + $sql = "SELECT count(sys_userid) as number FROM ".$app->db->quote($limit['db_table'])." WHERE "; + if($limit['db_where'] != '') $sql .= $limit['db_where']." AND "; + $sql .= $app->tform->getAuthSQL('r'); + $rec = $app->db->queryOneRecord($sql); + return $rec['number']; + + } + +} + + + + + + + + +?> diff --git a/interface/web/data.sql b/interface/web/data.sql index 67234bd43c..0c15827b2c 100644 --- a/interface/web/data.sql +++ b/interface/web/data.sql @@ -322,6 +322,57 @@ INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ( INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_subdomain_edit.php', 'nginx_directives', '0', '', ''); INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_subdomain_edit.php', 'proxy_directives', '0', '', ''); INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_subdomain_edit.php', 'php_fpm_use_socket', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'domain', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'web_folder', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'traffic_quota', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'parent_domain_id', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'sel_domain', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'parent_domain_id', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'aliasdomain', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'php', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'fastcgi_php_version', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'cgi', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssi', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'perl', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ruby', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'python', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'suexec', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'errordocs', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssl', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'active', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'redirect_path', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'redirect_type', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'seo_redirect', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssl_state', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssl_locality', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssl_organisation', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssl_organisation_unit', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssl_country', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssl_domain', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssl_action', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssl_key', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssl_request', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssl_cert', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'ssl_bundle', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'stats_password', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'repeat_password', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'stats_type', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'backup_interval', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'backup_copies', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'allow_override', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'pm_max_children', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'pm_start_servers', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'pm_min_spare_servers', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'pm_max_spare_servers', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'pm_process_idle_timeout', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'pm_max_requests', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'php_open_basedir', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'pm', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'custom_php_ini', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'apache_directives', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'nginx_directives', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'proxy_directives', '0', '', ''); +INSERT IGNORE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_vhost_aliasdomain_edit.php', 'php_fpm_use_socket', '0', '', ''); REPLACE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_folder_edit.php', 'path', '0', '', 'Welches Verzeichnis von Ihrer Webseite möchten Sie mit einem Passwort schützen?'); REPLACE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_folder_edit.php', 'parent_domain_id', '0', '', 'Zu welcher Webseite soll ein Passwortschutz angelegt werden?'); REPLACE INTO `help_tooltips` (`url`, `field`, `demo`, `en`, `de`) VALUES ('/sites/web_folder_edit.php', 'active', '0', '', 'Ist diese Option gesetzt, ist der Passwortschutz aktiv.'); diff --git a/interface/web/sites/aps_install_package.php b/interface/web/sites/aps_install_package.php index 8ba04efd21..2e2e7bc761 100644 --- a/interface/web/sites/aps_install_package.php +++ b/interface/web/sites/aps_install_package.php @@ -87,7 +87,7 @@ $domains = array(); $domain_for_user = ''; if(!$adminflag) $domain_for_user = "AND (sys_userid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' OR sys_groupid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' )"; -$domains_assoc = $app->db->queryAllRecords("SELECT domain FROM web_domain WHERE document_root != '' AND (type = 'vhost' OR type = 'vhostsubdomain') AND active = 'y' ".$domain_for_user." ORDER BY domain;"); +$domains_assoc = $app->db->queryAllRecords("SELECT domain FROM web_domain WHERE document_root != '' AND (type = 'vhost' OR type = 'vhostsubdomain' OR type = 'vhostalias') AND active = 'y' ".$domain_for_user." ORDER BY domain;"); if(!empty($domains_assoc)) foreach($domains_assoc as $domain) $domains[] = $domain['domain']; // If data has been submitted, validate it diff --git a/interface/web/sites/aps_install_package.php.bak b/interface/web/sites/aps_install_package.php.bak new file mode 100644 index 0000000000..8ba04efd21 --- /dev/null +++ b/interface/web/sites/aps_install_package.php.bak @@ -0,0 +1,211 @@ +load('aps_guicontroller'); + +// Check the module permissions +$app->auth->check_module_permissions('sites'); + +// Load needed classes +$app->uses('tpl,tform'); +$app->tpl->newTemplate("form.tpl.htm"); +$app->tpl->setInclude('content_tpl', 'templates/aps_install_package.htm'); + +// Load the language file +$lngfile = 'lib/lang/'.$_SESSION['s']['language'].'_aps.lng'; +require_once $lngfile; +$app->tpl->setVar($wb); +$app->load_language_file('web/sites/'.$lngfile); + +// we will check only users, not admins +if($_SESSION["s"]["user"]["typ"] == 'user') { + $app->tform->formDef['db_table_idx'] = 'client_id'; + $app->tform->formDef['db_table'] = 'client'; + if(!$app->tform->checkClientLimit('limit_aps')) { + $app->error($app->lng("limit_aps_txt")); + } + if(!$app->tform->checkResellerLimit('limit_aps')) { + $app->error('Reseller: '.$wb["limit_aps_txt"]); + } +} + + +$adminflag = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false; +$gui = new ApsGUIController($app); +$pkg_id = (isset($_GET['id'])) ? $app->db->quote($_GET['id']) : ''; + +// Check if a newer version is available for the current package +// Note: It's intended that here is no strict ID check (see below) +if(isset($pkg_id)) +{ + $newest_pkg_id = $gui->getNewestPackageID($pkg_id); + if($newest_pkg_id != 0) $pkg_id = $newest_pkg_id; +} + +// Make sure an integer ID is given +if(!isset($pkg_id) || !$gui->isValidPackageID($pkg_id, $adminflag)) + $app->error($app->lng('Invalid ID')); + +// Get package details +$details = $gui->getPackageDetails($pkg_id); +if(isset($details['error'])) $app->error($details['error']); +$settings = $gui->getPackageSettings($pkg_id); +if(isset($settings['error'])) $app->error($settings['error']); + +// Get domain list +$domains = array(); +$domain_for_user = ''; +if(!$adminflag) $domain_for_user = "AND (sys_userid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' + OR sys_groupid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' )"; +$domains_assoc = $app->db->queryAllRecords("SELECT domain FROM web_domain WHERE document_root != '' AND (type = 'vhost' OR type = 'vhostsubdomain') AND active = 'y' ".$domain_for_user." ORDER BY domain;"); +if(!empty($domains_assoc)) foreach($domains_assoc as $domain) $domains[] = $domain['domain']; + + // If data has been submitted, validate it + $result['input'] = array(); +if(count($_POST) > 1) +{ + $result = $gui->validateInstallerInput($_POST, $details, $domains, $settings); + if(empty($result['error'])) + { + $gui->createPackageInstance($result['input'], $pkg_id); + @header('Location:aps_installedpackages_list.php'); + } + else + { + $app->tpl->setVar('error', implode('
', $result['error'])); + + // Set memorized values (license, db password, install location) + if(!empty($result['input'])) + foreach($result['input'] as $key => $value) $app->tpl->setVar('inp_'.$key, $value); + } +} +else $app->tpl->setVar('inp_main_database_password', ucfirst(substr(md5(crypt(rand(0, 10))), 0, 16))); + +// Pass the package details to the template +foreach($details as $key => $value) +{ + if(!is_array($value)) $app->tpl->setVar('pkg_'.str_replace(' ', '_', strtolower($key)), $value); + else if($key == 'Requirements PHP settings') $app->tpl->setLoop('pkg_requirements_php_settings', $details['Requirements PHP settings']); +} + +// Parse the template as far as possible, then do the rest manually +$app->tpl_defaults(); +$parsed_tpl = $app->tpl->grab(); + + +// ISPConfig has a very old and functionally limited template engine. We have to style parts on our own... + +// Print the domain list +$domains_tpl = ''; +if(!empty($domains)) +{ + $set = array(); + $set[] = ''; + + $domains_tpl = implode("\n", $set); +} +$parsed_tpl = str_replace('DOMAIN_LIST_SPACE', $domains_tpl, $parsed_tpl); + +// Print the packgae settings +$settings_tpl = ''; +if(!empty($settings)) +{ + $set = array(); + $set[] = ''.$app->lng('package_settings_txt').''; + foreach($settings as $setting) + { + $set[] = '
'; + $set[] = ''; + if($setting['SettingInputType'] == 'string' || $setting['SettingInputType'] == 'password') + { + $input_type = ($setting['SettingInputType'] == 'string') ? 'text' : 'password'; + + $input_value = ''; + if((count($_POST) > 1) + && (isset($result['input'][$setting['SettingID']]))) + $input_value = $result['input'][$setting['SettingID']]; + else $input_value = @$setting['SettingDefaultValue']; + + $set[] = ' +

'.$setting['SettingDescription'].'

'; + } + else if($setting['SettingInputType'] == 'checkbox') + { + $checked = ''; + if((count($_POST) > 1) + && (isset($result['input'][$setting['SettingID']]) + && ($result['input'][$setting['SettingID']] == 'true'))) + $checked = 'checked '; + else if($setting['SettingDefaultValue'] == '1') $checked = 'checked '; + + $set[] = ' +

'.$setting['SettingDescription'].'

'; + } + else if($setting['SettingInputType'] == 'select') + { + $set[] = ' +

'.$setting['SettingDescription'].'

'; + } + + $set[] = '
'; + } + $settings_tpl = implode("\n", $set); +} +$parsed_tpl = str_replace('PKG_SETTINGS_SPACE', $settings_tpl, $parsed_tpl); + +echo $parsed_tpl; +?> diff --git a/interface/web/sites/form/web_folder.tform.php b/interface/web/sites/form/web_folder.tform.php index ab8d4747ce..5fec523a69 100644 --- a/interface/web/sites/form/web_folder.tform.php +++ b/interface/web/sites/form/web_folder.tform.php @@ -74,7 +74,7 @@ $form["tabs"]['folder'] = array ( 'formtype' => 'SELECT', 'default' => '', 'datasource' => array ( 'type' => 'SQL', - 'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE (web_domain.type = 'vhost' OR web_domain.type = 'vhostsubdomain') AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain", + 'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE (web_domain.type = 'vhost' OR web_domain.type = 'vhostsubdomain' OR web_domain.type = 'vhostalias') AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain", 'keyfield'=> 'domain_id', 'valuefield'=> 'parent_domain' ), diff --git a/interface/web/sites/form/web_folder.tform.php.bak b/interface/web/sites/form/web_folder.tform.php.bak new file mode 100644 index 0000000000..ab8d4747ce --- /dev/null +++ b/interface/web/sites/form/web_folder.tform.php.bak @@ -0,0 +1,110 @@ + 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete + +$form["tabs"]['folder'] = array ( + 'title' => "Folder", + 'width' => 100, + 'template' => "templates/web_folder_edit.htm", + 'fields' => array ( + //################################# + // Begin Datatable fields + //################################# + 'server_id' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name', + 'keyfield'=> 'server_id', + 'valuefield'=> 'server_name' + ), + 'value' => '' + ), + 'parent_domain_id' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE (web_domain.type = 'vhost' OR web_domain.type = 'vhostsubdomain') AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain", + 'keyfield'=> 'domain_id', + 'valuefield'=> 'parent_domain' + ), + 'value' => '' + ), + 'path' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[\w\.\-\_\/]{0,255}$/', + 'errmsg'=> 'path_error_regex'), + ), + 'default' => '/', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'active' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + + + + +?> diff --git a/interface/web/sites/form/web_vhost_aliasdomain.tform.php b/interface/web/sites/form/web_vhost_aliasdomain.tform.php new file mode 100644 index 0000000000..1b877a645e --- /dev/null +++ b/interface/web/sites/form/web_vhost_aliasdomain.tform.php @@ -0,0 +1,735 @@ + 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete + +$wildcard_available = false; +$ssl_available = true; +if(!$app->auth->is_admin()) { + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $client = $app->db->queryOneRecord("SELECT limit_wildcard, limit_ssl FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + + if($client['limit_ssl'] != 'y') $ssl_available = false; +} + +$app->uses('getconf'); +$web_config = $app->getconf->get_global_config('sites'); + +$form["tabs"]['domain'] = array ( + 'title' => "Domain", + 'width' => 100, + 'template' => "templates/web_vhost_aliasdomain_edit.htm", + 'readonly' => false, + 'fields' => array ( + //################################# + // Begin Datatable fields + //################################# + 'server_id' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name', + 'keyfield'=> 'server_id', + 'valuefield'=> 'server_name' + ), + 'value' => '' + ), + 'ip_address' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + /*'datasource' => array ( 'type' => 'SQL', + 'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address", + 'keyfield'=> 'ip_address', + 'valuefield'=> 'ip_address' + ),*/ + 'value' => '', + 'searchable' => 2 + ), + 'ipv6_address' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + /*'datasource' => array ( 'type' => 'SQL', + 'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv6' AND {AUTHSQL} ORDER BY ip_address", + 'keyfield'=> 'ip_address', + 'valuefield'=> 'ip_address' + ),*/ + 'value' => '', + 'searchable' => 2 + ), + 'domain' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( 0 => array( 'event' => 'SAVE', + 'type' => 'IDNTOASCII'), + 1 => array( 'event' => 'SHOW', + 'type' => 'IDNTOUTF8'), + 2 => array( 'event' => 'SAVE', + 'type' => 'TOLOWER') + ), + 'validators' => array ( 0 => array ( 'type' => 'CUSTOM', + 'class' => 'validate_domain', + 'function' => 'alias_domain', + 'errmsg'=> 'domain_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255', + 'searchable' => 1 + ), + 'type' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'y', + 'value' => array('vhost' => 'Site', 'alias' => 'Alias', 'vhostalias' => 'Alias', 'subdomain' => 'Subdomain', 'vhostsubdomain' => 'Subdomain') + ), + 'parent_domain_id' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain", + 'keyfield'=> 'domain_id', + 'valuefield'=> 'parent_domain' + ), + 'value' => '' + ), + 'web_folder' => array ( + 'datatype' => 'VARCHAR', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '@^((?!.*\.\.)[\w/_\.\-]{1,100})$@', + 'errmsg'=> 'web_folder_error_regex'), + ), + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'vhost_type' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'y', + 'value' => array('name' => 'Namebased', 'ip' => 'IP-Based') + ), + 'hd_quota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => '0', + 'value' => '', + 'width' => '7', + 'maxlength' => '7' + ), + 'traffic_quota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'traffic_quota_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^(\-1|[0-9]{1,10})$/', + 'errmsg'=> 'traffic_quota_error_regex'), + ), + 'default' => '-1', + 'value' => '', + 'width' => '7', + 'maxlength' => '7' + ), + 'cgi' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'ssi' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'suexec' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'errordocs' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'CHECKBOX', + 'default' => '1', + 'value' => array(0 => '0', 1 => '1') + ), + 'subdomain' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'www', + 'value' => ($wildcard_available ? array('none' => 'none_txt', 'www' => 'www.', '*' => '*.') : array('none' => 'none_txt', 'www' => 'www.')) + ), + 'ssl' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'php' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'fast-cgi', + 'valuelimit' => 'client:web_php_options', + 'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'), + 'searchable' => 2 + ), + 'fastcgi_php_version' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + /*'datasource' => array ( 'type' => 'SQL', + 'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address", + 'keyfield'=> 'ip_address', + 'valuefield'=> 'ip_address' + ),*/ + 'value' => '' + ), + 'perl' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'ruby' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'python' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'active' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + + +$form["tabs"]['redirect'] = array ( + 'title' => "Redirect", + 'width' => 100, + 'template' => "templates/web_vhost_aliasdomain_redirect.htm", + 'readonly' => false, + 'fields' => array ( + //################################# + // Begin Datatable fields + //################################# + 'redirect_type' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + 'value' => array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy') + ), + 'redirect_path' => array ( + 'datatype' => 'VARCHAR', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@', + 'errmsg'=> 'redirect_error_regex'), + ), + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'seo_redirect' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + 'value' => array('' => 'no_redirect_txt', 'non_www_to_www' => 'domain.tld => www.domain.tld', 'www_to_non_www' => 'www.domain.tld => domain.tld', '*_domain_tld_to_domain_tld' => '*.doman.tld => domain.tld', '*_domain_tld_to_www_domain_tld' => '*.domain.tld => www.domain.tld', '*_to_domain_tld' => '* => domain.tld', '*_to_www_domain_tld' => '* => www.domain.tld') + ), + 'rewrite_rules' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + +if($ssl_available) { + $form["tabs"]['ssl'] = array ( + 'title' => "SSL", + 'width' => 100, + 'template' => "templates/web_vhost_aliasdomain_ssl.htm", + 'readonly' => false, + 'fields' => array ( + //################################# + // Begin Datatable fields + //################################# + 'ssl_state' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/', + 'errmsg'=> 'ssl_state_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'ssl_locality' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/', + 'errmsg'=> 'ssl_locality_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'ssl_organisation' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/', + 'errmsg'=> 'ssl_organisation_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'ssl_organisation_unit' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/', + 'errmsg'=> 'ssl_organistaion_unit_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + /* + 'ssl_country' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^(([\.]{0})|([A-Z]{2,2}))$/', + 'errmsg'=> 'ssl_country_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '2', + 'maxlength' => '2' + ), + */ + 'ssl_country' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name', + 'keyfield'=> 'iso', + 'valuefield'=> 'printable_name' + ), + 'value' => '' + ), + 'ssl_domain' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'ssl_key' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXTAREA', + 'default' => '', + 'value' => '', + 'cols' => '30', + 'rows' => '10' + ), + 'ssl_request' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXTAREA', + 'default' => '', + 'value' => '', + 'cols' => '30', + 'rows' => '10' + ), + 'ssl_cert' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXTAREA', + 'default' => '', + 'value' => '', + 'cols' => '30', + 'rows' => '10' + ), + 'ssl_bundle' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXTAREA', + 'default' => '', + 'value' => '', + 'cols' => '30', + 'rows' => '10' + ), + 'ssl_action' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + 'value' => array('' => 'none_txt', 'save' => 'save_certificate_txt', 'create' => 'create_certificate_txt', 'del' => 'delete_certificate_txt') + ), + //################################# + // ENDE Datatable fields + //################################# + ) + ); +} + +//* Statistics +$form["tabs"]['stats'] = array ( + 'title' => "Stats", + 'width' => 100, + 'template' => "templates/web_vhost_aliasdomain_stats.htm", + 'readonly' => false, + 'fields' => array ( + //################################# + // Begin Datatable fields + //################################# + 'stats_password' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'PASSWORD', + 'encryption' => 'CRYPT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'stats_type' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'webalizer', + 'value' => array('webalizer' => 'Webalizer', 'awstats' => 'AWStats') + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + +// if($_SESSION["s"]["user"]["typ"] == 'admin') { + +//* Backup +$form["tabs"]['backup'] = array ( + 'title' => "Backup", + 'width' => 100, + 'template' => "templates/web_vhost_aliasdomain_backup.htm", + 'readonly' => false, + 'fields' => array ( + //################################# + // Begin Datatable fields + //################################# + 'backup_interval' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + 'value' => array('none' => 'No backup', 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly') + ), + 'backup_copies' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '', + 'value' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10') + ), + 'backup_excludes' => array ( + 'datatype' => 'VARCHAR', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '@^(?!.*\.\.)[-a-zA-Z0-9_/.~,*]*$@', + 'errmsg'=> 'backup_excludes_error_regex'), + ), + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + //################################# + // ENDE Datatable fields + //################################# + ), + 'plugins' => array ( + 'backup_records' => array ( + 'class' => 'plugin_backuplist', + 'options' => array( + ) + ) + ) +); + +// } + +if($_SESSION["s"]["user"]["typ"] == 'admin' + || ($web_config['reseller_can_use_options'] == 'y' && $app->auth->has_clients($_SESSION['s']['user']['userid']))) { + + $form["tabs"]['advanced'] = array ( + 'title' => "Options", + 'width' => 100, + 'template' => "templates/web_vhost_aliasdomain_advanced.htm", + 'readonly' => false, + 'fields' => array ( + //################################# + // Begin Datatable fields + //################################# + 'document_root' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'documentroot_error_empty'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'system_user' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'sysuser_error_empty'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'system_group' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'sysgroup_error_empty'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'allow_override' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'allow_override_error_empty'), + ), + 'default' => 'All', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'php_fpm_use_socket' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'pm' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'dynamic', + 'value' => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand (PHP Version >= 5.3.9)') + ), + 'pm_max_children' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^([1-9][0-9]{0,10})$/', + 'errmsg'=> 'pm_max_children_error_regex'), + ), + 'default' => '10', + 'value' => '', + 'width' => '3', + 'maxlength' => '3' + ), + 'pm_start_servers' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^([1-9][0-9]{0,10})$/', + 'errmsg'=> 'pm_start_servers_error_regex'), + ), + 'default' => '2', + 'value' => '', + 'width' => '3', + 'maxlength' => '3' + ), + 'pm_min_spare_servers' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^([1-9][0-9]{0,10})$/', + 'errmsg'=> 'pm_min_spare_servers_error_regex'), + ), + 'default' => '1', + 'value' => '', + 'width' => '3', + 'maxlength' => '3' + ), + 'pm_max_spare_servers' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^([1-9][0-9]{0,10})$/', + 'errmsg'=> 'pm_max_spare_servers_error_regex'), + ), + 'default' => '5', + 'value' => '', + 'width' => '3', + 'maxlength' => '3' + ), + 'pm_process_idle_timeout' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^([1-9][0-9]{0,10})$/', + 'errmsg'=> 'pm_process_idle_timeout_error_regex'), + ), + 'default' => '10', + 'value' => '', + 'width' => '3', + 'maxlength' => '6' + ), + 'pm_max_requests' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^([0-9]{1,11})$/', + 'errmsg'=> 'pm_max_requests_error_regex'), + ), + 'default' => '0', + 'value' => '', + 'width' => '3', + 'maxlength' => '6' + ), + 'php_open_basedir' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + /*'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'php_open_basedir_error_empty'), + ), */ + 'default' => 'All', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'custom_php_ini' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'apache_directives' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'nginx_directives' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'proxy_directives' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + //################################# + // ENDE Datatable fields + //################################# + ) + ); + +} + + +?> diff --git a/interface/web/sites/form/web_vhost_subdomain.tform.php b/interface/web/sites/form/web_vhost_subdomain.tform.php index 2e30efa870..de2fba800a 100644 --- a/interface/web/sites/form/web_vhost_subdomain.tform.php +++ b/interface/web/sites/form/web_vhost_subdomain.tform.php @@ -136,7 +136,7 @@ $form["tabs"]['domain'] = array ( 'datatype' => 'VARCHAR', 'formtype' => 'SELECT', 'default' => 'y', - 'value' => array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain', 'vhostsubdomain' => 'Subdomain') + 'value' => array('vhost' => 'Site', 'alias' => 'Alias', 'vhostalias' => 'Alias', 'subdomain' => 'Subdomain', 'vhostsubdomain' => 'Subdomain') ), 'parent_domain_id' => array ( 'datatype' => 'INTEGER', diff --git a/interface/web/sites/lib/lang/ar_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/ar_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/ar_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/ar_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/ar_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..ae8bfec7a8 --- /dev/null +++ b/interface/web/sites/lib/lang/ar_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/bg_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/bg_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/bg_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/bg_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/bg_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..8e60e143c2 --- /dev/null +++ b/interface/web/sites/lib/lang/bg_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/br_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/br_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/br_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/br_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/br_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..78dbdd0228 --- /dev/null +++ b/interface/web/sites/lib/lang/br_web_vhost_aliasdomain_list.lng @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/interface/web/sites/lib/lang/cz_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/cz_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..ab47f26dc4 --- /dev/null +++ b/interface/web/sites/lib/lang/cz_web_vhost_aliasdomain.lng @@ -0,0 +1,119 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generovat heslo'; +$wb['repeat_password_txt'] = 'Opakujte heslo'; +$wb['password_mismatch_txt'] = 'Hesla se neshodují.'; +$wb['password_match_txt'] = 'Hesla se shodují.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> + diff --git a/interface/web/sites/lib/lang/cz_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/cz_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..08a25f2ace --- /dev/null +++ b/interface/web/sites/lib/lang/cz_web_vhost_aliasdomain_list.lng @@ -0,0 +1,9 @@ + + diff --git a/interface/web/sites/lib/lang/de_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/de_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..e43803fd25 --- /dev/null +++ b/interface/web/sites/lib/lang/de_web_vhost_aliasdomain.lng @@ -0,0 +1,126 @@ + www'; +$wb['www_to_non_www_txt'] = 'www -> Nicht-www'; +$wb['php_fpm_use_socket_txt'] = 'Benutze Socket für PHP-FPM'; +$wb['ipv6_address_txt'] = 'IPv6-Adresse'; +$wb['error_no_sni_txt'] = 'SNI für SSL ist auf diesem Server nicht aktiviert. Sie können daher nur ein SSL-Zertifikat pro IP-Adresse eintragen.'; +$wb['python_txt'] = 'Python'; +$wb['perl_txt'] = 'Perl'; +$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children'; +$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers'; +$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers'; +$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers'; +$wb['error_php_fpm_pm_settings_txt'] = 'Die Werte der PHP-FPM pm Einstellungen müssen wie folgt sein: pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0'; +$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children muß eine positive ganze Zahl sein.'; +$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers muß eine positive ganze Zahl sein.'; +$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers muß eine positive ganze Zahl sein.'; +$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers muß eine positive ganze Zahl sein.'; +$wb['hd_quota_error_regex'] = 'Harddisk-Quota ist ungültig.'; +$wb['traffic_quota_error_regex'] = 'Traffic-Quota ist ungültig.'; +$wb['fastcgi_php_version_txt'] = 'PHP-Version'; +$wb['pm_txt'] = 'PHP-FPM Prozess Manager'; +$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout'; +$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests'; +$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout muß eine positive ganze Zahl sein.'; +$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests muß eine ganze Zahl >= 0 sein.'; +$wb['pm_ondemand_hint_txt'] = 'Bitte beachten Sie, daß Ihre PHP Version >= 5.3.9 sein muß, wenn Sie den ondemand Prozess Manager nutzen möchten. Wenn Sie ondemand für eine ältere PHP-Version auswählen, wird PHP nicht mehr starten!'; +$wb['generate_password_txt'] = 'Passwort erzeugen'; +$wb['repeat_password_txt'] = 'Passwort wiederholen'; +$wb['password_mismatch_txt'] = 'Die Passwörter stimmen nicht überein.'; +$wb['password_match_txt'] = 'Die Passwörter stimmen überein.'; +$wb['available_php_directive_snippets_txt'] = 'Verfügbare PHP-Direktiven-Schnipsel:'; +$wb['available_apache_directive_snippets_txt'] = 'Verfügbare Apache-Direktiven-Schnipsel:'; +$wb['available_nginx_directive_snippets_txt'] = 'Verfügbare nginx-Direktiven-Schnipsel:'; +$wb['proxy_directives_txt'] = 'Proxy-Direktiven'; +$wb['available_proxy_directive_snippets_txt'] = 'Verfügbare Proxy-Direktiven-Schnipsel:'; +$wb['rewrite_rules_txt'] = 'Rewrite Rules'; +$wb['invalid_rewrite_rules_txt'] = 'Unzulässige Rewrite Rules'; +$wb['allowed_rewrite_rule_directives_txt'] = 'Erlaubte Direktiven:'; +$wb['configuration_error_txt'] = 'KONFIGURATIONSFEHLER'; +$wb['variables_txt'] = 'Variablen'; +$wb['backup_excludes_txt'] = 'Auszuschließende Verzeichnisse'; +$wb['backup_excludes_note_txt'] = '(Mehrere Verzeichnisse mit Kommas trennen. Beispiel: web/cache/*,web/backup)'; +$wb['backup_excludes_error_regex'] = 'Die auszuschließenden Verzeichnisse enthalten ungültige Zeichen.'; +?> diff --git a/interface/web/sites/lib/lang/de_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/de_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..7926017c0d --- /dev/null +++ b/interface/web/sites/lib/lang/de_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/el_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/el_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..7381df6bf7 --- /dev/null +++ b/interface/web/sites/lib/lang/el_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Δημιουργία Συνθηματικού'; +$wb['repeat_password_txt'] = 'Επανάληψη Συνθηματικού'; +$wb['password_mismatch_txt'] = 'Τα Συνθηματικά δεν ταιριάζουν.'; +$wb['password_match_txt'] = 'Τα Συνθηματικά ταιριάζουν.'; +$wb['available_php_directive_snippets_txt'] = 'Διαθέσιμα PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Διαθέσιμα Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Διαθέσιμα nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Διαθέσιμα Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/el_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/el_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..4905e4240d --- /dev/null +++ b/interface/web/sites/lib/lang/el_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/en_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/en_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..3c9009ee15 --- /dev/null +++ b/interface/web/sites/lib/lang/en_web_vhost_aliasdomain.lng @@ -0,0 +1,127 @@ += 0.'; +$wb["pm_ondemand_hint_txt"] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +$wb['rewrite_rules_txt'] = 'Rewrite Rules'; +$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules'; +$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:'; +$wb['configuration_error_txt'] = "CONFIGURATION ERROR"; +$wb['variables_txt'] = 'Variables'; +$wb['backup_excludes_txt'] = 'Excluded Directories'; +$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)'; +$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.'; +?> \ No newline at end of file diff --git a/interface/web/sites/lib/lang/en_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/en_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..3699711f1c --- /dev/null +++ b/interface/web/sites/lib/lang/en_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/interface/web/sites/lib/lang/es_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/es_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/es_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/es_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/es_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..4b28a648e0 --- /dev/null +++ b/interface/web/sites/lib/lang/es_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/fi_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/fi_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/fi_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/fi_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/fi_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..bbea906d1b --- /dev/null +++ b/interface/web/sites/lib/lang/fi_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/fr_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/fr_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/fr_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/fr_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/fr_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..0c6ab59b5c --- /dev/null +++ b/interface/web/sites/lib/lang/fr_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/hr_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/hr_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/hr_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/hr_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/hr_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..79ee85dfe1 --- /dev/null +++ b/interface/web/sites/lib/lang/hr_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/hu_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/hu_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/hu_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/hu_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/hu_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..8fe58ed568 --- /dev/null +++ b/interface/web/sites/lib/lang/hu_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/id_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/id_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/id_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/id_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/id_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..b4aa9e0a1a --- /dev/null +++ b/interface/web/sites/lib/lang/id_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/it_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/it_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/it_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/it_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/it_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..ae8bfec7a8 --- /dev/null +++ b/interface/web/sites/lib/lang/it_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/ja_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/ja_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/ja_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/ja_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/ja_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..1407d49ae9 --- /dev/null +++ b/interface/web/sites/lib/lang/ja_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/nl_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/nl_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/nl_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/nl_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/nl_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..7a24c02a9a --- /dev/null +++ b/interface/web/sites/lib/lang/nl_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/pl_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/pl_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..8420a9d2b7 --- /dev/null +++ b/interface/web/sites/lib/lang/pl_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ + www'; +$wb['www_to_non_www_txt'] = 'www -> bez-www'; +$wb['php_fpm_use_socket_txt'] = 'Użyj gniazda dla PHP-FPM'; +$wb['error_no_sni_txt'] = 'SNI dla SSL nie jest aktywowane dla tego serwera. Możesz włączyć tylko jeden certyfikat SSL dla jednego adresu IP.'; +$wb['python_txt'] = 'Python'; +$wb['perl_txt'] = 'Perl'; +$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children'; +$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers'; +$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers'; +$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers'; +$wb['error_php_fpm_pm_settings_txt'] = 'Wartości ustawień PHP-FPM pm muszą być następujące: pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0'; +$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children musi być dodatnią wartością całkowitą.'; +$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers musi być dodatnią wartością całkowitą.'; +$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers musi być dodatnią wartością całkowitą.'; +$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers musi być dodatnią wartością całkowitą.'; +$wb['hd_quota_error_regex'] = 'Limit dyski jest nieprawidłowy'; +$wb['traffic_quota_error_regex'] = 'Limit transferu jest nieprawidłowy'; +$wb['fastcgi_php_version_txt'] = 'Wersja PHP'; +$wb['pm_txt'] = 'PHP-FPM Process Manager'; +$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout'; +$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests'; +$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout musi być dodatnią wartością całkowitą.'; +$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests musi być wartością całkowitą >= 0.'; +$wb['pm_ondemand_hint_txt'] = 'Pamiętaj że musisz mieć wersję PHP >= 5.3.9 aby używać ondemand process manager. W przypadku starszej wersji PHP nie będzie działać w ogóle!'; +$wb['generate_password_txt'] = 'Generuj hasło'; +$wb['repeat_password_txt'] = 'Powtórz hasło'; +$wb['password_mismatch_txt'] = 'Hasła nie pasują do siebie'; +$wb['password_match_txt'] = 'Hasła pasują do siebie'; +$wb['available_php_directive_snippets_txt'] = 'Dostępne zestawy dyrektyw PHP:'; +$wb['available_apache_directive_snippets_txt'] = 'Dostępne zestawy dyrektyw Apache:'; +$wb['available_nginx_directive_snippets_txt'] = 'Dostępne zestawy dyrektyw nginx:'; +$wb['proxy_directives_txt'] = 'Dyrektywy Proxy'; +$wb['available_proxy_directive_snippets_txt'] = 'Dostępne zestawy dyrektyw Proxy:'; +?> diff --git a/interface/web/sites/lib/lang/pl_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/pl_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..621b614fd7 --- /dev/null +++ b/interface/web/sites/lib/lang/pl_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/pt_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/pt_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/pt_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/pt_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/pt_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..b9dd27cbb9 --- /dev/null +++ b/interface/web/sites/lib/lang/pt_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/ro_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/ro_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/ro_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/ro_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/ro_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..f63f62e246 --- /dev/null +++ b/interface/web/sites/lib/lang/ro_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/ru_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/ru_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/ru_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/ru_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/ru_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..041c188ead --- /dev/null +++ b/interface/web/sites/lib/lang/ru_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/se_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/se_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/se_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/se_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/se_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..ae8bfec7a8 --- /dev/null +++ b/interface/web/sites/lib/lang/se_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/sk_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/sk_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/sk_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/sk_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/sk_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..c626f081e2 --- /dev/null +++ b/interface/web/sites/lib/lang/sk_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/lang/tr_web_vhost_aliasdomain.lng b/interface/web/sites/lib/lang/tr_web_vhost_aliasdomain.lng new file mode 100644 index 0000000000..b87c788126 --- /dev/null +++ b/interface/web/sites/lib/lang/tr_web_vhost_aliasdomain.lng @@ -0,0 +1,118 @@ += 0.'; +$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; +$wb['generate_password_txt'] = 'Generate Password'; +$wb['repeat_password_txt'] = 'Repeat Password'; +$wb['password_mismatch_txt'] = 'The passwords do not match.'; +$wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; +$wb['proxy_directives_txt'] = 'Proxy Directives'; +$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:'; +?> diff --git a/interface/web/sites/lib/lang/tr_web_vhost_aliasdomain_list.lng b/interface/web/sites/lib/lang/tr_web_vhost_aliasdomain_list.lng new file mode 100644 index 0000000000..afe91af16e --- /dev/null +++ b/interface/web/sites/lib/lang/tr_web_vhost_aliasdomain_list.lng @@ -0,0 +1,8 @@ + diff --git a/interface/web/sites/lib/module.conf.php b/interface/web/sites/lib/module.conf.php index 7bb6f8e16a..92e1c12747 100644 --- a/interface/web/sites/lib/module.conf.php +++ b/interface/web/sites/lib/module.conf.php @@ -43,6 +43,16 @@ if($app->auth->get_client_limit($userid, 'web_aliasdomain') != 0) 'target' => 'content', 'link' => 'sites/web_aliasdomain_list.php', 'html_id' => 'aliasdomain_list'); + + // read web config + $app->uses('getconf'); + $sys_config = $app->getconf->get_global_config('sites'); + if($sys_config['vhost_aliasdomains'] == 'y') { + $items[] = array( 'title' => "Aliasdomain (Vhost)", + 'target' => 'content', + 'link' => 'sites/web_vhost_aliasdomain_list.php', + 'html_id' => 'subdomain_list'); + } } if(count($items)) diff --git a/interface/web/sites/list/web_folder.list.php b/interface/web/sites/list/web_folder.list.php index aa23fac673..fedef22a2f 100644 --- a/interface/web/sites/list/web_folder.list.php +++ b/interface/web/sites/list/web_folder.list.php @@ -82,7 +82,7 @@ $liste["item"][] = array( 'field' => "parent_domain_id", 'prefix' => "", 'suffix' => "", 'datasource' => array ( 'type' => 'SQL', - 'querystring' => "SELECT domain_id,domain FROM web_domain WHERE (type = 'vhost' OR type = 'vhostsubdomain') AND {AUTHSQL} ORDER BY domain", + 'querystring' => "SELECT domain_id,domain FROM web_domain WHERE (type = 'vhost' OR type = 'vhostsubdomain' OR type = 'vhostalias') AND {AUTHSQL} ORDER BY domain", 'keyfield'=> 'domain_id', 'valuefield'=> 'domain' ), diff --git a/interface/web/sites/list/web_folder.list.php.bak b/interface/web/sites/list/web_folder.list.php.bak new file mode 100644 index 0000000000..aa23fac673 --- /dev/null +++ b/interface/web/sites/list/web_folder.list.php.bak @@ -0,0 +1,102 @@ + "active", + 'datatype' => "VARCHAR", + 'formtype' => "SELECT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => array('y' => "
Yes
", 'n' => "
No
")); + + +$liste["item"][] = array( 'field' => "server_id", + 'datatype' => "VARCHAR", + 'formtype' => "SELECT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name', + 'keyfield'=> 'server_id', + 'valuefield'=> 'server_name' + ), + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "parent_domain_id", + 'datatype' => "VARCHAR", + 'filters' => array( 0 => array( 'event' => 'SHOW', + 'type' => 'IDNTOUTF8') + ), + 'formtype' => "SELECT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => "SELECT domain_id,domain FROM web_domain WHERE (type = 'vhost' OR type = 'vhostsubdomain') AND {AUTHSQL} ORDER BY domain", + 'keyfield'=> 'domain_id', + 'valuefield'=> 'domain' + ), + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "path", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + + +?> diff --git a/interface/web/sites/templates/web_sites_stats_list.htm b/interface/web/sites/templates/web_sites_stats_list.htm index f721dfbd21..8a1241ad7a 100644 --- a/interface/web/sites/templates/web_sites_stats_list.htm +++ b/interface/web/sites/templates/web_sites_stats_list.htm @@ -30,10 +30,10 @@ {tmpl_var name="domain"} - {tmpl_var name="this_month"} - {tmpl_var name="last_month"} - {tmpl_var name="this_year"} - {tmpl_var name="last_year"} + {tmpl_var name="this_month"} MB + {tmpl_var name="last_month"} MB + {tmpl_var name="this_year"} MB + {tmpl_var name="last_year"} MB diff --git a/interface/web/sites/templates/web_sites_stats_list.htm.bak b/interface/web/sites/templates/web_sites_stats_list.htm.bak new file mode 100644 index 0000000000..f721dfbd21 --- /dev/null +++ b/interface/web/sites/templates/web_sites_stats_list.htm.bak @@ -0,0 +1,63 @@ +

+

+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{tmpl_var name='search_limit'}
+ +
{tmpl_var name="domain"}{tmpl_var name="this_month"}{tmpl_var name="last_month"}{tmpl_var name="this_year"}{tmpl_var name="last_year"}
{tmpl_var name='globalsearch_noresults_text_txt'}
{tmpl_var name="sum_txt"}{tmpl_var name="sum_this_month"} MB{tmpl_var name="sum_last_month"} MB{tmpl_var name="sum_this_year"} MB{tmpl_var name="sum_last_year"} MB
+
+
+ +
diff --git a/interface/web/sites/templates/web_vhost_aliasdomain_advanced.htm b/interface/web/sites/templates/web_vhost_aliasdomain_advanced.htm new file mode 100644 index 0000000000..85f5027221 --- /dev/null +++ b/interface/web/sites/templates/web_vhost_aliasdomain_advanced.htm @@ -0,0 +1,157 @@ +

+

+ +
+ +
+
+ +
+ + + +
+
+ + + +
+
+ + +
+
+
+

{tmpl_var name='php_fpm_use_socket_txt'}

+
+ {tmpl_var name='php_fpm_use_socket'} +
+
+
+ + +
+
+ {tmpl_var name='pm_ondemand_hint_txt'} +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +  s +
+
+ + +
+
+
+ + +
+
+ +  {tmpl_var name="available_php_directive_snippets_txt"}

 {tmpl_var name="php_directive_snippets_txt"} +
+
+ +  {tmpl_var name="available_apache_directive_snippets_txt"}

 {tmpl_var name="apache_directive_snippets_txt"} +
+
+ +  {tmpl_var name="available_nginx_directive_snippets_txt"}

 {tmpl_var name="nginx_directive_snippets_txt"}
----
 {tmpl_var name='variables_txt'}: {DOCROOT}, {FASTCGIPASS} +
+
+ +  {tmpl_var name="available_proxy_directive_snippets_txt"}

 {tmpl_var name="proxy_directive_snippets_txt"} +
+
+ + + +
+ + +
+
+ +
+ \ No newline at end of file diff --git a/interface/web/sites/templates/web_vhost_aliasdomain_backup.htm b/interface/web/sites/templates/web_vhost_aliasdomain_backup.htm new file mode 100644 index 0000000000..8a3b0c3afc --- /dev/null +++ b/interface/web/sites/templates/web_vhost_aliasdomain_backup.htm @@ -0,0 +1,36 @@ +

+

+ +
+ +
+
Backup +
+ + +
+
+ + +
+
+ +  {tmpl_var name='backup_excludes_note_txt'} +
+
+ + {tmpl_var name='backup_records'} + + + +
+ + +
+
+ +
\ No newline at end of file diff --git a/interface/web/sites/templates/web_vhost_aliasdomain_edit.htm b/interface/web/sites/templates/web_vhost_aliasdomain_edit.htm new file mode 100644 index 0000000000..f646b94bc8 --- /dev/null +++ b/interface/web/sites/templates/web_vhost_aliasdomain_edit.htm @@ -0,0 +1,234 @@ +

+

+ +
+ +
+
+ + +
+ + +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ + readonly="readonly" /> +
+
+ +  MB +
+
+

{tmpl_var name='cgi_txt'}

+
+ {tmpl_var name='cgi'} +
+
+
+

{tmpl_var name='ssi_txt'}

+
+ {tmpl_var name='ssi'} +
+
+
+

{tmpl_var name='perl_txt'}

+
+ {tmpl_var name='perl'} +
+
+
+

{tmpl_var name='ruby_txt'}

+
+ {tmpl_var name='ruby'} +
+
+
+

{tmpl_var name='python_txt'}

+
+ {tmpl_var name='python'} +
+
+
+

{tmpl_var name='suexec_txt'}

+
+ {tmpl_var name='suexec'} +
+
+
+

{tmpl_var name='errordocs_txt'}

+
+ {tmpl_var name='errordocs'} +
+
+ +
+ + +
+
+

{tmpl_var name='ssl_txt'}

+
+ {tmpl_var name='ssl'} +
+
+
+ + +
+
+ + +
+
+

{tmpl_var name='active_txt'}

+
+ {tmpl_var name='active'} +
+
+
+ + + +
+ + +
+
+ +
+ \ No newline at end of file diff --git a/interface/web/sites/templates/web_vhost_aliasdomain_list.htm b/interface/web/sites/templates/web_vhost_aliasdomain_list.htm new file mode 100644 index 0000000000..f07c4f3932 --- /dev/null +++ b/interface/web/sites/templates/web_vhost_aliasdomain_list.htm @@ -0,0 +1,79 @@ +

+

+ +
+ +
+ +
+
+
+
+ {tmpl_var name="datalog_changes_txt"} +
    + +
  • {tmpl_var name="text"}: {tmpl_var name="count"}
  • +
    +
+ {tmpl_var name="datalog_changes_end_txt"} +
+

+
+
+
{tmpl_var name="toolsarea_head_txt"} +
+ +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{tmpl_var name='search_limit'}
{tmpl_var name="active"}{tmpl_var name="server_id"}{tmpl_var name="parent_domain_id"}{tmpl_var name="domain"} + {tmpl_var name='delete_txt'} +
{tmpl_var name='globalsearch_noresults_text_txt'}
+
+
+ +
\ No newline at end of file diff --git a/interface/web/sites/templates/web_vhost_aliasdomain_redirect.htm b/interface/web/sites/templates/web_vhost_aliasdomain_redirect.htm new file mode 100644 index 0000000000..d1b8b307d8 --- /dev/null +++ b/interface/web/sites/templates/web_vhost_aliasdomain_redirect.htm @@ -0,0 +1,84 @@ +

+

+ +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ +  {tmpl_var name="allowed_rewrite_rule_directives_txt"}

 break
 if
 return
 rewrite
 set

 http://wiki.nginx.org/HttpRewriteModule +
+
+ + + +
+ + +
+
+ +
+ \ No newline at end of file diff --git a/interface/web/sites/templates/web_vhost_aliasdomain_ssl.htm b/interface/web/sites/templates/web_vhost_aliasdomain_ssl.htm new file mode 100644 index 0000000000..e442f3d0f3 --- /dev/null +++ b/interface/web/sites/templates/web_vhost_aliasdomain_ssl.htm @@ -0,0 +1,68 @@ +

+

+ +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+ + +
+
+ +
\ No newline at end of file diff --git a/interface/web/sites/templates/web_vhost_aliasdomain_stats.htm b/interface/web/sites/templates/web_vhost_aliasdomain_stats.htm new file mode 100644 index 0000000000..d4b06bde01 --- /dev/null +++ b/interface/web/sites/templates/web_vhost_aliasdomain_stats.htm @@ -0,0 +1,37 @@ +

+

+ +
+ +
+
+
+

{tmpl_var name='stats_user_txt'}

admin

+
+
+ +  {tmpl_var name='generate_password_txt'} +
+
+ + +
+ + +
+ + +
+
+ + + +
+ + +
+
+ +
diff --git a/interface/web/sites/web_aliasdomain_edit.php b/interface/web/sites/web_aliasdomain_edit.php index b220011dd3..e618a43494 100644 --- a/interface/web/sites/web_aliasdomain_edit.php +++ b/interface/web/sites/web_aliasdomain_edit.php @@ -57,10 +57,10 @@ class page_action extends tform_actions { // we will check only users, not admins if($_SESSION["s"]["user"]["typ"] == 'user') { - if(!$app->tform->checkClientLimit('limit_web_aliasdomain', "type = 'alias'")) { + if(!$app->tform->checkClientLimit('limit_web_aliasdomain',"(type = 'alias' OR type = 'vhostalias')")) { $app->error($app->tform->wordbook["limit_web_aliasdomain_txt"]); } - if(!$app->tform->checkResellerLimit('limit_web_aliasdomain', "type = 'alias'")) { + if(!$app->tform->checkResellerLimit('limit_web_aliasdomain',"(type = 'alias' OR type = 'vhostalias')")) { $app->error('Reseller: '.$app->tform->wordbook["limit_web_aliasdomain_txt"]); } } diff --git a/interface/web/sites/web_aliasdomain_edit.php.bak b/interface/web/sites/web_aliasdomain_edit.php.bak new file mode 100644 index 0000000000..b220011dd3 --- /dev/null +++ b/interface/web/sites/web_aliasdomain_edit.php.bak @@ -0,0 +1,191 @@ +auth->check_module_permissions('sites'); + +// Loading classes +$app->uses('tpl,tform,tform_actions,tools_sites'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + var $parent_domain_record; + + function onShowNew() { + global $app, $conf; + + // we will check only users, not admins + if($_SESSION["s"]["user"]["typ"] == 'user') { + if(!$app->tform->checkClientLimit('limit_web_aliasdomain', "type = 'alias'")) { + $app->error($app->tform->wordbook["limit_web_aliasdomain_txt"]); + } + if(!$app->tform->checkResellerLimit('limit_web_aliasdomain', "type = 'alias'")) { + $app->error('Reseller: '.$app->tform->wordbook["limit_web_aliasdomain_txt"]); + } + } + + parent::onShowNew(); + } + + function onShowEnd() { + global $app, $conf; + + /* + * Now we have to check, if we should use the domain-module to select the domain + * or not + */ + $app->uses('ini_parser,getconf'); + $settings = $app->getconf->get_global_config('domains'); + if ($settings['use_domain_module'] == 'y') { + /* + * The domain-module is in use. + */ + $domains = $app->tools_sites->getDomainModuleDomains(); + $domain_select = ''; + if(is_array($domains) && sizeof($domains) > 0) { + /* We have domains in the list, so create the drop-down-list */ + foreach( $domains as $domain) { + $domain_select .= "\r\n"; + } + } + else { + /* + * We have no domains in the domain-list. This means, we can not add ANY new domain. + * To avoid, that the variable "domain_option" is empty and so the user can + * free enter a domain, we have to create a empty option! + */ + $domain_select .= "\r\n"; + } + $app->tpl->setVar("domain_option", $domain_select); + } + + if($_SESSION["s"]["user"]["typ"] == 'admin') { + // Directive Snippets + $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'"); + $proxy_directive_snippets_txt = ''; + if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){ + foreach($proxy_directive_snippets as $proxy_directive_snippet){ + $proxy_directive_snippets_txt .= '['.$proxy_directive_snippet['name'].'] '; + } + } + if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------'; + $app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt); + } + + parent::onShowEnd(); + + } + + function onSubmit() { + global $app, $conf; + + /* check if the domain module is used - and check if the selected domain can be used! */ + $app->uses('ini_parser,getconf'); + $settings = $app->getconf->get_global_config('domains'); + if ($settings['use_domain_module'] == 'y') { + $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']); + if(!$domain_check) { + // invalid domain selected + $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."
"; + } else { + $this->dataRecord['domain'] = $domain_check; + } + } + + // nginx: if redirect type is proxy and redirect path is no URL, display error + if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'], 0, 1) == '/'){ + $app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."
"; + } + + // Get the record of the parent domain + $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ? AND ".$app->tform->getAuthSQL('r'), @$this->dataRecord["parent_domain_id"]); + if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm"); + + // Set a few fixed values + $this->dataRecord["type"] = 'alias'; + $this->dataRecord["server_id"] = $parent_domain["server_id"]; + //$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"]; + + $this->parent_domain_record = $parent_domain; + + //* make sure that the domain is lowercase + if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]); + + parent::onSubmit(); + } + + function onAfterInsert() { + global $app, $conf; + + $app->db->query('UPDATE web_domain SET sys_groupid = ? WHERE domain_id = ?', $this->parent_domain_record['sys_groupid'], $this->id); + + } + + function onAfterUpdate() { + global $app, $conf; + + //* Check if parent domain has been changed + if($this->dataRecord['parent_domain_id'] != $this->oldDataRecord['parent_domain_id']) { + + //* Update the domain owner + $app->db->query('UPDATE web_domain SET sys_groupid = ? WHERE domain_id = ?', $this->parent_domain_record['sys_groupid'], $this->id); + + //* Update the old website, so that the vhost alias gets removed + //* We force the update by inserting a transaction record without changes manually. + $old_website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ?', $this->oldDataRecord['domain_id']); + $app->db->datalogSave('web_domain', 'UPDATE', 'domain_id', $this->oldDataRecord['parent_domain_id'], $old_website, $old_website, true); + } + + } + +} + +$page = new page_action; +$page->onLoad(); + +?> diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index 2d9c774403..c793cd0eb2 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -992,7 +992,7 @@ class page_action extends tform_actions { $records = $app->db->queryAllRecords("SELECT domain_id, `domain`, `type`, `web_folder` FROM web_domain WHERE parent_domain_id = ".$this->id); foreach($records as $rec) { $update_columns = "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'"; - if($rec['type'] == 'vhostsubdomain') { + if($rec['type'] == 'vhostsubdomain' || $rec['type'] == 'vhostalias') { $php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$rec['web_folder'], $web_config["php_open_basedir"]); $php_open_basedir = str_replace("[website_domain]/web", $rec['domain'].'/'.$rec['web_folder'], $php_open_basedir); $php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir); @@ -1017,7 +1017,7 @@ class page_action extends tform_actions { //* If the domain name has been changed, we will have to change all subdomains + APS instances if(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) { - $records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE (type = 'subdomain' OR type = 'vhostsubdomain') AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'"); + $records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE (type = 'subdomain' OR type = 'vhostsubdomain' OR type = 'vhostalias') AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'"); foreach($records as $rec) { $subdomain = $app->db->quote(str_replace($this->oldDataRecord["domain"], $this->dataRecord["domain"], $rec['domain'])); $app->db->datalogUpdate('web_domain', "domain = '".$subdomain."'", 'domain_id', $rec['domain_id']); @@ -1077,9 +1077,9 @@ class page_action extends tform_actions { unset($backup_interval); } - //* Change vhost subdomain ip/ipv6 if domain ip/ipv6 has changed + //* Change vhost subdomain and alias ip/ipv6 if domain ip/ipv6 has changed if(isset($this->dataRecord['ip_address']) && ($this->dataRecord['ip_address'] != $this->oldDataRecord['ip_address'] || $this->dataRecord['ipv6_address'] != $this->oldDataRecord['ipv6_address'])) { - $records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".$this->id); + $records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE (type = 'vhostsubdomain' OR type = 'vhostalias') AND parent_domain_id = ".$this->id); foreach($records as $rec) { $app->db->datalogUpdate('web_domain', "ip_address = '".$app->db->quote($web_rec['ip_address'])."', ipv6_address = '".$app->db->quote($web_rec['ipv6_address'])."'", 'domain_id', $rec['domain_id']); } diff --git a/interface/web/sites/web_domain_edit.php.bak b/interface/web/sites/web_domain_edit.php.bak new file mode 100644 index 0000000000..2d9c774403 --- /dev/null +++ b/interface/web/sites/web_domain_edit.php.bak @@ -0,0 +1,1114 @@ +auth->check_module_permissions('sites'); + +// Loading classes +$app->uses('tpl,tform,tform_actions,tools_sites'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + //* Returna a "3/2/1" path hash from a numeric id '123' + function id_hash($id, $levels) { + $hash = "" . $id % 10 ; + $id /= 10 ; + $levels -- ; + while ( $levels > 0 ) { + $hash .= "/" . $id % 10 ; + $id /= 10 ; + $levels-- ; + } + return $hash; + } + + function onShowNew() { + global $app, $conf; + + // we will check only users, not admins + if($_SESSION["s"]["user"]["typ"] == 'user') { + if(!$app->tform->checkClientLimit('limit_web_domain', "type = 'vhost'")) { + $app->error($app->tform->wordbook["limit_web_domain_txt"]); + } + if(!$app->tform->checkResellerLimit('limit_web_domain', "type = 'vhost'")) { + $app->error('Reseller: '.$app->tform->wordbook["limit_web_domain_txt"]); + } + + // Get the limits of the client + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $client = $app->db->queryOneRecord("SELECT client.web_servers FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + $web_servers = explode(',', $client['web_servers']); + $app->tpl->setVar("server_id_value", $web_servers[0]); + unset($web_servers); + } + $app->tform->formDef['tabs']['domain']['readonly'] = false; + + parent::onShowNew(); + } + + function onShowEnd() { + global $app, $conf; + + $app->uses('ini_parser,getconf'); + + $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl'); + + //* Client: If the logged in user is not admin and has no sub clients (no reseller) + if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { + + // Get the limits of the client + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $client = $app->db->queryOneRecord("SELECT client.limit_web_domain, client.web_servers, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + + $client['web_servers_ids'] = explode(',', $client['web_servers']); + + $only_one_server = count($client['web_servers_ids']) === 1; + $app->tpl->setVar('only_one_server', $only_one_server); + + //* Get global web config + foreach ($client['web_servers_ids'] as $web_server_id) { + $web_config[$web_server_id] = $app->getconf->get_server_config($web_server_id, 'web'); + } + + $sql = "SELECT server_id, server_name FROM server WHERE server_id IN (" . $client['web_servers'] . ");"; + $web_servers = $app->db->queryAllRecords($sql); + + $options_web_servers = ""; + + foreach ($web_servers as $web_server) { + $options_web_servers .= ""; + } + + $app->tpl->setVar("server_id", $options_web_servers); + unset($options_web_servers); + + if($this->id > 0) { + if(!isset($this->dataRecord["server_id"])){ + $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id)); + $this->dataRecord["server_id"] = $tmp["server_id"]; + unset($tmp); + } + $server_id = intval(@$this->dataRecord["server_id"]); + } else { + $server_id = (isset($web_servers[0])) ? intval($web_servers[0]) : 0; + } + + //* Fill the IPv4 select field with the IP addresses that are allowed for this client + $sql = "SELECT ip_address FROM server_ip WHERE server_id IN (" . $client['web_servers'] . ") AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"; + $ips = $app->db->queryAllRecords($sql); + $ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"":""; + //$ip_select = ""; + if(is_array($ips)) { + foreach( $ips as $ip) { + $selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':''; + $ip_select .= "\r\n"; + } + } + $app->tpl->setVar("ip_address", $ip_select); + unset($tmp); + unset($ips); + + //* Fill the IPv6 select field with the IP addresses that are allowed for this client + $sql = "SELECT ip_address FROM server_ip WHERE server_id IN (" . $client['web_servers'] . ") AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"; + $ips = $app->db->queryAllRecords($sql); + $ip_select = ""; + //$ip_select = ""; + if(is_array($ips)) { + foreach( $ips as $ip) { + $selected = ($ip["ip_address"] == $this->dataRecord["ipv6_address"])?'SELECTED':''; + $ip_select .= "\r\n"; + } + } + $app->tpl->setVar("ipv6_address", $ip_select); + unset($tmp); + unset($ips); + + //PHP Version Selection (FastCGI) + $server_type = 'apache'; + if(!empty($web_config['server_type'])) $server_type = $web_config['server_type']; + if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm'; + if($this->dataRecord['php'] == 'php-fpm'){ + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".($this->id > 0 ? $app->functions->intval($this->dataRecord['server_id']) : $app->functions->intval($client['default_webserver']))." AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")"); + } + if($this->dataRecord['php'] == 'fast-cgi'){ + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".($this->id > 0 ? $app->functions->intval($this->dataRecord['server_id']) : $app->functions->intval($client['default_webserver']))." AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")"); + } + $php_select = ""; + if(is_array($php_records) && !empty($php_records)) { + foreach( $php_records as $php_record) { + if($this->dataRecord['php'] == 'php-fpm'){ + $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; + } else { + $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; + } + $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':''; + $php_select .= "\r\n"; + } + } + $app->tpl->setVar("fastcgi_php_version", $php_select); + unset($php_records); + + // add limits to template to be able to hide settings + foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]); + + + //* Reseller: If the logged in user is not admin and has sub clients (is a reseller) + } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) { + + // Get the limits of the client + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_domain, client.default_webserver, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + + //* Get global web config + foreach ($client['web_servers_ids'] as $web_server_id) { + $web_config[$web_server_id] = $app->getconf->get_server_config($web_server_id, 'web'); + } + + $sql = "SELECT server_id, server_name FROM server WHERE server_id IN (" . $client['web_servers'] . ");"; + $web_servers = $app->db->queryAllRecords($sql); + + $options_web_servers = ""; + + foreach ($web_servers as $web_server) { + $options_web_servers .= ""; + } + + $app->tpl->setVar("server_id", $options_web_servers); + unset($options_web_servers); + + // Fill the client select field + $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name"; + $records = $app->db->queryAllRecords($sql); + $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$app->functions->intval($client['client_id'])); + $client_select = ''; + //$tmp_data_record = $app->tform->getDataRecord($this->id); + if(is_array($records)) { + $selected_client_group_id = 0; // needed to get list of PHP versions + foreach( $records as $rec) { + if(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']) && !$selected_client_group_id) $selected_client_group_id = $rec["groupid"]; + $selected = @(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':''; + if($selected == 'SELECTED') $selected_client_group_id = $rec["groupid"]; + $client_select .= "\r\n"; + } + } + $app->tpl->setVar("client_group_id", $client_select); + + //* Fill the IPv4 select field with the IP addresses that are allowed for this client + $sql = "SELECT ip_address FROM server_ip WHERE server_id IN (" . $client['web_servers'] . ") AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"; + $ips = $app->db->queryAllRecords($sql); + $ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"":""; + //$ip_select = ""; + if(is_array($ips)) { + foreach( $ips as $ip) { + $selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':''; + $ip_select .= "\r\n"; + } + } + $app->tpl->setVar("ip_address", $ip_select); + unset($tmp); + unset($ips); + + //* Fill the IPv6 select field with the IP addresses that are allowed for this client + $sql = "SELECT ip_address FROM server_ip WHERE server_id IN (" . $client['web_servers'] . ") AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"; + $ips = $app->db->queryAllRecords($sql); + $ip_select = ""; + //$ip_select = ""; + if(is_array($ips)) { + foreach( $ips as $ip) { + $selected = ($ip["ip_address"] == $this->dataRecord["ipv6_address"])?'SELECTED':''; + $ip_select .= "\r\n"; + } + } + $app->tpl->setVar("ipv6_address", $ip_select); + unset($tmp); + unset($ips); + + //PHP Version Selection (FastCGI) + $server_type = 'apache'; + if(!empty($web_config['server_type'])) $server_type = $web_config['server_type']; + if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm'; + $selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ".$app->functions->intval($selected_client_group_id)); + //$sql_where = " AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id']." OR client_id = ".intval($selected_client['client_id']).")"; + $sql_where = " AND (client_id = 0 OR client_id = ".intval($selected_client['client_id']).")"; + if($this->dataRecord['php'] == 'php-fpm'){ + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".($this->id > 0 ? $app->functions->intval($this->dataRecord['server_id']) : $app->functions->intval($client['default_webserver'])).$sql_where); + } + if($this->dataRecord['php'] == 'fast-cgi') { + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".($this->id > 0 ? $app->functions->intval($this->dataRecord['server_id']) : $app->functions->intval($client['default_webserver'])).$sql_where); + } + $php_select = ""; + if(is_array($php_records) && !empty($php_records)) { + foreach( $php_records as $php_record) { + if($this->dataRecord['php'] == 'php-fpm'){ + $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; + } else { + $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; + } + $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':''; + $php_select .= "\r\n"; + } + } + $app->tpl->setVar("fastcgi_php_version", $php_select); + unset($php_records); + + // add limits to template to be able to hide settings + foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]); + + $sites_config = $app->getconf->get_global_config('sites'); + if($sites_config['reseller_can_use_options']) { + // Directive Snippets + $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'"); + $php_directive_snippets_txt = ''; + if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){ + foreach($php_directive_snippets as $php_directive_snippet){ + $php_directive_snippets_txt .= '['.$php_directive_snippet['name'].'] '; + } + } + if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------'; + $app->tpl->setVar("php_directive_snippets_txt", $php_directive_snippets_txt); + + if($server_type == 'apache'){ + $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'"); + $apache_directive_snippets_txt = ''; + if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){ + foreach($apache_directive_snippets as $apache_directive_snippet){ + $apache_directive_snippets_txt .= '['.$apache_directive_snippet['name'].'] '; + } + } + if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------'; + $app->tpl->setVar("apache_directive_snippets_txt", $apache_directive_snippets_txt); + } + + if($server_type == 'nginx'){ + $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'"); + $nginx_directive_snippets_txt = ''; + if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){ + foreach($nginx_directive_snippets as $nginx_directive_snippet){ + $nginx_directive_snippets_txt .= '['.$nginx_directive_snippet['name'].'] '; + } + } + if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------'; + $app->tpl->setVar("nginx_directive_snippets_txt", $nginx_directive_snippets_txt); + } + + $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'"); + $proxy_directive_snippets_txt = ''; + if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){ + foreach($proxy_directive_snippets as $proxy_directive_snippet){ + $proxy_directive_snippets_txt .= '['.$proxy_directive_snippet['name'].'] '; + } + } + if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------'; + $app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt); + } + + //* Admin: If the logged in user is admin + } else { + + // The user is admin, so we fill in all IP addresses of the server + if($this->id > 0) { + if(!isset($this->dataRecord["server_id"])){ + $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id)); + $this->dataRecord["server_id"] = $tmp["server_id"]; + unset($tmp); + } + $server_id = intval(@$this->dataRecord["server_id"]); + } else { + // Get the first server ID + $tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1"); + $server_id = intval($tmp['server_id']); + } + + //* get global web config + $web_config = $app->getconf->get_server_config($server_id, 'web'); + + //* Fill the IPv4 select field + $sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv4' AND server_id = ".$app->functions->intval($server_id); + $ips = $app->db->queryAllRecords($sql); + $ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"":""; + //$ip_select = ""; + if(is_array($ips)) { + foreach( $ips as $ip) { + $selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':''; + $ip_select .= "\r\n"; + } + } + $app->tpl->setVar("ip_address", $ip_select); + unset($tmp); + unset($ips); + + //* Fill the IPv6 select field + $sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND server_id = ".$app->functions->intval($server_id); + $ips = $app->db->queryAllRecords($sql); + $ip_select = ""; + //$ip_select = ""; + if(is_array($ips)) { + foreach( $ips as $ip) { + $selected = ($ip["ip_address"] == $this->dataRecord["ipv6_address"])?'SELECTED':''; + $ip_select .= "\r\n"; + } + } + $app->tpl->setVar("ipv6_address", $ip_select); + unset($tmp); + unset($ips); + + // Fill the client select field + $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name"; + $clients = $app->db->queryAllRecords($sql); + $client_select = ""; + //$tmp_data_record = $app->tform->getDataRecord($this->id); + if(is_array($clients)) { + $selected_client_group_id = 0; // needed to get list of PHP versions + foreach($clients as $client) { + if(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']) && !$selected_client_group_id) $selected_client_group_id = $client["groupid"]; + //$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':''; + $selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':''; + if($selected == 'SELECTED') $selected_client_group_id = $client["groupid"]; + $client_select .= "\r\n"; + } + } + $app->tpl->setVar("client_group_id", $client_select); + + //PHP Version Selection (FastCGI) + $server_type = 'apache'; + if(!empty($web_config['server_type'])) $server_type = $web_config['server_type']; + if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm'; + $selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ".$app->functions->intval($selected_client_group_id)); + //$sql_where = " AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id']." OR client_id = ".intval($selected_client['client_id']).")"; + $sql_where = " AND (client_id = 0 OR client_id = ".$app->functions->intval($selected_client['client_id']).")"; + if($this->dataRecord['php'] == 'php-fpm'){ + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = $server_id".$sql_where); + } + if($this->dataRecord['php'] == 'fast-cgi') { + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$app->functions->intval($server_id).$sql_where); + } + $php_select = ""; + if(is_array($php_records) && !empty($php_records)) { + foreach( $php_records as $php_record) { + if($this->dataRecord['php'] == 'php-fpm'){ + $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; + } else { + $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; + } + $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':''; + $php_select .= "\r\n"; + } + } + $app->tpl->setVar("fastcgi_php_version", $php_select); + unset($php_records); + + foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y')); + + // Directive Snippets + $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'"); + $php_directive_snippets_txt = ''; + if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){ + foreach($php_directive_snippets as $php_directive_snippet){ + $php_directive_snippets_txt .= '['.$php_directive_snippet['name'].'] '; + } + } + if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------'; + $app->tpl->setVar("php_directive_snippets_txt", $php_directive_snippets_txt); + + if($server_type == 'apache'){ + $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'"); + $apache_directive_snippets_txt = ''; + if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){ + foreach($apache_directive_snippets as $apache_directive_snippet){ + $apache_directive_snippets_txt .= '['.$apache_directive_snippet['name'].'] '; + } + } + if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------'; + $app->tpl->setVar("apache_directive_snippets_txt", $apache_directive_snippets_txt); + } + + if($server_type == 'nginx'){ + $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'"); + $nginx_directive_snippets_txt = ''; + if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){ + foreach($nginx_directive_snippets as $nginx_directive_snippet){ + $nginx_directive_snippets_txt .= '['.$nginx_directive_snippet['name'].'] '; + } + } + if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------'; + $app->tpl->setVar("nginx_directive_snippets_txt", $nginx_directive_snippets_txt); + } + + $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'"); + $proxy_directive_snippets_txt = ''; + if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){ + foreach($proxy_directive_snippets as $proxy_directive_snippet){ + $proxy_directive_snippets_txt .= '['.$proxy_directive_snippet['name'].'] '; + } + } + if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------'; + $app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt); + } + + $ssl_domain_select = ''; + $tmp = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$this->id); + $ssl_domains = array($tmp["domain"], 'www.'.$tmp["domain"], '*.'.$tmp["domain"]); + if(is_array($ssl_domains)) { + foreach( $ssl_domains as $ssl_domain) { + $selected = ($ssl_domain == $this->dataRecord['ssl_domain'])?'SELECTED':''; + $ssl_domain_select .= "\r\n"; + } + } + $app->tpl->setVar("ssl_domain", $ssl_domain_select); + unset($ssl_domain_select); + unset($ssl_domains); + unset($ssl_domain); + + if($this->id > 0) { + //* we are editing a existing record + $app->tpl->setVar("edit_disabled", 1); + $app->tpl->setVar("server_id_value", $this->dataRecord["server_id"]); + } else { + $app->tpl->setVar("edit_disabled", 0); + } + + $tmp_txt = ($this->dataRecord['traffic_quota_lock'] == 'y')?'('.$app->tform->lng('traffic_quota_exceeded_txt').')':''; + $app->tpl->setVar("traffic_quota_exceeded_txt", $tmp_txt); + + /* + * Now we have to check, if we should use the domain-module to select the domain + * or not + */ + $settings = $app->getconf->get_global_config('domains'); + if ($settings['use_domain_module'] == 'y') { + /* + * The domain-module is in use. + */ + $domains = $app->tools_sites->getDomainModuleDomains(); + $domain_select = ''; + if(is_array($domains) && sizeof($domains) > 0) { + /* We have domains in the list, so create the drop-down-list */ + foreach( $domains as $domain) { + $domain_select .= "\r\n"; + } + } + else { + /* + * We have no domains in the domain-list. This means, we can not add ANY new domain. + * To avoid, that the variable "domain_option" is empty and so the user can + * free enter a domain, we have to create a empty option! + */ + $domain_select .= "\r\n"; + } + $app->tpl->setVar("domain_option", $domain_select); + } + + // check for configuration errors in sys_datalog + if($this->id > 0) { + $datalog = $app->db->queryOneRecord("SELECT sys_datalog.error, sys_log.tstamp FROM sys_datalog, sys_log WHERE sys_datalog.dbtable = 'web_domain' AND sys_datalog.dbidx = 'domain_id:".$app->functions->intval($this->id)."' AND sys_datalog.datalog_id = sys_log.datalog_id AND sys_log.message = CONCAT('Processed datalog_id ',sys_log.datalog_id) ORDER BY sys_datalog.tstamp DESC"); + if(is_array($datalog) && !empty($datalog)){ + if(trim($datalog['error']) != ''){ + $app->tpl->setVar("config_error_msg", nl2br(htmlentities($datalog['error']))); + $app->tpl->setVar("config_error_tstamp", date($app->lng('conf_format_datetime'), $datalog['tstamp'])); + } + } + } + + parent::onShowEnd(); + } + + function onShowEdit() { + global $app; + if($app->tform->checkPerm($this->id, 'riud')) $app->tform->formDef['tabs']['domain']['readonly'] = false; + parent::onShowEdit(); + } + + function onSubmit() { + global $app, $conf; + + /* check if the domain module is used - and check if the selected domain can be used! */ + if($app->tform->getCurrentTab() == 'domain') { + $app->uses('ini_parser,getconf'); + $settings = $app->getconf->get_global_config('domains'); + if ($settings['use_domain_module'] == 'y') { + $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']); + if(!$domain_check) { + // invalid domain selected + $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."
"; + } else { + $this->dataRecord['domain'] = $domain_check; + } + } + } + + // nginx: if redirect type is proxy and redirect path is no URL, display error + //if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'],0,1) == '/'){ + // $app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."
"; + //} + + // Set a few fixed values + $this->dataRecord["parent_domain_id"] = 0; + $this->dataRecord["type"] = 'vhost'; + $this->dataRecord["vhost_type"] = 'name'; + + $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl'); + + + 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_traffic_quota, limit_web_domain, web_servers, parent_client_id, limit_web_quota, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + + $client['web_servers_ids'] = explode(',', $client['web_servers']); + + if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-'; + if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-'; + if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-'; + if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-'; + if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-'; + if($client['force_suexec'] == 'y') $this->dataRecord['suexec'] = 'y'; + if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-'; + if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-'; + if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-'; + + // only generate quota and traffic warnings if value has changed + if($this->id > 0) { + $old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id)); + } else { + $old_web_values = array(); + } + + //* Check the website quota of the client + if(isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0 && $_POST["hd_quota"] != $old_web_values["hd_quota"]) { + $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND type = 'vhost' AND ".$app->tform->getAuthSQL('u')); + $webquota = $tmp["webquota"]; + $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]); + if(($webquota + $new_web_quota > $client["limit_web_quota"]) || ($new_web_quota < 0 && $client["limit_web_quota"] >= 0)) { + $max_free_quota = floor($client["limit_web_quota"] - $webquota); + if($max_free_quota < 0) $max_free_quota = 0; + $app->tform->errorMessage .= $app->tform->lng("limit_web_quota_free_txt").": ".$max_free_quota." MB
"; + // Set the quota field to the max free space + $this->dataRecord["hd_quota"] = $max_free_quota; + } + unset($tmp); + unset($tmp_quota); + } + + //* Check the traffic quota of the client + if(isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) { + $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $trafficquota = $tmp["trafficquota"]; + $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]); + if(($trafficquota + $new_traffic_quota > $client["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $client["limit_traffic_quota"] >= 0)) { + $max_free_quota = floor($client["limit_traffic_quota"] - $trafficquota); + if($max_free_quota < 0) $max_free_quota = 0; + $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
"; + // Set the quota field to the max free space + $this->dataRecord["traffic_quota"] = $max_free_quota; + } + unset($tmp); + unset($tmp_quota); + } + + if($client['parent_client_id'] > 0) { + // Get the limits of the reseller + $reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_domain, web_servers, limit_web_quota FROM client WHERE client_id = ".$client['parent_client_id']); + + //* Check the website quota of the client + if(isset($_POST["hd_quota"]) && $reseller["limit_web_quota"] >= 0 && $_POST["hd_quota"] != $old_web_values["hd_quota"]) { + $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND type = 'vhost' AND ".$app->tform->getAuthSQL('u')); + $webquota = $tmp["webquota"]; + $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]); + if(($webquota + $new_web_quota > $reseller["limit_web_quota"]) || ($new_web_quota < 0 && $reseller["limit_web_quota"] >= 0)) { + $max_free_quota = floor($reseller["limit_web_quota"] - $webquota); + if($max_free_quota < 0) $max_free_quota = 0; + $app->tform->errorMessage .= $app->tform->lng("limit_web_quota_free_txt").": ".$max_free_quota." MB
"; + // Set the quota field to the max free space + $this->dataRecord["hd_quota"] = $max_free_quota; + } + unset($tmp); + unset($tmp_quota); + } + + //* Check the traffic quota of the client + if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) { + $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $trafficquota = $tmp["trafficquota"]; + $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]); + if(($trafficquota + $new_traffic_quota > $reseller["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $reseller["limit_traffic_quota"] >= 0)) { + $max_free_quota = floor($reseller["limit_traffic_quota"] - $trafficquota); + if($max_free_quota < 0) $max_free_quota = 0; + $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
"; + // Set the quota field to the max free space + $this->dataRecord["traffic_quota"] = $max_free_quota; + } + unset($tmp); + unset($tmp_quota); + } + } + + // 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, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id)); + $this->dataRecord["server_id"] = $tmp["server_id"]; + + // set the settings to current if not provided (or cleared due to limits) + if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi']; + if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi']; + if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl']; + if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby']; + if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python']; + if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec']; + if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs']; + if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain']; + if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl']; + + unset($tmp); + // When the record is inserted + } else { + //* display an error if chosen server is not allowed for this client + if (!is_array($client['web_servers_ids']) || !in_array($this->dataRecord['server_id'], $client['web_servers_ids'])) { + $app->error($app->tform->wordbook['server_chosen_not_ok']); + } + + // 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 and the client is not a reseller + if(!$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]); + } + + //* make sure that the email domain is lowercase + if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]); + + //* get the server config for this server + $app->uses("getconf"); + if($this->id > 0){ + $web_rec = $app->tform->getDataRecord($this->id); + $server_id = $web_rec["server_id"]; + } else { + // Get the first server ID + $tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1"); + $server_id = intval($tmp['server_id']); + } + $web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : $server_id), 'web'); + //* Check for duplicate ssl certs per IP if SNI is disabled + if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') { + $sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id; + $tmp = $app->db->queryOneRecord($sql); + if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("error_no_sni_txt"); + } + + // Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0 + if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') { + if($app->functions->intval($this->dataRecord['pm_max_children'], true) >= $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) >= $app->functions->intval($this->dataRecord['pm_start_servers'], true) && $app->functions->intval($this->dataRecord['pm_start_servers'], true) >= $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) > 0){ + + } else { + $app->tform->errorMessage .= $app->tform->lng("error_php_fpm_pm_settings_txt").'
'; + } + } + + // Check rewrite rules + $server_type = $web_config['server_type']; + + if($server_type == 'nginx' && isset($this->dataRecord['rewrite_rules']) && trim($this->dataRecord['rewrite_rules']) != '') { + $rewrite_rules = trim($this->dataRecord['rewrite_rules']); + $rewrites_are_valid = true; + // use this counter to make sure all curly brackets are properly closed + $if_level = 0; + // Make sure we only have Unix linebreaks + $rewrite_rules = str_replace("\r\n", "\n", $rewrite_rules); + $rewrite_rules = str_replace("\r", "\n", $rewrite_rules); + $rewrite_rule_lines = explode("\n", $rewrite_rules); + if(is_array($rewrite_rule_lines) && !empty($rewrite_rule_lines)){ + foreach($rewrite_rule_lines as $rewrite_rule_line){ + // ignore comments + if(substr(ltrim($rewrite_rule_line), 0, 1) == '#') continue; + // empty lines + if(trim($rewrite_rule_line) == '') continue; + // rewrite + if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $rewrite_rule_line)) continue; + // if + if(preg_match('@^\s*if\s+\(\s*\$\S+(\s+(\!?(=|~|~\*))\s+(\S+|\".+\"))?\s*\)\s*\{\s*$@', $rewrite_rule_line)){ + $if_level += 1; + continue; + } + // if - check for files, directories, etc. + if(preg_match('@^\s*if\s+\(\s*\!?-(f|d|e|x)\s+\S+\s*\)\s*\{\s*$@', $rewrite_rule_line)){ + $if_level += 1; + continue; + } + // break + if(preg_match('@^\s*break\s*;\s*$@', $rewrite_rule_line)){ + continue; + } + // return code [ text ] + if(preg_match('@^\s*return\s+\d\d\d.*;\s*$@', $rewrite_rule_line)) continue; + // return code URL + // return URL + if(preg_match('@^\s*return(\s+\d\d\d)?\s+(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*\@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*\s*;\s*$@', $rewrite_rule_line)) continue; + // set + if(preg_match('@^\s*set\s+\$\S+\s+\S+\s*;\s*$@', $rewrite_rule_line)) continue; + // closing curly bracket + if(trim($rewrite_rule_line) == '}'){ + $if_level -= 1; + continue; + } + $rewrites_are_valid = false; + break; + } + } + + if(!$rewrites_are_valid || $if_level != 0){ + $app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'
'; + } + } + + parent::onSubmit(); + } + + function onAfterInsert() { + global $app, $conf; + + // make sure that the record belongs to the clinet group and not the admin group when admin inserts it + // also make sure that the user can not delete domain created by a admin + if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); + } + if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id); + } + + // Get configuration for the web system + $app->uses("getconf"); + $web_rec = $app->tform->getDataRecord($this->id); + $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web'); + $document_root = str_replace("[website_id]", $this->id, $web_config["website_path"]); + $document_root = str_replace("[website_idhash_1]", $this->id_hash($page_form->id, 1), $document_root); + $document_root = str_replace("[website_idhash_2]", $this->id_hash($page_form->id, 1), $document_root); + $document_root = str_replace("[website_idhash_3]", $this->id_hash($page_form->id, 1), $document_root); + $document_root = str_replace("[website_idhash_4]", $this->id_hash($page_form->id, 1), $document_root); + + // get the ID of the client + if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id"); + $client_id = $app->functions->intval($client["client_id"]); + } else { + //$client_id = $app->functions->intval($this->dataRecord["client_group_id"]); + $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($this->dataRecord["client_group_id"])); + $client_id = $app->functions->intval($client["client_id"]); + } + + // Set the values for document_root, system_user and system_group + $system_user = $app->db->quote('web'.$this->id); + $system_group = $app->db->quote('client'.$client_id); + $document_root = str_replace("[client_id]", $client_id, $document_root); + $document_root = str_replace("[client_idhash_1]", $this->id_hash($client_id, 1), $document_root); + $document_root = str_replace("[client_idhash_2]", $this->id_hash($client_id, 2), $document_root); + $document_root = str_replace("[client_idhash_3]", $this->id_hash($client_id, 3), $document_root); + $document_root = str_replace("[client_idhash_4]", $this->id_hash($client_id, 4), $document_root); + $document_root = $app->db->quote($document_root); + $php_open_basedir = str_replace("[website_path]", $document_root, $web_config["php_open_basedir"]); + $php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir)); + $htaccess_allow_override = $app->db->quote($web_config["htaccess_allow_override"]); + $added_date = date($app->lng('conf_format_dateshort')); + $added_by = $app->db->quote($_SESSION['s']['user']['username']); + + $sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir', added_date = '$added_date', added_by = '$added_by' WHERE domain_id = ".$this->id; + $app->db->query($sql); + } + + function onBeforeUpdate () { + global $app, $conf; + + //* Check if the server has been changed + // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway + if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) { + if (isset($this->dataRecord["server_id"])) { + $rec = $app->db->queryOneRecord("SELECT server_id from web_domain WHERE domain_id = ".$this->id); + if($rec['server_id'] != $this->dataRecord["server_id"]) { + //* Add a error message and switch back to old server + $app->tform->errorMessage .= $app->lng('The Server can not be changed.'); + $this->dataRecord["server_id"] = $rec['server_id']; + } + unset($rec); + } + //* If the user is neither admin nor reseller + } else { + //* We do not allow users to change a domain which has been created by the admin + $rec = $app->db->queryOneRecord("SELECT sys_perm_group, domain, ip_address, ipv6_address from web_domain WHERE domain_id = ".$this->id); + if(isset($this->dataRecord["domain"]) && $rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id, 'u')) { + //* Add a error message and switch back to old server + $app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.'); + $this->dataRecord["domain"] = $rec['domain']; + } + if(isset($this->dataRecord["ip_address"]) && $rec['ip_address'] != $this->dataRecord["ip_address"] && $rec['sys_perm_group'] != 'riud') { + $this->dataRecord["ip_address"] = $rec['ip_address']; + } + if(isset($this->dataRecord["ipv6_address"]) && $rec['ipv6_address'] != $this->dataRecord["ipv6_address"] && $rec['sys_perm_group'] != 'riud') { + $this->dataRecord["ipv6_address"] = $rec['ipv6_address']; + } + unset($rec); + } + + //* Check that all fields for the SSL cert creation are filled + if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'create') { + if($this->dataRecord['ssl_state'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_state_empty').'
'; + if($this->dataRecord['ssl_locality'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_locality_empty').'
'; + if($this->dataRecord['ssl_organisation'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_empty').'
'; + if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'
'; + if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'
'; + } + + if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'save') { + if(trim($this->dataRecord['ssl_cert']) == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_cert_empty').'
'; + } + + } + + function onAfterUpdate() { + global $app, $conf; + + // make sure that the record belongs to the client group and not the admin group when a admin inserts it + // also make sure that the user can not delete domain created by a admin + if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); + } + if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id); + } + + // Get configuration for the web system + $app->uses("getconf"); + $web_rec = $app->tform->getDataRecord($this->id); + $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web'); + $document_root = str_replace("[website_id]", $this->id, $web_config["website_path"]); + $page_formid = isset($page_form->id) ? $page_form->id : ''; + $document_root = str_replace("[website_idhash_1]", $this->id_hash($page_formid, 1), $document_root); + $document_root = str_replace("[website_idhash_2]", $this->id_hash($page_formid, 1), $document_root); + $document_root = str_replace("[website_idhash_3]", $this->id_hash($page_formid, 1), $document_root); + $document_root = str_replace("[website_idhash_4]", $this->id_hash($page_formid, 1), $document_root); + + // get the ID of the client + if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id"); + $client_id = $app->functions->intval($client["client_id"]); + } elseif (isset($this->dataRecord["client_group_id"])) { + $client_group_id = $this->dataRecord["client_group_id"]; + $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval(@$this->dataRecord["client_group_id"])); + $client_id = $app->functions->intval($client["client_id"]); + } else { + $client_group_id = $web_rec['sys_groupid']; + $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($client_group_id)); + $client_id = $app->functions->intval($client["client_id"]); + } + + if(($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) && isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"]) { + // Set the values for document_root, system_user and system_group + $system_user = $app->db->quote('web'.$this->id); + $system_group = $app->db->quote('client'.$client_id); + $document_root = str_replace("[client_id]", $client_id, $document_root); + $document_root = str_replace("[client_idhash_1]", $this->id_hash($client_id, 1), $document_root); + $document_root = str_replace("[client_idhash_2]", $this->id_hash($client_id, 2), $document_root); + $document_root = str_replace("[client_idhash_3]", $this->id_hash($client_id, 3), $document_root); + $document_root = str_replace("[client_idhash_4]", $this->id_hash($client_id, 4), $document_root); + $document_root = $app->db->quote($document_root); + + $sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root' WHERE domain_id = ".$this->id; + //$sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group' WHERE domain_id = ".$this->id; + $app->db->query($sql); + + // Update the FTP user(s) too + $records = $app->db->queryAllRecords("SELECT ftp_user_id FROM ftp_user WHERE parent_domain_id = ".$this->id); + foreach($records as $rec) { + $app->db->datalogUpdate('ftp_user', "sys_userid = '".$app->functions->intval($web_rec['sys_userid'])."', sys_groupid = '".$app->functions->intval($web_rec['sys_groupid'])."', uid = '$system_user', gid = '$system_group', dir = '$document_root'", 'ftp_user_id', $app->functions->intval($rec['ftp_user_id'])); + } + unset($records); + unset($rec); + + // Update the Shell user(s) too + $records = $app->db->queryAllRecords("SELECT shell_user_id FROM shell_user WHERE parent_domain_id = ".$this->id); + foreach($records as $rec) { + $app->db->datalogUpdate('shell_user', "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."', puser = '$system_user', pgroup = '$system_group', dir = '$document_root'", 'shell_user_id', $app->functions->intval($rec['shell_user_id'])); + } + unset($records); + unset($rec); + + //* Update all subdomains and alias domains + $records = $app->db->queryAllRecords("SELECT domain_id, `domain`, `type`, `web_folder` FROM web_domain WHERE parent_domain_id = ".$this->id); + foreach($records as $rec) { + $update_columns = "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'"; + if($rec['type'] == 'vhostsubdomain') { + $php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$rec['web_folder'], $web_config["php_open_basedir"]); + $php_open_basedir = str_replace("[website_domain]/web", $rec['domain'].'/'.$rec['web_folder'], $php_open_basedir); + $php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir); + $php_open_basedir = $app->db->quote(str_replace("[website_domain]", $rec['domain'], $php_open_basedir)); + + $update_columns .= ", document_root = '".$document_root."', `php_open_basedir` = '".$php_open_basedir."'"; + } + $app->db->datalogUpdate('web_domain', $update_columns, 'domain_id', $rec['domain_id']); + } + unset($records); + unset($rec); + + //* Update all databases + $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE parent_domain_id = ".$this->id); + foreach($records as $rec) { + $app->db->datalogUpdate('web_database', "sys_userid = '".$app->functions->intval($web_rec['sys_userid'])."', sys_groupid = '".$app->functions->intval($web_rec['sys_groupid'])."'", 'database_id', $app->functions->intval($rec['database_id'])); + } + unset($records); + unset($rec); + + } + + //* If the domain name has been changed, we will have to change all subdomains + APS instances + if(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) { + $records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE (type = 'subdomain' OR type = 'vhostsubdomain') AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'"); + foreach($records as $rec) { + $subdomain = $app->db->quote(str_replace($this->oldDataRecord["domain"], $this->dataRecord["domain"], $rec['domain'])); + $app->db->datalogUpdate('web_domain', "domain = '".$subdomain."'", 'domain_id', $rec['domain_id']); + } + unset($records); + unset($rec); + unset($subdomain); + + // Update APS instances + $records = $app->db->queryAllRecords("SELECT id, instance_id FROM aps_instances_settings WHERE name = 'main_domain' AND value = '".$app->db->quote($this->oldDataRecord["domain"])."'"); + if(is_array($records) && !empty($records)){ + foreach($records as $rec){ + $app->db->datalogUpdate('aps_instances_settings', "value = '".$app->db->quote($this->dataRecord["domain"])."'", 'id', $rec['id']); + // Reinstall of package needed? + //$app->db->datalogUpdate('aps_instances', "instance_status = '1'", 'id', $rec['instance_id']); + } + } + unset($records); + unset($rec); + } + + //* Set allow_override if empty + if($web_rec['allow_override'] == '') { + $sql = "UPDATE web_domain SET allow_override = '".$app->db->quote($web_config["htaccess_allow_override"])."' WHERE domain_id = ".$this->id; + $app->db->query($sql); + } + + //* Set php_open_basedir if empty or domain or client has been changed + if(empty($web_rec['php_open_basedir']) || + (!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"])) { + $php_open_basedir = $web_rec['php_open_basedir']; + $php_open_basedir = $app->db->quote(str_replace($this->oldDataRecord['domain'], $web_rec['domain'], $php_open_basedir)); + $sql = "UPDATE web_domain SET php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id; + $app->db->query($sql); + } + if(empty($web_rec['php_open_basedir']) || + (isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"])) { + $document_root = $app->db->quote(str_replace("[client_id]", $client_id, $document_root)); + $php_open_basedir = str_replace("[website_path]", $document_root, $web_config["php_open_basedir"]); + $php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir)); + $sql = "UPDATE web_domain SET php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id; + $app->db->query($sql); + } + + //* Change database backup options when web backup options have been changed + if(isset($this->dataRecord['backup_interval']) && ($this->dataRecord['backup_interval'] != $this->oldDataRecord['backup_interval'] || $this->dataRecord['backup_copies'] != $this->oldDataRecord['backup_copies'])) { + //* Update all databases + $backup_interval = $app->functions->intval($this->dataRecord['backup_interval']); + $backup_copies = $app->functions->intval($this->dataRecord['backup_copies']); + $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE parent_domain_id = ".$this->id); + foreach($records as $rec) { + $app->db->datalogUpdate('web_database', "backup_interval = '$backup_interval', backup_copies = '$backup_copies'", 'database_id', $rec['database_id']); + } + unset($records); + unset($rec); + unset($backup_copies); + unset($backup_interval); + } + + //* Change vhost subdomain ip/ipv6 if domain ip/ipv6 has changed + if(isset($this->dataRecord['ip_address']) && ($this->dataRecord['ip_address'] != $this->oldDataRecord['ip_address'] || $this->dataRecord['ipv6_address'] != $this->oldDataRecord['ipv6_address'])) { + $records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".$this->id); + foreach($records as $rec) { + $app->db->datalogUpdate('web_domain', "ip_address = '".$app->db->quote($web_rec['ip_address'])."', ipv6_address = '".$app->db->quote($web_rec['ipv6_address'])."'", 'domain_id', $rec['domain_id']); + } + unset($records); + unset($rec); + } + } + + function onAfterDelete() { + global $app, $conf; + + // Delete the sub and alias domains + $child_domains = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ".$this->id); + foreach($child_domains as $d) { + // Saving record to datalog when db_history enabled + if($app->tform->formDef["db_history"] == 'yes') { + $app->tform->datalogSave('DELETE', $d["domain_id"], $d, array()); + } + + $app->db->query("DELETE FROM web_domain WHERE domain_id = ".$app->functions->intval($d["domain_id"])." LIMIT 0,1"); + } + unset($child_domains); + unset($d); + + } + +} + +$page = new page_action; +$page->onLoad(); + +?> diff --git a/interface/web/sites/web_sites_stats.php b/interface/web/sites/web_sites_stats.php index 9bf96cb6a7..b6e3a3da4d 100644 --- a/interface/web/sites/web_sites_stats.php +++ b/interface/web/sites/web_sites_stats.php @@ -180,7 +180,7 @@ class list_action extends listform_actions { } $list = new list_action; -$list->SQLExtWhere = "(web_domain.type = 'vhost' or web_domain.type = 'vhostsubdomain')"; +$list->SQLExtWhere = "(web_domain.type = 'vhost' or web_domain.type = 'vhostsubdomain' or web_domain.type = 'vhostalias')"; $list->SQLOrderBy = 'ORDER BY web_domain.domain'; $list->onLoad(); diff --git a/interface/web/sites/web_sites_stats.php.bak b/interface/web/sites/web_sites_stats.php.bak new file mode 100644 index 0000000000..9bf96cb6a7 --- /dev/null +++ b/interface/web/sites/web_sites_stats.php.bak @@ -0,0 +1,188 @@ +auth->check_module_permissions('sites'); + +$app->uses('functions'); + +$app->load('listform_actions'); + +class list_action extends listform_actions { + + private $sum_this_month = 0; + private $sum_this_year = 0; + private $sum_last_month = 0; + private $sum_last_year = 0; + + function prepareDataRow($rec) + { + global $app; + + $rec = $app->listform->decode($rec); + + //* Alternating datarow colors + $this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF'; + $rec['bgcolor'] = $this->DataRowColor; + + //* Set the statistics colums + //** Traffic of the current month + $tmp_year = date('Y'); + $tmp_month = date('m'); + $tmp_rec = $app->db->queryOneRecord("SELECT SUM(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year' AND MONTH(traffic_date) = '$tmp_month'"); +// $rec['this_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); +// $this->sum_this_month += ($tmp_rec['t']/1024/1024); + $rec['this_month'] = $app->functions->formatBytes($tmp_rec['t']); + $this->sum_this_month += $app->functions->formatBytes($tmp_rec['t']); + + + //** Traffic of the current year + $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year'"); +// $rec['this_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); +// $this->sum_this_year += ($tmp_rec['t']/1024/1024); + $rec['this_year'] = $app->functions->formatBytes($tmp_rec['t']); + $this->sum_this_year += $app->functions->formatBytes($tmp_rec['t']); + + //** Traffic of the last month + $tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); + $tmp_month = date('m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); + $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year' AND MONTH(traffic_date) = '$tmp_month'"); +// $rec['last_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); +// $this->sum_last_month += ($tmp_rec['t']/1024/1024); + $rec['last_month'] = $app->functions->formatBytes($tmp_rec['t']); + $this->sum_last_month += $app->functions->formatBytes($tmp_rec['t']); + + //** Traffic of the last year + $tmp_year = date('Y', mktime(0, 0, 0, date("m"), date("d"), date("Y")-1)); + $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year'"); +// $rec['last_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); +// $this->sum_last_year += ($tmp_rec['t']/1024/1024); + $rec['last_year'] = $app->functions->formatBytes($tmp_rec['t']); + $this->sum_last_year += $app->functions->formatBytes($tmp_rec['t']); + + //* The variable "id" contains always the index variable + $rec['id'] = $rec[$this->idx_key]; + + return $rec; + } + + function onShowEnd() + { + global $app; + + $app->tpl->setVar('sum_this_month', number_format($app->functions->intval($this->sum_this_month), 0, '.', ' ')); + $app->tpl->setVar('sum_this_year', number_format($app->functions->intval($this->sum_this_year), 0, '.', ' ')); + $app->tpl->setVar('sum_last_month', number_format($app->functions->intval($this->sum_last_month), 0, '.', ' ')); + $app->tpl->setVar('sum_last_year', number_format($app->functions->intval($this->sum_last_year), 0, '.', ' ')); + $app->tpl->setVar('sum_txt', $app->listform->lng('sum_txt')); + + $app->tpl_defaults(); + $app->tpl->pparse(); + } + + function getQueryString() { + global $app; + $sql_where = ''; + + //* Generate the search sql + if($app->listform->listDef['auth'] != 'no') { + if($_SESSION['s']['user']['typ'] == "admin") { + $sql_where = ''; + } else { + $sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and'; + //$sql_where = $app->tform->getAuthSQL('r').' and'; + } + } + if($this->SQLExtWhere != '') { + $sql_where .= ' '.$this->SQLExtWhere.' and'; + } + + $sql_where = $app->listform->getSearchSQL($sql_where); + if($app->listform->listDef['join_sql']) $sql_where .= ' AND '.$app->listform->listDef['join_sql']; + $app->tpl->setVar($app->listform->searchValues); + + $order_by_sql = $this->SQLOrderBy; + + //* Generate SQL for paging + $limit_sql = $app->listform->getPagingSQL($sql_where); + $app->tpl->setVar('paging', $app->listform->pagingHTML); + + $extselect = ''; + $join = ''; + + if(!empty($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){ + $order = str_replace(' DESC', '', $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']); + list($tmp_table, $order) = explode('.', $order); + if($order == 'web_traffic_last_month'){ + $tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); + $tmp_month = date('m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); + $extselect .= ', SUM(wt.traffic_bytes) as calctraffic'; + $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname '; + $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'"; + $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_last_month', 'calctraffic', $order_by_sql); + $order_by_sql = "GROUP BY domain ".$order_by_sql; + } elseif($order == 'web_traffic_this_month'){ + $tmp_year = date('Y'); + $tmp_month = date('m'); + $extselect .= ', SUM(wt.traffic_bytes) as calctraffic'; + $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname '; + $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'"; + $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_this_month', 'calctraffic', $order_by_sql); + $order_by_sql = "GROUP BY domain ".$order_by_sql; + } elseif($order == 'web_traffic_last_year'){ + $tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); + $extselect .= ', SUM(wt.traffic_bytes) as calctraffic'; + $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname '; + $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'"; + $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_last_year', 'calctraffic', $order_by_sql); + $order_by_sql = "GROUP BY domain ".$order_by_sql; + } elseif($order == 'web_traffic_this_year'){ + $tmp_year = date('Y'); + $extselect .= ', SUM(wt.traffic_bytes) as calctraffic'; + $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname '; + $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'"; + $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_this_year', 'calctraffic', $order_by_sql); + $order_by_sql = "GROUP BY domain ".$order_by_sql; + } + } + + if($this->SQLExtSelect != '') { + if(substr($this->SQLExtSelect, 0, 1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect; + $extselect .= $this->SQLExtSelect; + } + + $table_selects = array(); + $table_selects[] = trim($app->listform->listDef['table']).'.*'; + $app->listform->listDef['additional_tables'] = trim($app->listform->listDef['additional_tables']); + if($app->listform->listDef['additional_tables'] != ''){ + $additional_tables = explode(',', $app->listform->listDef['additional_tables']); + foreach($additional_tables as $additional_table){ + $table_selects[] = trim($additional_table).'.*'; + } + } + $select = implode(', ', $table_selects); + + $sql = 'SELECT '.$select.$extselect.' FROM '.$app->listform->listDef['table'].($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')."$join WHERE $sql_where $order_by_sql $limit_sql"; + return $sql; + } + +} + +$list = new list_action; +$list->SQLExtWhere = "(web_domain.type = 'vhost' or web_domain.type = 'vhostsubdomain')"; +$list->SQLOrderBy = 'ORDER BY web_domain.domain'; +$list->onLoad(); + + +?> diff --git a/interface/web/sites/web_vhost_aliasdomain_del.php b/interface/web/sites/web_vhost_aliasdomain_del.php new file mode 100644 index 0000000000..2d288dd833 --- /dev/null +++ b/interface/web/sites/web_vhost_aliasdomain_del.php @@ -0,0 +1,73 @@ +auth->check_module_permissions('sites'); + +$app->uses('tpl,tform,tform_actions'); +$app->load("tform_actions"); +class page_action extends tform_actions { + + function onBeforeDelete() { + global $app; $conf; + + //* Delete all web folders + $records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".$app->functions->intval($this->id)."'"); + foreach($records as $rec) { + //* Delete all web folder users + $records2 = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$app->functions->intval($rec['web_folder_id'])."'"); + foreach($records2 as $rec2) { + $app->db->datalogDelete('web_folder_user', 'web_folder_user_id', $rec2['web_folder_user_id']); + } + $app->db->datalogDelete('web_folder', 'web_folder_id', $rec['web_folder_id']); + } + + } + +} + +$page = new page_action; +$page->onDelete(); + +?> diff --git a/interface/web/sites/web_vhost_aliasdomain_edit.php b/interface/web/sites/web_vhost_aliasdomain_edit.php new file mode 100644 index 0000000000..2c63881c4f --- /dev/null +++ b/interface/web/sites/web_vhost_aliasdomain_edit.php @@ -0,0 +1,666 @@ +auth->check_module_permissions('sites'); + +// Loading classes +$app->uses('tpl,tform,tform_actions,tools_sites'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + //* Returna a "3/2/1" path hash from a numeric id '123' + function id_hash($id, $levels) { + $hash = "" . $id % 10 ; + $id /= 10 ; + $levels -- ; + while ( $levels > 0 ) { + $hash .= "/" . $id % 10 ; + $id /= 10 ; + $levels-- ; + } + return $hash; + } + + function onShowNew() { + global $app, $conf; + + // we will check only users, not admins + if($_SESSION["s"]["user"]["typ"] == 'user') { + if(!$app->tform->checkClientLimit('limit_web_aliasdomain', "(type = 'alias' OR type = 'vhostalias')")) { + $app->error($app->tform->wordbook["limit_web_aliasdomain_txt"]); + } + if(!$app->tform->checkResellerLimit('limit_web_aliasdomain', "(type = 'alias' OR type = 'vhostalias')")) { + $app->error('Reseller: '.$app->tform->wordbook["limit_web_aliasdomain_txt"]); + } + } + parent::onShowNew(); + } + + function onShowEnd() { + global $app, $conf; + + $app->uses('ini_parser,getconf'); + + $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl'); + + $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"])); + + //* Client: If the logged in user is not admin and has no sub clients (no reseller) + if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { + + // Get the limits of the client + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $client = $app->db->queryOneRecord("SELECT client.limit_web_aliasdomain, client.default_webserver, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + + //* Get global web config + $web_config = $app->getconf->get_server_config($parent_domain['server_id'], 'web'); + + //PHP Version Selection (FastCGI) + $server_type = 'apache'; + if(!empty($web_config['server_type'])) $server_type = $web_config['server_type']; + if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm'; + if($this->dataRecord['php'] == 'php-fpm'){ + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$app->functions->intval($parent_domain['server_id'])." AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")"); + } + if($this->dataRecord['php'] == 'fast-cgi'){ + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$app->functions->intval($parent_domain['server_id'])." AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")"); + } + $php_select = ""; + if(is_array($php_records) && !empty($php_records)) { + foreach( $php_records as $php_record) { + if($this->dataRecord['php'] == 'php-fpm'){ + $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; + } else { + $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; + } + $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':''; + $php_select .= "\r\n"; + } + } + $app->tpl->setVar("fastcgi_php_version", $php_select); + unset($php_records); + + // add limits to template to be able to hide settings + foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]); + + + //* Reseller: If the logged in user is not admin and has sub clients (is a reseller) + } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) { + + // Get the limits of the client + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_aliasdomain, client.default_webserver, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + + //* Get global web config + $web_config = $app->getconf->get_server_config($parent_domain['server_id'], 'web'); + + //PHP Version Selection (FastCGI) + $server_type = 'apache'; + if(!empty($web_config['server_type'])) $server_type = $web_config['server_type']; + if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm'; + if($this->dataRecord['php'] == 'php-fpm'){ + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$app->functions->intval($parent_domain['server_id'])." AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")"); + } + if($this->dataRecord['php'] == 'fast-cgi') { + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$app->functions->intval($parent_domain['server_id'])." AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")"); + } + $php_select = ""; + if(is_array($php_records) && !empty($php_records)) { + foreach( $php_records as $php_record) { + if($this->dataRecord['php'] == 'php-fpm'){ + $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; + } else { + $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; + } + $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':''; + $php_select .= "\r\n"; + } + } + $app->tpl->setVar("fastcgi_php_version", $php_select); + unset($php_records); + + // add limits to template to be able to hide settings + foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]); + + $sites_config = $app->getconf->get_global_config('sites'); + if($sites_config['reseller_can_use_options']) { + // Directive Snippets + $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'"); + $php_directive_snippets_txt = ''; + if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){ + foreach($php_directive_snippets as $php_directive_snippet){ + $php_directive_snippets_txt .= '['.$php_directive_snippet['name'].'] '; + } + } + if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------'; + $app->tpl->setVar("php_directive_snippets_txt", $php_directive_snippets_txt); + + if($server_type == 'apache'){ + $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'"); + $apache_directive_snippets_txt = ''; + if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){ + foreach($apache_directive_snippets as $apache_directive_snippet){ + $apache_directive_snippets_txt .= '['.$apache_directive_snippet['name'].'] '; + } + } + if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------'; + $app->tpl->setVar("apache_directive_snippets_txt", $apache_directive_snippets_txt); + } + + if($server_type == 'nginx'){ + $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'"); + $nginx_directive_snippets_txt = ''; + if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){ + foreach($nginx_directive_snippets as $nginx_directive_snippet){ + $nginx_directive_snippets_txt .= '['.$nginx_directive_snippet['name'].'] '; + } + } + if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------'; + $app->tpl->setVar("nginx_directive_snippets_txt", $nginx_directive_snippets_txt); + } + + $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'"); + $proxy_directive_snippets_txt = ''; + if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){ + foreach($proxy_directive_snippets as $proxy_directive_snippet){ + $proxy_directive_snippets_txt .= '['.$proxy_directive_snippet['name'].'] '; + } + } + if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------'; + $app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt); + } + + //* Admin: If the logged in user is admin + } else { + + //* get global web config + $web_config = $app->getconf->get_server_config($parent_domain['server_id'], 'web'); + + //PHP Version Selection (FastCGI) + $server_type = 'apache'; + if(!empty($web_config['server_type'])) $server_type = $web_config['server_type']; + if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm'; + if($this->dataRecord['php'] == 'php-fpm'){ + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = " . $app->functions->intval($parent_domain['server_id'])); + } + if($this->dataRecord['php'] == 'fast-cgi') { + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = " . $app->functions->intval($parent_domain['server_id'])); + } + $php_select = ""; + if(is_array($php_records) && !empty($php_records)) { + foreach( $php_records as $php_record) { + if($this->dataRecord['php'] == 'php-fpm'){ + $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; + } else { + $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; + } + $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':''; + $php_select .= "\r\n"; + } + } + $app->tpl->setVar("fastcgi_php_version", $php_select); + unset($php_records); + + foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y')); + + // Directive Snippets + $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'"); + $php_directive_snippets_txt = ''; + if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){ + foreach($php_directive_snippets as $php_directive_snippet){ + $php_directive_snippets_txt .= '['.$php_directive_snippet['name'].'] '; + } + } + if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------'; + $app->tpl->setVar("php_directive_snippets_txt", $php_directive_snippets_txt); + + if($server_type == 'apache'){ + $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'"); + $apache_directive_snippets_txt = ''; + if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){ + foreach($apache_directive_snippets as $apache_directive_snippet){ + $apache_directive_snippets_txt .= '['.$apache_directive_snippet['name'].'] '; + } + } + if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------'; + $app->tpl->setVar("apache_directive_snippets_txt", $apache_directive_snippets_txt); + } + + if($server_type == 'nginx'){ + $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'"); + $nginx_directive_snippets_txt = ''; + if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){ + foreach($nginx_directive_snippets as $nginx_directive_snippet){ + $nginx_directive_snippets_txt .= '['.$nginx_directive_snippet['name'].'] '; + } + } + if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------'; + $app->tpl->setVar("nginx_directive_snippets_txt", $nginx_directive_snippets_txt); + } + + $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'"); + $proxy_directive_snippets_txt = ''; + if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){ + foreach($proxy_directive_snippets as $proxy_directive_snippet){ + $proxy_directive_snippets_txt .= '['.$proxy_directive_snippet['name'].'] '; + } + } + if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------'; + $app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt); + } + + $ssl_domain_select = ''; + $tmp = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$this->id); + $ssl_domains = array($tmp["domain"], 'www.'.$tmp["domain"]); + if(is_array($ssl_domains)) { + foreach( $ssl_domains as $ssl_domain) { + $selected = ($ssl_domain == $this->dataRecord['ssl_domain'])?'SELECTED':''; + $ssl_domain_select .= "\r\n"; + } + } + + if($this->id > 0) { + $app->tpl->setVar('fixed_folder', 'y'); + $app->tpl->setVar('server_id_value', $parent_domain['server_id']); + } else { + $app->tpl->setVar('fixed_folder', 'n'); + $app->tpl->setVar('server_id_value', $parent_domain['server_id']); + } + + $app->tpl->setVar("ssl_domain", $ssl_domain_select); + unset($ssl_domain_select); + unset($ssl_domains); + unset($ssl_domain); + + $tmp_txt = ($this->dataRecord['traffic_quota_lock'] == 'y')?'('.$app->tform->lng('traffic_quota_exceeded_txt').')':''; + $app->tpl->setVar("traffic_quota_exceeded_txt", $tmp_txt); + + + $app->uses('ini_parser,getconf'); + $settings = $app->getconf->get_global_config('domains'); + if ($settings['use_domain_module'] == 'y') { + /* + * The domain-module is in use. + */ + $domains = $app->tools_sites->getDomainModuleDomains(); + $domain_select = ''; + $selected_domain = ''; + if(is_array($domains) && sizeof($domains) > 0) { + /* We have domains in the list, so create the drop-down-list */ + foreach( $domains as $domain) { + $domain_select .= "\r\n"; + } + } + else { + /* + * We have no domains in the domain-list. This means, we can not add ANY new domain. + * To avoid, that the variable "domain_option" is empty and so the user can + * free enter a domain, we have to create a empty option! + */ + $domain_select .= "\r\n"; + } + $app->tpl->setVar("domain_option", $domain_select); + $this->dataRecord['domain'] = substr($this->dataRecord["domain"], 0, strlen($this->dataRecord['domain']) - strlen($selected_domain) - 1); + } else { + + // 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"]); + + parent::onShowEnd(); + } + + function onSubmit() { + global $app, $conf; + + // Get the record of the parent domain + if(!@$this->dataRecord["parent_domain_id"] && $this->id) { + $tmp = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id)); + if($tmp) $this->dataRecord["parent_domain_id"] = $tmp['parent_domain_id']; + unset($tmp); + } + + $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r')); + if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm"); + + // Set a few fixed values + $this->dataRecord["type"] = 'vhostalias'; + $this->dataRecord["server_id"] = $parent_domain["server_id"]; + $this->dataRecord["ip_address"] = $parent_domain["ip_address"]; + $this->dataRecord["ipv6_address"] = $parent_domain["ipv6_address"]; + $this->dataRecord["client_group_id"] = $parent_domain["client_group_id"]; + $this->dataRecord["vhost_type"] = 'name'; + + $this->parent_domain_record = $parent_domain; + + $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl'); + + if($app->tform->getCurrentTab() == 'domain') { + + /* check if the domain module is used - and check if the selected domain can be used! */ + $app->uses('ini_parser,getconf'); + $settings = $app->getconf->get_global_config('domains'); + if ($settings['use_domain_module'] == 'y') { + $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['sel_domain']); + if(!$domain_check) { + // invalid domain selected + $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."
"; + } else { + $this->dataRecord['domain'] = $this->dataRecord['domain'] . '.' . $domain_check; + } + } else { + $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"]; + } + + + $this->dataRecord['web_folder'] = strtolower($this->dataRecord['web_folder']); + if(substr($this->dataRecord['web_folder'], 0, 1) === '/') $this->dataRecord['web_folder'] = substr($this->dataRecord['web_folder'], 1); + if(substr($this->dataRecord['web_folder'], -1) === '/') $this->dataRecord['web_folder'] = substr($this->dataRecord['web_folder'], 0, -1); + $forbidden_folders = array('', 'cgi-bin', 'log', 'private', 'ssl', 'tmp', 'webdav'); + $check_folder = strtolower($this->dataRecord['web_folder']); + if(substr($check_folder, 0, 1) === '/') $check_folder = substr($check_folder, 1); // strip / at beginning to check against forbidden entries + if(strpos($check_folder, '/') !== false) $check_folder = substr($check_folder, 0, strpos($check_folder, '/')); // get the first part of the path to check it + if(in_array($check_folder, $forbidden_folders)) { + $app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."
"; + } + + // vhostaliasdomains do not have a quota of their own + $this->dataRecord["hd_quota"] = 0; + + // check for duplicate folder usage + /* + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostalias' AND `parent_domain_id` = '" . $app->functions->intval($this->dataRecord['parent_domain_id']) . "' AND `web_folder` = '" . $app->db->quote($this->dataRecord['web_folder']) . "' AND `domain_id` != '" . $app->functions->intval($this->id) . "'"); + if($check && $check['cnt'] > 0) { + $app->tform->errorMessage .= $app->tform->lng("web_folder_unique_txt")."
"; + } + */ + } else { + $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"]; + } + + if($_SESSION["s"]["user"]["typ"] != 'admin') { + // Get the limits of the client + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $client = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_aliasdomain, default_webserver, parent_client_id, limit_web_quota, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + + if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-'; + if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-'; + if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-'; + if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-'; + if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-'; + if($client['force_suexec'] != 'n') $this->dataRecord['suexec'] = 'y'; + if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-'; + if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-'; + if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-'; + + // only generate quota and traffic warnings if value has changed + if($this->id > 0) { + $old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id)); + } else { + $old_web_values = $_POST; + } + + //* Check the traffic quota of the client + if(isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) { + $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $trafficquota = $tmp["trafficquota"]; + $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]); + if(($trafficquota + $new_traffic_quota > $client["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $client["limit_traffic_quota"] >= 0)) { + $max_free_quota = floor($client["limit_traffic_quota"] - $trafficquota); + if($max_free_quota < 0) $max_free_quota = 0; + $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
"; + // Set the quota field to the max free space + $this->dataRecord["traffic_quota"] = $max_free_quota; + } + unset($tmp); + unset($tmp_quota); + } + + if($client['parent_client_id'] > 0) { + // Get the limits of the reseller + $reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_aliasdomain, default_webserver, limit_web_quota FROM client WHERE client_id = ".$app->functions->intval($client['parent_client_id'])); + + //* Check the traffic quota of the client + if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) { + $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $trafficquota = $tmp["trafficquota"]; + $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]); + if(($trafficquota + $new_traffic_quota > $reseller["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $reseller["limit_traffic_quota"] >= 0)) { + $max_free_quota = floor($reseller["limit_traffic_quota"] - $trafficquota); + if($max_free_quota < 0) $max_free_quota = 0; + $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
"; + // Set the quota field to the max free space + $this->dataRecord["traffic_quota"] = $max_free_quota; + } + unset($tmp); + unset($tmp_quota); + } + } + + // 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, `web_folder`, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id)); + $this->dataRecord['web_folder'] = $tmp['web_folder']; // cannot be changed! + + // set the settings to current if not provided (or cleared due to limits) + if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi']; + if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi']; + if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl']; + if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby']; + if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python']; + if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec']; + if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs']; + if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain']; + if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl']; + + unset($tmp); + // When the record is inserted + } else { + // Check if the user may add another web_domain + 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' OR type = 'vhostalias')"); + if($tmp["number"] >= $client["limit_web_aliasdomain"]) { + $app->error($app->tform->wordbook["limit_web_aliasdomain_txt"]); + } + } + } + } + + //* make sure that the domain is lowercase + if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]); + + //* get the server config for this server + $app->uses("getconf"); + $web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0), 'web'); + //* Check for duplicate ssl certs per IP if SNI is disabled + if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') { + $sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id; + $tmp = $app->db->queryOneRecord($sql); + if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("error_no_sni_txt"); + } + + // Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0 + if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') { + if($app->functions->intval($this->dataRecord['pm_max_children'], true) >= $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) >= $app->functions->intval($this->dataRecord['pm_start_servers'], true) && $app->functions->intval($this->dataRecord['pm_start_servers'], true) >= $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) > 0){ + + } else { + $app->tform->errorMessage .= $app->tform->lng("error_php_fpm_pm_settings_txt").'
'; + } + } + + // Check rewrite rules + $server_type = $web_config['server_type']; + + if($server_type == 'nginx' && isset($this->dataRecord['rewrite_rules']) && trim($this->dataRecord['rewrite_rules']) != '') { + $rewrite_rules = trim($this->dataRecord['rewrite_rules']); + $rewrites_are_valid = true; + // use this counter to make sure all curly brackets are properly closed + $if_level = 0; + // Make sure we only have Unix linebreaks + $rewrite_rules = str_replace("\r\n", "\n", $rewrite_rules); + $rewrite_rules = str_replace("\r", "\n", $rewrite_rules); + $rewrite_rule_lines = explode("\n", $rewrite_rules); + if(is_array($rewrite_rule_lines) && !empty($rewrite_rule_lines)){ + foreach($rewrite_rule_lines as $rewrite_rule_line){ + // ignore comments + if(substr(ltrim($rewrite_rule_line), 0, 1) == '#') continue; + // empty lines + if(trim($rewrite_rule_line) == '') continue; + // rewrite + if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $rewrite_rule_line)) continue; + // if + if(preg_match('@^\s*if\s+\(\s*\$\S+(\s+(\!?(=|~|~\*))\s+(\S+|\".+\"))?\s*\)\s*\{\s*$@', $rewrite_rule_line)){ + $if_level += 1; + continue; + } + // if - check for files, directories, etc. + if(preg_match('@^\s*if\s+\(\s*\!?-(f|d|e|x)\s+\S+\s*\)\s*\{\s*$@', $rewrite_rule_line)){ + $if_level += 1; + continue; + } + // break + if(preg_match('@^\s*break\s*;\s*$@', $rewrite_rule_line)){ + continue; + } + // return code [ text ] + if(preg_match('@^\s*return\s+\d\d\d.*;\s*$@', $rewrite_rule_line)) continue; + // return code URL + // return URL + if(preg_match('@^\s*return(\s+\d\d\d)?\s+(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*\@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*\s*;\s*$@', $rewrite_rule_line)) continue; + // set + if(preg_match('@^\s*set\s+\$\S+\s+\S+\s*;\s*$@', $rewrite_rule_line)) continue; + // closing curly bracket + if(trim($rewrite_rule_line) == '}'){ + $if_level -= 1; + continue; + } + $rewrites_are_valid = false; + break; + } + } + + if(!$rewrites_are_valid || $if_level != 0){ + $app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'
'; + } + } + + parent::onSubmit(); + } + + function onAfterInsert() { + global $app, $conf; + + // Get configuration for the web system + $app->uses("getconf"); + $web_rec = $app->tform->getDataRecord($this->id); + $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web'); + //var_dump($this->parent_domain_record, $web_rec); + // Set the values for document_root, system_user and system_group + $system_user = $app->db->quote($this->parent_domain_record['system_user']); + $system_group = $app->db->quote($this->parent_domain_record['system_group']); + $document_root = $app->db->quote($this->parent_domain_record['document_root']); + $php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$web_rec['web_folder'], $web_config["php_open_basedir"]); + $php_open_basedir = str_replace("[website_domain]/web", $web_rec['domain'].'/'.$web_rec['web_folder'], $php_open_basedir); + $php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir); + $php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir)); + $htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']); + + $sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id; + $app->db->query($sql); + } + + function onBeforeUpdate () { + global $app, $conf; + + //* Check that all fields for the SSL cert creation are filled + if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'create') { + if($this->dataRecord['ssl_state'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_state_empty').'
'; + if($this->dataRecord['ssl_locality'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_locality_empty').'
'; + if($this->dataRecord['ssl_organisation'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_empty').'
'; + if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'
'; + if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'
'; + } + + if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'save') { + if(trim($this->dataRecord['ssl_cert']) == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_cert_empty').'
'; + } + + } + + function onAfterUpdate() { + global $app, $conf; + + // Get configuration for the web system + $app->uses("getconf"); + $web_rec = $app->tform->getDataRecord($this->id); + $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web'); + + // Set the values for document_root, system_user and system_group + $system_user = $app->db->quote($this->parent_domain_record['system_user']); + $system_group = $app->db->quote($this->parent_domain_record['system_group']); + $document_root = $app->db->quote($this->parent_domain_record['document_root']); + $php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$web_rec['web_folder'], $web_config["php_open_basedir"]); + $php_open_basedir = str_replace("[website_domain]/web", $web_rec['domain'].'/'.$web_rec['web_folder'], $php_open_basedir); + $php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir); + $php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir)); + $htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']); + + $sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id; + $app->db->query($sql); + } + +} + +$page = new page_action; +$page->onLoad(); + +?> diff --git a/interface/web/sites/web_vhost_aliasdomain_list.php b/interface/web/sites/web_vhost_aliasdomain_list.php new file mode 100644 index 0000000000..52033a15b1 --- /dev/null +++ b/interface/web/sites/web_vhost_aliasdomain_list.php @@ -0,0 +1,55 @@ +auth->check_module_permissions('sites'); + +$app->uses('listform_actions'); + +// Limit the results to alias domains +$app->listform_actions->SQLExtWhere = "web_domain.type = 'vhostalias'"; +$app->listform_actions->SQLOrderBy = 'ORDER BY web_domain.domain'; +$app->listform_actions->onLoad(); + + +?> diff --git a/interface/web/themes/default-304/templates/admin/system_config_sites_edit.htm b/interface/web/themes/default-304/templates/admin/system_config_sites_edit.htm index 121d607a38..c3fc9bfdd3 100644 --- a/interface/web/themes/default-304/templates/admin/system_config_sites_edit.htm +++ b/interface/web/themes/default-304/templates/admin/system_config_sites_edit.htm @@ -45,6 +45,12 @@ {tmpl_var name='vhost_subdomains'} {tmpl_var name='vhost_subdomains_note_txt'}
+
+

{tmpl_var name='vhost_aliasdomains_txt'}

+
+ {tmpl_var name='vhost_aliasdomains'} {tmpl_var name='vhost_aliasdomains_note_txt'} +
+
diff --git a/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_advanced.htm b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_advanced.htm new file mode 100644 index 0000000000..3067cd02df --- /dev/null +++ b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_advanced.htm @@ -0,0 +1,146 @@ +

+

+ +
+ +
+
+ +
+ + + +
+
+ + + +
+
+ + +
+
+
+

{tmpl_var name='php_fpm_use_socket_txt'}

+
+ {tmpl_var name='php_fpm_use_socket'} +
+
+
+ + +
+
+ {tmpl_var name='pm_ondemand_hint_txt'} +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +  s +
+
+ + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+ + +
+
+ +
+ \ No newline at end of file diff --git a/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_backup.htm b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_backup.htm new file mode 100644 index 0000000000..b93b2020fc --- /dev/null +++ b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_backup.htm @@ -0,0 +1,32 @@ +

+

+ +
+ +
+
Backup +
+ + +
+
+ + +
+
+ + {tmpl_var name='backup_records'} + + + +
+ + +
+
+ +
\ No newline at end of file diff --git a/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_edit.htm b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_edit.htm new file mode 100644 index 0000000000..9c047697a5 --- /dev/null +++ b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_edit.htm @@ -0,0 +1,208 @@ +

+

+ +
+ +
+
+ +
+ + +
+
+ + +
+
+ + readonly="readonly" /> +
+
+ +  MB +
+
+ +  MB +
+
+

{tmpl_var name='cgi_txt'}

+
+ {tmpl_var name='cgi'} +
+
+
+

{tmpl_var name='ssi_txt'}

+
+ {tmpl_var name='ssi'} +
+
+
+

{tmpl_var name='perl_txt'}

+
+ {tmpl_var name='perl'} +
+
+
+

{tmpl_var name='ruby_txt'}

+
+ {tmpl_var name='ruby'} +
+
+
+

{tmpl_var name='python_txt'}

+
+ {tmpl_var name='python'} +
+
+
+

{tmpl_var name='suexec_txt'}

+
+ {tmpl_var name='suexec'} +
+
+
+

{tmpl_var name='errordocs_txt'}

+
+ {tmpl_var name='errordocs'} +
+
+ +
+ + +
+
+

{tmpl_var name='ssl_txt'}

+
+ {tmpl_var name='ssl'} +
+
+
+ + +
+
+ + +
+
+

{tmpl_var name='active_txt'}

+
+ {tmpl_var name='active'} +
+
+
+ + + +
+ + +
+
+ +
+ \ No newline at end of file diff --git a/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_list.htm b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_list.htm new file mode 100644 index 0000000000..8bd5427069 --- /dev/null +++ b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_list.htm @@ -0,0 +1,60 @@ +

+

+ +
+ +
+
{tmpl_var name="toolsarea_head_txt"} +
+ +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{tmpl_var name='search_limit'}
{tmpl_var name="active"}{tmpl_var name="server_id"}{tmpl_var name="parent_domain_id"}{tmpl_var name="domain"} + +
+
+
+ +
\ No newline at end of file diff --git a/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_redirect.htm b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_redirect.htm new file mode 100644 index 0000000000..f0781acaa6 --- /dev/null +++ b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_redirect.htm @@ -0,0 +1,76 @@ +

+

+ +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+ + +
+
+ +
+ \ No newline at end of file diff --git a/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_ssl.htm b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_ssl.htm new file mode 100644 index 0000000000..35bd37113d --- /dev/null +++ b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_ssl.htm @@ -0,0 +1,68 @@ +

+

+ +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+ + +
+
+ +
\ No newline at end of file diff --git a/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_stats.htm b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_stats.htm new file mode 100644 index 0000000000..2f50a62a66 --- /dev/null +++ b/interface/web/themes/default-304/templates/sites/web_vhost_aliasdomain_stats.htm @@ -0,0 +1,37 @@ +

+

+ +
+ +
+
+
+

{tmpl_var name='stats_user_txt'}

admin

+
+
+ +  {tmpl_var name='generate_password_txt'} +
+
+ + +
+ + +
+ + +
+
+ + + +
+ + +
+
+ +
diff --git a/server/lib/classes/aps_installer.inc.php b/server/lib/classes/aps_installer.inc.php index 2925c7a541..5fac926c91 100644 --- a/server/lib/classes/aps_installer.inc.php +++ b/server/lib/classes/aps_installer.inc.php @@ -277,7 +277,8 @@ class ApsInstaller extends ApsBase if(substr($this->document_root, -1) != '/') $this->document_root .= '/'; // Attention: ISPConfig Special: web files are in subfolder 'web' -> append it: - if($domain_res['type'] == 'vhostsubdomain') $this->document_root .= $domain_res['web_folder'] . '/'; + if(($domain_res['type'] == 'vhostsubdomain') || ($domain_res['type'] == 'vhostalias')) + $this->document_root .= $domain_res['web_folder'] . '/'; else $this->document_root .= 'web/'; // If a subfolder is given, make sure it's path doesn't begin with / i.e. /phpbb diff --git a/server/lib/classes/aps_installer.inc.php.bak b/server/lib/classes/aps_installer.inc.php.bak new file mode 100644 index 0000000000..2925c7a541 --- /dev/null +++ b/server/lib/classes/aps_installer.inc.php.bak @@ -0,0 +1,749 @@ +log('Aborting execution because '.$e->getMessage(), 1); + return false; + } + } + + + + /** + * Get a file from a ZIP archive and either return it's content or + * extract it to a given destination + * + * @param $zipfile the ZIP file to work with + * @param $subfile the file from which to get the content + * @param $destfolder the optional extraction destination + * @param $destname the optional target file name when extracting + * @return string or boolean + */ + private function getContentFromZIP($zipfile, $subfile, $destfolder = '', $destname = '') + { + try + { + $zip = new ZipArchive; + $res = $zip->open(realpath($zipfile)); + if(!$res) throw new Exception('Cannot open ZIP file '.$zipfile); + + // If no destination is given, the content is returned, otherwise + // the $subfile is extracted to $destination + if($destfolder == '') + { + $fh = $zip->getStream($subfile); + if(!$fh) throw new Exception('Cannot read '.$subfile.' from '.$zipfile); + + $subfile_content = ''; + while(!feof($fh)) $subfile_content .= fread($fh, 8192); + + fclose($fh); + + return $subfile_content; + } + else + { + // extractTo would be suitable but has no target name parameter + //$ind = $zip->locateName($subfile); + //$ex = $zip->extractTo($destination, array($zip->getNameIndex($ind))); + if($destname == '') $destname = basename($subfile); + $ex = @copy('zip://'.$zipfile.'#'.$subfile, $destfolder.$destname); + if(!$ex) throw new Exception('Cannot extract '.$subfile.' to '.$destfolder); + } + + $zip->close(); + + } + + catch(Exception $e) + { + // The exception message is only interesting for debugging reasons + // echo $e->getMessage(); + return false; + } + } + + + + /** + * Extract the complete directory of a ZIP file + * + * @param $filename the file to unzip + * @param $directory the ZIP inside directory to unzip + * @param $destination the place where to extract the data + * @return boolean + */ + private function extractZip($filename, $directory, $destination) + { + if(!file_exists($filename)) return false; + + // Fix the paths + if(substr($directory, -1) == '/') $directory = substr($directory, 0, strlen($directory) - 1); + if(substr($destination, -1) != '/') $destination .= '/'; + + // Read and extract the ZIP file + $ziphandle = zip_open(realpath($filename)); + if(is_resource($ziphandle)) + { + while($entry = zip_read($ziphandle)) + { + if(substr(zip_entry_name($entry), 0, strlen($directory)) == $directory) + { + // Modify the relative ZIP file path + $new_path = substr(zip_entry_name($entry), strlen($directory)); + + if(substr($new_path, -1) == '/') // Identifier for directories + { + if(!file_exists($destination.$new_path)) mkdir($destination.$new_path, 0777, true); + } + else // Handle files + { + if(zip_entry_open($ziphandle, $entry)) + { + $new_dir = dirname($destination.$new_path); + if(!file_exists($new_dir)) mkdir($new_dir, 0777, true); + + $file = fopen($destination.$new_path, 'wb'); + if($file) + { + while($line = zip_entry_read($entry)) fwrite($file, $line); + fclose($file); + } + else return false; + } + } + } + } + + zip_close($ziphandle); + return true; + } + + return false; + } + + /** + * Setup the path environment variables for the install script + * + * @param $parent_mapping the SimpleXML instance with the current mapping position + * @param $url the relative path within the mapping tree + * @param $path the absolute path within the mapping tree + */ + private function processMappings($parent_mapping, $url, $path) + { + if($parent_mapping && $parent_mapping != null) + { + $writable = parent::getXPathValue($parent_mapping, 'php:permissions/@writable'); + $readable = parent::getXPathValue($parent_mapping, 'php:permissions/@readable'); + + // set the write permission + if($writable == 'true') + { + if(is_dir($path)) chmod($path, 0775); + else chmod($path, 0664); + } + + // set non-readable permission + if($readable == 'false') + { + if(is_dir($path)) chmod($path, 0333); + else chmod($path, 0222); + } + } + + // Set the environment variables + $env = str_replace('/', '_', $url); + $this->putenv[] = 'WEB_'.$env.'_DIR='.$path; + + // Step recursively into further mappings + if($parent_mapping && $parent_mapping != null) + { + foreach($parent_mapping->mapping as $mapping) + { + if($url == '/') $this->processMappings($mapping, $url.$mapping['url'], $path.$mapping['url']); + else $this->processMappings($mapping, $url.'/'.$mapping['url'], $path.'/'.$mapping['url']); + } + } + } + + + + /** + * Setup the environment with data for the install location + * + * @param $task an array containing all install related data + */ + private function prepareLocation($task) + { + global $app; + + // Get the domain name to use for the installation + // Would be possible in one query too, but we use 2 for easier debugging + $main_domain = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings + WHERE name = 'main_domain' AND instance_id = '".$app->db->quote($task['instance_id'])."';"); + $this->domain = $main_domain['value']; + + // Get the document root + $domain_res = $app->db->queryOneRecord("SELECT document_root, web_folder, type FROM web_domain + WHERE domain = '".$app->db->quote($this->domain)."';"); + $this->document_root = $domain_res['document_root']; + + // Get the sub location + $location_res = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings + WHERE name = 'main_location' AND instance_id = '".$app->db->quote($task['instance_id'])."';"); + $this->sublocation = $location_res['value']; + + // Make sure the document_root ends with / + if(substr($this->document_root, -1) != '/') $this->document_root .= '/'; + + // Attention: ISPConfig Special: web files are in subfolder 'web' -> append it: + if($domain_res['type'] == 'vhostsubdomain') $this->document_root .= $domain_res['web_folder'] . '/'; + else $this->document_root .= 'web/'; + + // If a subfolder is given, make sure it's path doesn't begin with / i.e. /phpbb + if(substr($this->sublocation, 0, 1) == '/') $this->sublocation = substr($this->sublocation, 1); + + // If the package isn't installed to a subfolder, remove the / at the end of the document root + if(empty($this->sublocation)) $this->document_root = substr($this->document_root, 0, strlen($this->document_root) - 1); + + // Set environment variables, later processed by the package install script + $this->putenv[] = 'BASE_URL_SCHEME=http'; + // putenv('BASE_URL_PORT') -> omitted as it's 80 by default + $this->putenv[] = 'BASE_URL_HOST='.$this->domain; + $this->putenv[] = 'BASE_URL_PATH='.$this->sublocation.'/'; + } + + + + /** + * Setup a database (if needed) and the appropriate environment variables + * + * @param $task an array containing all install related data + * @param $sxe a SimpleXMLElement handle, holding APP-META.xml + */ + private function prepareDatabase($task, $sxe) + { + global $app; + + $db_id = parent::getXPathValue($sxe, '//db:id'); + if(empty($db_id)) return; // No database needed + + /* WARNING: if this will ever be uncommented please check the updated prefix handling for user and db names!!! + * + // Set the database owner to the domain owner + // ISPConfig identifies the owner by the sys_groupid (not sys_userid!) + // so sys_userid can be set to any value + $perm = $app->db->queryOneRecord("SELECT sys_groupid, server_id FROM web_domain + WHERE domain = '".$this->domain."';"); + $task['sys_groupid'] = $perm['sys_groupid']; + $serverid = $perm['server_id']; + + // Get the database prefix and db user prefix + $app->uses('getconf'); + $global_config = $app->getconf->get_global_config('sites'); + $dbname_prefix = str_replace('[CLIENTID]', '', $global_config['dbname_prefix']); + $dbuser_prefix = str_replace('[CLIENTID]', '', $global_config['dbuser_prefix']); + $this->dbhost = DB_HOST; // Taken from config.inc.php + if(empty($this->dbhost)) $this->dbhost = 'localhost'; // Just to ensure any hostname... ;) + + $this->newdb_name = $dbname_prefix.$task['CustomerID'].'aps'.$task['InstanceID']; + $this->newdb_user = $dbuser_prefix.$task['CustomerID'].'aps'.$task['InstanceID']; + $dbpw_res = $app->db->queryOneRecord("SELECT Value FROM aps_instances_settings + WHERE Name = 'main_database_password' AND InstanceID = '".$app->db->quote($task['InstanceID'])."';"); + $newdb_pw = $dbpw_res['Value']; + + // In any case delete an existing database (install and removal procedure) + $app->db->query('DROP DATABASE IF EXISTS `'.$app->db->quote($this->newdb_name).'`;'); + // Delete an already existing database with this name + $app->db->query("DELETE FROM web_database WHERE database_name = '".$app->db->quote($this->newdb_name)."';"); + + + // Create the new database and assign it to a user + if($this->handle_type == 'install') + { + $app->db->query('CREATE DATABASE IF NOT EXISTS `'.$app->db->quote($this->newdb_name).'`;'); + $app->db->query('GRANT ALL PRIVILEGES ON '.$app->db->quote($this->newdb_name).'.* TO '.$app->db->quote($this->newdb_user).'@'.$app->db->quote($this->dbhost).' IDENTIFIED BY \'password\';'); + $app->db->query('SET PASSWORD FOR '.$app->db->quote($this->newdb_user).'@'.$app->db->quote($this->dbhost).' = PASSWORD(\''.$newdb_pw.'\');'); + $app->db->query('FLUSH PRIVILEGES;'); + + // Add the new database to the customer databases + // Assumes: charset = utf8 + $app->db->query('INSERT INTO web_database (sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, + type, database_name, database_user, database_password, database_charset, remote_access, remote_ips, active) + VALUES ('.$task['sys_userid'].', '.$task['sys_groupid'].', "'.$task['sys_perm_user'].'", "'.$task['sys_perm_group'].'", + "'.$task['sys_perm_other'].'", '.$app->db->quote($serverid).', "mysql", "'.$app->db->quote($this->newdb_name).'", + "'.$app->db->quote($this->newdb_user).'", "'.$app->db->quote($newdb_pw).'", "utf8", "n", "", "y");'); + } + */ + + $mysqlver_res = $app->db->queryOneRecord('SELECT VERSION() as ver;'); + $mysqlver = $mysqlver_res['ver']; + + $tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_password' AND instance_id = '".$app->db->quote($task['instance_id'])."';"); + $newdb_pw = $tmp['value']; + + $tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_host' AND instance_id = '".$app->db->quote($task['instance_id'])."';"); + $newdb_host = $tmp['value']; + + $tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_name' AND instance_id = '".$app->db->quote($task['instance_id'])."';"); + $newdb_name = $tmp['value']; + + $tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_login' AND instance_id = '".$app->db->quote($task['instance_id'])."';"); + $newdb_login = $tmp['value']; + + $this->putenv[] = 'DB_'.$db_id.'_TYPE=mysql'; + $this->putenv[] = 'DB_'.$db_id.'_NAME='.$newdb_name; + $this->putenv[] = 'DB_'.$db_id.'_LOGIN='.$newdb_login; + $this->putenv[] = 'DB_'.$db_id.'_PASSWORD='.$newdb_pw; + $this->putenv[] = 'DB_'.$db_id.'_HOST='.$newdb_host; + $this->putenv[] = 'DB_'.$db_id.'_PORT=3306'; + $this->putenv[] = 'DB_'.$db_id.'_VERSION='.$mysqlver; + } + + + + /** + * Extract all needed files from the package + * + * @param $task an array containing all install related data + * @param $sxe a SimpleXMLElement handle, holding APP-META.xml + * @return boolean + */ + private function prepareFiles($task, $sxe) + { + global $app; + + // Basically set the mapping for APS version 1.0, if not available -> newer way + $mapping = $sxe->mapping; + $mapping_path = $sxe->mapping['path']; + $mapping_url = $sxe->mapping['url']; + if(empty($mapping)) + { + $mapping = $sxe->service->provision->{'url-mapping'}->mapping; + $mapping_path = $sxe->service->provision->{'url-mapping'}->mapping['path']; + $mapping_url = $sxe->service->provision->{'url-mapping'}->mapping['url']; + } + + try + { + // Make sure we have a valid mapping path (at least /) + if(empty($mapping_path)) throw new Exception('Unable to determine a mapping path'); + + $this->local_installpath = $this->document_root.$this->sublocation.'/'; + + // Now delete an existing folder (affects install and removal in the same way) + @chdir($this->local_installpath); + if(file_exists($this->local_installpath)){ + // make sure we don't delete error and stats folders + if($this->local_installpath == $this->document_root.'/'){ + if(is_dir($this->document_root)){ + $files = array_diff(scandir($this->document_root), array('.', '..', 'error', 'stats')); + foreach($files as $file){ + if(is_dir($this->document_root.'/'.$file)){ + $app->file->removeDirectory($this->document_root.'/'.$file); + } else { + @unlink($this->document_root.'/'.$file); + } + } + } else { + @unlink($this->document_root); + mkdir($this->document_root, 0777, true); + } + } else { + exec("rm -Rf ".escapeshellarg($this->local_installpath).'*'); + } + } else { + mkdir($this->local_installpath, 0777, true); + } + + if($this->handle_type == 'install') + { + // Now check if the needed folder is there + if(!file_exists($this->local_installpath)) + throw new Exception('Unable to create a new folder for the package '.$task['path']); + + // Extract all files and assign them a new owner + if( ($this->extractZip($this->packages_dir.'/'.$task['path'], $mapping_path, $this->local_installpath) === false) + || ($this->extractZip($this->packages_dir.'/'.$task['path'], 'scripts', $this->local_installpath.'install_scripts/') === false) ) + { + // Clean already extracted data + exec("rm -Rf ".escapeshellarg($this->local_installpath).'*'); + throw new Exception('Unable to extract the package '.$task['path']); + } + + $this->processMappings($mapping, $mapping_url, $this->local_installpath); + + // Set the appropriate file owner + $main_domain = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings + WHERE name = 'main_domain' AND instance_id = '".$app->db->quote($task['instance_id'])."';"); + $owner_res = $app->db->queryOneRecord("SELECT system_user, system_group FROM web_domain + WHERE domain = '".$app->db->quote($main_domain['value'])."';"); + $this->file_owner_user = $owner_res['system_user']; + $this->file_owner_group = $owner_res['system_group']; + exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath)); + + //* Chown stats directory back + if(is_dir($this->local_installpath.'stats')) { + exec('chown -R root:root '.escapeshellarg($this->local_installpath.'stats')); + } + } + } + catch(Exception $e) + { + $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'" + WHERE id = "'.$app->db->quote($task['instance_id']).'";'); + $app->log($e->getMessage(), 1); + return false; + } + + return true; + } + + + + /** + * Get all user config variables and set them to environment variables + * + * @param $task an array containing all install related data + */ + private function prepareUserInputData($task) + { + global $app; + + $userdata = $app->db->queryAllRecords("SELECT name, value FROM aps_instances_settings + WHERE instance_id = '".$app->db->quote($task['instance_id'])."';"); + if(empty($userdata)) return false; + + foreach($userdata as $data) + { + // Skip unnecessary data + if($data['name'] == 'main_location' + || $data['name'] == 'main_domain' + || $data['name'] == 'main_database_password' + || $data['name'] == 'main_database_name' + || $data['name'] == 'main_database_host' + || $data['name'] == 'main_database_login' + || $data['name'] == 'license') continue; + + $this->putenv[] = 'SETTINGS_'.$data['name'].'='.$data['value']; + } + } + + + + /** + * Fetch binary data from a given array + * The data is retrieved in binary mode and + * then directly written to an output file + * + * @param $input a specially structed array + * @see $this->startUpdate() + */ + private function fetchFiles($input) + { + $fh = array(); + $url = array(); + $conn = array(); + + // Build the single cURL handles and add them to a multi handle + $mh = curl_multi_init(); + + // Process each app + for($i = 0; $i < count($input); $i++) + { + $conn[$i] = curl_init($input[$i]['url']); + $fh[$i] = fopen($input[$i]['localtarget'], 'wb'); + + curl_setopt($conn[$i], CURLOPT_BINARYTRANSFER, true); + curl_setopt($conn[$i], CURLOPT_FILE, $fh[$i]); + curl_setopt($conn[$i], CURLOPT_TIMEOUT, 0); + curl_setopt($conn[$i], CURLOPT_FAILONERROR, 1); + curl_setopt($conn[$i], CURLOPT_FOLLOWLOCATION, 1); + + curl_multi_add_handle($mh, $conn[$i]); + } + + $active = 0; + do curl_multi_exec($mh, $active); + while($active > 0); + + // Close the handles + for($i = 0; $i < count($input); $i++) + { + fclose($fh[$i]); + curl_multi_remove_handle($mh, $conn[$i]); + curl_close($conn[$i]); + } + curl_multi_close($mh); + } + + + + /** + * The installation script should be executed + * + * @param $task an array containing all install related data + * @param $sxe a SimpleXMLElement handle, holding APP-META.xml + * @return boolean + */ + private function doInstallation($task, $sxe) + { + global $app; + + try + { + // Check if the install directory exists + if(!is_dir($this->local_installpath.'install_scripts/')) + throw new Exception('The install directory '.$this->local_installpath.' is not existing'); + + // Set the executable bit to the configure script + $cfgscript = @(string)$sxe->service->provision->{'configuration-script'}['name']; + if(!$cfgscript) $cfgscript = 'configure'; + chmod($this->local_installpath.'install_scripts/'.$cfgscript, 0755); + + // Change to the install folder (import for the exec() below!) + //exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath)); + chdir($this->local_installpath.'install_scripts/'); + + // Set the enviroment variables + foreach($this->putenv as $var) { + putenv($var); + } + + $shell_retcode = true; + $shell_ret = array(); + exec('php '.escapeshellarg($this->local_installpath.'install_scripts/'.$cfgscript).' install 2>&1', $shell_ret, $shell_retcode); + $shell_ret = array_filter($shell_ret); + $shell_ret_str = implode("\n", $shell_ret); + + // Although $shell_retcode might be 0, there can be PHP errors. Filter them: + if(substr_count($shell_ret_str, 'Warning: ') > 0) $shell_retcode = 1; + + // If an error has occurred, the return code is != 0 + if($shell_retcode != 0) throw new Exception($shell_ret_str); + else + { + // The install succeeded, chown newly created files too + exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath)); + + //* Chown stats directory back + if(is_dir($this->local_installpath.'stats')) { + exec('chown -R root:root '.escapeshellarg($this->local_installpath.'stats')); + } + + $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_SUCCESS.'" + WHERE id = "'.$app->db->quote($task['instance_id']).'";'); + } + } + + catch(Exception $e) + { + $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'" + WHERE id = "'.$app->db->quote($task['instance_id']).'";'); + $app->log($e->getMessage(), 1); + return false; + } + + return true; + } + + + + /** + * Cleanup: Remove install scripts, remove tasks and update the database + * + * @param $task an array containing all install related data + * @param $sxe a SimpleXMLElement handle, holding APP-META.xml + */ + private function cleanup($task, $sxe) + { + chdir($this->local_installpath); + exec("rm -Rf ".escapeshellarg($this->local_installpath).'install_scripts'); + } + + + + /** + * The main method which performs the actual package installation + * + * @param $instanceid the instanceID to install + * @param $type the type of task to perform (installation, removal) + */ + public function installHandler($instanceid, $type) + { + global $app; + + // Set the given handle type, currently supported: install, delete + if($type == 'install' || $type == 'delete') $this->handle_type = $type; + else return false; + + // Get all instance metadata + /* + $task = $app->db->queryOneRecord("SELECT * FROM aps_instances AS i + INNER JOIN aps_packages AS p ON i.package_id = p.id + INNER JOIN client AS c ON i.customer_id = c.client_id + WHERE i.id = ".$instanceid.";"); + */ + $task = $app->db->queryOneRecord("SELECT * FROM aps_instances AS i + INNER JOIN aps_packages AS p ON i.package_id = p.id + WHERE i.id = ".$instanceid.";"); + if(!$task) return false; // formerly: throw new Exception('The InstanceID doesn\'t exist.'); + if(!isset($task['instance_id'])) $task['instance_id'] = $instanceid; + + // Download aps package + if(!file_exists($this->packages_dir.'/'.$task['path']) || filesize($this->packages_dir.'/'.$task['path']) == 0) { + $ch = curl_init(); + $fh = fopen($this->packages_dir.'/'.$task['path'], 'wb'); + curl_setopt($ch, CURLOPT_FILE, $fh); + //curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_URL, $task['package_url']); + curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, 0); + curl_setopt($ch, CURLOPT_FAILONERROR, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + if(curl_exec($ch) === false) $app->log(curl_error($ch), 1); + fclose($fh); + curl_close($ch); + } + + /* + $app_to_dl[] = array('name' => $task['path'], + 'url' => $task['package_url'], + 'filesize' => 0, + 'localtarget' => $this->packages_dir.'/'.$task['path']); + + $this->fetchFiles($app_to_dl); + */ + + // Make sure the requirements are given so that this script can execute + $req_ret = $this->checkRequirements(); + if(!$req_ret) return false; + + $metafile = $this->getContentFromZIP($this->packages_dir.'/'.$task['path'], 'APP-META.xml'); + // Check if the meta file is existing + if(!$metafile) + { + $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'" + WHERE id = "'.$app->db->quote($task['instance_id']).'";'); + $app->log('Unable to find the meta data file of package '.$task['path'], 1); + return false; + } + + // Rename namespaces and register them + $metadata = str_replace("xmlns=", "ns=", $metafile); + $sxe = new SimpleXMLElement($metadata); + $namespaces = $sxe->getDocNamespaces(true); + foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url); + + // Setup the environment with data for the install location + $this->prepareLocation($task); + + // Create the database if necessary + $this->prepareDatabase($task, $sxe); + + // Unpack the install scripts from the packages + if($this->prepareFiles($task, $sxe) && $this->handle_type == 'install') + { + // Setup the variables from the install script + $this->prepareUserInputData($task); + + // Do the actual installation + $this->doInstallation($task, $sxe); + + // Remove temporary files + $this->cleanup($task, $sxe); + } + + // Finally delete the instance entry + settings + if($this->handle_type == 'delete') + { + $app->db->query('DELETE FROM aps_instances WHERE id = "'.$app->db->quote($task['instance_id']).'";'); + $app->db->query('DELETE FROM aps_instances_settings WHERE instance_id = "'.$app->db->quote($task['instance_id']).'";'); + } + + unset($sxe); + } + +} + +?> diff --git a/server/lib/classes/cron.d/150-awstats.inc.php b/server/lib/classes/cron.d/150-awstats.inc.php index 5b54a181cf..9803a89f13 100644 --- a/server/lib/classes/cron.d/150-awstats.inc.php +++ b/server/lib/classes/cron.d/150-awstats.inc.php @@ -54,7 +54,7 @@ class cronjob_awstats extends cronjob { // Create awstats statistics //###################################################################################################### - $sql = "SELECT domain_id, domain, document_root, web_folder, type, system_user, system_group, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') and stats_type = 'awstats' AND server_id = ".$conf['server_id']; + $sql = "SELECT domain_id, domain, document_root, web_folder, type, system_user, system_group, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain' or type = 'vhostalias') and stats_type = 'awstats' AND server_id = ".$conf['server_id']; $records = $app->db->queryAllRecords($sql); $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); @@ -64,7 +64,7 @@ class cronjob_awstats extends cronjob { $yesterday = date('Ymd', strtotime("-1 day", time())); $log_folder = 'log'; - if($rec['type'] == 'vhostsubdomain') { + if($rec['type'] == 'vhostsubdomain' || $rec['type'] == 'vhostalias') { $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id'])); $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']); if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id']; @@ -78,7 +78,7 @@ class cronjob_awstats extends cronjob { continue; } } - $web_folder = ($rec['type'] == 'vhostsubdomain' ? $rec['web_folder'] : 'web'); + $web_folder = (($rec['type'] == 'vhostsubdomain' || $rec['type'] == 'vhostalias') ? $rec['web_folder'] : 'web'); $domain = escapeshellcmd($rec['domain']); $statsdir = escapeshellcmd($rec['document_root'].'/'.$web_folder.'/stats'); $awstats_pl = $web_config['awstats_pl']; diff --git a/server/lib/classes/cron.d/150-webalizer.inc.php b/server/lib/classes/cron.d/150-webalizer.inc.php index fb1d76d423..1f9a921f0d 100644 --- a/server/lib/classes/cron.d/150-webalizer.inc.php +++ b/server/lib/classes/cron.d/150-webalizer.inc.php @@ -79,7 +79,7 @@ class cronjob_webalizer extends cronjob { } - $sql = "SELECT domain_id, domain, document_root, web_folder, type, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') and stats_type = 'webalizer' AND server_id = ".$conf['server_id']; + $sql = "SELECT domain_id, domain, document_root, web_folder, type, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain' or type = 'vhostalias') and stats_type = 'webalizer' AND server_id = ".$conf['server_id']; $records = $app->db->queryAllRecords($sql); foreach($records as $rec) { @@ -87,7 +87,7 @@ class cronjob_webalizer extends cronjob { $yesterday = date('Ymd', strtotime("-1 day", time())); $log_folder = 'log'; - if($rec['type'] == 'vhostsubdomain') { + if($rec['type'] == 'vhostsubdomain' || $rec['type'] == 'vhostalias') { $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id'])); $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']); if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id']; @@ -103,7 +103,7 @@ class cronjob_webalizer extends cronjob { } $domain = escapeshellcmd($rec['domain']); - $statsdir = escapeshellcmd($rec['document_root'].'/'.($rec['type'] == 'vhostsubdomain' ? $rec['web_folder'] : 'web').'/stats'); + $statsdir = escapeshellcmd($rec['document_root'].'/'.(($rec['type'] == 'vhostsubdomain' || $rec['type'] == 'vhostalias') ? $rec['web_folder'] : 'web').'/stats'); $webalizer = '/usr/bin/webalizer'; $webalizer_conf_main = '/etc/webalizer/webalizer.conf'; $webalizer_conf = escapeshellcmd($rec['document_root'].'/log/webalizer.conf'); diff --git a/server/lib/classes/cron.d/200-logfiles.inc.php b/server/lib/classes/cron.d/200-logfiles.inc.php index addbf21638..ebf159c877 100644 --- a/server/lib/classes/cron.d/200-logfiles.inc.php +++ b/server/lib/classes/cron.d/200-logfiles.inc.php @@ -60,7 +60,7 @@ class cronjob_logfiles extends cronjob { // Manage and compress web logfiles and create traffic statistics //###################################################################################################### - $sql = "SELECT domain_id, domain, type, document_root, web_folder, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') AND server_id = ".$conf['server_id']; + $sql = "SELECT domain_id, domain, type, document_root, web_folder, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain' or type = 'vhostalias') AND server_id = ".$conf['server_id']; $records = $app->db->queryAllRecords($sql); foreach($records as $rec) { @@ -68,7 +68,7 @@ class cronjob_logfiles extends cronjob { $yesterday = date('Ymd', time() - 86400); $log_folder = 'log'; - if($rec['type'] == 'vhostsubdomain') { + if($rec['type'] == 'vhostsubdomain' || $rec['type'] == 'vhostalias') { $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id'])); $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']); if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id']; diff --git a/server/lib/classes/cron.d/300-quota_notify.inc.php b/server/lib/classes/cron.d/300-quota_notify.inc.php index 57f388f70c..1d24e7c765 100644 --- a/server/lib/classes/cron.d/300-quota_notify.inc.php +++ b/server/lib/classes/cron.d/300-quota_notify.inc.php @@ -119,7 +119,7 @@ class cronjob_quota_notify extends cronjob { $current_month = date('Y-m'); //* Check website traffic quota - $sql = "SELECT sys_groupid,domain_id,domain,traffic_quota,traffic_quota_lock FROM web_domain WHERE (traffic_quota > 0 or traffic_quota_lock = 'y') and (type = 'vhost' OR type = 'vhostsubdomain')"; + $sql = "SELECT sys_groupid,domain_id,domain,traffic_quota,traffic_quota_lock FROM web_domain WHERE (traffic_quota > 0 or traffic_quota_lock = 'y') and (type = 'vhost' OR type = 'vhostsubdomain' OR type = 'vhostalias')"; $records = $app->db->queryAllRecords($sql); if(is_array($records)) { foreach($records as $rec) { @@ -196,7 +196,7 @@ class cronjob_quota_notify extends cronjob { $global_config = $app->getconf->get_global_config('mail'); //* Check website disk quota - $sql = "SELECT domain_id,sys_groupid,domain,system_user,last_quota_notification,DATEDIFF(CURDATE(), last_quota_notification) as `notified_before` FROM web_domain WHERE (type = 'vhost' OR type = 'vhostsubdomain')"; + $sql = "SELECT domain_id,sys_groupid,domain,system_user,last_quota_notification,DATEDIFF(CURDATE(), last_quota_notification) as `notified_before` FROM web_domain WHERE (type = 'vhost' OR type = 'vhostsubdomain' OR type = 'vhostalias')"; $records = $app->db->queryAllRecords($sql); if(is_array($records) && !empty($records)) { diff --git a/server/lib/classes/cron.d/500-backup.inc.php b/server/lib/classes/cron.d/500-backup.inc.php index 23e7495571..4793d28843 100644 --- a/server/lib/classes/cron.d/500-backup.inc.php +++ b/server/lib/classes/cron.d/500-backup.inc.php @@ -72,7 +72,7 @@ class cronjob_backup extends cronjob { chmod(escapeshellcmd($backup_dir), $backup_dir_permissions); } - $sql = "SELECT * FROM web_domain WHERE server_id = '".$conf['server_id']."' AND (type = 'vhost' OR type = 'vhostsubdomain') AND active = 'y'"; + $sql = "SELECT * FROM web_domain WHERE server_id = '".$conf['server_id']."' AND (type = 'vhost' OR type = 'vhostsubdomain' OR type = 'vhostalias') AND active = 'y'"; $records = $app->db->queryAllRecords($sql); if(is_array($records)) { foreach($records as $rec) { diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 5fc085be74..6267217802 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -131,7 +131,7 @@ class apache2_plugin { foreach($web_domains as $web_data) { $custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$web_data['system_user']; $web_folder = 'web'; - if($web_data['type'] == 'vhostsubdomain') { + if($web_data['type'] == 'vhostsubdomain' || $web_data['type'] == 'vhostalias') { $web_folder = $web_data['web_folder']; $custom_php_ini_dir .= '_' . $web_folder; } @@ -192,7 +192,7 @@ class apache2_plugin { $app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf', LOGLEVEL_ERROR); //* Only vhosts can have a ssl cert - if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain") return; + if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain" && $data["new"]["type"] != "vhostalias") return; // if(!is_dir($data['new']['document_root'].'/ssl')) exec('mkdir -p '.$data['new']['document_root'].'/ssl'); if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl'); @@ -396,7 +396,7 @@ class apache2_plugin { if($this->action != 'insert') $this->action = 'update'; - if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['parent_domain_id'] > 0) { + if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['type'] != 'vhostalias' && $data['new']['parent_domain_id'] > 0) { $old_parent_domain_id = intval($data['old']['parent_domain_id']); $new_parent_domain_id = intval($data['new']['parent_domain_id']); @@ -430,7 +430,7 @@ class apache2_plugin { } if($data['new']['document_root'] == '') { - if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') $app->log('document_root not set', LOGLEVEL_WARN); + if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') $app->log('document_root not set', LOGLEVEL_WARN); return 0; } if($data['new']['system_user'] == 'root' or $data['new']['system_group'] == 'root') { @@ -444,7 +444,7 @@ class apache2_plugin { $web_folder = 'web'; $log_folder = 'log'; - if($data['new']['type'] == 'vhostsubdomain') { + if($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') { $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id'])); $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']); if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id']; @@ -521,7 +521,7 @@ class apache2_plugin { //* Remove protection of old folders $app->system->web_folder_protection($data['old']['document_root'], false); - if($data["new"]["type"] != "vhostsubdomain") { + if($data["new"]["type"] != "vhostsubdomain" && $data["new"]["type"] != "vhostalias") { //* Move the site data $tmp_docroot = explode('/', $data['new']['document_root']); unset($tmp_docroot[count($tmp_docroot)-1]); @@ -677,7 +677,7 @@ class apache2_plugin { // setting a local var here // normally $conf['templates'] = "/usr/local/ispconfig/server/conf"; - if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) { + if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) { // Copy the error pages if($data['new']['errordocs']) { @@ -723,7 +723,7 @@ class apache2_plugin { exec('chmod -R a+r '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); //** Copy the error documents on update when the error document checkbox has been activated and was deactivated before - } elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) { + } elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) { $error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/'; if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) { @@ -741,7 +741,7 @@ class apache2_plugin { exec('chown -R '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.$error_page_path); } // end copy error docs - // Set the quota for the user, but only for vhosts, not vhostsubdomains + // Set the quota for the user, but only for vhosts, not vhostsubdomains or vhostalias if($username != '' && $app->system->is_user($username) && $data['new']['type'] == 'vhost') { if($data['new']['hd_quota'] > 0) { $blocks_soft = $data['new']['hd_quota'] * 1024; @@ -873,7 +873,9 @@ class apache2_plugin { $app->system->chown($data['new']['document_root'].'/webdav', $username); $app->system->chgrp($data['new']['document_root'].'/webdav', $groupname); } - } elseif(($this->action == 'insert' && $data['new']['type'] == 'vhostsubdomain') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhostsubdomain')) { + } elseif((($data['new']['type'] == 'vhostsubdomain') || ($data['new']['type'] == 'vhostalias')) && + (($this->action == 'insert') || ($web_config['set_folder_permissions_on_update'] == 'y'))) { + if($web_config['security_level'] == 20) { $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0710); $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username); @@ -905,7 +907,7 @@ class apache2_plugin { //* Write the custom php.ini file, if custom_php_ini fieled is not empty $custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$data['new']['system_user']; - if($data['new']['type'] == 'vhostsubdomain') $custom_php_ini_dir .= '_' . $web_folder; + if($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') $custom_php_ini_dir .= '_' . $web_folder; if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf'); //* add open_basedir restriction to custom php.ini content, required for suphp only @@ -1087,7 +1089,7 @@ class apache2_plugin { } // get alias domains (co-domains and subdomains) - $aliases = $app->db->queryAllRecords('SELECT * FROM web_domain WHERE parent_domain_id = '.$data['new']['domain_id']." AND active = 'y' AND type != 'vhostsubdomain'"); + $aliases = $app->db->queryAllRecords('SELECT * FROM web_domain WHERE parent_domain_id = '.$data['new']['domain_id']." AND active = 'y' AND (type != 'vhostsubdomain' OR type != 'vhostalias')"); $alias_seo_redirects = array(); switch($data['new']['subdomain']) { case 'www': @@ -1256,7 +1258,7 @@ class apache2_plugin { $php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir']; $fcgi_tpl->setVar('open_basedir', escapeshellcmd($php_open_basedir)); - $fcgi_starter_script = escapeshellcmd($fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : '')); + $fcgi_starter_script = escapeshellcmd($fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : '')); $app->system->file_put_contents($fcgi_starter_script, $fcgi_tpl->grab()); unset($fcgi_tpl); @@ -1268,7 +1270,7 @@ class apache2_plugin { $tpl->setVar('fastcgi_alias', $fastcgi_config['fastcgi_alias']); $tpl->setVar('fastcgi_starter_path', $fastcgi_starter_path); - $tpl->setVar('fastcgi_starter_script', $fastcgi_config['fastcgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : '')); + $tpl->setVar('fastcgi_starter_script', $fastcgi_config['fastcgi_starter_script'].(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : '')); $tpl->setVar('fastcgi_config_syntax', $fastcgi_config['fastcgi_config_syntax']); $tpl->setVar('fastcgi_max_requests', $fastcgi_config['fastcgi_max_requests']); @@ -1347,7 +1349,7 @@ class apache2_plugin { //$cgi_config = $app->getconf->get_server_config($conf['server_id'], 'cgi'); $cgi_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/'; - $cgi_config['cgi_starter_script'] = 'php-cgi-starter'.($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''); + $cgi_config['cgi_starter_script'] = 'php-cgi-starter'.(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : ''); $cgi_config['cgi_bin'] = '/usr/bin/php-cgi'; $cgi_starter_path = str_replace('[system_user]', $data['new']['system_user'], $cgi_config['cgi_starter_path']); @@ -1382,7 +1384,7 @@ class apache2_plugin { $cgi_tpl->setVar('php_ini_path', escapeshellcmd($fastcgi_config['fastcgi_phpini_path'])); } - $cgi_starter_script = escapeshellcmd($cgi_starter_path.$cgi_config['cgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : '')); + $cgi_starter_script = escapeshellcmd($cgi_starter_path.$cgi_config['cgi_starter_script'].(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : '')); $app->system->file_put_contents($cgi_starter_script, $cgi_tpl->grab()); unset($cgi_tpl); @@ -1394,7 +1396,7 @@ class apache2_plugin { $app->system->chgrp($cgi_starter_script, $data['new']['system_group']); $tpl->setVar('cgi_starter_path', $cgi_starter_path); - $tpl->setVar('cgi_starter_script', $cgi_config['cgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : '')); + $tpl->setVar('cgi_starter_script', $cgi_config['cgi_starter_script'].(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : '')); } @@ -1558,7 +1560,7 @@ class apache2_plugin { } //* Create awstats configuration - if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) { + if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) { $this->awstats_update($data, $web_config); } @@ -1715,7 +1717,7 @@ class apache2_plugin { $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); $fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi'); - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') $app->system->web_folder_protection($data['old']['document_root'], false); + if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') $app->system->web_folder_protection($data['old']['document_root'], false); //* Check if this is a chrooted setup if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) { @@ -1727,7 +1729,7 @@ class apache2_plugin { //* Remove the mounts $log_folder = 'log'; $web_folder = ''; - if($data['old']['type'] == 'vhostsubdomain') { + if($data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { $tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id'])); if($tmp['domain'] != ''){ $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']); @@ -1773,7 +1775,7 @@ class apache2_plugin { unset($subdomain_hosts); } - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain'){ + if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias'){ if(is_array($log_folders) && !empty($log_folders)){ foreach($log_folders as $log_folder){ //if($app->system->is_mounted($data['old']['document_root'].'/'.$log_folder)) exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder)); @@ -1797,7 +1799,7 @@ class apache2_plugin { } unset($log_folders); - if($data['old']['type'] != 'vhost' && $data['old']['type'] != 'vhostsubdomain' && $data['old']['parent_domain_id'] > 0) { + if($data['old']['type'] != 'vhost' && $data['old']['type'] != 'vhostsubdomain' && $data['old']['type'] != 'vhostalias' && $data['old']['parent_domain_id'] > 0) { //* This is a alias domain or subdomain, so we have to update the website instead $parent_domain_id = intval($data['old']['parent_domain_id']); $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$parent_domain_id." AND active = 'y'"); @@ -1831,7 +1833,7 @@ class apache2_plugin { $app->system->unlink($vhost_file); $app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG); - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') { + if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { $docroot = escapeshellcmd($data['old']['document_root']); if($docroot != '' && !stristr($docroot, '..')) { if($data['old']['type'] == 'vhost') { @@ -1852,9 +1854,9 @@ class apache2_plugin { // we use strict check as otherwise directories named '0' may not be deleted $do_delete = false; } else { - // read all vhost subdomains with same parent domain + // read all vhost subdomains and alias with same parent domain $used_paths = array(); - $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id'])); + $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE (type = 'vhostsubdomain' OR type = 'vhostalias') AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id'])); foreach($tmp as $tmprec) { // we normalize the folder entries because we need to compare them $tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times @@ -1973,7 +1975,7 @@ class apache2_plugin { $this->awstats_delete($data, $web_config); } - if($data['old']['type'] == 'vhostsubdomain') { + if($data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { $app->system->web_folder_protection($parent_web_document_root, true); } @@ -2083,7 +2085,7 @@ class apache2_plugin { } $web_folder = 'web'; - if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder']; + if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; //* Get the folder path. if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1); @@ -2184,7 +2186,7 @@ class apache2_plugin { } $web_folder = 'web'; - if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder']; + if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; //* Get the folder path. if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1); @@ -2239,7 +2241,7 @@ class apache2_plugin { } $web_folder = 'web'; - if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder']; + if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; //* Get the folder path. if(substr($data['old']['path'], 0, 1) == '/') $data['old']['path'] = substr($data['old']['path'], 1); diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 1a6e57ba0f..abe085862c 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -102,7 +102,7 @@ class nginx_plugin { $app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf', LOGLEVEL_ERROR); //* Only vhosts can have a ssl cert - if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain") return; + if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain" && $data["new"]["type"] != "vhostalias") return; // if(!is_dir($data['new']['document_root'].'/ssl')) exec('mkdir -p '.$data['new']['document_root'].'/ssl'); if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl'); @@ -314,7 +314,7 @@ class nginx_plugin { if($this->action != 'insert') $this->action = 'update'; - if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['parent_domain_id'] > 0) { + if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['type'] != 'vhostalias' && $data['new']['parent_domain_id'] > 0) { $old_parent_domain_id = intval($data['old']['parent_domain_id']); $new_parent_domain_id = intval($data['new']['parent_domain_id']); @@ -348,7 +348,7 @@ class nginx_plugin { } if($data['new']['document_root'] == '') { - if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') $app->log('document_root not set', LOGLEVEL_WARN); + if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') $app->log('document_root not set', LOGLEVEL_WARN); return 0; } if($data['new']['system_user'] == 'root' or $data['new']['system_group'] == 'root') { @@ -362,7 +362,7 @@ class nginx_plugin { $web_folder = 'web'; $log_folder = 'log'; - if($data['new']['type'] == 'vhostsubdomain') { + if($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') { $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id'])); $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']); if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id']; @@ -436,7 +436,7 @@ class nginx_plugin { } } - if($data["new"]["type"] != "vhostsubdomain") { + if($data["new"]["type"] != "vhostsubdomain" && $data["new"]["type"] != "vhostalias") { //* Move the site data $tmp_docroot = explode('/', $data['new']['document_root']); unset($tmp_docroot[count($tmp_docroot)-1]); @@ -592,7 +592,7 @@ class nginx_plugin { // setting a local var here // normally $conf['templates'] = "/usr/local/ispconfig/server/conf"; - if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) { + if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) { // Copy the error pages if($data['new']['errordocs']) { @@ -638,7 +638,7 @@ class nginx_plugin { exec('chmod -R a+r '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); //** Copy the error documents on update when the error document checkbox has been activated and was deactivated before - } elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) { + } elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) { $error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/'; if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) { @@ -656,7 +656,7 @@ class nginx_plugin { exec('chown -R '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.$error_page_path); } // end copy error docs - // Set the quota for the user, but only for vhosts, not vhostsubdomains + // Set the quota for the user, but only for vhosts, not vhostsubdomains or vhostalias if($username != '' && $app->system->is_user($username) && $data['new']['type'] == 'vhost') { if($data['new']['hd_quota'] > 0) { $blocks_soft = $data['new']['hd_quota'] * 1024; @@ -788,7 +788,9 @@ class nginx_plugin { //$app->system->chown($data['new']['document_root'].'/webdav',$username); //$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname); } - } elseif(($this->action == 'insert' && $data['new']['type'] == 'vhostsubdomain') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhostsubdomain')) { + } elseif((($data['new']['type'] == 'vhostsubdomain') || ($data['new']['type'] == 'vhostalias')) && + (($this->action == 'insert') || ($web_config['set_folder_permissions_on_update'] == 'y'))) { + if($web_config['security_level'] == 20) { $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0710); $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username); @@ -1293,7 +1295,7 @@ class nginx_plugin { } // get alias domains (co-domains and subdomains) - $aliases = $app->db->queryAllRecords('SELECT * FROM web_domain WHERE parent_domain_id = '.$data['new']['domain_id']." AND active = 'y' AND type != 'vhostsubdomain'"); + $aliases = $app->db->queryAllRecords('SELECT * FROM web_domain WHERE parent_domain_id = '.$data['new']['domain_id']." AND active = 'y' AND (type != 'vhostsubdomain' OR type != 'vhostalias')"); $alias_seo_redirects = array(); if(is_array($aliases)) { foreach($aliases as $alias) { @@ -1610,7 +1612,7 @@ class nginx_plugin { } //* Create awstats configuration - if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) { + if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) { $this->awstats_update($data, $web_config); } @@ -1728,7 +1730,7 @@ class nginx_plugin { $app->uses('system'); $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') $app->system->web_folder_protection($data['old']['document_root'], false); + if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') $app->system->web_folder_protection($data['old']['document_root'], false); //* Check if this is a chrooted setup if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) { @@ -1740,7 +1742,7 @@ class nginx_plugin { //* Remove the mounts $log_folder = 'log'; $web_folder = ''; - if($data['old']['type'] == 'vhostsubdomain') { + if($data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { $tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id'])); if($tmp['domain'] != ''){ $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']); @@ -1786,7 +1788,7 @@ class nginx_plugin { unset($subdomain_hosts); } - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain'){ + if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias'){ if(is_array($log_folders) && !empty($log_folders)){ foreach($log_folders as $log_folder){ //if($app->system->is_mounted($data['old']['document_root'].'/'.$log_folder)) exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder)); @@ -1810,7 +1812,7 @@ class nginx_plugin { } unset($log_folders); - if($data['old']['type'] != 'vhost' && $data['old']['type'] != 'vhostsubdomain' && $data['old']['parent_domain_id'] > 0) { + if($data['old']['type'] != 'vhost' && $data['old']['type'] != 'vhostsubdomain' && $data['old']['type'] != 'vhostalias' && $data['old']['parent_domain_id'] > 0) { //* This is a alias domain or subdomain, so we have to update the website instead $parent_domain_id = intval($data['old']['parent_domain_id']); $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$parent_domain_id." AND active = 'y'"); @@ -1844,7 +1846,7 @@ class nginx_plugin { $app->system->unlink($vhost_file); $app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG); - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') { + if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { $docroot = escapeshellcmd($data['old']['document_root']); if($docroot != '' && !stristr($docroot, '..')) { if($data['old']['type'] == 'vhost') { @@ -1867,7 +1869,7 @@ class nginx_plugin { } else { // read all vhost subdomains with same parent domain $used_paths = array(); - $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id'])); + $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE (type = 'vhostsubdomain' OR type = 'vhostalias') AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id'])); foreach($tmp as $tmprec) { // we normalize the folder entries because we need to compare them $tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times @@ -2023,7 +2025,7 @@ class nginx_plugin { } $web_folder = 'web'; - if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder']; + if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; //* Get the folder path. if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1); @@ -2102,7 +2104,7 @@ class nginx_plugin { } $web_folder = 'web'; - if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder']; + if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; //* Get the folder path. if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1); @@ -2139,7 +2141,7 @@ class nginx_plugin { } $web_folder = 'web'; - if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder']; + if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; //* Get the folder path. if(substr($data['old']['path'], 0, 1) == '/') $data['old']['path'] = substr($data['old']['path'], 1); @@ -2210,7 +2212,7 @@ class nginx_plugin { $website_auth_location['path'] .= '/'; } $basic_auth_locations[] = array('htpasswd_location' => '/'.$website_auth_location['path'], - 'htpasswd_path' => $website['document_root'].'/' . ($website['type'] == 'vhostsubdomain' ? $website['web_folder'] : 'web') . '/'.$website_auth_location['path']); + 'htpasswd_path' => $website['document_root'].'/' . (($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') ? $website['web_folder'] : 'web') . '/'.$website_auth_location['path']); } } return $basic_auth_locations; @@ -2722,7 +2724,7 @@ class nginx_plugin { // web domain doesn't match hostname if(substr($hostname, -strlen($web['domain'])) != $web['domain']) continue; // own vhost and therefore server {} container of its own - //if($web['type'] == 'vhostsubdomain') continue; + //if($web['type'] == 'vhostsubdomain' || $web['type'] == 'vhostalias') continue; // alias domains/subdomains using rewrites and therefore a server {} container of their own //if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') continue; @@ -2733,7 +2735,7 @@ class nginx_plugin { if($web['domain'] == $hostname){ if($web['domain_id'] == $domain_id || $web['parent_domain_id'] == $domain_id){ // own vhost and therefore server {} container of its own - if($web['type'] == 'vhostsubdomain') return false; + if($web['type'] == 'vhostsubdomain' || $web['type'] == 'vhostalias') return false; // alias domains/subdomains using rewrites and therefore a server {} container of their own if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') return false; return true; @@ -2747,7 +2749,7 @@ class nginx_plugin { if($web['domain'] == $hostname || $web['subdomain'].'.'.$web['domain'] == $hostname){ if($web['domain_id'] == $domain_id || $web['parent_domain_id'] == $domain_id){ // own vhost and therefore server {} container of its own - if($web['type'] == 'vhostsubdomain') return false; + if($web['type'] == 'vhostsubdomain' || $web['type'] == 'vhostalias') return false; // alias domains/subdomains using rewrites and therefore a server {} container of their own if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') return false; return true; @@ -2760,7 +2762,7 @@ class nginx_plugin { if(preg_match($pattern, $hostname)){ if($web['domain_id'] == $domain_id || $web['parent_domain_id'] == $domain_id){ // own vhost and therefore server {} container of its own - if($web['type'] == 'vhostsubdomain') return false; + if($web['type'] == 'vhostsubdomain' || $web['type'] == 'vhostalias') return false; // alias domains/subdomains using rewrites and therefore a server {} container of their own if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') return false; return true; diff --git a/server/plugins-available/nginx_reverseproxy_plugin.inc.php b/server/plugins-available/nginx_reverseproxy_plugin.inc.php index a17c5ba227..1f68649fbf 100644 --- a/server/plugins-available/nginx_reverseproxy_plugin.inc.php +++ b/server/plugins-available/nginx_reverseproxy_plugin.inc.php @@ -63,7 +63,7 @@ class nginx_reverseproxy_plugin { if($this->action != 'insert') $this->action = 'update'; - if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['parent_domain_id'] > 0) { + if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['type'] != 'vhostalias' && $data['new']['parent_domain_id'] > 0) { $old_parent_domain_id = intval($data['old']['parent_domain_id']); $new_parent_domain_id = intval($data['new']['parent_domain_id']); @@ -130,7 +130,7 @@ class nginx_reverseproxy_plugin { // get alias domains (co-domains and subdomains) - $aliases = $app->dbmaster->queryAllRecords('SELECT * FROM web_domain WHERE parent_domain_id = '.$data['new']['domain_id']." AND type != 'vhostsubdomain' AND active = 'y'"); + $aliases = $app->dbmaster->queryAllRecords('SELECT * FROM web_domain WHERE parent_domain_id = '.$data['new']['domain_id']." AND (type != 'vhostsubdomain' OR type != 'vhostalias') AND active = 'y'"); $server_alias = array(); switch($data['new']['subdomain']) { case 'www': @@ -280,7 +280,7 @@ class nginx_reverseproxy_plugin { $nginx_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') { + if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { //* This is a website // Deleting the vhost file, symlink and the data directory -- GitLab