Esempio n. 1
0
 /**
  * コンストラクタ
  * @param \radium\action\Request $request
  */
 public function __construct(Request $request)
 {
     parent::__construct();
     $uri = $request->uri;
     $plugin = '';
     $controller = 'home';
     $action = 'index';
     StringUtil::getLocalizedString('');
     // URI を分割します
     $args = strlen(substr($uri, 1)) > 0 ? explode('/', substr($uri, 1)) : array();
     foreach ($args as &$arg) {
         $arg = urldecode($arg);
     }
     // ルーティング
     $route = Router::get($uri, $args);
     if ($route === false) {
         throw new NotFoundError(StringUtil::getLocalizedString('Not Found.'));
     }
     $controller = $route['controller'];
     $action = $route['action'];
     $args = $route['args'];
     $request->params['path'] = $uri;
     $request->params['controller'] = $controller;
     $request->params['action'] = $action;
     $request->params['args'] = $args;
     $this->request = $request;
 }
Esempio n. 2
0
 /**
  * コンストラクタ
  */
 public function __construct($model, $resource)
 {
     parent::__construct();
     $this->model = $model;
     $this->collectionName = $model->className();
     $this->resource = $resource;
 }
Esempio n. 3
0
 /**
  * コンストラクタ
  */
 public function __construct()
 {
     parent::__construct();
     $this->_config = array('queryString' => '');
     if (strpos($_SERVER['REQUEST_URI'], '?') > 0) {
         $this->_config['queryString'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?'));
     }
     // uri
     $uri = $_SERVER['REQUEST_URI'];
     if (strpos($uri, '?') !== false) {
         $uri = substr($uri, 0, strpos($uri, '?'));
     }
     // base
     $base = str_replace('\\', '/', dirname($_SERVER['PHP_SELF']));
     $base = rtrim(str_replace(array("/app/webroot", '/webroot'), '', $base), '/');
     $idx = strlen($base);
     if ($base) {
         $idx += strpos($uri, $base);
     }
     $appBase = substr($uri, 0, $idx);
     $uri = substr($uri, $idx);
     if (!defined('RADIUM_APP_BASE_URI')) {
         define('RADIUM_APP_BASE_URI', $appBase . '/');
     }
     $argPos = strpos($uri, '?');
     if ($argPos > 0) {
         $uri = substr($uri, 0, $argPos);
     }
     $uri = rtrim($uri, '/');
     if (substr($uri, 0, 1) != '/') {
         $uri = '/' . $uri;
     }
     $this->_config['uri'] = $uri;
     $domain = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'];
     if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 80) {
         $domain .= ':' . $_SERVER['SERVER_PORT'];
     }
     $rawHeaders = getallheaders();
     $headers = array();
     while (list($header, $value) = each($rawHeaders)) {
         $headers[strtoupper($header)] = $value;
     }
     // data and query
     $this->_config['domain'] = $domain;
     $this->_config['appBaseURI'] = RADIUM_APP_BASE_URI;
     $this->_config['base'] = $base;
     $this->_config['headers'] = $headers;
     $this->_config['data'] = $this->_config['query'] = array();
     $this->_config['data'] += $_POST;
     $this->_config['query'] += $_GET;
 }
Esempio n. 4
0
 /**
  * コンストラクタ
  */
 public function __construct()
 {
     parent::__construct();
 }