Пример #1
0
require '../../../config.inc.php';
try {
    $request = HttpRequest::create()->setGet($_GET)->setPost($_POST)->setCookie($_COOKIE)->setServer($_SERVER)->setSession($_SESSION)->setFiles($_FILES);
    $controllerName = 'main';
    if (isset($_GET['area']) && is_readable(PATH_CONTROLLERS . $_GET['area'] . EXT_CLASS)) {
        $controllerName = $_GET['area'];
    }
    $controller = new AuthorizationFilter(new $controllerName());
    $modelAndView = $controller->handleRequest($request);
    $view = $modelAndView->getView();
    $model = $modelAndView->getModel();
    $prefix = PATH_WEB_ADMIN . '?area=';
    if (!$view) {
        $view = $controllerName;
    } elseif (is_string($view) && $view == 'error') {
        $view = new RedirectView($prefix);
    } elseif ($view instanceof RedirectToView) {
        $view->setPrefix($prefix);
    }
    if (!$view instanceof View) {
        $viewName = $view;
        $view = PhpViewResolver::create(PATH_TEMPLATES, EXT_TPL)->resolveViewName($viewName);
    }
    if (!$view instanceof RedirectView) {
        $model->set('selfUrl', $_SERVER['PHP_SELF'] . '?area=' . $controllerName)->set('baseUrl', $_SERVER['PHP_SELF']);
    }
    $view->render($model);
} catch (Exception $e) {
    $uri = $_SERVER['HTTP_HOST'] . $_SERVER["REQUEST_URI"];
    $msg = 'class: ' . get_class($e) . "\n" . 'code: ' . $e->getCode() . "\n" . 'message: ' . $e->getMessage() . "\n\n" . $e->getTraceAsString() . "\n" . "\n_POST=" . var_export($_POST, true) . "\n_GET=" . var_export($_GET, true) . (isset($_SERVER['HTTP_REFERER']) ? "\nREFERER=" . var_export($_SERVER['HTTP_REFERER'], true) : null) . (isset($_SESSION) ? "\n_SESSION=" . var_export($_SESSION, true) : null);
    if (defined('__LOCAL_DEBUG__')) {
 private function makeCheckIdRequest(OpenIdCredentials $credentials, HttpUrl $returnTo, $trustRoot = null, $association = null)
 {
     Assert::isTrue($returnTo->isValid());
     $view = RedirectView::create($credentials->getServer()->toString());
     $model = Model::create()->set('openid.ns', self::NAMESPACE_2_0)->set('openid.identity', $credentials->getRealId()->toString())->set('openid.return_to', $returnTo->toString())->set('openid.claimed_id', $credentials->getRealId()->toString());
     foreach ($this->extensions as $extension) {
         $extension->addParamsToModel($model);
     }
     if ($association) {
         Assert::isTrue($association instanceof OpenIdConsumerAssociation && $association->getServer()->toString() == $credentials->getServer()->toString());
         $model->set('openid.assoc_handle', $association->getHandle());
     }
     if ($trustRoot) {
         Assert::isTrue($trustRoot instanceof HttpUrl && $trustRoot->isValid());
         $model->set('openid.trust_root', $trustRoot->toString())->set('openid.realm', $trustRoot->toString());
     }
     return ModelAndView::create()->setModel($model)->setView($view);
 }
Пример #3
0
 function request($verb, array $params = [])
 {
     $this->code = \Carbo\Http\Code::MovedPermanently;
     parent::request($verb, $params);
 }
Пример #4
0
 function request($verb, array $params = [])
 {
     $this->code = \Carbo\Http\Code::Found;
     parent::request($verb, $params);
 }