Exemplo n.º 1
0
 function __construct($message, $code = "Page cannot be found", $status = "404")
 {
     if ($location = self::$redirect_on_error) {
         $this->error_heading = $code;
         $this->error_message = $this->format_trace($this);
         $this->error_site = str_ireplace("www.", '', $_SERVER['HTTP_HOST']);
         $this->error_site = substr($this->error_site, 0, strpos($this->error_site, '.'));
         $this->error_site_name = ucwords(Inflections::humanize($this->error_site));
         $this->simple_routing_error_log();
         if (!self::$double_redirect) {
             self::$double_redirect = true;
             header("HTTP/1.1 404 Not Found", 1, 404);
             if (is_readable(PUBLIC_DIR . ltrim($location, "/"))) {
                 $content = file_get_contents(PUBLIC_DIR . ltrim($location, "/"));
                 foreach (self::$replacements as $value => $replace) {
                     $content = str_ireplace($replace, $this->{$value}, $content);
                 }
                 ob_end_clean();
                 echo $content;
                 exit;
             }
             $_GET["route"] = $location;
             WaxUrl::$params = false;
             WaxUrl::perform_mappings();
             $delegate = Inflections::slashcamelize(WaxUrl::get("controller"), true) . "Controller";
             $delegate_controller = new $delegate();
             $delegate_controller->execute_request();
             exit;
         } else {
             WaxLog::log("error", "[Routing] Double redirect error");
             $code = "Application Error";
             $message = "A Page not found error was triggered and you have not set up a page to handle it";
         }
     }
     parent::__construct($message, $code);
 }
Exemplo n.º 2
0
/*********************************************************************************************/



/************ Application Error Handling *******************************************************
*
*  When you're running in production mode, you don't want your errors displayed to users.
*  The following commands can be uncommented to handle errors professionally.
*  Firstly the routing redirect_on_error gives a location for a 404 error (page not found)
*  The second redirect_on_error is an application error page.
*  Both of these can be either actions in your application or static pages.
*  
*  Finally email_on_error accepts an email address and email_subject_on_error a text subject.
*  If these are set a copy of the error trace will be emailed to the address. */

WXRoutingException::$redirect_on_error = "/404.html"; // Page not found error

// Application Error and an email address and subject to send details to.
WXException::$redirect_on_error = "/error.html";
//WXException::$email_on_error="";
//WXException::$email_subject_on_error="";
/*********************************************************************************************/


/*********************************************************************************************/

/*********** Your Additional Application Configuration ***************************************
*  This file is run at boot time so if you want to set any systemwide configuration values, 
*  you can do so below this point */

Exemplo n.º 3
0
    define('FRAMEWORK_DIR', WAX_PATH . "/phpwax/releases/" . WAX_VERSION . "/wax");
} else {
    ini_set('include_path', ini_get("include_path") . ":" . WAX_PATH . "/phpwax/releases/latest/wax");
    define('FRAMEWORK_DIR', WAX_PATH . "/phpwax/releases/latest/wax");
}
ini_set('include_path', ini_get("include_path") . ":" . WAX_ROOT);
require_once FRAMEWORK_DIR . "/AutoLoader.php";
/*********************************************************************************************/
/************ Application Error Handling *******************************************************
*
*  When you're running in production mode, you don't want your errors displayed to users.
*  The following commands can be uncommented to handle errors professionally.
*  Firstly the routing redirect_on_error gives a location for a 404 error (page not found)
*  The second redirect_on_error is an application error page.
*  Both of these can be either actions in your application or static pages.
*  
*  Finally email_on_error accepts an email address and email_subject_on_error a text subject.
*  If these are set a copy of the error trace will be emailed to the address. */
WXRoutingException::$redirect_on_error = "/404.html";
// Page not found error
// Application Error and an email address and subject to send details to.
WXException::$redirect_on_error = "/error.html";
//WXException::$email_on_error="";
//WXException::$email_subject_on_error="";
/*********************************************************************************************/
/*********************************************************************************************/
/*********** Your Additional Application Configuration ***************************************
*  This file is run at boot time so if you want to set any systemwide configuration values, 
*  you can do so below this point */
Autoloader::include_from_registry('SiteHelper');
Autoloader::register_helpers();