Esempio n. 1
0
 public function setUp()
 {
     parent::setUp();
     Router::register($this->di);
     View::register($this->di);
 }
Esempio n. 2
0
 public function testGenerateErrorPage()
 {
     $this->assertEquals('404 NOT FOUND', Router::generateErrorPage('404', '404 PAGE TITLE'));
 }
Esempio n. 3
0
 public function missingMethod()
 {
     Router::throw404Exception(json_encode(['jsonapi' => $this->jsonApiVersion, 'errors' => [['status' => 404, 'code' => 404, 'title' => '404 Not Found']]]), $this->jsonApiContentType);
 }
Esempio n. 4
0
 /**
  * @param string $uri
  * @param Route  $route
  * @param Router $router
  * @return bool
  */
 protected function filter($uri, $route, $router)
 {
     Router::disableCsrfCheck();
     return true;
 }
Esempio n. 5
0
use Phalcon\Version;
use Phwoolcon\Aliases;
use Phwoolcon\Cache;
use Phwoolcon\Config;
use Phwoolcon\Cookies;
use Phwoolcon\Db;
use Phwoolcon\DiFix;
use Phwoolcon\Events;
use Phwoolcon\I18n;
use Phwoolcon\Log;
use Phwoolcon\Queue;
use Phwoolcon\Router;
use Phwoolcon\Session;
use Phwoolcon\Util\Counter;
use Phwoolcon\View;
$_SERVER['PHWOOLCON_PHALCON_VERSION'] = Version::getId();
Events::register($di);
DiFix::register($di);
Db::register($di);
Cache::register($di);
Log::register($di);
Config::register($di);
Counter::register($di);
Aliases::register($di);
Router::register($di);
I18n::register($di);
Cookies::register($di);
Session::register($di);
View::register($di);
Queue::register($di);
$loader->registerNamespaces(Config::get('app.autoload.namespaces', []), true);
Esempio n. 6
0
 public function onReceive(SwooleServer $server, $fd, $fromId, $data)
 {
     if ($this->debug) {
         $this->debugData = [];
         Timer::start();
     }
     $length = unpack('N', $data)[1];
     $data = unserialize(substr($data, -$length));
     $_REQUEST = $_GET = $_POST = isset($data['request']) ? $data['request'] : [];
     $_COOKIE = isset($data['cookies']) ? $data['cookies'] : [];
     $_FILES = isset($data['files']) ? $data['files'] : [];
     $_SERVER = isset($data['server']) ? $data['server'] : [];
     foreach ($this->environmentVariables as $k => $v) {
         $_SERVER[$k] = $v;
     }
     $this->reset();
     ob_start();
     $response = Router::dispatch();
     $extraContent = ob_get_clean();
     $headers = $this->parseResponseHeaders($response);
     $body = $response->getContent();
     $result = serialize(['headers' => $headers, 'body' => $body . $extraContent, 'meta' => $this->debug ? $this->getDebugInfo($server) : ['service' => 1]]);
     $server->send($fd, pack('N', $outputLength = strlen($result)), $fromId);
     if ($outputLength >= $this->config['buffer_output_size']) {
         foreach (str_split($result, $this->config['chunk_output_size']) as $chunk) {
             $server->send($fd, $chunk, $fromId);
         }
     } else {
         $server->send($fd, $result, $fromId);
     }
 }
 /**
  * @param string $uri
  * @param Route  $route
  * @param Router $router
  * @return bool
  */
 protected function filter($uri, $route, $router)
 {
     Router::disableSession();
     return true;
 }