Пример #1
0
 function buildPage($pagePath, $innerAccess = false)
 {
     global $_PATH;
     global $REQUEST_VARS, $REQUEST_ASSOC, $_COMMON_SITE_CONF;
     $this->_EVM->fire('agregator:start', $pagePath);
     if (!$innerAccess && ($url = $this->rewrite($pagePath))) {
         return $this->buildPage($url, true);
     }
     $this->modules_out = null;
     $this->globalFields = array();
     $_SESSION['pages']['previous_page_path'] = $_SESSION['pages']['current_page_full_path'];
     $_SESSION['pages']['current_page_full_path'] = $pagePath;
     if ($pos = strpos($pagePath, '@')) {
         $_SESSION['pages']['current_page_no_filter'] = substr($pagePath, 0, $pos - 1);
     }
     if (isset($_SESSION['fronted']['enabled'])) {
         $this->frontEditMode = true;
     }
     //отделяем переменные и action
     if (preg_match("/(\\;|\\)|\\'|\"|\\!|\\<|\\>|union)/", urldecode($pagePath))) {
         return false;
     }
     $pathExploded = explode('~', $pagePath);
     $_SESSION['pages']['current_page_path'] = $pathExploded[0];
     if (!isset($pathExploded[1]) && ($pos = strpos($pathExploded[0], '@'))) {
         $pathExploded[1] = substr($pathExploded[0], $pos - 1);
         $pathExploded[0] = substr($pathExploded[0], 0, $pos);
     }
     if (isset($pathExploded[1])) {
         $this->pageParams = $pathExploded[1];
         //разбор переменных GET оформление ассоциативных массивов arrayname/key=value&key1=value
         $this->requestVarsDetect($this->pageParams);
         $_SESSION['pages']['current_get_params'] = substr($this->pageParams, 1 + strpos($this->pageParams, '/'));
     }
     if (isset($pathExploded[0])) {
         if (preg_match('/[0-9a-z_\\-\\/]/', $pathExploded[0])) {
             $treePath = XARRAY::clearEmptyItems(explode('/', $pathExploded[0]), true);
         } else {
             return false;
         }
     }
     /*
      *   action всегда  $REQUEST_VARS[0];
      *  приоритет action из $REQUEST_VARS[0] всегда выше чем у модуля по умолчанию если данное дествие разрешено
      */
     //вызов модуля страниц
     $pages = xCore::moduleFactory('pages.front');
     //    $pages->createTest();
     if (!$pages->getPageIdByPath($pathExploded[0])) {
         return false;
     }
     //кросспост
     if ($_SESSION['POST']) {
         $_POST = $_SESSION['POST'];
         unset($_SESSION['POST']);
     }
     xCore::callCommonInstance('templates');
     $templates = templatesCommon::getInstance();
     if (!$pages->page['params']['Template']) {
         return;
     }
     $templates->refreshMainTpls();
     $this->mainTemplate = $templates->getTpl($pages->page['params']['Template'], HTTP_HOST);
     $slotzCrotch = $pages->getSlotzCrotch($this->mainTemplate['slotz']);
     //добываем модули слотов ветвления
     if (!empty($pages->modulesOrder)) {
         foreach ($pages->modulesOrder as $moduleId => $priority) {
             if ($module = $pages->execModules[$moduleId]) {
                 //всегда 1 экземпляр на уровне factory
                 if (is_object($moduleObject = xCore::moduleFactory($module['params']['Type'] . '.front'))) {
                     $moduleObject->requestActionSet($this->request_action);
                     $moduleTimeStart = Common::getmicrotime();
                     $modulesOut[$moduleId] = $moduleObject->execute($module['params']);
                     $modules_crotch[$mk]['params']['__moduleExecutionTime'] = Common::getmicrotime() - $moduleTimeStart;
                 }
             }
         }
     }
     global $time;
     $y = Common::getmicrotime();
     echo $y - $time . ' modules ready ';
     while (list($slot, $modules) = each($slotzCrotch)) {
         foreach ($modules as $moduleId) {
             if (!$this->frontEditMode) {
                 $this->slotzOut[$slot] .= $modulesOut[$moduleId];
             } else {
                 /*                        while (list($module_id, $mout) = each($out))
                                         {
                                             $out[$module_id] = '<map etime="' . $modules_crotch[$module_id]['_etime'] . '" template="' . $modules_crotch[$module_id]['Template'] . '" alias="' . $modules_crotch[$module_id]['Alias'] . '" mtype="' . $modules_crotch[$module_id]['type'] . '" class="__module" id="_m' . $module_id . '">' . $mout . '</map>';
                                         }
                                         $this->modules_out[$slot] = '<form  alias="' . $tpl_slotz_all[$slot]['SlotAlias'] . '" class="__slot" id="_s' . $tpl_slotz_id[$slot] . '">' . implode('', $out) . '</form>';    
                 */
             }
         }
     }
     /*  if (($this->frontEditMode) && ($tpl_slotz_all))
         {
             //добавляем пустые слоты для FED
             foreach ($tpl_slotz_all as $slot => $source)
             {
                 $this->modules_out[$slot] = '<form alias="' . $tpl_slotz_all[$slot]['SlotAlias'] . '" class="__slot" id="_s' . $tpl_slotz_id[$slot] . '"> </form>';
             }
         }*/
     return true;
 }
