From 7374c819496c621f891b33827ca8b5d00967ac7e Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 20 Nov 2015 10:06:59 +0800 Subject: [PATCH] * fix bug #669 in backyard pms. --- module/setting/model.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/module/setting/model.php b/module/setting/model.php index 2e7f3a54e7..e09f8f5f81 100644 --- a/module/setting/model.php +++ b/module/setting/model.php @@ -49,12 +49,22 @@ class settingModel extends model */ public function setItem($path, $value = '') { + /* fix bug when account has dot. */ + $account = $this->app->user->account; + $replace = false; + if(strpos($path, $account) === 0) + { + $replace = true; + $path = preg_replace("/^{$account}/", 'account', $path); + } + $level = substr_count($path, '.'); $section = ''; if($level <= 1) return false; if($level == 2) list($owner, $module, $key) = explode('.', $path); if($level == 3) list($owner, $module, $section, $key) = explode('.', $path); + if($replace) $owner = $account; $item = new stdclass(); $item->owner = $owner; @@ -172,8 +182,7 @@ class settingModel extends model if(!isset($record->module)) return array(); // If no module field, return directly. Since 3.2 version, there's the module field. if(empty($record->module)) continue; - if($record->section) $config[$record->owner]->{$record->module}[] = $record; - if(!$record->section) $config[$record->owner]->{$record->module}[] = $record; + $config[$record->owner]->{$record->module}[] = $record; } return $config; }