Example #1
0
 public function link($route, $args = '', $secure = false)
 {
     if (strstr($route, 'extension/') && Client::isAdmin()) {
         $this->checkExtManagerRoute($route, $args);
     }
     if (empty($this->ssl)) {
         $this->ssl = str_replace('http://', 'https://', $this->domain);
     }
     if ($this->useSSL($secure)) {
         $url = $this->get('ssl');
     } else {
         $url = $this->get('domain');
     }
     // fix if admin forgot the trailing slash
     if (substr($url, -1) != '/') {
         $url .= '/';
     }
     $url .= 'index.php?route=' . $route;
     if ($args) {
         $url .= str_replace('&', '&', '&' . ltrim($args, '&'));
     }
     foreach ($this->rewrite as $rewrite) {
         $url = $rewrite->rewrite($url);
     }
     return $url;
 }
Example #2
0
 public function output($file, $data)
 {
     if (Client::isAdmin()) {
         $output = $this->view($file . '.tpl', $data);
     } else {
         if (file_exists(Client::getDir() . 'view/theme/' . $this->config->get('config_template') . '/template/' . $file . '.tpl')) {
             $output = $this->view($this->config->get('config_template') . '/template/' . $file . '.tpl', $data);
         } else {
             $output = $this->view('default/template/' . $file . '.tpl', $data);
         }
     }
     return $output;
 }
Example #3
0
 public function getDefaultLanguage()
 {
     if (!is_object($this->config)) {
         return;
     }
     $store_id = $this->config->get('config_store_id');
     if (Client::isAdmin()) {
         $sql = "SELECT * FROM " . DB_PREFIX . "setting WHERE `key` = 'config_admin_language' AND `store_id` = '" . $store_id . "'";
     } else {
         $sql = "SELECT * FROM " . DB_PREFIX . "setting WHERE `key` = 'config_language' AND `store_id` = '" . $store_id . "'";
     }
     $query = $this->db->query($sql);
     $code = $query->row['value'];
     $language = $this->db->query("SELECT * FROM " . DB_PREFIX . "language WHERE `code` = '" . $code . "'");
     return $language->row;
 }
Example #4
0
 public function dispatch()
 {
     # B/C start
     global $registry;
     $registry = $this->registry;
     global $config;
     $config = $this->registry->get('config');
     global $db;
     $db = $this->registry->get('db');
     global $log;
     $log = $this->registry->get('log');
     # B/C end
     if (!$this->canAccessAdmin()) {
         $catalog = Client::isAdmin() ? HTTPS_CATALOG : HTTPS_SERVER;
         $this->response->redirect($catalog);
     }
     // Front Controller
     $controller = new Front($this->registry);
     // Login
     $controller->addPreAction(new Action('common/login/check'));
     // Permission
     $controller->addPreAction(new Action('error/permission/check'));
     // Router
     if (isset($this->request->get['route'])) {
         $action = new Action($this->request->get['route']);
     } else {
         $action = new Action('common/dashboard');
     }
     // Dispatch
     $controller->dispatch($action, new Action('error/not_found'));
     $this->trigger->fire('post.app.dispatch');
 }