install/sql/ispconfig3.sql | ●●●●● patch | view | raw | blame | history | |
interface/web/client/client_edit.php | ●●●●● patch | view | raw | blame | history | |
interface/web/client/client_template_del.php | ●●●●● patch | view | raw | blame | history | |
interface/web/client/client_template_edit.php | ●●●●● patch | view | raw | blame | history | |
interface/web/client/client_template_list.php | ●●●●● patch | view | raw | blame | history | |
interface/web/client/form/client.tform.php | ●●●●● patch | view | raw | blame | history | |
interface/web/client/form/client_template.tform.php | ●●●●● patch | view | raw | blame | history | |
interface/web/client/templates/client_edit_limits.htm | ●●●●● patch | view | raw | blame | history | |
interface/web/client/tools.inc.php | ●●●●● patch | view | raw | blame | history |
install/sql/ispconfig3.sql
@@ -96,6 +96,8 @@ `password` varchar(255) default NULL, `language` varchar(255) NOT NULL default 'en', `usertheme` varchar(255) NOT NULL default 'default', `template_master` bigint(20) NOT NULL default '0', `template_additional` varchar(255) NOT NULL default '', PRIMARY KEY (`client_id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 ; @@ -133,6 +135,11 @@ `limit_dns_record` int(11) NOT NULL default '-1', `limit_database` int(11) NOT NULL default '-1', `limit_client` int(11) NOT NULL default '0', `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, PRIMARY KEY (`template_id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 ; interface/web/client/client_edit.php
@@ -40,6 +40,7 @@ require_once('../../lib/config.inc.php'); require_once('../../lib/app.inc.php'); require_once('tools.inc.php'); //* Check permissions for module $app->auth->check_module_permissions('client'); @@ -84,7 +85,8 @@ $app->db->query("UPDATE client SET parent_client_id = ".intval($_SESSION['s']['user']['client_id'])." WHERE client_id = ".$this->id); } /* If there is a client-template, process it */ applyClientTemplates($this->id); } @@ -122,9 +124,10 @@ $sql = "UPDATE sys_user SET modules = '$modules' WHERE client_id = $client_id"; $app->db->query($sql); } /* * If there is a client-template, process it */ applyClientTemplates($this->id); } } $page = new page_action; interface/web/client/client_template_del.php
@@ -44,6 +44,7 @@ //* Check permissions for module $app->auth->check_module_permissions('client'); if(!$_SESSION["s"]["user"]["typ"] == 'admin') die('Client-Templates are only for Admins.'); $app->uses('tpl,tform'); $app->load('tform_actions'); interface/web/client/client_template_edit.php
@@ -40,10 +40,10 @@ require_once('../../lib/config.inc.php'); require_once('../../lib/app.inc.php'); require_once('tools.inc.php'); //* Check permissions for module $app->auth->check_module_permissions('client'); if(!$_SESSION["s"]["user"]["typ"] == 'admin') die('Client-Templates are only for Admins.'); // Loading classes @@ -52,6 +52,22 @@ class page_action extends tform_actions { /* This function is called automatically right after the data was successful updated in the database. */ function onAfterUpdate() { global $app; /* * the template has changed. apply the new data to all clients */ $sql = "SELECT client_id FROM client WHERE template_master = " . $this->id; $clients = $app->db->queryAllRecords($sql); foreach ($clients as $client){ applyClientTemplates($client['client_id']); } } } $page = new page_action; interface/web/client/client_template_list.php
@@ -14,7 +14,6 @@ //* Check permissions for module $app->auth->check_module_permissions('client'); if(!$_SESSION["s"]["user"]["typ"] == 'admin') die('Client-Templates are only for Admins.'); $app->uses('listform_actions'); interface/web/client/form/client.tform.php
@@ -297,6 +297,17 @@ ################################## # Begin Datatable fields ################################## 'template_master' => array ( 'datatype' => 'INTEGER', 'formtype' => 'SELECT', 'default' => '1', 'datasource' => array ( 'type' => 'SQL', 'querystring' => "SELECT template_id,template_name FROM client_template WHERE template_type ='m'", 'keyfield'=> 'template_id', 'valuefield'=> 'template_name' ), 'value' => array('0' => 'custom') ), 'default_mailserver' => array ( 'datatype' => 'INTEGER', 'formtype' => 'SELECT', interface/web/client/form/client_template.tform.php
@@ -42,7 +42,7 @@ $form["db_history"] = "no"; $form["tab_default"] = "template"; $form["list_default"] = "client_template_list.php"; $form["auth"] = 'no'; $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 interface/web/client/templates/client_edit_limits.htm
@@ -3,6 +3,12 @@ <div class="panel panel_client"> <div class="pnl_formsarea"> <fieldset id="wf_area_client"><legend>Client-Template</legend> <span class="wf_oneField"> <label for="template_master" class="wf_preField">{tmpl_var name='template_master_txt'}</label> <select id="template_master" name="template_master">{tmpl_var name='template_master'}</select> </span> </fieldset> <fieldset id="wf_area_client"><legend>Limits</legend> <span class="wf_oneField"> <label for="default_mailserver" class="wf_preField">{tmpl_var name='default_mailserver_txt'}</label> interface/web/client/tools.inc.php
New file @@ -0,0 +1,66 @@ <?php /* Copyright (c) 2007-2008, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com 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. */ function applyClientTemplates($clientId){ global $app; /* * Get the master-template for the client */ $sql = "SELECT template_master FROM client WHERE client_id = " . intval($clientId); $record = $app->db->queryOneRecord($sql); $masterTemplateId = $record['template_master']; /* * if the master-Template is custom there is NO changing */ if ($masterTemplateId > 0){ $sql = "SELECT * FROM client_template WHERE template_id = " . intval($masterTemplateId); $limits = $app->db->queryOneRecord($sql); } /* * TODO: Process the additional tempaltes here (add them to the limits * if != -1) * (like $limits['limit_database'] += $limitAdditional) */ /* * Write all back to the database */ $update = ''; foreach($limits as $k => $v){ if (strpos($k, 'limit') !== false){ if ($update != '') $update .= ', '; $update .= '`' . $k . "`='" . $v . "'"; } } $sql = 'UPDATE client SET ' . $update . " WHERE client_id = " . intval($clientId); $app->db->query($sql); } ?>