function usersCommon() { parent::__construct(__CLASS__); $this->_tree->setObject('_ROOT', array('LastModified')); //'Roles'-serialized array $this->_tree->setObject('_USERGROUP', array('LastModified', 'Name', 'Roles'), array('_ROOT')); $this->_tree->setObject('_SUPERADMIN', array('LastModified', 'Password', 'Name', 'Email'), array('_ROOT')); $this->_tree->setObject('_USER', array('LastModified', 'Password', 'Name', 'Email'), array('_USERGROUP')); /* $this->_tree->delete()->where(array('@id','>',1))->run(); $id = $this->_tree->initTreeObj(1, '%SAMEASID%', '_USERGROUP', array( 'StartPage' => '' )); $this->_tree->initTreeObj(1, 'admin', '_SUPERADMIN', array( 'Password' => md5(strrev('dexter')), 'Email'=>'*****@*****.**' )); */ $this->rolesTree = new xte('usersRoles_container', xRegistry::get('xPDO')); $this->rolesTree->setObject('_ROOT', array('LastModified')); $this->rolesTree->setObject('_ROLE', array('Name'), '_ROOT'); $this->rolesTree->setObject('_MODULE', array('is_accesible'), '_ROLE'); $this->rolesTree->setObject('_PERMISSION', array('module', 'obj_id', 'read', 'write', 'delete', 'deep'), '_ROLE'); $this->rv = array('update' => 1, 'delete' => 2, 'add' => 4, 'read' => 8); }
public static function getInstance($className = null) { if (!$className) { $className = get_called_class(); } if (!isset(self::$objInstances[$className])) { $instance = new ReflectionClass($className); $instance->getConstructor(); self::$objInstances[$className] = $instance->newInstance(); //регистрируем в реестре xRegistry::set($className, self::$objInstances[$className]); } return self::$objInstances[$className]; }
function __construct() { $this->_TMS = xRegistry::get('TMS'); $this->_EVM = xRegistry::get('EVM'); }
function __construct() { $this->_TMS = xRegistry::get('TMS'); xNameSpaceHolder::addObjectToNS('module.adminPanel.back', $this); }
public function getPageIdByPath($path) { global $REQUEST_VARS; $treePath = XARRAY::clearEmptyItems(explode('/', $path), true); $this->root = $this->_tree->getNodeInfo(1); $this->domain = $this->_tree->selectStruct('*')->selectParams('*')->where(array('@basic', '=', HTTP_HOST), array('@ancestor', '=', 1))->run(); $this->domain = $this->domain[0]; $langVersions = $this->getLangVersions($this->domain['id']); $langVersionsStack = XARRAY::arr_to_keyarr($langVersions, 'id', 'basic'); if (!$treePath) { if (!$this->domain['params']['StartPage']) { return; } //здесь заглушка - по умолчанию должен выбирать первую языковую версию если другое не указано $this->langVersion = $langVersions[$langVersionsStack[$this->domain['params']['StartPage']]]; if (!$this->langVersion['params']['StartPage']) { return; } //здесь заглушка - по умолчанию должен выбирать первую страницу $this->page = $this->_tree->getNodeInfo($this->langVersion['params']['StartPage']); if ($this->pageFinalPoint() === false) { return false; } else { return true; } } else { if (($lang = array_search($treePath[0], $langVersionsStack) !== false) && $langVersions[$treePath[0]]) { $this->langVersion = $langVersions[$treePath[0]]; } else { foreach ($langVersions as $lKey => $lVersion) { if ($this->domain['params']['StartPage'] == $lVersion['id']) { $this->langVersion = $langVersions[$lKey]; } } reset($langVersions); if (!$this->langVersion) { $this->langVersion = current($langVersions); } array_unshift($treePath, $this->langVersion['basic']); $this->_commonObj->nativeLangVersion = $this->langVersion['basic']; } array_unshift($treePath, HTTP_HOST); if (!($node = $this->_tree->idByBasicPath($treePath, array('_DOMAIN', '_LVERSION', '_PAGE', '_GROUP'), true))) { return false; } $this->page = $this->_tree->getNodeInfo($node['id']); if ($this->page['obj_type'] == '_PAGE') { if ($this->_tree->readNodeParam($this->page['ancestor'], 'StartPage') == $this->page['id']) { if (xRegistry::get('TPA')->pathParams) { $pathParams = '/~' . xRegistry::get('TPA')->pathParams; } $this->move_301_permanent(CHOST . '/' . $this->_commonObj->createPagePath($this->page['id'], true) . $pathParams); } } if ($this->pageFinalPoint() === false) { return false; } else { $bones = array_slice($this->page['path'], 3); $bones[] = $this->page['id']; if (!empty($bones)) { $this->bones = $this->_tree->selectStruct('*')->selectParams('*')->getBasicPath('/', true)->where(array('@id', '=', $bones))->format('keyval', 'id')->run(); } array_unshift($this->bones, $this->langVersion); return true; } } }
$_SESSION['user'] = 1; if (!isset($_SESSION['user'])) { if (!$_REQUEST['xoadCall']) { header('location: login.php'); } 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;
$connector = new connector(); @ob_end_clean(); ob_start(); if (XOAD_Server::runServer()) { if ($all = ob_get_contents()) { @ob_end_clean(); if (xConfig::get('GLOBAL', 'output_html_compress')) { echo Common::compress_output($all); } else { echo $all; } } 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); }