public function GET($matches)
 {
     $location = app\core\Config::get("general", "hostname") . app\core\Config::get("general", "subdir");
     include APPPATH . "template/header.php";
     include APPPATH . "template/documentation.php";
     include APPPATH . "template/footer.php";
 }
Example #2
0
 function GET($matches)
 {
     // get the current URL
     $location = app\core\Config::get("general", "hostname") . app\core\Config::get("general", "subdir");
     $pageURL = $location . $matches[0];
     $pageURL = rtrim($pageURL, "/");
     //add .about before the ?
     if (sizeof($_GET) > 0) {
         $pageURL = str_replace("?", ".about?", $pageURL);
         $pageURL = str_replace("/.about", ".about", $pageURL);
     } else {
         $pageURL .= ".about";
     }
     header("HTTP/1.1 303 See Other");
     header("Location:" . $pageURL);
 }
Example #3
0
/**
 * This function is called when an unexpected error(non-exception) occurs
 * @param integer $number Number of the level of the error that's been raised.
 * @param string  $string Contains errormessage.
 * @param string  $file   Contains the filename in which the error occured.
 * @param integer $line   Represents the linenumber on which the error occured.
 * @param string  $context Context is an array that points to the active symbol table at the point the error occurred. In other words, errcontext will contain an array of every variable that existed in the scope the error was triggered in. User error handler must not modify error context.
 */
function wrapper_handler($number, $string, $file, $line, $context)
{
    global $log;
    $error_message = $string . " on line " . $line . " in file " . $file . ".";
    $log = new Logger('bootstrap');
    $log->pushHandler(new StreamHandler(app\core\Config::get("general", "logging", "path") . "/log_" . date('Y-m-d') . ".txt", Logger::ERROR));
    $log->addError($error_message);
    echo "<script>location = \"" . app\core\Config::get("general", "hostname") . app\core\Config::get("general", "subdir") . "error/critical\";</script>";
    set_error_header(500, "Internal Server Error");
    //No need to continue
    exit(0);
}
Example #4
0
File: router.php Project: tdt/start
    unset($allroutes[$key]);
}
$routes = array();
// Drop the HTTP method from the route
foreach ($allroutes as $route => $controller) {
    $route = preg_replace('/^' . strtoupper($_SERVER['REQUEST_METHOD']) . '(\\s|\\t)*\\|(\\s|\\t)*/', "", trim($route));
    $routes[trim($route)] = trim($controller);
}
//$log->logInfo("The routes we are working with", $routes);
try {
    // This function will do the magic.
    Glue::stick($routes);
} catch (Exception $e) {
    // Instantiate a Logger
    $log = new Logger('router');
    $log->pushHandler(new StreamHandler(app\core\Config::get("general", "logging", "path") . "/log_" . date('Y-m-d') . ".txt", Logger::ERROR));
    // Generator to generate an error page
    $generator = new Generator();
    $generator->setTitle("The DataTank");
    if ($e instanceof tdt\exceptions\TDTException) {
        // DataTank error
        $log->addError($e->getMessage());
        set_error_header($e->getCode(), $e->getShort());
        if ($e->getCode() < 500) {
            $generator->error($e->getCode(), "Sorry, but there seems to be something wrong with the call you've made", $e->getMessage());
        } else {
            $generator->error($e->getCode(), "Sorry, there seems to be something wrong with our servers", "If you're the system administrator, please check the logs. Otherwise, check back in a short while.");
        }
    } else {
        // General error
        $log->addCritical($e->getMessage());