diff --git a/install/dist/lib/debian60.lib.php b/install/dist/lib/debian60.lib.php index b3887cbd235513c726f07ba3315822359ac7d2b4..d792c5a7b9466054ba29f371a23c79db1abce64f 100644 --- a/install/dist/lib/debian60.lib.php +++ b/install/dist/lib/debian60.lib.php @@ -57,7 +57,7 @@ class installer extends installer_base { // Adding the amavisd commands to the postfix configuration $postconf_commands = array ( 'dovecot_destination_recipient_limit = 1', - 'virtual_transport = dovecot', + 'virtual_transport = lmtp:unix:private/dovecot-lmtp', 'smtpd_sasl_type = dovecot', 'smtpd_sasl_path = private/auth' ); diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php index ab25741ee9ace42cbd56be625b28ac24eb1b80d0..628f012dba0efa91278e048cad2c197f6e6e97bf 100644 --- a/install/dist/lib/fedora.lib.php +++ b/install/dist/lib/fedora.lib.php @@ -402,7 +402,7 @@ class installer_dist extends installer_base { // Adding the amavisd commands to the postfix configuration $postconf_commands = array ( 'dovecot_destination_recipient_limit = 1', - 'virtual_transport = dovecot', + 'virtual_transport = lmtp:unix:private/dovecot-lmtp', 'smtpd_sasl_type = dovecot', 'smtpd_sasl_path = private/auth', 'receive_override_options = no_address_mappings' diff --git a/install/dist/lib/gentoo.lib.php b/install/dist/lib/gentoo.lib.php index 99670eec1338e79223b66975dbb37c7fd4061179..7078f83dabd8e826334e8c0ac5bf81fb5020fc82 100644 --- a/install/dist/lib/gentoo.lib.php +++ b/install/dist/lib/gentoo.lib.php @@ -245,7 +245,7 @@ class installer extends installer_base //* Reconfigure postfix to use dovecot authentication $postconf_commands = array ( 'dovecot_destination_recipient_limit = 1', - 'virtual_transport = dovecot', + 'virtual_transport = lmtp:unix:private/dovecot-lmtp', 'smtpd_sasl_type = dovecot', 'smtpd_sasl_path = private/auth' ); diff --git a/install/dist/lib/opensuse.lib.php b/install/dist/lib/opensuse.lib.php index 7663f7eb39cddbcb53732a0cdc8bc664dcef0368..9ec6bcf4711d6f7c90cb4f5ec42948d35265ca7c 100644 --- a/install/dist/lib/opensuse.lib.php +++ b/install/dist/lib/opensuse.lib.php @@ -437,7 +437,7 @@ class installer_dist extends installer_base { // Adding the amavisd commands to the postfix configuration $postconf_commands = array ( 'dovecot_destination_recipient_limit = 1', - 'virtual_transport = dovecot', + 'virtual_transport = lmtp:unix:private/dovecot-lmtp', 'smtpd_sasl_type = dovecot', 'smtpd_sasl_path = private/auth', 'receive_override_options = no_address_mappings' 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_0049.sql b/install/sql/incremental/upd_0049.sql index d37d1a5b4a14a227ce5b4c6329a461d5d4f60ab8..7cfe1129480b84a6b564ea300ca1ec5c7e2fde88 100644 --- a/install/sql/incremental/upd_0049.sql +++ b/install/sql/incremental/upd_0049.sql @@ -1,2 +1 @@ ALTER TABLE `client_template` CHANGE `limit_aps` `limit_aps` INT( 11 ) NOT NULL DEFAULT '-1'; -ALTER TABLE `web_backup` ADD `filesize` VARCHAR(10) NOT NULL AFTER `filename`; diff --git a/install/sql/incremental/upd_0052.sql b/install/sql/incremental/upd_0052.sql index 5f4a1b66da0efe793c49afcccf41c3a3fd78c553..a25f7a73d49eb66d333553666a6da6907a8eaad9 100644 --- a/install/sql/incremental/upd_0052.sql +++ b/install/sql/incremental/upd_0052.sql @@ -1,5 +1 @@ -ALTER TABLE `client_template` CHANGE `limit_aps` `limit_aps` INT( 11 ) NOT NULL DEFAULT '-1'; -ALTER TABLE `mail_domain` ADD `dkim_public` MEDIUMTEXT NOT NULL AFTER `domain`; -ALTER TABLE `mail_domain` ADD `dkim_private` MEDIUMTEXT NOT NULL AFTER `domain`; -ALTER TABLE `mail_domain` ADD `dkim` ENUM( 'n', 'y' ) NOT NULL AFTER `domain`; ALTER TABLE `client` ADD `default_slave_dnsserver` INT( 11 ) UNSIGNED NOT NULL DEFAULT '1' AFTER `limit_dns_zone`; diff --git a/install/sql/incremental/upd_0055.sql b/install/sql/incremental/upd_0055.sql index 3a7c5d58638f1166ea43118a79a9525505161d5d..6d1a56f72aad5eb350d19cbfc1e0e5f87726508f 100644 --- a/install/sql/incremental/upd_0055.sql +++ b/install/sql/incremental/upd_0055.sql @@ -1,3 +1 @@ -ALTER TABLE `web_backup` CHANGE `backup_type` `backup_type` enum('web','mongodb','mysql') NOT NULL DEFAULT 'web'; -ALTER TABLE `web_database_user` ADD `database_password_mongo` varchar(32) DEFAULT NULL AFTER `database_password`; ALTER TABLE `sys_datalog` ADD `error` MEDIUMTEXT NULL DEFAULT NULL; diff --git a/install/sql/incremental/upd_0063.sql b/install/sql/incremental/upd_0063.sql index 827fdee11a9d20a19d2695e67a14aa5b4604ba10..04e1daa7530ffb5f8842db207313d3045d49906c 100644 --- a/install/sql/incremental/upd_0063.sql +++ b/install/sql/incremental/upd_0063.sql @@ -1 +1,20 @@ -ALTER TABLE `mail_user` ADD `disablelmtp` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'n' AFTER `disablelda` ; \ No newline at end of file +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/incremental/upd_0064.sql b/install/sql/incremental/upd_0064.sql new file mode 100644 index 0000000000000000000000000000000000000000..23bdd263c4207cf20e64fdef8f1b22918cf3a721 --- /dev/null +++ b/install/sql/incremental/upd_0064.sql @@ -0,0 +1,2 @@ +ALTER TABLE `mail_user` ADD `disablelmtp` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'n' AFTER `disablelda` ; +ALTER TABLE `mail_user` CHANGE `uid` `uid` INT( 11 ) NOT NULL DEFAULT '5000', CHANGE `gid` `gid` INT( 11 ) NOT NULL DEFAULT '5000' ; \ No newline at end of file diff --git a/install/sql/incremental/upd_0065.sql b/install/sql/incremental/upd_0065.sql new file mode 100644 index 0000000000000000000000000000000000000000..ccc790c035eda18e7f6d91ebd14d7979fd3a3ec0 --- /dev/null +++ b/install/sql/incremental/upd_0065.sql @@ -0,0 +1,7 @@ +ALTER TABLE `web_backup` ADD `filesize` VARCHAR(10) NOT NULL AFTER `filename`; +ALTER TABLE `client_template` CHANGE `limit_aps` `limit_aps` INT( 11 ) NOT NULL DEFAULT '-1'; +ALTER TABLE `mail_domain` ADD `dkim_public` MEDIUMTEXT NOT NULL AFTER `domain`; +ALTER TABLE `mail_domain` ADD `dkim_private` MEDIUMTEXT NOT NULL AFTER `domain`; +ALTER TABLE `mail_domain` ADD `dkim` ENUM( 'n', 'y' ) NOT NULL AFTER `domain`; +ALTER TABLE `web_backup` CHANGE `backup_type` `backup_type` enum('web','mysql','mongodb') NOT NULL DEFAULT 'web'; +ALTER TABLE `web_database_user` ADD `database_password_mongo` varchar(32) DEFAULT NULL AFTER `database_password`; diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 4841b1a726386295a58f090b4521195182b8ad73..81a4cf3a97e3d29e0696f47a085d8de98c1c7c87 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` -- @@ -1379,6 +1405,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 ; @@ -1699,7 +1730,7 @@ CREATE TABLE `web_backup` ( `backup_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `server_id` int(10) unsigned NOT NULL, `parent_domain_id` int(10) unsigned NOT NULL, - `backup_type` enum('web','mongodb','mysql') NOT NULL DEFAULT 'web', + `backup_type` enum('web','mysql','mongodb') NOT NULL DEFAULT 'web', `backup_mode` varchar(64) NOT NULL DEFAULT '', `tstamp` int(10) unsigned NOT NULL, `filename` varchar(255) NOT NULL, 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/remote.d/admin.inc.php b/interface/lib/classes/remote.d/admin.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..ba966fe1aba371daaf03fcb19844fa1681f4b8c7 --- /dev/null +++ b/interface/lib/classes/remote.d/admin.inc.php @@ -0,0 +1,109 @@ +<?php + +/* +Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh +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. + +--UPDATED 08.2009-- +Full SOAP support for ISPConfig 3.1.4 b +Updated by Arkadiusz Roch & Artur Edelman +Copyright (c) Tri-Plex technology + +--UPDATED 08.2013-- +Migrated into new remote classes system +by Marius Cramer <m.cramer@pixcept.de> + +*/ + +class remoting_admin extends remoting { + + /** + * set record permissions in any table + * @param string session_id + * @param string index_field + * @param string index_value + * @param array permissions + * @author "ispcomm", improved by M. Cramer <m.cramer@pixcept.de> + */ + public function update_record_permissions($tablename, $index_field, $index_value, $permissions) { + global $app; + + if(!$this->checkPerm($session_id, 'admin_record_permissions')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + foreach($permissions as $key => $value) { // make sure only sys_ fields are updated + switch($key) { + case 'sys_userid': + // check if userid is valid + $check = $app->db->queryOneRecord('SELECT userid FROM sys_user WHERE userid = ' . $app->functions->intval($value)); + if(!$check || !$check['userid']) { + $this->server->fault('invalid parameters', $value . ' is no valid sys_userid.'); + return false; + } + $permissions[$key] = $app->functions->intval($value); + break; + case 'sys_groupid': + // check if groupid is valid + $check = $app->db->queryOneRecord('SELECT groupid FROM sys_group WHERE groupid = ' . $app->functions->intval($value)); + if(!$check || !$check['groupid']) { + $this->server->fault('invalid parameters', $value . ' is no valid sys_groupid.'); + return false; + } + $permissions[$key] = $app->functions->intval($value); + break; + case 'sys_perm_user': + case 'sys_perm_group': + // check if permissions are valid + $value = strtolower($value); + if(!preg_match('/^[riud]+$/', $value)) { + $this->server->fault('invalid parameters', $value . ' is no valid permission string.'); + return false; + } + + $newvalue = ''; + if(strpos($value, 'r') !== false) $newvalue .= 'r'; + if(strpos($value, 'i') !== false) $newvalue .= 'i'; + if(strpos($value, 'u') !== false) $newvalue .= 'u'; + if(strpos($value, 'd') !== false) $newvalue .= 'd'; + $permissions[$key] = $newvalue; + unset($newvalue); + + break; + default: + $this->server->fault('invalid parameters', 'Only sys_userid, sys_groupid, sys_perm_user and sys_perm_group parameters can be changed with this function.'); + break; + } + } + + return $app->db->datalogUpdate( $tablename, $permissions, $index_field, $index_value ) ; + } + + +} + +?> diff --git a/interface/lib/classes/remote.d/mail.inc.php b/interface/lib/classes/remote.d/mail.inc.php index d235d01b7cebf1b33511fae280737cf6b2f205e9..c54466f5d9e87fb2784c91cb4042d86052f3166e 100644 --- a/interface/lib/classes/remote.d/mail.inc.php +++ b/interface/lib/classes/remote.d/mail.inc.php @@ -214,6 +214,10 @@ class remoting_mail extends remoting { return false; } + //* Set a few params to non empty values that will be overwritten by mail_plugin + if (!isset($params['uid'])) $params['uid'] = -1; + if (!isset($params['gid'])) $params['gid'] = -1; + $affected_rows = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params); return $affected_rows; } diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php index 268b257bc4be6cccfa1f20302b767adcb3ef0454..647ba8073c60e5ad382ca59fece325f367ea3f91 100644 --- a/interface/lib/classes/remoting.inc.php +++ b/interface/lib/classes/remoting.inc.php @@ -184,34 +184,8 @@ class remoting { return $app->db->affectedRows() == 1; } - //* Add mail domain - public function mail_user_add($session_id, $client_id, $params){ - global $app; - - if (!$this->checkPerm($session_id, 'mail_user_add')){ - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - - //* Check if mail domain exists - $email_parts = explode('@',$params['email']); - $tmp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = '".$app->db->quote($email_parts[1])."'"); - if($tmp['domain'] != $email_parts[1]) { - $this->server->fault('mail_domain_does_not_exist','Mail domain - '.$email_parts[1].' - does not exist.'); - return false; - } - - //* Set a few params to non empty values that will be overwritten by mail_plugin - if (!isset($params['uid'])) $params['uid'] = 999989999; - if (!isset($params['gid'])) $params['gid'] = 999989999; - - $affected_rows = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params); - return $affected_rows; - } - //** protected functions ----------------------------------------------------------------------------------- - protected function klientadd($formdef_file, $reseller_id, $params) { global $app; diff --git a/interface/lib/classes/tform_base.inc.php b/interface/lib/classes/tform_base.inc.php index 6cfdfe04d53dfc70087020f4529d73d36f3fa5b5..65f10c5216126f02edce4053bfb003e707fd1854 100644 --- a/interface/lib/classes/tform_base.inc.php +++ b/interface/lib/classes/tform_base.inc.php @@ -270,6 +270,7 @@ class tform_base { unset($tmp_recordid); $querystring = str_replace("{AUTHSQL}", $this->getAuthSQL('r'), $querystring); + $querystring = preg_replace_callback('@{AUTHSQL::(.+?)}@', "self::table_auth_sql", $querystring); // Getting the records $tmp_records = $app->db->queryAllRecords($querystring); diff --git a/interface/lib/classes/tpl.inc.php b/interface/lib/classes/tpl.inc.php index 4b411e2c3caaed3975bef8a94a3daf0de565c50a..a8533bb8ed45227829041c59266607682d8ce499 100644 --- a/interface/lib/classes/tpl.inc.php +++ b/interface/lib/classes/tpl.inc.php @@ -864,7 +864,7 @@ if (!defined('vlibTemplateClassLoaded')) { $regex = '/(<|<\/|{|{\/|<!--|<!--\/){1}\s*'; $regex.= 'tmpl_([\w]+)\s*'; - $regex.= '(?:'; + $regex.= '((?:(?:'; $regex.= '(?:'; $regex.= '(name|format|escape|op|value|file)'; $regex.= '\s*=\s*'; @@ -873,30 +873,10 @@ if (!defined('vlibTemplateClassLoaded')) { $regex.= '((?<=[\"\'])'; $regex.= '[^\"\']*|[a-z0-9_\.]*)'; $regex.= '[\"\']?'; - $regex.= ')?\s*'; - $regex.= '(?:'; - $regex.= '(?:'; - $regex.= '(name|format|escape|op|value)'; - $regex.= '\s*=\s*'; - $regex.= ')'; - $regex.= '(?:[\"\'])?'; - $regex.= '((?<=[\"\'])'; - $regex.= '[^\"\']*|[a-z0-9_\.]*)'; - $regex.= '[\"\']?'; - $regex.= ')?\s*'; - $regex.= '(?:'; - $regex.= '(?:'; - $regex.= '(name|format|escape|op|value)'; - $regex.= '\s*=\s*'; - $regex.= ')'; - $regex.= '(?:[\"\'])?'; - $regex.= '((?<=[\"\'])'; - $regex.= '[^\"\']*|[a-z0-9_\.]*)'; - $regex.= '[\"\']?'; - $regex.= ')?\s*'; + $regex.= ')?\s*)*?)'; $regex.= '(?:>|\/>|}|-->){1}'; - $regex.= '([\r\n|\n|\r])?/i'; - $data = preg_replace_callback($regex, array($this, _parseTag), $data); + $regex.= '/i'; + $data = preg_replace_callback($regex, array($this, '_parseTag'), $data); if ($this->_cache) { // add cache if need be $this->_createCache($data); @@ -1026,8 +1006,7 @@ if (!defined('vlibTemplateClassLoaded')) { * @access private * @return string used for eval'ing */ - private 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 @@ -1065,9 +1044,19 @@ if (!defined('vlibTemplateClassLoaded')) { } } if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) { - return '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'.$comp_str; - } else { - return $retstr."['".$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 { + if(isset($format) && isset($value) && $format == 'version') { + return 'version_compare(' . $retstr."['".$varname."']" . ', \'' . $value . '\', ' . (!empty($op) ? $op : '==') . ')'; + } else { + return $retstr."['".$varname."']".$comp_str; + } } } @@ -1186,28 +1175,38 @@ if (!defined('vlibTemplateClassLoaded')) { $wholetag = $args[0]; $openclose = $args[1]; $tag = strtolower($args[2]); - $newline = $args[9]; - - if ($tag == 'else') return '<?php } else { ?>'.$newline; + + if ($tag == 'else') return '<?php } else { ?>'; if ($tag == 'tmpl_include') return $wholetag; // ignore tmpl_include tags if (preg_match("/^<\/|{\/|<!--\/$/s", $openclose) || preg_match("/^end[if|loop|unless|comment]$/", $tag)) { if ($tag == 'loop' || $tag == 'endloop') array_pop($this->_namespace); if ($tag == 'comment' || $tag == 'endcomment') { - return '<?php */ ?>'.$newline; - } else { - return '<?php } ?>'.$newline; + return '<?php */ ?>'; + } + else { + return '<?php } ?>'; } } - //* arrange attributes - for ($i=3; $i < 8; $i=($i+2)) { - if (empty($args[$i]) && empty($args[($i+1)])) break; - $key = (empty($args[$i])) ? 'name' : strtolower($args[$i]); - if ($key == 'name' && preg_match('/^(php)?include$/', $tag)) $key = 'file'; - $$key = $args[($i+1)]; + // arrange attributes + $tmp_atts = $args[3]; + $atts = preg_split('/\s+/', $tmp_atts); + foreach($atts as $att) { + $regex = '/(?:'; + $regex.= '(name|format|escape|op|value|file)'; + $regex.= '\s*=\s*'; + $regex.= ')?'; + $regex.= '(?:[\"\'])?'; + $regex.= '((?<=[\"\'])'; + $regex.= '[^\"\']*|[a-z0-9_\.]*)'; + $regex.= '[\"\']?/'; + if(preg_match($regex, $att, $match)) { + $key = (empty($match[1])) ? 'name' : strtolower($match[1]); + if ($key == 'name' && preg_match('/^(php)?include$/', $tag)) $key = 'file'; + $$key = $match[2]; + } } - $var = ($this->OPTIONS['CASELESS']) ? strtolower($name) : $name; if ($this->_debug && !empty($var)) { @@ -1229,37 +1228,47 @@ if (!defined('vlibTemplateClassLoaded')) { if (empty($escape) && (!empty($this->OPTIONS['DEFAULT_ESCAPE']) && strtolower($this->OPTIONS['DEFAULT_ESCAPE']) != 'none')) { $escape = strtolower($this->OPTIONS['DEFAULT_ESCAPE']); } - return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace)." ?>$newline"; + return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace).' ?>'."\n"; + break; case 'if': - return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline; + return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'; + break; case 'unless': - return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline; + return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'; + break; case 'elseif': - return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline; + return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'; + break; case 'loop': - return '<?php '. $this->_parseLoop($var) .'?>'.$newline; + return '<?php '. $this->_parseLoop($var) .'?>'; + break; case 'comment': if (empty($var)) { // full open/close style comment - return '<?php /* ?>'.$newline; - } else { // just ignore tag if it was a one line comment + return '<?php /* ?>'; + } + else { // just ignore tag if it was a one line comment return; } + break; case 'phpinclude': if ($this->OPTIONS['ENABLE_PHPINCLUDE']) { - return '<?php include(\''.$file.'\'); ?>'.$newline; + return '<?php include(\''.$file.'\'); ?>'; } + break; case 'include': return '<?php $this->_getData($this->_fileSearch(\''.$file.'\'), 1); ?>'; + break; case 'dyninclude': return '<?php $this->_getData($this->_fileSearch($this->_dyninclude[\''.$name.'\']), 1); ?>'; + break; default: if ($this->OPTIONS['STRICT']) vlibTemplateError::raiseError('VT_ERROR_INVALID_TAG', KILL, htmlspecialchars($wholetag, ENT_QUOTES)); diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php index dde1d746a9e054470bed0252205181c910a37caf..89165ecfe5e7f8ab9b9871a1d6fd07fb5e8f50e1 100644 --- a/interface/web/admin/form/server_config.tform.php +++ b/interface/web/admin/form/server_config.tform.php @@ -368,6 +368,12 @@ $form["tabs"]['mail'] = array( 'width' => '10', 'maxlength' => '255' ), + 'mailbox_virtual_uidgid_maps' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), 'relayhost' => array( 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', diff --git a/interface/web/admin/lib/lang/en_users.lng b/interface/web/admin/lib/lang/en_users.lng index 9eec3222a509286923710d0aea91cb635e51c99a..09b8ac3057382b237c0d5a9b17ad0225989f49ef 100644 --- a/interface/web/admin/lib/lang/en_users.lng +++ b/interface/web/admin/lib/lang/en_users.lng @@ -30,4 +30,5 @@ $wb['repeat_password_txt'] = 'Repeat Password'; $wb['password_mismatch_txt'] = 'The passwords do not match.'; $wb['password_match_txt'] = 'The passwords do match.'; $wb['username_error_collision'] = 'The username may not be web or web plus a number."'; +$wb['client_not_admin_err'] = 'A user that belongs to a client can not be set to type: admin'; ?> 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/admin/users_edit.php b/interface/web/admin/users_edit.php index 5eab80a9b242ffcf6695e2364626419c6d0a1242..2b1be7f0fc7df0c6622db8e12b797d2a0476ca76 100644 --- a/interface/web/admin/users_edit.php +++ b/interface/web/admin/users_edit.php @@ -66,7 +66,14 @@ class page_action extends tform_actions { if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'], $this->dataRecord['modules'])) { $app->tform->errorMessage .= $app->tform->wordbook['startmodule_err']; } + $this->oldDataRecord = $app->tform->getDataRecord($this->id); + + //* A user that belongs to a client record (client or reseller) may not have typ admin + if(isset($this->dataRecord['typ']) && $this->dataRecord['typ'][0] == 'admin' && $this->oldDataRecord['client_id'] > 0) { + $app->tform->errorMessage .= $app->tform->wordbook['client_not_admin_err']; + } + } /* 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/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php index 435489f0909e1a65964eff4c0be8f93d45a43da1..75fb42fa11dd975e7ee1657fde436971606be8cc 100644 --- a/interface/web/mail/mail_user_edit.php +++ b/interface/web/mail/mail_user_edit.php @@ -205,8 +205,8 @@ class page_action extends tform_actions { $this->dataRecord["homedir"] = $mail_config["homedir_path"]; // Will be overwritten by mail_plugin - $this->dataRecord['uid'] = 999989999; - $this->dataRecord['gid'] = 999989999; + $this->dataRecord['uid'] = -1; + $this->dataRecord['gid'] = -1; //* Check if there is no alias or forward with this address $tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE active = 'y' AND source = '".$app->db->quote($this->dataRecord["email"])."'"); 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 c793cd0eb2bc394d7c44daf029e59605769fce33..76738957e1b02d2db37c24f7af7463fa9a2c7655 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/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_advanced.htm b/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_advanced.htm index 87107400af24704f79644aa7ac3cc83dac2373cf..289339bf1c7a365b50d8dc19e187b40a33ec07e7 100644 --- a/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_advanced.htm +++ b/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_advanced.htm @@ -82,8 +82,8 @@ <input type="hidden" name="id" value="{tmpl_var name='id'}"> <div class="buttonHolder buttons"> - <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_domain_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('sites/web_domain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> + <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_vhost_subdomain_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('sites/web_vhost_subdomain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> </div> </div> diff --git a/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_backup.htm b/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_backup.htm index c46d4e2d4ef9a3fd0aae5921d68d194f959bfb86..1784e2437eabad4ebb86ca603703b6a5cade7f53 100644 --- a/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_backup.htm +++ b/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_backup.htm @@ -24,8 +24,8 @@ <input type="hidden" name="id" value="{tmpl_var name='id'}"> <div class="buttonHolder buttons"> - <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_domain_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('sites/web_domain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> + <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_vhost_subdomain_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('sites/web_vhost_subdomain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> </div> </div> diff --git a/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_redirect.htm b/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_redirect.htm index 66a17034c9b27fec864671d69ddddf1024273511..eb059e288027d21bf55b555e78025dc894946efe 100644 --- a/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_redirect.htm +++ b/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_redirect.htm @@ -26,8 +26,8 @@ <input type="hidden" name="id" value="{tmpl_var name='id'}"> <div class="buttonHolder buttons"> - <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_domain_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('sites/web_domain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> + <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_vhost_subdomain_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('sites/web_vhost_subdomain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> </div> </div> diff --git a/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_ssl.htm b/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_ssl.htm index 4c27bb77298df546759290df5dfd967d1400d8e7..b4c035759d36e4ae4fddd4fd492f192cee412a7c 100644 --- a/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_ssl.htm +++ b/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_ssl.htm @@ -60,8 +60,8 @@ <input type="hidden" name="id" value="{tmpl_var name='id'}"> <div class="buttonHolder buttons"> - <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_domain_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('sites/web_domain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> + <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_vhost_subdomain_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('sites/web_vhost_subdomain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> </div> </div> diff --git a/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_stats.htm b/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_stats.htm index 26eee94772c6b8ea574a65495cf7fa43aad68377..8234422e1649a141c9d0e969dd0404b90b03d2bc 100644 --- a/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_stats.htm +++ b/interface/web/themes/default-304/templates/sites/web_vhost_subdomain_stats.htm @@ -29,8 +29,8 @@ <input type="hidden" name="id" value="{tmpl_var name='id'}"> <div class="buttonHolder buttons"> - <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_domain_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('sites/web_domain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> + <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_vhost_subdomain_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('sites/web_vhost_subdomain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> </div> </div> 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 9b7d9940a08e7837c48c60e323d12e4c7116da62..6ee95556fc17c3868316e8a827c1d9536f336d0f 100644 --- a/server/lib/classes/system.inc.php +++ b/server/lib/classes/system.inc.php @@ -899,7 +899,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); @@ -1524,7 +1524,7 @@ class system{ } } - function maildirmake($maildir_path, $user = '', $group = '', $subfolder = '') { + function maildirmake($maildir_path, $user = '', $subfolder = '', $group = '') { global $app; @@ -1774,6 +1774,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..2a91b0654b957e2765e818615a24f7dcc1c16117 100644 --- a/server/lib/classes/tpl.inc.php +++ b/server/lib/classes/tpl.inc.php @@ -932,7 +932,7 @@ if (!defined('vlibTemplateClassLoaded')) { $regex = '/(<|<\/|{|{\/|<!--|<!--\/){1}\s*'; $regex.= 'tmpl_([\w]+)\s*'; - $regex.= '(?:'; + $regex.= '((?:(?:'; $regex.= '(?:'; $regex.= '(name|format|escape|op|value|file)'; $regex.= '\s*=\s*'; @@ -941,30 +941,9 @@ if (!defined('vlibTemplateClassLoaded')) { $regex.= '((?<=[\"\'])'; $regex.= '[^\"\']*|[a-z0-9_\.]*)'; $regex.= '[\"\']?'; - $regex.= ')?\s*'; - $regex.= '(?:'; - $regex.= '(?:'; - $regex.= '(name|format|escape|op|value)'; - $regex.= '\s*=\s*'; - $regex.= ')'; - $regex.= '(?:[\"\'])?'; - $regex.= '((?<=[\"\'])'; - $regex.= '[^\"\']*|[a-z0-9_\.]*)'; - $regex.= '[\"\']?'; - $regex.= ')?\s*'; - $regex.= '(?:'; - $regex.= '(?:'; - $regex.= '(name|format|escape|op|value)'; - $regex.= '\s*=\s*'; - $regex.= ')'; - $regex.= '(?:[\"\'])?'; - $regex.= '((?<=[\"\'])'; - $regex.= '[^\"\']*|[a-z0-9_\.]*)'; - $regex.= '[\"\']?'; - $regex.= ')?\s*'; + $regex.= ')?\s*)*?)'; $regex.= '(?:>|\/>|}|-->){1}'; $regex.= '/i'; - //$regex.= '([\r\n|\n|\r])?/ie'; $data = preg_replace_callback($regex, array($this, '_parseTag'), $data); if ($this->_cache) { // add cache if need be @@ -1109,7 +1088,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 +1130,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; + } } } @@ -1281,28 +1269,37 @@ if (!defined('vlibTemplateClassLoaded')) { $wholetag = $args[0]; $openclose = $args[1]; $tag = strtolower($args[2]); - $newline = $args[9]; - //echo "1#$newline#2"; - - if ($tag == 'else') return '<?php } else { ?>'.$newline; + + if ($tag == 'else') return '<?php } else { ?>'; if ($tag == 'tmpl_include') return $wholetag; // ignore tmpl_include tags if (preg_match("/^<\/|{\/|<!--\/$/s", $openclose) || preg_match("/^end[if|loop|unless|comment]$/", $tag)) { if ($tag == 'loop' || $tag == 'endloop') array_pop($this->_namespace); if ($tag == 'comment' || $tag == 'endcomment') { - return '<?php */ ?>'.$newline; + return '<?php */ ?>'; } else { - return '<?php } ?>'.$newline; + return '<?php } ?>'; } } // arrange attributes - for ($i=3; $i < 8; $i=($i+2)) { - if (empty($args[$i]) && empty($args[($i+1)])) break; - $key = (empty($args[$i])) ? 'name' : strtolower($args[$i]); - if ($key == 'name' && preg_match('/^(php)?include$/', $tag)) $key = 'file'; - $$key = $args[($i+1)]; + $tmp_atts = $args[3]; + $atts = preg_split('/\s+/', $tmp_atts); + foreach($atts as $att) { + $regex = '/(?:'; + $regex.= '(name|format|escape|op|value|file)'; + $regex.= '\s*=\s*'; + $regex.= ')?'; + $regex.= '(?:[\"\'])?'; + $regex.= '((?<=[\"\'])'; + $regex.= '[^\"\']*|[a-z0-9_\.]*)'; + $regex.= '[\"\']?/'; + if(preg_match($regex, $att, $match)) { + $key = (empty($match[1])) ? 'name' : strtolower($match[1]); + if ($key == 'name' && preg_match('/^(php)?include$/', $tag)) $key = 'file'; + $$key = $match[2]; + } } $var = ($this->OPTIONS['CASELESS']) ? strtolower($name) : $name; @@ -1326,28 +1323,28 @@ if (!defined('vlibTemplateClassLoaded')) { if (empty($escape) && (!empty($this->OPTIONS['DEFAULT_ESCAPE']) && strtolower($this->OPTIONS['DEFAULT_ESCAPE']) != 'none')) { $escape = strtolower($this->OPTIONS['DEFAULT_ESCAPE']); } - return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace).' ?>'.$newline."\n"; + return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace).' ?>'."\n"; break; case 'if': - return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline; + return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'; break; case 'unless': - return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline; + return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'; break; case 'elseif': - return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline; + return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'; break; case 'loop': - return '<?php '. $this->_parseLoop($var) .'?>'.$newline; + return '<?php '. $this->_parseLoop($var) .'?>'; break; case 'comment': if (empty($var)) { // full open/close style comment - return '<?php /* ?>'.$newline; + return '<?php /* ?>'; } else { // just ignore tag if it was a one line comment return; @@ -1356,7 +1353,7 @@ if (!defined('vlibTemplateClassLoaded')) { case 'phpinclude': if ($this->OPTIONS['ENABLE_PHPINCLUDE']) { - return '<?php include(\''.$file.'\'); ?>'.$newline; + return '<?php include(\''.$file.'\'); ?>'; } break; diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 6267217802bcb0235075069236e2a28d555e739e..8940cfd58f0acf509c1b5d3af8ba3846ce3ef10c 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -1021,6 +1021,7 @@ class apache2_plugin { } $tpl->setVar($vhost_data); + $tpl->setVar('apache_version', $app->system->getapacheversion()); // Rewrite rules $rewrite_rules = array(); @@ -1227,6 +1228,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']) != ''){ @@ -1366,6 +1368,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']; @@ -2030,6 +2033,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(); @@ -2739,7 +2743,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/mail_plugin.inc.php b/server/plugins-available/mail_plugin.inc.php index 72b69a3c119332b7e851e67ba30a39cf4c572fe2..c5f13927ba8816f579d012a4f4dc025985442f59 100644 --- a/server/plugins-available/mail_plugin.inc.php +++ b/server/plugins-available/mail_plugin.inc.php @@ -93,7 +93,7 @@ class mail_plugin { $base_path = implode('/', $tmp_basepath_parts); //* Set the email-uid and gid if not given - if (($data['new']['uid'] == 999989999) || ($data['new']['gid'] == 999989999)) { + if (($data['new']['uid'] == -1) || ($data['new']['gid'] == -1)) { $app->log('Setting uid and gid automatically',LOGLEVEL_DEBUG); if ($mail_config["mailbox_virtual_uidgid_maps"] == 'y') { $app->log('Map uid to linux-user',LOGLEVEL_DEBUG); @@ -113,8 +113,8 @@ class mail_plugin { } } // if nothing set before -> use standard mailuser uid and gid vmail - if ($data['new']['uid'] == 999989999) $data['new']['uid'] = $mail_config["mailuser_uid"]; - if ($data['new']['gid'] == 999989999) $data['new']['gid'] = $mail_config["mailuser_gid"]; + if ($data['new']['uid'] == -1) $data['new']['uid'] = $mail_config["mailuser_uid"]; + if ($data['new']['gid'] == -1) $data['new']['gid'] = $mail_config["mailuser_gid"]; $app->log('Mailuser uid: '.$data['new']['uid'].', gid: '.$data['new']['gid'],LOGLEVEL_DEBUG); // update DB if values changed @@ -148,7 +148,7 @@ class mail_plugin { if(!empty($maildomain_path) && !is_dir($maildomain_path)) { //exec("su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); - $app->system->maildirmake($maildomain_path, $user, $group); + $app->system->maildirmake($maildomain_path, $user, '', $group); //* This is to fix the maildrop quota not being rebuilt after the quota is changed. if($mail_config['pop3_imap_daemon'] != 'dovecot') { @@ -160,22 +160,22 @@ class mail_plugin { if(!is_dir($data['new']['maildir'].'/.Sent')) { //exec("su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); //$app->log('Created submaildir Sent: '."su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG); - $app->system->maildirmake($maildomain_path, $user, $group, 'Sent'); + $app->system->maildirmake($maildomain_path, $user, 'Sent', $group); } if(!is_dir($data['new']['maildir'].'/.Drafts')) { //exec("su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); //$app->log('Created submaildir Drafts: '."su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG); - $app->system->maildirmake($maildomain_path, $user, $group, 'Drafts'); + $app->system->maildirmake($maildomain_path, $user, 'Drafts', $group); } if(!is_dir($data['new']['maildir'].'/.Trash')) { //exec("su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); //$app->log('Created submaildir Trash: '."su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG); - $app->system->maildirmake($maildomain_path, $user, $group, 'Trash'); + $app->system->maildirmake($maildomain_path, $user, 'Trash', $group); } if(!is_dir($data['new']['maildir'].'/.Junk')) { //exec("su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); //$app->log('Created submaildir Junk: '."su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG); - $app->system->maildirmake($maildomain_path, $user, $group, 'Junk'); + $app->system->maildirmake($maildomain_path, $user, 'Junk', $group); } // Set permissions now recursive @@ -284,7 +284,7 @@ class mail_plugin { if(!empty($maildomain_path) && !is_dir($maildomain_path.'/new')) { //exec("su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); //$app->log("Created Maildir "."su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG); - $app->system->maildirmake($maildomain_path, $user, $group); + $app->system->maildirmake($maildomain_path, $user, '', $group); //* This is to fix the maildrop quota not being rebuilt after the quota is changed. if($mail_config['pop3_imap_daemon'] != 'dovecot') { @@ -301,22 +301,22 @@ class mail_plugin { if(!is_dir($data['new']['maildir'].'/.Sent')) { //exec("su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); //$app->log('Created submaildir Sent: '."su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG); - $app->system->maildirmake($maildomain_path, $user, $group, 'Sent'); + $app->system->maildirmake($maildomain_path, $user, 'Sent', $group); } if(!is_dir($data['new']['maildir'].'/.Drafts')) { //exec("su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); //$app->log('Created submaildir Drafts: '."su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG); - $app->system->maildirmake($maildomain_path, $user, $group, 'Drafts'); + $app->system->maildirmake($maildomain_path, $user, 'Drafts', $group); } if(!is_dir($data['new']['maildir'].'/.Trash')) { //exec("su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); //$app->log('Created submaildir Trash: '."su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG); - $app->system->maildirmake($maildomain_path, $user, $group, 'Trash'); + $app->system->maildirmake($maildomain_path, $user, 'Trash', $group); } if(!is_dir($data['new']['maildir'].'/.Junk')) { //exec("su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); //$app->log('Created submaildir Junk: '."su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG); - $app->system->maildirmake($maildomain_path, $user, $group, 'Junk'); + $app->system->maildirmake($maildomain_path, $user, 'Junk', $group); } // Set permissions now recursive 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"]);