コード例 #1
0
ファイル: Template.php プロジェクト: AcidSlide/FluxCP
 /**
  * Redirect to login page if the user is not currently logged in.
  */
 public function loginRequired($message = null)
 {
     $dispatcher = Flux_Dispatcher::getInstance();
     $dispatcher->loginRequired($this->basePath, $message);
 }
コード例 #2
0
ファイル: index.php プロジェクト: AcidSlide/FluxCP
    }
    // Initialize session data.
    Flux::$sessionData = new Flux_SessionData($_SESSION[$sessionKey], $hasUpdates);
    // Initialize authorization component.
    $accessConfig = Flux::parseConfigFile(FLUX_CONFIG_DIR . '/access.php');
    // Merge with add-on configs.
    foreach (Flux::$addons as $addon) {
        $accessConfig->merge($addon->accessConfig);
    }
    $accessConfig->set('unauthorized.index', AccountLevel::ANYONE);
    $authComponent = Flux_Authorization::getInstance($accessConfig, Flux::$sessionData);
    if (!Flux::config('DebugMode')) {
        ini_set('display_errors', 0);
    }
    // Dispatch requests->modules->actions->views.
    $dispatcher = Flux_Dispatcher::getInstance();
    $dispatcher->setDefaultModule(Flux::config('DefaultModule'));
    $dispatcher->dispatch(array('basePath' => Flux::config('BaseURI'), 'useCleanUrls' => Flux::config('UseCleanUrls'), 'modulePath' => FLUX_MODULE_DIR, 'themePath' => FLUX_THEME_DIR, 'themeName' => Flux::$sessionData->theme, 'missingActionModuleAction' => Flux::config('DebugMode') ? array('errors', 'missing_action') : array('main', 'page_not_found'), 'missingViewModuleAction' => Flux::config('DebugMode') ? array('errors', 'missing_view') : array('main', 'page_not_found')));
} catch (Exception $e) {
    $exceptionDir = FLUX_DATA_DIR . '/logs/errors/exceptions';
    if (is_writable($exceptionDir)) {
        require_once 'Flux/LogFile.php';
        $today = date('Ymd');
        $eLog = new Flux_LogFile("{$exceptionDir}/{$today}.log");
        // Log exception.
        $eLog->puts('(%s) Exception %s: %s', get_class($e), get_class($e), $e->getMessage());
        foreach (explode("\n", $e->getTraceAsString()) as $traceLine) {
            $eLog->puts('(%s) **TRACE** %s', get_class($e), $traceLine);
        }
    }
    require_once FLUX_CONFIG_DIR . '/error.php';