Commit de63b2cacd4e1b0d9bc41d00b4f37ab50ed9b31b

Authored by Conrad Vermeulen
1 parent d3a879e2

KTS-3326

"Bug when loading cached config results in an error with array_key_exists."
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Philip Arkoll

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8413 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 25 additions and 17 deletions
config/dmsDefaults.php
@@ -8,31 +8,31 @@ @@ -8,31 +8,31 @@
8 * Document Management Made Simple 8 * Document Management Made Simple
9 * Copyright (C) 2008 KnowledgeTree Inc. 9 * Copyright (C) 2008 KnowledgeTree Inc.
10 * Portions copyright The Jam Warehouse Software (Pty) Limited 10 * Portions copyright The Jam Warehouse Software (Pty) Limited
11 - * 11 + *
12 * This program is free software; you can redistribute it and/or modify it under 12 * This program is free software; you can redistribute it and/or modify it under
13 * the terms of the GNU General Public License version 3 as published by the 13 * the terms of the GNU General Public License version 3 as published by the
14 * Free Software Foundation. 14 * Free Software Foundation.
15 - * 15 + *
16 * This program is distributed in the hope that it will be useful, but WITHOUT 16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 * details. 19 * details.
20 - * 20 + *
21 * You should have received a copy of the GNU General Public License 21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>. 22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 - *  
24 - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, 23 + *
  24 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
25 * California 94120-7775, or email info@knowledgetree.com. 25 * California 94120-7775, or email info@knowledgetree.com.
26 - * 26 + *
27 * The interactive user interfaces in modified source and object code versions 27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under 28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU General Public License version 3. 29 * Section 5 of the GNU General Public License version 3.
30 - * 30 + *
31 * In accordance with Section 7(b) of the GNU General Public License version 3, 31 * In accordance with Section 7(b) of the GNU General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by 32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 33 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
34 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 34 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
35 - * must display the words "Powered by KnowledgeTree" and retain the original 35 + * must display the words "Powered by KnowledgeTree" and retain the original
36 * copyright notice. 36 * copyright notice.
37 * Contributor( s): Guenter Roeck______________________________________ 37 * Contributor( s): Guenter Roeck______________________________________
38 * 38 *
@@ -392,25 +392,25 @@ class KTInit { @@ -392,25 +392,25 @@ class KTInit {
392 392
393 function catchFatalErrors() 393 function catchFatalErrors()
394 { 394 {
395 - 395 +
396 $CustomErrorPage = KTCustomErrorViewer::getCustomErrorRedirectPage(); 396 $CustomErrorPage = KTCustomErrorViewer::getCustomErrorRedirectPage();
397 if($CustomErrorPage != '0') 397 if($CustomErrorPage != '0')
398 { 398 {
399 ini_set('display_errors','On'); 399 ini_set('display_errors','On');
400 $phperror='><div id="phperror" style="display:none">'; 400 $phperror='><div id="phperror" style="display:none">';
401 ini_set('error_prepend_string',$phperror); 401 ini_set('error_prepend_string',$phperror);
402 - 402 +
403 $sUrl = KTInit::guessRootUrl(); 403 $sUrl = KTInit::guessRootUrl();
404 global $default; 404 global $default;
405 $sRootUrl = ($default->sslEnabled ? 'https' : 'http') .'://'.$_SERVER['HTTP_HOST'].$sUrl; 405 $sRootUrl = ($default->sslEnabled ? 'https' : 'http') .'://'.$_SERVER['HTTP_HOST'].$sUrl;
406 - 406 +
407 $CustomErrorPage = basename($CustomErrorPage); 407 $CustomErrorPage = basename($CustomErrorPage);
408 - 408 +
409 $phperror='</div>><form name="catcher" action="'.$sRootUrl.'/'.$CustomErrorPage.'" method="post" ><input type="hidden" name="fatal" value=""></form> 409 $phperror='</div>><form name="catcher" action="'.$sRootUrl.'/'.$CustomErrorPage.'" method="post" ><input type="hidden" name="fatal" value=""></form>
410 <script> document.catcher.fatal.value = document.getElementById("phperror").innerHTML; document.catcher.submit();</script>'; 410 <script> document.catcher.fatal.value = document.getElementById("phperror").innerHTML; document.catcher.submit();</script>';
411 ini_set('error_append_string',$phperror); 411 ini_set('error_append_string',$phperror);
412 } 412 }
413 - 413 +
414 } 414 }
415 415
416 416
@@ -481,10 +481,18 @@ function catchFatalErrors() @@ -481,10 +481,18 @@ function catchFatalErrors()
481 $oKTConfig =& KTConfig::getSingleton(); 481 $oKTConfig =& KTConfig::getSingleton();
482 $oKTConfig->loadCache($cache_file); 482 $oKTConfig->loadCache($cache_file);
483 483
484 - foreach ($oKTConfig->flat as $k => $v) {  
485 - $default->$k = $oKTConfig->get($k); 484 + // checking flatns as it should be more complete
  485 + if (empty($oKTConfig->flatns)) {
  486 + $use_cache = false;
486 } 487 }
487 - } else { 488 + else {
  489 + foreach ($oKTConfig->flat as $k => $v) {
  490 + $default->$k = $oKTConfig->get($k);
  491 + }
  492 + }
  493 + }
  494 +
  495 + if (!$use_cache) {
488 $oKTConfig =& KTConfig::getSingleton(); 496 $oKTConfig =& KTConfig::getSingleton();
489 497
490 $oKTConfig->setdefaultns('ui', 'appName', 'KnowledgeTree'); 498 $oKTConfig->setdefaultns('ui', 'appName', 'KnowledgeTree');