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 64 $default->log = new KTLegacyLog($default->fileSystemRoot . "/log", $default->logLevel);
65 65 $res = $default->log->initialiseLogFile();
66 66 if (PEAR::isError($res)) {
67   - KTInit::handleInitError($res);
  67 + $this->handleInitError($res);
68 68 // returns only in checkup
69 69 return $res;
70 70 }
71 71 $default->queryLog = new KTLegacyLog($default->fileSystemRoot . "/log", $default->logLevel, "query");
72 72 $res = $default->queryLog->initialiseLogFile();
73 73 if (PEAR::isError($res)) {
74   - KTInit::handleInitError($res);
  74 + $this->handleInitError($res);
75 75 // returns only in checkup
76 76 return $res;
77 77 }
78 78 $default->timerLog = new KTLegacyLog($default->fileSystemRoot . "/log", $default->logLevel, "timer");
79 79 $res = $default->timerLog->initialiseLogFile();
80 80 if (PEAR::isError($res)) {
81   - KTInit::handleInitError($res);
  81 + $this->handleInitError($res);
82 82 // returns only in checkup
83 83 return $res;
84 84 }
... ... @@ -159,7 +159,7 @@ class KTInit {
159 159  
160 160 $default->_db = &DB::connect($dsn, $options);
161 161 if (PEAR::isError($default->_db)) {
162   - KTInit::handleInitError($default->_db);
  162 + $this->handleInitError($default->_db);
163 163 // returns only in checkup
164 164 return $default->_db;
165 165 }
... ... @@ -192,7 +192,7 @@ class KTInit {
192 192 function cleanMagicQuotesItem (&$var) {
193 193 if (is_array($var)) {
194 194 foreach ($var as $key => $val) {
195   - KTInit::cleanMagicQuotesItem($var[$key]);
  195 + $this->cleanMagicQuotesItem($var[$key]);
196 196 }
197 197 } else {
198 198 // XXX: Make it look pretty
... ... @@ -204,10 +204,10 @@ class KTInit {
204 204 // {{{ cleanMagicQuotes()
205 205 function cleanMagicQuotes () {
206 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 286 }
287 287 // }}}
288 288  
  289 +$KTInit = new KTInit();
  290 +
289 291 // Application defaults
290 292 //
291 293 // Overridden in environment.php
... ... @@ -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 317 // include the environment settings
316 318 require_once("environment.php");
317 319  
318 320  
319   -KTInit::prependPath(KT_DIR . '/pear');
  321 +$KTInit->prependPath(KT_DIR . '/pear');
320 322 require_once('PEAR.php');
321 323  
322 324 // instantiate log
323   -$loggingSupport = KTInit::setupLogging();
  325 +$loggingSupport = $KTInit->setupLogging();
324 326  
325 327 // Send all PHP errors to a file (and maybe a window)
326 328 set_error_handler(array('KTInit', 'handlePHPError'));
... ... @@ -331,8 +333,8 @@ require_once(KT_LIB_DIR . '/util/legacy.inc');
331 333 // Give everyone access to KTUtil utility functions
332 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 339 require_once("$default->fileSystemRoot/lib/authentication/$default->authenticationClass.inc");
338 340  
... ... @@ -352,7 +354,7 @@ if ($default->useDatabaseConfiguration && $default->system->initialised()) {
352 354 // table mapping entries
353 355 include("tableMappings.inc");
354 356  
355   -$i18nLoaded = KTInit::setupI18n();
  357 +$i18nLoaded = $KTInit->setupI18n();
356 358 if ($i18nLoaded === false) {
357 359 // define a dummy _ function so gettext is not -required-
358 360 function _($sString) {
... ... @@ -363,8 +365,8 @@ if ($i18nLoaded === false) {
363 365 $default->systemVersion = file_get_contents(KT_DIR . '/docs/VERSION.txt');
364 366 $default->lastDatebaseVersion = '2.0.2';
365 367  
366   -KTInit::cleanGlobals();
367   -KTInit::cleanMagicQuotes();
  368 +$KTInit->cleanGlobals();
  369 +$KTInit->cleanMagicQuotes();
368 370  
369 371 // site map definition
370 372 include("siteMap.inc");
... ...