Changeset View
Changeset View
Standalone View
Standalone View
branches/5.3.x/core/kernel/application.php
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | |||||
* @access public | * @access public | ||||
*/ | */ | ||||
public $Debugger = null; | public $Debugger = null; | ||||
/** | /** | ||||
* Holds all phrases used | * Holds all phrases used | ||||
* in code and template | * in code and template | ||||
* | * | ||||
* @var PhrasesCache | * @var kPhraseCache | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public $Phrases; | public $Phrases; | ||||
/** | /** | ||||
* Modules table content, key - module name | * Modules table content, key - module name | ||||
* | * | ||||
* @var Array | * @var Array | ||||
▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Line(s) | |||||
if ( defined('DEBUG_MODE') && $this->isDebugMode() ) { | if ( defined('DEBUG_MODE') && $this->isDebugMode() ) { | ||||
$this->Debugger->appendTimestamp('After UnitConfigReader'); | $this->Debugger->appendTimestamp('After UnitConfigReader'); | ||||
} | } | ||||
define('MOD_REWRITE', $this->ConfigValue('UseModRewrite') && !$this->isAdmin ? 1 : 0); | define('MOD_REWRITE', $this->ConfigValue('UseModRewrite') && !$this->isAdmin ? 1 : 0); | ||||
// start processing request | // start processing request | ||||
$this->HttpQuery = $this->recallObject('HTTPQuery'); | $this->HttpQuery = $this->recallObject('kHTTPQuery'); | ||||
$this->HttpQuery->process(); | $this->HttpQuery->process(); | ||||
if ( defined('DEBUG_MODE') && $this->isDebugMode() ) { | if ( defined('DEBUG_MODE') && $this->isDebugMode() ) { | ||||
$this->Debugger->appendTimestamp('Processed HTTPQuery initial'); | $this->Debugger->appendTimestamp('Processed HTTPQuery initial'); | ||||
} | } | ||||
$this->Session = $this->recallObject('Session'); | $this->Session = $this->recallObject('Session'); | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | |||||
*/ | */ | ||||
public function InitManagers() | public function InitManagers() | ||||
{ | { | ||||
if ( $this->InitDone ) { | if ( $this->InitDone ) { | ||||
throw new Exception('Duplicate call of ' . __METHOD__, E_USER_ERROR); | throw new Exception('Duplicate call of ' . __METHOD__, E_USER_ERROR); | ||||
} | } | ||||
$this->UrlManager = $this->makeClass('kUrlManager'); | $this->UrlManager = $this->makeClass('kUrlManager'); | ||||
$this->EventManager = $this->makeClass('EventManager'); | $this->EventManager = $this->makeClass('kEventManager'); | ||||
$this->Phrases = $this->makeClass('kPhraseCache'); | $this->Phrases = $this->makeClass('kPhraseCache'); | ||||
$this->RegisterDefaultBuildEvents(); | $this->RegisterDefaultBuildEvents(); | ||||
} | } | ||||
/** | /** | ||||
* Returns module information. Searches module by requested field | * Returns module information. Searches module by requested field | ||||
* | * | ||||
Show All 25 Lines | |||||
* | * | ||||
* @return void | * @return void | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function refreshModuleInfo() | public function refreshModuleInfo() | ||||
{ | { | ||||
if ( defined('IS_INSTALL') && IS_INSTALL && !$this->TableFound('Modules', true) ) { | if ( defined('IS_INSTALL') && IS_INSTALL && !$this->TableFound('Modules', true) ) { | ||||
$this->registerModuleConstants(); | $this->registerModuleConstants(); | ||||
$this->Factory->configureAutoloader(); | |||||
return; | return; | ||||
} | } | ||||
// use makeClass over recallObject, since used before kApplication initialization during installation | // use makeClass over recallObject, since used before kApplication initialization during installation | ||||
$modules_helper = $this->makeClass('ModulesHelper'); | $modules_helper = $this->makeClass('kModulesHelper'); | ||||
/* @var $modules_helper kModulesHelper */ | /* @var $modules_helper kModulesHelper */ | ||||
$this->Conn->nextQueryCachable = true; | $this->Conn->nextQueryCachable = true; | ||||
$sql = 'SELECT * | $sql = 'SELECT * | ||||
FROM ' . TABLE_PREFIX . 'Modules | FROM ' . TABLE_PREFIX . 'Modules | ||||
WHERE ' . $modules_helper->getWhereClause() . ' | WHERE ' . $modules_helper->getWhereClause() . ' | ||||
ORDER BY LoadOrder'; | ORDER BY LoadOrder'; | ||||
$this->ModuleInfo = $this->Conn->Query($sql, 'Name'); | $this->ModuleInfo = $this->Conn->Query($sql, 'Name'); | ||||
$this->registerModuleConstants(); | $this->registerModuleConstants(); | ||||
$this->Factory->configureAutoloader(); | |||||
} | } | ||||
/** | /** | ||||
* Checks if passed language id if valid and sets it to primary otherwise | * Checks if passed language id if valid and sets it to primary otherwise | ||||
* | * | ||||
* @return void | * @return void | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 205 Lines • ▼ Show 20 Line(s) | |||||
if ( $this->siteDomain->isLoaded() ) { | if ( $this->siteDomain->isLoaded() ) { | ||||
return $formatted ? $this->siteDomain->GetField($field, $format) : $this->siteDomain->GetDBField($field); | return $formatted ? $this->siteDomain->GetField($field, $format) : $this->siteDomain->GetDBField($field); | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
/** | /** | ||||
* Registers default classes such as kDBEventHandler, kUrlManager | * Registers classes, that are used before unit configs (where class registration usually is done) are read. | ||||
* | * | ||||
* Called automatically while initializing kApplication | * Called automatically while initializing kApplication. | ||||
* | * | ||||
* @return void | * @return void | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function RegisterDefaultClasses() | public function RegisterDefaultClasses() | ||||
{ | { | ||||
$this->registerClass('kHelper', KERNEL_PATH . '/kbase.php'); | // Database. | ||||
$this->registerClass('kMultipleFilter', KERNEL_PATH . '/utility/filters.php'); | $this->registerClass('IDBConnection', KERNEL_PATH . '/db/i_db_connection.php'); | ||||
$this->registerClass('kiCacheable', KERNEL_PATH . '/interfaces/cacheable.php'); | $this->registerClass('kDBConnection', KERNEL_PATH . '/db/db_connection.php'); | ||||
$this->registerClass('kDBConnectionDebug', KERNEL_PATH . '/db/db_connection.php'); | |||||
$this->registerClass('kDBLoadBalancer', KERNEL_PATH . '/db/db_load_balancer.php'); | |||||
$this->registerClass('kEventManager', KERNEL_PATH . '/event_manager.php', 'EventManager'); | // Cache. | ||||
$this->registerClass('kHookManager', KERNEL_PATH . '/managers/hook_manager.php'); | $this->registerClass('kCacheManager', KERNEL_PATH . '/managers/cache_manager.php'); | ||||
$this->registerClass('kScheduledTaskManager', KERNEL_PATH . '/managers/scheduled_task_manager.php'); | $this->registerClass('kCache', KERNEL_PATH . '/utility/cache.php'); | ||||
$this->registerClass('kRequestManager', KERNEL_PATH . '/managers/request_manager.php'); | |||||
$this->registerClass('kSubscriptionManager', KERNEL_PATH . '/managers/subscription_manager.php'); | // Unit configs. | ||||
$this->registerClass('kUnitConfigReader', KERNEL_PATH . '/utility/unit_config_reader.php'); | |||||
$this->registerClass('kUnitConfigCloner', KERNEL_PATH . '/utility/unit_config_cloner.php'); | |||||
// Urls. | |||||
$this->registerClass('kUrlManager', KERNEL_PATH . '/managers/url_manager.php'); | $this->registerClass('kUrlManager', KERNEL_PATH . '/managers/url_manager.php'); | ||||
$this->registerClass('kUrlProcessor', KERNEL_PATH . '/managers/url_processor.php'); | $this->registerClass('kUrlProcessor', KERNEL_PATH . '/managers/url_processor.php'); | ||||
$this->registerClass('kPlainUrlProcessor', KERNEL_PATH . '/managers/plain_url_processor.php'); | $this->registerClass('kPlainUrlProcessor', KERNEL_PATH . '/managers/plain_url_processor.php'); | ||||
$this->registerClass('kRewriteUrlProcessor', KERNEL_PATH . '/managers/rewrite_url_processor.php'); | // $this->registerClass('kRewriteUrlProcessor', KERNEL_PATH . '/managers/rewrite_url_processor.php'); | ||||
$this->registerClass('kCacheManager', KERNEL_PATH . '/managers/cache_manager.php'); | // Events. | ||||
$this->registerClass('PhrasesCache', KERNEL_PATH . '/languages/phrases_cache.php', 'kPhraseCache'); | $this->registerClass('kEventManager', KERNEL_PATH . '/event_manager.php'); | ||||
$this->registerClass('kTempTablesHandler', KERNEL_PATH . '/utility/temp_handler.php'); | $this->registerClass('kHookManager', KERNEL_PATH . '/managers/hook_manager.php'); | ||||
$this->registerClass('kValidator', KERNEL_PATH . '/utility/validator.php'); | $this->registerClass('kScheduledTaskManager', KERNEL_PATH . '/managers/scheduled_task_manager.php'); | ||||
$this->registerClass('kOpenerStack', KERNEL_PATH . '/utility/opener_stack.php'); | $this->registerClass('kRequestManager', KERNEL_PATH . '/managers/request_manager.php'); | ||||
$this->registerClass('kLogger', KERNEL_PATH . '/utility/logger.php'); | |||||
$this->registerClass('kUnitConfig', KERNEL_PATH . '/utility/unit_config.php'); | // Misc. | ||||
$this->registerClass('kUnitConfigReader', KERNEL_PATH . '/utility/unit_config_reader.php'); | $this->registerClass('kPhraseCache', KERNEL_PATH . '/languages/phrases_cache.php'); | ||||
$this->registerClass('kUnitConfigCloner', KERNEL_PATH . '/utility/unit_config_cloner.php'); | $this->registerClass('kModulesHelper', KERNEL_PATH . self::MODULE_HELPER_PATH); | ||||
$this->registerClass('PasswordHash', KERNEL_PATH . '/utility/php_pass.php'); | |||||
// Params class descendants | // Aliased. | ||||
$this->registerClass('kArray', KERNEL_PATH . '/utility/params.php'); | |||||
$this->registerClass('Params', KERNEL_PATH . '/utility/params.php'); | |||||
$this->registerClass('Params', KERNEL_PATH . '/utility/params.php', 'kActions'); | $this->registerClass('Params', KERNEL_PATH . '/utility/params.php', 'kActions'); | ||||
$this->registerClass('kCache', KERNEL_PATH . '/utility/cache.php', 'kCache', 'Params'); | |||||
$this->registerClass('kHTTPQuery', KERNEL_PATH . '/utility/http_query.php', 'HTTPQuery'); | |||||
// session | |||||
$this->registerClass('kCookieHasher', KERNEL_PATH . '/utility/cookie_hasher.php'); | |||||
$this->registerClass('Session', KERNEL_PATH . '/session/session.php'); | |||||
$this->registerClass('SessionStorage', KERNEL_PATH . '/session/session_storage.php'); | |||||
$this->registerClass('InpSession', KERNEL_PATH . '/session/inp_session.php', 'Session'); | |||||
$this->registerClass('InpSessionStorage', KERNEL_PATH . '/session/inp_session_storage.php', 'SessionStorage'); | |||||
// template parser | |||||
$this->registerClass('kTagProcessor', KERNEL_PATH . '/processors/tag_processor.php'); | |||||
$this->registerClass('kMainTagProcessor', KERNEL_PATH . '/processors/main_processor.php', 'm_TagProcessor'); | $this->registerClass('kMainTagProcessor', KERNEL_PATH . '/processors/main_processor.php', 'm_TagProcessor'); | ||||
$this->registerClass('kDBTagProcessor', KERNEL_PATH . '/db/db_tag_processor.php'); | |||||
$this->registerClass('kCatDBTagProcessor', KERNEL_PATH . '/db/cat_tag_processor.php'); | |||||
$this->registerClass('NParser', KERNEL_PATH . '/nparser/nparser.php'); | |||||
$this->registerClass('TemplatesCache', KERNEL_PATH . '/nparser/template_cache.php'); | |||||
// database | |||||
$this->registerClass('kDBConnection', KERNEL_PATH . '/db/db_connection.php'); | |||||
$this->registerClass('kDBConnectionDebug', KERNEL_PATH . '/db/db_connection.php'); | |||||
$this->registerClass('kDBLoadBalancer', KERNEL_PATH . '/db/db_load_balancer.php'); | |||||
$this->registerClass('kDBItem', KERNEL_PATH . '/db/dbitem.php'); | |||||
$this->registerClass('kCatDBItem', KERNEL_PATH . '/db/cat_dbitem.php'); | |||||
$this->registerClass('kDBList', KERNEL_PATH . '/db/dblist.php'); | |||||
$this->registerClass('kCatDBList', KERNEL_PATH . '/db/cat_dblist.php'); | |||||
$this->registerClass('kDBEventHandler', KERNEL_PATH . '/db/db_event_handler.php'); | |||||
$this->registerClass('kCatDBEventHandler', KERNEL_PATH . '/db/cat_event_handler.php'); | |||||
// email sending | |||||
$this->registerClass('kEmail', KERNEL_PATH . '/utility/email.php'); | |||||
$this->registerClass('kEmailSendingHelper', KERNEL_PATH . '/utility/email_send.php', 'EmailSender'); | $this->registerClass('kEmailSendingHelper', KERNEL_PATH . '/utility/email_send.php', 'EmailSender'); | ||||
$this->registerClass('kSocket', KERNEL_PATH . '/utility/socket.php', 'Socket'); | |||||
// do not move to config - this helper is used before configs are read | |||||
$this->registerClass('kModulesHelper', KERNEL_PATH . self::MODULE_HELPER_PATH, 'ModulesHelper'); | |||||
} | } | ||||
/** | /** | ||||
* Registers default build events | * Registers default build events | ||||
* | * | ||||
* @return void | * @return void | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 2317 Lines • Show Last 20 Lines |