diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php index eac79e9872d241e53e29028ff425ab9de6bcb773..501cf3b35765e41864d7a143a1e2a904bc342962 100644 --- a/install/lib/install.lib.php +++ b/install/lib/install.lib.php @@ -666,6 +666,23 @@ function removeLine($filename, $search_pattern, $strict = 0) { } } +function hasLine($filename, $search_pattern, $strict = 0) { + if($lines = @file($filename)) { + foreach($lines as $line) { + if($strict == 0) { + if(stristr($line, $search_pattern)) { + return true; + } + } else { + if(trim($line) == $search_pattern) { + return true; + } + } + } + } + return false; +} + function is_installed($appname) { exec('which '.escapeshellcmd($appname).' 2> /dev/null', $out, $returncode); if(isset($out[0]) && stristr($out[0], $appname) && $returncode == 0) { diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index ab0c963092916004f58287c32f9fe6764f9cd991..cdb0a5368070834bbd53f4c378343063af914ad2 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -1247,6 +1247,15 @@ class installer_base { replaceLine('/etc/apache2/ports.conf', 'Listen 443', 'Listen 443', 1); } + if(is_file('/etc/apache2/apache.conf')) { + if(hasLine('/etc/apache2/apache.conf', 'Include sites-enabled/', 1) == false) { + if(hasLine('/etc/apache2/apache.conf', 'IncludeOptional sites-enabled/*.conf', 1) == false) { + replaceLine('/etc/apache2/apache.conf', 'Include sites-enabled/', 'Include sites-enabled/', 1, 1); + } elseif(hasLine('/etc/apache2/apache.conf', 'IncludeOptional sites-enabled/*.vhost', 1) == false) { + replaceLine('/etc/apache2/apache.conf', 'IncludeOptional sites-enabled/*.vhost', 'IncludeOptional sites-enabled/*.vhost', 1, 1); + } + } + } //* Copy the ISPConfig configuration include $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; diff --git a/install/sql/incremental/upd_0063.sql b/install/sql/incremental/upd_0063.sql new file mode 100644 index 0000000000000000000000000000000000000000..04e1daa7530ffb5f8842db207313d3045d49906c --- /dev/null +++ b/install/sql/incremental/upd_0063.sql @@ -0,0 +1,20 @@ +ALTER TABLE `client` ADD `limit_domainmodule` INT NOT NULL DEFAULT '0'; +ALTER TABLE `client_template` ADD `limit_domainmodule` INT NOT NULL DEFAULT '0'; +CREATE TABLE `client_message_template` ( + `client_message_template_id` bigint(20) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `template_type` varchar(255) DEFAULT NULL, + `template_name` varchar(255) DEFAULT NULL, + `subject` varchar(255) DEFAULT NULL, + `message` text, + PRIMARY KEY (`client_message_template_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +ALTER TABLE `spamfilter_policy` ADD `policyd_quota_in` int(11) NOT NULL DEFAULT '-1', +ADD `policyd_quota_in_period` int(11) NOT NULL DEFAULT '24', +ADD `policyd_quota_out` int(11) NOT NULL DEFAULT '-1', +ADD `policyd_quota_out_period` int(11) NOT NULL DEFAULT '24', +ADD `policyd_greylist` ENUM( 'Y', 'N' ) NOT NULL DEFAULT 'N'; \ No newline at end of file diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 533151bbbf4974279c884d7594a096f48d9bb875..5efffbfad36e170c6c5dbfd32c244282c2e84214 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -219,6 +219,7 @@ CREATE TABLE `client` ( `limit_cron_frequency` int(11) NOT NULL DEFAULT '5', `limit_traffic_quota` int(11) NOT NULL DEFAULT '-1', `limit_client` int(11) NOT NULL DEFAULT '0', + `limit_domainmodule` int(11) NOT NULL DEFAULT '0', `limit_mailmailinglist` int(11) NOT NULL DEFAULT '-1', `limit_openvz_vm` int(11) NOT NULL DEFAULT '0', `limit_openvz_vm_template_id` int(11) NOT NULL DEFAULT '0', @@ -321,6 +322,7 @@ CREATE TABLE `client_template` ( `limit_cron_frequency` int(11) NOT NULL default '5', `limit_traffic_quota` int(11) NOT NULL default '-1', `limit_client` int(11) NOT NULL default '0', + `limit_domainmodule` int(11) NOT NULL DEFAULT '0', `limit_mailmailinglist` int(11) NOT NULL default '-1', `limit_openvz_vm` int(11) NOT NULL DEFAULT '0', `limit_openvz_vm_template_id` int(11) NOT NULL DEFAULT '0', @@ -342,6 +344,30 @@ CREATE TABLE `client_template_assigned` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- +-- +-- Table structure for table `invoice_message_template` +-- + +CREATE TABLE `client_message_template` ( + `client_message_template_id` bigint(20) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `template_type` varchar(255) DEFAULT NULL, + `template_name` varchar(255) DEFAULT NULL, + `subject` varchar(255) DEFAULT NULL, + `message` text, + PRIMARY KEY (`client_message_template_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Dumping data for table `invoice_message_template` +-- + +-- -------------------------------------------------------- + -- -- Table structure for table `country` -- @@ -1378,6 +1404,11 @@ CREATE TABLE `spamfilter_policy` ( `spam_subject_tag2` varchar(64) default NULL, `message_size_limit` int(11) unsigned default NULL, `banned_rulenames` varchar(64) default NULL, + `policyd_quota_in` int(11) NOT NULL DEFAULT '-1', + `policyd_quota_in_period` int(11) NOT NULL DEFAULT '24', + `policyd_quota_out` int(11) NOT NULL DEFAULT '-1', + `policyd_quota_out_period` int(11) NOT NULL DEFAULT '24', + `policyd_greylist` ENUM( 'Y', 'N' ) NOT NULL DEFAULT 'N', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; diff --git a/interface/lib/classes/client_templates.inc.php b/interface/lib/classes/client_templates.inc.php index bdf9b167f8a26ca5bd5d293e7506dc22e3e06ad0..64beb9eb53942c2f8229cb9df49f293c9a29b772 100644 --- a/interface/lib/classes/client_templates.inc.php +++ b/interface/lib/classes/client_templates.inc.php @@ -106,9 +106,10 @@ class client_templates { /* * Get the master-template for the client */ - $sql = "SELECT template_master, template_additional FROM client WHERE client_id = " . $app->functions->intval($clientId); + $sql = "SELECT template_master, template_additional,limit_client FROM client WHERE client_id = " . $app->functions->intval($clientId); $record = $app->db->queryOneRecord($sql); $masterTemplateId = $record['template_master']; + $is_reseller = ($record['limit_client'] > 0)?true:false; if($record['template_additional'] != '') { // we have to call the update_client_templates function @@ -222,6 +223,7 @@ class client_templates { * Write all back to the database */ $update = ''; + if(!$is_reseller) unset($limits['limit_client']); // Only Resellers may have limit_client set in template to ensure that we do not convert a client to reseller accidently. foreach($limits as $k => $v){ if ((strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){ if ($update != '') $update .= ', '; diff --git a/interface/lib/classes/custom_datasource.inc.php b/interface/lib/classes/custom_datasource.inc.php index ff01084ef5316053d43597973e17a8666899866f..16036f599c3fe94803cabe98a3cfd3592f7de7dd 100644 --- a/interface/lib/classes/custom_datasource.inc.php +++ b/interface/lib/classes/custom_datasource.inc.php @@ -32,7 +32,7 @@ class custom_datasource { function master_templates($field, $record) { global $app, $conf; - $records = $app->db->queryAllRecords("SELECT template_id,template_name FROM client_template WHERE template_type ='m'"); + $records = $app->db->queryAllRecords("SELECT template_id,template_name FROM client_template WHERE template_type ='m' and ".$app->tform->getAuthSQL('r')); $records_new[0] = $app->lng('Custom'); foreach($records as $rec) { $key = $rec['template_id']; diff --git a/interface/lib/classes/ispcmail.inc.php b/interface/lib/classes/ispcmail.inc.php index 16247ab0f108fa314c0663630e46e6129d1c45c8..2e49c8de97104618050bcd8d55a4cb3a908ee0df 100644 --- a/interface/lib/classes/ispcmail.inc.php +++ b/interface/lib/classes/ispcmail.inc.php @@ -223,6 +223,7 @@ class ispcmail { elseif(isset($_SERVER['SERVER_NAME'])) $this->smtp_helo = $_SERVER['SERVER_NAME']; else $this->smtp_helo = php_uname('n'); if($this->smtp_helo == '') $this->smtp_helo = 'localhost'; + return $this->smtp_helo; } diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php index 2dd717986f7066fa3b8cca23fae4a04c063aa5df..d0d2dc86f8bbbab007980c38aff4025374f6b1c1 100644 --- a/interface/lib/classes/remoting.inc.php +++ b/interface/lib/classes/remoting.inc.php @@ -187,7 +187,6 @@ class remoting { //** protected functions ----------------------------------------------------------------------------------- - protected function klientadd($formdef_file, $reseller_id, $params) { global $app; diff --git a/interface/web/admin/lib/remote.conf.php b/interface/web/admin/lib/remote.conf.php index 4268f47e120e0f706054d2e6b2885b2f024000fc..c40e8bf07257ddbbdaeae7e39395b6081b244398 100644 --- a/interface/web/admin/lib/remote.conf.php +++ b/interface/web/admin/lib/remote.conf.php @@ -1,5 +1,6 @@ <?php $function_list['server_get,get_function_list,client_templates_get_all,server_get_serverid_by_ip,server_ip_add,server_ip_update,server_ip_delete'] = 'Server functions'; +$function_list['admin_record_permissions'] = 'Record permission changes'; ?> diff --git a/interface/web/admin/templates/server_config_web_edit.htm b/interface/web/admin/templates/server_config_web_edit.htm index 89ba859129304248e259a3ec446a37ab90213f0a..ece9d7ddabb86ac78e5b20e82e2dc102811e5dc8 100644 --- a/interface/web/admin/templates/server_config_web_edit.htm +++ b/interface/web/admin/templates/server_config_web_edit.htm @@ -145,11 +145,11 @@ </div> <div class="ctrlHolder"> <label for="CA_path">{tmpl_var name='CA_path_txt'}</label> - <input name="CA_path" id="CA_path" value="{tmpl_var name='CA_path'}" size="40" maxlength="255" type="text" class="textInput" /> + <input name="CA_path" id="CA_path" value="{tmpl_var name='CA_path'}" size="40" maxlength="255" type="text" autocomplete="off" class="textInput" /> </div> <div class="ctrlHolder"> <label for="CA_pass">{tmpl_var name='CA_pass_txt'}</label> - <input name="CA_pass" id="CA_pass" value="{tmpl_var name='CA_pass'}" size="40" maxlength="255" type="password" class="textInput" /> + <input name="CA_pass" id="CA_pass" value="{tmpl_var name='CA_pass'}" size="40" maxlength="255" type="password" autocomplete="off" class="textInput" /> </div> </div> <div class="subsectiontoggle"><span></span>{tmpl_var name='permissions_txt'}<em></em></div> diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php index d12f39edb6829115ebfea8735df4ac51e567c055..f731cca251e479150db41f3c2b0270792fa5f37e 100644 --- a/interface/web/client/client_edit.php +++ b/interface/web/client/client_edit.php @@ -92,6 +92,11 @@ class page_action extends tform_actions { } } } + + //* Resellers shall not be able to create another reseller + if($_SESSION["s"]["user"]["typ"] == 'user') { + $this->dataRecord['limit_client'] = 0; + } if($this->id != 0) { $this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $this->id); @@ -189,9 +194,11 @@ class page_action extends tform_actions { $app->tpl->setVar('customer_no',$customer_no_string); //* save new counter value + /* $system_config['misc']['customer_no_counter']++; $system_config_str = $app->ini_parser->get_ini_string($system_config); $app->db->datalogUpdate('sys_ini', "config = '".$app->db->quote($system_config_str)."'", 'sysini_id', 1); + */ } } else { //* Logged in user must be a reseller @@ -206,10 +213,30 @@ class page_action extends tform_actions { $app->tpl->setVar('customer_no',$customer_no_string); //* save new counter value + /* $customer_no_counter = $app->functions->intval($reseller['customer_no_counter']+1); $app->db->query("UPDATE client SET customer_no_counter = $customer_no_counter WHERE client_id = ".$app->functions->intval($reseller['client_id'])); + */ + } + } + } + + if($app->auth->is_admin()) { + // Fill the client select field + $sql = "SELECT client.client_id, 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 AND client.limit_client > 0 ORDER BY sys_group.name"; + $clients = $app->db->queryAllRecords($sql); + $client_select = "<option value='0'>- ".$app->tform->lng('none_txt')." -</option>"; + //$tmp_data_record = $app->tform->getDataRecord($this->id); + if(is_array($clients)) { + $selected_client_id = 0; // needed to get list of PHP versions + foreach($clients as $client) { + if(is_array($this->dataRecord) && ($client["client_id"] == $this->dataRecord['parent_client_id']) && !$selected_client_id) $selected_client_id = $client["client_id"]; + $selected = @(is_array($this->dataRecord) && ($client["client_id"] == $this->dataRecord['parent_client_id']))?'SELECTED':''; + if($selected == 'SELECTED') $selected_client_id = $client["client_id"]; + $client_select .= "<option value='$client[client_id]' $selected>$client[contactname]</option>\r\n"; } } + $app->tpl->setVar("parent_client_id", $client_select); } parent::onShowEnd(); @@ -253,6 +280,14 @@ class page_action extends tform_actions { if($_SESSION['s']['user']['typ'] == 'user') { $app->auth->add_group_to_user($_SESSION['s']['user']['userid'], $groupid); $app->db->query("UPDATE client SET parent_client_id = ".$app->functions->intval($_SESSION['s']['user']['client_id'])." WHERE client_id = ".$this->id); + } else { + if($this->dataRecord['parent_client_id'] > 0) { + //* get userid of the reseller and add it to the group of the client + $tmp = $app->db->queryOneRecord("SELECT sys_user.userid FROM sys_user,sys_group WHERE sys_user.default_group = sys_group.groupid AND sys_group.client_id = ".$app->functions->intval($this->dataRecord['parent_client_id'])); + $app->auth->add_group_to_user($tmp['userid'], $groupid); + $app->db->query("UPDATE client SET parent_client_id = ".$app->functions->intval($this->dataRecord['parent_client_id'])." WHERE client_id = ".$this->id); + unset($tmp); + } } //* Set the default servers @@ -272,6 +307,75 @@ class page_action extends tform_actions { $app->uses('client_templates'); $app->client_templates->update_client_templates($this->id, $this->_template_additional); } + + if($this->dataRecord['customer_no'] == $this->dataRecord['customer_no_org']) { + if($app->auth->is_admin()) { + //* Logged in User is admin + //* get the system config + $app->uses('getconf'); + $system_config = $app->getconf->get_global_config(); + if($system_config['misc']['customer_no_template'] != '') { + + //* save new counter value + $system_config['misc']['customer_no_counter']++; + $system_config_str = $app->ini_parser->get_ini_string($system_config); + $app->db->datalogUpdate('sys_ini', "config = '".$app->db->quote($system_config_str)."'", 'sysini_id', 1); + } + } else { + //* Logged in user must be a reseller + //* get the record of the reseller + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $reseller = $app->db->queryOneRecord("SELECT client.client_id, client.customer_no_template, client.customer_no_counter, client.customer_no_start FROM sys_group,client WHERE client.client_id = sys_group.client_id and sys_group.groupid = ".$client_group_id); + + if($reseller['customer_no_template'] != '') { + //* save new counter value + $customer_no_counter = $app->functions->intval($reseller['customer_no_counter']+1); + $app->db->query("UPDATE client SET customer_no_counter = $customer_no_counter WHERE client_id = ".$app->functions->intval($reseller['client_id'])); + } + } + } + + //* Send welcome email + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $sql = "SELECT * FROM client_message_template WHERE template_type = 'welcome' AND sys_groupid = ".$client_group_id; + $email_template = $app->db->queryOneRecord($sql); + $client = $app->tform->getDataRecord($this->id); + + if(is_array($email_template) && $client['email'] != '') { + //* Parse client details into message + $message = $email_template['message']; + $subject = $email_template['subject']; + foreach($client as $key => $val) { + switch ($key) { + case 'password': + $message = str_replace('{password}', $this->dataRecord['password'], $message); + $subject = str_replace('{password}', $this->dataRecord['password'], $subject); + break; + case 'gender': + $message = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $message); + $subject = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $subject); + break; + default: + $message = str_replace('{'.$key.'}', $val, $message); + $subject = str_replace('{'.$key.'}', $val, $subject); + } + } + + //* Get sender address + if($app->auth->is_admin()) { + $app->uses('getconf'); + $system_config = $app->getconf->get_global_config(); + $from = $system_config['admin_mail']; + } else { + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $reseller = $app->db->queryOneRecord("SELECT client.email FROM sys_group,client WHERE client.client_id = sys_group.client_id and sys_group.groupid = ".$client_group_id); + $from = $reseller["email"]; + } + + //* Send the email + $app->functions->mail($client['email'], $subject, $message, $from); + } + parent::onAfterInsert(); } @@ -412,7 +516,7 @@ class page_action extends tform_actions { $app->db->query($sql); } - // reseller status changed + //* reseller status changed if(isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] != $this->oldDataRecord["limit_client"]) { $modules = $conf['interface_modules_enabled']; if($this->dataRecord["limit_client"] > 0) $modules .= ',client'; @@ -421,6 +525,34 @@ class page_action extends tform_actions { $sql = "UPDATE sys_user SET modules = '$modules' WHERE client_id = $client_id"; $app->db->query($sql); } + + //* Client has been moved to another reseller + if($_SESSION['s']['user']['typ'] == 'admin' && isset($this->dataRecord['parent_client_id']) && $this->dataRecord['parent_client_id'] != $this->oldDataRecord['parent_client_id']) { + //* Get groupid of the client + $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".intval($this->id)); + $groupid = $tmp['groupid']; + unset($tmp); + + //* Remove sys_user of old reseller from client group + if($this->oldDataRecord['parent_client_id'] > 0) { + //* get userid of the old reseller remove it from the group of the client + $tmp = $app->db->queryOneRecord("SELECT sys_user.userid FROM sys_user,sys_group WHERE sys_user.default_group = sys_group.groupid AND sys_group.client_id = ".$app->functions->intval($this->oldDataRecord['parent_client_id'])); + $app->auth->remove_group_from_user($tmp['userid'], $groupid); + unset($tmp); + } + + //* Add sys_user of new reseller to client group + if($this->dataRecord['parent_client_id'] > 0) { + //* get userid of the reseller and add it to the group of the client + $tmp = $app->db->queryOneRecord("SELECT sys_user.userid, sys_user.default_group FROM sys_user,sys_group WHERE sys_user.default_group = sys_group.groupid AND sys_group.client_id = ".$app->functions->intval($this->dataRecord['parent_client_id'])); + $app->auth->add_group_to_user($tmp['userid'], $groupid); + $app->db->query("UPDATE client SET sys_userid = ".$app->functions->intval($tmp['userid']).", sys_groupid = ".$app->functions->intval($tmp['default_group']).", parent_client_id = ".$app->functions->intval($this->dataRecord['parent_client_id'])." WHERE client_id = ".$this->id); + unset($tmp); + } else { + //* Client is not assigned to a reseller anymore, so we assign it to the admin + $app->db->query("UPDATE client SET sys_userid = 1, sys_groupid = 1, parent_client_id = 0 WHERE client_id = ".$this->id); + } + } if(isset($this->dataRecord['template_master'])) { $app->uses('client_templates'); diff --git a/interface/web/client/client_message.php b/interface/web/client/client_message.php index 199fc6927e71a86e510a5831a9d6a5cf13f787eb..5707e88206be5b02ffe24d8be088f3d14d184b2b 100644 --- a/interface/web/client/client_message.php +++ b/interface/web/client/client_message.php @@ -146,7 +146,7 @@ if($_SESSION["s"]["user"]["typ"] == 'admin'){ //message variables $message_variables = ''; -$sql = "SHOW COLUMNS FROM client WHERE Field NOT IN ('client_id', 'sys_userid', 'sys_groupid', 'sys_perm_user', 'sys_perm_group', 'sys_perm_other', 'password', 'parent_client_id', 'id_rsa', 'ssh_rsa', 'created_at', 'default_mailserver', 'default_webserver', 'web_php_options', 'ssh_chroot', 'default_dnsserver', 'default_dbserver', 'template_master', 'template_additional') AND Field NOT LIKE 'limit_%'"; +$sql = "SHOW COLUMNS FROM client WHERE Field NOT IN ('client_id', 'sys_userid', 'sys_groupid', 'sys_perm_user', 'sys_perm_group', 'sys_perm_other', 'password', 'parent_client_id', 'id_rsa', 'ssh_rsa', 'created_at', 'default_mailserver', 'default_webserver', 'web_php_options', 'ssh_chroot', 'default_dnsserver', 'default_dbserver', 'template_master', 'template_additional', 'force_suexec', 'default_slave_dnsserver', 'usertheme', 'locked', 'canceled', 'can_use_api', 'tmp_data', 'customer_no_template', 'customer_no_start', 'customer_no_counter', 'added_date', 'added_by') AND Field NOT LIKE 'limit_%'"; $field_names = $app->db->queryAllRecords($sql); if(!empty($field_names) && is_array($field_names)){ foreach($field_names as $field_name){ diff --git a/interface/web/client/client_template_edit.php b/interface/web/client/client_template_edit.php index d956faf98c997f5a62ad68009138b50eafde7b6c..bc5c6d22cf3fb77f502901e125b112756d3d89d2 100644 --- a/interface/web/client/client_template_edit.php +++ b/interface/web/client/client_template_edit.php @@ -51,6 +51,19 @@ $app->load('tform_actions'); class page_action extends tform_actions { + + function onSubmit() { + global $app; + + //* Resellers shall not be able to create another reseller or set reseller specific settings + if($_SESSION["s"]["user"]["typ"] == 'user') { + $this->dataRecord['limit_client'] = 0; + $this->dataRecord['limit_domainmodule'] = 0; + } + + parent::onSubmit(); + } + function onBeforeUpdate() { global $app; diff --git a/interface/web/client/domain_edit.php b/interface/web/client/domain_edit.php index 24a4c81515ece409e4d39fd47ffdd449eb6ee2b4..07929f901eeb71a3a8da033f2f4a9f34f33bd1c0 100644 --- a/interface/web/client/domain_edit.php +++ b/interface/web/client/domain_edit.php @@ -52,6 +52,15 @@ $app->load('tform_actions'); $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng'; include $lng_file; +if(!$app->tform->checkClientLimit('limit_domainmodule')) { + $app->uses('ini_parser,getconf'); + $settings = $app->getconf->get_global_config('domains'); + if ($settings['use_domain_module'] == 'y') { + $app->error($settings['new_domain_html']); + } +} + + class page_action extends tform_actions { function onShowNew() { diff --git a/interface/web/client/form/client_template.tform.php b/interface/web/client/form/client_template.tform.php index ecf61f7af05c7e6951d35a5ce314477a34f2cb05..f9d9f6b2c0d499d6c79a19dbe0487aa5bceac352 100644 --- a/interface/web/client/form/client_template.tform.php +++ b/interface/web/client/form/client_template.tform.php @@ -101,6 +101,20 @@ $form["tabs"]['limits'] = array ( //################################# // Begin Datatable fields //################################# + 'limit_client' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_client_error_notint'), + ), + 'default' => '1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), 'limit_maildomain' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', diff --git a/interface/web/client/form/message_template.tform.php b/interface/web/client/form/message_template.tform.php new file mode 100644 index 0000000000000000000000000000000000000000..421b1af71374040e6c7a60bdb64b04481fdd679d --- /dev/null +++ b/interface/web/client/form/message_template.tform.php @@ -0,0 +1,108 @@ +<?php + +/* + Form Definition + + Tabledefinition + + Datatypes: + - INTEGER (Forces the input to Int) + - DOUBLE + - CURRENCY (Formats the values to currency notation) + - VARCHAR (no format check, maxlength: 255) + - TEXT (no format check) + - DATE (Dateformat, automatic conversion to timestamps) + + Formtype: + - TEXT (Textfield) + - TEXTAREA (Textarea) + - PASSWORD (Password textfield, input is not shown when edited) + - SELECT (Select option field) + - RADIO + - CHECKBOX + - CHECKBOXARRAY + - FILE + + VALUE: + - Wert oder Array + + Hint: + The ID field of the database table is not part of the datafield definition. + The ID field must be always auto incement (int or bigint). + + +*/ + +$form["title"] = "Email template"; +$form["description"] = ""; +$form["name"] = "client_message_template"; +$form["action"] = "message_template_edit.php"; +$form["db_table"] = "client_message_template"; +$form["db_table_idx"] = "client_message_template_id"; +$form["db_history"] = "no"; +$form["tab_default"] = "template"; +$form["list_default"] = "message_template_list.php"; +$form["auth"] = 'yes'; + +$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 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"]['template'] = array ( + 'title' => "Settings", + 'width' => 100, + 'template' => "templates/message_template.htm", + 'fields' => array ( + //################################# + // Begin Datatable fields + //################################# + 'template_type' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + 'value' => array('welcome' => 'Default welcome email', 'other' => 'Other') + ), + 'template_name' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'subject' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'message' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXTAREA', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + //################################# + // END Datatable fields + //################################# + ) +); + + + +?> diff --git a/interface/web/client/form/reseller.tform.php b/interface/web/client/form/reseller.tform.php index eb74ce72bfea3c449b36cbbd0b0424d1b86f9cda..8db74b6e74c0ab4af69c4871493a9aab1e48f5d4 100644 --- a/interface/web/client/form/reseller.tform.php +++ b/interface/web/client/form/reseller.tform.php @@ -1203,6 +1203,20 @@ $form["tabs"]['limits'] = array ( 'width' => '30', 'maxlength' => '255' ), + 'limit_domainmodule' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_domainmodule_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), //################################# // END Datatable fields //################################# diff --git a/interface/web/client/lib/lang/ar.lng b/interface/web/client/lib/lang/ar.lng index 88e0f8fa70499f443b98043a6795a8b66a22d5ff..bb03af82b7c55422ab8e4fea0184cfd2165935db 100644 --- a/interface/web/client/lib/lang/ar.lng +++ b/interface/web/client/lib/lang/ar.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits'; $wb['Add Client'] = 'Add Client'; $wb['Edit Client'] = 'Edit Client'; $wb['Clients'] = 'Clients'; -$wb['Edit Client-Templates'] = 'Edit Client-Templates'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Add Reseller'; $wb['Edit Reseller'] = 'Edit Reseller'; $wb['Resellers'] = 'Resellers'; diff --git a/interface/web/client/lib/lang/bg.lng b/interface/web/client/lib/lang/bg.lng index e4417305c0fae4e291601f2077f70ab6e9e3afbb..836fc56d96a0cd4f731b376b79eaa793ec5eb821 100644 --- a/interface/web/client/lib/lang/bg.lng +++ b/interface/web/client/lib/lang/bg.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'ОграничениÑ'; $wb['Add Client'] = 'ДобавÑне на клиент'; $wb['Edit Client'] = 'Редактиране на клиент'; $wb['Clients'] = 'Клиенти'; -$wb['Edit Client-Templates'] = 'Редактирай КлиентÑки-Шаблон'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Добави диÑтрибутор'; $wb['Edit Reseller'] = 'Редактирай диÑтрибутор'; $wb['Resellers'] = 'ДиÑтрибутори'; diff --git a/interface/web/client/lib/lang/br.lng b/interface/web/client/lib/lang/br.lng index bb73de1f3307ba7a481dae9d38ac73f7aebc4ddd..26049404da95d676507278621006b5d7ecc6996c 100644 --- a/interface/web/client/lib/lang/br.lng +++ b/interface/web/client/lib/lang/br.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limites'; $wb['Add Client'] = 'Adcionar Cliente'; $wb['Edit Client'] = 'Editar Cliente'; $wb['Clients'] = 'Clientes'; -$wb['Edit Client-Templates'] = 'Editar Gabaritos de Clientes'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Adcionar Revendedor'; $wb['Edit Reseller'] = 'Editar Revendedor'; $wb['Resellers'] = 'Revendedores'; diff --git a/interface/web/client/lib/lang/cz.lng b/interface/web/client/lib/lang/cz.lng index fa1c78df750a6461120bf2a67bd24d66758f86b8..38d1ac835be01d55442bc350cd3c87ae453918fd 100644 --- a/interface/web/client/lib/lang/cz.lng +++ b/interface/web/client/lib/lang/cz.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limity'; $wb['Add Client'] = 'PÅ™idat klienta'; $wb['Edit Client'] = 'Upravit klienta'; $wb['Clients'] = 'Klienti'; -$wb['Edit Client-Templates'] = 'Upravit klientské Å¡ablony'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'PÅ™idat distributora'; $wb['Edit Reseller'] = 'Upravit distributora'; $wb['Resellers'] = 'DistributoÅ™i (prodejci)'; diff --git a/interface/web/client/lib/lang/de.lng b/interface/web/client/lib/lang/de.lng index ba66401d9ed70d257fa914a9ff424f1d01dc4de8..bdff0bb30ee0ad682fa6ea484258414157839267 100644 --- a/interface/web/client/lib/lang/de.lng +++ b/interface/web/client/lib/lang/de.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits'; $wb['Add Client'] = 'Kunde hinzufügen'; $wb['Edit Client'] = 'Kunde bearbeiten'; $wb['Clients'] = 'Kunden'; -$wb['Edit Client-Templates'] = 'Kundenvorlagen'; +$wb['Templates'] = 'Vorlagen'; +$wb['Limit-Templates'] = 'Kundenvorlagen'; $wb['Add Reseller'] = 'Reseller hinzufügen'; $wb['Edit Reseller'] = 'Reseller bearbeiten'; $wb['Resellers'] = 'Reseller'; diff --git a/interface/web/client/lib/lang/el.lng b/interface/web/client/lib/lang/el.lng index 7d4f4fa535d8911a96011ed94f4e209e024083d6..fe70d3fde9487ae02da885d6fbba03d121336c4f 100644 --- a/interface/web/client/lib/lang/el.lng +++ b/interface/web/client/lib/lang/el.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'ÎŒÏια'; $wb['Add Client'] = 'ÎÎος Πελάτης'; $wb['Edit Client'] = 'ΕπεξεÏγασία Πελάτη'; $wb['Clients'] = 'Πελάτες'; -$wb['Edit Client-Templates'] = 'ΕπεξεÏγασία Ï€ÏοτÏπων πελατών'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'ÎÎος Μεταπωλητής'; $wb['Edit Reseller'] = 'ΕπεξεÏγασία Μεταπωλητή'; $wb['Resellers'] = 'ΜεταπωλητÎÏ‚'; diff --git a/interface/web/client/lib/lang/en.lng b/interface/web/client/lib/lang/en.lng index 46cdb4aaf2a06f583613c441fb2512e41b530b40..d901b7a2e02e37f98fafc4ff84adb0140fa2bc2d 100644 --- a/interface/web/client/lib/lang/en.lng +++ b/interface/web/client/lib/lang/en.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits'; $wb['Add Client'] = 'Add Client'; $wb['Edit Client'] = 'Edit Client'; $wb['Clients'] = 'Clients'; -$wb['Edit Client-Templates'] = 'Edit Client-Templates'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Add Reseller'; $wb['Edit Reseller'] = 'Edit Reseller'; $wb['Resellers'] = 'Resellers'; diff --git a/interface/web/client/lib/lang/en_client.lng b/interface/web/client/lib/lang/en_client.lng index d4ab57adc2e5ed09430e3a65eec9d869f55622da..a9565a32e493a2718d4ae3d930dad4f39464a2ed 100644 --- a/interface/web/client/lib/lang/en_client.lng +++ b/interface/web/client/lib/lang/en_client.lng @@ -170,4 +170,6 @@ $wb['no_mail_server_error'] = 'At least one Mailserver must be selected.'; $wb['mail_servers_used'] = 'The server you are trying to remove from this client is used as a Mailserver. Be sure that this server is not used by this client before to remove it.'; $wb['added_by_txt'] = 'Added by'; $wb['added_date_txt'] = 'Added date'; +$wb['parent_client_id_txt'] = 'Client of reseller'; +$wb['none_txt'] = 'none'; ?> diff --git a/interface/web/client/lib/lang/en_client_message_template.lng b/interface/web/client/lib/lang/en_client_message_template.lng new file mode 100644 index 0000000000000000000000000000000000000000..e2ab2c7970f4bbf4fa96e71911f32c314bbecccc --- /dev/null +++ b/interface/web/client/lib/lang/en_client_message_template.lng @@ -0,0 +1,11 @@ +<?php +$wb["template_type_txt"] = 'Email type'; +$wb["template_name_txt"] = 'Template name'; +$wb["subject_txt"] = 'Subject'; +$wb["message_txt"] = 'Message'; +$wb['Email template'] = 'Email template'; +$wb['Settings'] = 'Setting'; +$wb['variables_txt'] = 'Variables'; +$wb['variables_description_txt'] = '(The username and password variables are only available in welcome emails.)'; +$wb['duplicate_welcome_error'] = 'There can be only one default welcome email template. Please edit the existing template instead of adding a new one.'; +?> \ No newline at end of file diff --git a/interface/web/client/lib/lang/en_client_message_template_list.lng b/interface/web/client/lib/lang/en_client_message_template_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..7a78bf08dea0f780adb9d22f462cf43e009dc56b --- /dev/null +++ b/interface/web/client/lib/lang/en_client_message_template_list.lng @@ -0,0 +1,5 @@ +<?php +$wb["list_head_txt"] = 'Email templates'; +$wb["template_type_txt"] = 'Message for'; +$wb["template_name_txt"] = 'Template name'; +?> \ No newline at end of file diff --git a/interface/web/client/lib/lang/en_client_template.lng b/interface/web/client/lib/lang/en_client_template.lng index e7c06a8b6ffa25999e68e764d431b0d4095b0cfb..0eef4700bf0bb88c39a12d7b072debb9d418d0ee 100644 --- a/interface/web/client/lib/lang/en_client_template.lng +++ b/interface/web/client/lib/lang/en_client_template.lng @@ -88,4 +88,6 @@ $wb["virtualization_limits_txt"] = 'Virtualization Limits'; $wb['aps_limits_txt'] = 'APS Installer Limits'; $wb['limit_aps_txt'] = 'Max. number of APS instances'; $wb['limit_aps_error_notint'] = 'The APS instances limit must be a number.'; +$wb['limit_domainmodule_txt'] = 'Domainmodule Limit'; +$wb['client_limits_txt'] = 'Client Limits' ?> \ No newline at end of file diff --git a/interface/web/client/lib/lang/en_client_template_list.lng b/interface/web/client/lib/lang/en_client_template_list.lng index ce1f9bd123146ae3420c2280a9fe6dc5eba65d9f..1906cefc469e063b01a1ea409cb7fe311f964977 100644 --- a/interface/web/client/lib/lang/en_client_template_list.lng +++ b/interface/web/client/lib/lang/en_client_template_list.lng @@ -1,5 +1,5 @@ <?php -$wb["list_head_txt"] = 'Client-Templates'; +$wb["list_head_txt"] = 'Client and Reseller Templates'; $wb["template_type_txt"] = 'Type'; $wb["template_name_txt"] = 'Template name'; $wb['template_id_txt'] = 'Template ID'; diff --git a/interface/web/client/lib/lang/en_reseller.lng b/interface/web/client/lib/lang/en_reseller.lng index c70e324f0eb9b6bc70f9756f45ad61901a982774..3b478e4cecf9c5001c2ab37dae06fb8f0ae109f7 100644 --- a/interface/web/client/lib/lang/en_reseller.lng +++ b/interface/web/client/lib/lang/en_reseller.lng @@ -172,4 +172,8 @@ $wb['customer_no_start_txt'] = 'Customer No. start value'; $wb['customer_no_counter_txt'] = 'Customer No. counter'; $wb['added_by_txt'] = 'Added by'; $wb['added_date_txt'] = 'Added date'; +$wb['limit_domainmodule_error_notint'] = 'Domainmodule limit must be a number.'; +$wb['limit_domainmodule_txt'] = 'Domainmodule Limit'; +$wb['client_limits_txt'] = 'Client Limits'; +$wb['err_msg_master_tpl_set'] = 'All custom limit settings are ignored if any master template other than "custom" is selected.'; ?> diff --git a/interface/web/client/lib/lang/es.lng b/interface/web/client/lib/lang/es.lng index fb636c358b667f1bdaecf652af25f7f17b4de444..da7204818289ca41c7129d57b1f274edf0471262 100644 --- a/interface/web/client/lib/lang/es.lng +++ b/interface/web/client/lib/lang/es.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'LÃmites'; $wb['Add Client'] = 'Añadir cliente'; $wb['Edit Client'] = 'Editar cliente'; $wb['Clients'] = 'Clientes'; -$wb['Edit Client-Templates'] = 'Editar plantillas de clientes'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Añadir revendedor'; $wb['Edit Reseller'] = 'Editar revendedor'; $wb['Resellers'] = 'Revendedores'; diff --git a/interface/web/client/lib/lang/fi.lng b/interface/web/client/lib/lang/fi.lng index 6f3dd5a6d1355841804c946b7d2339eacf974f1e..d440dfe3b08f2c0e4e63e2aad095ba4139bebfc4 100755 --- a/interface/web/client/lib/lang/fi.lng +++ b/interface/web/client/lib/lang/fi.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Rajoitukset'; $wb['Add Client'] = 'Lisää asiakas'; $wb['Edit Client'] = 'Muokkaa asiakkaan tietoja'; $wb['Clients'] = 'Asiakkaat'; -$wb['Edit Client-Templates'] = 'Muokkaa asiakasmalleja'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Lisää uusi jälleenmyyjä'; $wb['Edit Reseller'] = 'Muokkaa jälleenmyyjää'; $wb['Resellers'] = 'Jälleenmyyjät'; diff --git a/interface/web/client/lib/lang/fr.lng b/interface/web/client/lib/lang/fr.lng index 8676a29e128a800e71201e7427ddf85151839057..02d06dfd2e1e64db1ac6d00864b34350f80b83a5 100644 --- a/interface/web/client/lib/lang/fr.lng +++ b/interface/web/client/lib/lang/fr.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limites'; $wb['Add Client'] = 'Ajouter un Client'; $wb['Edit Client'] = 'Editer un Client'; $wb['Clients'] = 'Clients'; -$wb['Edit Client-Templates'] = 'Editer les modèles de Clients'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Ajouter un Revendeur'; $wb['Edit Reseller'] = 'Editer un Revendeur'; $wb['Resellers'] = 'Revendeurs'; diff --git a/interface/web/client/lib/lang/hr.lng b/interface/web/client/lib/lang/hr.lng index 74e37dd6eb9a6ca3e1b30e3ab22f18d286622f35..137f9bb1f1a8ddf8cac08a6e1b62105055819a8b 100644 --- a/interface/web/client/lib/lang/hr.lng +++ b/interface/web/client/lib/lang/hr.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limiti'; $wb['Add Client'] = 'Dodaj klijenta'; $wb['Edit Client'] = 'Editiraj klijenta'; $wb['Clients'] = 'Klijenti'; -$wb['Edit Client-Templates'] = 'Editiraj predložak za klijente'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Dodaj preprodavaÄa'; $wb['Edit Reseller'] = 'Editiraj preprodavaÄa'; $wb['Resellers'] = 'PreprodavaÄi'; diff --git a/interface/web/client/lib/lang/hu.lng b/interface/web/client/lib/lang/hu.lng index 84311fe94e3c75b38fea7a341c2b167eee4347dc..84beaf578a2521c84a5fc6642287aefb2fffad86 100644 --- a/interface/web/client/lib/lang/hu.lng +++ b/interface/web/client/lib/lang/hu.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Korlátok'; $wb['Add Client'] = 'Ãœgyfél hozzáadása'; $wb['Edit Client'] = 'Ãœgyfél adatok szerkesztése'; $wb['Clients'] = 'Ãœgyfelek'; -$wb['Edit Client-Templates'] = 'Ãœgyfél-Sablonok szerkesztése'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Új Viszonteladó'; $wb['Edit Reseller'] = 'Viszonteladók szerkesztése'; $wb['Resellers'] = 'Viszonteladók'; diff --git a/interface/web/client/lib/lang/id.lng b/interface/web/client/lib/lang/id.lng index 280dd4220a0b4c5fb2682c753f822ee5d57398b9..8459d168486f685f87af3f53bdb5ea38105d4826 100644 --- a/interface/web/client/lib/lang/id.lng +++ b/interface/web/client/lib/lang/id.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Batasan'; $wb['Add Client'] = 'Tambah Klien'; $wb['Edit Client'] = 'Sunting Klien'; $wb['Clients'] = 'Klien'; -$wb['Edit Client-Templates'] = 'Sunting Template Klien'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Tambah Reseller'; $wb['Edit Reseller'] = 'Sunting Reseller'; $wb['Resellers'] = 'Reseller'; diff --git a/interface/web/client/lib/lang/ja.lng b/interface/web/client/lib/lang/ja.lng index 716fc0779059276bb7f4f660b7de9b86c9e8b668..c0c097156f77787876dbefe83e9ca7c77a3073e2 100644 --- a/interface/web/client/lib/lang/ja.lng +++ b/interface/web/client/lib/lang/ja.lng @@ -5,7 +5,8 @@ $wb['Limits'] = '制é™'; $wb['Add Client'] = 'ã‚¯ãƒ©ã‚¤ã‚¢ãƒ³ãƒˆã‚’è¿½åŠ ã™ã‚‹'; $wb['Edit Client'] = 'クライアントを編集ã™ã‚‹'; $wb['Clients'] = 'クライアント'; -$wb['Edit Client-Templates'] = 'クライアントテンプレートを編集ã™ã‚‹'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'ãƒªã‚»ãƒ©ãƒ¼ã‚’è¿½åŠ ã™ã‚‹'; $wb['Edit Reseller'] = 'リセラーを編集ã™ã‚‹'; $wb['Resellers'] = 'リセラー'; diff --git a/interface/web/client/lib/lang/nl.lng b/interface/web/client/lib/lang/nl.lng index 75add75c08f68736ebb985b9acfec597d41e9cd5..2ebe3895be4e30fa6ade1db3ce6a895bad59e192 100644 --- a/interface/web/client/lib/lang/nl.lng +++ b/interface/web/client/lib/lang/nl.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limieten'; $wb['Add Client'] = 'Toevoegen klant'; $wb['Edit Client'] = 'Wijzigen klant'; $wb['Clients'] = 'klanten'; -$wb['Edit Client-Templates'] = 'Wijzig klant-template'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Toevoegen Reseller'; $wb['Edit Reseller'] = 'Wijzigen Reseller'; $wb['Resellers'] = 'Resellers'; diff --git a/interface/web/client/lib/lang/pl.lng b/interface/web/client/lib/lang/pl.lng index 272743515496a4347635abf786fe034f099529ea..12dc65ce96805ccf00b1b7dff0763706215b8f0a 100644 --- a/interface/web/client/lib/lang/pl.lng +++ b/interface/web/client/lib/lang/pl.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limity'; $wb['Add Client'] = 'Dodaj klienta'; $wb['Edit Client'] = 'Edytuj klienta'; $wb['Clients'] = 'Klienci'; -$wb['Edit Client-Templates'] = 'Edytuj szablony klientów'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Dodaj Resellera'; $wb['Edit Reseller'] = 'Edytuj Resellera'; $wb['Resellers'] = 'Resellerzy'; diff --git a/interface/web/client/lib/lang/pt.lng b/interface/web/client/lib/lang/pt.lng index 181ab88b3e4b846aa61da9e4c4eb1f3679a5f9b1..cd565699bc15898c209fd52d06f32a2f3b305698 100644 --- a/interface/web/client/lib/lang/pt.lng +++ b/interface/web/client/lib/lang/pt.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limites'; $wb['Add Client'] = 'Adicionar Cliente'; $wb['Edit Client'] = 'Editar Cliente'; $wb['Clients'] = 'Clientes'; -$wb['Edit Client-Templates'] = 'Editar Templates de Clientes'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Adicionar Revendedor'; $wb['Edit Reseller'] = 'Editar Revendedor'; $wb['Resellers'] = 'Revendedores'; diff --git a/interface/web/client/lib/lang/ro.lng b/interface/web/client/lib/lang/ro.lng index 88e0f8fa70499f443b98043a6795a8b66a22d5ff..bb03af82b7c55422ab8e4fea0184cfd2165935db 100644 --- a/interface/web/client/lib/lang/ro.lng +++ b/interface/web/client/lib/lang/ro.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits'; $wb['Add Client'] = 'Add Client'; $wb['Edit Client'] = 'Edit Client'; $wb['Clients'] = 'Clients'; -$wb['Edit Client-Templates'] = 'Edit Client-Templates'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Add Reseller'; $wb['Edit Reseller'] = 'Edit Reseller'; $wb['Resellers'] = 'Resellers'; diff --git a/interface/web/client/lib/lang/ru.lng b/interface/web/client/lib/lang/ru.lng index 5d37029047033191c2d9785f474b1369d40a3308..087e68b34559958f992ba074db7680b1608f1b2e 100644 --- a/interface/web/client/lib/lang/ru.lng +++ b/interface/web/client/lib/lang/ru.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Лимиты'; $wb['Add Client'] = 'Добавить клиента'; $wb['Edit Client'] = 'Изменить клиента'; $wb['Clients'] = 'Клиенты'; -$wb['Edit Client-Templates'] = 'Изменить шаблон клиента'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Добавить реÑеллера'; $wb['Edit Reseller'] = 'Изменить реÑеллера'; $wb['Resellers'] = 'РеÑеллеры'; diff --git a/interface/web/client/lib/lang/se.lng b/interface/web/client/lib/lang/se.lng index 88e0f8fa70499f443b98043a6795a8b66a22d5ff..bb03af82b7c55422ab8e4fea0184cfd2165935db 100644 --- a/interface/web/client/lib/lang/se.lng +++ b/interface/web/client/lib/lang/se.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits'; $wb['Add Client'] = 'Add Client'; $wb['Edit Client'] = 'Edit Client'; $wb['Clients'] = 'Clients'; -$wb['Edit Client-Templates'] = 'Edit Client-Templates'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Add Reseller'; $wb['Edit Reseller'] = 'Edit Reseller'; $wb['Resellers'] = 'Resellers'; diff --git a/interface/web/client/lib/lang/sk.lng b/interface/web/client/lib/lang/sk.lng index e9d300ceb027c870111e2e0b0cab24fbe2a82e24..6351f3d90511f0f58f7a876887c537119a21ca3d 100644 --- a/interface/web/client/lib/lang/sk.lng +++ b/interface/web/client/lib/lang/sk.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limity'; $wb['Add Client'] = 'PridaÅ¥ klienta'; $wb['Edit Client'] = 'UpraviÅ¥ klienta'; $wb['Clients'] = 'Klienti'; -$wb['Edit Client-Templates'] = 'UpraviÅ¥ klient-Å ablónu'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'PridaÅ¥ nového predajcu'; $wb['Edit Reseller'] = 'UpraviÅ¥ predajcu'; $wb['Resellers'] = 'Predajcovia'; diff --git a/interface/web/client/lib/lang/tr.lng b/interface/web/client/lib/lang/tr.lng index 96dd7a0ac0ab7ff33791da53d8f8c0d527b1619d..8a98a13a96d9bbd212c846ed72a19eb46eb7866e 100644 --- a/interface/web/client/lib/lang/tr.lng +++ b/interface/web/client/lib/lang/tr.lng @@ -5,7 +5,8 @@ $wb['Limits'] = 'Limitler'; $wb['Add Client'] = 'Müşteri Ekle'; $wb['Edit Client'] = 'Müşteri Düzenle'; $wb['Clients'] = 'Müşteriler'; -$wb['Edit Client-Templates'] = 'Müşteri-Åžablon Düzenle'; +$wb['Templates'] = 'Templates'; +$wb['Limit-Templates'] = 'Limit-Templates'; $wb['Add Reseller'] = 'Reseller Ekle'; $wb['Edit Reseller'] = 'Reseller Düzenle'; $wb['Resellers'] = 'Resellerlar'; diff --git a/interface/web/client/lib/module.conf.php b/interface/web/client/lib/module.conf.php index bfb6ac80ddea1ede6d68f0354cce5e500f5b581c..e4bddd72f292e8c6738175c9c61d84449a17bf96 100644 --- a/interface/web/client/lib/module.conf.php +++ b/interface/web/client/lib/module.conf.php @@ -17,13 +17,6 @@ $items[] = array( 'title' => "Add Client", 'link' => 'client/client_edit.php', 'html_id' => 'client_add'); -if($_SESSION["s"]["user"]["typ"] == 'admin'){ - $items[] = array( 'title' => "Edit Client-Templates", - 'target' => 'content', - 'link' => 'client/client_template_list.php', - 'html_id' => 'client_template_list'); -} - $module["nav"][] = array( 'title' => 'Clients', 'open' => 1, 'items' => $items); @@ -66,6 +59,24 @@ $module["nav"][] = array( 'title' => 'Messaging', unset($items); + +$items[] = array( 'title' => "Limit-Templates", + 'target' => 'content', + 'link' => 'client/client_template_list.php', + 'html_id' => 'client_template_list'); + +$items[] = array( 'title' => "Email-Templates", + 'target' => 'content', + 'link' => 'client/message_template_list.php', + 'html_id' => 'message_template_list'); + +$module["nav"][] = array( 'title' => 'Templates', + 'open' => 1, + 'items' => $items); + +unset($items); + + $app->uses('ini_parser,getconf'); $settings = $app->getconf->get_global_config('domains'); diff --git a/interface/web/client/list/message_template.list.php b/interface/web/client/list/message_template.list.php new file mode 100644 index 0000000000000000000000000000000000000000..6441182b91bcfaafa57461cb016fcc774d1fffff --- /dev/null +++ b/interface/web/client/list/message_template.list.php @@ -0,0 +1,77 @@ +<?php + +/* +Copyright (c) 2010, Till Brehm, projektfarm Gmbh +All rights reserved. +*/ + +/* + Datatypes: + - INTEGER + - DOUBLE + - CURRENCY + - VARCHAR + - TEXT + - DATE +*/ + + + +// Name of the list +$liste["name"] = "client_message_template"; + +// Database table +$liste["table"] = "client_message_template"; + +// Index index field of the database table +$liste["table_idx"] = "client_message_template_id"; + +// Search Field Prefix +$liste["search_prefix"] = "search_"; + +// Records per page +$liste["records_per_page"] = 15; + +// Script File of the list +$liste["file"] = "message_template_list.php"; + +// Script file of the edit form +$liste["edit_file"] = "message_template_edit.php"; + +// Script File of the delete script +$liste["delete_file"] = "message_template_del.php"; + +// Paging Template +$liste["paging_tpl"] = "templates/paging.tpl.htm"; + +// Enable authe +$liste["auth"] = "yes"; + + +/***************************************************** +* Suchfelder +*****************************************************/ + +$liste["item"][] = array( 'field' => "template_type", + 'datatype' => "VARCHAR", + 'formtype' => "SELECT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => array('welcome' => 'Default welcome email', 'other' => 'Other')); + +$liste["item"][] = array( 'field' => "template_name", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + + + + + +?> diff --git a/interface/web/client/message_template_del.php b/interface/web/client/message_template_del.php new file mode 100644 index 0000000000000000000000000000000000000000..46aba4f64c3cf21c69669d7d4b51629c0c76311e --- /dev/null +++ b/interface/web/client/message_template_del.php @@ -0,0 +1,58 @@ +<?php + +/* +Copyright (c) 2014 Till Brehm, ISPConfig UG +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of ISPConfig nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/****************************************** +* Begin Form configuration +******************************************/ + +$list_def_file = "list/message_template.list.php"; +$tform_def_file = "form/message_template.tform.php"; + +/****************************************** +* End Form configuration +******************************************/ + +require_once '../../lib/config.inc.php'; +require_once '../../lib/app.inc.php'; + +//* Check permissions for module +$app->auth->check_module_permissions('client'); + +$app->uses('tpl,tform'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + +} + +$page = new page_action; +$page->onDelete() + +?> diff --git a/interface/web/client/message_template_edit.php b/interface/web/client/message_template_edit.php new file mode 100644 index 0000000000000000000000000000000000000000..819e267657aab3c753984138b8512f4993d0ef20 --- /dev/null +++ b/interface/web/client/message_template_edit.php @@ -0,0 +1,99 @@ +<?php +/* +Copyright (c) 2014 Till Brehm, ISPConfig UG +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of ISPConfig nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +/****************************************** +* Begin Form configuration +******************************************/ + +$tform_def_file = "form/message_template.tform.php"; + +/****************************************** +* End Form configuration +******************************************/ + +require_once '../../lib/config.inc.php'; +require_once '../../lib/app.inc.php'; + +//* Check permissions for module +$app->auth->check_module_permissions('client'); + +// Loading classes +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + function onSubmit() { + global $app, $conf; + + // Check for duplicates + if($this->dataRecord['template_type'] == 'welcome') { + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $sql = "SELECT count(client_message_template_id) as number FROM client_message_template WHERE template_type = 'welcome' AND sys_groupid = ".$client_group_id; + if($this->id > 0) { + $sql .= " AND client_message_template_id != ".$this->id; + } + + $tmp = $app->db->queryOneRecord($sql); + if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng('duplicate_welcome_error'); + } + + parent::onSubmit(); + } + + function onShowEnd() { + global $app, $conf; + + //message variables + $message_variables = ''; + $sql = "SHOW COLUMNS FROM client WHERE Field NOT IN ('client_id', 'sys_userid', 'sys_groupid', 'sys_perm_user', 'sys_perm_group', 'sys_perm_other', 'parent_client_id', 'id_rsa', 'ssh_rsa', 'created_at', 'default_mailserver', 'default_webserver', 'web_php_options', 'ssh_chroot', 'default_dnsserver', 'default_dbserver', 'template_master', 'template_additional', 'force_suexec', 'default_slave_dnsserver', 'usertheme', 'locked', 'canceled', 'can_use_api', 'tmp_data', 'customer_no_template', 'customer_no_start', 'customer_no_counter', 'added_date', 'added_by') AND Field NOT LIKE 'limit_%'"; + $field_names = $app->db->queryAllRecords($sql); + if(!empty($field_names) && is_array($field_names)){ + foreach($field_names as $field_name){ + if($field_name['Field'] != ''){ + if($field_name['Field'] == 'gender'){ + $message_variables .= '<a href="javascript:void(0);" class="addPlaceholder">{salutation}</a> '; + } else { + $message_variables .= '<a href="javascript:void(0);" class="addPlaceholder">{'.$field_name['Field'].'}</a> '; + } + } + } + } + $app->tpl->setVar('message_variables', trim($message_variables)); + + parent::onShowEnd(); + } + +} + +$page = new page_action; +$page->onLoad(); + +?> diff --git a/interface/web/client/message_template_list.php b/interface/web/client/message_template_list.php new file mode 100644 index 0000000000000000000000000000000000000000..a324732ed0a236803d1fa05cbb2951399b71f99e --- /dev/null +++ b/interface/web/client/message_template_list.php @@ -0,0 +1,53 @@ +<?php +/* +Copyright (c) 2014 Till Brehm, ISPConfig UG +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of ISPConfig nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +require_once '../../lib/config.inc.php'; +require_once '../../lib/app.inc.php'; + +/****************************************** +* Begin Form configuration +******************************************/ + +$list_def_file = "list/message_template.list.php"; + +/****************************************** +* End Form configuration +******************************************/ + +//* Check permissions for module +$app->auth->check_module_permissions('client'); + +$app->uses('listform_actions'); + +//$app->listform_actions->SQLOrderBy = 'ORDER BY company_name, contact_name, client_id'; +//$app->listform_actions->SQLExtWhere = "limit_client = 0"; +$app->listform_actions->onLoad(); + + +?> diff --git a/interface/web/client/reseller_edit.php b/interface/web/client/reseller_edit.php index f9828569a6d257bc2b6fb48112261af623058b9f..4a7cc874077c524334e7438585536e9d8c9c75d1 100644 --- a/interface/web/client/reseller_edit.php +++ b/interface/web/client/reseller_edit.php @@ -94,6 +94,26 @@ class page_action extends tform_actions { } } } + + if($this->id != 0) { + $this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $this->id); + if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) { + // check previous type of storing templates + $tpls = explode('/', $this->oldDataRecord['template_additional']); + $this->oldTemplatesAssigned = array(); + foreach($tpls as $item) { + $item = trim($item); + if(!$item) continue; + $this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $this->id); + } + unset($tpls); + } + } else { + $this->oldTemplatesAssigned = array(); + } + + $this->_template_additional = explode('/', $this->dataRecord['template_additional']); + $this->dataRecord['template_additional'] = ''; parent::onSubmit(); } @@ -117,13 +137,27 @@ class page_action extends tform_actions { $result = $app->db->queryAllRecords('SELECT assigned_template_id, client_template_id FROM client_template_assigned WHERE client_id = ' . $this->id); if($result && count($result) > 0) { // new style + $items = array(); $text = ''; foreach($result as $item){ if (trim($item['client_template_id']) != ''){ if ($text != '') $text .= ''; - $text .= '<li rel="' . $item['assigned_template_id'] . '">' . $tpl[$item['client_template_id']]. '<a href="#" class="button icons16 icoDelete"></a></li>'; + $text .= '<li rel="' . $item['assigned_template_id'] . '">' . $tpl[$item['client_template_id']]; + $text .= '<a href="#" class="button icons16 icoDelete"></a>'; + $tmp = new stdClass(); + $tmp->id = $item['assigned_template_id']; + $tmp->data = ''; + $app->plugin->raiseEvent('get_client_template_details', $tmp); + if($tmp->data != '') $text .= '<br /><em>' . $tmp->data . '</em>'; + + $text .= '</li>'; + $items[] = $item['assigned_template_id'] . ':' . $item['client_template_id']; } } + + $tmprec = $app->tform->getHTML(array('template_additional' => implode('/', $items)), $this->active_tab, 'EDIT'); + $app->tpl->setVar('template_additional', $tmprec['template_additional']); + unset($tmprec); } else { // old style $sql = "SELECT template_additional FROM client WHERE client_id = " . $this->id; @@ -139,6 +173,7 @@ class page_action extends tform_actions { } $app->tpl->setVar('template_additional_list', $text); + $app->tpl->setVar('app_module', 'client'); //* Set the 'customer no' default value if($this->id == 0) { @@ -153,9 +188,11 @@ class page_action extends tform_actions { $app->tpl->setVar('customer_no',$customer_no_string); //* save new counter value + /* $system_config['misc']['customer_no_counter']++; $system_config_str = $app->ini_parser->get_ini_string($system_config); $app->db->datalogUpdate('sys_ini', "config = '".$app->db->quote($system_config_str)."'", 'sysini_id', 1); + */ } } @@ -210,6 +247,66 @@ class page_action extends tform_actions { $sql = "UPDATE client SET default_mailserver = $default_mailserver, default_webserver = $default_webserver, default_dnsserver = $default_dnsserver, default_slave_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id; $app->db->query($sql); + + if(isset($this->dataRecord['template_master'])) { + $app->uses('client_templates'); + $app->client_templates->update_client_templates($this->id, $this->_template_additional); + } + + if($this->dataRecord['customer_no'] == $this->dataRecord['customer_no_org']) { + //* get the system config + $app->uses('getconf'); + $system_config = $app->getconf->get_global_config(); + if($system_config['misc']['customer_no_template'] != '') { + + //* save new counter value + $system_config['misc']['customer_no_counter']++; + $system_config_str = $app->ini_parser->get_ini_string($system_config); + $app->db->datalogUpdate('sys_ini', "config = '".$app->db->quote($system_config_str)."'", 'sysini_id', 1); + + } + } + + //* Send welcome email + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $sql = "SELECT * FROM client_message_template WHERE template_type = 'welcome' AND sys_groupid = ".$client_group_id; + $email_template = $app->db->queryOneRecord($sql); + $client = $app->tform->getDataRecord($this->id); + + if(is_array($email_template) && $client['email'] != '') { + //* Parse client details into message + $message = $email_template['message']; + $subject = $email_template['subject']; + foreach($client as $key => $val) { + switch ($key) { + case 'password': + $message = str_replace('{password}', $this->dataRecord['password'], $message); + $subject = str_replace('{password}', $this->dataRecord['password'], $subject); + break; + case 'gender': + $message = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $message); + $subject = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $subject); + break; + default: + $message = str_replace('{'.$key.'}', $val, $message); + $subject = str_replace('{'.$key.'}', $val, $subject); + } + } + + //* Get sender address + if($app->auth->is_admin()) { + $app->uses('getconf'); + $system_config = $app->getconf->get_global_config(); + $from = $system_config['admin_mail']; + } else { + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $reseller = $app->db->queryOneRecord("SELECT client.email FROM sys_group,client WHERE client.client_id = sys_group.client_id and sys_group.groupid = ".$client_group_id); + $from = $reseller["email"]; + } + + //* Send the email + $app->functions->mail($client['email'], $subject, $message, $from); + } parent::onAfterInsert(); } @@ -272,6 +369,11 @@ class page_action extends tform_actions { $sql = "UPDATE sys_user SET modules = '$modules' WHERE client_id = $client_id"; $app->db->query($sql); } + + if(isset($this->dataRecord['template_master'])) { + $app->uses('client_templates'); + $app->client_templates->update_client_templates($this->id, $this->_template_additional); + } parent::onAfterUpdate(); } diff --git a/interface/web/client/templates/client_edit_address.htm b/interface/web/client/templates/client_edit_address.htm index 839282072e05e8503b853ca9ce4c4c50e5446614..6149a42d71ab1d7cea4f1e47571e5ee6ff7994de 100644 --- a/interface/web/client/templates/client_edit_address.htm +++ b/interface/web/client/templates/client_edit_address.htm @@ -22,6 +22,7 @@ <div class="ctrlHolder"> <label for="customer_no">{tmpl_var name='customer_no_txt'}</label> <input name="customer_no" id="customer_no" value="{tmpl_var name='customer_no'}" size="30" maxlength="255" type="text" class="textInput" /> + <input name="customer_no_org" id="customer_no_org" value="{tmpl_var name='customer_no'}" type="hidden" /> </div> <div class="ctrlHolder"> <label for="username">{tmpl_var name='username_txt'}*</label> diff --git a/interface/web/client/templates/client_edit_limits.htm b/interface/web/client/templates/client_edit_limits.htm index 05ceb6367f14ea46debb15a796a4b905784e33c7..c97e03f53e225366f0477ebb9f9cd85d0a9f51d8 100644 --- a/interface/web/client/templates/client_edit_limits.htm +++ b/interface/web/client/templates/client_edit_limits.htm @@ -3,7 +3,6 @@ <div class="panel panel_client"> - <tmpl_if name="is_admin"> <div class="pnl_toolsarea"> <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend> <div class="buttons topbuttons"> @@ -11,11 +10,9 @@ </div> </fieldset> </div> - </tmpl_if> <div class="pnl_formsarea"> <fieldset class="inlineLabels"><legend>Limits</legend> - <tmpl_if name="is_admin"> <div class="ctrlHolder"> <label for="template_master">{tmpl_var name='template_master_txt'}</label> <select name="template_master" id="template_master" class="selectInput"> @@ -40,7 +37,14 @@ <div class="ctrlHolder"> </div> - </tmpl_if> + <tmpl_if name="is_admin"> + <div class="ctrlHolder"> + <label for="parent_client_id_id">{tmpl_var name='parent_client_id_txt'}</label> + <select name="parent_client_id" id="parent_client_id" class="selectInput"> + {tmpl_var name='parent_client_id'} + </select> + </div> + </tmpl_if> <div class="subsectiontoggle"><span class="showing"></span>{tmpl_var name='web_limits_txt'}<em class="showing"></em></div> <div> <div class="ctrlHolder"> @@ -301,7 +305,7 @@ </div> </div> -<tmpl_if name="is_admin"> + <script type="text/javascript"> <!-- function custom_template_selected() { @@ -317,7 +321,7 @@ jQuery('div.panel_client') .find('div.pnl_formsarea') .find('fieldset') .find('input,select,button') - .not('#template_master,#template_additional,#default_mailserver,#default_webserver,#default_dbserver,#default_dnsserver,#default_slave_dnsserver') + .not('#template_master,#template_additional,#default_mailserver,#default_webserver,#default_dbserver,#default_dnsserver,#default_slave_dnsserver,#customer_no_template,#customer_no_start,#customer_no_counter,#parent_client_id') .click(function(e) { if(custom_template_selected()) return true; e.preventDefault(); @@ -330,4 +334,3 @@ jQuery('div.panel_client') //--> </script> -</tmpl_if> \ No newline at end of file diff --git a/interface/web/client/templates/client_message_template_list.htm b/interface/web/client/templates/client_message_template_list.htm new file mode 100644 index 0000000000000000000000000000000000000000..95f6f00bd0c1c11021dfa56f79c4b42cb50f02fe --- /dev/null +++ b/interface/web/client/templates/client_message_template_list.htm @@ -0,0 +1,57 @@ +<h2><tmpl_var name="list_head_txt"></h2> + +<div class="panel panel_list_client_message_template"> + + <div class="pnl_toolsarea"> + <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend> + <div class="buttons"> + <button class="iconstxt icoAdd" type="button" onclick="loadContent('client/message_template_edit.php');"> + <span>{tmpl_var name="add_new_record_txt"}</span> + </button> + </div> + </fieldset> + </div> + + <div class="pnl_listarea"> + <fieldset><legend><tmpl_var name="list_head_txt"></legend> + <table class="list"> + <thead> + <tr> + <th class="tbl_col_template_type" scope="col"><tmpl_var name="template_type_txt"></th> + <th class="tbl_col_template_name" scope="col"><tmpl_var name="template_name_txt"></th> + <th class="tbl_col_buttons" scope="col"> </th> + </tr> + <tr> + <td class="tbl_col_template_type"><select name="search_template_type" onChange="submitForm('pageForm','client/message_template_list.php');">{tmpl_var name='search_template_type'}</select></td> + <td class="tbl_col_template_name"><input type="text" name="search_template_name" value="{tmpl_var name='search_template_name'}" /></td> + <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onclick="submitForm('pageForm','client/message_template_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td> + </tr> + </thead> + <tbody> + <tmpl_loop name="records"> + <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> + <td class="tbl_col_template_type"><a href="#" onclick="loadContent('client/message_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_type"}</a></td> + <td class="tbl_col_template_name"><a href="#" onclick="loadContent('client/message_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_name"}</a></td> + <td class="tbl_col_buttons"> + <div class="buttons icons16"> + <a class="button icons16 icoDelete" href="javascript: del_record('client/message_template_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a> + </div> + </td> + </tr> + </tmpl_loop> + <tmpl_unless name="records"> + <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> + <td colspan="2">{tmpl_var name='globalsearch_noresults_text_txt'}</td> + </tr> + </tmpl_unless> + </tbody> + <tfoot> + <tr> + <td class="tbl_footer tbl_paging" colspan="3"><tmpl_var name="paging"></td> + </tr> + </tfoot> + </table> + </fieldset> + </div> + +</div> diff --git a/interface/web/client/templates/client_template_edit_limits.htm b/interface/web/client/templates/client_template_edit_limits.htm index 18abc9b39757e0ebbf94ee34bb7ee3c0ca308695..1eea39900407dba216fc2f6761236cbd7012316a 100644 --- a/interface/web/client/templates/client_template_edit_limits.htm +++ b/interface/web/client/templates/client_template_edit_limits.htm @@ -5,7 +5,7 @@ <div class="pnl_formsarea"> <fieldset class="inlineLabels"><legend>Limits</legend> - <div class="subsectiontoggle"><span class="showing"></span>{tmpl_var name='web_limits_txt'}<em class="showing"></em></div> + <div class="subsectiontoggle"><span class="showing"></span>{tmpl_var name='web_limits_txt'}<em class="showing"></em></div> <div> <div class="ctrlHolder"> <label for="limit_web_domain">{tmpl_var name='limit_web_domain_txt'}</label> @@ -224,6 +224,19 @@ <input name="limit_aps" id="limit_aps" value="{tmpl_var name='limit_aps'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" /> </div> </div> + <tmpl_if name="is_admin"> + <div class="subsectiontoggle"><span></span>{tmpl_var name='client_limits_txt'}<em></em></div> + <div style="display:none;"> + <div class="ctrlHolder"> + <label for="limit_client">{tmpl_var name='limit_client_txt'}</label> + <input name="limit_client" id="limit_client" value="{tmpl_var name='limit_client'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" /> + </div> + <div class="ctrlHolder"> + <label for="limit_domainmodule">{tmpl_var name='limit_domainmodule_txt'}</label> + <input name="limit_domainmodule" id="limit_domainmodule" value="{tmpl_var name='limit_domainmodule'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" /> + </div> + </div> + </tmpl_if> </fieldset> <input type="hidden" name="id" value="{tmpl_var name='id'}"> diff --git a/interface/web/client/templates/domain_list.htm b/interface/web/client/templates/domain_list.htm index bd8f8be4136b689837fa84633149d00822a6624b..3100660896b877df92d90c3908fc88813c7ccc17 100644 --- a/interface/web/client/templates/domain_list.htm +++ b/interface/web/client/templates/domain_list.htm @@ -6,15 +6,9 @@ <div class="pnl_toolsarea"> <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend> <div class="buttons"> - <tmpl_if name="is_admin"> <button class="button iconstxt icoAdd" type="button" onclick="loadContent('client/domain_edit.php');"> <span>{tmpl_var name="add_new_record_txt"}</span> </button> - <tmpl_else> - <button class="button iconstxt icoAdd" type="button" onclick="loadContent('client/domain_new_client.php');"> - <span>{tmpl_var name="add_new_record_txt"}</span> - </button> - </tmpl_if> </div> </fieldset> </div> diff --git a/interface/web/client/templates/message_template.htm b/interface/web/client/templates/message_template.htm new file mode 100644 index 0000000000000000000000000000000000000000..4c0c6231623c2180028c877a2534c5f2b92fc64f --- /dev/null +++ b/interface/web/client/templates/message_template.htm @@ -0,0 +1,39 @@ +<h2><tmpl_var name="list_head_txt"></h2> +<p><tmpl_var name="list_desc_txt"></p> + +<div class="panel panel_invoice_message_template"> + + <div class="pnl_formsarea"> + <fieldset class="inlineLabels"><legend>Settings</legend> + <div class="ctrlHolder"> + <label for="template_type">{tmpl_var name='template_type_txt'}</label> + <select name="template_type" id="template_type" class="selectInput"> + {tmpl_var name='template_type'} + </select> + </div> + <div class="ctrlHolder"> + <label for="template_name">{tmpl_var name='template_name_txt'}</label> + <input name="template_name" id="template_name" value="{tmpl_var name='template_name'}" size="30" maxlength="255" type="text" class="textInput" /> + </div> + <div class="ctrlHolder"> + <label for="subject">{tmpl_var name='subject_txt'}</label> + <input name="subject" id="subject" value="{tmpl_var name='subject'}" style="width:500px" size="30" maxlength="255" type="text" class="textInput" /> + <br clear="all">{tmpl_var name='variables_txt'}: {tmpl_var name="message_variables"} <br />{tmpl_var name='variables_description_txt'} + </div> + <div class="ctrlHolder"> + <label for="message">{tmpl_var name='message_txt'}</label> + <textarea name="message" id="message" rows='' cols='' style="width:500px">{tmpl_var name='message'}</textarea> + <br clear="all">{tmpl_var name='variables_txt'}: {tmpl_var name="message_variables"} <br />{tmpl_var name='variables_description_txt'} + </div> + <div class="buttonHolder buttons"> + <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','client/message_template_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button> + <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('client/message_template_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> + </div> + </fieldset> + + <input type="hidden" name="id" value="{tmpl_var name='id'}"> + + + </div> + +</div> diff --git a/interface/web/client/templates/message_template_list.htm b/interface/web/client/templates/message_template_list.htm new file mode 100644 index 0000000000000000000000000000000000000000..27b0113df4d68d30d2675ca3f43a0ce0c3b5d088 --- /dev/null +++ b/interface/web/client/templates/message_template_list.htm @@ -0,0 +1,52 @@ +<h2><tmpl_var name="list_head_txt"></h2> + +<div class="panel panel_list_invoice_message_template"> + + <div class="pnl_toolsarea"> + <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend> + <div class="buttons"> + <button class="iconstxt icoAdd" type="button" onClick="loadContent('billing/invoice_message_template_edit.php');"> + <span>{tmpl_var name="add_new_record_txt"}</span> + </button> + </div> + </fieldset> + </div> + + <div class="pnl_listarea"> + <fieldset><legend><tmpl_var name="list_head_txt"></legend> + <table class="list"> + <thead> + <tr> + <th class="tbl_col_template_type" scope="col"><tmpl_var name="template_type_txt"></th> + <th class="tbl_col_template_name" scope="col"><tmpl_var name="template_name_txt"></th> + <th class="tbl_col_buttons" scope="col"> </th> + </tr> + <tr> + <td class="tbl_col_template_type"><select name="search_template_type" onChange="submitForm('pageForm','billing/invoice_message_template_list.php');">{tmpl_var name='search_template_type'}</select></td> + <td class="tbl_col_template_name"><input type="text" name="search_template_name" value="{tmpl_var name='search_template_name'}" /></td> + <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','billing/invoice_message_template_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td> + </tr> + </thead> + <tbody> + <tmpl_loop name="records"> + <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> + <td class="tbl_col_template_type"><a href="#" onClick="loadContent('billing/invoice_message_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_type"}</a></td> + <td class="tbl_col_template_name"><a href="#" onClick="loadContent('billing/invoice_message_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_name"}</a></td> + <td class="tbl_col_buttons"> + <div class="buttons icons16"> + <a class="button icons16 icoDelete" href="javascript: del_record('billing/invoice_message_template_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a> + </div> + </td> + </tr> + </tmpl_loop> + </tbody> + <tfoot> + <tr> + <td class="tbl_footer tbl_paging" colspan="3"><tmpl_var name="paging"></td> + </tr> + </tfoot> + </table> + </fieldset> + </div> + +</div> diff --git a/interface/web/client/templates/reseller_edit_address.htm b/interface/web/client/templates/reseller_edit_address.htm index 86acccd822926a0dc6ce331a49f4cd9d1701565e..5495d0adc78f1b5ee47044460107853b192efc07 100644 --- a/interface/web/client/templates/reseller_edit_address.htm +++ b/interface/web/client/templates/reseller_edit_address.htm @@ -22,6 +22,7 @@ <div class="ctrlHolder"> <label for="customer_no">{tmpl_var name='customer_no_txt'}</label> <input name="customer_no" id="customer_no" value="{tmpl_var name='customer_no'}" size="30" maxlength="255" type="text" class="textInput" /> + <input name="customer_no_org" id="customer_no_org" value="{tmpl_var name='customer_no'}" type="hidden" /> </div> <div class="ctrlHolder"> <label for="username">{tmpl_var name='username_txt'}*</label> diff --git a/interface/web/client/templates/reseller_edit_limits.htm b/interface/web/client/templates/reseller_edit_limits.htm index e12726e3a971296fa3bee8a9e1567d8af653d359..d5ff205384c036d90b350625bef16c67d2b8f86a 100644 --- a/interface/web/client/templates/reseller_edit_limits.htm +++ b/interface/web/client/templates/reseller_edit_limits.htm @@ -3,33 +3,44 @@ <div class="panel panel_client"> + <tmpl_if name="is_admin"> + <div class="pnl_toolsarea"> + <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend> + <div class="buttons topbuttons"> + <button class="positive iconstxt icoAdd" type="button" value="{tmpl_var name='add_additional_template_txt'}" onclick="addAdditionalTemplate();"><span>{tmpl_var name='add_additional_template_txt'}</span></button> + </div> + </fieldset> + </div> + </tmpl_if> + <div class="pnl_formsarea"> <fieldset class="inlineLabels"><legend>Limits</legend> - <!-- - <tmpl_if name="is_admin"> - <div class="ctrlHolder"> + <tmpl_if name="is_admin"> + <div class="ctrlHolder"> <label for="template_master">{tmpl_var name='template_master_txt'}</label> <select name="template_master" id="template_master" class="selectInput"> - {tmpl_var name='template_master'} - </select> - </div> - <div class="ctrlHolder"> + {tmpl_var name='template_master'} + </select> + </div> + <div class="ctrlHolder"> <label for="template_additional">{tmpl_var name='template_additional_txt'}</label> <select name="tpl_add_select" id="tpl_add_select" class="selectInput"> - {tmpl_var name='tpl_add_select'} - </select> - <span id="template_additional_list">{tmpl_var name='template_additional_list'}</span> - <input type="hidden" id="template_additional" name="template_additional" value="{tmpl_var name='template_additional'}"> - </div> - <div class="ctrlHolder"> - - </div> + {tmpl_var name='tpl_add_select'} + </select> + </div> + <div class="ctrlHolder"> + <p class="label">{tmpl_var name='active_template_additional_txt'}</p> + <div id="template_additional_list" class="multiField"> + <ul> + {tmpl_var name='template_additional_list'} + </ul> + </div> + <input type="hidden" id="template_additional" name="template_additional" value="{tmpl_var name='template_additional'}"> + </div> + <div class="ctrlHolder"> + + </div> </tmpl_if> - --> - <div class="ctrlHolder"> - <label for="limit_client">{tmpl_var name='limit_client_txt'}</label> - <input name="limit_client" id="limit_client" value="{tmpl_var name='limit_client'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" /> - </div> <div class="ctrlHolder"> <label for="customer_no_template">{tmpl_var name='customer_no_template_txt'}</label> <input name="customer_no_template" id="customer_no_template" value="{tmpl_var name='customer_no_template'}" size="30" maxlength="255" type="text" class="textInput formLengthHalf" /> @@ -291,6 +302,17 @@ <input name="limit_aps" id="limit_aps" value="{tmpl_var name='limit_aps'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" /> </div> </div> + <div class="subsectiontoggle"><span></span>{tmpl_var name='client_limits_txt'}<em></em></div> + <div style="display:none;"> + <div class="ctrlHolder"> + <label for="limit_client">{tmpl_var name='limit_client_txt'}</label> + <input name="limit_client" id="limit_client" value="{tmpl_var name='limit_client'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" /> + </div> + <div class="ctrlHolder"> + <label for="limit_domainmodule">{tmpl_var name='limit_domainmodule_txt'}</label> + <input name="limit_domainmodule" id="limit_domainmodule" value="{tmpl_var name='limit_domainmodule'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" /> + </div> + </div> </fieldset> <input type="hidden" name="id" value="{tmpl_var name='id'}"> @@ -301,4 +323,34 @@ </div> </div> -</div> \ No newline at end of file +</div> +<tmpl_if name="is_admin"> +<script type="text/javascript"> +<!-- +function custom_template_selected() { + return ($('#template_master').val() == '0' ? true : false); +} + +jQuery('#template_additional_list').find('li > a').click(function(e) { + e.preventDefault(); + delAdditionalTemplate($(this).parent().attr('rel')); +}); + +jQuery('div.panel_client') + .find('div.pnl_formsarea') + .find('fieldset') + .find('input,select,button') + .not('#template_master,#template_additional,#default_mailserver,#default_webserver,#default_dbserver,#default_dnsserver,#default_slave_dnsserver,#customer_no_template,#customer_no_start,#customer_no_counter') + .click(function(e) { + if(custom_template_selected()) return true; + e.preventDefault(); + alert('{tmpl_var name="err_msg_master_tpl_set"}'); + }) + .focus(function() { + if(custom_template_selected()) return true; + $(this).blur(); + }); + +//--> +</script> +</tmpl_if> diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php index 139c971a251d32bccb6c8f913a9f709ac91b742b..22493515bbffe9680c5cbfa250f8791f66dd3592 100644 --- a/interface/web/sites/database_edit.php +++ b/interface/web/sites/database_edit.php @@ -302,7 +302,26 @@ class page_action extends tform_actions { } } } - + + if ($app->tform->errorMessage == '') { + // force update of the used database user + if($this->dataRecord['database_user_id']) { + $user_old_rec = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user_id` = ' . $app->functions->intval($this->dataRecord['database_user_id'])); + if($user_old_rec) { + $user_new_rec = $user_old_rec; + $user_new_rec['server_id'] = $this->dataRecord['server_id']; + $app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->dataRecord['database_user_id'], $user_old_rec, $user_new_rec); + } + } + if($this->dataRecord['database_ro_user_id']) { + $user_old_rec = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user_id` = ' . $app->functions->intval($this->dataRecord['database_ro_user_id'])); + if($user_old_rec) { + $user_new_rec = $user_old_rec; + $user_new_rec['server_id'] = $this->dataRecord['server_id']; + $app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->dataRecord['database_ro_user_id'], $user_old_rec, $user_new_rec); + } + } + } parent::onBeforeUpdate(); } @@ -371,6 +390,27 @@ class page_action extends tform_actions { } } + if ($app->tform->errorMessage == '') { + // force update of the used database user + if($this->dataRecord['database_user_id']) { + $user_old_rec = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user_id` = ' . $app->functions->intval($this->dataRecord['database_user_id'])); + if($user_old_rec) { + $user_new_rec = $user_old_rec; + $user_new_rec['server_id'] = $this->dataRecord['server_id']; + $app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->dataRecord['database_user_id'], $user_old_rec, $user_new_rec); + } + } + if($this->dataRecord['database_ro_user_id']) { + $user_old_rec = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user_id` = ' . $app->functions->intval($this->dataRecord['database_ro_user_id'])); + if($user_old_rec) { + $user_new_rec = $user_old_rec; + $user_new_rec['server_id'] = $this->dataRecord['server_id']; + $app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->dataRecord['database_ro_user_id'], $user_old_rec, $user_new_rec); + } + } + } + + parent::onBeforeInsert(); } diff --git a/interface/web/sites/templates/web_domain_advanced.htm b/interface/web/sites/templates/web_domain_advanced.htm index 0afe57a717f4dd3eb9fd7c68e91fb993cf6aa118..3a634e13dd0dea4e704692fc8b876dd4facdcace 100644 --- a/interface/web/sites/templates/web_domain_advanced.htm +++ b/interface/web/sites/templates/web_domain_advanced.htm @@ -55,27 +55,27 @@ </div> <div class="ctrlHolder"> <label for="pm_max_children">{tmpl_var name='pm_max_children_txt'}</label> - <input name="pm_max_children" id="pm_max_children" value="{tmpl_var name='pm_max_children'}" size="3" maxlength="3" type="text" class="textInput formLengthLimit" /> + <input name="pm_max_children" id="pm_max_children" value="{tmpl_var name='pm_max_children'}" size="6" maxlength="6" type="text" class="textInput formLengthLimit" /> </div> <div class="ctrlHolder pm_dynamic"> <label for="pm_start_servers">{tmpl_var name='pm_start_servers_txt'}</label> - <input name="pm_start_servers" id="pm_start_servers" value="{tmpl_var name='pm_start_servers'}" size="3" maxlength="3" type="text" class="textInput formLengthLimit" /> + <input name="pm_start_servers" id="pm_start_servers" value="{tmpl_var name='pm_start_servers'}" size="6" maxlength="6" type="text" class="textInput formLengthLimit" /> </div> <div class="ctrlHolder pm_dynamic"> <label for="pm_min_spare_servers">{tmpl_var name='pm_min_spare_servers_txt'}</label> - <input name="pm_min_spare_servers" id="pm_min_spare_servers" value="{tmpl_var name='pm_min_spare_servers'}" size="3" maxlength="3" type="text" class="textInput formLengthLimit" /> + <input name="pm_min_spare_servers" id="pm_min_spare_servers" value="{tmpl_var name='pm_min_spare_servers'}" size="6" maxlength="6" type="text" class="textInput formLengthLimit" /> </div> <div class="ctrlHolder pm_dynamic"> <label for="pm_max_spare_servers">{tmpl_var name='pm_max_spare_servers_txt'}</label> - <input name="pm_max_spare_servers" id="pm_max_spare_servers" value="{tmpl_var name='pm_max_spare_servers'}" size="3" maxlength="3" type="text" class="textInput formLengthLimit" /> + <input name="pm_max_spare_servers" id="pm_max_spare_servers" value="{tmpl_var name='pm_max_spare_servers'}" size="6" maxlength="6" type="text" class="textInput formLengthLimit" /> </div> <div class="ctrlHolder pm_ondemand"> <label for="pm_process_idle_timeout">{tmpl_var name='pm_process_idle_timeout_txt'}</label> - <input name="pm_process_idle_timeout" id="pm_process_idle_timeout" value="{tmpl_var name='pm_process_idle_timeout'}" size="3" maxlength="6" type="text" class="textInput formLengthLimit" /> s + <input name="pm_process_idle_timeout" id="pm_process_idle_timeout" value="{tmpl_var name='pm_process_idle_timeout'}" size="6" maxlength="6" type="text" class="textInput formLengthLimit" /> s </div> <div class="ctrlHolder"> <label for="pm_max_requests">{tmpl_var name='pm_max_requests_txt'}</label> - <input name="pm_max_requests" id="pm_max_requests" value="{tmpl_var name='pm_max_requests'}" size="3" maxlength="6" type="text" class="textInput formLengthLimit" /> + <input name="pm_max_requests" id="pm_max_requests" value="{tmpl_var name='pm_max_requests'}" size="6" maxlength="6" type="text" class="textInput formLengthLimit" /> </div> </div> <div class="ctrlHolder php"> diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index 2d9c774403018377d3a5de1692da6f13febdaf7a..7540e6ccf93941c3c04c325fae3f403abfbfe45a 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -133,11 +133,21 @@ class page_action extends tform_actions { } else { $server_id = (isset($web_servers[0])) ? intval($web_servers[0]) : 0; } - + + if($app->functions->intval($this->dataRecord["server_id"]) > 0) { + // check if server is in client's servers or add it. + $chk_sid = explode(',', $client['web_servers']); + if(in_array($this->dataRecord["server_id"], $client['web_servers']) == false) { + if($client['web_servers'] != '') $client['web_servers'] .= ','; + $client['web_servers'] .= $app->functions->intval($this->dataRecord["server_id"]); + } + } + //* 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')?"<option value='*'>*</option>":""; + //if(!in_array($this->dataRecord["ip_address"], $ips)) $ip_select .= "<option value='".$this->dataRecord["ip_address"]."' SELECTED>".$this->dataRecord["ip_address"]."</option>\r\n"; //$ip_select = ""; if(is_array($ips)) { foreach( $ips as $ip) { @@ -234,10 +244,20 @@ class page_action extends tform_actions { } $app->tpl->setVar("client_group_id", $client_select); + if($app->functions->intval($this->dataRecord["server_id"]) > 0) { + // check if server is in client's servers or add it. + $chk_sid = explode(',', $client['web_servers']); + if(in_array($this->dataRecord["server_id"], $client['web_servers']) == false) { + if($client['web_servers'] != '') $client['web_servers'] .= ','; + $client['web_servers'] .= $app->functions->intval($this->dataRecord["server_id"]); + } + } + //* 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')?"<option value='*'>*</option>":""; + //if(!in_array($this->dataRecord["ip_address"], $ips)) $ip_select .= "<option value='".$this->dataRecord["ip_address"]."' SELECTED>".$this->dataRecord["ip_address"]."</option>\r\n"; //$ip_select = ""; if(is_array($ips)) { foreach( $ips as $ip) { diff --git a/server/conf/apache_apps.vhost.master b/server/conf/apache_apps.vhost.master index ff6d4da05bdea4573a24b1a8a778817458c8909b..49f829a6d4465c2fe4a56d8b3f8317925a014ed1 100644 --- a/server/conf/apache_apps.vhost.master +++ b/server/conf/apache_apps.vhost.master @@ -4,38 +4,46 @@ # for the ISPConfig apps vhost ###################################################### -{vhost_port_listen} Listen {apps_vhost_port} -# NameVirtualHost *:{apps_vhost_port} +{tmpl_var name='vhost_port_listen'} Listen {tmpl_var name='apps_vhost_port'} +# NameVirtualHost *:{tmpl_var name='apps_vhost_port'} -<VirtualHost {apps_vhost_ip}:{apps_vhost_port}> +<VirtualHost {tmpl_var name='apps_vhost_ip'}:{tmpl_var name='apps_vhost_port'}> ServerAdmin webmaster@localhost - {apps_vhost_servername} + {tmpl_var name='apps_vhost_servername'} <FilesMatch "\.ph(p3?|tml)$"> SetHandler None </FilesMatch> <IfModule mod_php5.c> - DocumentRoot {apps_vhost_dir} + DocumentRoot {tmpl_var name='apps_vhost_dir'} AddType application/x-httpd-php .php - <Directory {apps_vhost_dir}> - Options FollowSymLinks - AllowOverride None - Order allow,deny - Allow from all + <Directory {tmpl_var name='apps_vhost_dir'}> + Options FollowSymLinks + AllowOverride None + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} + Order allow,deny + Allow from all + {/tmpl_if} </Directory> </IfModule> <IfModule mod_fcgid.c> - DocumentRoot {apps_vhost_dir} + DocumentRoot {tmpl_var name='apps_vhost_dir'} SuexecUserGroup ispapps ispapps - <Directory {apps_vhost_dir}> - Options Indexes FollowSymLinks MultiViews +ExecCGI - AllowOverride AuthConfig Indexes Limit Options FileInfo - AddHandler fcgid-script .php - FCGIWrapper {apps_vhost_basedir}/php-fcgi-scripts/apps/.php-fcgi-starter .php - Order allow,deny - Allow from all + <Directory {tmpl_var name='apps_vhost_dir'}> + Options Indexes FollowSymLinks MultiViews +ExecCGI + AllowOverride AuthConfig Indexes Limit Options FileInfo + AddHandler fcgid-script .php + FCGIWrapper {tmpl_var name='apps_vhost_basedir'}/php-fcgi-scripts/apps/.php-fcgi-starter .php + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} + Order allow,deny + Allow from all + {/tmpl_if} </Directory> </IfModule> diff --git a/server/conf/apache_ispconfig.conf.master b/server/conf/apache_ispconfig.conf.master index 5fb0f2c1181d3ad09155cf8bbae96401b3ccccd0..a6151988071b2ab5f52ef9d435d89391cd7ed1ce 100644 --- a/server/conf/apache_ispconfig.conf.master +++ b/server/conf/apache_ispconfig.conf.master @@ -8,61 +8,100 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m <Directory /var/www/clients> AllowOverride None - Order Deny,Allow - Deny from all + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all deny + {tmpl_else} + Order Deny,Allow + Deny from all + {/tmpl_if} </Directory> # Do not allow access to the root file system of the server for security reasons <Directory /> AllowOverride None - Order Deny,Allow - Deny from all + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all deny + {tmpl_else} + Order Deny,Allow + Deny from all + {/tmpl_if} </Directory> <Directory /var/www/conf> AllowOverride None - Order Deny,Allow - Deny from all + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all deny + {tmpl_else} + Order Deny,Allow + Deny from all + {/tmpl_if} </Directory> # Except of the following directories that contain website scripts <Directory /usr/share/phpmyadmin> + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} Order allow,deny Allow from all + {/tmpl_if} </Directory> <Directory /usr/share/phpMyAdmin> + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} Order allow,deny Allow from all + {/tmpl_if} </Directory> <Directory /usr/share/squirrelmail> + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} Order allow,deny Allow from all + {/tmpl_if} </Directory> # Allow access to mailman on OpenSuSE <Directory /usr/lib/mailman/cgi-bin> - AllowOverride All - order allow,deny - allow from all + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} + Order allow,deny + Allow from all + {/tmpl_if} </Directory> <Directory /usr/lib/mailman/icons> - order allow,deny - allow from all + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} + Order allow,deny + Allow from all + {/tmpl_if} </Directory> <Directory /var/lib/mailman/archives/> Options +FollowSymLinks - order allow,deny - allow from all + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} + Order allow,deny + Allow from all + {/tmpl_if} </Directory> # allow path to awstats and alias for awstats icons <Directory /usr/share/awstats> + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} Order allow,deny Allow from all + {/tmpl_if} </Directory> Alias /awstats-icon "/usr/share/awstats/icon" diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master index 5d74512cc9bf2d54b2413adb73cfeb01a3c85f91..0f8a79ad6104ef3126d329f738225004cfd21266 100644 --- a/server/conf/vhost.conf.master +++ b/server/conf/vhost.conf.master @@ -1,8 +1,12 @@ <Directory {tmpl_var name='web_basedir'}/{tmpl_var name='domain'}> AllowOverride None + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all deny + {tmpl_else} Order Deny,Allow Deny from all + {/tmpl_if} </Directory> <tmpl_loop name="vhosts"> @@ -55,8 +59,12 @@ <Directory {tmpl_var name='web_document_root_www'}> Options FollowSymLinks AllowOverride <tmpl_var name='allow_override'> + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} Order allow,deny Allow from all + {/tmpl_if} <tmpl_if name='ssi' op='==' value='y'> # ssi enabled @@ -66,17 +74,25 @@ </tmpl_if> <tmpl_if name='php' op='==' value='no'> <Files ~ '.php[s3-6]{0,1}$'> + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all denied + {tmpl_else} Order allow,deny Deny from all Allow from none + {/tmpl_if} </Files> </tmpl_if> </Directory> <Directory {tmpl_var name='web_document_root'}> Options FollowSymLinks AllowOverride <tmpl_var name='allow_override'> + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} Order allow,deny Allow from all + {/tmpl_if} <tmpl_if name='ssi' op='==' value='y'> # ssi enabled @@ -86,9 +102,13 @@ </tmpl_if> <tmpl_if name='php' op='==' value='no'> <Files ~ '.php[s3-6]{0,1}$'> - Order allow,deny - Deny from all - Allow from none + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all denied + {tmpl_else} + Order allow,deny + Deny from all + Allow from none + {/tmpl_if} </Files> </tmpl_if> </Directory> @@ -141,8 +161,12 @@ <tmpl_if name='cgi' op='==' value='y'> # cgi enabled <Directory {tmpl_var name='document_root'}/cgi-bin> + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} Order allow,deny Allow from all + {/tmpl_if} </Directory> ScriptAlias /cgi-bin/ <tmpl_var name='document_root'>/cgi-bin/ AddHandler cgi-script .cgi @@ -189,8 +213,12 @@ Action php5-cgi /php5-cgi AddHandler php5-cgi .php .php3 .php4 .php5 <Directory {tmpl_var name='cgi_starter_path'}> - Order allow,deny - Allow from all + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} + Order allow,deny + Allow from all + {/tmpl_if} </Directory> </tmpl_if> <tmpl_if name='php' op='==' value='fast-cgi'> @@ -224,23 +252,35 @@ FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php Options +ExecCGI AllowOverride <tmpl_var name='allow_override'> + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} Order allow,deny Allow from all + {/tmpl_if} </Directory> <Directory {tmpl_var name='web_document_root'}> AddHandler fcgid-script .php .php3 .php4 .php5 FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php Options +ExecCGI AllowOverride <tmpl_var name='allow_override'> + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} Order allow,deny Allow from all + {/tmpl_if} </Directory> </tmpl_if> <tmpl_if name='php' op='==' value='php-fpm'> <IfModule mod_fastcgi.c> <Directory {tmpl_var name='document_root'}/cgi-bin> - Order allow,deny - Allow from all + {tmpl_if name='apache_version' op='>' value='2.2' format='version'} + Require all granted + {tmpl_else} + Order allow,deny + Allow from all + {/tmpl_if} </Directory> AddHandler php5-fcgi .php Action php5-fcgi /php5-fcgi diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php index a393384c96b7c77bca45360f7643fc85ea414c4e..afb4db812434f996c1c7d9910e713f79b14afd72 100644 --- a/server/lib/classes/system.inc.php +++ b/server/lib/classes/system.inc.php @@ -851,7 +851,7 @@ class system{ //* We allow only some characters in the path // * is allowed, for example it is part of wildcard certificates/keys: *.example.com.crt - if(!preg_match('@^/[-a-zA-Z0-9_/.*~]{1,}$@', $path)) return false; + if(!preg_match('@^/[-a-zA-Z0-9_/.*]{1,}[~]?$@', $path)) return false; //* Check path for symlinks $path_parts = explode('/', $path); @@ -1724,6 +1724,31 @@ class system{ if(substr($init_script_directory, -1) === '/') $init_script_directory = substr($init_script_directory, 0, -1); return $init_script_directory.'/'.$servicename.' '.$action; } + + function getapacheversion($get_minor = false) { + global $app; + + $cmd = ''; + if($this->is_installed('apache2ctl')) $cmd = 'apache2ctl -v'; + elseif($this->is_installed('apachectl')) $cmd = 'apachectl -v'; + else { + $app->log("Could not check apache version, apachectl not found.", LOGLEVEL_WARN); + return '2.2'; + } + + exec($cmd, $output, $return_var); + if($return_var != 0 || !$output[0]) { + $app->log("Could not check apache version, apachectl did not return any data.", LOGLEVEL_WARN); + return '2.2'; + } + + if(preg_match('/version:\s*Apache\/(\d+)(\.(\d+)(\.(\d+))*)?(\D|$)/i', $output[0], $matches)) { + return $matches[1] . (isset($matches[3]) ? '.' . $matches[3] : '') . (isset($matches[5]) && $get_minor == true ? '.' . $matches[5] : ''); + } else { + $app->log("Could not check apache version, did not find version string in apachectl output.", LOGLEVEL_WARN); + return '2.2'; + } + } } diff --git a/server/lib/classes/tpl.inc.php b/server/lib/classes/tpl.inc.php index deb9ca1c5422deeaca0013517064a37602d3c625..b4d8ca2aa718c75e4292cb45bd963f050dc8d40b 100644 --- a/server/lib/classes/tpl.inc.php +++ b/server/lib/classes/tpl.inc.php @@ -1109,7 +1109,7 @@ if (!defined('vlibTemplateClassLoaded')) { * @access private * @return string used for eval'ing */ - function _parseIf ($varname, $value=null, $op=null, $namespace=null) { + function _parseIf ($varname, $value=null, $op=null, $namespace=null, $format=null) { if (isset($namespace)) $namespace = substr($namespace, 0, -1); $comp_str = ''; // used for extended if statements @@ -1151,10 +1151,19 @@ if (!defined('vlibTemplateClassLoaded')) { } } if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) { - return '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'.$comp_str; + $retstr = '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'; + if(isset($format) && isset($value) && $format == 'version') { + return 'version_compare(' . $retstr . ', \'' . $value . '\', ' . (!empty($op) ? $op : '==') . ')'; + } else { + return $retstr.$comp_str; + } } else { - return $retstr."['".$varname."']".$comp_str; + if(isset($format) && isset($value) && $format == 'version') { + return 'version_compare(' . $retstr."['".$varname."']" . ', \'' . $value . '\', ' . (!empty($op) ? $op : '==') . ')'; + } else { + return $retstr."['".$varname."']".$comp_str; + } } } @@ -1330,15 +1339,15 @@ if (!defined('vlibTemplateClassLoaded')) { break; case 'if': - return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline; + return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'.$newline; break; case 'unless': - return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline; + return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'.$newline; break; case 'elseif': - return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline; + return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'.$newline; break; case 'loop': diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 5fc085be74ce3a8050a9fc717d5631b9f8396eaa..c8a5e1ed325822558f7bf0953f5cad1e49960450 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -1019,6 +1019,7 @@ class apache2_plugin { } $tpl->setVar($vhost_data); + $tpl->setVar('apache_version', $app->system->getapacheversion()); // Rewrite rules $rewrite_rules = array(); @@ -1225,6 +1226,7 @@ class apache2_plugin { $fcgi_tpl = new tpl(); $fcgi_tpl->newTemplate('php-fcgi-starter.master'); + $fcgi_tpl->setVar('apache_version', $app->system->getapacheversion()); // Support for multiple PHP versions (FastCGI) if(trim($data['new']['fastcgi_php_version']) != ''){ @@ -1364,6 +1366,7 @@ class apache2_plugin { $cgi_tpl = new tpl(); $cgi_tpl->newTemplate('php-cgi-starter.master'); + $cgi_tpl->setVar('apache_version', $app->system->getapacheversion()); // This works because PHP "rewrites" a symlink to the physical path $php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir']; @@ -2028,6 +2031,7 @@ class apache2_plugin { $tpl = new tpl(); $tpl->newTemplate('apache_ispconfig.conf.master'); + $tpl->setVar('apache_version', $app->system->getapacheversion()); $records = $app->db->queryAllRecords('SELECT * FROM server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'"); $records_out= array(); @@ -2737,7 +2741,8 @@ class apache2_plugin { $app->load('tpl'); $tpl = new tpl(); $tpl->newTemplate('php_fpm_pool.conf.master'); - + $tpl->setVar('apache_version', $app->system->getapacheversion()); + if($data['new']['php_fpm_use_socket'] == 'y'){ $use_tcp = 0; $use_socket = 1; diff --git a/server/plugins-available/apps_vhost_plugin.inc.php b/server/plugins-available/apps_vhost_plugin.inc.php index 82518639978e0ef359a26572f5fe89bc6fd04f7c..320f3d024bc273b381a3f45c2da446c1844f4717 100644 --- a/server/plugins-available/apps_vhost_plugin.inc.php +++ b/server/plugins-available/apps_vhost_plugin.inc.php @@ -80,13 +80,12 @@ class apps_vhost_plugin { $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); if($web_config['server_type'] == 'apache'){ - // Dont just copy over the virtualhost template but add some custom settings - if(file_exists($conf["rootpath"]."/conf-custom/apache_apps.vhost.master")) { - $content = file_get_contents($conf["rootpath"]."/conf-custom/apache_apps.vhost.master"); - } else { - $content = file_get_contents($conf["rootpath"]."/conf/apache_apps.vhost.master"); - } + $app->load('tpl'); + $tpl = new tpl(); + $tpl->newTemplate('apache_apps.vhost.master'); + + $tpl->setVar('apache_version', $app->system->getapacheversion()); $vhost_conf_dir = $web_config['vhost_conf_dir']; $vhost_conf_enabled_dir = $web_config['vhost_conf_enabled_dir']; @@ -95,21 +94,31 @@ class apps_vhost_plugin { $web_config['apps_vhost_port'] = (empty($web_config['apps_vhost_port']))?8081:$web_config['apps_vhost_port']; $web_config['apps_vhost_ip'] = (empty($web_config['apps_vhost_ip']))?'_default_':$web_config['apps_vhost_ip']; + $tpl->setVar('apps_vhost_ip', $web_config['apps_vhost_ip']); + $tpl->setVar('apps_vhost_port', $web_config['apps_vhost_port']); + $tpl->setVar('apps_vhost_dir', $web_config['website_basedir'].'/apps'); + $tpl->setVar('apps_vhost_servername', $apps_vhost_servername); + $tpl->setVar('apps_vhost_basedir', $web_config['website_basedir']); + + $vhost_port_listen = ''; + // comment out the listen directive if port is 80 or 443 + if($web_config['apps_vhost_port'] == 80 or $web_config['apps_vhost_port'] == 443) { + $vhost_port_listen = '#'; + } + $tpl->setVar('vhost_port_listen', $vhost_port_listen); + + $content = $tpl->grab(); + + /* for backwards compatibility we replace the old syntax by hand now */ $content = str_replace('{apps_vhost_ip}', $web_config['apps_vhost_ip'], $content); $content = str_replace('{apps_vhost_port}', $web_config['apps_vhost_port'], $content); $content = str_replace('{apps_vhost_dir}', $web_config['website_basedir'].'/apps', $content); $content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content); $content = str_replace('{apps_vhost_basedir}', $web_config['website_basedir'], $content); + $content = str_replace('{vhost_port_listen}', $vhost_port_listen, $content); + /* end of backwards compatibility section */ - - // comment out the listen directive if port is 80 or 443 - if($web_config['apps_vhost_port'] == 80 or $web_config['apps_vhost_port'] == 443) { - $content = str_replace('{vhost_port_listen}', '#', $content); - } else { - $content = str_replace('{vhost_port_listen}', '', $content); - } - - file_put_contents("$vhost_conf_dir/apps.vhost", $content); + $app->system->file_put_contents("$vhost_conf_dir/apps.vhost", $content); $app->services->restartServiceDelayed('httpd', 'restart'); } diff --git a/server/plugins-available/maildeliver_plugin.inc.php b/server/plugins-available/maildeliver_plugin.inc.php index 7ff4a72dee055919dd636f8d1eac316fa0501222..c5b531dfa121d91e4d2981d20b26be4c43595c32 100644 --- a/server/plugins-available/maildeliver_plugin.inc.php +++ b/server/plugins-available/maildeliver_plugin.inc.php @@ -208,8 +208,9 @@ class maildeliver_plugin { if ( ! is_dir($data["new"]["maildir"].'/sieve/') ) { $app->system->mkdirpath($data["new"]["maildir"].'/sieve/', 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']); } + file_put_contents($sieve_file, $tpl->grab()); + exec('chown '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($sieve_file)); - file_put_contents($sieve_file_isp, $tpl->grab()); chown($sieve_file_isp,$mail_config['mailuser_name']); chgrp($sieve_file_isp,$mail_config['mailuser_group']); chdir($data["new"]["maildir"]);