core_dir = $core_dir; $this->root_dir = $root_dir; $this->log_file = $this->getTmpDir().'/'.$ENGINE_LOG_FILE; error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING & ~E_DEPRECATED & ~E_USER_DEPRECATED); error_reporting(0); ini_set('display_errors', 0); ini_set('log_errors', 0); ini_set('error_log', $this->log_file); $this->active_history = array(); $old_error_handler = set_error_handler(array($this, 'errorHandler')); } /*********************************************************************** * Description: * ������� �������� ������������ ����� ������������ ������. * ���������� � ������ ������ ��������� � ���-���� � ������ ������. * Arguments: * [in] errno - ����� ������ * [in] errmsg - ����� ������ * [in] filename - ��� �����, ��� ��������� ������ * [in] linenum - ����� ������, ��� ��������� ������ * Returns: * Exceptions: ************************************************************************/ function errorHandler ($errno, $errmsg, $filename='', $linenum='') { if (($errno == 8) || ($errno == 1024) || ($errno == 2048)) return; $_error['date'] = date('d-M-Y H:i:s'); $errortype = array ( 1 => 'Error', 2 => 'Warning', 4 => 'Parsing Error', 8 => 'Notice', 16 => 'Core Error', 32 => 'Core Warning', 64 => 'Compile Error', 128 => 'Compile Warning', 256 => 'Engine Error', 512 => 'Engine Warning', 1024=> 'Engine Notice' ); $_error['type'] = $errortype[$errno]; $_error['errno'] = $errno; $_error['message'] = $errmsg; $_error['filename'] = $filename; $_error['linenum'] = $linenum; $this->errors[] = $_error; $msg = '['.$_error['date'].'] '.$_error['type'].': '.$_error['message']; if (trim($_error['filename']) != '') $msg .= ' in '.$_error['filename']; if (trim($_error['linenum']) != '') $msg .= ' on line '.$_error['linenum']; $msg .= "\n"; //error_log($msg, 3, $this->log_file); } /*********************************************************************** * Description: * ������� ������� ������ ��� ������ � ��, ��������� ��������� * Arguments: * [in] params - ������������� ������ ���������� : * type - ��� ���� * host - ����� ���������� � ����, �� ������� * ������� ������ ���� ������ * user - ��� ������������, ��� ���������� � * �������� ���� ������ * password - ������ * name - ��� ���� ������ * * Returns: * ������ �� * Exceptions: ************************************************************************/ function initDb($params) { if ($params['type'] == '') { trigger_error('Connect to DB failed - invalid params!', E_USER_ERROR); return; } include_once('classes/db/'.strtolower($params['type']).'.php'); eval('$db = new CoreDb'.$params['type'].'();'); if (isset($db)) { $host = $params['host']; unset($params['host']); $user = $params['user']; unset($params['user']); $password = $params['password']; unset($params['password']); $name = $params['name']; unset($params['name']); $result = $db->connect($host, $user, $password, $name, $params); if (!$result) trigger_error('Connect to DB failed !', E_USER_ERROR); } else trigger_error('Can\'t create DB object', E_USER_ERROR); return $db; } /*********************************************************************** * Description: * ������� ������������� ������� ������ ��� ������ � �� * Arguments: * [in] db - ������ �� * * Returns: * Exceptions: ************************************************************************/ function setDb(&$db) { $this->db = $db; } /*********************************************************************** * Description: * ������� ������������� ������� �������� ��� ������ � �� - ������ * ��������� ����� * Arguments: * Returns: * Exceptions: ************************************************************************/ function resetDb() { $this->db = &$this->core_db; } /*********************************************************************** * Description: * ������� ������� ��������� ������ Smarty � ������������ ��� * ����������� �������. * Arguments: * Returns: * Exceptions: ************************************************************************/ function initSmarty() { unset($this->smarty); $smarty = new Smarty; $this->smarty = &$smarty; $_templates = $this->getTmpDir().'/templates'; if (!file_exists($_templates)) @mkdir($_templates); $smarty->compile_dir = $_templates; $smarty->use_sub_dirs = false; // modifiers $smarty->register_modifier('root','smarty_modifier_root'); $smarty->register_modifier('node_url','smarty_modifier_node_url'); $smarty->register_modifier('design','smarty_modifier_design'); $smarty->register_modifier('translate', 'smarty_modifier_translate'); $smarty->register_modifier('in_set', 'smarty_modifier_in_set'); $smarty->register_modifier('check_quotes', 'smarty_check_quotes'); // functions $smarty->register_function('fetchQuery', 'smarty_function_fetchQuery'); $smarty->register_function('fetchClass', 'smarty_function_fetchClass'); $smarty->register_function('fetchClasses', 'smarty_function_fetchClasses'); $smarty->register_function('fetchNode', 'smarty_function_fetchNode'); $smarty->register_function('fetchNodes', 'smarty_function_fetchNodes'); $smarty->register_function('fetchNodePath', 'smarty_function_fetchNodePath'); $smarty->register_function('fetchLanguages', 'smarty_function_fetchLanguages'); $smarty->register_function('fetchLanguage', 'smarty_function_fetchLanguage'); $smarty->register_function('fetchWords', 'smarty_function_fetchWords'); $smarty->register_function('fetchWord', 'smarty_function_fetchWord'); $smarty->register_function('showAttribute', 'smarty_function_showAttribute'); $smarty->register_function('showClass', 'smarty_function_showClass'); $smarty->register_function('showListText', 'smarty_function_showListText'); $smarty->register_function('fetchAttribute', 'smarty_function_fetchAttribute'); $smarty->register_function('showAttributeID', 'smarty_function_showAttributeID'); $smarty->register_function('fetchImage', 'smarty_function_fetchImage'); $smarty->register_function('fetchFile', 'smarty_function_fetchFile'); $smarty->register_function('getRunTime', 'smarty_function_getRunTime'); $smarty->register_function('getArrayValue', 'smarty_function_getArrayValue'); // Smarty Paginate $smarty->register_function('paginate_middle', 'smarty_function_paginate_middle'); $smarty->register_function('paginate_next', 'smarty_function_paginate_next'); $smarty->register_function('paginate_prev', 'smarty_function_paginate_prev'); } /*********************************************************************** * Description: * ������� ���������� ���������� ������� * Arguments: * Returns: * Exceptions: ************************************************************************/ function includeClasses() { include_once('classes/db/db.php'); include_once('classes/module.php'); include_once('classes/attributes/attributes.php'); include_once('classes/class.php'); include_once('classes/object.php'); include_once('classes/action.php'); include_once('classes/filesystem.php'); include_once('classes/language.php'); include_once('classes/node.php'); include_once('classes/word.php'); include_once('classes/utils.php'); include_once('classes/cache.php'); include_once('classes/smarty_plugins.php'); include_once('smarty/smarty.class.php'); include_once('classes/smarty_paginate.class.php'); } /*********************************************************************** * Description: * ������� ������������� �������� ������ * Arguments: * [in] active_module - ������ "������" * Returns: * Exceptions: ************************************************************************/ function setActiveModule($params, $add_to_reset = false) { if (isset($params['object'])) $active_module = $params['object']; else if (isset($params['id'])) $active_module = CoreModule::fetch(array('id' => $params['id'])); else if (isset($params['ident'])) $active_module = CoreModule::fetch(array('ident' => $params['ident'])); else trigger_error('setActiveModule - no params !', E_USER_ERROR); if (!$active_module) trigger_error('setActiveModule - invalid params ('.print_r($params, true).')!', E_USER_ERROR); if ($active_module['id'] == $this->active_module['id']) return; if ($add_to_reset) array_push($this->active_history, $this->active_module); $module_ident = $active_module['ident']; $_dir = $this->getModuleDir($module_ident); $this->active_module = $active_module; $this->smarty->template_dir = $_dir.'/design/templates'; require_once($_dir.'/module.php'); if (!isset($this->load_modules[$module_ident])) eval('$this->load_modules['.$module_ident.'] = new '.$module_ident.'();'); $this->module = &$this->load_modules[$module_ident]; } function resetActiveModule() { if (count($this->active_history) > 0) { $module = array_pop($this->active_history); $this->setActiveModule(array('object' => $module)); } } /*********************************************************************** * Description: * ������� ���������� ���������� ������������� ������, �� ��������� - * �������� * Arguments: * [in] module - ��� ������ * Returns: * ��� ���������� * Exceptions: ************************************************************************/ function getModuleDir($module = '') { if ($module == '') $module = $this->active_module['ident']; return $this->getRootDir().'/modules/'.$module; } /*********************************************************************** * Description: * ������� ���������� URL ������������� ������, �� ��������� - * �������� * Arguments: * [in] module - ��� ������ * Returns: * URL * Exceptions: ************************************************************************/ function getModuleURL($module = '') { if ($module == '') $module = $this->active_module['ident']; return $this->getRootURL().'/'.$module; } /*********************************************************************** * Description: * ������� ���������� ���� ������ "������" * Arguments: * [in] class_name - ���� ������ * [in] module - ��� ������ * Returns: * Exceptions: ************************************************************************/ function includeClass($class_file, $module = '') { if ($module == '') $module = $this->active_module['ident']; include_once($this->getRootDir().'/modules/'.$module.'/classes/'.$class_file); } /*********************************************************************** * Description: * ������� ���������� ���� �� �������� ���������� * Arguments: * Returns: * ���� �� �������� ���������� * Exceptions: ************************************************************************/ function getRootDir() { return $this->root_dir; } /*********************************************************************** * Description: * ������� ���������� ���� ���������� ���� * Arguments: * Returns: * ���� �� �������� ���������� * Exceptions: ************************************************************************/ function getCoreDir() { return $this->core_dir; } /*********************************************************************** * Description: * ������� ���������� ���� �� ���������� ��� ��������� ������ * Arguments: * Returns: * ���� �� ���������� ��� ��������� ������ * Exceptions: ************************************************************************/ function getTmpDir() { return $this->getRootDir().'/tmp'; } /*********************************************************************** * Description: * ������� ���������� URL ����� �����, �������� ������� ���� * Arguments: * [in] lang_ident - ������������� "�����" * Returns: * URL * Exceptions: ************************************************************************/ function getRootURL($lang_ident = '') { $_root = substr($this->getRootDir(), strlen($_SERVER['DOCUMENT_ROOT'])); $_root = str_replace('\\','/',$_root); if ($lang_ident == '') return $_root; else { $def_language = CoreLanguage::fetchDefault(); if (($lang_ident != $def_language['ident']) && ($lang_ident != 'default')) return $_root.'/'.$lang_ident; else return $_root; } } /*********************************************************************** * Description: * ������� ���������� ������ URL "����" * Arguments: * [in] node_name - ��� "����" * [in] lang_ident - ������������� "�����" * Returns: * URL ����� ����� * Exceptions: ************************************************************************/ function getNodeURL($node_name, $lang_ident='') { $node = CoreNode::fetch(array('name' => $node_name, 'module_id' => $this->active_module['id']), false); if (!$node) trigger_error('Can\'t find node by name \''.$node_name.'\'', E_USER_ERROR); return $this->getRootURL($lang_ident).$node['url']; } /*********************************************************************** * Description: * ������� ��������� "�����������" "����" * Arguments: * [in] node - ������ "����" * [in] is_parent - �������� �� node ������� "�����" (false), * ��� �� ��� ���� �� ��� ��������� (true) * Returns: * Exceptions: ************************************************************************/ function executeActions(&$core_node, $is_parent) { for ($i=0; $istop_node_actions) break; } } } /*********************************************************************** * Description: * ������� ���������� ������� ���� * Arguments: * [in] file_name - ������ ��� ����� * Returns: * Exceptions: ************************************************************************/ function responseFile($file_name, $attach_name='', $content_type ='') { $ext = explode('.', $file_name); if ($ext[1] == 'xml') header('Content-Type: text/xml'); if ($content_type != '') header('Content-Type: '.$content_type); header('Content-length: '.filesize($file_name)); header("Pragma: no-cache"); if ($attach_name != '') header('Content-Disposition: attachment; filename='.$attach_name); readfile($file_name); exit; } /*********************************************************************** * Description: * ������� ���������� ����� ���������� ������� �� ������� �� ������ * Arguments: * Returns: * ������������ ����� * Exceptions: ************************************************************************/ function getRunTime() { return floatval(CoreUtils::getMicrotime() - $this->run_start); } /*********************************************************************** * Description: * ������� ���������� HTML ��� ����������� "��������" ��������� * ���������. ��������� ������� �� ������������ �������� - ���������� * � �������������� ������ * Arguments: * [in] params - ������������� ������ ���������� : * ident - ������������� "��������" * class - ������ "������" * class_ident - ������������� "������" * theme - ������������� ���� �� ���� * "���������" � �������� * object - �������� ��� ���� "���������" * "������" * password - ��� �������� "true" * ����� �������������� * ������ "password" * hidden - ��� �������� "true" * ����� �������������� * ������ "hidden" * Returns: * HTML-����� * Exceptions: ************************************************************************/ function showAttribute($params) { if (($params['ident'] == '') || ((!$params['class']) && (!$params['class_ident'])) ) return; $class = $params['class']; if (!$class) $class = CoreClass::fetch(array('ident' => $params['class_ident'])); $object = $params['object']; $value = $params['value']; $theme = $params['theme']; $ident = $params['ident']; $password = $params['password']; $hidden = $params['hidden']; $attribute = CoreClass::fetchAttribute(array('class' => $class, 'ident' => $ident)); if ($attribute == '') return; unset($params['class']); unset($params['class_ident']); unset($params['object']); unset($params['theme']); unset($params['password']); unset($params['hidden']); unset($params['ident']); $this->smarty->assign_by_ref('attribute', $attribute); if ($object != '') $this->smarty->assign('value', $object[$attribute['ident']]); else $this->smarty->assign('value', $value); $this->smarty->assign('template_params', $params); if ($password == 'true') $type = 'password'; else if ($hidden == 'true') $type = 'hidden'; else $type = $attribute['type']; return $this->fetchTemplate($theme.'/'.$type.'.tpl'); } function fetchTemplate($tpl_name) { $_tpl = explode(':', $tpl_name); if (count($_tpl) > 1) { $this->setActiveModule(array('ident' => $_tpl[0]), true); $tpl_result = $this->smarty->fetch($_tpl[1]); $this->resetActiveModule(); return $tpl_result; } else return $this->smarty->fetch($tpl_name); } /*********************************************************************** * Description: * ������� ���������� HTML ��� ����������� ���� "���������" "������" * ��������� ��������� * Arguments: * [in] params - ������������� ������ ���������� : * ident - ������������� "������" * class - ������ "������" * theme - ������������� ���� �� ���� * "���������" � �������� * object - �������� ��� ���� "���������" * "������" * delim - ������ ������������ ��� ���������� * ��������� * password - ������ ��������������� * "���������" ��� ������� * ����� �������������� * ������ "password" * hidden - ������ ��������������� * "���������" ��� ������� * ����� �������������� * ������ "hidden" * include - ������ ��������������� * "���������" ������� * ����� ������������, �������� * ��� ��������� * exclude - ������ ��������������� * "���������" ������� �� * ����� ������������ * Returns: * HTML-����� * Exceptions: ************************************************************************/ function showClass($params) { if (($params['ident'] == '') && ($params['class'] == '')) return; if ($params['delim'] == '') $params['delim'] = 'delim.tpl'; if ($params['class']) $class = $params['class']; else $class = CoreClass::fetch(array('ident' => $params['ident'])); $theme = $params['theme']; if (trim($params['password']) > '') $password_attributes = explode(',',str_replace(' ','',$params['password'])); if (trim($params['hidden']) > '') $hidden_attributes = explode(',',str_replace(' ','',$params['hidden'])); if (trim($params['include']) > '') $include_attributes = explode(',',str_replace(' ','',$params['include'])); if (trim($params['exclude']) > '') $exclude_attributes = explode(',',str_replace(' ','',$params['exclude'])); $html = ''; for ($i=0; $i 0) && (array_search($attribute['ident'], $include_attributes) === false)) continue; if ((count($exclude_attributes) > 0) && (array_search($attribute['ident'], $exclude_attributes) !== false)) continue; $params['ident'] = $attribute['ident']; $params['class'] = &$class; $params['password'] = 'false'; $params['hidden'] = 'false'; if ((count($password_attributes) > 0) && (array_search($attribute['ident'], $password_attributes) !== false)) $params['password'] = 'true'; if ((count($hidden_attributes) > 0) && (array_search($attribute['ident'], $hidden_attributes) !== false)) $params['hidden'] = 'true'; $html .= $this->showAttribute($params); if (($i < count($class['attributes'])-1) && ($params['hidden'] != 'true')) $html .= $this->fetchTemplate($theme.'/'.$params['delim']); } return $html; } /*********************************************************************** * Description: * ������� ���������� HTML ��� ����������� ���� "���������" "������" * ��������� ��������� * Arguments: * [in] params - ������������� ������ ���������� : * class_ident - ������������� "������" * class - ������ "������" * attribute - ������������� ���� �� ���� * "���������" � �������� * value - �������� ��� ���� "���������" * "������" * delim - ������ ������������ ��� ���������� * ��������� * Returns: * HTML-����� * Exceptions: ************************************************************************/ function showListText($params) { if (isset($params['class'])) $class = $params['class']; else $class = CoreClass::fetch(array('ident' => $params['class_ident'])); if (!$class) return; $attribute = CoreClass::fetchAttribute(array('class' => $class, 'ident' => $params['attribute'])); if (!$attribute) return; if (isset($params['value'])) $value = $params['value']; else $value = $params['object'][$attribute['ident']]; $delim = $params['delim']; if ($delim == '') $delim = ', '; if ($attribute['params']['multiple']) { $_list = explode(',',$value); $result = array(); for ($i=0; $igetRootURL($params['lang_ident']).$params['url']; else $redirect = $this->getNodeURL($params['node_name'], $params['lang_ident']).$params['url']; Header('Location: '.$redirect); } /*********************************************************************** * Description: * ������� ���������� ������� ���� "�������" ��� ��������� ���� ���� * ����������. * Arguments: * [in] storage_dir - ���������� ����� * [in] storage_file - ��� ����� * Returns: * Exceptions: ************************************************************************/ function downloadStorageFile($url) { $url_parts = explode('/', $url); $storage_file = $url_parts[4]; $parts = explode('.', $storage_file); $storage_value = $parts[0]; $this->setActiveModule(array('ident' => $url_parts[1])); $file_name = $this->getRootDir().'/modules'.$url; // tmp image ? $parts = explode('_', $storage_value); if (count($parts) > 1) { $file_name = $this->getRootDir().'/tmp/images/'.$storage_file; $storage_value = $parts[0]; } $upload_file = $this->db->query('core::upload::fetchByStorageFile', array('storage_file' => $storage_value), 'object'); if ($upload_file) { $class = CoreClass::fetch(array('id' => $upload_file['class_id'])); $attribute = CoreClass::fetchAttribute(array('class' => $class, 'id' => $upload_file['attribute_id'])); $upload_handler = ''; if ($this->module->config['storage'][$class['ident']] != '') $upload_handler = $this->module->config['storage'][$class['ident']]; else if ($this->module->config['storage'][$class['ident'].'::'.$attribute['ident']] != '') $upload_handler = $this->module->config['storage'][$class['ident'].'::'.$attribute['ident']]; if ($upload_handler) { $object = CoreObject::fetch($class['ident'], $upload_file['object_id']); $storage_info = unserialize($upload_file['storage_info']); eval('$this->module->'.$upload_handler.'($class, $attribute, $object, $file_name, $storage_info);'); } else { $original_name = ''; $upload_file['storage_info'] = unserialize($upload_file['storage_info']); if ($url_parts[3] == 'files') { $original_name = $upload_file['storage_info']['original_name']; $this->responseFile($file_name, $original_name); } else { if ($upload_file['storage_info']['type'] == 'jpg') $content_type = 'image/jpeg'; else $content_type = 'image/'.$upload_file['storage_info']['type']; $this->responseFile($file_name,'', $content_type); } } } } function setSmartyPaginate($params) { if (isset($params['id'])) $pag_id = $params['id']; else $pag_id = 'list'; SmartyPaginate::disconnect(); SmartyPaginate::connect($pag_id); if (isset($params['url'])) SmartyPaginate::setUrl($params['url'], $pag_id); if (isset($params['url_var'])) SmartyPaginate::setUrlVar($params['url_var'], $pag_id); else SmartyPaginate::setUrlVar('page', $pag_id); SmartyPaginate::setLimit($params['limit'], $pag_id); if (SmartyPaginate::getCurrentItem($pag_id) > $params['count']) SmartyPaginate::setCurrentItem(SmartyPaginate::getCurrentItem($pag_id) - SmartyPaginate::getLimit($pag_id),$pag_id); SmartyPaginate::setTotal($params['count'], $pag_id); SmartyPaginate::assign($this->smarty, 'paginate_'.$pag_id, $pag_id); } function nodeCacheExist($hash, $category) { if (!isset($this->node_cache[$category])) return false; return array_key_exists($this->db->getId().$hash,$this->node_cache[$category]); } function &nodeCacheGet($hash, $category) { return $this->node_cache[$category][$this->db->getId().$hash]; } function nodeCacheSave($hash, $category, $data) { $this->node_cache_change = true; $this->node_cache[$category][$this->db->getId().$hash] = $data; } function nodeCacheClear($category) { $this->node_cache_change = true; $this->node_cache[$category] = ''; } /*********************************************************************** * Description: * ������� �������� ������ �����, � ������� ���������� ���������� * Arguments: * Returns: * Exceptions: ************************************************************************/ function run() { // �������� URL "����" $_root = str_replace("\\",'/',$this->getRootURL()); $_url = substr($_SERVER['REQUEST_URI'], strlen($_root)); $_url = explode('?',$_url); $url = $_url[0]; if (strlen($url) == 0) $url = '/'; else if ((substr($url,strlen($url)-1,1) == '/') && (strlen($url) > 1)) $url = substr($url,0,strlen($url)-1); // trigger_error('url: '.$url, E_USER_WARNING); // URL �������� ������� ? ���� �� - ������ �� ������� � // ����������� ���������� $url_parts = explode('/',$url); if (($url_parts[2] == 'design') && ($url_parts[3] == 'images')) $this->responseFile($this->getRootDir().'/modules'.$url); if (($url_parts[2] == 'design') && ($url_parts[3] == 'stylesheets')) $this->responseFile($this->getRootDir().'/modules'.$url); if (($url_parts[2] == 'design') && ($url_parts[3] == 'js')) $this->responseFile($this->getRootDir().'/modules'.$url); // ���������� ���������� ������� $this->includeClasses(); $this->run_start = CoreUtils::getMicrotime(); // ������ ����������������� ����� � ����� ������ $this->config = parse_ini_file($this->getRootDir().'/config.ini', true); session_start(); // ������������� Smarty � ���� ������ $this->initSmarty(); $this->core_db = $this->initDb($this->config['db']); $this->resetDb(); // Storage file ? if (($url_parts[2] == 'storage') && (($url_parts[3] == 'images') || ($url_parts[3] == 'files'))) { $this->downloadStorageFile($url); exit; } if (CoreCache::exists('1', 'essential')) { $this->node_cache = CoreCache::getData('1', 'essential'); } // �� URL ������ ������� "����" $parts = explode('/', $url); if ($parts[1] != '') { $languages = CoreLanguage::fetchList(); for ($i=0; $ilang = $languages[$i]; unset($parts[1]); $url = implode('/',$parts); break; } } if ($this->lang == '') $this->lang = CoreLanguage::fetchDefault(); // ���� "����" �� URL $this->node = CoreNode::fetch(array('url' => $url)); // ���� �� ������, �������� ����� �� ������� if (!$this->node) { $this->node = CoreNode::fetch(array('url_regexp' => $url)); $node_url = substr($this->node['url'],1,strlen($this->node['url'])-3); $node_url = '/'.str_replace('/','\/',$node_url).'/i'; if (preg_match($node_url, $url, $matches)) $this->url_matches = $matches; } // "����" �������� ������� ? if (intval($this->node['reference_id']) != 0) $this->node = CoreNode::fetch(array('id' => $this->node['reference_id'])); // 404 ? if (!$this->node) { if (isset($this->config['404']['redirect'])) $this->httpRedirect(array('url' => $this->config['404']['redirect'])); else if ($url != '/favicon.ico' && $url != '/robots.txt') trigger_error('Not found Node for URL \''.$url.'\'',E_USER_ERROR); exit; } $node_hash = $this->node['id']; if (CoreCache::exists($node_hash, 'nodes')) { if (!CoreCache::exists('1', 'essential')) { unset($this->node_cache['nodes']); CoreCache::saveData('1', 'essential', $this->node_cache); } $this->node_cache = CoreCache::getData($node_hash, 'nodes'); } $this->node_cache_change = false; $this->url = $url; $this->setActiveModule(array('id' => $this->node['module_id'])); // ��������� "�����������" "����" $path = CoreNode::fetchPath($this->node['id']); $this->stop_node_actions = false; for ($i=0; $iactive_module['id']) { $this->setActiveModule(array('id' => $_node['module_id']), true); $this->executeActions($_node, true); $this->resetActiveModule(); } else $this->executeActions($_node, true); if ($this->stop_node_actions) break; } if (!$this->stop_node_actions) $this->executeActions($this->node, false); // ���������� "����" if ($this->node['template_page'] == '') { $this->node['template_page'] = ''; for ($i=count($path)-1; $i>=0; $i--) { if ($path[$i]['template_page'] != '') { $page_module_id = $path[$i]['module_id']; $this->node['template_page'] = $path[$i]['template_page']; break; } } } $this->smarty->assign_by_ref('language', $this->lang); // fetch object if ($this->node['template_object'] != '') { $content = $this->smarty->fetch($this->node['template_object'], '', $this->node['module_id']); $this->smarty->assign('content', $content); } // fetch page if ($this->node['template_page'] != '') { if (($page_module_id != $this->node['module_id']) && ($page_module_id != '')) { $this->setActiveModule(array('id' => $page_module_id)); } if ($page_module_id != '') $this->smarty->display($this->node['template_page'], '', $page_module_id); else $this->smarty->display($this->node['template_page']); } $this->shutdown(false); } function shutdown($exit_flag = true) { $node_hash = $this->node['id']; if ($this->node_cache_change || !CoreCache::exists($node_hash, 'nodes')) { unset($this->node_cache['languages']); if (is_array($this->node_cache['classes'])) { $keys = array_keys($this->node_cache['classes']); for ($j=0; $jnode_cache['classes'][$keys[$j]]; for ($i=0; $inode_cache); } if ($exit_flag) exit; } } global $engine; // ������ ������ ?>