public static function write($data, $module, $id, $timeout = null) { if ($timeout === null) { $timeout = xConfig::get('GLOBAL', 'cacheTimeout'); } self::$memcache->set($module . md5($id), $data, 0, time() + $timeout); }
public static function readFile($module, $file) { global $_PATH; if (file_exists($file = xConfig::get('PATH', 'CACHE') . '/' . $module . '/' . $file)) { if ($res = file_get_contents($file)) { return $res; } } }
function compress_js_output($input, $fileflag = false, $level = 9) { if ($fileflag) { if (in_array(getExtension($input), array('.js'))) { $all = compress_file(PATH_ . $input, xConfig::get('GLOBAL', 'output_js_compress')); } else { $all = gzencode($all, $level); } } elseif (xConfig::get('GLOBAL', 'output_js_compress')) { $all = gzencode($input, $level); } else { echo $input; return; } if (!IE() && xConfig::get('GLOBAL', 'output_js_compress')) { if (@$_SERVER["HTTP_ACCEPT_ENCODING"] && FALSE !== strpos($_SERVER["HTTP_ACCEPT_ENCODING"], 'gzip')) { header('Content-Encoding: gzip'); header('Content-Length: ' . strlen($all)); } } echo $all; }
function show_e404_page() { global $_COMMON_SITE_CONF; header("HTTP/1.0 404 Not Found"); $this->_TMS->AddFileSection(xConfig::get('PATH', 'TEMPLATES') . '404.htm'); $this->_TMS->AddMassReplace('main', array('link_main_page' => HOST, 'admin_email' => 'mailto:' . $_COMMON_SITE_CONF['admin_email'])); echo $this->_TMS->parseSection('main'); die; }
function getAdminPanelData() { static $apd = array(); if (!$apd) { $apd['version'] = xCore::getVersion(); $apd['charset'] = xConfig::get('GLOBAL', 'site_encoding'); $apd['lisence'] = xCore::getLicense(); if (class_exists('XOAD_Utilities')) { $apd['xoadHeader'] = XOAD_Utilities::header(xConfig::get('WEBPATH', 'XOAD')); } $apd['lang'] = $_SESSION['lang']; $apd['siteByDefault'] = HOST; $apd['XJS'] = xConfig::get('WEBPATH', 'XJS'); } return $apd; }
public static function getAdminTpl($tpl) { return xConfig::get('PATH', 'ADM') . 'tpl/' . $tpl; }
} else { echo 'SESSION_TIME_EXPIRED'; die; } } require_once 'inc/core/helpers.php'; require_once 'conf/init.php'; require_once xConfig::get('PATH', 'CORE') . 'core.php'; require_once xConfig::get('PATH', 'CORE') . 'helpers.tpl.php'; xRegistry::set('TMS', $TMS = new tMultiSection()); xPDO::setSource(DB_HOST, DB_NAME, DB_USER, DB_PASS); xRegistry::set('xPDO', xPDO::getInstance()); xNameSpaceHolder::addObjectToNS('E', new ENHANCE()); require_once xConfig::get('PATH', 'XOAD') . 'xoad.php'; require_once xConfig::get('PATH', 'ADM') . 'logger.class.php'; require_once xConfig::get('PATH', 'ADM') . 'adm.class.php'; if ($_REQUEST['xoadCall']) { ob_start(); $adm = new adminPanel(); $adm->startMapping(); if (XOAD_Server::runServer()) { $all = ob_get_contents(); ob_end_clean(); if ($_COMMON_SITE_CONF['output_html_compress']) { Common::compress_output($all); } echo $all; exit; } } elseif ($_REQUEST['action']) { $adm = new adminPanel();
} exit; } } else { xRegistry::set('TPA', $TPA = new tPageAgregator()); if (isset($_GET['action'])) { $TPA->dispatch_action($_GET['action']); } elseif ($page = $TPA->execute_page(xConfig::get('PATH', 'baseUrl'))) { if ($TPA->FED_MODE) { $xConnector = new Connector(); $xConnector_obj = XOAD_Client::register($xConnector, array('url' => '/admin.php')); $TMS->AddFileSection($_PATH['ADM'] . 'tpl/FED.html'); $TMS->AddMassReplace('FED', array('front_obj' => XOAD_Client::register(new front_api()), 'xConnector' => $xConnector_obj, 'xoad_header' => XOAD_Utilities::header($_WEBPATH['XOAD']))); $page = preg_replace(array('#<script[^>]*>.*?</script>#is'), array(''), $page); $page .= $TMS->parseSection('FED'); } $all = $page; if (xConfig::get('GLOBAL', 'enable_page_caching') && !$TPA->DisablePageCaching && !$TPA->FED_MODE) { $cache->toCache($all); } if (xConfig::get('GLOBAL', 'show_debug_info')) { $y = Common::getmicrotime() - $x; $all .= '<!-- ' . $y . ' -->'; } if (xConfig::get('GLOBAL', 'output_html_compress')) { $all = Common::compress_output($all); } echo $all; } } die;
<?php define('DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT']); ini_set('session.gc_maxlifetime', '18000'); preg_match('@^(?:www.)?([^/]+)@i', $_SERVER['HTTP_HOST'], $m); define('REAL_HTTP_HOST', $m[1]); require_once DOCUMENT_ROOT . '/inc/core/helpers.php'; ob_start(); require_once DOCUMENT_ROOT . '/conf/init.php'; require_once xConfig::get('PATH', 'CORE') . 'core.php'; require_once xConfig::get('PATH', 'CORE') . 'helpers.tpl.php'; require_once xConfig::get('PATH', 'CLASSES') . 'cache.class.php'; session_start(); //xPDO xPDO::setSource(DB_HOST, DB_NAME, DB_USER, DB_PASS); xRegistry::set('xPDO', xPDO::getInstance()); $pages = new xTreeEngine('pages_container'); $source = Common::classesFactory('treeJsonSource', array(&$pages)); $p = array('pp'); $opt = array('nested' => array('_GROUP', '_DOMAIN', '_LVERSION'), 'columns' => array('id' => array(), 'obj_type' => array('name' => 'objType'), '>StartPage' => array())); $source->setOptions($opt); $r = $source->createView(1);
/** * переиндексация шаблонов согласно домену */ function processTemplate($tplDomain, $tpls) { foreach ($tpls as $tpl) { $TMS = new tMultiSection(); $tplFullPath = xConfig::get('PATH', 'COMMON_TEMPLATES') . $tplDomain . '/' . $tpl['tpl']; //слоты шаблона $name = $TMS->AddFileSection($tplFullPath); //если не относиться к главным шаблонам if (!$tpl['main']) { if ($tpl['lang']) { $lang = '@' . $tpl['lang']; } $tplMainForDomain = xConfig::get('PATH', 'COMMON_TEMPLATES') . $tplDomain . '/_index' . $lang . '.html'; $TMS->AddFileSection($tplMainForDomain); } //Глобальный кроссдоменный шаблон $TMS->AddFileSection(xConfig::get('PATH', 'COMMON_TEMPLATES') . '_index.html'); $registeredFields = $TMS->MainFields; $tplData = array('lastModified' => time(), 'slotz' => $TMS->MainFields, 'name' => $name, 'lang' => $tpl['lang'], 'path' => $tplDomain . '/' . $tpl['tpl']); $this->setTplData($tplDomain . '/' . $tpl['tpl'], $tplData); } }
public function linkCreator($basicPath, $domain = null) { if (!$domain) { $domain = xConfig::get('GLOBAL', 'DOMAIN'); } $link = 'http://' . $domain; if (!$this->nativeLangVersion) { $link .= '/' . $this->nativeLangVersion; } if ($basicPath) { $bPath = array_slice($basicPath, 2); $link .= '/' . implode('/', $bPath); } return $link; }
$_COMMON_SITE_CONF['deny_files_upload_extensions'] = array('php', 'phtml', 'php3', 'php4', 'php5', 'htaccess'); $_COMMON_SITE_CONF['do_not_translit_in_file_manager'] = false; xConfig::setBranch('GLOBAL', $_COMMON_SITE_CONF); xConfig::set('GLOBAL', 'cacheTimeout', 3600); xConfig::set('GLOBAL', 'DOMAIN', HTTP_HOST); xConfig::set('GLOBAL', 'HOST', 'http://' . HTTP_HOST . '/'); xConfig::set('GLOBAL', 'CHOST', 'http://' . HTTP_HOST); xConfig::set('GLOBAL', 'output_js_back_compress', 1); $_CONFIG['content']['show_content']['m_caching'] = 1; $_CONFIG['pages']['show_level_menu']['m_caching'] = 1; $_CONFIG['pages']['show_path']['m_caching'] = 1; $_CONFIG['catalog']['show_level_catmenu']['m_caching'] = 1; $_CONFIG['catalog']['show_category']['m_caching'] = 1; $_CONFIG['catalog']['show_catalog_server']['m_caching'] = 1; $_CONFIG['catalog']['catalog_filter']['m_caching'] = 1; $_CONFIG['catalog']['showcat']['m_caching'] = 1; $_CONFIG['catalog']['showobj']['m_caching'] = 1; $_CONFIG['catalog']['show']['m_caching'] = 1; $_CONFIG['news']['show_news_interval']['m_caching'] = 1; $_CONFIG['ishop']['admin_rows_per_page'] = 20; $_CONFIG['news']['admin_rows_per_page'] = 20; $_CONFIG['news']['show_news_per_page'] = 15; $_CONFIG['news']['date_format'] = '%d.%m.%Y %H:%i:%s'; $_CONFIG['news']['show_similar_news_per_news'] = 15; $_CONFIG['faq']['question_words_count'] = 15; $_CONFIG['faq']['admin_rows_per_page'] = 15; $_CONFIG['search']['index_time_limit'] = 10; $_CONFIG['catalog']['excelparser'] = 'ExcelExplorer'; //возможен 'ExcelReader' xConfig::setBranch('MODULES', $_CONFIG);