Example #1
0
 function parse_http_request()
 {
     parent::parse_http_request();
     if (!empty($_POST)) {
         $this->params = array_merge($this->params, $_POST);
     }
     $default_view_file = $this->view_path . $this->controller . '/' . $this->action . '.php';
     if (file_exists($default_view_file)) {
         $this->view = new Uigu2_View($default_view_file);
     }
     return $this;
 }
Example #2
0
 function __construct($controller_path = 'controllers/', $web_folder = WEB_FOLDER, $default_controller = DEFAULT_ROUTE, $default_function = DEFAULT_ACTION)
 {
     // generic redirection for secure connections (assuming that ssl is on port 443)
     if (defined('SSL') && SSL && $_SERVER['SERVER_PORT'] != "443") {
         header('Location: ' . url(request_uri()));
     }
     // html cache on only in production
     $cached = DEBUG ? false : $this->_pageCache();
     if (!empty($cached)) {
         echo $cached;
         // exit now
         exit;
         //return;
     }
     // add the config in the data object
     $this->data['config'] = $GLOBALS['config'];
     // add admin flag
     if (array_key_exists('admin', $_SESSION)) {
         $this->data['admin'] = $_SESSION['admin'];
     }
     // set the template the controller is using
     $template = strtolower(get_class($this)) . ".php";
     $this->data['template'] = is_file(TEMPLATES . $template) ? $template : false;
     // #116 add site info in the client object
     $GLOBALS['client']['site']['name'] = $GLOBALS['config']['main']['site_name'];
     $url = url();
     // FIX: removing ending slash
     $GLOBALS['client']['site']['url'] = substr($url, -1) == "/" ? substr($url, 0, -1) : $url;
     parent::__construct($controller_path, $web_folder, $default_controller, $default_function);
 }