Commit 2797d69756a5ee775b7b29a19c486d1a64ff8ccb
1 parent
6a2638a8
KTS-3447
"The cache needs to be cleared when updating the config settings" Fixed. After the update, the cache is cleared. Committed by: Megan Watson Reviewed by: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8665 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
309 additions
and
273 deletions
config/dmsDefaults.php
| ... | ... | @@ -455,36 +455,19 @@ class KTInit { |
| 455 | 455 | // TODO: refactor when all the config settings are stored in the database |
| 456 | 456 | // Check for the config cache |
| 457 | 457 | $use_cache = false; |
| 458 | - $store_cache = false; | |
| 459 | - $cachePathFile = KT_DIR . '/config/cache-path'; | |
| 460 | - if (file_exists($cachePathFile)) { | |
| 461 | - $store_cache = true; | |
| 462 | - // Get the path to the config cache | |
| 463 | - $cachePath = trim(file_get_contents($cachePathFile)); | |
| 464 | - $cachePath .= '/configcache'; | |
| 465 | - | |
| 466 | - $cachePath = (!KTUtil::isAbsolutePath($cachePath)) ? sprintf('%s/%s', KT_DIR, $cachePath) : $cachePath; | |
| 467 | - | |
| 468 | - // Get the path to the config file | |
| 469 | - $configPathFile = KT_DIR . '/config/config-path'; | |
| 470 | - $configPath = trim(file_get_contents($configPathFile)); | |
| 471 | - | |
| 472 | - $configPath = (!KTUtil::isAbsolutePath($configPath)) ? sprintf('%s/%s', KT_DIR, $configPath) : $configPath; | |
| 473 | - | |
| 474 | - // Remove any double slashes | |
| 475 | - $configPath = str_replace('//', '/', $configPath); | |
| 476 | - $configPath = str_replace('\\\\', '\\', $configPath); | |
| 458 | + $store_cache = true; | |
| 459 | + $cachePath = $oKTConfig->getCacheFilename(); | |
| 460 | + if (file_exists($cachePath)) { | |
| 461 | + $configPath = $oKTConfig->getConfigFilename(); | |
| 477 | 462 | |
| 478 | 463 | // This check can be removed once all config settings are in the database |
| 479 | 464 | // Check if the config file has been updated since the last time the cache file was generated. |
| 480 | - if (file_exists($cachePath)) { | |
| 481 | - $cachestat = stat($cachePath); | |
| 482 | - $configstat = stat($configPath); | |
| 483 | - $tval = 9; | |
| 484 | - if ($cachestat[$tval] > $configstat[$tval]) { | |
| 485 | - $use_cache = true; | |
| 486 | - $store_cache = false; | |
| 487 | - } | |
| 465 | + $cachestat = stat($cachePath); | |
| 466 | + $configstat = stat($configPath); | |
| 467 | + $tval = 9; | |
| 468 | + if ($cachestat[$tval] > $configstat[$tval]) { | |
| 469 | + $use_cache = true; | |
| 470 | + $store_cache = false; | |
| 488 | 471 | } |
| 489 | 472 | |
| 490 | 473 | if ($use_cache) { | ... | ... |
lib/config/config.inc.php
| ... | ... | @@ -49,8 +49,36 @@ class KTConfig { |
| 49 | 49 | var $expanded = array(); |
| 50 | 50 | var $expanding = array(); |
| 51 | 51 | |
| 52 | + /** | |
| 53 | + * Get the path to the cache file for the config settings | |
| 54 | + * | |
| 55 | + * @return string | |
| 56 | + */ | |
| 57 | + static function getCacheFilename() | |
| 58 | + { | |
| 59 | + $pathFile = KT_DIR . '/config/cache-path'; | |
| 60 | + | |
| 61 | + if(!file_exists($pathFile)){ | |
| 62 | + return false; | |
| 63 | + } | |
| 64 | + | |
| 65 | + // Get the directory containing the file, append the file name | |
| 66 | + $cacheFile = trim(file_get_contents($pathFile)); | |
| 67 | + $cacheFile .= '/configcache'; | |
| 68 | + | |
| 69 | + // Ensure path is absolute | |
| 70 | + $cacheFile = (!KTUtil::isAbsolutePath($cacheFile)) ? sprintf('%s/%s', KT_DIR, $cacheFile) : $cacheFile; | |
| 71 | + | |
| 72 | + return $cacheFile; | |
| 73 | + } | |
| 74 | + | |
| 52 | 75 | // FIXME nbm: how do we cache errors here? |
| 53 | - function loadCache($filename) { | |
| 76 | + function loadCache() { | |
| 77 | + $filename = $this->getCacheFilename(); | |
| 78 | + if($filename === false){ | |
| 79 | + return false; | |
| 80 | + } | |
| 81 | + | |
| 54 | 82 | $config_str = file_get_contents($filename); |
| 55 | 83 | $config_cache = unserialize($config_str); |
| 56 | 84 | $this->flat = $config_cache['flat']; |
| ... | ... | @@ -60,7 +88,9 @@ class KTConfig { |
| 60 | 88 | return true; |
| 61 | 89 | } |
| 62 | 90 | |
| 63 | - function createCache($filename) { | |
| 91 | + function createCache() { | |
| 92 | + $filename = $this->getCacheFilename(); | |
| 93 | + | |
| 64 | 94 | $config_cache = array(); |
| 65 | 95 | $config_cache['flat'] = $this->flat; |
| 66 | 96 | $config_cache['flatns'] = $this->flatns; |
| ... | ... | @@ -70,6 +100,19 @@ class KTConfig { |
| 70 | 100 | file_put_contents($filename, serialize($config_cache)); |
| 71 | 101 | } |
| 72 | 102 | |
| 103 | + /** | |
| 104 | + * Delete the cache so it can be refreshed on the next page load | |
| 105 | + * | |
| 106 | + * @param string $filename | |
| 107 | + */ | |
| 108 | + function clearCache() | |
| 109 | + { | |
| 110 | + $filename = $this->getCacheFilename(); | |
| 111 | + if($filename !== false && file_exists($filename)){ | |
| 112 | + @unlink($filename); | |
| 113 | + } | |
| 114 | + } | |
| 115 | + | |
| 73 | 116 | // {{{ readConfig |
| 74 | 117 | function readConfig () { |
| 75 | 118 | global $default; |
| ... | ... | @@ -236,15 +279,22 @@ class KTConfig { |
| 236 | 279 | */ |
| 237 | 280 | static function getConfigFilename() |
| 238 | 281 | { |
| 239 | - $configPath = file_get_contents(KT_DIR . '/config/config-path'); | |
| 282 | + $pathFile = KT_DIR . '/config/config-path'; | |
| 283 | + $configFile = trim(file_get_contents($pathFile)); | |
| 284 | + | |
| 285 | + $configFile = (!KTUtil::isAbsolutePath($configFile)) ? sprintf('%s/%s', KT_DIR, $configFile) : $configFile; | |
| 286 | + | |
| 287 | + // Remove any double slashes | |
| 288 | + $configFile = str_replace('//', '/', $configFile); | |
| 289 | + $configFile = str_replace('\\\\', '\\', $configFile); | |
| 240 | 290 | |
| 241 | - if (is_file($configPath)) | |
| 291 | + if (file_exists($configFile)) | |
| 242 | 292 | { |
| 243 | - return $configPath; | |
| 293 | + return $configFile; | |
| 244 | 294 | } |
| 245 | 295 | else |
| 246 | 296 | { |
| 247 | - return KT_DIR . '/' . $configPath; | |
| 297 | + return KT_DIR . DIRECTORY_SEPARATOR . $configFile; | |
| 248 | 298 | } |
| 249 | 299 | } |
| 250 | 300 | ... | ... |
plugins/ktcore/admin/configSettings.php
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id: KTCorePlugin.php 7954 2008-01-25 05:56:52Z megan_w $ | |
| 4 | - * | |
| 5 | - * KnowledgeTree Open Source Edition | |
| 6 | - * Document Management Made Simple | |
| 7 | - * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited | |
| 8 | - * | |
| 9 | - * This program is free software; you can redistribute it and/or modify it under | |
| 10 | - * the terms of the GNU General Public License version 3 as published by the | |
| 11 | - * Free Software Foundation. | |
| 12 | - * | |
| 13 | - * This program is distributed in the hope that it will be useful, but WITHOUT | |
| 14 | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 15 | - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 16 | - * details. | |
| 17 | - * | |
| 18 | - * You should have received a copy of the GNU General Public License | |
| 19 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 20 | - * | |
| 21 | - * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, | |
| 22 | - * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. | |
| 23 | - * | |
| 24 | - * The interactive user interfaces in modified source and object code versions | |
| 25 | - * of this program must display Appropriate Legal Notices, as required under | |
| 26 | - * Section 5 of the GNU General Public License version 3. | |
| 27 | - * | |
| 28 | - * In accordance with Section 7(b) of the GNU General Public License version 3, | |
| 29 | - * these Appropriate Legal Notices must retain the display of the "Powered by | |
| 30 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 31 | - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | |
| 32 | - * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | - * copyright notice. | |
| 34 | - * Contributor( s): ______________________________________ | |
| 35 | - * | |
| 36 | - */ | |
| 37 | - | |
| 38 | -require_once(KT_LIB_DIR . '/dispatcher.inc.php'); | |
| 39 | -require_once(KT_LIB_DIR . '/templating/templating.inc.php'); | |
| 40 | - | |
| 41 | -class BaseConfigDispatcher extends KTAdminDispatcher | |
| 42 | -{ | |
| 43 | - function check() { | |
| 44 | - return parent::check(); | |
| 45 | - } | |
| 46 | - | |
| 47 | - function do_main($sQuery) | |
| 48 | - { | |
| 49 | - if(empty($sQuery)) | |
| 50 | - { | |
| 51 | - $sQuery = ''; | |
| 52 | - } | |
| 53 | - $aResults = DBUtil::getResultArray($sQuery); | |
| 54 | - | |
| 55 | - //populating paths correctly | |
| 56 | - $oKTConfig =& KTConfig::getSingleton(); | |
| 57 | - | |
| 58 | - for($i = 0; $i < count($aResults); $i++) | |
| 59 | - { | |
| 60 | - if(strstr($aResults[$i]['value'],'$') != false) | |
| 61 | - { | |
| 62 | - $aResults[$i]['value'] = $oKTConfig->get($aResults[$i]['group_name'].'/'.$aResults[$i]['item']); | |
| 63 | - } | |
| 64 | - } | |
| 65 | - | |
| 66 | - //If template has posted changes for config settings save all values to db. | |
| 67 | - if(isset($_POST['configArray'])) | |
| 68 | - { | |
| 69 | - | |
| 70 | - foreach ($aResults as $values) | |
| 71 | - { | |
| 72 | - | |
| 73 | - //IF current db entries id is in the array sent back by the page AND | |
| 74 | - //the values for the db and the page are different, update the db. | |
| 75 | - if(isset($_POST['configArray'][$values['id']]) && $_POST['configArray'][$values['id']] | |
| 76 | - != $values['value']) | |
| 77 | - { | |
| 78 | - //update entry | |
| 79 | - $aFields = array(); | |
| 80 | - if($values['type'] == 'boolean') | |
| 81 | - { | |
| 82 | - if($_POST['configArray'][$values['id']] == 'true') | |
| 83 | - { | |
| 84 | - $aFields['value'] = true; | |
| 85 | - | |
| 86 | - } | |
| 87 | - else | |
| 88 | - { | |
| 89 | - $aFields['value'] = false; | |
| 90 | - } | |
| 91 | - } | |
| 92 | - else | |
| 93 | - { | |
| 94 | - $aFields['value'] = $_POST['configArray'][$values['id']]; | |
| 95 | - } | |
| 96 | - $oUpdateResult = DBUtil::autoUpdate('config_settings', $aFields, $values['id']); | |
| 97 | - } | |
| 98 | - } | |
| 99 | - } | |
| 100 | - | |
| 101 | - //Get new results after any db change above | |
| 102 | - if(isset($_POST['configArray'])) | |
| 103 | - { | |
| 104 | - $aResults = DBUtil::getResultArray($sQuery); | |
| 105 | - for($i = 0; $i < count($aResults); $i++) | |
| 106 | - { | |
| 107 | - if(strstr($aResults[$i]['value'],'$') != false) | |
| 108 | - { | |
| 109 | - $aResults[$i]['value'] = $oKTConfig->get($aResults[$i]['group_name'].'/'.$aResults[$i]['item']); | |
| 110 | - } | |
| 111 | - } | |
| 112 | - } | |
| 113 | - | |
| 114 | - $oTemplating =& KTTemplating::getSingleton(); | |
| 115 | - | |
| 116 | - $oTemplate =& $oTemplating->loadTemplate('ktcore/configsettings'); | |
| 117 | - | |
| 118 | - //set db config data being sent to template | |
| 119 | - $oTemplate->setData(array( | |
| 120 | - 'results' => $aResults | |
| 121 | - | |
| 122 | - )); | |
| 123 | - return $oTemplate; | |
| 124 | - } | |
| 125 | -} | |
| 126 | - | |
| 127 | -class UIConfigPageDispatcher extends BaseConfigDispatcher | |
| 128 | -{ | |
| 129 | - function check() { | |
| 130 | - $this->aBreadcrumbs[] = array( | |
| 131 | - 'url' => $_SERVER['PHP_SELF'], | |
| 132 | - 'name' => _kt('User Interface Settings'), | |
| 133 | - ); | |
| 134 | - return parent::check(); | |
| 135 | - } | |
| 136 | - | |
| 137 | - function do_main() { | |
| 138 | - | |
| 139 | - //get config settings from db | |
| 140 | - $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where group_name = \'ui\'order by group_name'; | |
| 141 | - return parent::do_main($sQuery); | |
| 142 | - } | |
| 143 | -} | |
| 144 | - | |
| 145 | -class ClientSettingsConfigPageDispatcher extends BaseConfigDispatcher | |
| 146 | -{ | |
| 147 | - function check() { | |
| 148 | - $this->aBreadcrumbs[] = array( | |
| 149 | - 'url' => $_SERVER['PHP_SELF'], | |
| 150 | - 'name' => _kt('Client Tools Settings'), | |
| 151 | - ); | |
| 152 | - return parent::check(); | |
| 153 | - } | |
| 154 | - | |
| 155 | - function do_main() { | |
| 156 | - | |
| 157 | - //get config settings from db | |
| 158 | - $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where | |
| 159 | - group_name = \'KTWebDAVSettings\' or group_name = \'BaobabSettings\' or | |
| 160 | - group_name = \'webservice\' or group_name = \'clientToolPolicies\' order by group_name'; | |
| 161 | - return parent::do_main($sQuery); | |
| 162 | - } | |
| 163 | -} | |
| 164 | - | |
| 165 | -class EmailConfigPageDispatcher extends BaseConfigDispatcher | |
| 166 | -{ | |
| 167 | - function check() { | |
| 168 | - $this->aBreadcrumbs[] = array( | |
| 169 | - 'url' => $_SERVER['PHP_SELF'], | |
| 170 | - 'name' => _kt('Email Settings'), | |
| 171 | - ); | |
| 172 | - return parent::check(); | |
| 173 | - } | |
| 174 | - | |
| 175 | - function do_main() { | |
| 176 | - | |
| 177 | - //get config settings from db | |
| 178 | - $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where group_name = \'email\'order by group_name'; | |
| 179 | - return parent::do_main($sQuery); | |
| 180 | - } | |
| 181 | -} | |
| 182 | - | |
| 183 | -class GeneralConfigPageDispatcher extends BaseConfigDispatcher | |
| 184 | -{ | |
| 185 | - function check() { | |
| 186 | - $this->aBreadcrumbs[] = array( | |
| 187 | - 'url' => $_SERVER['PHP_SELF'], | |
| 188 | - 'name' => _kt('General Settings'), | |
| 189 | - ); | |
| 190 | - return parent::check(); | |
| 191 | - } | |
| 192 | - | |
| 193 | - function do_main() { | |
| 194 | - | |
| 195 | - //get config settings from db | |
| 196 | - $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where | |
| 197 | - item = \'schedulerInterval\' or item = \'fakeMimetype\' | |
| 198 | - or item = \'browseToUnitFolder\' order by group_name'; | |
| 199 | - return parent::do_main($sQuery); | |
| 200 | - } | |
| 201 | -} | |
| 202 | - | |
| 203 | -class i18nConfigPageDispatcher extends BaseConfigDispatcher | |
| 204 | -{ | |
| 205 | - function check() { | |
| 206 | - $this->aBreadcrumbs[] = array( | |
| 207 | - 'url' => $_SERVER['PHP_SELF'], | |
| 208 | - 'name' => _kt('Internationalisation Settings'), | |
| 209 | - ); | |
| 210 | - return parent::check(); | |
| 211 | - } | |
| 212 | - | |
| 213 | - function do_main() { | |
| 214 | - | |
| 215 | - //get config settings from db | |
| 216 | - $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where | |
| 217 | - group_name = \'i18n\' order by group_name'; | |
| 218 | - return parent::do_main($sQuery); | |
| 219 | - } | |
| 220 | -} | |
| 221 | - | |
| 222 | -class SearchAndIndexingConfigPageDispatcher extends BaseConfigDispatcher | |
| 223 | -{ | |
| 224 | - function check() { | |
| 225 | - $this->aBreadcrumbs[] = array( | |
| 226 | - 'url' => $_SERVER['PHP_SELF'], | |
| 227 | - 'name' => _kt('Search and Indexing Settings'), | |
| 228 | - ); | |
| 229 | - return parent::check(); | |
| 230 | - } | |
| 231 | - | |
| 232 | - function do_main() { | |
| 233 | - | |
| 234 | - //get config settings from db | |
| 235 | - $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where | |
| 236 | - group_name = \'search\' or group_name = \'indexer\'order by group_name'; | |
| 237 | - return parent::do_main($sQuery); | |
| 238 | - } | |
| 239 | -} | |
| 240 | -?> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * $Id: KTCorePlugin.php 7954 2008-01-25 05:56:52Z megan_w $ | |
| 4 | + * | |
| 5 | + * KnowledgeTree Open Source Edition | |
| 6 | + * Document Management Made Simple | |
| 7 | + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited | |
| 8 | + * | |
| 9 | + * This program is free software; you can redistribute it and/or modify it under | |
| 10 | + * the terms of the GNU General Public License version 3 as published by the | |
| 11 | + * Free Software Foundation. | |
| 12 | + * | |
| 13 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
| 14 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 15 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 16 | + * details. | |
| 17 | + * | |
| 18 | + * You should have received a copy of the GNU General Public License | |
| 19 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 20 | + * | |
| 21 | + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, | |
| 22 | + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. | |
| 23 | + * | |
| 24 | + * The interactive user interfaces in modified source and object code versions | |
| 25 | + * of this program must display Appropriate Legal Notices, as required under | |
| 26 | + * Section 5 of the GNU General Public License version 3. | |
| 27 | + * | |
| 28 | + * In accordance with Section 7(b) of the GNU General Public License version 3, | |
| 29 | + * these Appropriate Legal Notices must retain the display of the "Powered by | |
| 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 31 | + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | |
| 32 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | + * copyright notice. | |
| 34 | + * Contributor( s): ______________________________________ | |
| 35 | + * | |
| 36 | + */ | |
| 37 | + | |
| 38 | +require_once(KT_LIB_DIR . '/dispatcher.inc.php'); | |
| 39 | +require_once(KT_LIB_DIR . '/templating/templating.inc.php'); | |
| 40 | + | |
| 41 | +class BaseConfigDispatcher extends KTAdminDispatcher | |
| 42 | +{ | |
| 43 | + function check() { | |
| 44 | + return parent::check(); | |
| 45 | + } | |
| 46 | + | |
| 47 | + function do_main($sQuery) | |
| 48 | + { | |
| 49 | + if(empty($sQuery)) | |
| 50 | + { | |
| 51 | + $sQuery = ''; | |
| 52 | + } | |
| 53 | + $aResults = DBUtil::getResultArray($sQuery); | |
| 54 | + | |
| 55 | + //populating paths correctly | |
| 56 | + $oKTConfig =& KTConfig::getSingleton(); | |
| 57 | + | |
| 58 | + for($i = 0; $i < count($aResults); $i++) | |
| 59 | + { | |
| 60 | + if(strstr($aResults[$i]['value'],'$') != false) | |
| 61 | + { | |
| 62 | + $aResults[$i]['value'] = $oKTConfig->get($aResults[$i]['group_name'].'/'.$aResults[$i]['item']); | |
| 63 | + } | |
| 64 | + } | |
| 65 | + | |
| 66 | + //If template has posted changes for config settings save all values to db. | |
| 67 | + if(isset($_POST['configArray'])) | |
| 68 | + { | |
| 69 | + | |
| 70 | + foreach ($aResults as $values) | |
| 71 | + { | |
| 72 | + | |
| 73 | + //IF current db entries id is in the array sent back by the page AND | |
| 74 | + //the values for the db and the page are different, update the db. | |
| 75 | + if(isset($_POST['configArray'][$values['id']]) && $_POST['configArray'][$values['id']] | |
| 76 | + != $values['value']) | |
| 77 | + { | |
| 78 | + //update entry | |
| 79 | + $aFields = array(); | |
| 80 | + if($values['type'] == 'boolean') | |
| 81 | + { | |
| 82 | + if($_POST['configArray'][$values['id']] == 'true') | |
| 83 | + { | |
| 84 | + $aFields['value'] = true; | |
| 85 | + | |
| 86 | + } | |
| 87 | + else | |
| 88 | + { | |
| 89 | + $aFields['value'] = false; | |
| 90 | + } | |
| 91 | + } | |
| 92 | + else | |
| 93 | + { | |
| 94 | + $aFields['value'] = $_POST['configArray'][$values['id']]; | |
| 95 | + } | |
| 96 | + $oUpdateResult = DBUtil::autoUpdate('config_settings', $aFields, $values['id']); | |
| 97 | + } | |
| 98 | + } | |
| 99 | + | |
| 100 | + // Clear the cached settings | |
| 101 | + $oKTConfig->clearCache(); | |
| 102 | + } | |
| 103 | + | |
| 104 | + //Get new results after any db change above | |
| 105 | + if(isset($_POST['configArray'])) | |
| 106 | + { | |
| 107 | + $aResults = DBUtil::getResultArray($sQuery); | |
| 108 | + for($i = 0; $i < count($aResults); $i++) | |
| 109 | + { | |
| 110 | + if(strstr($aResults[$i]['value'],'$') != false) | |
| 111 | + { | |
| 112 | + $aResults[$i]['value'] = $oKTConfig->get($aResults[$i]['group_name'].'/'.$aResults[$i]['item']); | |
| 113 | + } | |
| 114 | + } | |
| 115 | + } | |
| 116 | + | |
| 117 | + $oTemplating =& KTTemplating::getSingleton(); | |
| 118 | + | |
| 119 | + $oTemplate =& $oTemplating->loadTemplate('ktcore/configsettings'); | |
| 120 | + | |
| 121 | + //set db config data being sent to template | |
| 122 | + $oTemplate->setData(array( | |
| 123 | + 'results' => $aResults | |
| 124 | + | |
| 125 | + )); | |
| 126 | + return $oTemplate; | |
| 127 | + } | |
| 128 | +} | |
| 129 | + | |
| 130 | +class UIConfigPageDispatcher extends BaseConfigDispatcher | |
| 131 | +{ | |
| 132 | + function check() { | |
| 133 | + $this->aBreadcrumbs[] = array( | |
| 134 | + 'url' => $_SERVER['PHP_SELF'], | |
| 135 | + 'name' => _kt('User Interface Settings'), | |
| 136 | + ); | |
| 137 | + return parent::check(); | |
| 138 | + } | |
| 139 | + | |
| 140 | + function do_main() { | |
| 141 | + | |
| 142 | + //get config settings from db | |
| 143 | + $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where group_name = \'ui\'order by group_name'; | |
| 144 | + return parent::do_main($sQuery); | |
| 145 | + } | |
| 146 | +} | |
| 147 | + | |
| 148 | +class ClientSettingsConfigPageDispatcher extends BaseConfigDispatcher | |
| 149 | +{ | |
| 150 | + function check() { | |
| 151 | + $this->aBreadcrumbs[] = array( | |
| 152 | + 'url' => $_SERVER['PHP_SELF'], | |
| 153 | + 'name' => _kt('Client Tools Settings'), | |
| 154 | + ); | |
| 155 | + return parent::check(); | |
| 156 | + } | |
| 157 | + | |
| 158 | + function do_main() { | |
| 159 | + | |
| 160 | + //get config settings from db | |
| 161 | + $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where | |
| 162 | + group_name = \'KTWebDAVSettings\' or group_name = \'BaobabSettings\' or | |
| 163 | + group_name = \'webservice\' or group_name = \'clientToolPolicies\' order by group_name'; | |
| 164 | + return parent::do_main($sQuery); | |
| 165 | + } | |
| 166 | +} | |
| 167 | + | |
| 168 | +class EmailConfigPageDispatcher extends BaseConfigDispatcher | |
| 169 | +{ | |
| 170 | + function check() { | |
| 171 | + $this->aBreadcrumbs[] = array( | |
| 172 | + 'url' => $_SERVER['PHP_SELF'], | |
| 173 | + 'name' => _kt('Email Settings'), | |
| 174 | + ); | |
| 175 | + return parent::check(); | |
| 176 | + } | |
| 177 | + | |
| 178 | + function do_main() { | |
| 179 | + | |
| 180 | + //get config settings from db | |
| 181 | + $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where group_name = \'email\'order by group_name'; | |
| 182 | + return parent::do_main($sQuery); | |
| 183 | + } | |
| 184 | +} | |
| 185 | + | |
| 186 | +class GeneralConfigPageDispatcher extends BaseConfigDispatcher | |
| 187 | +{ | |
| 188 | + function check() { | |
| 189 | + $this->aBreadcrumbs[] = array( | |
| 190 | + 'url' => $_SERVER['PHP_SELF'], | |
| 191 | + 'name' => _kt('General Settings'), | |
| 192 | + ); | |
| 193 | + return parent::check(); | |
| 194 | + } | |
| 195 | + | |
| 196 | + function do_main() { | |
| 197 | + | |
| 198 | + //get config settings from db | |
| 199 | + $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where | |
| 200 | + item = \'schedulerInterval\' or item = \'fakeMimetype\' | |
| 201 | + or item = \'browseToUnitFolder\' order by group_name'; | |
| 202 | + return parent::do_main($sQuery); | |
| 203 | + } | |
| 204 | +} | |
| 205 | + | |
| 206 | +class i18nConfigPageDispatcher extends BaseConfigDispatcher | |
| 207 | +{ | |
| 208 | + function check() { | |
| 209 | + $this->aBreadcrumbs[] = array( | |
| 210 | + 'url' => $_SERVER['PHP_SELF'], | |
| 211 | + 'name' => _kt('Internationalisation Settings'), | |
| 212 | + ); | |
| 213 | + return parent::check(); | |
| 214 | + } | |
| 215 | + | |
| 216 | + function do_main() { | |
| 217 | + | |
| 218 | + //get config settings from db | |
| 219 | + $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where | |
| 220 | + group_name = \'i18n\' order by group_name'; | |
| 221 | + return parent::do_main($sQuery); | |
| 222 | + } | |
| 223 | +} | |
| 224 | + | |
| 225 | +class SearchAndIndexingConfigPageDispatcher extends BaseConfigDispatcher | |
| 226 | +{ | |
| 227 | + function check() { | |
| 228 | + $this->aBreadcrumbs[] = array( | |
| 229 | + 'url' => $_SERVER['PHP_SELF'], | |
| 230 | + 'name' => _kt('Search and Indexing Settings'), | |
| 231 | + ); | |
| 232 | + return parent::check(); | |
| 233 | + } | |
| 234 | + | |
| 235 | + function do_main() { | |
| 236 | + | |
| 237 | + //get config settings from db | |
| 238 | + $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where | |
| 239 | + group_name = \'search\' or group_name = \'indexer\'order by group_name'; | |
| 240 | + return parent::do_main($sQuery); | |
| 241 | + } | |
| 242 | +} | |
| 243 | +?> | ... | ... |