public function showAction() { $nodeInfo = Zend_Registry::get('nodeInfo'); $request = $this->getRequest(); $lang = $nodeInfo['LOCALE_CODE']; $view = $this->view; $view->translate()->setLocale($lang); $view->assign('docid', $request->docid); // For content rendering // $view->assign ('ctxid', $request->ctxid); // $view->assign ('dbModel', new Model_Common()); $view->assign('node_info', $nodeInfo); $view->assign('docsPath', $view->cfg['docs']['path']); $view->headTitle($view->translate('skin.oficial_site_info') . ' ' . $nodeInfo['TITLE']); $view->headLink()->appendStylesheet(array('rel' => 'shortcut icon', 'type' => 'image/x-icon', 'href' => '/img/favicon.ico')); $view->headLink()->appendStylesheet($view->baseUrl . '/modules/site/css/cont.css'); //$view->headScript()->appendFile($view->baseUrl . '/modules/site/js/script.js'); $view->headMeta()->appendName('content-language', $nodeInfo['DOC_LOCALE_CODE']); $keywords = $nodeInfo['KEYWORDS']; if (isset($keywords)) { $view->headMeta()->appendName('keywords', $keywords); } $description = $nodeInfo['DESCRIPTION']; if (isset($description)) { $view->headMeta()->appendName('description', $description); } $model = new Model_Common(); $view->link_items = $model->getMenuItems($nodeInfo['MAINLINKS_NODEID']); $view->path_items = $model->getCurrentPath($request->ctxid); $view->menu_languages = $model->getMenuLanguages($nodeInfo['SITE_NODEID']); $view->menu_items = $model->getMenuItems($nodeInfo['MENU_NODEID']); $view->content_gen = $request->getParam('content_gen', $nodeInfo['CONTENT_GEN']); $view->queryParams = $this->getRequest()->getParams(); }
public function showAction() { // $view->layout()->setLayout('contingent'); // Zend_Layout::setLayout('contingent'); $nodeInfo = Zend_Registry::get('nodeInfo'); $request = $this->getRequest(); $view = $this->view; $view->translate()->setLocale($nodeInfo['LOCALE_CODE']); $view->assign('docid', $request->docid); // $view->assign ('ctxid', $request->ctxid); // $view->assign ('dbModel', new Model_Common()); $view->assign('node_info', $nodeInfo); $view->assign('docsPath', $view->cfg['docs']['path']); $view->headTitle($view->translate('skin.oficial_site_info') . ' ' . $nodeInfo['TITLE']); $keywords = $nodeInfo['KEYWORDS']; if (isset($keywords)) { $view->headMeta()->appendName('keywords', $keywords); } $view->headLink()->appendStylesheet('/modules/contingent/css/cont.css'); $model = new Model_Common(); $view->menu_items = $model->getMenuItems($nodeInfo['MENU_NODEID']); }
public function mapAction() { $model = new Model_Common(); $nodeInfo = Zend_Registry::get('nodeInfo'); $map = $model->getMap($nodeInfo['LANGUAGE_NODEID']); $this->view->assign('map', $map); }
public function preDispatch(Zend_Controller_Request_Abstract $request) { $module = $request->getModuleName(); $controller = $request->getControllerName(); $action = $request->getActionName(); if ($module == 'auth' || $controller == 'error') { return; } $cache = $this->getCoreCache(60 * 60 * 24); // 24 часа сохраняются права для гостя $se_mask = "(Yandex|Googlebot|StackRambler|Yahoo\\! Slurp|WebAlta|msnbot|Baiduspider\\+|Speedy Spider|Sogou web spider|Subscribe|Twiceler|GingerCrawler)"; $isBot = ereg($se_mask, $_SERVER['HTTP_USER_AGENT']); if (!$isBot) { Zend_Session::start(); $ns = new Zend_Session_Namespace('tmp'); $ns->remote_addr = $_SERVER['REMOTE_ADDR']; $ns->http_user_agent = $_SERVER['HTTP_USER_AGENT']; } $auth = Zend_Auth::getInstance(); $accessID = Uman_Auth::getAccessID(); if (!$isBot && $auth->hasIdentity()) { $identity = $auth->getIdentity(); } else { if (!($identity = $cache->load("guest_ident_{$accessID}"))) { if (!Uman_Auth::login('guest', 'guest', false)) { throw new Zend_Exception('The trouble is that guest login fault :-)'); } $auth = Zend_Auth::getInstance(); $identity = $auth->getIdentity(); $cache->save($identity, "guest_ident_{$accessID}"); } } if ($identity->USERNAME != 'guest') { $ns = new Zend_Session_Namespace('acl'); $acl = $ns->acl; } else { if (!($acl = $cache->load("guest_acl_{$accessID}"))) { $acl = new Uman_Acl($identity->NODEID, $identity->PATH); $cache->save($acl, "guest_acl_{$accessID}"); } } Zend_Registry::set('auth_ident', $identity); Zend_Registry::set('acl', $acl); if ($acl->isMCAExists("{$module}_{$controller}_{$action}")) { if (!$acl->isMCAExecuteAllowed("{$module}_{$controller}_{$action}")) { $this->authRedirect($request); } } else { $right = 'RIGHT_' . strtoupper($controller . '_' . $action); if (!defined('RIGHT')) { define('RIGHT', $right); } if ($module == 'admin' || $controller == 'admin') { $request->setParam('show_error', 1); // Для админки отображать полные сообщения об ошибках return; } $dbModel = new Model_Common(); if (@(!is_numeric($request->docid)) && !$request->ctxid) { // Если в url нет параметра docid $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $href = null; $uri = $request->getRequestUri(); if (strpos($uri, '.htm')) { $docid = substr($uri, strrpos($uri, '/') + 1, strrpos($uri, '.htm') - strrpos($uri, '/') - 1); if (@is_numeric($docid)) { $newNode = $dbModel->getNewNode($docid); } if (@$newNode) { $href = $newNode['HREF']; $redirector->setCode(301); } else { throw new Zend_Controller_Dispatcher_Exception("Resource '{$docid}' not found."); } } if (!$href) { Zend_Locale::setDefault('en'); $locale = new Zend_Locale(); // (Zend_Locale::BROWSER); $language = $locale->getLanguage(); $siteID = $dbModel->getSite($language); if (!$siteID) { throw new Zend_Exception('Main site not found'); } $docid = $siteID['NODEID']; $href = "page/show/docid/{$docid}"; } $redirector->gotoUrlAndExit($href); } $docid = $request->docid; //substr($request->docid, 0, strlen($request->docid)-5); // Remove .html if (@(!is_numeric($docid))) { $docid = $dbModel->getNodeID($docid); } $ctxid = $request->getParam('ctxid', $docid); $nodeInfo = $dbModel->getNodeInfo($ctxid); Zend_Registry::set('nodeInfo', $nodeInfo); $request->setParam('docid', $docid); $request->setParam('ctxid', $ctxid); if (!$acl->isPathAllowed($nodeInfo['FULL_PATH']) || $ctxid != $docid && !$acl->isNodeByPathAllowed($ctxid)) { $this->authRedirect($request); } } }
/** * runDb * @param array POST値 * @return array array(DB操作ステータス,エラー配列) * @Author fujimura * submitボタンのPOST値を元に処理を振り分ける */ public static function runDb($post, $savetype, $fieldset) { //バリデーションの実行(失敗時$errorにエラーメッセージが入る) $errors = Model_Common::validation_run($fieldset); $db_status = true; //バリデーション成功時 if (empty($errors)) { //データセーブ $db_status = call_user_func_array($savetype, array($post)); } else { //エラーメッセージ取得 $errors = Model_Common::get_error_message($errors); } return array($db_status, $errors); }