コード例 #1
0
ファイル: Widget.php プロジェクト: piratevn/cms-gio
 protected function showAction()
 {
     $request = $this->getRequest();
     $this->view->zoneId = $this->getParam('zone_id');
     $this->view->containerId = uniqid('adZone_');
     $route = Gio_Core_Route::getInstance()->getCurrentRoute();
     $this->view->route = $route['name'];
     $this->view->url = $request->getRedirectUrl();
 }
コード例 #2
0
ファイル: Csrf.php プロジェクト: piratevn/cms-gio
 public function __construct($routeName)
 {
     if (isset($config['salt'])) {
         $this->_salt = $config['salt'];
     }
     if (isset($config['name'])) {
         $this->_name = $config['name'];
     }
     if (isset($config['timeout'])) {
         $this->_timeout = $config['timeout'];
     }
     $routes = Gio_Core_Route::getInstance()->getRoutes();
     if ($routeName && isset($routes[$routeName])) {
         $defaults = $routes[$routeName];
         if (isset($defaults['csrf']) && 'true' == (string) $defaults['csrf']['enable']) {
             $this->_csrfEnable = true;
             $this->_csrfRequestMethod = strtoupper($defaults['csrf']['request']);
             $this->_csrfRetriveMethod = strtoupper($defaults['csrf']['retrive']);
         }
     }
 }
コード例 #3
0
ファイル: Permalink.php プロジェクト: piratevn/cms-gio
 public function run()
 {
     $request = Gio_Core_Request::getInstance();
     $configs = Gio_Core_Config_Xml::getConfig('web');
     /**
      * Do nothing if we are in page of managing permalink
      */
     $uri = $request->getRequestUri();
     $uri = strtolower($uri);
     $uri = rtrim($uri, '/') . '/';
     $adminPrefix = $configs->admin->url_prefix;
     $adminPrefix = rtrim(ltrim($adminPrefix, '/'), '/');
     if (is_int(strpos($uri, '/' . $adminPrefix . '/core/permalink'))) {
         return;
     }
     $defaultFile = ROOT_DIR . DS . 'configs' . DS . 'permalink.xml';
     $host = $request->getServerName();
     $host = substr($host, 0, 3) == 'www' ? substr($host, 4) : $host;
     $file = ROOT_DIR . DS . 'configs' . DS . $host . '.' . 'permalink.xml';
     $file = file_exists($file) ? $file : $defaultFile;
     if (!file_exists($file)) {
         return;
     }
     $route = Gio_Core_Route::getInstance();
     $config = @simplexml_load_file($file);
     if (!isset($config->item) || empty($config->item)) {
         return;
     }
     $categoryConfig = Gio_Core_Module::getConfig('category');
     $param = isset($categoryConfig['url']['param']) ? $categoryConfig['url']['param'] : 'category_id';
     foreach ($config->item as $index => $item) {
         $item = (array) $item;
         if (!in_array($item['name'], $this->_inArray)) {
             $route->setRoute($item['name'], $item);
         } elseif ($param == 'category_path' && in_array($item['name'], $this->_inArray)) {
             $route->setRoute($item['name'], $item);
         }
     }
 }
コード例 #4
0
ファイル: LinkProvider.php プロジェクト: piratevn/cms-gio
 public static function getLinks($lang = null)
 {
     if (null == $lang) {
         $lang = Gio_Core_Config_Xml::getConfig('web')->language;
     }
     $view = Gio_Core_View::getInstance();
     $router = Gio_Core_Route::getInstance();
     $results = array();
     $links = array();
     /**
      * Add the homepage link
      */
     $links['core_index_index'][] = array('href' => $view->url('core_index_index', array('language' => $lang)));
     $links = Gio_Core_Hook_Registry::getInstance()->executeFilter('Core_LinkProvider', $links, array($lang));
     foreach ($links as $routeName => $value) {
         /**
          * Get route description
          */
         $defaults = $router->getRoute($routeName);
         $description = isset($defaults['langKey']) ? $view->TRANSLATOR->translator($defaults['langKey'], $defaults['module'], $lang) : $routeName;
         $results[$routeName] = array('description' => $description, 'links' => $value);
     }
     return $results;
 }
コード例 #5
0
ファイル: Page.php プロジェクト: piratevn/cms-gio
 public function editAction()
 {
     $request = $this->getRequest();
     $template = $request->getParam('template_id');
     $this->view->template = $template;
     $pageId = $request->getParam('page_id');
     $page = Modules_Core_Services_Page::getById($pageId);
     if (null == $page) {
         return;
     }
     $page['template_id'] = $template;
     $this->view->pageData = $page;
     $dbRoutesPage = Modules_Core_Services_Page::dbPages('route');
     $routes = array();
     if ($dbRoutesPage) {
         foreach ($dbRoutesPage as $index => $route) {
             $routes[] = $route['route'];
         }
     }
     $this->view->dbRoutesPage = $routes;
     $routesFrontend = Gio_Core_Route::getInstance()->getRoutes(true);
     $this->view->routesFrontend = $routesFrontend;
     if ($request->isPost()) {
         $pageData = $request->getPost('page');
         $pageData = Modules_Core_Services_Page::validate($pageData);
         if (isset($pageData['messages_error']) && $pageData['messages_error']) {
             $this->view->errorMessages = $pageData['messages'];
             $pageData['page_id'] = $pageId;
             $pageData['template_id'] = $template;
             $this->view->pageData = $pageData;
             return;
         }
         if (in_array($pageData['route'], $routes) && $page['route'] != $pageData['route']) {
             Gio_Core_Messenger::getInstance()->addMessage($this->view->TRANSLATOR->translator('page_actions_edit_exist'));
             $this->redirect($this->view->url('core_page_edit', $page));
             return;
         }
         Modules_Core_Services_Page::update($pageData);
         Gio_Core_Messenger::getInstance()->addMessage($this->view->TRANSLATOR->translator('page_actions_edit_success'));
         $this->redirect($this->view->url('core_page_edit', $page));
     }
 }
コード例 #6
0
ファイル: View.php プロジェクト: piratevn/cms-gio
 public function url($name, $params = array())
 {
     return Gio_Core_Route::getInstance()->get($name, $params);
 }