Esempio n. 1
0
 /**
  * Override inorder to ignore trailing slashes in requests.
  *   @see \sfWebRequest::getPathInfo()
  */
 public function getPathInfo()
 {
     $pathInfo = parent::getPathInfo();
     // remove trailing slash.
     $pathInfo = preg_replace('/\\/$/', '', $pathInfo);
     return $pathInfo;
 }
Esempio n. 2
0
 public function executeError404(sfWebRequest $request)
 {
     $this->search = preg_split("/\\/|-/", $request->getPathInfo());
     $query = Doctrine::getTable('SeoPage')->getSearchQuery(array_filter($this->search))->limit(10);
     $this->results = $query->execute();
     $this->getResponse()->setStatusCode(404, 'This page does not exist');
 }
 public function executeChiaraRedirector(sfWebRequest $request)
 {
     $pathInfo = str_replace('Chiara_PEAR_Server_REST', 'pluginRest', $request->getPathInfo());
     $routing = sfContext::getInstance()->getRouting();
     $parameter = $routing->parse($pathInfo);
     $request->setAttribute('sf_route', $parameter['_sf_route']);
     unset($parameter['_sf_route']);
     $parameterHolder = $request->getParameterHolder();
     $parameterHolder->add($parameter);
     $this->forward($parameter['module'], $parameter['action']);
 }
Esempio n. 4
0
 /**
  * pageActions::executePage_index()
  *
  * @param sfWebRequest $request
  * @return
  */
 public function executePage_index(sfWebRequest $request)
 {
     // リクエストされたパスを取得する。
     $path = strtolower($request->getPathInfo());
     //  並べ替えパラメータを取得する。
     $sort_key = $request->getParameter('sk', 'title');
     $sort_order = $request->getParameter('so', 'asc');
     // パスにマッチするページ一覧を取得する。
     $pages = PageTable::getListFromPath($path, $sort_key, $sort_order);
     $this->path = $path;
     $this->pages = $pages;
 }
 public function executeShow(sfWebRequest $request)
 {
     $this->rt_site = Doctrine::getTable('rtSite')->findOneBy('reference_key', $request->getParameter('reference_key'));
     $this->forward404Unless($this->rt_site);
     $site = rtSiteToolkit::getCurrentSite();
     if (rtSiteToolkit::getCurrentSite()->getReferenceKey() !== sfConfig::get('app_rt_booking_site_ref_key')) {
         $site = Doctrine::getTable('rtSite')->findOneBy('reference_key', sfConfig::get('app_rt_booking_site_ref_key'));
         if (!$site) {
             $this->forward404();
         }
         $this->redirect('http://' . $site->getDomain() . $request->getPathInfo());
     }
 }
Esempio n. 6
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     // リクエストされたパスを取得する。
     $path = strtolower($request->getPathInfo());
     $year = $request->getParameter('year', '');
     $month = $request->getParameter('month', '');
     $page_type = $request->getParameter('page_type', '');
     $path = str_replace(sprintf('%s/%s/', $year, $month), '', $path);
     //  並べ替えパラメータを設定する。
     $sort_key = 'first_committed';
     $sort_order = 'desc';
     // パスと条件にマッチするページ一覧を取得する。
     $pages = PageTable::getListFromPath($path, $sort_key, $sort_order, -1, true, $year, $month);
     // パスにマッチするページ一覧(全部)を取得する。
     $pages_temp = PageTable::getListFromPath($path, $sort_key, $sort_order);
     // ページの一覧から年月インデックス配列を作成する。
     $ym_index = array();
     foreach ($pages_temp as $page) {
         $ym = $page->getDateTimeObject('first_committed')->format('Ym');
         if (isset($ym_index[$ym])) {
             ++$ym_index[$ym]['count'];
         } else {
             $ym_index[$ym]['count'] = 1;
             $ym_index[$ym]['year'] = substr($ym, 0, 4);
             $ym_index[$ym]['month'] = substr($ym, -2, 2);
         }
     }
     $this->path = $path;
     $this->pages = $pages;
     $this->ym_index = $ym_index;
     switch ($page_type) {
         case 'events':
             $title = 'イベント';
             break;
         case 'news':
             $title = 'ニュース';
             break;
         case 'blog':
         default:
             $title = 'ブログ';
             break;
     }
     $this->page_type = $page_type;
     $this->page_title = $title;
 }
Esempio n. 7
0
  /**
   * Action for the JS Routing. Action checks if a cached file is used or
   * not. Cached = prod, not cached = dev.
   * prod means that a single file is loaded with all logic
   * dev means that all files (about 120) will be loaded
   *
   * @param sfWebRequest $request
   * @return <type>
   */
    public function executeLoad(sfWebRequest $request) {
        $path = $request->getPathInfo();

        $path = str_replace('/djs', '', $path);
        $path = str_replace($request->getParameter('filename') . '.js', '', $path);

        if($path == '/cache/') {
            $template = sfConfig::get('sf_cache_dir') . '/javaScriptCache/' . $request->getParameter('filename');
        }
        else {
            $template = sfConfig::get('sf_app_template_dir') . $path . $request->getParameter('filename');
        }
        $this->getResponse()->setContentType('text/javascript');
	$this->setLayout(false);
	$this->setTemplate($template); // the real path to JS File -.-

        return sfView::SUCCESS;
	//return '.js' . chr(0);
    }
Esempio n. 8
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $path = preg_replace('/\\/download\\/uploads/', '', preg_replace('/:/', '.', $request->getPathInfo()));
     $file = sfConfig::get('sf_upload_dir') . $path;
     if (file_exists($file)) {
         header('Content-Description: File Transfer');
         header('Content-Type: application/octet-stream');
         header('Content-Disposition: attachment; filename=' . basename($file));
         header('Content-Transfer-Encoding: binary');
         header('Expires: 0');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Pragma: public');
         header('Content-Length: ' . filesize($file));
         ob_clean();
         flush();
         readfile($file);
         exit;
     }
     return sfView::NONE;
 }