コード例 #1
0
ファイル: Fajr.php プロジェクト: BGCX067/fajr-svn-to-git
 /**
  * Runs the whole logic. It is fajr's main()
  *
  * @returns void
  */
 public function run()
 {
     $this->injector->getInstance('SessionInitializer.class')->startSession();
     $timer = new SystemTimer();
     // TODO(ppershing): use injector here!
     $trace = new NullTrace();
     if (FajrConfig::get('Debug.Trace') === true) {
         $trace = new HtmlTrace($timer, "--Trace--");
     }
     try {
         Input::prepare();
         $this->regenerateSessionOnLogin();
         $connection = $this->provideConnection();
         $this->runLogic($trace, $connection);
     } catch (LoginException $e) {
         if ($connection) {
             FajrUtils::logout($connection);
         }
         DisplayManager::addException($e);
     } catch (Exception $e) {
         DisplayManager::addException($e);
     }
     DisplayManager::setBase(hescape(FajrUtils::basePath()));
     $trace->tlog("everything done, generating html");
     if (FajrConfig::get('Debug.Trace') === true) {
         $traceHtml = $trace->getHtml();
         DisplayManager::addContent('<div class="span-24">' . $traceHtml . '<div> Trace size:' . sprintf("%.2f", strlen($traceHtml) / 1024.0 / 1024.0) . ' MB</div></div>');
     }
     echo DisplayManager::display();
 }
コード例 #2
0
ファイル: index.php プロジェクト: BGCX067/fajr-svn-to-git
 * Wrong www root detection.
 */
if (!defined('_FAJR')) {
    die('<html><head>' . '<title>Varovanie</title>' . '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . '</head><body>' . '<h1>Varovanie</h1>' . '<p>Máte zle nastavený server, tento súbor by nemal byť ' . 'priamo prístupný. Prosím nastavte server tak, aby sa dalo ' . 'dostať len k podadresáru <code>web</code> a použite ' . '<code>index.php</code> v ňom</p>' . '</body></html>');
}
// TODO(ppershing): create helper objects and configuration modules for these constants
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set('Europe/Bratislava');
mb_internal_encoding("UTF-8");
// register Symfony autoloader first, because ours will eat the loading instead.
require_once '../third_party/symfony_di/lib/sfServiceContainerAutoloader.php';
sfServiceContainerAutoloader::register();
// register our autoloader
require_once 'libfajr/libfajr.php';
Loader::register();
Loader::searchForClasses(dirname(__FILE__), true);
// TODO(ppershing): move this to libfajr/Loader.php as that is the right place for it
require_once 'libfajr/Assert.php';
// is there configuration.php file present?
if (!FajrConfig::isConfigured()) {
    DisplayManager::addContent('notConfigured', true);
    echo DisplayManager::display();
    session_write_close();
    die;
}
// bootstrapping whole application
$modules = array(new SessionInitializerModule(), new TraceModule());
$injector = new Injector($modules);
$fajr = new Fajr($injector);
$fajr->run();
session_write_close();