Commit 8a50e226d78320bb474685eeab90823247c4e591

Authored by Neil Blakey-Milner
1 parent e5db552e

Use KTInit as an object rather than a utility class.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3284 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 19 additions and 17 deletions
config/dmsDefaults.php
@@ -64,21 +64,21 @@ class KTInit { @@ -64,21 +64,21 @@ class KTInit {
64 $default->log = new KTLegacyLog($default->fileSystemRoot . "/log", $default->logLevel); 64 $default->log = new KTLegacyLog($default->fileSystemRoot . "/log", $default->logLevel);
65 $res = $default->log->initialiseLogFile(); 65 $res = $default->log->initialiseLogFile();
66 if (PEAR::isError($res)) { 66 if (PEAR::isError($res)) {
67 - KTInit::handleInitError($res); 67 + $this->handleInitError($res);
68 // returns only in checkup 68 // returns only in checkup
69 return $res; 69 return $res;
70 } 70 }
71 $default->queryLog = new KTLegacyLog($default->fileSystemRoot . "/log", $default->logLevel, "query"); 71 $default->queryLog = new KTLegacyLog($default->fileSystemRoot . "/log", $default->logLevel, "query");
72 $res = $default->queryLog->initialiseLogFile(); 72 $res = $default->queryLog->initialiseLogFile();
73 if (PEAR::isError($res)) { 73 if (PEAR::isError($res)) {
74 - KTInit::handleInitError($res); 74 + $this->handleInitError($res);
75 // returns only in checkup 75 // returns only in checkup
76 return $res; 76 return $res;
77 } 77 }
78 $default->timerLog = new KTLegacyLog($default->fileSystemRoot . "/log", $default->logLevel, "timer"); 78 $default->timerLog = new KTLegacyLog($default->fileSystemRoot . "/log", $default->logLevel, "timer");
79 $res = $default->timerLog->initialiseLogFile(); 79 $res = $default->timerLog->initialiseLogFile();
80 if (PEAR::isError($res)) { 80 if (PEAR::isError($res)) {
81 - KTInit::handleInitError($res); 81 + $this->handleInitError($res);
82 // returns only in checkup 82 // returns only in checkup
83 return $res; 83 return $res;
84 } 84 }
@@ -159,7 +159,7 @@ class KTInit { @@ -159,7 +159,7 @@ class KTInit {
159 159
160 $default->_db = &DB::connect($dsn, $options); 160 $default->_db = &DB::connect($dsn, $options);
161 if (PEAR::isError($default->_db)) { 161 if (PEAR::isError($default->_db)) {
162 - KTInit::handleInitError($default->_db); 162 + $this->handleInitError($default->_db);
163 // returns only in checkup 163 // returns only in checkup
164 return $default->_db; 164 return $default->_db;
165 } 165 }
@@ -192,7 +192,7 @@ class KTInit { @@ -192,7 +192,7 @@ class KTInit {
192 function cleanMagicQuotesItem (&$var) { 192 function cleanMagicQuotesItem (&$var) {
193 if (is_array($var)) { 193 if (is_array($var)) {
194 foreach ($var as $key => $val) { 194 foreach ($var as $key => $val) {
195 - KTInit::cleanMagicQuotesItem($var[$key]); 195 + $this->cleanMagicQuotesItem($var[$key]);
196 } 196 }
197 } else { 197 } else {
198 // XXX: Make it look pretty 198 // XXX: Make it look pretty
@@ -204,10 +204,10 @@ class KTInit { @@ -204,10 +204,10 @@ class KTInit {
204 // {{{ cleanMagicQuotes() 204 // {{{ cleanMagicQuotes()
205 function cleanMagicQuotes () { 205 function cleanMagicQuotes () {
206 if (get_magic_quotes_gpc()) { 206 if (get_magic_quotes_gpc()) {
207 - KTInit::cleanMagicQuotesItem($_GET);  
208 - KTInit::cleanMagicQuotesItem($_POST);  
209 - KTInit::cleanMagicQuotesItem($_REQUEST);  
210 - KTInit::cleanMagicQuotesItem($_COOKIE); 207 + $this->cleanMagicQuotesItem($_GET);
  208 + $this->cleanMagicQuotesItem($_POST);
  209 + $this->cleanMagicQuotesItem($_REQUEST);
  210 + $this->cleanMagicQuotesItem($_COOKIE);
211 } 211 }
212 } 212 }
213 // }}} 213 // }}}
@@ -286,6 +286,8 @@ class KTInit { @@ -286,6 +286,8 @@ class KTInit {
286 } 286 }
287 // }}} 287 // }}}
288 288
  289 +$KTInit = new KTInit();
  290 +
289 // Application defaults 291 // Application defaults
290 // 292 //
291 // Overridden in environment.php 293 // Overridden in environment.php
@@ -310,17 +312,17 @@ if (array_key_exists('HTTPS', $_SERVER)) { @@ -310,17 +312,17 @@ if (array_key_exists('HTTPS', $_SERVER)) {
310 } 312 }
311 } 313 }
312 314
313 -$default->rootUrl = KTInit::guessRootUrl(); 315 +$default->rootUrl = $KTInit->guessRootUrl();
314 316
315 // include the environment settings 317 // include the environment settings
316 require_once("environment.php"); 318 require_once("environment.php");
317 319
318 320
319 -KTInit::prependPath(KT_DIR . '/pear'); 321 +$KTInit->prependPath(KT_DIR . '/pear');
320 require_once('PEAR.php'); 322 require_once('PEAR.php');
321 323
322 // instantiate log 324 // instantiate log
323 -$loggingSupport = KTInit::setupLogging(); 325 +$loggingSupport = $KTInit->setupLogging();
324 326
325 // Send all PHP errors to a file (and maybe a window) 327 // Send all PHP errors to a file (and maybe a window)
326 set_error_handler(array('KTInit', 'handlePHPError')); 328 set_error_handler(array('KTInit', 'handlePHPError'));
@@ -331,8 +333,8 @@ require_once(KT_LIB_DIR . '/util/legacy.inc'); @@ -331,8 +333,8 @@ require_once(KT_LIB_DIR . '/util/legacy.inc');
331 // Give everyone access to KTUtil utility functions 333 // Give everyone access to KTUtil utility functions
332 require_once(KT_LIB_DIR . '/util/ktutil.inc'); 334 require_once(KT_LIB_DIR . '/util/ktutil.inc');
333 335
334 -$dbSupport = KTInit::setupDB();  
335 -KTInit::setupRandomSeed(); 336 +$dbSupport = $KTInit->setupDB();
  337 +$KTInit->setupRandomSeed();
336 338
337 require_once("$default->fileSystemRoot/lib/authentication/$default->authenticationClass.inc"); 339 require_once("$default->fileSystemRoot/lib/authentication/$default->authenticationClass.inc");
338 340
@@ -352,7 +354,7 @@ if ($default->useDatabaseConfiguration && $default->system->initialised()) { @@ -352,7 +354,7 @@ if ($default->useDatabaseConfiguration && $default->system->initialised()) {
352 // table mapping entries 354 // table mapping entries
353 include("tableMappings.inc"); 355 include("tableMappings.inc");
354 356
355 -$i18nLoaded = KTInit::setupI18n(); 357 +$i18nLoaded = $KTInit->setupI18n();
356 if ($i18nLoaded === false) { 358 if ($i18nLoaded === false) {
357 // define a dummy _ function so gettext is not -required- 359 // define a dummy _ function so gettext is not -required-
358 function _($sString) { 360 function _($sString) {
@@ -363,8 +365,8 @@ if ($i18nLoaded === false) { @@ -363,8 +365,8 @@ if ($i18nLoaded === false) {
363 $default->systemVersion = file_get_contents(KT_DIR . '/docs/VERSION.txt'); 365 $default->systemVersion = file_get_contents(KT_DIR . '/docs/VERSION.txt');
364 $default->lastDatebaseVersion = '2.0.2'; 366 $default->lastDatebaseVersion = '2.0.2';
365 367
366 -KTInit::cleanGlobals();  
367 -KTInit::cleanMagicQuotes(); 368 +$KTInit->cleanGlobals();
  369 +$KTInit->cleanMagicQuotes();
368 370
369 // site map definition 371 // site map definition
370 include("siteMap.inc"); 372 include("siteMap.inc");