Exemple #1
0
 /**
  * Returns a function creating a URL by using the current route and the GET parameters.
  * @return \Closure A function creating a URL by using the current route and the GET parameters.
  */
 public function getCurrent() : \Closure
 {
     return function ($value, \Mustache_LambdaHelper $helper) {
         $args = $this->parseArguments($helper->render($value), 'params', ['scheme' => false]);
         return UrlHelper::current($args['params'], $args['scheme']);
     };
 }
 function admin_setup()
 {
     if ($this->layout) {
         $this->layout = $this->load->layout('admin');
     }
     $default_utility = '/' . DEFAULT_MODULE . '/admin/' . DEFAULT_MODULE . 'admin';
     if (!file_exists(APPD_APPLICATION . '/' . DEFAULT_MODULE . '/admin/' . DEFAULT_MODULE . 'admin.utility.php')) {
         $default_utility = '/admin/admin/adminadmin';
     }
     $util = $this->load->utility($default_utility);
     $path = $util ? DEFAULT_MODULE . '/' . DEFAULT_MODULE : 'admin/index';
     $default_config = array('roles' => array('admin' => array('home' => $path, 'modules' => '*')), 'time_limit' => 500, 'memory_limit' => '128M');
     $this->config = array_merge($default_config, $this->config);
     $roles = array_keys($this->config['roles']);
     $this->plugin->Auth->addArea('admin-area', $roles);
     foreach ($roles as $role) {
         $this->plugin->Auth->addRole($role, array('member-area', 'admin-area', 'open-area'));
     }
     $this->plugin->Auth->authorize('admin-area', array('admin', 'node', 'node_process', 'error'), array(&$this, '_goLogin'));
     if (isset($this->config['language']) && $this->config['language'] != Lang::getCurrent()) {
         $this->helper->redirect->to(UrlHelper::current($this->config['language']));
     }
     if (!ini_get('safe_mode') && is_callable('set_time_limit') && is_callable('ini_set')) {
         @set_time_limit($this->config['time_limit']);
         @ini_set("memory_limit", $this->config['memory_limit']);
     }
 }
 private function loginRedirect()
 {
     if ($this->requested_module != $this->config['module_name']) {
         RedirectHelper::flash($this->config['module_name'] . '/' . $this->config['login_action'], 'next', UrlHelper::current('', false));
     } else {
         RedirectHelper::to('/');
     }
 }
 static function hashLink($text, $href, $attributes = array(), $escape = true)
 {
     if ($href && $href[0] != '#') {
         $href = '#' . $href;
     }
     $href = UrlHelper::current() . $href;
     return self::absoluteLink($text, $href, $attributes, $escape);
 }
Exemple #5
0
        $value = stripslashes($value);
    }
    $gpc = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
    array_walk_recursive($gpc, 'undo_magic_quotes');
}
$plugin_manager = PluginManager::getInstance();
$url_mapper = new UrlMapper();
$context = $url_mapper->map($_SERVER['REQUEST_URI']);
if (!$context) {
    header("HTTP/1.1 400 Bad Request");
    @(include PHAXSI_ERROR_400);
    exit;
}
if (AppConfig::$language_redirect && !Lang::wasSet()) {
    $lang = Lang::autoDetect();
    RedirectHelper::to(UrlHelper::current($lang));
}
if (AppConfig::CUSTOM_ROUTER) {
    $router_name = Loader::includeApplicationClass(new Context('router', AppConfig::CUSTOM_ROUTER));
    if ($router_name) {
        $router = new $router_name();
    } else {
        trigger_error('Custom router "' . AppConfig::CUSTOM_ROUTER . '" was not found', E_USER_ERROR);
    }
} else {
    $router = new Router();
}
$controller = $router->getController($context);
if (!$controller) {
    header("HTTP/1.1 404 Not Found");
    @(include PHAXSI_ERROR_404);