Exemple #1
0
 public static function prepare()
 {
     if (FajrConfig::get('URL.Path')) {
         $_get = array_merge(FajrRouter::pathToParams(FajrUtils::pathInfo()), $_GET);
     } else {
         $_get = $_GET;
     }
     $_post = $_POST;
     // podla pola definujeceho vstupne parametre overim ich platnost
     foreach (self::$allowedParamters as $input => $params) {
         foreach ($params as $name => $type) {
             if (isset(${$input}[$name])) {
                 $checker = self::$conditions[$type]['cond'];
                 if (!Validator::$checker(${$input}[$name], self::$conditions[$type]['options'])) {
                     throw new Exception(str_replace('%%NAME%%', $name, self::$conditions[$type]['message']));
                 }
                 self::$inputParameters[$name] = ${$input}[$name];
                 self::${$input}[$name] = ${$input}[$name];
             }
         }
     }
     // specialne vynimky
     if (isset($_get['logout'])) {
         self::$inputParameters['logout'] = true;
         //self::$_GET['logout'] = true; FIXME: Majak, co tu robilo toto?
         //Pravdepodobne to chceme umazat.
     }
     // budeme pouzivat uz len Input
     unset($_GET);
     unset($_POST);
 }
 public static function buildUrl($params)
 {
     $path = '';
     if (FajrConfig::get('URL.Path')) {
         $path = FajrRouter::paramsToPath($params);
     }
     $query = http_build_query($params);
     if (strlen($query) > 0) {
         $query = '?' . $query;
     }
     $base = '';
     if (!FajrConfig::get('URL.Rewrite')) {
         $base = 'index.php';
         if (strlen($path) > 0) {
             $base .= '/';
         }
     }
     return self::basePath() . $base . $path . $query;
 }