示例#1
0
 /**
  * Return the match dictionary for the incoming request.
  *
  * @return array The match dictionary.
  */
 public function getMatchDict()
 {
     if ($this->_match_dict === null) {
         $path = $this->_request->getPath();
         if (($pos = strpos($path, '?')) !== false) {
             $path = substr($path, 0, $pos);
         }
         if (!$path) {
             $path = '/';
         }
         $this->_match_dict = new Horde_Support_Array($this->_mapper->match($path));
     }
     return $this->_match_dict;
 }
示例#2
0
文件: Feed.php 项目: ralflang/dolcore
 public function processRequest(Horde_Controller_Request $request, Horde_Controller_Response $response)
 {
     $this->_mapper = $GLOBALS['injector']->getInstance('Horde_Routes_Mapper');
     $this->_matchDict = new Horde_Support_Array($this->_mapper->match($request->getPath()));
     $injector = $this->getInjector();
     switch ($this->_matchDict->action) {
         case 'category':
             $driver = $injector->getInstance('Dolcore_Factory_Driver')->create($injector);
             $categories = $driver->getCategoriesApi();
             $discussionApi = $driver->getDiscussionApi();
             $category = $categories->getCategory($this->_matchDict->category);
             /* Write a category's currently running Umfragen */
             $now = new Horde_Date(time());
             $template = $this->getInjector()->createInstance('Horde_Template');
             $template->set('updated', $now->format(DATE_ATOM));
             $template->set('category_caption', $category->getCaption());
             $template->set('category_id', $category->id);
             $discussions = array();
             foreach ($discussionApi->listDiscussions(array('category' => $category->id)) as $discussion) {
                 $discussions[$discussion->id]['title'] = $discussion->text;
                 $discussions[$discussion->id]['details'] = $discussion->hintergrund;
                 $discussions[$discussion->id]['modified'] = $discussion->erstelldatum;
                 $discussions[$discussion->id]['id'] = Dolcore::getUrlFor('discussion', array('discussion_id' => $discussion->id), true, true);
                 $discussions[$discussion->id]['url'] = Dolcore::getUrlFor('discussion', array('discussion_id' => $discussion->id), true, true);
             }
             $template->set('discussions', $discussions);
             $response->setBody($template->fetch(DOLCORE_TEMPLATES . '/feeds/atom.xml'));
             break;
         case 'categories':
             break;
     }
 }
示例#3
0
 public function processRequest(Horde_Controller_Request $request, Horde_Controller_Response $response)
 {
     $path = $request->getPath();
     $pathParts = explode('/', $path);
     $tag = urldecode(array_pop($pathParts));
     $tagBrowser = new Trean_TagBrowser($this->getInjector()->getInstance('Trean_Tagger'), $tag);
     $view = new Trean_View_BookmarkList(null, $tagBrowser);
     $page_output = $this->getInjector()->getInstance('Horde_PageOutput');
     $notification = $this->getInjector()->getInstance('Horde_Notification');
     if ($GLOBALS['conf']['content_index']['enabled']) {
         $topbar = $this->getInjector()->getInstance('Horde_View_Topbar');
         $topbar->search = true;
         $topbar->searchAction = Horde::url('search.php');
     }
     Trean::addFeedLink();
     $title = sprintf(_("Tagged with %s"), urldecode($tag));
     $page_output->header(array('title' => $title));
     $notification->notify(array('listeners' => 'status'));
     echo $view->render($title);
     $page_output->footer();
 }
示例#4
0
 /**
  * Generate the URL for triggering data on a remote system.
  *
  * @param string  $username The user accessing the data.
  * @param string  $password The user password.
  *
  * @return string The URL
  */
 protected function getUrlWithCredentials($username, $password)
 {
     return $this->_getUrl(preg_replace('#(http[s]://)(.*)#', '\\1' . urlencode($username) . ':' . urlencode($password) . '@\\2', $this->_owner->getRemoteServer()), $this->_request->getPath());
 }