function &factory($name)
 {
     $name = empty($name) ? APPLICATION_DEFAULT_PAGE : $name;
     include_once $file = PAGE_FACTORY_SEARCH_DIR . $name . '.php';
     if (!class_exists($classname = 'Page_' . basename($file, '.php'))) {
         if ($name == APPLICATION_404_PAGE) {
             return PEAR::raiseError(null, PAGE_FACTORY_ERROR_NOT_FOUND, null, null, null, 'PageFactory_Error', true);
         } else {
             HTTP_Header::redirect(SAURL::url(APPLICATION_404_PAGE));
             exit;
         }
     }
     $obj =& new $classname();
     return $obj;
 }
 function SApplication()
 {
     $this->_updateMeStatic();
     if (ENABLE_PROFILING) {
         include_once 'Benchmark/Timer.php';
         $this->_timer =& new Benchmark_Timer();
         $this->_timer->start();
     }
     parent::PEAR();
     $u = SAURL::restore();
     if (PEAR::isError($u)) {
         if ($u->getCode() == URL_MANIPULATION) {
             HTTP_Header::redirect(SAUrl::Url(APPLICATION_401_PAGE));
             exit;
         }
     }
 }
Beispiel #3
0
<?php

require_once 'HTTP/Header.php';
$h =& new HTTP_Header();
$s = 200;
foreach ($_GET as $header => $value) {
    if (!strcasecmp('redirect', $header)) {
        HTTP_Header::redirect($value);
    }
    if (strcasecmp('status', $header)) {
        $h->setHeader($header, $value);
    } else {
        $s = $value;
    }
}
$h->sendHeaders();
$h->sendStatusCode($s);