Пример #2
0
 function buildMainPage($page_fields = null)
 {
     $this->_TMS->AddFileSection($this->loadModuleTpls($this->_module_name, array(array('tplName' => 'run')), true), true);
     if ($moduleList = xCore::getModuleList()) {
         $users = xCore::loadCommonClass('users');
         //$maccess=$users->roles_tree->GetChildsParam($_SESSION['user']['id'], array('is_accesible'), true);
         foreach ($moduleList as $module) {
             if ($_SESSION['user']['type'] == '_SUPERADMIN' or $_SESSION['user']['maccess'][$module['name']]) {
                 $i++;
                 $this->_TMS->AddMassReplace('js_modules', $module);
                 $this->_TMS->parseSection('js_modules', true);
                 $lang = Common::getModuleLang($this->_module_name, $_SESSION['lang'], 'modules');
                 $m = array('name' => $module['name'], 'alias' => $lang[$module['name']], 'info' => $lang[$module['name'] . '_info']);
                 $this->_TMS->AddMassReplace('fw_module', $m);
                 $column1 .= $this->_TMS->parseSection('fw_module');
                 if ($i % 3 == 0) {
                     $this->_TMS->AddReplace('fw_module_all', 'fw_module', $column1);
                     $this->_TMS->parseSection('fw_module_all', true);
                     $column1 = '';
                 }
                 $this->_TMS->AddMassReplace('module_menu', $m);
                 $menu_html = $this->_TMS->parseSection('module_menu');
                 switch ($module['moduleCategory']) {
                     case 0:
                         $mm['menu_content'] .= $menu_html;
                         break;
                     case 1:
                         $mm['menu_control'] .= $menu_html;
                         break;
                     case 2:
                         $mm['menu_special'] .= $menu_html;
                         break;
                 }
             }
         }
         $this->_TMS->AddReplace('fw_module_all', 'fw_module', $column1);
         $this->_TMS->parseSection('fw_module_all', true);
     }
     $this->_TMS->AddMassReplace('main', $mm);
     $this->_TMS->AddMassReplace('main', $this->getAdminPanelData());
     $this->_TMS->AddMassReplace('main', $page_fields);
     return $this->_TMS->parseSection('main');
 }
Пример #3
0
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();
$time = Common::getmicrotime();
$_SERVER['REQUEST_URI'] = '/group/mypage';
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();
xConfig::set('GLOBAL', 'currentMode', 'front');
xRegistry::set('EVM', xEventMachine::getInstance());
xCore::pluginEventDetector();
xConfig::set('PATH', 'fullBaseUrl', CHOST . $_SERVER['REQUEST_URI']);
xConfig::set('PATH', 'baseUrl', trim($_SERVER['REQUEST_URI']));
$position = strpos(xConfig::get('PATH', 'baseUrl'), '?');
if ($position !== false) {
    xConfig::set('PATH', 'baseUrl', substr(xConfig::get('PATH', 'baseUrl'), 0, $position, '?'));
}
require_once xConfig::get('PATH', 'XOAD') . 'xoad.php';
xCache::initialize('MemCache');
xRegistry::set('TMS', $TMS = new tMultiSection());
/*
$TMS->AddFileSection(PATH_.'templates/robots.htm');
$TMS->AddReplace('robots','paramse','hello');
$TMS->AddReplace('robots','arr',array('hell'=>'d'));
echo $TMS->ParseSection('robots');*/
//xPDO
Пример #4
0
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();
    echo $adm->dispatchAction($_GET['action']);
} else {
    $tpl = xCore::moduleFactory('templates.back');
    $adm = new adminPanel();
    //$data['xObject']=XOAD_Client::register(new adminPanel());
    $data['xConnector'] = XOAD_Client::register(new Connector());
    echo $adm->buildMainPage($data);
}
die;
Пример #5
0
define("REAL_HTTP_HOST", $m[1]);
require_once 'inc/core/helpers.php';
require_once 'conf/init.php';
require_once xConfig::get('PATH', 'CORE') . 'core.php';
require_once xConfig::get('PATH', 'ADM') . 'adm.class.php';
xRegistry::set('TMS', $TMS = new tMultiSection());
xPDO::setSource(DB_HOST, DB_NAME, DB_USER, DB_PASS);
xRegistry::set('xPDO', xPDO::getInstance());
session_start();
@session_destroy();
@session_start();
$adm = new adminPanel();
$_SESSION['lang'] = $_COMMON_SITE_CONF['default_language'];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($_POST['login'] && $_POST['password']) {
        $users = xCore::loadCommonClass('users');
        if ($users->checkAndLoadUser($_POST['login'], $_POST['password'])) {
            if ($_POST['lang']) {
                $_SESSION['lang'] = $_POST['lang'];
            }
            if ($_POST['clearGSTORAGE']) {
                $_SESSION['clearGSTORAGE'] = 1;
            }
            header('location: admin.php?');
            exit;
        }
    }
    echo $adm->showLogin(true);
} else {
    echo $adm->showLogin();
}