Beispiel #1
0
 /**
  * Initialize the vars for this class
  *
  * @return void
  */
 public static function init($refresh = false)
 {
     if (self::$_vars == [] || $refresh === true) {
         // make get
         $get = [];
         $url = String::split('?', $_SERVER['REQUEST_URI']);
         if (count($url) === 1) {
             $url = String::split('&', $_SERVER['QUERY_STRING']);
             if (count($url) === 1) {
                 $url = '';
             } else {
                 unset($url[0]);
                 foreach ($url as $v) {
                     $p = String::split('=', $v);
                     $get[$p[0]] = $p[1];
                 }
             }
         } else {
             unset($url[0]);
             $url = String::unsplit('', $url);
             $url = String::split('&', $url);
             foreach ($url as $v) {
                 $p = String::split('=', $v);
                 $get[$p[0]] = $p[1];
             }
         }
         self::$_vars = ['querystring' => String::split('&', String::trim($_SERVER['QUERY_STRING'], '/'))[0], 'redirect' => @$_SERVER['HTTP_REFERER'], 'url' => DOMEIN . '/' . $_SERVER['QUERY_STRING'], 'root' => DOMEIN, 'fullurl' => String::lower(!empty($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : 'HTTP') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'schema' => !empty($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : 'HTTP', 'ip' => $_SERVER['REMOTE_ADDR'], 'post' => $_POST, 'get' => $get];
     }
 }
Beispiel #2
0
 public static function makeThumb($dir, $file, $x = '')
 {
     $e = String::split('.', $file);
     $ext = $e[count($e) - 1];
     unset($e[count($e) - 1]);
     $f = String::unsplit('.', $e);
     return '<img src="' . URL . '/uploads/' . String::trim($dir, '/') . '/' . $f . '' . $x . '.' . $ext . '" />';
 }
Beispiel #3
0
 /**
  * Make an errorstring
  *
  * @param string $name  the name of the column
  * @param value $value  the given value
  *
  * @return string  the errorstring
  */
 public function makeError($name, $value)
 {
     $column = $value;
     $num = null;
     if (String::like($column, '%:%')) {
         $e = String::split(':', $column);
         $column = $e[0];
         $num = $e[1];
     }
     if (App::hasLanguage($name)) {
         $name = App::language($name);
     }
     return App::language('validation.error.' . $column, ['name' => String::lower($name), 'num' => $num]);
 }