Пример #1
0
 function data_make()
 {
     switch ($this->method) {
         case 'get':
         case 'head':
             return null;
         case 'post':
             $data = $_POST;
             foreach ($_FILES as $key => $info) {
                 $data[$key] = so_file::make($info['tmp_name']);
             }
             return so_query::make($data);
         default:
             $raw = '';
             $input = fopen('php://input', 'r');
             while ($chunk = fread($input, 1024)) {
                 $raw .= $chunk;
             }
             fclose($input);
             $type = preg_replace('~;.*$~', '', so_value::make($_SERVER['CONTENT_TYPE']) ?: '');
             switch ($type) {
                 case 'application/x-www-form-urlencoded':
                     return so_query::make($raw);
                     break;
                 case 'text/xml':
                 case 'application/xml':
                     return so_dom::make($raw);
                 case 'text/json':
                 case 'application/json':
                     return json_decode($raw);
                 default:
                     return $raw;
             }
     }
 }
Пример #2
0
 function allow($pattern, $action)
 {
     so_query::ensure($pattern);
     if ($this->check($pattern->uri, $action)) {
         return $this;
     }
     $this->storage[] = array('so_permit_pattern' => (string) $pattern, 'so_permit_action' => (string) $action);
     unset($this->list);
     return $this;
 }
Пример #3
0
 static function start($package, $mode = 'dev')
 {
     register_shutdown_function(array(get_class(), 'finalize'));
     ob_start();
     so_error::monitor();
     foreach (parse_ini_file(so_file::make('php.ini')) as $key => $value) {
         ini_set($key, $value);
     }
     so_page::$mode = $mode;
     so_package::$defaultName = $package;
     so_query::$resourcePrefix = $package;
     $front = so_front::make();
     $query = $front->uri->query;
     $resource = $query->resource;
     $uriStandard = $resource->uri;
     if ($query->uri != $uriStandard) {
         return static::$response = so_output::moved((string) $uriStandard);
     }
     static::$response = $resource->execute($front->method, $front->data);
 }
Пример #4
0
 function uri_make()
 {
     return so_query::make(array('subscriber;list', 'for' => (string) $this->subject))->uri;
 }
Пример #5
0
 function uri_make()
 {
     return so_query::make(array('console'))->uri;
 }
Пример #6
0
 function query_store($data)
 {
     return so_query::make($data);
 }
Пример #7
0
 function uri_make()
 {
     return so_query::make(array('article;list'))->uri;
 }
Пример #8
0
 function uri_make()
 {
     return so_query::make(array('article;list', 'author' => (string) $this->author->name))->uri;
 }
Пример #9
0
 static function hash()
 {
     $data = func_get_args();
     $key = sha1(so_query::make($data));
     return $key;
 }
Пример #10
0
 function uri_make()
 {
     return so_query::make(array('image' => $this->id))->uri;
 }
Пример #11
0
 function uri_make()
 {
     return so_query::make(array('phpinfo'))->uri;
 }
Пример #12
0
 function uri_make()
 {
     return so_query::make(array('image', 'search' => $this->search))->uri;
 }
Пример #13
0
 function match($subject)
 {
     so_query::ensure($subject);
     $iterP = $this->getIterator();
     $iterS = $subject->getIterator();
     while (true) {
         if (!$iterP->valid()) {
             return !$iterS->valid();
         }
         if (!$iterS->valid()) {
             return false;
         }
         if ($iterP->key() !== $iterS->key()) {
             return false;
         }
         if ($iterP->current()) {
             if ($iterP->current() !== $iterS->current()) {
                 return false;
             }
         }
         $iterP->next();
         $iterS->next();
     }
 }
Пример #14
0
 function uri_make()
 {
     return so_query::make(array('search' => $this->text))->uri;
 }
Пример #15
0
 function uri_make()
 {
     return so_query::make(array('author' => $this->name))->uri;
 }