Ejemplo n.º 1
0
 public function display($template, $internal = false)
 {
     if ($internal) {
         $this->switchInternal();
     }
     if (\Empathy\MVC\Util\Misc::isSecure()) {
         echo str_replace('http://' . WEB_ROOT, 'https://' . WEB_ROOT, $this->smarty->fetch($template));
     } else {
         $this->smarty->display($template);
     }
 }
Ejemplo n.º 2
0
 private static function doRedirect()
 {
     $proto = \Empathy\MVC\Util\Misc::isSecure() ? 'https' : 'http';
     if (isset(self::$config['redirect'])) {
         $loc = $proto . '://' . WEB_ROOT . PUBLIC_DIR . '/' . self::$class . '/' . self::$config['redirect'];
         header('Location: ' . $loc);
         exit;
     }
 }
Ejemplo n.º 3
0
 /**
  * Redirect the user to another location within the application
  * Redirection is disabled if the MVC_TEST_MODE global flag is detected to prevent tests breaking
  * but execution always begins to end here
  *
  * @param string $endString the new URI to redirect to.
  *
  * @return void
  */
 public function redirect($endString)
 {
     $proto = \Empathy\MVC\Util\Misc::isSecure() ? 'https' : 'http';
     if (!defined('MVC_TEST_MODE')) {
         session_write_close();
         $location = 'Location: ';
         $location .= $proto . '://' . WEB_ROOT . PUBLIC_DIR . '/';
         if ($endString != '') {
             $location .= $endString;
         }
         header($location);
     } else {
         throw new TestModeException('Cannot redirect due to test mode.');
     }
 }