Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Feb 22, 12:04 AM

in-portal

Index: branches/5.3.x/core/kernel/application.php
===================================================================
--- branches/5.3.x/core/kernel/application.php (revision 16180)
+++ branches/5.3.x/core/kernel/application.php (revision 16181)
@@ -1,3064 +1,3076 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
+use Intechnic\InPortal\Core\kernel\Console\ConsoleApplication;
+
defined('FULL_PATH') or die('restricted access!');
/**
* Basic class for Kernel4-based Application
*
* This class is a Facade for any other class which needs to deal with Kernel4 framework.<br>
* The class encapsulates the main run-cycle of the script, provide access to all other objects in the framework.<br>
* <br>
* The class is a singleton, which means that there could be only one instance of kApplication in the script.<br>
* This could be guaranteed by NOT calling the class constructor directly, but rather calling kApplication::Instance() method,
* which returns an instance of the application. The method guarantees that it will return exactly the same instance for any call.<br>
* See singleton pattern by GOF.
*/
class kApplication implements kiCacheable {
/**
* Location of module helper class (used in installator too)
*/
const MODULE_HELPER_PATH = '/../units/helpers/modules_helper.php';
/**
* Is true, when Init method was called already, prevents double initialization
*
* @var bool
*/
public $InitDone = false;
/**
* Holds internal NParser object
*
* @var NParser
* @access public
*/
public $Parser;
/**
* Holds parser output buffer
*
* @var string
* @access protected
*/
protected $HTML = '';
/**
* The main Factory used to create
* almost any class of kernel and
* modules
*
* @var kFactory
* @access protected
*/
protected $Factory;
/**
* Template names, that will be used instead of regular templates
*
* @var Array
* @access public
*/
public $ReplacementTemplates = Array ();
/**
* Registered routers, that are used during url building and parsing.
*
* @var array
*/
public $routers = array();
/**
* Reference to debugger
*
* @var Debugger
* @access public
*/
public $Debugger = null;
/**
* Holds all phrases used
* in code and template
*
* @var kPhraseCache
* @access public
*/
public $Phrases;
/**
* Modules table content, key - module name
*
* @var Array
* @access public
*/
public $ModuleInfo = Array ();
/**
* Holds DBConnection
*
* @var IDBConnection
* @access public
*/
public $Conn = null;
/**
* Reference to event log
*
* @var Array|kLogger
* @access public
*/
protected $_logger = Array ();
// performance needs:
/**
* Holds a reference to httpquery
*
* @var kHttpQuery
* @access public
*/
public $HttpQuery = null;
/**
* Holds a reference to UnitConfigReader
*
* @var kUnitConfigReader
* @access public
*/
public $UnitConfigReader = null;
/**
* Holds a reference to Session
*
* @var Session
* @access public
*/
public $Session = null;
/**
* Holds a ref to kEventManager
*
* @var kEventManager
* @access public
*/
public $EventManager = null;
/**
* Holds a ref to kUrlManager
*
* @var kUrlManager
* @access public
*/
public $UrlManager = null;
/**
* Ref for TemplatesCache
*
* @var TemplatesCache
* @access public
*/
public $TemplatesCache = null;
/**
* Holds current NParser tag while parsing, can be used in error messages to display template file and line
*
* @var _BlockTag
* @access public
*/
public $CurrentNTag = null;
/**
* Object of unit caching class
*
* @var kCacheManager
* @access public
*/
public $cacheManager = null;
/**
* Tells, that administrator has authenticated in administrative console
* Should be used to manipulate data change OR data restrictions!
*
* @var bool
* @access public
*/
public $isAdminUser = false;
/**
* Tells, that admin version of "index.php" was used, nothing more!
* Should be used to manipulate data display!
*
* @var bool
* @access public
*/
public $isAdmin = false;
/**
* Instance of site domain object
*
* @var kDBItem
* @access public
* @todo move away into separate module
*/
public $siteDomain = null;
/**
* Prevent kApplication class to be created directly, only via Instance method
*
* @access private
*/
private function __construct()
{
}
final private function __clone() {}
/**
* Returns kApplication instance anywhere in the script.
*
* This method should be used to get single kApplication object instance anywhere in the
* Kernel-based application. The method is guaranteed to return the SAME instance of kApplication.
* Anywhere in the script you could write:
* <code>
* $application =& kApplication::Instance();
* </code>
* or in an object:
* <code>
* $this->Application =& kApplication::Instance();
* </code>
* to get the instance of kApplication. Note that we call the Instance method as STATIC - directly from the class.
* To use descendant of standard kApplication class in your project you would need to define APPLICATION_CLASS constant
* BEFORE calling kApplication::Instance() for the first time. If APPLICATION_CLASS is not defined the method would
* create and return default KernelApplication instance.
*
* Pattern: Singleton
*
* @static
* @return kApplication
* @access public
*/
public static function &Instance()
{
static $instance = false;
if ( !$instance ) {
$class = defined('APPLICATION_CLASS') ? APPLICATION_CLASS : 'kApplication';
$instance = new $class();
}
return $instance;
}
/**
* Initializes the Application
*
* @param string $factory_class
* @return bool Was Init actually made now or before
* @access public
* @see kHTTPQuery
* @see Session
* @see TemplatesCache
*/
public function Init($factory_class = 'kFactory')
{
if ( $this->InitDone ) {
return false;
}
if ( preg_match('/utf-8/i', CHARSET) ) {
setlocale(LC_ALL, 'en_US.UTF-8');
mb_internal_encoding('UTF-8');
}
$this->isAdmin = kUtil::constOn('ADMIN');
if ( !kUtil::constOn('SKIP_OUT_COMPRESSION') ) {
ob_start(); // collect any output from method (other then tags) into buffer
}
if ( defined('DEBUG_MODE') && $this->isDebugMode() && kUtil::constOn('DBG_PROFILE_MEMORY') ) {
$this->Debugger->appendMemoryUsage('Application before Init:');
}
$this->_logger = new kLogger($this->_logger);
$this->Factory = new $factory_class();
$this->registerDefaultClasses();
$system_config = new kSystemConfig(true);
$vars = $system_config->getData();
$db_class = isset($vars['Databases']) ? 'kDBLoadBalancer' : ($this->isDebugMode() ? 'kDBConnectionDebug' : 'kDBConnection');
$this->Conn = $this->Factory->makeClass($db_class, Array (SQL_TYPE, Array ($this->_logger, 'handleSQLError')));
$this->Conn->setup($vars);
$this->cacheManager = $this->makeClass('kCacheManager');
$this->cacheManager->InitCache();
if ( defined('DEBUG_MODE') && $this->isDebugMode() ) {
$this->Debugger->appendTimestamp('Before UnitConfigReader');
}
// init config reader and all managers
$this->UnitConfigReader = $this->makeClass('kUnitConfigReader');
$this->UnitConfigReader->scanModules(MODULES_PATH); // Will also set routers.
$this->registerModuleConstants();
if ( defined('DEBUG_MODE') && $this->isDebugMode() ) {
$this->Debugger->appendTimestamp('After UnitConfigReader');
}
define('MOD_REWRITE', $this->ConfigValue('UseModRewrite') && !$this->isAdmin ? 1 : 0);
// start processing request
$this->HttpQuery = $this->recallObject('kHTTPQuery');
$this->HttpQuery->process();
if ( defined('DEBUG_MODE') && $this->isDebugMode() ) {
$this->Debugger->appendTimestamp('Processed HTTPQuery initial');
}
$this->Session = $this->recallObject('Session');
if ( defined('DEBUG_MODE') && $this->isDebugMode() ) {
$this->Debugger->appendTimestamp('Processed Session');
}
$this->Session->ValidateExpired(); // needs mod_rewrite url already parsed to keep user at proper template after session expiration
if ( defined('DEBUG_MODE') && $this->isDebugMode() ) {
$this->Debugger->appendTimestamp('Processed HTTPQuery AfterInit');
}
$this->cacheManager->LoadApplicationCache();
$site_timezone = $this->ConfigValue('Config_Site_Time');
if ( $site_timezone ) {
date_default_timezone_set($site_timezone);
}
if ( defined('DEBUG_MODE') && $this->isDebugMode() ) {
$this->Debugger->appendTimestamp('Loaded cache and phrases');
}
$this->ValidateLogin(); // must be called before AfterConfigRead, because current user should be available there
$this->UnitConfigReader->AfterConfigRead();
if ( defined('DEBUG_MODE') && $this->isDebugMode() ) {
$this->Debugger->appendTimestamp('Processed AfterConfigRead');
}
if ( $this->GetVar('m_cat_id') === false ) {
$this->SetVar('m_cat_id', 0);
}
if ( !$this->RecallVar('curr_iso') ) {
$this->StoreVar('curr_iso', $this->GetPrimaryCurrency(), true); // true for optional
}
$visit_id = $this->RecallVar('visit_id');
if ( $visit_id !== false ) {
$this->SetVar('visits_id', $visit_id);
}
if ( defined('DEBUG_MODE') && $this->isDebugMode() ) {
$this->Debugger->profileFinish('kernel4_startup');
}
$this->InitDone = true;
$this->HandleEvent(new kEvent('adm:OnStartup'));
return true;
}
/**
* Performs initialization of manager classes, that can be overridden from unit configs
*
* @return void
* @access public
* @throws Exception
*/
public function InitManagers()
{
if ( $this->InitDone ) {
throw new Exception('Duplicate call of ' . __METHOD__, E_USER_ERROR);
}
$this->UrlManager = $this->makeClass('kUrlManager');
$this->EventManager = $this->makeClass('kEventManager');
$this->Phrases = $this->makeClass('kPhraseCache');
$this->RegisterDefaultBuildEvents();
}
/**
* Returns module information. Searches module by requested field
*
* @param string $field
* @param mixed $value
* @param string $return_field field value to returns, if not specified, then return all fields
* @return Array
*/
public function findModule($field, $value, $return_field = null)
{
$found = $module_info = false;
foreach ($this->ModuleInfo as $module_info) {
if ( strtolower($module_info[$field]) == strtolower($value) ) {
$found = true;
break;
}
}
if ( $found ) {
return isset($return_field) ? $module_info[$return_field] : $module_info;
}
return false;
}
/**
* Refreshes information about loaded modules
*
* @return void
* @access public
*/
public function refreshModuleInfo()
{
if ( defined('IS_INSTALL') && IS_INSTALL && !$this->TableFound('Modules', true) ) {
$this->registerModuleConstants();
$this->Factory->configureAutoloader();
return;
}
// use makeClass over recallObject, since used before kApplication initialization during installation
$modules_helper = $this->makeClass('kModulesHelper');
/* @var $modules_helper kModulesHelper */
$this->Conn->nextQueryCachable = true;
$sql = 'SELECT *
FROM ' . TABLE_PREFIX . 'Modules
WHERE ' . $modules_helper->getWhereClause() . '
ORDER BY LoadOrder';
$this->ModuleInfo = $this->Conn->Query($sql, 'Name');
$this->registerModuleConstants();
$this->Factory->configureAutoloader();
}
/**
* Checks if passed language id if valid and sets it to primary otherwise
*
* @return void
* @access public
*/
public function VerifyLanguageId()
{
/** @var LanguagesItem $lang */
$lang = $this->recallObject('lang.current');
if ( !$lang->isLoaded() || (!$this->isAdmin && !$lang->GetDBField('Enabled')) ) {
if ( !defined('IS_INSTALL') ) {
$this->ApplicationDie('Unknown or disabled language');
}
}
}
/**
* Checks if passed theme id if valid and sets it to primary otherwise
*
* @return void
* @access public
*/
public function VerifyThemeId()
{
if ( $this->isAdmin ) {
kUtil::safeDefine('THEMES_PATH', '/core/admin_templates');
return;
}
$path = $this->GetFrontThemePath();
if ( $path === false ) {
$this->ApplicationDie('No Primary Theme Selected or Current Theme is Unknown or Disabled');
}
kUtil::safeDefine('THEMES_PATH', $path);
}
/**
* Returns relative path to current front-end theme
*
* @param bool $force
* @return string
* @access public
*/
public function GetFrontThemePath($force = false)
{
static $path = null;
if ( !$force && isset($path) ) {
return $path;
}
/** @var ThemeItem $theme */
$theme = $this->recallObject('theme.current');
if ( !$theme->isLoaded() || !$theme->GetDBField('Enabled') ) {
return false;
}
// assign & then return, since it's static variable
$path = '/themes/' . $theme->GetDBField('Name');
return $path;
}
/**
* Returns primary front/admin language id
*
* @param bool $init
* @return int
* @access public
*/
public function GetDefaultLanguageId($init = false)
{
$cache_key = 'primary_language_info[%LangSerial%]';
$language_info = $this->getCache($cache_key);
if ( $language_info === false ) {
// cache primary language info first
$language_config = $this->getUnitConfig('lang');
$table = $language_config->getTableName();
$id_field = $language_config->getIDField();
$this->Conn->nextQueryCachable = true;
$sql = 'SELECT ' . $id_field . ', IF(AdminInterfaceLang, "Admin", "Front") AS LanguageKey
FROM ' . $table . '
WHERE (AdminInterfaceLang = 1 OR PrimaryLang = 1) AND (Enabled = 1)';
$language_info = $this->Conn->GetCol($sql, 'LanguageKey');
if ( $language_info !== false ) {
$this->setCache($cache_key, $language_info);
}
}
$language_key = ($this->isAdmin && $init) || count($language_info) == 1 ? 'Admin' : 'Front';
if ( array_key_exists($language_key, $language_info) && $language_info[$language_key] > 0 ) {
// get from cache
return $language_info[$language_key];
}
$language_id = $language_info && array_key_exists($language_key, $language_info) ? $language_info[$language_key] : false;
if ( !$language_id && defined('IS_INSTALL') && IS_INSTALL ) {
$language_id = 1;
}
return $language_id;
}
/**
* Returns front-end primary theme id (even, when called from admin console)
*
* @param bool $force_front
* @return int
* @access public
*/
public function GetDefaultThemeId($force_front = false)
{
static $theme_id = 0;
if ( $theme_id > 0 ) {
return $theme_id;
}
if ( kUtil::constOn('DBG_FORCE_THEME') ) {
$theme_id = DBG_FORCE_THEME;
}
elseif ( !$force_front && $this->isAdmin ) {
$theme_id = 999;
}
else {
$cache_key = 'primary_theme[%ThemeSerial%]';
$theme_id = $this->getCache($cache_key);
if ( $theme_id === false ) {
$this->Conn->nextQueryCachable = true;
$theme_config = $this->getUnitConfig('theme');
$sql = 'SELECT ' . $theme_config->getIDField() . '
FROM ' . $theme_config->getTableName() . '
WHERE (PrimaryTheme = 1) AND (Enabled = 1)';
$theme_id = $this->Conn->GetOne($sql);
if ( $theme_id !== false ) {
$this->setCache($cache_key, $theme_id);
}
}
}
return $theme_id;
}
/**
* Returns site primary currency ISO code
*
* @return string
* @access public
* @todo Move into In-Commerce
*/
public function GetPrimaryCurrency()
{
$cache_key = 'primary_currency[%CurrSerial%][%SiteDomainSerial%]:' . $this->siteDomainField('DomainId');
$currency_iso = $this->getCache($cache_key);
if ( $currency_iso === false ) {
if ( $this->prefixRegistred('curr') ) {
$this->Conn->nextQueryCachable = true;
$currency_id = $this->siteDomainField('PrimaryCurrencyId');
$sql = 'SELECT ISO
FROM ' . $this->getUnitConfig('curr')->getTableName() . '
WHERE ' . ($currency_id > 0 ? 'CurrencyId = ' . $currency_id : 'IsPrimary = 1');
$currency_iso = $this->Conn->GetOne($sql);
}
else {
$currency_iso = 'USD';
}
$this->setCache($cache_key, $currency_iso);
}
return $currency_iso;
}
/**
* Returns site domain field. When none of site domains are found false is returned.
*
* @param string $field
* @param bool $formatted
* @param string $format
* @return mixed
* @todo Move into separate module
*/
public function siteDomainField($field, $formatted = false, $format = null)
{
if ( $this->isAdmin ) {
// don't apply any filtering in administrative console
return false;
}
if ( !$this->siteDomain ) {
$this->siteDomain = $this->recallObject('site-domain.current', null, Array ('live_table' => true));
/* @var $site_domain kDBItem */
}
if ( $this->siteDomain->isLoaded() ) {
return $formatted ? $this->siteDomain->GetField($field, $format) : $this->siteDomain->GetDBField($field);
}
return false;
}
/**
* Registers classes, that are used before unit configs (where class registration usually is done) are read.
*
* Called automatically while initializing kApplication.
*
* @return void
* @access public
*/
public function RegisterDefaultClasses()
{
// Database.
$this->registerClass('IDBConnection', KERNEL_PATH . '/db/i_db_connection.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');
// Cache.
$this->registerClass('kCacheManager', KERNEL_PATH . '/managers/cache_manager.php');
$this->registerClass('kCache', KERNEL_PATH . '/utility/cache.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('kUrlProcessor', KERNEL_PATH . '/managers/url_processor.php');
$this->registerClass('kPlainUrlProcessor', KERNEL_PATH . '/managers/plain_url_processor.php');
// $this->registerClass('kRewriteUrlProcessor', KERNEL_PATH . '/managers/rewrite_url_processor.php');
// Events.
$this->registerClass('kEventManager', KERNEL_PATH . '/event_manager.php');
$this->registerClass('kHookManager', KERNEL_PATH . '/managers/hook_manager.php');
$this->registerClass('kScheduledTaskManager', KERNEL_PATH . '/managers/scheduled_task_manager.php');
$this->registerClass('kRequestManager', KERNEL_PATH . '/managers/request_manager.php');
// Misc.
$this->registerClass('kPhraseCache', KERNEL_PATH . '/languages/phrases_cache.php');
$this->registerClass('kModulesHelper', KERNEL_PATH . self::MODULE_HELPER_PATH);
// Aliased.
$this->registerClass('Params', KERNEL_PATH . '/utility/params.php', 'kActions');
$this->registerClass('kMainTagProcessor', KERNEL_PATH . '/processors/main_processor.php', 'm_TagProcessor');
$this->registerClass('kEmailSendingHelper', KERNEL_PATH . '/utility/email_send.php', 'EmailSender');
}
/**
* Registers default build events
*
* @return void
* @access protected
*/
protected function RegisterDefaultBuildEvents()
{
$this->EventManager->registerBuildEvent('kTempTablesHandler', 'OnTempHandlerBuild');
}
/**
* Returns cached category information by given cache name. All given category
* information is recached, when at least one of 4 caches is missing.
*
* @param int $category_id
* @param string $name cache name = {filenames, category_designs, category_tree}
* @return string
* @access public
*/
public function getCategoryCache($category_id, $name)
{
return $this->cacheManager->getCategoryCache($category_id, $name);
}
/**
* Returns caching type (none, memory, temporary)
*
* @param int $caching_type
* @return bool
* @access public
*/
public function isCachingType($caching_type)
{
return $this->cacheManager->isCachingType($caching_type);
}
/**
* Increments serial based on prefix and it's ID (optional)
*
* @param string $prefix
* @param int $id ID (value of IDField) or ForeignKeyField:ID
* @param bool $increment
* @return string
* @access public
*/
public function incrementCacheSerial($prefix, $id = null, $increment = true)
{
return $this->cacheManager->incrementCacheSerial($prefix, $id, $increment);
}
/**
* Returns cached $key value from cache named $cache_name
*
* @param int $key key name from cache
* @param bool $store_locally store data locally after retrieved
* @param int $max_rebuild_seconds
* @return mixed
* @access public
*/
public function getCache($key, $store_locally = true, $max_rebuild_seconds = 0)
{
return $this->cacheManager->getCache($key, $store_locally, $max_rebuild_seconds);
}
/**
* Stores new $value in cache with $key name
*
* @param int $key key name to add to cache
* @param mixed $value value of cached record
* @param int $expiration when value expires (0 - doesn't expire)
* @return bool
* @access public
*/
public function setCache($key, $value, $expiration = 0)
{
return $this->cacheManager->setCache($key, $value, $expiration);
}
/**
* Stores new $value in cache with $key name (only if it's not there)
*
* @param int $key key name to add to cache
* @param mixed $value value of cached record
* @param int $expiration when value expires (0 - doesn't expire)
* @return bool
* @access public
*/
public function addCache($key, $value, $expiration = 0)
{
return $this->cacheManager->addCache($key, $value, $expiration);
}
/**
* Sets rebuilding mode for given cache
*
* @param string $name
* @param int $mode
* @param int $max_rebuilding_time
* @return bool
* @access public
*/
public function rebuildCache($name, $mode = null, $max_rebuilding_time = 0)
{
return $this->cacheManager->rebuildCache($name, $mode, $max_rebuilding_time);
}
/**
* Deletes key from cache
*
* @param string $key
* @return void
* @access public
*/
public function deleteCache($key)
{
$this->cacheManager->deleteCache($key);
}
/**
* Reset's all memory cache at once
*
* @return void
* @access public
*/
public function resetCache()
{
$this->cacheManager->resetCache();
}
/**
* Returns value from database cache
*
* @param string $name key name
* @param int $max_rebuild_seconds
* @return mixed
* @access public
*/
public function getDBCache($name, $max_rebuild_seconds = 0)
{
return $this->cacheManager->getDBCache($name, $max_rebuild_seconds);
}
/**
* Sets value to database cache
*
* @param string $name
* @param mixed $value
* @param int|bool $expiration
* @return void
* @access public
*/
public function setDBCache($name, $value, $expiration = false)
{
$this->cacheManager->setDBCache($name, $value, $expiration);
}
/**
* Sets rebuilding mode for given cache
*
* @param string $name
* @param int $mode
* @param int $max_rebuilding_time
* @return bool
* @access public
*/
public function rebuildDBCache($name, $mode = null, $max_rebuilding_time = 0)
{
return $this->cacheManager->rebuildDBCache($name, $mode, $max_rebuilding_time);
}
/**
* Deletes key from database cache
*
* @param string $name
* @return void
* @access public
*/
public function deleteDBCache($name)
{
$this->cacheManager->deleteDBCache($name);
}
/**
* Registers each module specific constants if any found
*
* @return bool
* @access protected
*/
protected function registerModuleConstants()
{
if ( file_exists(KERNEL_PATH . '/constants.php') ) {
kUtil::includeOnce(KERNEL_PATH . '/constants.php');
}
if ( !$this->ModuleInfo ) {
return false;
}
foreach ($this->ModuleInfo as $module_info) {
$constants_file = FULL_PATH . '/' . $module_info['Path'] . 'constants.php';
if ( file_exists($constants_file) ) {
kUtil::includeOnce($constants_file);
}
}
return true;
}
/**
* Performs redirect to hard maintenance template
*
* @return void
* @access public
*/
public function redirectToMaintenance()
{
$maintenance_page = WRITEBALE_BASE . '/maintenance.html';
$query_string = ''; // $this->isAdmin ? '' : '?next_template=' . kUtil::escape($_SERVER['REQUEST_URI'], kUtil::ESCAPE_URL);
if ( file_exists(FULL_PATH . $maintenance_page) ) {
header('Location: ' . BASE_PATH . $maintenance_page . $query_string);
exit;
}
}
/**
* Actually runs the parser against current template and stores parsing result
*
* This method gets 't' variable passed to the script, loads the template given in 't' variable and
* parses it. The result is store in {@link $this->HTML} property.
*
* @return void
* @access public
*/
public function Run()
{
// process maintenance mode redirect: begin
$maintenance_mode = $this->getMaintenanceMode();
if ( $maintenance_mode == MaintenanceMode::HARD ) {
$this->redirectToMaintenance();
}
elseif ( $maintenance_mode == MaintenanceMode::SOFT ) {
$maintenance_template = $this->isAdmin ? 'login' : $this->ConfigValue('SoftMaintenanceTemplate');
if ( $this->GetVar('t') != $maintenance_template ) {
$redirect_params = Array ();
if ( !$this->isAdmin ) {
$redirect_params['next_template'] = $_SERVER['REQUEST_URI'];
}
$this->Redirect($maintenance_template, $redirect_params);
}
}
// process maintenance mode redirect: end
if ( defined('DEBUG_MODE') && $this->isDebugMode() && kUtil::constOn('DBG_PROFILE_MEMORY') ) {
$this->Debugger->appendMemoryUsage('Application before Run:');
}
if ( $this->isAdminUser ) {
// for permission checking in events & templates
$this->LinkVar('module'); // for common configuration templates
$this->LinkVar('module_key'); // for common search templates
$this->LinkVar('section'); // for common configuration templates
if ( $this->GetVar('m_opener') == 'p' ) {
$this->LinkVar('main_prefix'); // window prefix, that opened selector
$this->LinkVar('dst_field'); // field to set value choosed in selector
}
if ( $this->GetVar('ajax') == 'yes' && !$this->GetVar('debug_ajax') ) {
// hide debug output from ajax requests automatically
kUtil::safeDefine('DBG_SKIP_REPORTING', 1); // safeDefine, because debugger also defines it
}
}
elseif ( $this->GetVar('admin') ) {
$admin_session = $this->recallObject('Session.admin');
/* @var $admin_session Session */
// store Admin Console User's ID to Front-End's session for cross-session permission checks
$this->StoreVar('admin_user_id', (int)$admin_session->RecallVar('user_id'));
if ( $this->CheckAdminPermission('CATEGORY.MODIFY', 0, $this->getBaseCategory()) ) {
// user can edit cms blocks (when viewing front-end through admin's frame)
$editing_mode = $this->GetVar('editing_mode');
define('EDITING_MODE', $editing_mode ? $editing_mode : EDITING_MODE_BROWSE);
}
}
kUtil::safeDefine('EDITING_MODE', ''); // user can't edit anything
$this->Phrases->setPhraseEditing();
$this->EventManager->ProcessRequest();
$this->InitParser();
$t = $this->GetVar('render_template', $this->GetVar('t'));
if ( !$this->TemplatesCache->TemplateExists($t) && !$this->isAdmin ) {
$cms_handler = $this->recallObject('st_EventHandler');
/* @var $cms_handler CategoriesEventHandler */
$t = ltrim($cms_handler->GetDesignTemplate(), '/');
if ( defined('DEBUG_MODE') && $this->isDebugMode() ) {
$this->Debugger->appendHTML('<strong>Design Template</strong>: ' . $t . '; <strong>CategoryID</strong>: ' . $this->GetVar('m_cat_id'));
}
}
/*else {
$cms_handler->SetCatByTemplate();
}*/
if ( defined('DEBUG_MODE') && $this->isDebugMode() && kUtil::constOn('DBG_PROFILE_MEMORY') ) {
$this->Debugger->appendMemoryUsage('Application before Parsing:');
}
$this->HTML = $this->Parser->Run($t);
if ( defined('DEBUG_MODE') && $this->isDebugMode() && kUtil::constOn('DBG_PROFILE_MEMORY') ) {
$this->Debugger->appendMemoryUsage('Application after Parsing:');
}
}
/**
+ * Returns console application.
+ *
+ * @return ConsoleApplication
+ */
+ public function getConsoleApplication()
+ {
+ return $this->makeClass('Intechnic\InPortal\Core\kernel\Console\ConsoleApplication');
+ }
+
+ /**
* Only renders template
*
* @see kDBEventHandler::_errorNotFound()
*/
public function QuickRun()
{
// discard any half-parsed content
ob_clean();
// replace current page content with 404
$this->InitParser();
$this->HTML = $this->Parser->Run($this->GetVar('t'));
}
/**
* Performs template parser/cache initialization
*
* @param bool|string $theme_name
* @return void
* @access public
*/
public function InitParser($theme_name = false)
{
if ( !is_object($this->Parser) ) {
$this->Parser = $this->recallObject('NParser');
$this->TemplatesCache = $this->recallObject('TemplatesCache');
}
$this->TemplatesCache->forceThemeName = $theme_name;
}
/**
* Send the parser results to browser
*
* Actually send everything stored in {@link $this->HTML}, to the browser by echoing it.
*
* @return void
* @access public
*/
public function Done()
{
$this->HandleEvent(new kEvent('adm:OnBeforeShutdown'));
$debug_mode = defined('DEBUG_MODE') && $this->isDebugMode();
if ( $debug_mode ) {
if ( kUtil::constOn('DBG_PROFILE_MEMORY') ) {
$this->Debugger->appendMemoryUsage('Application before Done:');
}
$this->Session->SaveData(); // adds session data to debugger report
$this->HTML = ob_get_clean() . $this->HTML . $this->Debugger->printReport(true);
}
else {
// send "Set-Cookie" header before any output is made
$this->Session->SetSession();
$this->HTML = ob_get_clean() . $this->HTML;
}
$this->_outputPage();
$this->cacheManager->UpdateApplicationCache();
if ( !$debug_mode ) {
$this->Session->SaveData();
}
$this->EventManager->runScheduledTasks();
if ( defined('DBG_CAPTURE_STATISTICS') && DBG_CAPTURE_STATISTICS && !$this->isAdmin ) {
$this->_storeStatistics();
}
}
/**
* Outputs generated page content to end-user
*
* @return void
* @access protected
*/
protected function _outputPage()
{
$this->setContentType();
ob_start();
if ( $this->UseOutputCompression() ) {
$compression_level = $this->ConfigValue('OutputCompressionLevel');
if ( !$compression_level || $compression_level < 0 || $compression_level > 9 ) {
$compression_level = 7;
}
header('Content-Encoding: gzip');
echo gzencode($this->HTML, $compression_level);
}
else {
// when gzip compression not used connection won't be closed early!
echo $this->HTML;
}
// send headers to tell the browser to close the connection
header('Content-Length: ' . ob_get_length());
header('Connection: close');
// flush all output
ob_end_flush();
if ( ob_get_level() ) {
ob_flush();
}
flush();
// close current session
if ( session_id() ) {
session_write_close();
}
}
/**
* Stores script execution statistics to database
*
* @return void
* @access protected
*/
protected function _storeStatistics()
{
global $start;
$script_time = microtime(true) - $start;
$query_statistics = $this->Conn->getQueryStatistics(); // time & count
$sql = 'SELECT *
FROM ' . TABLE_PREFIX . 'StatisticsCapture
WHERE TemplateName = ' . $this->Conn->qstr($this->GetVar('t'));
$data = $this->Conn->GetRow($sql);
if ( $data ) {
$this->_updateAverageStatistics($data, 'ScriptTime', $script_time);
$this->_updateAverageStatistics($data, 'SqlTime', $query_statistics['time']);
$this->_updateAverageStatistics($data, 'SqlCount', $query_statistics['count']);
$data['Hits']++;
$data['LastHit'] = time();
$this->Conn->doUpdate($data, TABLE_PREFIX . 'StatisticsCapture', 'StatisticsId = ' . $data['StatisticsId']);
}
else {
$data['ScriptTimeMin'] = $data['ScriptTimeAvg'] = $data['ScriptTimeMax'] = $script_time;
$data['SqlTimeMin'] = $data['SqlTimeAvg'] = $data['SqlTimeMax'] = $query_statistics['time'];
$data['SqlCountMin'] = $data['SqlCountAvg'] = $data['SqlCountMax'] = $query_statistics['count'];
$data['TemplateName'] = $this->GetVar('t');
$data['Hits'] = 1;
$data['LastHit'] = time();
$this->Conn->doInsert($data, TABLE_PREFIX . 'StatisticsCapture');
}
}
/**
* Calculates average time for statistics
*
* @param Array $data
* @param string $field_prefix
* @param float $current_value
* @return void
* @access protected
*/
protected function _updateAverageStatistics(&$data, $field_prefix, $current_value)
{
$data[$field_prefix . 'Avg'] = (($data['Hits'] * $data[$field_prefix . 'Avg']) + $current_value) / ($data['Hits'] + 1);
if ( $current_value < $data[$field_prefix . 'Min'] ) {
$data[$field_prefix . 'Min'] = $current_value;
}
if ( $current_value > $data[$field_prefix . 'Max'] ) {
$data[$field_prefix . 'Max'] = $current_value;
}
}
/**
* Remembers slow query SQL and execution time into log
*
* @param string $slow_sql
* @param int $time
* @return void
* @access public
*/
public function logSlowQuery($slow_sql, $time)
{
$query_crc = kUtil::crc32($slow_sql);
$sql = 'SELECT *
FROM ' . TABLE_PREFIX . 'SlowSqlCapture
WHERE QueryCrc = ' . $query_crc;
$data = $this->Conn->Query($sql, null, true);
if ( $data ) {
$this->_updateAverageStatistics($data, 'Time', $time);
$template_names = explode(',', $data['TemplateNames']);
array_push($template_names, $this->GetVar('t'));
$data['TemplateNames'] = implode(',', array_unique($template_names));
$data['Hits']++;
$data['LastHit'] = time();
$this->Conn->doUpdate($data, TABLE_PREFIX . 'SlowSqlCapture', 'CaptureId = ' . $data['CaptureId']);
}
else {
$data['TimeMin'] = $data['TimeAvg'] = $data['TimeMax'] = $time;
$data['SqlQuery'] = $slow_sql;
$data['QueryCrc'] = $query_crc;
$data['TemplateNames'] = $this->GetVar('t');
$data['Hits'] = 1;
$data['LastHit'] = time();
$this->Conn->doInsert($data, TABLE_PREFIX . 'SlowSqlCapture');
}
}
/**
* Checks if output compression options is available
*
* @return bool
* @access protected
*/
protected function UseOutputCompression()
{
if ( kUtil::constOn('IS_INSTALL') || kUtil::constOn('DBG_ZEND_PRESENT') || kUtil::constOn('SKIP_OUT_COMPRESSION') ) {
return false;
}
$accept_encoding = isset($_SERVER['HTTP_ACCEPT_ENCODING']) ? $_SERVER['HTTP_ACCEPT_ENCODING'] : '';
return $this->ConfigValue('UseOutputCompression') && function_exists('gzencode') && strstr($accept_encoding, 'gzip');
}
// Facade
/**
* Returns current session id (SID)
*
* @return int
* @access public
*/
public function GetSID()
{
$session = $this->recallObject('Session');
/* @var $session Session */
return $session->GetID();
}
/**
* Destroys current session
*
* @return void
* @access public
* @see UserHelper::logoutUser()
*/
public function DestroySession()
{
$session = $this->recallObject('Session');
/* @var $session Session */
$session->Destroy();
}
/**
* Returns variable passed to the script as GET/POST/COOKIE
*
* @param string $name Name of variable to retrieve
* @param mixed $default default value returned in case if variable not present
* @return mixed
* @access public
*/
public function GetVar($name, $default = false)
{
return isset($this->HttpQuery->_Params[$name]) ? $this->HttpQuery->_Params[$name] : $default;
}
/**
* Removes forceful escaping done to the variable upon Front-End submission.
*
* @param string|array $value Value.
*
* @return string|array
* @see kHttpQuery::StripSlashes
* @todo Temporary method for marking problematic places to take care of, when forceful escaping will be removed.
*/
public function unescapeRequestVariable($value)
{
return $this->HttpQuery->unescapeRequestVariable($value);
}
/**
* Returns variable passed to the script as $type
*
* @param string $name Name of variable to retrieve
* @param string $type Get/Post/Cookie
* @param mixed $default default value returned in case if variable not present
* @return mixed
* @access public
*/
public function GetVarDirect($name, $type, $default = false)
{
// $type = ucfirst($type);
$array = $this->HttpQuery->$type;
return isset($array[$name]) ? $array[$name] : $default;
}
/**
* Returns ALL variables passed to the script as GET/POST/COOKIE
*
* @return Array
* @access public
* @deprecated
*/
public function GetVars()
{
return $this->HttpQuery->GetParams();
}
/**
* Set the variable 'as it was passed to the script through GET/POST/COOKIE'
*
* This could be useful to set the variable when you know that
* other objects would relay on variable passed from GET/POST/COOKIE
* or you could use SetVar() / GetVar() pairs to pass the values between different objects.<br>
*
* @param string $var Variable name to set
* @param mixed $val Variable value
* @return void
* @access public
*/
public function SetVar($var,$val)
{
$this->HttpQuery->Set($var, $val);
}
/**
* Deletes kHTTPQuery variable
*
* @param string $var
* @return void
* @todo Think about method name
*/
public function DeleteVar($var)
{
$this->HttpQuery->Remove($var);
}
/**
* Deletes Session variable
*
* @param string $var
* @return void
* @access public
*/
public function RemoveVar($var)
{
$this->Session->RemoveVar($var);
}
/**
* Removes variable from persistent session
*
* @param string $var
* @return void
* @access public
*/
public function RemovePersistentVar($var)
{
$this->Session->RemovePersistentVar($var);
}
/**
* Restores Session variable to it's db version
*
* @param string $var
* @return void
* @access public
*/
public function RestoreVar($var)
{
$this->Session->RestoreVar($var);
}
/**
* Returns session variable value
*
* Return value of $var variable stored in Session. An optional default value could be passed as second parameter.
*
* @param string $var Variable name
* @param mixed $default Default value to return if no $var variable found in session
* @return mixed
* @access public
* @see Session::RecallVar()
*/
public function RecallVar($var,$default=false)
{
return $this->Session->RecallVar($var,$default);
}
/**
* Returns variable value from persistent session
*
* @param string $var
* @param mixed $default
* @return mixed
* @access public
* @see Session::RecallPersistentVar()
*/
public function RecallPersistentVar($var, $default = false)
{
return $this->Session->RecallPersistentVar($var, $default);
}
/**
* Stores variable $val in session under name $var
*
* Use this method to store variable in session. Later this variable could be recalled.
*
* @param string $var Variable name
* @param mixed $val Variable value
* @param bool $optional
* @return void
* @access public
* @see kApplication::RecallVar()
*/
public function StoreVar($var, $val, $optional = false)
{
$session = $this->recallObject('Session');
/* @var $session Session */
$this->Session->StoreVar($var, $val, $optional);
}
/**
* Stores variable to persistent session
*
* @param string $var
* @param mixed $val
* @param bool $optional
* @return void
* @access public
*/
public function StorePersistentVar($var, $val, $optional = false)
{
$this->Session->StorePersistentVar($var, $val, $optional);
}
/**
* Stores default value for session variable
*
* @param string $var
* @param string $val
* @param bool $optional
* @return void
* @access public
* @see Session::RecallVar()
* @see Session::StoreVar()
*/
public function StoreVarDefault($var, $val, $optional = false)
{
$session = $this->recallObject('Session');
/* @var $session Session */
$this->Session->StoreVarDefault($var, $val, $optional);
}
/**
* Links HTTP Query variable with session variable
*
* If variable $var is passed in HTTP Query it is stored in session for later use. If it's not passed it's recalled from session.
* This method could be used for making sure that GetVar will return query or session value for given
* variable, when query variable should overwrite session (and be stored there for later use).<br>
* This could be used for passing item's ID into popup with multiple tab -
* in popup script you just need to call LinkVar('id', 'current_id') before first use of GetVar('id').
* After that you can be sure that GetVar('id') will return passed id or id passed earlier and stored in session
*
* @param string $var HTTP Query (GPC) variable name
* @param mixed $ses_var Session variable name
* @param mixed $default Default variable value
* @param bool $optional
* @return void
* @access public
*/
public function LinkVar($var, $ses_var = null, $default = '', $optional = false)
{
if ( !isset($ses_var) ) {
$ses_var = $var;
}
if ( $this->GetVar($var) !== false ) {
$this->StoreVar($ses_var, $this->GetVar($var), $optional);
}
else {
$this->SetVar($var, $this->RecallVar($ses_var, $default));
}
}
/**
* Returns variable from HTTP Query, or from session if not passed in HTTP Query
*
* The same as LinkVar, but also returns the variable value taken from HTTP Query if passed, or from session if not passed.
* Returns the default value if variable does not exist in session and was not passed in HTTP Query
*
* @param string $var HTTP Query (GPC) variable name
* @param mixed $ses_var Session variable name
* @param mixed $default Default variable value
* @return mixed
* @access public
* @see LinkVar
*/
public function GetLinkedVar($var, $ses_var = null, $default = '')
{
$this->LinkVar($var, $ses_var, $default);
return $this->GetVar($var);
}
/**
* Renders given tag and returns it's output
*
* @param string $prefix
* @param string $tag
* @param Array $params
* @return mixed
* @access public
* @see kApplication::InitParser()
*/
public function ProcessParsedTag($prefix, $tag, $params)
{
$processor = $this->Parser->GetProcessor($prefix);
/* @var $processor kDBTagProcessor */
return $processor->ProcessParsedTag($tag, $params, $prefix);
}
/**
* Return object of IDBConnection interface
*
* Return object of IDBConnection interface already connected to the project database, configurable in config.php
*
* @return IDBConnection
* @access public
*/
public function &GetADODBConnection()
{
return $this->Conn;
}
/**
* Allows to parse given block name or include template
*
* @param Array $params Parameters to pass to block. Reserved parameter "name" used to specify block name.
* @param bool $pass_params Forces to pass current parser params to this block/template. Use with caution, because you can accidentally pass "block_no_data" parameter.
* @param bool $as_template
* @return string
* @access public
*/
public function ParseBlock($params, $pass_params = false, $as_template = false)
{
if ( substr($params['name'], 0, 5) == 'html:' ) {
return substr($params['name'], 5);
}
return $this->Parser->ParseBlock($params, $pass_params, $as_template);
}
/**
* Checks, that we have given block defined
*
* @param string $name
* @return bool
* @access public
*/
public function ParserBlockFound($name)
{
return $this->Parser->blockFound($name);
}
/**
* Allows to include template with a given name and given parameters
*
* @param Array $params Parameters to pass to template. Reserved parameter "name" used to specify template name.
* @return string
* @access public
*/
public function IncludeTemplate($params)
{
return $this->Parser->IncludeTemplate($params, isset($params['is_silent']) ? 1 : 0);
}
/**
* Return href for template
*
* @param string $t Template path
* @param string $prefix index.php prefix - could be blank, 'admin'
* @param Array $params
* @param string $index_file
* @return string
*/
public function HREF($t, $prefix = '', $params = Array (), $index_file = null)
{
return $this->UrlManager->HREF($t, $prefix, $params, $index_file);
}
/**
* Returns theme template filename and it's corresponding page_id based on given seo template
*
* @param string $seo_template
* @return string
* @access public
*/
public function getPhysicalTemplate($seo_template)
{
return $this->UrlManager->getPhysicalTemplate($seo_template);
}
/**
* Returns seo template by physical template
*
* @param string $physical_template
* @return string
* @access public
*/
public function getSeoTemplate($physical_template)
{
return $this->UrlManager->getSeoTemplate($physical_template);
}
/**
* Returns template name, that corresponds with given virtual (not physical) page id
*
* @param int $page_id
* @return string|bool
* @access public
*/
public function getVirtualPageTemplate($page_id)
{
return $this->UrlManager->getVirtualPageTemplate($page_id);
}
/**
* Returns section template for given physical/virtual template
*
* @param string $template
* @param int $theme_id
* @return string
* @access public
*/
public function getSectionTemplate($template, $theme_id = null)
{
return $this->UrlManager->getSectionTemplate($template, $theme_id);
}
/**
* Returns variables with values that should be passed through with this link + variable list
*
* @param Array $params
* @return Array
* @access public
*/
public function getPassThroughVariables(&$params)
{
return $this->UrlManager->getPassThroughVariables($params);
}
/**
* Builds url
*
* @param string $t
* @param Array $params
* @param string $pass
* @param bool $pass_events
* @param bool $env_var
* @return string
* @access public
*/
public function BuildEnv($t, $params, $pass = 'all', $pass_events = false, $env_var = true)
{
return $this->UrlManager->plain->build($t, $params, $pass, $pass_events, $env_var);
}
/**
* Process QueryString only, create
* events, ids, based on config
* set template name and sid in
* desired application variables.
*
* @param string $env_var environment string value
* @param string $pass_name
* @return Array
* @access public
*/
public function processQueryString($env_var, $pass_name = 'passed')
{
return $this->UrlManager->plain->parse($env_var, $pass_name);
}
/**
* Parses rewrite url and returns parsed variables
*
* @param string $url
* @param string $pass_name
* @return Array
* @access public
*/
public function parseRewriteUrl($url, $pass_name = 'passed')
{
return $this->UrlManager->rewrite->parse($url, $pass_name);
}
/**
* Returns base part of all urls, build on website
*
* @param string $domain Domain override.
* @param boolean $ssl_redirect Redirect to/from SSL.
*
* @return string
*/
public function BaseURL($domain = '', $ssl_redirect = null)
{
if ( $ssl_redirect === null ) {
// stay on same encryption level
return PROTOCOL . ($domain ? $domain : SERVER_NAME) . (defined('PORT') ? ':' . PORT : '') . BASE_PATH . '/';
}
if ( $ssl_redirect ) {
// going from http:// to https://
$protocol = 'https://';
$domain = $this->getSecureDomain();
}
else {
// going from https:// to http://
$protocol = 'http://';
$domain = $this->siteDomainField('DomainName');
if ( $domain === false ) {
$domain = DOMAIN; // not on site domain
}
}
return $protocol . $domain . (defined('PORT') ? ':' . PORT : '') . BASE_PATH . '/';
}
/**
* Returns secure domain.
*
* @return string
*/
public function getSecureDomain()
{
$ret = $this->isAdmin ? $this->ConfigValue('AdminSSLDomain') : false;
if ( !$ret ) {
$ssl_domain = $this->siteDomainField('SSLDomainName');
return strlen($ssl_domain) ? $ssl_domain : $this->ConfigValue('SSLDomain');
}
return $ret;
}
/**
* Redirects user to url, that's build based on given parameters
*
* @param string $t
* @param Array $params
* @param string $prefix
* @param string $index_file
* @return void
* @access public
*/
public function Redirect($t = '', $params = Array(), $prefix = '', $index_file = null)
{
$js_redirect = getArrayValue($params, 'js_redirect');
if ( $t == '' || $t === true ) {
$t = $this->GetVar('t');
}
// pass prefixes and special from previous url
if ( array_key_exists('js_redirect', $params) ) {
unset($params['js_redirect']);
}
// allows to send custom responce code along with redirect header
if ( array_key_exists('response_code', $params) ) {
$response_code = (int)$params['response_code'];
unset($params['response_code']);
}
else {
$response_code = 302; // Found
}
if ( !array_key_exists('pass', $params) ) {
$params['pass'] = 'all';
}
if ( $this->GetVar('ajax') == 'yes' && $t == $this->GetVar('t') ) {
// redirects to the same template as current
$params['ajax'] = 'yes';
}
$location = $this->HREF($t, $prefix, $params, $index_file);
if ( $this->isDebugMode() && (kUtil::constOn('DBG_REDIRECT') || (kUtil::constOn('DBG_RAISE_ON_WARNINGS') && $this->Debugger->WarningCount)) ) {
$this->Debugger->appendTrace();
echo '<strong>Debug output above !!!</strong><br/>' . "\n";
if ( array_key_exists('HTTP_REFERER', $_SERVER) ) {
echo 'Referer: <strong>' . $_SERVER['HTTP_REFERER'] . '</strong><br/>' . "\n";
}
echo "Proceed to redirect: <a href=\"{$location}\">{$location}</a><br/>\n";
}
else {
if ( $js_redirect ) {
// show "redirect" template instead of redirecting,
// because "Set-Cookie" header won't work, when "Location"
// header is used later
$this->SetVar('t', 'redirect');
$this->SetVar('redirect_to', $location);
// make all additional parameters available on "redirect" template too
foreach ($params as $name => $value) {
$this->SetVar($name, $value);
}
return;
}
else {
if ( $this->GetVar('ajax') == 'yes' && ($t != $this->GetVar('t') || !$this->isSOPSafe($location, $t)) ) {
// redirection to other then current template during ajax request OR SOP violation
kUtil::safeDefine('DBG_SKIP_REPORTING', 1);
echo '#redirect#' . $location;
}
elseif ( headers_sent() != '' ) {
// some output occurred -> redirect using javascript
echo '<script type="text/javascript">window.location.href = \'' . $location . '\';</script>';
}
else {
// no output before -> redirect using HTTP header
// header('HTTP/1.1 302 Found');
header('Location: ' . $location, true, $response_code);
}
}
}
// session expiration is called from session initialization,
// that's why $this->Session may be not defined here
$session = $this->recallObject('Session');
/* @var $session Session */
if ( $this->InitDone ) {
// if redirect happened in the middle of application initialization don't call event,
// that presumes that application was successfully initialized
$this->HandleEvent(new kEvent('adm:OnBeforeShutdown'));
}
$session->SaveData();
ob_end_flush();
exit;
}
/**
* Determines if real redirect should be made within AJAX request.
*
* @param string $url Location.
* @param string $template Template.
*
* @return boolean
* @link http://en.wikipedia.org/wiki/Same-origin_policy
*/
protected function isSOPSafe($url, $template)
{
$parsed_url = parse_url($url);
if ( $parsed_url['scheme'] . '://' != PROTOCOL ) {
return false;
}
if ( $parsed_url['host'] != SERVER_NAME ) {
return false;
}
if ( defined('PORT') && isset($parsed_url['port']) && $parsed_url['port'] != PORT ) {
return false;
}
return true;
}
/**
* Returns translation of given label
*
* @param string $label
* @param bool $allow_editing return translation link, when translation is missing on current language
* @param bool $use_admin use current Admin Console language to translate phrase
* @return string
* @access public
*/
public function Phrase($label, $allow_editing = true, $use_admin = false)
{
return $this->Phrases->GetPhrase($label, $allow_editing, $use_admin);
}
/**
* Replace language tags in exclamation marks found in text
*
* @param string $text
* @param bool $force_escape force escaping, not escaping of resulting string
* @return string
* @access public
*/
public function ReplaceLanguageTags($text, $force_escape = null)
{
return $this->Phrases->ReplaceLanguageTags($text, $force_escape);
}
/**
* Checks if user is logged in, and creates
* user object if so. User object can be recalled
* later using "u.current" prefix_special. Also you may
* get user id by getting "u.current_id" variable.
*
* @return void
* @access protected
*/
protected function ValidateLogin()
{
$session = $this->recallObject('Session');
/* @var $session Session */
$user_id = $session->GetField('PortalUserId');
if ( !$user_id && $user_id != USER_ROOT ) {
$user_id = USER_GUEST;
}
$this->SetVar('u.current_id', $user_id);
if ( !$this->isAdmin ) {
// needed for "profile edit", "registration" forms ON FRONT ONLY
$this->SetVar('u_id', $user_id);
}
$this->StoreVar('user_id', $user_id, $user_id == USER_GUEST); // storing Guest user_id (-2) is optional
$this->isAdminUser = $this->isAdmin && $this->LoggedIn();
if ( $this->GetVar('expired') == 1 ) {
// this parameter is set only from admin
$user = $this->recallObject('u.login-admin', null, Array ('form_name' => 'login'));
/* @var $user UsersItem */
$user->SetError('UserLogin', 'session_expired', 'la_text_sess_expired');
}
$this->HandleEvent(new kEvent('adm:OnLogHttpRequest'));
if ( $user_id != USER_GUEST ) {
// normal users + root
$this->LoadPersistentVars();
}
$user_timezone = $this->Session->GetField('TimeZone');
if ( $user_timezone ) {
date_default_timezone_set($user_timezone);
}
}
/**
* Loads current user persistent session data
*
* @return void
* @access public
*/
public function LoadPersistentVars()
{
$this->Session->LoadPersistentVars();
}
/**
* Returns configuration option value by name
*
* @param string $name
* @return string
* @access public
*/
public function ConfigValue($name)
{
return $this->cacheManager->ConfigValue($name);
}
/**
* Changes value of individual configuration variable (+resets cache, when needed)
*
* @param string $name
* @param string $value
* @param bool $local_cache_only
* @return string
* @access public
*/
public function SetConfigValue($name, $value, $local_cache_only = false)
{
return $this->cacheManager->SetConfigValue($name, $value, $local_cache_only);
}
/**
* Allows to process any type of event
*
* @param kEvent $event
* @param Array $params
* @param Array $specific_params
* @return void
* @access public
*/
public function HandleEvent($event, $params = null, $specific_params = null)
{
if ( isset($params) ) {
$event = new kEvent($params, $specific_params);
}
$this->EventManager->HandleEvent($event);
}
/**
* Notifies event subscribers, that event has occured
*
* @param kEvent $event
* @return void
*/
public function notifyEventSubscribers(kEvent $event)
{
$this->EventManager->notifySubscribers($event);
}
/**
* Allows to process any type of event
*
* @param kEvent $event
* @return bool
* @access public
*/
public function eventImplemented(kEvent $event)
{
return $this->EventManager->eventImplemented($event);
}
/**
* Registers new class in the factory
*
* @param string $real_class Real name of class as in class declaration
* @param string $file Filename in what $real_class is declared
* @param string $pseudo_class Name under this class object will be accessed using getObject method
* @return void
* @access public
*/
public function registerClass($real_class, $file, $pseudo_class = null)
{
$this->Factory->registerClass($real_class, $file, $pseudo_class);
}
/**
* Unregisters existing class from factory
*
* @param string $real_class Real name of class as in class declaration
* @param string $pseudo_class Name under this class object is accessed using getObject method
* @return void
* @access public
*/
public function unregisterClass($real_class, $pseudo_class = null)
{
$this->Factory->unregisterClass($real_class, $pseudo_class);
}
/**
* Add new scheduled task
*
* @param string $short_name name to be used to store last maintenance run info
* @param string $event_string
* @param int $run_schedule run schedule like for Cron
* @param string $module
* @param int $status
* @access public
*/
public function registerScheduledTask($short_name, $event_string, $run_schedule, $module, $status = STATUS_ACTIVE)
{
$this->EventManager->registerScheduledTask($short_name, $event_string, $run_schedule, $module, $status);
}
/**
* Registers Hook from subprefix event to master prefix event
*
* Pattern: Observer
*
* @param string $hook_event
* @param string $do_event
* @param int $mode
* @param bool $conditional
* @access public
*/
public function registerHook($hook_event, $do_event, $mode = hAFTER, $conditional = false)
{
$this->EventManager->registerHook($hook_event, $do_event, $mode, $conditional);
}
/**
* Registers build event for given pseudo class
*
* @param string $pseudo_class
* @param string $event_name
* @access public
*/
public function registerBuildEvent($pseudo_class, $event_name)
{
$this->EventManager->registerBuildEvent($pseudo_class, $event_name);
}
/**
* Allows one TagProcessor tag act as other TagProcessor tag
*
* @param Array $tag_info
* @return void
* @access public
*/
public function registerAggregateTag($tag_info)
{
$aggregator = $this->recallObject('TagsAggregator', 'kArray');
/* @var $aggregator kArray */
$tag_data = Array (
$tag_info['LocalPrefix'],
$tag_info['LocalTagName'],
getArrayValue($tag_info, 'LocalSpecial')
);
$aggregator->SetArrayValue($tag_info['AggregateTo'], $tag_info['AggregatedTagName'], $tag_data);
}
/**
* Returns object using params specified, creates it if is required
*
* @param string $name
* @param string $pseudo_class
* @param Array $event_params
* @param Array $arguments
* @return kBase
*/
public function recallObject($name, $pseudo_class = null, $event_params = Array(), $arguments = Array ())
{
/*if ( !$this->hasObject($name) && $this->isDebugMode() && ($name == '_prefix_here_') ) {
// first time, when object with "_prefix_here_" prefix is accessed
$this->Debugger->appendTrace();
}*/
return $this->Factory->getObject($name, $pseudo_class, $event_params, $arguments);
}
/**
* Returns tag processor for prefix specified
*
* @param string $prefix
* @return kDBTagProcessor
* @access public
*/
public function recallTagProcessor($prefix)
{
$this->InitParser(); // because kDBTagProcesor is in NParser dependencies
return $this->recallObject($prefix . '_TagProcessor');
}
/**
* Checks if object with prefix passes was already created in factory
*
* @param string $name object pseudo_class, prefix
* @return bool
* @access public
*/
public function hasObject($name)
{
return $this->Factory->hasObject($name);
}
/**
* Removes object from storage by given name
*
* @param string $name Object's name in the Storage
* @return void
* @access public
*/
public function removeObject($name)
{
$this->Factory->DestroyObject($name);
}
/**
* Get's real class name for pseudo class, includes class file and creates class instance
*
* Pattern: Factory Method
*
* @param string $pseudo_class
* @param Array $arguments
* @return kBase
* @access public
*/
public function makeClass($pseudo_class, $arguments = Array ())
{
return $this->Factory->makeClass($pseudo_class, $arguments);
}
/**
* Returns sub-classes of given ancestor class.
*
* @param string $ancestor_class Ancestor class.
* @param boolean $concrete_only Return only non-abstract classes.
*
* @return array
*/
public function getSubClasses($ancestor_class, $concrete_only = true)
{
return $this->Factory->getSubClasses($ancestor_class, $concrete_only);
}
/**
* Checks if application is in debug mode
*
* @param bool $check_debugger check if kApplication debugger is initialized too, not only for defined DEBUG_MODE constant
* @return bool
* @author Alex
* @access public
*/
public function isDebugMode($check_debugger = true)
{
$debug_mode = defined('DEBUG_MODE') && DEBUG_MODE;
if ($check_debugger) {
$debug_mode = $debug_mode && is_object($this->Debugger);
}
return $debug_mode;
}
/**
* Apply url rewriting used by mod_rewrite or not
*
* @param bool|null $ssl Force ssl link to be build
* @return bool
* @access public
*/
public function RewriteURLs($ssl = false)
{
// case #1,#4:
// we want to create https link from http mode
// we want to create https link from https mode
// conditions: ($ssl || PROTOCOL == 'https://') && $this->ConfigValue('UseModRewriteWithSSL')
// case #2,#3:
// we want to create http link from https mode
// we want to create http link from http mode
// conditions: !$ssl && (PROTOCOL == 'https://' || PROTOCOL == 'http://')
$allow_rewriting =
(!$ssl && (PROTOCOL == 'https://' || PROTOCOL == 'http://')) // always allow mod_rewrite for http
|| // or allow rewriting for redirect TO httpS or when already in httpS
(($ssl || PROTOCOL == 'https://') && $this->ConfigValue('UseModRewriteWithSSL')); // but only if it's allowed in config!
return kUtil::constOn('MOD_REWRITE') && $allow_rewriting;
}
/**
* Returns unit config for given prefix
*
* @param string $prefix
* @return kUnitConfig
* @access public
*/
public function getUnitConfig($prefix)
{
return $this->UnitConfigReader->getUnitConfig($prefix);
}
/**
* Returns true if config exists and is allowed for reading
*
* @param string $prefix
* @return bool
*/
public function prefixRegistred($prefix)
{
return $this->UnitConfigReader->prefixRegistered($prefix);
}
/**
* Splits any mixing of prefix and
* special into correct ones
*
* @param string $prefix_special
* @return Array
* @access public
*/
public function processPrefix($prefix_special)
{
return $this->Factory->processPrefix($prefix_special);
}
/**
* Set's new event for $prefix_special
* passed
*
* @param string $prefix_special
* @param string $event_name
* @return void
* @access public
*/
public function setEvent($prefix_special, $event_name)
{
$this->EventManager->setEvent($prefix_special, $event_name);
}
/**
* SQL Error Handler
*
* @param int $code
* @param string $msg
* @param string $sql
* @return bool
* @access public
* @throws Exception
* @deprecated
*/
public function handleSQLError($code, $msg, $sql)
{
return $this->_logger->handleSQLError($code, $msg, $sql);
}
/**
* Returns & blocks next ResourceId available in system
*
* @return int
* @access public
*/
public function NextResourceId()
{
$table_name = TABLE_PREFIX . 'IdGenerator';
$this->Conn->Query('LOCK TABLES ' . $table_name . ' WRITE');
$this->Conn->Query('UPDATE ' . $table_name . ' SET lastid = lastid + 1');
$id = $this->Conn->GetOne('SELECT lastid FROM ' . $table_name);
if ( $id === false ) {
$this->Conn->Query('INSERT INTO ' . $table_name . ' (lastid) VALUES (2)');
$id = 2;
}
$this->Conn->Query('UNLOCK TABLES');
return $id - 1;
}
/**
* Returns genealogical main prefix for sub-table prefix passes
* OR prefix, that has been found in REQUEST and some how is parent of passed sub-table prefix
*
* @param string $current_prefix
* @param bool $real_top if set to true will return real topmost prefix, regardless of its id is passed or not
* @return string
* @access public
*/
public function GetTopmostPrefix($current_prefix, $real_top = false)
{
// 1. get genealogical tree of $current_prefix
$prefixes = Array ($current_prefix);
while ($parent_prefix = $this->getUnitConfig($current_prefix)->getParentPrefix()) {
if ( !$this->prefixRegistred($parent_prefix) ) {
// stop searching, when parent prefix is not registered
break;
}
$current_prefix = $parent_prefix;
array_unshift($prefixes, $current_prefix);
}
if ( $real_top ) {
return $current_prefix;
}
// 2. find what if parent is passed
$passed = explode(',', $this->GetVar('all_passed'));
foreach ($prefixes as $a_prefix) {
if ( in_array($a_prefix, $passed) ) {
return $a_prefix;
}
}
return $current_prefix;
}
/**
* Triggers email event of type Admin
*
* @param string $email_template_name
* @param int $to_user_id
* @param array $send_params associative array of direct send params, possible keys: to_email, to_name, from_email, from_name, message, message_text
* @return kEvent
* @access public
*/
public function emailAdmin($email_template_name, $to_user_id = null, $send_params = Array ())
{
return $this->_email($email_template_name, EmailTemplate::TEMPLATE_TYPE_ADMIN, $to_user_id, $send_params);
}
/**
* Triggers email event of type User
*
* @param string $email_template_name
* @param int $to_user_id
* @param array $send_params associative array of direct send params, possible keys: to_email, to_name, from_email, from_name, message, message_text
* @return kEvent
* @access public
*/
public function emailUser($email_template_name, $to_user_id = null, $send_params = Array ())
{
return $this->_email($email_template_name, EmailTemplate::TEMPLATE_TYPE_FRONTEND, $to_user_id, $send_params);
}
/**
* Triggers general email event
*
* @param string $email_template_name
* @param int $email_template_type (0 for User, 1 for Admin)
* @param int $to_user_id
* @param array $send_params associative array of direct send params,
* possible keys: to_email, to_name, from_email, from_name, message, message_text
* @return kEvent
* @access protected
*/
protected function _email($email_template_name, $email_template_type, $to_user_id = null, $send_params = Array ())
{
$email = $this->makeClass('kEmail');
/* @var $email kEmail */
if ( !$email->findTemplate($email_template_name, $email_template_type) ) {
return false;
}
$email->setParams($send_params);
return $email->send($to_user_id);
}
/**
* Allows to check if user in this session is logged in or not
*
* @return bool
* @access public
*/
public function LoggedIn()
{
// no session during expiration process
return is_null($this->Session) ? false : $this->Session->LoggedIn();
}
/**
* Check current user permissions based on it's group permissions in specified category
*
* @param string $name permission name
* @param int $cat_id category id, current used if not specified
* @param int $type permission type {1 - system, 0 - per category}
* @return int
* @access public
*/
public function CheckPermission($name, $type = 1, $cat_id = null)
{
$perm_helper = $this->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
return $perm_helper->CheckPermission($name, $type, $cat_id);
}
/**
* Check current admin permissions based on it's group permissions in specified category
*
* @param string $name permission name
* @param int $cat_id category id, current used if not specified
* @param int $type permission type {1 - system, 0 - per category}
* @return int
* @access public
*/
public function CheckAdminPermission($name, $type = 1, $cat_id = null)
{
$perm_helper = $this->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
return $perm_helper->CheckAdminPermission($name, $type, $cat_id);
}
/**
* Set's any field of current visit
*
* @param string $field
* @param mixed $value
* @return void
* @access public
* @todo move to separate module
*/
public function setVisitField($field, $value)
{
if ( $this->isAdmin || !$this->ConfigValue('UseVisitorTracking') ) {
// admin logins are not registered in visits list
return;
}
$visit = $this->recallObject('visits', null, Array ('raise_warnings' => 0));
/* @var $visit kDBItem */
if ( $visit->isLoaded() ) {
$visit->SetDBField($field, $value);
$visit->Update();
}
}
/**
* Allows to check if in-portal is installed
*
* @return bool
* @access public
*/
public function isInstalled()
{
return $this->InitDone && (count($this->ModuleInfo) > 0);
}
/**
* Allows to determine if module is installed & enabled
*
* @param string $module_name
* @return bool
* @access public
*/
public function isModuleEnabled($module_name)
{
return $this->findModule('Name', $module_name) !== false;
}
/**
* Returns Window ID of passed prefix main prefix (in edit mode)
*
* @param string $prefix
* @return int
* @access public
*/
public function GetTopmostWid($prefix)
{
$top_prefix = $this->GetTopmostPrefix($prefix);
$mode = $this->GetVar($top_prefix . '_mode');
return $mode != '' ? substr($mode, 1) : '';
}
/**
* Get temp table name
*
* @param string $table
* @param mixed $wid
* @return string
* @access public
*/
public function GetTempName($table, $wid = '')
{
return $this->GetTempTablePrefix($wid) . $table;
}
/**
* Builds temporary table prefix based on given window id
*
* @param string $wid
* @return string
* @access public
*/
public function GetTempTablePrefix($wid = '')
{
if ( preg_match('/prefix:(.*)/', $wid, $regs) ) {
$wid = $this->GetTopmostWid($regs[1]);
}
return TABLE_PREFIX . 'ses_' . $this->GetSID() . ($wid ? '_' . $wid : '') . '_edit_';
}
/**
* Checks if given table is a temporary table
*
* @param string $table
* @return bool
* @access public
*/
public function IsTempTable($table)
{
static $cache = Array ();
if ( !array_key_exists($table, $cache) ) {
$cache[$table] = preg_match('/' . TABLE_PREFIX . 'ses_' . $this->GetSID() . '(_[\d]+){0,1}_edit_(.*)/', $table);
}
return (bool)$cache[$table];
}
/**
* Checks, that given prefix is in temp mode
*
* @param string $prefix
* @param string $special
* @return bool
* @access public
*/
public function IsTempMode($prefix, $special = '')
{
$top_prefix = $this->GetTopmostPrefix($prefix);
$var_names = Array (
$top_prefix,
rtrim($top_prefix . '_' . $special, '_'), // from post
rtrim($top_prefix . '.' . $special, '.'), // assembled locally
);
$var_names = array_unique($var_names);
$temp_mode = false;
foreach ($var_names as $var_name) {
$value = $this->GetVar($var_name . '_mode');
if ( $value && (substr($value, 0, 1) == 't') ) {
$temp_mode = true;
break;
}
}
return $temp_mode;
}
/**
* Return live table name based on temp table name
*
* @param string $temp_table
* @return string
*/
public function GetLiveName($temp_table)
{
if ( preg_match('/' . TABLE_PREFIX . 'ses_' . $this->GetSID() . '(_[\d]+){0,1}_edit_(.*)/', $temp_table, $rets) ) {
// cut wid from table end if any
return $rets[2];
}
else {
return $temp_table;
}
}
/**
* Stops processing of user request and displays given message
*
* @param string $message
* @access public
*/
public function ApplicationDie($message = '')
{
while ( ob_get_level() ) {
ob_end_clean();
}
if ( $this->isDebugMode() ) {
$message .= $this->Debugger->printReport(true);
}
$this->HTML = $message;
$this->_outputPage();
}
/**
* Returns comma-separated list of groups from given user
*
* @param int $user_id
* @return string
*/
public function getUserGroups($user_id)
{
switch ($user_id) {
case USER_ROOT:
$user_groups = $this->ConfigValue('User_LoggedInGroup');
break;
case USER_GUEST:
$user_groups = $this->ConfigValue('User_LoggedInGroup') . ',' . $this->ConfigValue('User_GuestGroup');
break;
default:
$sql = 'SELECT GroupId
FROM ' . TABLE_PREFIX . 'UserGroupRelations
WHERE PortalUserId = ' . (int)$user_id;
$res = $this->Conn->GetCol($sql);
$user_groups = Array ($this->ConfigValue('User_LoggedInGroup'));
if ( $res ) {
$user_groups = array_merge($user_groups, $res);
}
$user_groups = implode(',', $user_groups);
}
return $user_groups;
}
/**
* Allows to detect if page is browsed by spider (293 scheduled_tasks supported)
*
* @return bool
* @access public
*/
/*public function IsSpider()
{
static $is_spider = null;
if ( !isset($is_spider) ) {
$user_agent = trim($_SERVER['HTTP_USER_AGENT']);
$robots = file(FULL_PATH . '/core/robots_list.txt');
foreach ($robots as $robot_info) {
$robot_info = explode("\t", $robot_info, 3);
if ( $user_agent == trim($robot_info[2]) ) {
$is_spider = true;
break;
}
}
}
return $is_spider;
}*/
/**
* Allows to detect table's presence in database
*
* @param string $table_name
* @param bool $force
* @return bool
* @access public
*/
public function TableFound($table_name, $force = false)
{
return $this->Conn->TableFound($table_name, $force);
}
/**
* Returns counter value
*
* @param string $name counter name
* @param Array $params counter parameters
* @param string $query_name specify query name directly (don't generate from parameters)
* @param bool $multiple_results
* @return mixed
* @access public
*/
public function getCounter($name, $params = Array (), $query_name = null, $multiple_results = false)
{
$count_helper = $this->recallObject('CountHelper');
/* @var $count_helper kCountHelper */
return $count_helper->getCounter($name, $params, $query_name, $multiple_results);
}
/**
* Resets counter, which are affected by one of specified tables
*
* @param string $tables comma separated tables list used in counting sqls
* @return void
* @access public
*/
public function resetCounters($tables)
{
if ( kUtil::constOn('IS_INSTALL') ) {
return;
}
$count_helper = $this->recallObject('CountHelper');
/* @var $count_helper kCountHelper */
$count_helper->resetCounters($tables);
}
/**
* Sends XML header + optionally displays xml heading
*
* @param string|bool $xml_version
* @return string
* @access public
* @author Alex
*/
public function XMLHeader($xml_version = false)
{
$this->setContentType('text/xml');
return $xml_version ? '<?xml version="' . $xml_version . '" encoding="' . CHARSET . '"?>' : '';
}
/**
* Returns category tree
*
* @param int $category_id
* @return Array
* @access public
*/
public function getTreeIndex($category_id)
{
$tree_index = $this->getCategoryCache($category_id, 'category_tree');
if ( $tree_index ) {
$ret = Array ();
list ($ret['TreeLeft'], $ret['TreeRight']) = explode(';', $tree_index);
return $ret;
}
return false;
}
/**
* Base category of all categories
* Usually replaced category, with ID = 0 in category-related operations.
*
* @return int
* @access public
*/
public function getBaseCategory()
{
// same, what $this->findModule('Name', 'Core', 'RootCat') does
// don't cache while IS_INSTALL, because of kInstallToolkit::createModuleCategory and upgrade
return $this->ModuleInfo['Core']['RootCat'];
}
/**
* Deletes all data, that was cached during unit config parsing (excluding unit config locations)
*
* @param Array $config_variables
* @access public
*/
public function DeleteUnitCache($config_variables = null)
{
$this->cacheManager->DeleteUnitCache($config_variables);
}
/**
* Deletes cached section tree, used during permission checking and admin console tree display
*
* @return void
* @access public
*/
public function DeleteSectionCache()
{
$this->cacheManager->DeleteSectionCache();
}
/**
* Sets data from cache to object
*
* @param Array $data
* @access public
*/
public function setFromCache(&$data)
{
$this->Factory->setFromCache($data);
$this->UnitConfigReader->setFromCache($data);
$this->EventManager->setFromCache($data);
$this->ReplacementTemplates = $data['Application.ReplacementTemplates'];
$this->routers = $data['Application.Routers'];
$this->ModuleInfo = $data['Application.ModuleInfo'];
}
/**
* Gets object data for caching
* The following caches should be reset based on admin interaction (adjusting config, enabling modules etc)
*
* @access public
* @return Array
*/
public function getToCache()
{
return array_merge(
$this->Factory->getToCache(),
$this->UnitConfigReader->getToCache(),
$this->EventManager->getToCache(),
Array (
'Application.ReplacementTemplates' => $this->ReplacementTemplates,
'Application.Routers' => $this->routers,
'Application.ModuleInfo' => $this->ModuleInfo,
)
);
}
public function delayUnitProcessing($method, $params)
{
$this->cacheManager->delayUnitProcessing($method, $params);
}
/**
* Returns current maintenance mode state
*
* @param bool $check_ips
* @return int
* @access public
*/
public function getMaintenanceMode($check_ips = true)
{
$exception_ips = defined('MAINTENANCE_MODE_IPS') ? MAINTENANCE_MODE_IPS : '';
$setting_name = $this->isAdmin ? 'MAINTENANCE_MODE_ADMIN' : 'MAINTENANCE_MODE_FRONT';
if ( defined($setting_name) && constant($setting_name) > MaintenanceMode::NONE ) {
$exception_ip = $check_ips ? kUtil::ipMatch($exception_ips) : false;
if ( !$exception_ip ) {
return constant($setting_name);
}
}
return MaintenanceMode::NONE;
}
/**
* Sets content type of the page
*
* @param string $content_type
* @param bool $include_charset
* @return void
* @access public
*/
public function setContentType($content_type = 'text/html', $include_charset = null)
{
static $already_set = false;
if ( $already_set ) {
return;
}
$header = 'Content-type: ' . $content_type;
if ( !isset($include_charset) ) {
$include_charset = $content_type = 'text/html' || $content_type == 'text/plain' || $content_type = 'text/xml';
}
if ( $include_charset ) {
$header .= '; charset=' . CHARSET;
}
$already_set = true;
header($header);
}
/**
* Posts message to event log
*
* @param string $message
* @param int $code
* @param bool $write_now Allows further customization of log record by returning kLog object
* @return bool|int|kLogger
* @access public
*/
public function log($message, $code = null, $write_now = false)
{
$log = $this->_logger->prepare($message, $code)->addSource($this->_logger->createTrace(null, 1));
if ( $write_now ) {
return $log->write();
}
return $log;
}
/**
* Deletes log with given id from database or disk, when database isn't available
*
* @param int $unique_id
* @param int $storage_medium
* @return void
* @access public
* @throws InvalidArgumentException
*/
public function deleteLog($unique_id, $storage_medium = kLogger::LS_AUTOMATIC)
{
$this->_logger->delete($unique_id, $storage_medium);
}
/**
* Returns the client IP address.
*
* @return string The client IP address
* @access public
*/
public function getClientIp()
{
return $this->HttpQuery->getClientIp();
}
}
Index: branches/5.3.x/core/kernel/Console/ConsoleCommandProvider.php
===================================================================
--- branches/5.3.x/core/kernel/Console/ConsoleCommandProvider.php (nonexistent)
+++ branches/5.3.x/core/kernel/Console/ConsoleCommandProvider.php (revision 16181)
@@ -0,0 +1,42 @@
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+namespace Intechnic\InPortal\Core\kernel\Console;
+
+
+defined('FULL_PATH') or die('restricted access!');
+
+class ConsoleCommandProvider extends \kBase implements IConsoleCommandProvider
+{
+
+ /**
+ * Returns console commands.
+ *
+ * @return array
+ */
+ public function getConsoleCommands()
+ {
+ $commands = array();
+ $command_classes = $this->Application->getSubClasses(
+ 'Intechnic\InPortal\Core\kernel\Console\Command\IConsoleCommand'
+ );
+
+ foreach ( $command_classes as $command_class ) {
+ $commands[] = new $command_class();
+ }
+
+ return $commands;
+ }
+
+}
Property changes on: branches/5.3.x/core/kernel/Console/ConsoleCommandProvider.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Index: branches/5.3.x/core/kernel/Console/IConsoleCommandProvider.php
===================================================================
--- branches/5.3.x/core/kernel/Console/IConsoleCommandProvider.php (nonexistent)
+++ branches/5.3.x/core/kernel/Console/IConsoleCommandProvider.php (revision 16181)
@@ -0,0 +1,30 @@
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+namespace Intechnic\InPortal\Core\kernel\Console;
+
+
+defined('FULL_PATH') or die('restricted access!');
+
+interface IConsoleCommandProvider
+{
+
+ /**
+ * Returns console commands.
+ *
+ * @return array
+ */
+ public function getConsoleCommands();
+
+}
Property changes on: branches/5.3.x/core/kernel/Console/IConsoleCommandProvider.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Index: branches/5.3.x/core/kernel/Console/ConsoleApplication.php
===================================================================
--- branches/5.3.x/core/kernel/Console/ConsoleApplication.php (nonexistent)
+++ branches/5.3.x/core/kernel/Console/ConsoleApplication.php (revision 16181)
@@ -0,0 +1,89 @@
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+namespace Intechnic\InPortal\Core\kernel\Console;
+
+
+use Symfony\Component\Console\Application as BaseApplication;
+use Symfony\Component\Console\Command\Command;
+
+defined('FULL_PATH') or die('restricted access!');
+
+class ConsoleApplication extends BaseApplication
+{
+
+ /**
+ * Reference to global kApplication instance.
+ *
+ * @var \kApplication
+ */
+ protected $Application = null;
+
+ /**
+ * Connection to database
+ *
+ * @var \IDBConnection
+ */
+ protected $Conn = null;
+
+ /**
+ * Constructor.
+ *
+ * @param string $name The name of the application.
+ * @param string $version The version of the application.
+ */
+ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
+ {
+ $this->Application =& \kApplication::Instance();
+ $this->Conn =& $this->Application->GetADODBConnection();
+
+ parent::__construct(
+ 'In-Portal CLI',
+ $this->Application->ModuleInfo['Core']['Version'] . ' (PHP v' . phpversion() . ')'
+ );
+ }
+
+ /**
+ * Returns Kernel Application instance.
+ *
+ * @return \kApplication
+ */
+ public function getKernelApplication()
+ {
+ return $this->Application;
+ }
+
+ /**
+ * Gets the default commands that should always be available.
+ *
+ * @return Command[] An array of default Command instances
+ */
+ protected function getDefaultCommands()
+ {
+ $default_commands = parent::getDefaultCommands();
+
+ $command_provider_classes = $this->Application->getSubClasses(
+ 'Intechnic\InPortal\Core\kernel\Console\IConsoleCommandProvider'
+ );
+
+ foreach ( $command_provider_classes as $command_provider_class ) {
+ /** @var IConsoleCommandProvider $command_provider */
+ $command_provider = new $command_provider_class();
+ $default_commands = array_merge($default_commands, $command_provider->getConsoleCommands());
+ }
+
+ return $default_commands;
+ }
+
+}
Property changes on: branches/5.3.x/core/kernel/Console/ConsoleApplication.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Index: branches/5.3.x/core/kernel/Console/Command/IConsoleCommand.php
===================================================================
--- branches/5.3.x/core/kernel/Console/Command/IConsoleCommand.php (nonexistent)
+++ branches/5.3.x/core/kernel/Console/Command/IConsoleCommand.php (revision 16181)
@@ -0,0 +1,23 @@
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+namespace Intechnic\InPortal\Core\kernel\Console\Command;
+
+
+defined('FULL_PATH') or die('restricted access!');
+
+interface IConsoleCommand
+{
+
+}
Property changes on: branches/5.3.x/core/kernel/Console/Command/IConsoleCommand.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Index: branches/5.3.x/core/kernel/Console/Command/AbstractCommand.php
===================================================================
--- branches/5.3.x/core/kernel/Console/Command/AbstractCommand.php (nonexistent)
+++ branches/5.3.x/core/kernel/Console/Command/AbstractCommand.php (revision 16181)
@@ -0,0 +1,79 @@
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+namespace Intechnic\InPortal\Core\kernel\Console\Command;
+
+
+use Intechnic\InPortal\Core\kernel\Console\ConsoleApplication;
+use Symfony\Component\Console\Command\Command as SymfonyCommand;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+defined('FULL_PATH') or die('restricted access!');
+
+abstract class AbstractCommand extends SymfonyCommand implements IConsoleCommand
+{
+
+ /**
+ * Reference to global kApplication instance
+ *
+ * @var \kApplication.
+ */
+ protected $Application = null;
+
+ /**
+ * Connection to database.
+ *
+ * @var \IDBConnection
+ */
+ protected $Conn = null;
+
+ /**
+ * Sets the application instance for this command.
+ *
+ * @param ConsoleApplication $application An Application instance.
+ *
+ * @return void
+ */
+ public function setApplication(ConsoleApplication $application = null)
+ {
+ parent::setApplication($application);
+
+ // For disabled commands $application is not set.
+ if ( isset($application) ) {
+ $this->Application = $application->getKernelApplication();
+ $this->Conn =& $this->Application->GetADODBConnection();
+ }
+ }
+
+ /**
+ * Perform additional validation of the input.
+ *
+ * @param InputInterface $input An InputInterface instance.
+ * @param OutputInterface $output An OutputInterface instance.
+ *
+ * @return void
+ * @throws \RuntimeException When not all required arguments were passed.
+ */
+ protected function initialize(InputInterface $input, OutputInterface $output)
+ {
+ $arguments = array_filter($input->getArguments());
+
+ // Consider required arguments passed with empty values as an error.
+ if ( count($arguments) < $this->getDefinition()->getArgumentRequiredCount() ) {
+ throw new \RuntimeException('Not enough arguments.');
+ }
+ }
+
+}
Property changes on: branches/5.3.x/core/kernel/Console/Command/AbstractCommand.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Index: branches/5.3.x/core/kernel/Console/Command/BuildClassMapCommand.php
===================================================================
--- branches/5.3.x/core/kernel/Console/Command/BuildClassMapCommand.php (nonexistent)
+++ branches/5.3.x/core/kernel/Console/Command/BuildClassMapCommand.php (revision 16181)
@@ -0,0 +1,136 @@
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+namespace Intechnic\InPortal\Core\kernel\Console\Command;
+
+
+use Intechnic\InPortal\Core\kernel\utility\ClassDiscovery\ClassMapBuilder;
+use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+defined('FULL_PATH') or die('restricted access!');
+
+class BuildClassMapCommand extends AbstractCommand implements CompletionAwareInterface
+{
+
+ /**
+ * Configures the current command.
+ *
+ * @return void
+ */
+ protected function configure()
+ {
+ $this
+ ->setName('classmap:rebuild')
+ ->setDescription('Rebuilds the class map')
+ ->addOption(
+ 'module',
+ null,
+ InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
+ 'Module name to build class map for'
+ );
+ }
+
+ /**
+ * Executes the current command.
+ *
+ * @param InputInterface $input An InputInterface instance.
+ * @param OutputInterface $output An OutputInterface instance.
+ *
+ * @return null|integer
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $user_modules = $input->getOption('module');
+
+ if ( $user_modules ) {
+ $modules_filter = array();
+ $valid_modules = $this->getModules();
+
+ foreach ( $user_modules as $module_name ) {
+ if ( !in_array($module_name, $valid_modules) ) {
+ throw new \InvalidArgumentException('Module "' . $module_name . '" not found or installed');
+ }
+
+ $modules_filter[$module_name] = $this->Application->ModuleInfo[$module_name];
+ }
+ }
+ else {
+ $modules_filter = null;
+ }
+
+ $table_rows = array();
+
+ foreach ( ClassMapBuilder::createBuilders($modules_filter) as $class_map_builder ) {
+ $table_rows[] = $class_map_builder->build();
+ }
+
+ // Needed because we aggregate class map from installed modules in unit config cache.
+ $this->Application->HandleEvent(new \kEvent('adm:OnResetParsedData'));
+
+ $table = $this->getHelper('table');
+ $table
+ ->setHeaders(array('Path', 'Scanned in', 'Parsed in'))
+ ->setRows($table_rows);
+ $table->render($output);
+
+ return 0;
+ }
+
+ /**
+ * Return possible values for the named option
+ *
+ * @param string $optionName Option name.
+ * @param CompletionContext $context Completion context.
+ *
+ * @return array
+ */
+ public function completeOptionValues($optionName, CompletionContext $context)
+ {
+ if ( $optionName === 'module' ) {
+ return $this->getModules();
+ }
+
+ return array();
+ }
+
+ /**
+ * Returns possible module names.
+ *
+ * @return array
+ */
+ protected function getModules()
+ {
+ $modules = array_keys($this->Application->ModuleInfo);
+
+ return array_diff($modules, array('In-Portal'));
+ }
+
+ /**
+ * Return possible values for the named argument.
+ *
+ * @param string $argumentName Argument name.
+ * @param CompletionContext $context Completion context.
+ *
+ * @return array
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context)
+ {
+ return array();
+ }
+
+}
Property changes on: branches/5.3.x/core/kernel/Console/Command/BuildClassMapCommand.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Index: branches/5.3.x/core/kernel/Console/Command/ResetCacheCommand.php
===================================================================
--- branches/5.3.x/core/kernel/Console/Command/ResetCacheCommand.php (nonexistent)
+++ branches/5.3.x/core/kernel/Console/Command/ResetCacheCommand.php (revision 16181)
@@ -0,0 +1,131 @@
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+namespace Intechnic\InPortal\Core\kernel\Console\Command;
+
+
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+defined('FULL_PATH') or die('restricted access!');
+
+class ResetCacheCommand extends AbstractCommand
+{
+
+ /**
+ * Determines what options will execute what events.
+ *
+ * @var array
+ */
+ protected $optionMap = array(
+ 'unit-data' => array(
+ 'short' => 'd',
+ 'description' => 'Reset Parsed and Cached System Data',
+ 'event' => 'adm:OnResetParsedData',
+ ),
+ 'unit-files' => array(
+ 'short' => 'f',
+ 'description' => 'Reset Configs Files Cache and Parsed System Data',
+ 'event' => 'adm:OnResetConfigsCache',
+ ),
+ 'admin-sections' => array(
+ 'short' => 's',
+ 'description' => 'Reset Admin Console Sections',
+ 'event' => 'adm:OnResetSections',
+ ),
+ 'mod-rewrite' => array(
+ 'short' => 'r',
+ 'description' => 'Reset ModRewrite Cache',
+ 'event' => 'adm:OnResetModRwCache',
+ ),
+ 'sms-menu' => array(
+ 'short' => 'm',
+ 'description' => 'Reset SMS Menu Cache',
+ 'event' => 'c:OnResetCMSMenuCache',
+ ),
+ 'templates' => array(
+ 'short' => 't',
+ 'description' => 'Clear Templates Cache',
+ 'event' => 'adm:OnDeleteCompiledTemplates',
+ ),
+ 'all-keys' => array(
+ 'short' => 'k',
+ 'description' => 'Reset All Keys',
+ 'event' => 'adm:OnResetMemcache',
+ ),
+ );
+
+ /**
+ * Configures the current command.
+ *
+ * @return void
+ */
+ protected function configure()
+ {
+ $this
+ ->setName('cache:reset')
+ ->setDescription('Resets the cache');
+
+ foreach ( $this->optionMap as $option_name => $option_data ) {
+ $this->addOption(
+ $option_name,
+ $option_data['short'],
+ InputOption::VALUE_NONE,
+ $option_data['description']
+ );
+ }
+ }
+
+ /**
+ * Executes the current command.
+ *
+ * @param InputInterface $input An InputInterface instance.
+ * @param OutputInterface $output An OutputInterface instance.
+ *
+ * @return null|integer
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $success_count = 0;
+ $error_count = 0;
+
+ foreach ( $this->optionMap as $option_name => $option_data ) {
+ if ( !$input->getOption($option_name) ) {
+ continue;
+ }
+
+ $success_count++;
+ $output->write('- ' . $option_data['description'] . ' ... ');
+
+ $event = new \kEvent($option_data['event']);
+ $this->Application->HandleEvent($event);
+
+ if ( $event->getRedirectParam('action_completed') ) {
+ $output->writeln('<info>OK</info>');
+ }
+ else {
+ $error_count++;
+ $output->writeln('<error>FAILED</error>');
+ }
+ }
+
+ if ( $success_count === 0 ) {
+ throw new \RuntimeException('Please specify at least one reset option');
+ }
+
+ return $error_count == 0 ? 0 : 64;
+ }
+
+}
Property changes on: branches/5.3.x/core/kernel/Console/Command/ResetCacheCommand.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Index: branches/5.3.x/core/kernel/Console/Command/RunEventCommand.php
===================================================================
--- branches/5.3.x/core/kernel/Console/Command/RunEventCommand.php (nonexistent)
+++ branches/5.3.x/core/kernel/Console/Command/RunEventCommand.php (revision 16181)
@@ -0,0 +1,126 @@
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+namespace Intechnic\InPortal\Core\kernel\Console\Command;
+
+
+use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+defined('FULL_PATH') or die('restricted access!');
+
+class RunEventCommand extends AbstractCommand implements CompletionAwareInterface
+{
+
+ /**
+ * Configures the current command.
+ *
+ * @return void
+ */
+ protected function configure()
+ {
+ $this
+ ->setName('event:run')
+ ->setDescription('Executes an event')
+ ->addArgument(
+ 'event_name',
+ InputArgument::REQUIRED,
+ 'Event name (e.g. "<info>adm:OnDoSomething</info>")'
+ );
+ }
+
+ /**
+ * Executes the current command.
+ *
+ * @param InputInterface $input An InputInterface instance.
+ * @param OutputInterface $output An OutputInterface instance.
+ *
+ * @return null|integer
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $event_name = $input->getArgument('event_name');
+
+ $run_event = new \kEvent($event_name);
+ $this->Application->HandleEvent($run_event);
+
+ return $run_event->status == \kEvent::erSUCCESS ? 0 : 64;
+ }
+
+ /**
+ * Return possible values for the named option
+ *
+ * @param string $optionName Option name.
+ * @param CompletionContext $context Completion context.
+ *
+ * @return array
+ */
+ public function completeOptionValues($optionName, CompletionContext $context)
+ {
+ return array();
+ }
+
+ /**
+ * Return possible values for the named argument.
+ *
+ * @param string $argumentName Argument name.
+ * @param CompletionContext $context Completion context.
+ *
+ * @return array
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context)
+ {
+ if ( $argumentName === 'event_name' ) {
+ $event_name = $context->getCurrentWord();
+
+ // Suggest unit config prefixes.
+ if ( strpos($event_name, ':') === false ) {
+ return $this->Application->UnitConfigReader->getPrefixes(false);
+ }
+
+ try {
+ $event = new \kEvent($event_name);
+ }
+ catch ( \InvalidArgumentException $e ) {
+ // Invalid event name.
+ return array();
+ }
+
+ // Unknown unit.
+ if ( !$this->Application->prefixRegistred($event->Prefix) ) {
+ return array();
+ }
+
+ // Suggest event names.
+ $suggestions = array();
+ $reflection = new \ReflectionClass(
+ $this->Application->makeClass($event->Prefix . '_EventHandler')
+ );
+
+ foreach ( $reflection->getMethods() as $method ) {
+ if ( substr($method->getName(), 0, 2) === 'On' ) {
+ $suggestions[] = $event->Prefix . ':' . $method->getName();
+ }
+ }
+
+ return $suggestions;
+ }
+
+ return array();
+ }
+
+}
Property changes on: branches/5.3.x/core/kernel/Console/Command/RunEventCommand.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Index: branches/5.3.x/core/kernel/Console/Command/CompletionCommand.php
===================================================================
--- branches/5.3.x/core/kernel/Console/Command/CompletionCommand.php (nonexistent)
+++ branches/5.3.x/core/kernel/Console/Command/CompletionCommand.php (revision 16181)
@@ -0,0 +1,89 @@
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+namespace Intechnic\InPortal\Core\kernel\Console\Command;
+
+
+use Intechnic\InPortal\Core\kernel\Console\ConsoleApplication;
+use Stecman\Component\Symfony\Console\BashCompletion\Completion;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand as BashCompletionCommand;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionHandler;
+
+defined('FULL_PATH') or die('restricted access!');
+
+class CompletionCommand extends BashCompletionCommand implements IConsoleCommand
+{
+
+ /**
+ * Reference to global kApplication instance
+ *
+ * @var \kApplication.
+ */
+ protected $Application = null;
+
+ /**
+ * Connection to database.
+ *
+ * @var \IDBConnection
+ */
+ protected $Conn = null;
+
+ /**
+ * Sets the application instance for this command.
+ *
+ * @param ConsoleApplication $application An Application instance.
+ *
+ * @return void
+ */
+ public function setApplication(ConsoleApplication $application = null)
+ {
+ parent::setApplication($application);
+
+ // For disabled commands $application is not set.
+ if ( isset($application) ) {
+ $this->Application = $application->getKernelApplication();
+ $this->Conn =& $this->Application->GetADODBConnection();
+ }
+ }
+
+ /**
+ * Configure the CompletionHandler instance before it is run
+ *
+ * @param CompletionHandler $handler Completion handler.
+ *
+ * @return void
+ */
+ protected function configureCompletion(CompletionHandler $handler)
+ {
+ // This can be removed once https://github.com/stecman/symfony-console-completion v0.5.2 will be released.
+ $handler->addHandler(
+ new Completion(
+ 'help',
+ 'command_name',
+ Completion::TYPE_ARGUMENT,
+ array_keys($this->getApplication()->all())
+ )
+ );
+
+ $handler->addHandler(
+ new Completion(
+ 'list',
+ 'namespace',
+ Completion::TYPE_ARGUMENT,
+ $this->getApplication()->getNamespaces()
+ )
+ );
+ }
+
+}
Property changes on: branches/5.3.x/core/kernel/Console/Command/CompletionCommand.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Index: branches/5.3.x/core/kernel/utility/ClassDiscovery/ClassMapBuilder.php
===================================================================
--- branches/5.3.x/core/kernel/utility/ClassDiscovery/ClassMapBuilder.php (revision 16180)
+++ branches/5.3.x/core/kernel/utility/ClassDiscovery/ClassMapBuilder.php (revision 16181)
@@ -1,448 +1,437 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
namespace Intechnic\InPortal\Core\kernel\utility\ClassDiscovery;
use PhpParser\Lexer;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitor\NameResolver;
use PhpParser\Parser;
defined('FULL_PATH') or die('restricted access!');
class ClassMapBuilder
{
const CACHE_FORMAT = 2;
const CACHE_FILE_STRUCTURE = 'class_structure.php';
const CACHE_FILE_HASHES = 'file_hashes.php';
/**
* Path to scan.
*
* @var string
*/
protected $scanPath;
/**
* Path to store cache into.
*
* @var string
*/
protected $cachePath;
/**
* List of classes (key - class, value - file).
*
* @var array
*/
protected $classToFileMap = array();
/**
* Class information used during cache building (file > class > class_info).
*
* @var array
*/
protected $buildingCache = array();
/**
* Class information (type, extends, implements, etc.).
*
* @var array
*/
protected $classInfo = array();
/**
* Stores hash of each file on given path.
*
* @var array
*/
protected $fileHashes = array();
/**
* Parser.
*
* @var Parser
*/
protected $parser;
/**
* Node traverser.
*
* @var NodeTraverser
*/
protected $traverser;
/**
* Name of file, that is currently processed.
*
* @var string
*/
protected $currentFile;
/**
* Returns builder array for all eligible folders.
*
* @param array $module_info Module info.
*
* @return static[]
*/
public static function createBuilders(array $module_info = null)
{
$ret = array();
if ( !isset($module_info) ) {
// No module information given > scan everything.
$ret[] = new static(FULL_PATH . DIRECTORY_SEPARATOR . 'core');
foreach ( glob(MODULES_PATH . '/*', GLOB_ONLYDIR) as $module_folder ) {
if ( \kModulesHelper::isInPortalModule($module_folder) ) {
$ret[] = new static($module_folder);
}
}
}
else {
// Module information given > scan only these modules.
foreach ( $module_info as $module_name => $module_data ) {
if ( $module_name == 'In-Portal' ) {
continue;
}
$ret[] = new static(FULL_PATH . DIRECTORY_SEPARATOR . rtrim($module_data['Path'], '/'));
}
}
return $ret;
}
/**
* Creates ClassMapBuilder instance.
*
* @param string $scan_path Path to scan.
*/
public function __construct($scan_path)
{
$this->scanPath = $scan_path;
$this->assertPath($this->scanPath);
$this->cachePath = $this->scanPath . '/install/cache';
$this->assertPath($this->cachePath);
}
/**
* Validates that path exists and is directory.
*
* @param string $path Path.
*
* @return void
* @throws \InvalidArgumentException When invalid path is given.
*/
protected function assertPath($path)
{
if ( !file_exists($path) || !is_dir($path) ) {
throw new \InvalidArgumentException('Path "' . $path . '" is not a folder or doesn\'t exist');
}
}
/**
* Returns class map and class information, that was built previously.
*
* @return array
*/
public function get()
{
$this->load(self::CACHE_FILE_STRUCTURE, false);
return array($this->classToFileMap, $this->classInfo);
}
/**
* Builds class map.
*
- * @return void
+ * @return array
* @throws \RuntimeException When PHP parser not found.
*/
public function build()
{
if ( !class_exists('PhpParser\Parser') ) {
$error_msg = 'PHP Parser not found. Make sure, that Composer dependencies were ';
$error_msg .= 'installed using "php composer.phar install --dev" command.';
throw new \RuntimeException($error_msg);
}
+ $table_output = array();
$scan_path = preg_replace('/^' . preg_quote(FULL_PATH, '/') . '/', '...', $this->scanPath, 1);
- echo $this->strPad('path "' . $scan_path . '"', 40);
+ $table_output[] = $scan_path; // The "Path" column.
$this->load(self::CACHE_FILE_STRUCTURE, true);
$this->load(self::CACHE_FILE_HASHES, true);
$start = microtime(true);
$files = $this->scan();
- echo $this->strPad('scanned in ' . sprintf('%.4f', microtime(true) - $start) . 's', 25);
+ $table_output[] = sprintf('%.4f', microtime(true) - $start) . 's'; // The "Scanned in" column.
$start = microtime(true);
$this->createParser();
foreach ( $files as $file ) {
$this->parseFile($file);
}
- echo $this->strPad('parsed in ' . sprintf('%.4f', microtime(true) - $start) . 's', 25);
- echo PHP_EOL;
+ $table_output[] = sprintf('%.4f', microtime(true) - $start) . 's'; // The "Parsed in" column.
ksort($this->classToFileMap);
ksort($this->fileHashes);
ksort($this->classInfo);
$this->store(self::CACHE_FILE_STRUCTURE);
$this->store(self::CACHE_FILE_HASHES);
- }
- /**
- * Pads text with spaces from right side.
- *
- * @param string $text Text.
- * @param integer $length Pad length.
- *
- * @return string
- */
- protected function strPad($text, $length)
- {
- return str_pad($text, $length, ' ', STR_PAD_RIGHT);
+ return $table_output;
}
/**
* Loads cache from disk.
*
* @param string $filename Filename.
* @param boolean $for_writing Load cache for writing or reading.
*
* @return void
*/
protected function load($filename, $for_writing)
{
$file_path = $this->getCacheFilename($filename);
if ( !file_exists($file_path) ) {
return;
}
$cache = include $file_path;
if ( $cache['cache_format'] != self::CACHE_FORMAT ) {
return;
}
if ( $filename === self::CACHE_FILE_STRUCTURE ) {
$class_info = $cache['class_info'];
if ( $for_writing ) {
foreach ( $cache['classes'] as $class => $file ) {
if ( !isset($this->buildingCache[$file]) ) {
$this->buildingCache[$file] = array();
}
$this->buildingCache[$file][$class] = $class_info[$class];
}
}
else {
$this->classToFileMap = $cache['classes'];
$this->classInfo = $class_info;
}
}
elseif ( $filename === self::CACHE_FILE_HASHES ) {
$this->fileHashes = $cache['file_hashes'];
}
}
/**
* Scans path for files.
*
* @return array
*/
protected function scan()
{
$files = array();
$directory_iterator = new \RecursiveDirectoryIterator($this->scanPath);
$filter_iterator = new CodeFolderFilterIterator($directory_iterator);
foreach ( new \RecursiveIteratorIterator($filter_iterator, \RecursiveIteratorIterator::SELF_FIRST) as $file ) {
/* @var \SplFileInfo $file */
if ( $file->isFile() && $file->getExtension() === 'php' ) {
$relative_path = preg_replace('/^' . preg_quote(FULL_PATH, '/') . '/', '', $file->getPathname(), 1);
$files[$relative_path] = true;
}
}
// Don't include cache file itself in cache.
$exclude_file = preg_replace(
'/^' . preg_quote(FULL_PATH, '/') . '/',
'',
$this->getCacheFilename(self::CACHE_FILE_STRUCTURE),
1
);
unset($files[$exclude_file]);
$exclude_file = preg_replace(
'/^' . preg_quote(FULL_PATH, '/') . '/',
'',
$this->getCacheFilename(self::CACHE_FILE_HASHES),
1
);
unset($files[$exclude_file]);
return array_keys($files);
}
/**
* Create parser.
*
* @return void
*/
protected function createParser()
{
\kUtil::setResourceLimit();
ini_set('xdebug.max_nesting_level', 3000);
$this->parser = new Parser(new Lexer());
$this->traverser = new NodeTraverser();
$this->traverser->addVisitor(new NameResolver());
$this->traverser->addVisitor(new ClassDetector($this));
}
/**
* Parses a file.
*
* @param string $file Path to file.
*
* @return void
*/
protected function parseFile($file)
{
$this->currentFile = $file;
$code = file_get_contents(FULL_PATH . $file);
$current_hash = filesize(FULL_PATH . $file);
$previous_hash = isset($this->fileHashes[$file]) ? $this->fileHashes[$file] : 0;
if ( $current_hash === $previous_hash ) {
// File wasn't change since time, when cache was built.
if ( isset($this->buildingCache[$file]) ) {
foreach ( $this->buildingCache[$file] as $class => $class_info ) {
$this->addClass($class, $class_info);
}
}
}
else {
// Parse file, because it's content doesn't match the cache.
$this->fileHashes[$file] = $current_hash;
$statements = $this->parser->parse($code);
$this->traverser->traverse($statements);
}
}
/**
* Stores cache to disk.
*
* @param string $filename Cache filename.
*
* @return void
* @throws \RuntimeException When cache could not be written.
*/
protected function store($filename)
{
$cache = array('cache_format' => self::CACHE_FORMAT);
if ( $filename === self::CACHE_FILE_STRUCTURE ) {
$cache['classes'] = $this->classToFileMap;
$cache['class_info'] = $this->classInfo;
}
elseif ( $filename === self::CACHE_FILE_HASHES ) {
$cache['file_hashes'] = $this->fileHashes;
}
$cache = $this->prettyVarExport($cache);
$at = '@';
$file_content = <<<EOPHP
<?php
// {$at}codingStandardsIgnoreFile
/**
- * This file is automatically {$at}generated. Use 'php tools/build_class_map.php' to rebuild it.
+ * This file is automatically {$at}generated. Please use 'in-portal classmap:rebuild' command to rebuild it.
*/
return {$cache};
EOPHP;
$file_path = $this->getCacheFilename($filename);
// Don't bother saving, because file wasn't even changed.
if ( file_exists($file_path) && file_get_contents($file_path) === $file_content ) {
return;
}
if ( file_put_contents($file_path, $file_content) === false ) {
throw new \RuntimeException('Unable to save cache to "' . $file_path . '" file');
}
}
/**
* Prettified var_export.
*
* @param mixed $data Data.
*
* @return string
*/
protected function prettyVarExport($data)
{
$result = var_export($data, true);
$result = preg_replace("/=> \n[ ]+array \\(/s", '=> array (', $result);
$result = str_replace(array('array (', ' '), array('array(', "\t"), $result);
return $result;
}
/**
* Returns cache filename.
*
* @param string $filename Filename.
*
* @return string
*/
protected function getCacheFilename($filename)
{
return $this->cachePath . '/' . $filename;
}
/**
* Adds class to the map.
*
* @param string $class Class.
* @param array $class_info Class info.
*
* @return void
*/
public function addClass($class, array $class_info)
{
$this->classInfo[$class] = $class_info;
$this->classToFileMap[$class] = $this->currentFile;
}
}
Index: branches/5.3.x/core/kernel/utility/factory.php
===================================================================
--- branches/5.3.x/core/kernel/utility/factory.php (revision 16180)
+++ branches/5.3.x/core/kernel/utility/factory.php (revision 16181)
@@ -1,492 +1,492 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
use Intechnic\InPortal\Core\kernel\utility\ClassDiscovery\ClassMapBuilder;
defined('FULL_PATH') or die('restricted access!');
class kFactory extends kBase implements kiCacheable {
const TYPE_CLASS = 1;
const TYPE_INTERFACE = 2;
const TYPE_TRAIT = 3;
const MODIFIER_ABSTRACT = 1;
const MODIFIER_FINAL = 2;
/**
* Mapping between class name and file name
* where class definition can be found.
* File path absolute!
*
* @var Array
* @access protected
*/
protected $classMap = Array ();
/**
* Class information.
*
* @var array
*/
protected $classInfo = array();
/**
* Information about class usage among other classes.
*
* @var array
*/
protected $classTree = array();
/**
* The PSR-4 compliant namespace-to-folder mapping.
*
* @var array
*/
protected $namespaceMap = array();
/**
* Map class names to their pseudo
* class names, e.g. key=pseudo_class,
* value=real_class_name
*
* @var Array
* @access protected
*/
protected $realClasses = Array ();
/**
* Where all created objects are stored
*
* @var Array|kBase[]
* @access protected
*/
protected $Storage = Array ();
public function __construct()
{
parent::__construct();
spl_autoload_register(array($this, 'autoload'), true, true);
}
/**
* Configures module-based autoloader.
*
* @return void
*/
public function configureAutoloader()
{
if ( !$this->Application->ModuleInfo ) {
$error_msg = 'Autoloader configuration can be only performed after module information is available';
throw new LogicException($error_msg);
}
$this->namespaceMap = array();
foreach ( $this->Application->ModuleInfo as $module_name => $module_info ) {
if ( $module_name == 'In-Portal' ) {
continue;
}
$this->namespaceMap[$module_info['ClassNamespace']] = rtrim($module_info['Path'], '/');
}
if ( defined('IS_INSTALL') && IS_INSTALL ) {
// During installation process all modules, because unit configs from all modules are scanned too.
$class_map_builders = ClassMapBuilder::createBuilders();
}
else {
$class_map_builders = ClassMapBuilder::createBuilders($this->Application->ModuleInfo);
}
foreach ( $class_map_builders as $class_map_builder ) {
list($class_map, $class_info) = $class_map_builder->get();
$class_names = array_keys($class_map);
$this->classMap = array_merge($this->classMap, $class_map);
$this->classInfo = array_merge($this->classInfo, $class_info);
$this->realClasses = array_merge($this->realClasses, array_combine($class_names, $class_names));
foreach ( $class_info as $class => $class_data ) {
if ( isset($class_data['extends']) ) {
foreach ( $class_data['extends'] as $extends_class ) {
if ( !isset($this->classTree[$extends_class]) ) {
$this->classTree[$extends_class] = array();
}
$this->classTree[$extends_class][] = $class;
}
}
}
}
}
/**
* Sets data from cache to object
*
* @param Array $data
* @return void
* @access public
*/
public function setFromCache(&$data)
{
$this->classMap = $data['Factory.Files'];
$this->classInfo = $data['Factory.ClassInfo'];
$this->classTree = $data['Factory.ClassTree'];
$this->namespaceMap = $data['Factory.Namespaces'];
$this->realClasses = $data['Factory.realClasses'];
}
/**
* Performs automatic loading of classes registered with the factory
*
* @param string $class
* @return bool|null
* @access public
*/
public function autoload($class)
{
$file = $this->findFile($class);
if ( $file ) {
kUtil::includeOnce(FULL_PATH . $file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
* @return string|bool The path if found, false otherwise
* @access protected
*/
protected function findFile($class)
{
if ( $class[0] == '\\' ) {
$class = substr($class, 1);
}
if ( isset($this->classMap[$class]) ) {
return $this->classMap[$class];
}
$pos = strrpos($class, '\\');
if ( $pos !== false ) {
// namespaced class name
$class_path = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR;
$class_name = substr($class, $pos + 1);
}
else {
// PEAR-like class name
$class_path = null;
$class_name = $class;
}
$class_path .= str_replace('_', DIRECTORY_SEPARATOR, $class_name) . '.php';
foreach ( $this->namespaceMap as $namespace_prefix => $namespace_path ) {
if ( strpos($class, $namespace_prefix) === 0 ) {
$test_class_path = str_replace(
str_replace('\\', DIRECTORY_SEPARATOR, $namespace_prefix),
$namespace_path,
$class_path
);
if ( file_exists(FULL_PATH . DIRECTORY_SEPARATOR . $test_class_path) ) {
return DIRECTORY_SEPARATOR . $test_class_path;
}
}
}
return $this->classMap[$class] = false;
}
/**
* Gets object data for caching
*
* @return Array
* @access public
*/
public function getToCache()
{
ksort($this->classMap);
ksort($this->classInfo);
ksort($this->classTree);
ksort($this->namespaceMap);
ksort($this->realClasses);
return Array (
'Factory.Files' => $this->classMap,
'Factory.ClassInfo' => $this->classInfo,
'Factory.ClassTree' => $this->classTree,
'Factory.Namespaces' => $this->namespaceMap,
'Factory.realClasses' => $this->realClasses,
);
}
/**
* Splits any mixing of prefix and
* special into correct ones
*
* @param string $prefix_special
* @return Array
* @access public
*/
public function processPrefix($prefix_special)
{
// l.pick, l, m.test_TagProcessor
//preg_match("/(.*)\.*(.*)(_*)(.*)/", $prefix_special, $regs);
//return Array('prefix'=>$regs[1].$regs[3].$regs[4], 'special'=>$regs[2]);
$tmp = explode('_', $prefix_special, 2);
$tmp[0] = explode('.', $tmp[0]);
$prefix = $tmp[0][0];
$prefix_special = $prefix; // new1
if ( isset($tmp[1]) ) {
$prefix .= '_' . $tmp[1];
}
$special = isset($tmp[0][1]) ? $tmp[0][1] : '';
$prefix_special .= '.' . $special; // new2
return Array ('prefix' => $prefix, 'special' => $special, 'prefix_special' => $prefix_special);
}
/**
* Returns object using params specified, creates it if is required.
*
* @param string $name Object name in factory.
* @param string $pseudo_class Pseudo class.
* @param Array $event_params Event params.
* @param Array $arguments Constructor arguments.
*
* @return kBase
*/
public function getObject($name, $pseudo_class = '', $event_params = Array (), $arguments = Array ())
{
$name = rtrim($name, '.');
if ( isset($this->Storage[$name]) ) {
return $this->Storage[$name];
}
$ret = $this->processPrefix($name);
if ( !$pseudo_class ) {
$pseudo_class = $ret['prefix'];
}
if ( defined('DEBUG_MODE') && defined('DBG_FACTORY') && DBG_FACTORY && $this->Application->isDebugMode() ) {
$this->Application->Debugger->appendHTML('<b>Creating object:</b> Pseudo class: ' . $pseudo_class . ' Prefix: ' . $name);
$this->Application->Debugger->appendTrace();
}
$this->Storage[$name] = $this->makeClass($pseudo_class, $arguments);
$this->Storage[$name]->Init($ret['prefix'], $ret['special']);
$this->Application->EventManager->runBuildEvent($ret['prefix_special'], $pseudo_class, $event_params);
return $this->Storage[$name];
}
/**
* Removes object from storage, so next time it could be created from scratch
*
* @param string $name Object's name in the Storage
* @return void
* @access public
*/
public function DestroyObject($name)
{
unset($this->Storage[$name]);
}
/**
* Checks if object with prefix passes was already created in factory
*
* @param string $name object pseudo_class, prefix
* @return bool
* @access public
*/
public function hasObject($name)
{
return isset($this->Storage[$name]);
}
/**
* Get's real class name for pseudo class, includes class file and creates class instance.
*
* Pattern: Factory Method
*
* @param string $pseudo_class Pseudo class.
* @param array $arguments Constructor arguments.
*
* @return kBase
* @throws kFactoryException When class not found.
*/
public function makeClass($pseudo_class, $arguments = Array ())
{
if ( !isset($this->realClasses[$pseudo_class]) ) {
$error_msg = 'RealClass not defined for "<strong>' . $pseudo_class . '</strong>" pseudo_class.';
- $error_msg .= ' Please use "<strong>php tools/build_class_map.php</strong>" to discover new classes.';
+ $error_msg .= ' Please use "<strong>in-portal classmap:rebuild</strong>" command to discover new classes.';
if ( $this->Application->isInstalled() ) {
throw new kFactoryException($error_msg);
}
else {
if ( $this->Application->isDebugMode() ) {
$this->Application->Debugger->appendTrace();
}
trigger_error($error_msg, E_USER_WARNING);
}
return false;
}
$real_class = $this->realClasses[$pseudo_class];
$mem_before = memory_get_usage();
$time_before = microtime(true);
$arguments = (array)$arguments;
if ( !$arguments ) {
$class = new $real_class();
}
else {
$reflection = new ReflectionClass($real_class);
$class = $reflection->newInstanceArgs($arguments);
}
if ( defined('DEBUG_MODE') && DEBUG_MODE && defined('DBG_PROFILE_MEMORY') && DBG_PROFILE_MEMORY && $this->Application->isDebugMode() ) {
$mem_after = memory_get_usage();
$time_after = microtime(true);
$mem_used = $mem_after - $mem_before;
$time_used = $time_after - $time_before;
$this->Application->Debugger->appendHTML('Factroy created <b>' . $real_class . '</b> - used ' . round($mem_used / 1024, 3) . 'Kb time: ' . round($time_used, 5));
$this->Application->Debugger->profilerAddTotal('objects', null, $mem_used);
}
return $class;
}
/**
* Returns sub-classes of given ancestor class.
*
* @param string $ancestor_class Ancestor class.
* @param boolean $concrete_only Return only non-abstract classes.
*
* @return array
* @throws kFactoryException When ancestor class not found.
*/
public function getSubClasses($ancestor_class, $concrete_only = true)
{
if ( !isset($this->classMap[$ancestor_class]) ) {
throw new kFactoryException(
'Class "<strong>' . $ancestor_class . '</strong>" is not registered in the Factory'
);
}
if ( !isset($this->classTree[$ancestor_class]) ) {
return array();
}
$all_sub_classes = array();
foreach ( $this->classTree[$ancestor_class] as $sub_class ) {
$real_sub_class = $this->realClasses[$sub_class];
$all_sub_classes[$real_sub_class] = $sub_class;
$all_sub_classes = array_merge($all_sub_classes, $this->getSubClasses($sub_class, false));
}
if ( $concrete_only ) {
$concrete_sub_classes = array();
foreach ( $all_sub_classes as $real_sub_class => $sub_class ) {
if ( $this->classInfo[$sub_class]['type'] == self::TYPE_CLASS
&& !$this->classHasModifier($sub_class, self::MODIFIER_ABSTRACT)
) {
$concrete_sub_classes[$real_sub_class] = $sub_class;
}
}
return $concrete_sub_classes;
}
return $all_sub_classes;
}
/**
* Determines of class has modifier.
*
* @param string $class Class.
* @param integer $modifier Modifier.
*
* @return boolean
*/
protected function classHasModifier($class, $modifier)
{
return ($this->classInfo[$class]['modifiers'] & $modifier) == $modifier;
}
/**
* Registers new class in the factory
*
* @param string $real_class Real name of class as in class declaration
* @param string $file Filename in what $real_class is declared
* @param string $pseudo_class Name under this class object will be accessed using getObject method
* @return void
* @access public
*/
public function registerClass($real_class, $file, $pseudo_class = null)
{
if ( !isset($pseudo_class) ) {
$pseudo_class = $real_class;
}
if ( !isset($this->classMap[$real_class]) ) {
$this->classMap[$real_class] = preg_replace('/^' . preg_quote(FULL_PATH, '/') . '/', '', $file, 1);
}
$this->realClasses[$pseudo_class] = $real_class;
}
/**
* Unregisters existing class from factory
*
* @param string $real_class Real name of class as in class declaration
* @param string $pseudo_class Name under this class object is accessed using getObject method
* @return void
* @access public
*/
public function unregisterClass($real_class, $pseudo_class = null)
{
unset($this->classMap[$real_class]);
}
}
class kFactoryException extends Exception {
}
Index: branches/5.3.x/core/kernel/utility/event.php
===================================================================
--- branches/5.3.x/core/kernel/utility/event.php (revision 16180)
+++ branches/5.3.x/core/kernel/utility/event.php (revision 16181)
@@ -1,448 +1,450 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
final class kEvent extends kBase {
/**
* Event finished working succsessfully
*
*/
const erSUCCESS = 0;
/**
* Event finished working, but result is unsuccsessfull
*
*/
const erFAIL = -1;
/**
* Event experienced FATAL error - no hooks should continue!
*
*/
const erFATAL = -2;
/**
* Event failed on internal permission checking (user has no permission)
*
*/
const erPERM_FAIL = -3;
/**
* Event requested to stop processing (don't parse templates)
*
*/
const erSTOP = -4;
/**
* Reference to event, that created given event
*
* @var kEvent
* @access public
*/
public $MasterEvent;
/**
* Event name
*
* @var string
* @access public
*/
public $Name;
/**
* Don't execute hooks, before event processing
*
* @var bool
* @access public
*/
public $SkipBeforeHooks = false;
/**
* Don't execute hooks, after event processing
*
* @var bool
* @access public
*/
public $SkipAfterHooks = false;
/**
* Perform redirect after event processing.
* Redirect after event processing allows to prevent same event being present in resulting url.
* Also could contain template name, that needs to be shown after redirect.
*
* @var mixed
* @access public
*/
public $redirect = true;
/**
* Params, used during redirect url building after event successful processing
*
* @var bool
* @access private
*/
private $redirectParams = Array ();
/**
* PHP file to redirect to. Defaults to "index.php"
*
* @var string
* @access public
*/
public $redirectScript = null;
/**
* Event processing status
*
* @var int
* @access public
*/
public $status = kEvent::erSUCCESS;
/**
* Event parameters
* Usually indicate, how particular event should be processed.
*
* @var Array
* @access private
*/
private $specificParams = Array ();
/**
* Pseudo class used, to create object, based on event contents
*
* @var string
* @access private
*/
private $pseudoClass = '';
/**
* Create event from given prefix, special, name and specific params.
* Parameter $params could be be an an array with following keys: "prefix", "special" (optional), "name".
* Parameter $params could be a string in format: "prefix:name" or "prefix.special:name".
*
- * @param mixed $params
- * @param Array $specific_params event specific params (none by default)
- * @return kEvent
- * @access public
+ * @param mixed $params Params.
+ * @param array $specific_params Event specific params (none by default).
+ *
+ * @throws InvalidArgumentException When incorrect event string given.
*/
public function __construct($params = Array(), $specific_params = null)
{
parent::__construct();
- if ($params) {
+ if ( $params ) {
if ( is_array($params) ) {
$prefix = isset($params['prefix']) ? $params['prefix'] : false;
$special = isset($params['special']) ? $params['special'] : false;
- if ($prefix) {
+ if ( $prefix ) {
$this->Init($prefix, $special);
}
$this->Name = isset($params['name']) ? $params['name'] : '';
}
elseif ( is_string($params) ) {
- if (preg_match('/([^.:]*)[.]{0,1}([^:]*):(.*)/', $params, $regs)) {
+ if ( preg_match('/([^.:]*)[.]{0,1}([^:]*):(.*)/', $params, $regs) ) {
$prefix = $regs[1];
$special = $regs[2];
- if ($prefix) {
+ if ( $prefix ) {
$this->Init($prefix, $special);
}
$this->Name = $regs[3];
}
else {
- throw new Exception('Invalid event string: "<strong>' . $params . '</strong>". Should be in "prefix[.special]:OnEvent" format');
+ $error_msg = 'Invalid event string: "<strong>' . $params . '</strong>". ';
+ $error_msg .= 'Should be in "prefix[.special]:OnEvent" format';
+ throw new InvalidArgumentException($error_msg);
}
}
}
if ( isset($specific_params) ) {
$this->specificParams = $specific_params;
}
}
/**
* Returns joined prefix and special if any
*
* @param bool $from_submit if true, then joins prefix & special by "_", uses "." otherwise
* @return string
* @access public
*/
public function getPrefixSpecial($from_submit = false)
{
if (!$from_submit) {
return parent::getPrefixSpecial();
}
return rtrim($this->Prefix . '_' . $this->Special, '_');
}
/**
* Sets event parameter
*
* @param string $name
* @param mixed $value
* @access public
*/
public function setEventParam($name,$value)
{
$this->specificParams[$name] = $value;
}
/**
* Returns event parameter by name (supports digging)
*
* @param string $name
* @return mixed
* @access public
*/
public function getEventParam($name)
{
$args = func_get_args();
if (count($args) > 1) {
kUtil::array_unshift_ref($args, $this->specificParams);
return call_user_func_array('getArrayValue', $args); // getArrayValue($this->specificParams, $name);
}
return array_key_exists($name, $this->specificParams) ? $this->specificParams[$name] : false;
}
/**
* Returns all event parameters
*
* @return Array
* @access public
*/
public function getEventParams()
{
return $this->specificParams;
}
/**
* Set's pseudo class that differs from
* the one specified in $Prefix
*
* @param string $appendix
* @access public
*/
public function setPseudoClass($appendix)
{
$this->pseudoClass = $this->Prefix . $appendix;
}
/**
* Performs event initialization
* Also sets pseudo class same $prefix
*
* @param string $prefix
* @param string $special
* @access public
*/
public function Init($prefix, $special)
{
$this->pseudoClass = $prefix;
parent::Init($prefix, $special);
}
/**
* Returns object used in event
*
* @param Array $params
* @return kDBBase
* @access public
*/
public function getObject(array $params = Array())
{
if ( !$this->Application->hasObject($this->prefixSpecial) ) {
$top_event = $this;
// when OnSave calls OnPreSave in first line, then this would make sure OnSave is used
while ( is_object($top_event->MasterEvent) ) {
$top_event = $top_event->MasterEvent;
}
$params['parent_event'] = $top_event;
}
return $this->Application->recallObject($this->prefixSpecial, $this->pseudoClass, $params);
}
/**
* Executes given event in context of current event
* Sub-event gets this event in "kEvent::MasterEvent" attribute.
* Sub-event execution results (status and redirect* properties) are copied back to current event.
*
* @param string $name name of callable event (optionally could contain prefix_special as well)
* @see kEvent::MasterEvent
* @todo Will overwrite master event data with called event data, which makes 'parent_event' useless in most cases
*/
public function CallSubEvent($name)
{
if ( strpos($name, ':') === false ) {
// PrefixSpecial not specified -> use from current event
$name = $this->getPrefixSpecial() . ':' . $name;
}
$child_event = new kEvent($name);
$child_event->copyFrom($this, true);
$this->Application->HandleEvent($child_event);
$this->copyFrom($child_event);
$this->specificParams = $child_event->specificParams;
}
/**
* Allows to copy data between events
*
* @param kEvent $source_event
* @param bool $inherit
* @access public
*/
public function copyFrom($source_event, $inherit = false)
{
if ( $inherit ) {
$this->MasterEvent = $source_event;
}
else {
$this->status = $source_event->status;
}
$this->redirect = $source_event->redirect;
$this->redirectParams = $source_event->redirectParams;
$this->redirectScript = $source_event->redirectScript;
$this->specificParams = $source_event->specificParams;
}
/**
* Returns all redirect parameters
*
* @return Array
* @access public
*/
public function getRedirectParams()
{
return $this->redirectParams;
}
/**
* Returns redirect parameter
*
* @param string $name
* @return mixed
* @access public
*/
public function getRedirectParam($name)
{
return array_key_exists($name, $this->redirectParams) ? $this->redirectParams[$name] : false;
}
/**
* Set's redirect param for event
*
* @param string $name
* @param string $value
* @access public
*/
public function SetRedirectParam($name, $value)
{
$this->redirectParams[$name] = $value;
}
/**
* Allows to merge passed redirect params hash with existing ones
*
* @param Array $params
* @param bool $append
* @access public
*/
public function setRedirectParams($params, $append = true)
{
if ( $append ) {
// append new parameters to parameters set before
$params = kUtil::array_merge_recursive($this->redirectParams, $params);
}
$this->redirectParams = $params;
}
/**
* Allows to tell if this event was called some how (e.g. subevent, hook) from event requested
*
* @param string $event_key event key in format [prefix[.special]:]event_name
* @return bool
* @access public
*/
public function hasAncestor($event_key)
{
if ( strpos($event_key, ':') === false ) {
$event_key = $this->getPrefixSpecial() . ':' . $event_key;
}
return $this->Application->EventManager->eventRunning($event_key);
}
/**
* Returns permission section associated with event
*
* @return string
* @access public
*/
public function getSection()
{
$perm_section = $this->getEventParam('PermSection');
if ( $perm_section ) {
return $perm_section;
}
// 1. get section by current top_prefix
$top_prefix = $this->getEventParam('top_prefix');
if ( $top_prefix == false ) {
$top_prefix = $this->Application->GetTopmostPrefix($this->Prefix, true);
$this->setEventParam('top_prefix', $top_prefix);
}
$section = $this->Application->getUnitConfig($top_prefix)->getPermSectionByName('main');
// 2. check if this section has perm_prefix mapping to other prefix
$sections_helper = $this->Application->recallObject('SectionsHelper');
/* @var $sections_helper kSectionsHelper */
$section_data =& $sections_helper->getSectionData($section);
if ( $section_data && isset($section_data['perm_prefix']) && $section_data['perm_prefix'] != $top_prefix ) {
$this->setEventParam('top_prefix', $section_data['perm_prefix']);
$section = $this->Application->getUnitConfig($section_data['perm_prefix'])->getPermSectionByName('main');
}
if ( !$section ) {
throw new Exception('Permission <strong>section</strong> not specified for prefix <strong>' . $top_prefix . '</strong>');
}
return $section;
}
public function __toString()
{
return $this->getPrefixSpecial() . ':' . $this->Name;
}
- }
\ No newline at end of file
+ }
Index: branches/5.3.x/core/kernel/utility/unit_config_reader.php
===================================================================
--- branches/5.3.x/core/kernel/utility/unit_config_reader.php (revision 16180)
+++ branches/5.3.x/core/kernel/utility/unit_config_reader.php (revision 16181)
@@ -1,735 +1,743 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class kUnitConfigReader extends kBase implements kiCacheable {
/**
* Unit config data storage.
*
* @var kUnitConfig[]
*/
protected $configData = array();
/**
* List of discovered unit config files.
*
* @var array
*/
protected $configFiles = array();
/**
* Mapping between unit config prefixes and files, where they data is stored.
*
* @var array
*/
protected $prefixFiles = array();
/**
* Tells, that it's final stage of application initialization, where OnAfterConfigRead events can be called.
*
* @var boolean
*/
protected $finalStage = false;
/**
* Determines if cache should be stored.
*
* @var boolean
*/
protected $storeCache = false;
/**
* List of unit configs, that have called their OnAfterConfigRead event.
*
* @var array
*/
protected $afterConfigProcessed = array();
/**
* Escaped directory separator for using in regular expressions
*
* @var string
*/
protected $directorySeparator = '';
/**
* Regular expression for detecting module folder
*
* @var string
*/
protected $moduleFolderRegExp = '';
/**
* Folders to skip during unit config search
*
* @var array
*/
protected $skipFolders = array('CVS', '.svn', 'admin_templates', 'libchart');
/**
* Cloner.
*
* @var kUnitConfigCloner
*/
protected $cloner;
/**
* Creates instance of unit config reader.
*/
public function __construct()
{
parent::__construct();
$this->directorySeparator = preg_quote(DIRECTORY_SEPARATOR);
$editor_path = explode('/', trim(EDITOR_PATH, '/'));
$this->skipFolders[] = array_pop($editor_path); // last of cmseditor folders
$this->moduleFolderRegExp = '#' . $this->directorySeparator . '(core|modules' . $this->directorySeparator . '.*?)' . $this->directorySeparator . '#';
$this->cloner = $this->Application->makeClass('kUnitConfigCloner', array($this));
}
/**
* Sets data from cache to object
*
* @param Array $data
*/
public function setFromCache(&$data)
{
$this->cloner->setFromCache($data);
$this->prefixFiles = $data['ConfigReader.prefixFiles'];
}
/**
* Gets object data for caching
*
* @return Array
*/
public function getToCache()
{
return array_merge(
$this->cloner->getToCache(),
array(
'ConfigReader.prefixFiles' => $this->prefixFiles,
)
);
}
public function scanModules($folder_path, $cache = true)
{
if ( defined('IS_INSTALL') && IS_INSTALL && !defined('FORCE_CONFIG_CACHE') ) {
// disable config caching during installation
$cache = false;
}
if ( $cache ) {
$restored = $this->Application->cacheManager->LoadUnitCache();
if ( $restored ) {
if ( defined('DEBUG_MODE') && DEBUG_MODE && $this->Application->isDebugMode() ) {
$this->Application->Debugger->appendHTML('UnitConfigReader: Restoring Cache');
}
return;
}
}
if ( defined('DEBUG_MODE') && DEBUG_MODE && $this->Application->isDebugMode() ) {
$this->Application->Debugger->appendHTML('UnitConfigReader: Generating Cache');
}
// === lines below would only executed on cold start (no unit config cache) ===
// no cache found -> include all unit configs to create it !
$this->includeConfigFiles($folder_path, $cache);
$this->parseConfigs();
$this->sortRouters();
// tell AfterConfigRead to store cache if needed
// can't store it here because AfterConfigRead needs ability to change config data
$this->storeCache = $cache;
if ( !$this->Application->InitDone ) {
// scanModules is called multiple times during installation process
$this->Application->InitManagers();
}
$this->Application->cacheManager->applyDelayedUnitProcessing();
}
/**
* Locates (recursively) and reads all unit configs at given path.
*
* @param string $folder_path Folder path.
* @param boolean $cache Store information to cache.
*
* @throws Exception When unit config file is missing a prefix defined inside it.
*/
protected function includeConfigFiles($folder_path, $cache = true)
{
$this->Application->refreshModuleInfo();
if ( $this->Application->isCachingType(CACHING_TYPE_MEMORY) ) {
$data = $this->Application->getCache('master:config_files', false, $cache ? CacheSettings::$unitCacheRebuildTime : 0);
}
else {
$data = $this->Application->getDBCache('config_files', $cache ? CacheSettings::$unitCacheRebuildTime : 0);
}
if ( $data ) {
$this->configFiles = unserialize($data);
if ( !(defined('DBG_VALIDATE_CONFIGS') && DBG_VALIDATE_CONFIGS) ) {
shuffle($this->configFiles);
}
}
else {
$this->findConfigFiles(FULL_PATH . DIRECTORY_SEPARATOR . 'core'); // search from "core" directory
$this->findConfigFiles($folder_path); // search from "modules" directory
if ( $cache ) {
if ( $this->Application->isCachingType(CACHING_TYPE_MEMORY) ) {
$this->Application->setCache('master:config_files', serialize($this->configFiles));
}
else {
$this->Application->setDBCache('config_files', serialize($this->configFiles));
}
}
}
foreach ( $this->configFiles as $filename ) {
$prefix = $this->PreloadConfigFile($filename);
if ( !$prefix ) {
throw new Exception('Prefix not defined in config file <strong>' . $filename . '</strong>');
}
}
// TODO: needed?
if ( $cache ) {
unset($this->configFiles);
}
}
/**
* Recursively searches for unit configs in given folder.
*
* @param string $folder_path Path to the folder.
* @param int $level Deep level of the folder.
*
* @return void
*/
protected function findConfigFiles($folder_path, $level = 0)
{
// if FULL_PATH = "/" ensure, that all "/" in $folderPath are not deleted
$reg_exp = '/^' . preg_quote(FULL_PATH, '/') . '/';
$folder_path = preg_replace($reg_exp, '', $folder_path, 1); // this make sense, since $folderPath may NOT contain FULL_PATH
$base_folder = FULL_PATH . $folder_path . DIRECTORY_SEPARATOR;
$sub_folders = glob($base_folder . '*', GLOB_ONLYDIR);
if ( !$sub_folders ) {
return;
}
if ( $level == 0 ) {
// don't scan Front-End themes because of extensive directory structure
$sub_folders = array_diff($sub_folders, array($base_folder . 'themes', $base_folder . 'tools'));
}
foreach ( $sub_folders as $full_path ) {
$sub_folder = substr($full_path, strlen($base_folder));
if ( in_array($sub_folder, $this->skipFolders) || preg_match('/^\./', $sub_folder) ) {
// don't scan skipped or hidden folders
continue;
}
$config_name = $this->getConfigName($folder_path . DIRECTORY_SEPARATOR . $sub_folder);
if ( file_exists(FULL_PATH . $config_name) ) {
$this->configFiles[] = $config_name;
}
$this->findConfigFiles($full_path, $level + 1);
}
}
/**
* Process all read config files - called ONLY when there is no cache!
*
* @return void
*/
protected function parseConfigs()
{
$this->parseUnitConfigs($this->getUnitConfigsWithoutPriority());
$this->parseUnitConfigs($this->getUnitConfigsWithPriority());
}
/**
* Parses unit config sub-set.
*
* @param array $prefixes Unit config prefixes.
*
* @return array
*/
protected function parseUnitConfigs(array $prefixes)
{
foreach ( $prefixes as $prefix ) {
$this->configData[$prefix]->parse();
}
$this->cloner->extrudeAndParse($prefixes);
}
/**
* Returns unit configs prefixes without priority defined.
*
* @return array
*/
public function getUnitConfigsWithoutPriority()
{
$ret = array();
foreach ( $this->configData as $prefix => $config ) {
if ( $config->getConfigPriority() === false ) {
$ret[] = $prefix;
}
}
return $ret;
}
/**
* Returns unit configs prefixes with priority defined.
*
* @return array
*/
public function getUnitConfigsWithPriority()
{
$ret = array();
foreach ( $this->configData as $prefix => $config ) {
$priority = $config->getConfigPriority();
if ( $priority !== false ) {
$ret[$prefix] = $priority;
}
}
asort($ret);
return array_keys($ret);
}
public function AfterConfigRead($store_cache = null)
{
$this->finalStage = true;
foreach ($this->configData as $prefix => $config) {
$this->runAfterConfigRead($prefix);
}
if ( !isset($store_cache) ) {
// $store_cache not overridden -> use global setting
$store_cache = $this->storeCache;
}
if ( $store_cache || (defined('IS_INSTALL') && IS_INSTALL) ) {
// cache is not stored during install, but dynamic clones should be processed in any case
$this->cloner->processDynamicallyAdded();
$this->retrieveCollections();
}
if ( $store_cache ) {
$this->Application->HandleEvent(new kEvent('adm:OnAfterCacheRebuild'));
$this->Application->cacheManager->UpdateUnitCache();
if ( defined('DEBUG_MODE') && DEBUG_MODE && defined('DBG_VALIDATE_CONFIGS') && DBG_VALIDATE_CONFIGS ) {
// validate configs here to have changes from OnAfterConfigRead hooks to prefixes
foreach ( $this->configData as $config ) {
if ( !$config->getTableName() ) {
continue;
}
$config->validate();
}
}
}
}
/**
* Sort routers according to their weight (non-prioritized routers goes first).
*
* @return void
*/
protected function sortRouters()
{
$sorted_routers = array();
$prioritized_routers = array();
$routers = $this->collectRouters();
// Process non-prioritized routers.
foreach ( $routers as $prefix => $router_data ) {
if ( $router_data['priority'] === false ) {
$sorted_routers[$prefix] = $router_data;
}
else {
$prioritized_routers[$prefix] = $router_data['priority'];
}
}
// Process prioritized routers.
asort($prioritized_routers, SORT_NUMERIC);
foreach ( $prioritized_routers as $prefix => $priority ) {
$sorted_routers[$prefix] = $routers[$prefix];
}
$this->Application->routers = $sorted_routers;
}
/**
* Collects routers.
*
* @return array
*/
protected function collectRouters()
{
$routers = array();
$router_classes = $this->Application->getSubClasses('AbstractRouter');
foreach ( $router_classes as $router_class ) {
if ( !class_exists($router_class) ) {
// This can happen, when:
// - router class (coming from cache) was renamed;
// - new cache is built based on outdated class map.
continue;
}
/** @var AbstractRouter $router */
$router = new $router_class();
$routers[$router->getPrefix()] = array(
'class' => $router_class,
'priority' => $router->getWeight(),
);
}
return $routers;
}
/**
* Re-reads all configs.
*
* @return void
*/
public function ReReadConfigs()
{
if ( $this->storeCache && $this->finalStage ) {
// Building cache right now, so all unit configs are read anyway.
return;
}
// don't reset prefix file, since file scanning could slow down the process
$prefix_files_backup = $this->prefixFiles;
$this->Application->cacheManager->EmptyUnitCache();
$this->prefixFiles = $prefix_files_backup;
// parse all configs
$this->afterConfigProcessed = array();
$this->includeConfigFiles(MODULES_PATH, false);
$this->parseConfigs();
$this->sortRouters();
$this->AfterConfigRead(false);
$this->cloner->processDynamicallyAdded();
$this->retrieveCollections();
}
/**
* Process all collectible unit config options here to also catch ones, defined from OnAfterConfigRead events
*
*/
protected function retrieveCollections()
{
foreach ( $this->configData as $prefix => $config ) {
// collect replacement templates
if ( $config->getReplacementTemplates() ) {
$this->Application->ReplacementTemplates = array_merge($this->Application->ReplacementTemplates, $config->getReplacementTemplates());
}
}
}
public function loadConfig($prefix)
{
$preloaded_prefix = $this->PreloadConfigFile($this->getPrefixFile($prefix));
if ( $this->finalStage ) {
// run prefix OnAfterConfigRead so all hooks to it can define their clones
$this->runAfterConfigRead($preloaded_prefix);
}
// Only use cached clones for calls in the middle of initialization (e.g. url parsing).
$clones = $this->cloner->extrude($preloaded_prefix, !$this->finalStage);
if ( $this->finalStage ) {
foreach ( $clones as $a_prefix ) {
$this->runAfterConfigRead($a_prefix);
}
}
}
/**
* Runs OnAfterConfigRead event for given prefix once.
*
* @param string $prefix Unit config prefix.
*
* @return void
*/
public function runAfterConfigRead($prefix)
{
if ( in_array($prefix, $this->afterConfigProcessed) ) {
return;
}
$this->Application->HandleEvent(new kEvent($prefix . ':OnAfterConfigRead'));
if ( !(defined('IS_INSTALL') && IS_INSTALL) ) {
// allow to call OnAfterConfigRead multiple times during install
array_push($this->afterConfigProcessed, $prefix);
}
}
/**
* Loads unit config file contents from disk.
*
* @param string $filename Unit config filename.
*
* @return string
*/
protected function PreloadConfigFile($filename)
{
$config_found = file_exists(FULL_PATH . $filename) && $this->configAllowed($filename);
if ( defined('DEBUG_MODE') && DEBUG_MODE && defined('DBG_PROFILE_INCLUDES') && DBG_PROFILE_INCLUDES ) {
if ( in_array($filename, get_included_files()) ) {
return '';
}
global $debugger;
if ( $config_found ) {
$file = FULL_PATH . $filename;
$file_crc = crc32($file);
$debugger->ProfileStart('inc_' . $file_crc, $file);
include_once($file);
$debugger->ProfileFinish('inc_' . $file_crc);
$debugger->profilerAddTotal('includes', 'inc_' . $file_crc);
}
}
elseif ( $config_found ) {
include_once(FULL_PATH . $filename);
}
if ( $config_found ) {
/* @var $config kUnitConfig|Array */
if ( isset($config) && $config ) {
// config file is included for 1st time -> save it's content for future processing
if ( !is_object($config) ) {
$prefix = array_key_exists('Prefix', $config) ? $config['Prefix'] : '';
$config = new kUnitConfig($prefix, $config);
}
else {
$prefix = $config->getPrefix();
}
preg_match($this->moduleFolderRegExp, $filename, $regs);
$config->setModuleFolder(str_replace(DIRECTORY_SEPARATOR, '/', $regs[1]));
$config->setBasePath(dirname(FULL_PATH . $filename));
if ( $config->getAdminTemplatePath() !== false ) {
// append template base folder for admin templates path of this prefix
$module_templates = $regs[1] == 'core' ? '' : substr($regs[1], 8) . '/';
$config->setAdminTemplatePath($module_templates . $config->getAdminTemplatePath());
}
if ( array_key_exists($prefix, $this->prefixFiles) && ($this->prefixFiles[$prefix] != $filename) ) {
trigger_error(
'Single unit config prefix "<strong>' . $prefix . '</strong>" ' .
'is used in multiple unit config files: ' .
'"<strong>' . $this->prefixFiles[$prefix] . '</strong>", "<strong>' . $filename . '</strong>"',
E_USER_WARNING
);
}
$this->add($config, $filename);
return $prefix;
}
else {
$prefix = array_search($filename, $this->prefixFiles);
if ( $prefix ) {
// attempt is made to include config file twice or more, but include_once prevents that,
// but file exists on hdd, then it is already saved to all required arrays, just return it's prefix
return $prefix;
}
}
}
return 'dummy';
}
/**
* Sets a file, for a given prefix.
*
* @param kUnitConfig $config Unit config.
* @param string $filename File.
*
* @return void
*/
public function add(kUnitConfig $config, $filename)
{
$config->setFilename($filename);
$prefix = $config->getPrefix();
$this->configData[$prefix] = $config;
$this->prefixFiles[$prefix] = $filename;
}
/**
* Removes unit config.
*
* @param string $prefix Unit config prefix.
*
* @return void
*/
public function remove($prefix)
{
unset($this->configData[$prefix], $this->prefixFiles[$prefix]);
}
/**
* Returns unit config for given prefix
*
* @param string $prefix
* @return kUnitConfig
*/
public function getUnitConfig($prefix = null)
{
if ( !isset($this->configData[$prefix]) ) {
$this->loadConfig($prefix);
}
return $this->configData[$prefix];
}
/**
- * Returns prefixes of unit configs, that were registered
+ * Returns prefixes of unit configs, that were registered.
*
- * @return Array
+ * @param boolean $loaded_only Only return prefixes, that were loaded till now.
+ *
+ * @return array
*/
- public function getPrefixes()
+ public function getPrefixes($loaded_only = true)
{
- return array_keys($this->configData);
+ if ( $loaded_only ) {
+ return array_keys($this->configData);
+ }
+
+ return array_keys($this->prefixFiles);
}
/**
* Get's config file name based
* on folder name supplied
*
* @param string $folder_path
* @return string
*/
protected function getConfigName($folder_path)
{
return $folder_path . DIRECTORY_SEPARATOR . basename($folder_path) . '_config.php';
}
/**
* Checks if config file is allowed for inclusion (if module of config is installed).
*
* @param string $config_path Relative path from In-Portal directory.
*
* @return boolean
*/
protected function configAllowed($config_path)
{
static $module_paths = null;
if ( defined('IS_INSTALL') && IS_INSTALL ) {
// at installation start no modules in db and kernel configs could not be read
return true;
}
if ( preg_match('#^' . $this->directorySeparator . 'core#', $config_path) ) {
// always allow to include configs from "core" module's folder
return true;
}
if ( !$this->Application->ModuleInfo ) {
return false;
}
if ( !isset($module_paths) ) {
$module_paths = array();
foreach ( $this->Application->ModuleInfo as $module_info ) {
$module_paths[] = str_replace('/', DIRECTORY_SEPARATOR, rtrim($module_info['Path'], '/'));
}
$module_paths = array_unique($module_paths);
}
preg_match($this->moduleFolderRegExp, $config_path, $regs);
// config file path starts with module folder path
return in_array($regs[1], $module_paths);
}
/**
* Returns true if config exists and is allowed for reading
*
* @param string $prefix Unit config prefix.
*
* @return boolean
*/
public function prefixRegistered($prefix)
{
return isset($this->prefixFiles[$prefix]);
}
/**
* Returns unit config file location by it's prefix.
*
* @param string $prefix Unit config prefix.
*
* @return string
- * @throws Exception When unit config is not found.
+ * @throws InvalidArgumentException When unit config is not found.
*/
public function getPrefixFile($prefix)
{
if ( !isset($this->prefixFiles[$prefix]) ) {
- throw new Exception('Configuration file for prefix "<strong>' . $prefix . '</strong>" is unknown');
+ throw new InvalidArgumentException(
+ 'Configuration file for prefix "<strong>' . $prefix . '</strong>" is unknown'
+ );
}
return $this->prefixFiles[$prefix];
}
}
Index: branches/5.3.x/core/install/cache/class_structure.php
===================================================================
--- branches/5.3.x/core/install/cache/class_structure.php (revision 16180)
+++ branches/5.3.x/core/install/cache/class_structure.php (revision 16181)
@@ -1,2561 +1,2630 @@
<?php
// @codingStandardsIgnoreFile
/**
- * This file is automatically @generated. Use 'php tools/build_class_map.php' to rebuild it.
+ * This file is automatically @generated. Please use 'in-portal classmap:rebuild' command to rebuild it.
*/
return array(
'cache_format' => 2,
'classes' => array(
'AbstractCategoryItemRouter' => '/core/kernel/utility/Router/AbstractCategoryItemRouter.php',
'AbstractReviewRouter' => '/core/kernel/utility/Router/AbstractReviewRouter.php',
'AbstractRouter' => '/core/kernel/utility/Router/AbstractRouter.php',
'AdminEventsHandler' => '/core/units/admin/admin_events_handler.php',
'AdminTagProcessor' => '/core/units/admin/admin_tag_processor.php',
'AjaxFormHelper' => '/core/units/helpers/ajax_form_helper.php',
'ApcCacheHandler' => '/core/kernel/utility/cache.php',
'BackupHelper' => '/core/units/helpers/backup_helper.php',
'BaseSession' => '/core/kernel/session/session.php',
'BaseSessionStorage' => '/core/kernel/session/session_storage.php',
'CacheSettings' => '/core/kernel/startup.php',
'CaptchaEventHandler' => '/core/units/captcha/captcha_eh.php',
'CategoriesEventHandler' => '/core/units/categories/categories_event_handler.php',
'CategoriesItem' => '/core/units/categories/categories_item.php',
'CategoriesTagProcessor' => '/core/units/categories/categories_tag_processor.php',
'CategoryHelper' => '/core/units/helpers/category_helper.php',
'CategoryItemsEventHandler' => '/core/units/category_items/category_items_event_handler.php',
'CategoryItemsTagProcessor' => '/core/units/category_items/category_items_tag_processor.php',
'CategoryPermissionRebuild' => '/core/kernel/constants.php',
'ChangeLog' => '/core/kernel/constants.php',
'ChangeLogEventHandler' => '/core/units/logs/change_logs/change_log_eh.php',
'ChangeLogTagProcessor' => '/core/units/logs/change_logs/change_log_tp.php',
'ColumnSet' => '/core/units/helpers/col_picker_helper.php',
'ConfigSearchEventHandler' => '/core/units/config_search/config_search_event_handler.php',
'ConfigSearchTagProcessor' => '/core/units/config_search/config_search_tag_processor.php',
'ConfigurationEventHandler' => '/core/units/configuration/configuration_event_handler.php',
'ConfigurationItem' => '/core/units/configuration/configuration.php',
'ConfigurationTagProcessor' => '/core/units/configuration/configuration_tag_processor.php',
'ConfigurationValidator' => '/core/units/configuration/configuration_validator.php',
'ContentEventHandler' => '/core/units/content/content_eh.php',
'ContentTagProcessor' => '/core/units/content/content_tp.php',
'CoreUpgrades' => '/core/install/upgrades.php',
'CountryStateEventHandler' => '/core/units/country_states/country_state_eh.php',
'CssMinifyHelper' => '/core/units/helpers/minifiers/css_minify_helper.php',
'CustomDataEventHandler' => '/core/units/custom_data/custom_data_event_handler.php',
'CustomFieldsEventHandler' => '/core/units/custom_fields/custom_fields_event_handler.php',
'CustomFieldsTagProcessor' => '/core/units/custom_fields/custom_fields_tag_processor.php',
'Debugger' => '/core/kernel/utility/debugger.php',
'DebuggerUtil' => '/core/kernel/utility/debugger.php',
'DeploymentHelper' => '/core/units/helpers/deployment_helper.php',
'DraftEventHandler' => '/core/units/forms/drafts/draft_eh.php',
'EditPickerHelper' => '/core/units/helpers/controls/edit_picker_helper.php',
'EmailDelivery' => '/core/kernel/constants.php',
'EmailLogEventHandler' => '/core/units/logs/email_logs/email_log_eh.php',
'EmailLogStatus' => '/core/kernel/constants.php',
'EmailLogTagProcessor' => '/core/units/logs/email_logs/email_log_tp.php',
'EmailQueueEventHandler' => '/core/units/email_queue/email_queue_eh.php',
'EmailQueueTagProcessor' => '/core/units/email_queue/email_queue_tp.php',
'EmailTemplate' => '/core/kernel/constants.php',
'EmailTemplateEventHandler' => '/core/units/email_templates/email_template_eh.php',
'EmailTemplateTagProcessor' => '/core/units/email_templates/email_template_tp.php',
'FakeCacheHandler' => '/core/kernel/utility/cache.php',
'FavoritesEventHandler' => '/core/units/favorites/favorites_eh.php',
'FckEventHandler' => '/core/units/fck/fck_eh.php',
'FckTagProcessor' => '/core/units/fck/fck_tp.php',
'FileEventHandler' => '/core/units/files/file_eh.php',
'FileHelper' => '/core/units/helpers/file_helper.php',
'FileTagProcessor' => '/core/units/files/file_tp.php',
'FormFieldEventHandler' => '/core/units/forms/form_fields/form_field_eh.php',
'FormFieldsTagProcessor' => '/core/units/forms/form_fields/form_fields_tp.php',
'FormSubmissionHelper' => '/core/units/helpers/form_submission_helper.php',
'FormSubmissionTagProcessor' => '/core/units/forms/form_submissions/form_submission_tp.php',
'FormSubmissionsEventHandler' => '/core/units/forms/form_submissions/form_submissions_eh.php',
'FormsEventHandler' => '/core/units/forms/forms/forms_eh.php',
'FormsTagProcessor' => '/core/units/forms/forms/forms_tp.php',
'GeoCodeHelper' => '/core/units/helpers/geocode_helper.php',
'GroupTagProcessor' => '/core/units/groups/group_tp.php',
'GroupsEventHandler' => '/core/units/groups/groups_event_handler.php',
'IDBConnection' => '/core/kernel/db/i_db_connection.php',
'ImageEventHandler' => '/core/units/images/image_event_handler.php',
'ImageHelper' => '/core/units/helpers/image_helper.php',
'ImageTagProcessor' => '/core/units/images/image_tag_processor.php',
'ImagesItem' => '/core/units/images/images.php',
'InPortalPrerequisites' => '/core/install/prerequisites.php',
'InpCustomFieldsHelper' => '/core/units/helpers/custom_fields_helper.php',
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\AbstractCommand' => '/core/kernel/Console/Command/AbstractCommand.php',
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\BuildClassMapCommand' => '/core/kernel/Console/Command/BuildClassMapCommand.php',
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\CompletionCommand' => '/core/kernel/Console/Command/CompletionCommand.php',
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\IConsoleCommand' => '/core/kernel/Console/Command/IConsoleCommand.php',
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\ResetCacheCommand' => '/core/kernel/Console/Command/ResetCacheCommand.php',
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\RunEventCommand' => '/core/kernel/Console/Command/RunEventCommand.php',
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\ConsoleApplication' => '/core/kernel/Console/ConsoleApplication.php',
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\ConsoleCommandProvider' => '/core/kernel/Console/ConsoleCommandProvider.php',
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\IConsoleCommandProvider' => '/core/kernel/Console/IConsoleCommandProvider.php',
'Intechnic\\InPortal\\Core\\kernel\\utility\\ClassDiscovery\\ClassDetector' => '/core/kernel/utility/ClassDiscovery/ClassDetector.php',
'Intechnic\\InPortal\\Core\\kernel\\utility\\ClassDiscovery\\ClassMapBuilder' => '/core/kernel/utility/ClassDiscovery/ClassMapBuilder.php',
'Intechnic\\InPortal\\Core\\kernel\\utility\\ClassDiscovery\\CodeFolderFilterIterator' => '/core/kernel/utility/ClassDiscovery/CodeFolderFilterIterator.php',
'ItemFilterEventHandler' => '/core/units/filters/item_filter_eh.php',
'ItemFilterTagProcessor' => '/core/units/filters/item_filter_tp.php',
'JSONHelper' => '/core/units/helpers/json_helper.php',
'JsMinifyHelper' => '/core/units/helpers/minifiers/js_minify_helper.php',
'Language' => '/core/kernel/constants.php',
'LanguageImportHelper' => '/core/units/helpers/language_import_helper.php',
'LanguagesEventHandler' => '/core/units/languages/languages_event_handler.php',
'LanguagesItem' => '/core/units/languages/languages_item.php',
'LanguagesTagProcessor' => '/core/units/languages/languages_tag_processor.php',
'LeftJoinOptimizer' => '/core/kernel/db/dblist.php',
'ListHelper' => '/core/units/helpers/list_helper.php',
'LoginResult' => '/core/kernel/constants.php',
'MInputHelper' => '/core/units/helpers/controls/minput_helper.php',
'MailboxHelper' => '/core/units/helpers/mailbox_helper.php',
'MailingList' => '/core/kernel/constants.php',
'MailingListEventHandler' => '/core/units/mailing_lists/mailing_list_eh.php',
'MailingListHelper' => '/core/units/helpers/mailing_list_helper.php',
'MailingListTagProcessor' => '/core/units/mailing_lists/mailing_list_tp.php',
'MainRouter' => '/core/units/general/MainRouter.php',
'MaintenanceMode' => '/core/kernel/startup.php',
'MassImageResizer' => '/core/units/admin/admin_events_handler.php',
'MemcacheCacheHandler' => '/core/kernel/utility/cache.php',
'MenuHelper' => '/core/units/helpers/menu_helper.php',
'MimeDecodeHelper' => '/core/units/helpers/mime_decode_helper.php',
'MinifyHelper' => '/core/units/helpers/minifiers/minify_helper.php',
'ModuleDeploymentLog' => '/core/kernel/constants.php',
'ModuleDeploymentLogEventHandler' => '/core/units/logs/module_deployment_logs/module_deployment_log_eh.php',
'ModulesEventHandler' => '/core/units/modules/modules_event_handler.php',
'ModulesTagProcessor' => '/core/units/modules/modules_tag_processor.php',
'NParser' => '/core/kernel/nparser/nparser.php',
'NParserCompiler' => '/core/kernel/nparser/compiler.php',
'POP3Helper' => '/core/units/helpers/pop3_helper.php',
'PageHelper' => '/core/units/helpers/page_helper.php',
'PageRevisionEventHandler' => '/core/units/page_revisions/page_revision_eh.php',
'PageRevisionTagProcessor' => '/core/units/page_revisions/page_revision_tp.php',
'Params' => '/core/kernel/utility/params.php',
'ParserException' => '/core/kernel/nparser/nparser.php',
'PasswordHash' => '/core/kernel/utility/php_pass.php',
'PasswordHashingMethod' => '/core/kernel/constants.php',
'PermissionTypeEventHandler' => '/core/units/permission_types/permission_type_eh.php',
'PermissionsEventHandler' => '/core/units/permissions/permissions_event_handler.php',
'PermissionsTagProcessor' => '/core/units/permissions/permissions_tag_processor.php',
'PhraseTagProcessor' => '/core/units/phrases/phrase_tp.php',
'PhrasesEventHandler' => '/core/units/phrases/phrases_event_handler.php',
'PriorityEventHandler' => '/core/units/priorites/priority_eh.php',
'PromoBlockEventHandler' => '/core/units/promo_blocks/promo_block_eh.php',
'PromoBlockGroupEventHandler' => '/core/units/promo_block_groups/promo_block_group_eh.php',
'PromoBlockGroupTagProcessor' => '/core/units/promo_block_groups/promo_block_group_tp.php',
'PromoBlockTagProcessor' => '/core/units/promo_blocks/promo_block_tp.php',
'PromoBlockType' => '/core/kernel/constants.php',
'RatingHelper' => '/core/units/helpers/rating_helper.php',
'RelatedSearchEventHandler' => '/core/units/related_searches/related_searches_event_handler.php',
'RelatedSearchTagProcessor' => '/core/units/related_searches/related_searches_tag_processor.php',
'RelationshipEventHandler' => '/core/units/relationship/relationship_event_handler.php',
'RelationshipTagProcessor' => '/core/units/relationship/relationship_tp.php',
'ReviewsEventHandler' => '/core/units/reviews/reviews_event_handler.php',
'ReviewsTagProcessor' => '/core/units/reviews/reviews_tag_processor.php',
'ScheduledTask' => '/core/kernel/constants.php',
'ScheduledTaskEventHandler' => '/core/units/scheduled_tasks/scheduled_task_eh.php',
'SelectorsEventHandler' => '/core/units/selectors/selectors_event_handler.php',
'SelectorsItem' => '/core/units/selectors/selectors_item.php',
'SelectorsTagProcessor' => '/core/units/selectors/selectors_tag_processor.php',
'Session' => '/core/kernel/session/inp_session.php',
'SessionLogEventHandler' => '/core/units/logs/session_logs/session_log_eh.php',
'SessionStorage' => '/core/kernel/session/inp_session_storage.php',
'SiteConfigEventHandler' => '/core/units/sections/site_config_eh.php',
'SiteConfigHelper' => '/core/units/helpers/site_config_helper.php',
'SiteConfigTagProcessor' => '/core/units/sections/site_config_tp.php',
'SiteDomainEventHandler' => '/core/units/site_domains/site_domain_eh.php',
'SiteHelper' => '/core/units/helpers/site_helper.php',
'SkinEventHandler' => '/core/units/skins/skin_eh.php',
'SkinHelper' => '/core/units/helpers/skin_helper.php',
'SpamHelper' => '/core/units/helpers/spam_helper.php',
'SpamReportEventHandler' => '/core/units/spam_reports/spam_report_eh.php',
'SpamReportTagProcessor' => '/core/units/spam_reports/spam_report_tp.php',
'StatisticsEventHandler' => '/core/units/statistics/statistics_event_handler.php',
'StatisticsTagProcessor' => '/core/units/statistics/statistics_tag_processor.php',
'StorageEngine' => '/core/kernel/constants.php',
'StylesheetsEventHandler' => '/core/units/stylesheets/stylesheets_event_handler.php',
'StylesheetsItem' => '/core/units/stylesheets/stylesheets_item.php',
'SubmissionFormField' => '/core/kernel/constants.php',
'SubmissionLogEventHandler' => '/core/units/forms/submission_log/submission_log_eh.php',
'SubmissionLogTagProcessor' => '/core/units/forms/submission_log/submission_log_tp.php',
'SystemEventSubscriptionEventHandler' => '/core/units/system_event_subscriptions/system_event_subscription_eh.php',
'SystemEventSubscriptionTagProcessor' => '/core/units/system_event_subscriptions/system_event_subscription_tp.php',
'SystemLogEventHandler' => '/core/units/logs/system_logs/system_log_eh.php',
'SystemLogTagProcessor' => '/core/units/logs/system_logs/system_log_tp.php',
'TemplateHelper' => '/core/units/helpers/template_helper.php',
'TemplatesCache' => '/core/kernel/nparser/template_cache.php',
'ThemeFileEventHandler' => '/core/units/theme_files/theme_file_eh.php',
'ThemeItem' => '/core/units/themes/theme_item.php',
'ThemesEventHandler' => '/core/units/themes/themes_eh.php',
'ThemesTagProcessor' => '/core/units/themes/themes_tag_processor.php',
'ThesaurusEventHandler' => '/core/units/thesaurus/thesaurus_eh.php',
'ThesaurusTagProcessor' => '/core/units/thesaurus/thesaurus_tp.php',
'TranslationSaveMode' => '/core/kernel/constants.php',
'TranslatorEventHandler' => '/core/units/translator/translator_event_handler.php',
'TranslatorTagProcessor' => '/core/units/translator/translator_tp.php',
'UnitConfigDecorator' => '/core/units/admin/admin_events_handler.php',
'UserGroupsEventHandler' => '/core/units/user_groups/user_groups_eh.php',
'UserHelper' => '/core/units/helpers/user_helper.php',
'UserProfileEventHandler' => '/core/units/user_profile/user_profile_eh.php',
'UserProfileTagProcessor' => '/core/units/user_profile/user_profile_tp.php',
'UserType' => '/core/kernel/constants.php',
'UsersEventHandler' => '/core/units/users/users_event_handler.php',
'UsersItem' => '/core/units/users/users_item.php',
'UsersSyncronize' => '/core/units/users/users_syncronize.php',
'UsersSyncronizeManager' => '/core/units/users/users_syncronize.php',
'UsersTagProcessor' => '/core/units/users/users_tag_processor.php',
'VisitsEventHandler' => '/core/units/visits/visits_event_handler.php',
'VisitsList' => '/core/units/visits/visits_list.php',
'VisitsTagProcessor' => '/core/units/visits/visits_tag_processor.php',
'XCacheCacheHandler' => '/core/kernel/utility/cache.php',
'XMLIterator' => '/core/units/helpers/xml_helper5.php',
'_BlockTag' => '/core/kernel/nparser/ntags.php',
'_Tag_Cache' => '/core/kernel/nparser/ntags.php',
'_Tag_Capture' => '/core/kernel/nparser/ntags.php',
'_Tag_Comment' => '/core/kernel/nparser/ntags.php',
'_Tag_Compress' => '/core/kernel/nparser/ntags.php',
'_Tag_DefaultParam' => '/core/kernel/nparser/ntags.php',
'_Tag_DefineElement' => '/core/kernel/nparser/ntags.php',
'_Tag_If' => '/core/kernel/nparser/ntags.php',
'_Tag_IfDataExists' => '/core/kernel/nparser/ntags.php',
'_Tag_IfNot' => '/core/kernel/nparser/ntags.php',
'_Tag_Include' => '/core/kernel/nparser/ntags.php',
'_Tag_Param' => '/core/kernel/nparser/ntags.php',
'_Tag_RenderElement' => '/core/kernel/nparser/ntags.php',
'_Tag_RenderElements' => '/core/kernel/nparser/ntags.php',
'_Tag_SetParam' => '/core/kernel/nparser/ntags.php',
'clsCachedPermissions' => '/core/units/categories/cache_updater.php',
'clsRecursionStack' => '/core/units/categories/cache_updater.php',
'fckFCKHelper' => '/core/units/helpers/fck_helper.php',
'kApplication' => '/core/kernel/application.php',
'kArray' => '/core/kernel/utility/params.php',
'kBase' => '/core/kernel/kbase.php',
'kBracketsHelper' => '/core/units/helpers/brackets_helper.php',
'kCCDateFormatter' => '/core/kernel/utility/formatters/ccdate_formatter.php',
'kCSSDefaults' => '/core/units/pdf/css_defaults.php',
'kCSVHelper' => '/core/units/helpers/csv_helper.php',
'kCache' => '/core/kernel/utility/cache.php',
'kCacheHandler' => '/core/kernel/utility/cache.php',
'kCacheManager' => '/core/kernel/managers/cache_manager.php',
'kCaptchaHelper' => '/core/units/helpers/captcha_helper.php',
'kCatDBEventHandler' => '/core/kernel/db/cat_event_handler.php',
'kCatDBItem' => '/core/kernel/db/cat_dbitem.php',
'kCatDBItemExportHelper' => '/core/units/helpers/cat_dbitem_export_helper.php',
'kCatDBList' => '/core/kernel/db/cat_dblist.php',
'kCatDBTagProcessor' => '/core/kernel/db/cat_tag_processor.php',
'kChangesFormatter' => '/core/units/logs/change_logs/changes_formatter.php',
'kChartHelper' => '/core/units/helpers/chart_helper.php',
'kClipboardHelper' => '/core/units/helpers/clipboard_helper.php',
'kColumnPickerHelper' => '/core/units/helpers/col_picker_helper.php',
'kCookieHasher' => '/core/kernel/utility/cookie_hasher.php',
'kCountHelper' => '/core/units/helpers/count_helper.php',
'kCountryStatesHelper' => '/core/units/helpers/country_states_helper.php',
'kCronField' => '/core/units/helpers/cron_helper.php',
'kCronHelper' => '/core/units/helpers/cron_helper.php',
'kCurlHelper' => '/core/units/helpers/curl_helper.php',
'kCustomFieldFormatter' => '/core/kernel/utility/formatters/customfield_formatter.php',
'kDBBase' => '/core/kernel/kbase.php',
'kDBConnection' => '/core/kernel/db/db_connection.php',
'kDBConnectionDebug' => '/core/kernel/db/db_connection.php',
'kDBEventHandler' => '/core/kernel/db/db_event_handler.php',
'kDBItem' => '/core/kernel/db/dbitem.php',
'kDBList' => '/core/kernel/db/dblist.php',
'kDBLoadBalancer' => '/core/kernel/db/db_load_balancer.php',
'kDBTagProcessor' => '/core/kernel/db/db_tag_processor.php',
'kDateFormatter' => '/core/kernel/utility/formatters/date_formatter.php',
'kEmail' => '/core/kernel/utility/email.php',
'kEmailSendingHelper' => '/core/kernel/utility/email_send.php',
'kEmailTemplateHelper' => '/core/units/helpers/email_template_helper.php',
'kErrorHandlerStack' => '/core/kernel/utility/logger.php',
'kEvent' => '/core/kernel/utility/event.php',
'kEventHandler' => '/core/kernel/event_handler.php',
'kEventManager' => '/core/kernel/event_manager.php',
'kExceptionHandlerStack' => '/core/kernel/utility/logger.php',
'kFactory' => '/core/kernel/utility/factory.php',
'kFactoryException' => '/core/kernel/utility/factory.php',
'kFilenamesHelper' => '/core/units/helpers/filenames_helper.php',
'kFilesizeFormatter' => '/core/kernel/utility/formatters/filesize_formatter.php',
'kFormatter' => '/core/kernel/utility/formatters/formatter.php',
'kHTTPQuery' => '/core/kernel/utility/http_query.php',
'kHandlerStack' => '/core/kernel/utility/logger.php',
'kHelper' => '/core/kernel/kbase.php',
'kHookManager' => '/core/kernel/managers/hook_manager.php',
'kInstallToolkit' => '/core/install/install_toolkit.php',
'kInstallator' => '/core/install.php',
'kLEFTFormatter' => '/core/kernel/utility/formatters/left_formatter.php',
'kLogger' => '/core/kernel/utility/logger.php',
'kMainTagProcessor' => '/core/kernel/processors/main_processor.php',
'kModulesHelper' => '/core/units/helpers/modules_helper.php',
'kMultiLanguage' => '/core/kernel/utility/formatters/multilang_formatter.php',
'kMultiLanguageHelper' => '/core/units/helpers/multilanguage_helper.php',
'kMultipleFilter' => '/core/kernel/utility/filters.php',
'kMySQLQuery' => '/core/kernel/db/db_connection.php',
'kMySQLQueryCol' => '/core/kernel/db/db_connection.php',
'kNavigationBar' => '/core/units/helpers/navigation_bar.php',
'kNoPermissionException' => '/core/kernel/kbase.php',
'kOpenerStack' => '/core/kernel/utility/opener_stack.php',
'kOptionsFormatter' => '/core/kernel/utility/formatters/options_formatter.php',
'kPDFElemFactory' => '/core/units/pdf/pdf_helper.php',
'kPDFElement' => '/core/units/pdf/pdf_helper.php',
'kPDFHelper' => '/core/units/pdf/pdf_helper.php',
'kPDFImage' => '/core/units/pdf/pdf_image.php',
'kPDFLine' => '/core/units/pdf/pdf_helper.php',
'kPDFRenderer' => '/core/units/pdf/pdf_renderer.php',
'kPDFStylesheet' => '/core/units/pdf/pdf_styles.php',
'kPDFTable' => '/core/units/pdf/pdf_table.php',
'kPDFTableRow' => '/core/units/pdf/pdf_table.php',
'kPDFTextElement' => '/core/units/pdf/pdf_text.php',
'kPasswordFormatter' => '/core/kernel/utility/formatters/password_formatter.php',
'kPermCacheUpdater' => '/core/units/categories/cache_updater.php',
'kPermissionsHelper' => '/core/units/helpers/permissions_helper.php',
'kPhraseCache' => '/core/kernel/languages/phrases_cache.php',
'kPictureFormatter' => '/core/kernel/utility/formatters/upload_formatter.php',
'kPlainUrlProcessor' => '/core/kernel/managers/plain_url_processor.php',
'kPriorityHelper' => '/core/units/helpers/priority_helper.php',
'kRecursiveHelper' => '/core/units/helpers/recursive_helper.php',
'kRedirectException' => '/core/kernel/kbase.php',
'kRequestManager' => '/core/kernel/managers/request_manager.php',
'kRewriteUrlProcessor' => '/core/kernel/managers/rewrite_url_processor.php',
'kScheduledTaskManager' => '/core/kernel/managers/scheduled_task_manager.php',
'kSearchHelper' => '/core/units/helpers/search_helper.php',
'kSectionsHelper' => '/core/units/helpers/sections_helper.php',
'kSerializedFormatter' => '/core/kernel/utility/formatters/serialized_formatter.php',
'kSocket' => '/core/kernel/utility/socket.php',
'kSubscriptionAnalyzer' => '/core/units/system_event_subscriptions/system_event_subscription_tp.php',
'kSubscriptionItem' => '/core/kernel/managers/subscription_manager.php',
'kSubscriptionManager' => '/core/kernel/managers/subscription_manager.php',
'kSystemConfig' => '/core/kernel/utility/system_config.php',
'kSystemConfigException' => '/core/kernel/utility/system_config.php',
'kTCPDFRenderer' => '/core/units/pdf/pdf_renderer_tcpdf.php',
'kTagProcessor' => '/core/kernel/processors/tag_processor.php',
'kTempHandlerSubTable' => '/core/kernel/utility/temp_handler.php',
'kTempHandlerTable' => '/core/kernel/utility/temp_handler.php',
'kTempHandlerTopTable' => '/core/kernel/utility/temp_handler.php',
'kTempTablesHandler' => '/core/kernel/utility/temp_handler.php',
'kThemesHelper' => '/core/units/helpers/themes_helper.php',
'kUnitConfig' => '/core/kernel/utility/unit_config.php',
'kUnitConfigCloner' => '/core/kernel/utility/unit_config_cloner.php',
'kUnitConfigReader' => '/core/kernel/utility/unit_config_reader.php',
'kUnitFormatter' => '/core/kernel/utility/formatters/unit_formatter.php',
'kUpgradeHelper' => '/core/install/upgrade_helper.php',
'kUploadFormatter' => '/core/kernel/utility/formatters/upload_formatter.php',
'kUploadHelper' => '/core/units/helpers/upload_helper.php',
'kUploaderException' => '/core/units/helpers/upload_helper.php',
'kUrlManager' => '/core/kernel/managers/url_manager.php',
'kUrlProcessor' => '/core/kernel/managers/url_processor.php',
'kUtil' => '/core/kernel/globals.php',
'kValidator' => '/core/kernel/utility/validator.php',
'kXMLHelper' => '/core/units/helpers/xml_helper.php',
'kXMLNode' => '/core/units/helpers/xml_helper.php',
'kXMLNode5' => '/core/units/helpers/xml_helper5.php',
'kZendPDFRenderer' => '/core/units/pdf/pdf_renderer_zend.php',
'kiCacheable' => '/core/kernel/interfaces/cacheable.php',
),
'class_info' => array(
'AbstractCategoryItemRouter' => array(
'type' => 1,
'modifiers' => 1,
'extends' => array(
0 => 'AbstractRouter',
),
),
'AbstractReviewRouter' => array(
'type' => 1,
'modifiers' => 1,
'extends' => array(
0 => 'AbstractRouter',
),
),
'AbstractRouter' => array(
'type' => 1,
'modifiers' => 1,
'extends' => array(
0 => 'kBase',
),
),
'AdminEventsHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'AdminTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'AjaxFormHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'ApcCacheHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kCacheHandler',
),
),
'BackupHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'BaseSession' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'BaseSessionStorage' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBBase',
),
),
'CacheSettings' => array(
'type' => 1,
'modifiers' => 0,
),
'CaptchaEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kEventHandler',
),
),
'CategoriesEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'CategoriesItem' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBItem',
),
),
'CategoriesTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'CategoryHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'CategoryItemsEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'CategoryItemsTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'CategoryPermissionRebuild' => array(
'type' => 1,
'modifiers' => 0,
),
'ChangeLog' => array(
'type' => 1,
'modifiers' => 0,
),
'ChangeLogEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'ChangeLogTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'ColumnSet' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'ConfigSearchEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'ConfigSearchTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'ConfigurationEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'ConfigurationItem' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBItem',
),
),
'ConfigurationTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'ConfigurationValidator' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kValidator',
),
),
'ContentEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'ContentTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'CoreUpgrades' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kUpgradeHelper',
),
),
'CountryStateEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'CssMinifyHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'CustomDataEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'CustomFieldsEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'CustomFieldsTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'Debugger' => array(
'type' => 1,
'modifiers' => 0,
),
'DebuggerUtil' => array(
'type' => 1,
'modifiers' => 0,
),
'DeploymentHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'DraftEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'EditPickerHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'EmailDelivery' => array(
'type' => 1,
'modifiers' => 0,
),
'EmailLogEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'EmailLogStatus' => array(
'type' => 1,
'modifiers' => 0,
),
'EmailLogTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'EmailQueueEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'EmailQueueTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'EmailTemplate' => array(
'type' => 1,
'modifiers' => 0,
),
'EmailTemplateEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'EmailTemplateTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'FakeCacheHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kCacheHandler',
),
),
'FavoritesEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'FckEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'FckTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'FileEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'FileHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'FileTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'FormFieldEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'FormFieldsTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'FormSubmissionHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'FormSubmissionTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'FormSubmissionsEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'FormsEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'FormsTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'GeoCodeHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'GroupTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'GroupsEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'IDBConnection' => array(
'type' => 2,
),
'ImageEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'ImageHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'ImageTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'ImagesItem' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBItem',
),
),
'InPortalPrerequisites' => array(
'type' => 1,
'modifiers' => 0,
),
'InpCustomFieldsHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\AbstractCommand' => array(
+ 'type' => 1,
+ 'modifiers' => 1,
+ 'extends' => array(
+ 0 => 'Symfony\\Component\\Console\\Command\\Command',
+ 1 => 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\IConsoleCommand',
+ ),
+ ),
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\BuildClassMapCommand' => array(
+ 'type' => 1,
+ 'modifiers' => 0,
+ 'extends' => array(
+ 0 => 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\AbstractCommand',
+ 1 => 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\Completion\\CompletionAwareInterface',
+ ),
+ ),
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\CompletionCommand' => array(
+ 'type' => 1,
+ 'modifiers' => 0,
+ 'extends' => array(
+ 0 => 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\CompletionCommand',
+ 1 => 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\IConsoleCommand',
+ ),
+ ),
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\IConsoleCommand' => array(
+ 'type' => 2,
+ ),
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\ResetCacheCommand' => array(
+ 'type' => 1,
+ 'modifiers' => 0,
+ 'extends' => array(
+ 0 => 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\AbstractCommand',
+ ),
+ ),
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\RunEventCommand' => array(
+ 'type' => 1,
+ 'modifiers' => 0,
+ 'extends' => array(
+ 0 => 'Intechnic\\InPortal\\Core\\kernel\\Console\\Command\\AbstractCommand',
+ 1 => 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\Completion\\CompletionAwareInterface',
+ ),
+ ),
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\ConsoleApplication' => array(
+ 'type' => 1,
+ 'modifiers' => 0,
+ 'extends' => array(
+ 0 => 'Symfony\\Component\\Console\\Application',
+ ),
+ ),
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\ConsoleCommandProvider' => array(
+ 'type' => 1,
+ 'modifiers' => 0,
+ 'extends' => array(
+ 0 => 'kBase',
+ 1 => 'Intechnic\\InPortal\\Core\\kernel\\Console\\IConsoleCommandProvider',
+ ),
+ ),
+ 'Intechnic\\InPortal\\Core\\kernel\\Console\\IConsoleCommandProvider' => array(
+ 'type' => 2,
+ ),
'Intechnic\\InPortal\\Core\\kernel\\utility\\ClassDiscovery\\ClassDetector' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'PhpParser\\NodeVisitorAbstract',
),
),
'Intechnic\\InPortal\\Core\\kernel\\utility\\ClassDiscovery\\ClassMapBuilder' => array(
'type' => 1,
'modifiers' => 0,
),
'Intechnic\\InPortal\\Core\\kernel\\utility\\ClassDiscovery\\CodeFolderFilterIterator' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'RecursiveFilterIterator',
),
),
'ItemFilterEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'ItemFilterTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'JSONHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'JsMinifyHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'Language' => array(
'type' => 1,
'modifiers' => 0,
),
'LanguageImportHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'LanguagesEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'LanguagesItem' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBItem',
),
),
'LanguagesTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'LeftJoinOptimizer' => array(
'type' => 1,
'modifiers' => 0,
),
'ListHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'LoginResult' => array(
'type' => 1,
'modifiers' => 0,
),
'MInputHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'MailboxHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'MailingList' => array(
'type' => 1,
'modifiers' => 0,
),
'MailingListEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'MailingListHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'MailingListTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'MainRouter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'AbstractRouter',
),
),
'MaintenanceMode' => array(
'type' => 1,
'modifiers' => 0,
),
'MassImageResizer' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'MemcacheCacheHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kCacheHandler',
),
),
'MenuHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'MimeDecodeHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'MinifyHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'ModuleDeploymentLog' => array(
'type' => 1,
'modifiers' => 0,
),
'ModuleDeploymentLogEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'ModulesEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'ModulesTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'NParser' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'NParserCompiler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'POP3Helper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'PageHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'PageRevisionEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'PageRevisionTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'Params' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'ParserException' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'Exception',
),
),
'PasswordHash' => array(
'type' => 1,
'modifiers' => 0,
),
'PasswordHashingMethod' => array(
'type' => 1,
'modifiers' => 0,
),
'PermissionTypeEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'PermissionsEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'PermissionsTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'PhraseTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'PhrasesEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'PriorityEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'PromoBlockEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'PromoBlockGroupEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'PromoBlockGroupTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'PromoBlockTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'PromoBlockType' => array(
'type' => 1,
'modifiers' => 0,
),
'RatingHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'RelatedSearchEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'RelatedSearchTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'RelationshipEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'RelationshipTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'ReviewsEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'ReviewsTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'ScheduledTask' => array(
'type' => 1,
'modifiers' => 0,
),
'ScheduledTaskEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'SelectorsEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'SelectorsItem' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBItem',
),
),
'SelectorsTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'Session' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'BaseSession',
),
),
'SessionLogEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'SessionStorage' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'BaseSessionStorage',
),
),
'SiteConfigEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kEventHandler',
),
),
'SiteConfigHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'SiteConfigTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kTagProcessor',
),
),
'SiteDomainEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'SiteHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'SkinEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'SkinHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'SpamHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'SpamReportEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'SpamReportTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'StatisticsEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'StatisticsTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'StorageEngine' => array(
'type' => 1,
'modifiers' => 0,
),
'StylesheetsEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'StylesheetsItem' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBItem',
),
),
'SubmissionFormField' => array(
'type' => 1,
'modifiers' => 0,
),
'SubmissionLogEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'SubmissionLogTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'SystemEventSubscriptionEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'SystemEventSubscriptionTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'SystemLogEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'SystemLogTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'TemplateHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'TemplatesCache' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'ThemeFileEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'ThemeItem' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBItem',
),
),
'ThemesEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'ThemesTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'ThesaurusEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'ThesaurusTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'TranslationSaveMode' => array(
'type' => 1,
'modifiers' => 0,
),
'TranslatorEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'TranslatorTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'UnitConfigDecorator' => array(
'type' => 1,
'modifiers' => 0,
),
'UserGroupsEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'UserHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'UserProfileEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'UserProfileTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'UserType' => array(
'type' => 1,
'modifiers' => 0,
),
'UsersEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'UsersItem' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBItem',
),
),
'UsersSyncronize' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'UsersSyncronizeManager' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'UsersTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'VisitsEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'VisitsList' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBList',
),
),
'VisitsTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'XCacheCacheHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kCacheHandler',
),
),
'XMLIterator' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'Iterator',
),
),
'_BlockTag' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'_Tag_Cache' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_BlockTag',
),
),
'_Tag_Capture' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_Tag_DefineElement',
),
),
'_Tag_Comment' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_BlockTag',
),
),
'_Tag_Compress' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_BlockTag',
),
),
'_Tag_DefaultParam' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_BlockTag',
),
),
'_Tag_DefineElement' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_BlockTag',
),
),
'_Tag_If' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_BlockTag',
),
),
'_Tag_IfDataExists' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_BlockTag',
),
),
'_Tag_IfNot' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_Tag_If',
),
),
'_Tag_Include' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_BlockTag',
),
),
'_Tag_Param' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_BlockTag',
),
),
'_Tag_RenderElement' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_Tag_DefineElement',
),
),
'_Tag_RenderElements' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_BlockTag',
),
),
'_Tag_SetParam' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => '_BlockTag',
),
),
'clsCachedPermissions' => array(
'type' => 1,
'modifiers' => 0,
),
'clsRecursionStack' => array(
'type' => 1,
'modifiers' => 0,
),
'fckFCKHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kApplication' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kiCacheable',
),
),
'kArray' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
1 => 'kiCacheable',
),
),
'kBase' => array(
'type' => 1,
'modifiers' => 0,
),
'kBracketsHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kCCDateFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kFormatter',
),
),
'kCSSDefaults' => array(
'type' => 1,
'modifiers' => 0,
),
'kCSVHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kCache' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kCacheHandler' => array(
'type' => 1,
'modifiers' => 1,
),
'kCacheManager' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
1 => 'kiCacheable',
),
),
'kCaptchaHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kCatDBEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBEventHandler',
),
),
'kCatDBItem' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBItem',
),
),
'kCatDBItemExportHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kCatDBList' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBList',
),
),
'kCatDBTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBTagProcessor',
),
),
'kChangesFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kFormatter',
),
),
'kChartHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kClipboardHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kColumnPickerHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kCookieHasher' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kCountHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kCountryStatesHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kCronField' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kCronHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kCurlHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kCustomFieldFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kFormatter',
),
),
'kDBBase' => array(
'type' => 1,
'modifiers' => 1,
'extends' => array(
0 => 'kBase',
),
),
'kDBConnection' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
1 => 'IDBConnection',
),
),
'kDBConnectionDebug' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBConnection',
),
),
'kDBEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kEventHandler',
),
),
'kDBItem' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBBase',
),
),
'kDBList' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kDBBase',
1 => 'Iterator',
2 => 'Countable',
),
),
'kDBLoadBalancer' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
1 => 'IDBConnection',
),
),
'kDBTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kTagProcessor',
),
),
'kDateFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kFormatter',
),
),
'kEmail' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kEmailSendingHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kEmailTemplateHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kErrorHandlerStack' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHandlerStack',
),
),
'kEvent' => array(
'type' => 1,
'modifiers' => 2,
'extends' => array(
0 => 'kBase',
),
),
'kEventHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kEventManager' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
1 => 'kiCacheable',
),
),
'kExceptionHandlerStack' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHandlerStack',
),
),
'kFactory' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
1 => 'kiCacheable',
),
),
'kFactoryException' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'Exception',
),
),
'kFilenamesHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kFilesizeFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kFormatter',
),
),
'kFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kHTTPQuery' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'Params',
),
),
'kHandlerStack' => array(
'type' => 1,
'modifiers' => 1,
'extends' => array(
0 => 'kBase',
),
),
'kHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kHookManager' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
1 => 'kiCacheable',
),
),
'kInstallToolkit' => array(
'type' => 1,
'modifiers' => 0,
),
'kInstallator' => array(
'type' => 1,
'modifiers' => 0,
),
'kLEFTFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kFormatter',
),
),
'kLogger' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kMainTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kTagProcessor',
),
),
'kModulesHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kMultiLanguage' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kFormatter',
),
),
'kMultiLanguageHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kMultipleFilter' => array(
'type' => 1,
'modifiers' => 0,
),
'kMySQLQuery' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'Iterator',
1 => 'Countable',
2 => 'SeekableIterator',
),
),
'kMySQLQueryCol' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kMySQLQuery',
),
),
'kNavigationBar' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kNoPermissionException' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kRedirectException',
),
),
'kOpenerStack' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kOptionsFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kFormatter',
),
),
'kPDFElemFactory' => array(
'type' => 1,
'modifiers' => 0,
),
'kPDFElement' => array(
'type' => 1,
'modifiers' => 0,
),
'kPDFHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kPDFImage' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kPDFElement',
),
),
'kPDFLine' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kPDFElement',
),
),
'kPDFRenderer' => array(
'type' => 1,
'modifiers' => 0,
),
'kPDFStylesheet' => array(
'type' => 1,
'modifiers' => 0,
),
'kPDFTable' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kPDFElement',
),
),
'kPDFTableRow' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kPDFElement',
),
),
'kPDFTextElement' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kPDFElement',
),
),
'kPasswordFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kFormatter',
),
),
'kPermCacheUpdater' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kPermissionsHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kPhraseCache' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kPictureFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kUploadFormatter',
),
),
'kPlainUrlProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kUrlProcessor',
),
),
'kPriorityHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kRecursiveHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kRedirectException' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'Exception',
),
),
'kRequestManager' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kRewriteUrlProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kUrlProcessor',
),
),
'kScheduledTaskManager' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
1 => 'kiCacheable',
),
),
'kSearchHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kSectionsHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kSerializedFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kFormatter',
),
),
'kSocket' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kSubscriptionAnalyzer' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kSubscriptionItem' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kSubscriptionManager' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kSystemConfig' => array(
'type' => 1,
'modifiers' => 0,
),
'kSystemConfigException' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'Exception',
),
),
'kTCPDFRenderer' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kPDFRenderer',
),
),
'kTagProcessor' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kTempHandlerSubTable' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kTempHandlerTable',
),
),
'kTempHandlerTable' => array(
'type' => 1,
'modifiers' => 1,
'extends' => array(
0 => 'kBase',
),
),
'kTempHandlerTopTable' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kTempHandlerTable',
),
),
'kTempTablesHandler' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kThemesHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kUnitConfig' => array(
'type' => 1,
'modifiers' => 0,
),
'kUnitConfigCloner' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
1 => 'kiCacheable',
),
),
'kUnitConfigReader' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
1 => 'kiCacheable',
),
),
'kUnitFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kFormatter',
),
),
'kUpgradeHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kUploadFormatter' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kFormatter',
),
),
'kUploadHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kUploaderException' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'Exception',
),
),
'kUrlManager' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kUrlProcessor' => array(
'type' => 1,
'modifiers' => 1,
'extends' => array(
0 => 'kBase',
),
),
'kUtil' => array(
'type' => 1,
'modifiers' => 0,
),
'kValidator' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kBase',
),
),
'kXMLHelper' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kHelper',
),
),
'kXMLNode' => array(
'type' => 1,
'modifiers' => 0,
),
'kXMLNode5' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kXMLNode',
1 => 'IteratorAggregate',
),
),
'kZendPDFRenderer' => array(
'type' => 1,
'modifiers' => 0,
'extends' => array(
0 => 'kPDFRenderer',
),
),
'kiCacheable' => array(
'type' => 2,
),
),
);
Index: branches/5.3.x/composer.json
===================================================================
--- branches/5.3.x/composer.json (revision 16180)
+++ branches/5.3.x/composer.json (revision 16181)
@@ -1,7 +1,11 @@
{
"name": "In-Portal",
+ "require": {
+ "symfony/console": "~2.6",
+ "stecman/symfony-console-completion": "~0.5"
+ },
"require-dev": {
"aik099/coding-standard": "dev-in-portal",
"nikic/php-parser": "~1.2"
}
}
Index: branches/5.3.x/tools/build_class_map.php
===================================================================
--- branches/5.3.x/tools/build_class_map.php (revision 16180)
+++ branches/5.3.x/tools/build_class_map.php (nonexistent)
@@ -1,19 +0,0 @@
-<?php
-
-use Intechnic\InPortal\Core\kernel\utility\ClassDiscovery\ClassMapBuilder;
-
-if ( PHP_SAPI !== 'cli' ) {
- exit(64);
-}
-
-$_GET['full_init'] = 0; // See INP-1413.
-
-define('FULL_PATH', realpath(dirname(__FILE__) . '/..'));
-require_once (FULL_PATH . '/core/kernel/startup.php');
-
-$application =& kApplication::Instance();
-$application->Init();
-
-foreach ( ClassMapBuilder::createBuilders() as $class_map_builder ) {
- $class_map_builder->build();
-}
Property changes on: branches/5.3.x/tools/build_class_map.php
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: branches/5.3.x/tools/bash_completion.sh
===================================================================
--- branches/5.3.x/tools/bash_completion.sh (nonexistent)
+++ branches/5.3.x/tools/bash_completion.sh (revision 16181)
@@ -0,0 +1,35 @@
+
+function _in-portal_d41351fc9a70c756_complete {
+
+
+ local CMDLINE_CONTENTS="$COMP_LINE"
+ local CMDLINE_CURSOR_INDEX="$COMP_POINT"
+ local CMDLINE_WORDBREAKS="$COMP_WORDBREAKS";
+
+ export CMDLINE_CONTENTS CMDLINE_CURSOR_INDEX CMDLINE_WORDBREAKS
+
+ local RESULT STATUS;
+
+ # this is custom line
+ RESULT=$(${1} _completion); # complete
+ STATUS=$?;
+
+ local cur;
+ _get_comp_words_by_ref -n : cur;
+
+
+ if [ $STATUS -eq 200 ]; then
+ _filedir;
+ return 0;
+
+ elif [ $STATUS -ne 0 ]; then
+ echo -e "$RESULT";
+ return $?;
+ fi;
+
+ COMPREPLY=(`compgen -W "$RESULT" -- $cur`);
+
+ __ltrim_colon_completions "$cur";
+};
+
+complete -F _in-portal_d41351fc9a70c756_complete in-portal;
Property changes on: branches/5.3.x/tools/bash_completion.sh
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/5.3.x/tools/run_event.php
===================================================================
--- branches/5.3.x/tools/run_event.php (revision 16180)
+++ branches/5.3.x/tools/run_event.php (revision 16181)
@@ -1,61 +1,33 @@
<?php
/**
* @version $Id$
* @package In-Portal
-* @copyright Copyright (C) 1997 - 2011 Intechnic. All rights reserved.
+* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
-exit_code(1, 'This script needs to be enabled manually !');
-
-if ( php_sapi_name() != 'cli' ) {
- exit_code(2, 'This script is intended to be used from command-line only !');
+if ( PHP_SAPI !== 'cli' ) {
+ echo 'This script is intended to be used from command-line only !';
+ exit(64);
}
-$start = microtime(true);
-
-define('CRON', 1);
-define('ADMIN', 1);
define('FULL_PATH', realpath(dirname(__FILE__) . '/..'));
-define('DBG_SKIP_REPORTING', 1);
-
-$_SERVER['HTTP_USER_AGENT'] = 'gecko';
-
-// in command line, then 2nd argument is password
-$password = isset($argv) && isset($argv[2]) ? $argv[2] : '';
-
-if ( $password != 'b674006f3edb1d9cd4d838c150b0567d' ) {
- exit_code(3, 'Bad key');
-}
-
-include_once(FULL_PATH . '/core/kernel/startup.php');
-
-$application =& kApplication::Instance();
-$application->Init();
-
-$application->StoreVar('user_id', USER_ROOT, true);
-
-$run_event = new kEvent($argv[1]); // event name in form "prefix[.special]:event_name"
-$application->HandleEvent($run_event);
-
-$application->Done();
+/*
+ * Arguments:
+ * 1 - event name
+ * 2 - password
+ * 3 - ip address for deployment (not handled)
+ */
+
+$exit_code = 0;
+$event_name = isset($argv[1]) ? $argv[1] : '';
+passthru(FULL_PATH . '/in-portal event:run ' . escapeshellarg($event_name), $exit_code);
+exit($exit_code);
$end = microtime(true);
-
-exit_code($run_event->status == kEvent::erSUCCESS ? 0 : 4);
-
-function exit_code($code, $msg = '')
-{
- if ( $msg ) {
- echo $msg . PHP_EOL;
- }
-
- exit($code);
-}
-$end = microtime(true);
\ No newline at end of file
Index: branches/5.3.x/in-portal
===================================================================
--- branches/5.3.x/in-portal (nonexistent)
+++ branches/5.3.x/in-portal (revision 16181)
@@ -0,0 +1,40 @@
+#!/usr/bin/env php
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+if ( PHP_SAPI !== 'cli' ) {
+ echo 'This script is intended to be used from command-line only !';
+ exit(64);
+}
+
+$start = microtime(true);
+
+define('CRON', 1);
+define('DBG_SKIP_REPORTING', 1);
+$_SERVER['REQUEST_URI'] = 'CRON';
+$_SERVER['HTTP_USER_AGENT'] = 'gecko';
+
+define('FULL_PATH', realpath(dirname(__FILE__)));
+include_once(FULL_PATH . '/core/kernel/startup.php');
+
+$application =& kApplication::Instance();
+$application->Init();
+
+// Assume user with all privileges, because nobody is doing authentication from CLI.
+$application->StoreVar('user_id', USER_ROOT, true);
+
+$application->getConsoleApplication()->run();
+$application->Done();
+
+$end = microtime(true);
Property changes on: branches/5.3.x/in-portal
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/5.3.x/composer.lock
===================================================================
--- branches/5.3.x/composer.lock (revision 16180)
+++ branches/5.3.x/composer.lock (revision 16181)
@@ -1,105 +1,209 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "746788fc49ab32d05ca2bd837e9f0a1f",
- "packages": [],
+ "hash": "0084b5c04f49b47e81eff44c0343b57f",
+ "packages": [
+ {
+ "name": "stecman/symfony-console-completion",
+ "version": "0.5.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/stecman/symfony-console-completion.git",
+ "reference": "1a9fc7ab4820cd1aabbdc584c6b25d221e7b6cb5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/stecman/symfony-console-completion/zipball/1a9fc7ab4820cd1aabbdc584c6b25d221e7b6cb5",
+ "reference": "1a9fc7ab4820cd1aabbdc584c6b25d221e7b6cb5",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2",
+ "symfony/console": "~2.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.5.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Stecman\\Component\\Symfony\\Console\\BashCompletion\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Stephen Holdaway",
+ "email": "stephen@stecman.co.nz"
+ }
+ ],
+ "description": "Automatic BASH completion for Symfony Console Component based applications.",
+ "time": "2015-05-07 12:21:50"
+ },
+ {
+ "name": "symfony/console",
+ "version": "v2.6.7",
+ "target-dir": "Symfony/Component/Console",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/Console.git",
+ "reference": "ebc5679854aa24ed7d65062e9e3ab0b18a917272"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/Console/zipball/ebc5679854aa24ed7d65062e9e3ab0b18a917272",
+ "reference": "ebc5679854aa24ed7d65062e9e3ab0b18a917272",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "psr/log": "~1.0",
+ "symfony/event-dispatcher": "~2.1",
+ "symfony/phpunit-bridge": "~2.7",
+ "symfony/process": "~2.1"
+ },
+ "suggest": {
+ "psr/log": "For using the console logger",
+ "symfony/event-dispatcher": "",
+ "symfony/process": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.6-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Symfony\\Component\\Console\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Console Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-05-02 15:18:45"
+ }
+ ],
"packages-dev": [
{
"name": "aik099/coding-standard",
"version": "dev-in-portal",
"source": {
"type": "git",
"url": "https://github.com/aik099/CodingStandard.git",
- "reference": "3680b3926f0e936dc95de82dece9310b97c73e97"
+ "reference": "a47f2b767c99a33f437802b3315179887018e114"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/aik099/CodingStandard/zipball/3680b3926f0e936dc95de82dece9310b97c73e97",
- "reference": "3680b3926f0e936dc95de82dece9310b97c73e97",
+ "url": "https://api.github.com/repos/aik099/CodingStandard/zipball/a47f2b767c99a33f437802b3315179887018e114",
+ "reference": "a47f2b767c99a33f437802b3315179887018e114",
"shasum": ""
},
"require-dev": {
"squizlabs/php_codesniffer": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Alexander Obuhovich",
"email": "aik.bold@gmail.com"
}
],
"description": "The PHP_CodeSniffer coding standard I'm using on all of my projects.",
"keywords": [
"PHP_CodeSniffer",
"codesniffer"
],
- "time": "2015-04-10 07:05:51"
+ "time": "2015-05-06 08:54:38"
},
{
"name": "nikic/php-parser",
- "version": "v1.2.2",
+ "version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
- "reference": "08f97eb4efa029e2fafb6d8c98b71731bf0cf621"
+ "reference": "dff239267fd1befa1cd40430c9ed12591aa720ca"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/08f97eb4efa029e2fafb6d8c98b71731bf0cf621",
- "reference": "08f97eb4efa029e2fafb6d8c98b71731bf0cf621",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dff239267fd1befa1cd40430c9ed12591aa720ca",
+ "reference": "dff239267fd1befa1cd40430c9ed12591aa720ca",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.2-dev"
+ "dev-master": "1.3-dev"
}
},
"autoload": {
"files": [
"lib/bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov"
}
],
"description": "A PHP parser written in PHP",
"keywords": [
"parser",
"php"
],
- "time": "2015-04-03 14:33:59"
+ "time": "2015-05-02 15:40:40"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"aik099/coding-standard": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}

Event Timeline