Project

General

Profile

« Previous | Next » 

Revision 1686

Added by darkviper about 12 years ago

some modifications concerning the new autoloader
Twig Template engine v.1.7.0
some droplets actualisized
unfinished changes in installer

View differences:

initialize.php
50 50
		$_SERVER['HTTP_REFERER'] = $sTmpReferer;
51 51
	}
52 52
/* -------------------------------------------------------- */
53
/**
54
 * Autoloader to load classes according to the new WB-2.9 standard
55
 * @param string $sClassName name of the requested class
56
 */
57
	function CoreAutoloader($sClassName) {
58
		$iCount = 0;
59
		$aSearch = array('/^m_/i', '/^a_/i');
60
		$aReplace = array('modules_', ADMIN_DIRECTORY.'_' );
61
		$sClassName = preg_replace($aSearch, $aReplace, $sClassName, 1, $iCount);
62
		if(!$iCount) { $sClassName = 'framework_'.$sClassName; }
63
		$sFileName = WB_PATH.'/'.str_replace('_', '/', $sClassName).'.php';
64
		if(file_exists($sFileName)) {
65
			include($sFileName);
66
		}
67
	}
68
/* -------------------------------------------------------- */
69 53
	function SetInstallPathConstants() {
70 54
		if(!defined('DEBUG')){ define('DEBUG', false); }// Include config file
71 55
		if(!defined('ADMIN_DIRECTORY')){ define('ADMIN_DIRECTORY', 'admin'); }
......
87 71
	$starttime = array_sum(explode(" ",microtime()));
88 72
	SetInstallPathConstants();
89 73
	SanitizeHttpReferer(WB_URL); // sanitize $_SERVER['HTTP_REFERER']
90
	spl_autoload_register('CoreAutoloader'); // activate core autoloader
74
	if(!class_exists('WbAutoloader', false)){ include(dirname(__FILE__.'/WbAutoloader.php')); }
75
	WbAutoloader::doRegister(array(ADMIN_DIRECTORY => 'a', 'modules' => 'm'));
91 76
	date_default_timezone_set('UTC');
92 77
	// Create database class
93 78
	$sSqlUrl = DB_TYPE.'://'.DB_USERNAME.':'.DB_PASSWORD.'@'.DB_HOST.'/'.DB_NAME;
94
	$database = Database::getInstance();
79
	$database = WbDatabase::getInstance();
95 80
	$database->doConnect($sSqlUrl);
96 81
	// disable all kind of magic_quotes
97 82
	if(get_magic_quotes_gpc() || get_magic_quotes_runtime()) {

Also available in: Unified diff