From 6faa009faad39be196c28d290ba89ff58d20172a Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Thu, 23 Oct 2014 04:30:40 -0400
Subject: [PATCH] dkim: fixed issue with php 5.3
---
interface/lib/classes/client_templates.inc.php | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/interface/lib/classes/client_templates.inc.php b/interface/lib/classes/client_templates.inc.php
index bdf9b16..993936b 100644
--- a/interface/lib/classes/client_templates.inc.php
+++ b/interface/lib/classes/client_templates.inc.php
@@ -106,9 +106,10 @@
/*
* 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
@@ -145,7 +146,7 @@
if (is_array($addLimits)){
foreach($addLimits as $k => $v){
/* we can remove this condition, but it is easier to debug with it (don't add ids and other non-limit values) */
- if (strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec'){
+ if (strpos($k, 'limit') !== false or strpos($k, 'default') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec'){
$app->log('Template processing key ' . $k . ' for client ' . $clientId, LOGLEVEL_DEBUG);
/* process the numerical limits */
@@ -157,6 +158,15 @@
/* silent adjustment of the minimum cron frequency to 1 minute */
/* maybe this control test should be done via validator definition in tform.php file, but I don't know how */
if ($limits[$k] < 1) $limits[$k] = 1;
+ break;
+
+ case 'default_mailserver':
+ case 'default_webserver':
+ case 'default_dnsserver':
+ case 'default_slave_dnsserver':
+ case 'default_dbserver':
+ /* additional templates don't override default server from main template */
+ if ($limits[$k] == 0) $limits[$k] = $v;
break;
default:
@@ -222,8 +232,12 @@
* 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 (strpos($k, 'default') !== false and $v == 0) {
+ continue; // template doesn't define default server, client's default musn't be changed
+ }
+ if ((strpos($k, 'limit') !== false or strpos($k, 'default') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){
if ($update != '') $update .= ', ';
$update .= '`' . $k . "`='" . $v . "'";
}
--
Gitblit v1.9.1