]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/noticesearch.php
change default timeout setting for HTTPClient
[quix0rs-gnu-social.git] / actions / noticesearch.php
index 257a925835677ab7cff287bb891dc111b3711dcd..0d6fb51fb468a935e8eb77385e831f54164abe65 100644 (file)
@@ -50,7 +50,7 @@ class NoticesearchAction extends SearchAction
 {
     protected $q = null;
 
-    function prepare($args)
+    function prepare(array $args = array())
     {
         parent::prepare($args);
 
@@ -65,8 +65,7 @@ class NoticesearchAction extends SearchAction
 
         if (!empty($this->q)) {
 
-            $profile = Profile::current();
-            $stream  = new SearchNoticeStream($this->q, $profile);
+            $stream  = new SearchNoticeStream($this->q, $this->scoped);
             $page    = $this->trimmed('page');
 
             if (empty($page)) {
@@ -132,19 +131,19 @@ class NoticesearchAction extends SearchAction
      */
     function showResults($q, $page)
     {
-        if ($this->notice->N === 0) {
-            $this->showEmptyResults($q, $page);
-        }
-
         if (Event::handle('StartNoticeSearchShowResults', array($this, $q, $this->notice))) {
-            $terms = preg_split('/[\s,]+/', $q);
-            $nl = new SearchNoticeList($this->notice, $this, $terms);
-            $cnt = $nl->show();
-            $this->pagination($page > 1,
-                              $cnt > NOTICES_PER_PAGE,
-                              $page,
-                              'noticesearch',
-                              array('q' => $q));
+            if ($this->notice->N === 0) {
+                $this->showEmptyResults($q, $page);
+            } else {
+                $terms = preg_split('/[\s,]+/', $q);
+                $nl = new SearchNoticeList($this->notice, $this, $terms);
+                $cnt = $nl->show();
+                $this->pagination($page > 1,
+                                  $cnt > NOTICES_PER_PAGE,
+                                  $page,
+                                  'noticesearch',
+                                  array('q' => $q));
+            }
             Event::handle('EndNoticeSearchShowResults', array($this, $q, $this->notice));
         }
     }
@@ -186,7 +185,7 @@ class SearchNoticeList extends NoticeList {
         $this->terms = $terms;
     }
 
-    function newListItem($notice)
+    function newListItem(Notice $notice)
     {
         return new SearchNoticeListItem($notice, $this->out, $this->terms);
     }
@@ -202,15 +201,8 @@ class SearchNoticeListItem extends NoticeListItem {
     function showContent()
     {
         // FIXME: URL, image, video, audio
-        $this->out->elementStart('p', array('class' => 'entry-content'));
-        if ($this->notice->rendered) {
-            $this->out->raw($this->highlight($this->notice->rendered, $this->terms));
-        } else {
-            // XXX: may be some uncooked notices in the DB,
-            // we cook them right now. This should probably disappear in future
-            // versions (>> 0.4.x)
-            $this->out->raw($this->highlight(common_render_content($this->notice->content, $this->notice), $this->terms));
-        }
+        $this->out->elementStart('p', array('class' => 'e-content'));
+        $this->out->raw($this->highlight($this->notice->getRendered(), $this->terms));
         $this->out->elementEnd('p');
 
     }