]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/public.php
Merge branch '0.8.x' of git@gitorious.org:laconica/mainline into 0.8.x
[quix0rs-gnu-social.git] / actions / public.php
index 96c766a57d946f9ecb2af9acaf19e5e245884b5a..ef9ef0d1ab0dc4ea451d29f1c1a016359533501c 100644 (file)
@@ -35,6 +35,10 @@ require_once INSTALLDIR.'/lib/publicgroupnav.php';
 require_once INSTALLDIR.'/lib/noticelist.php';
 require_once INSTALLDIR.'/lib/feedlist.php';
 
+// Farther than any human will go
+
+define('MAX_PUBLIC_PAGE', 100);
+
 /**
  * Action for displaying the public stream
  *
@@ -56,7 +60,7 @@ class PublicAction extends Action
 
     var $page = null;
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
@@ -74,6 +78,10 @@ class PublicAction extends Action
         parent::prepare($args);
         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
+        if ($this->page > MAX_PUBLIC_PAGE) {
+            $this->clientError(sprintf(_("Beyond the page limit (%s)"), MAX_PUBLIC_PAGE));
+        }
+
         common_set_returnto($this->selfUrl());
 
         return true;
@@ -166,46 +174,20 @@ class PublicAction extends Action
         $nav->show();
     }
 
-    function showPageNotice()
+    function showEmptyList()
     {
-        $notice = Notice::publicStream(0, 1);
-
-        if (!$notice) {
-            $this->serverError(_('Could not retrieve public stream.'));
-            return;
-        }
-
-        // no notices in the public stream, let's get out of here
-        if ($notice->count()) {
-            return;
-        }
-
-        $message = _('This is the public timeline for %%site.name%% but noone has posted anything yet.') . ' ';
+        $message = _('This is the public timeline for %%site.name%% but no one has posted anything yet.') . ' ';
 
         if (common_logged_in()) {
             $message .= _('Be the first to post!');
-/*
-                sprintf(_('You are logged in... %%%%site.name%%%% groups let you find and talk with ' .
-                    'people of similar interests. After you join a group ' .
-                    'you can send messages to all other members using the ' .
-                    'syntax "!groupname". Don\'t see a group you like? Try ' .
-                    '[searching for one](%%%%action.groupsearch%%%%) or ' .
-                    '[start your own!](%%%%action.newgroup%%%%)'));
-*/
         }
         else {
-            $message .= _('Why not [register an account](%%action.register%%) and be the first to post!');
-/*
-                sprintf(_('You are not logged in... %%%%site.name%%%% groups let you find and talk with ' .
-                    'people of similar interests. After you join a group ' .
-                    'you can send messages to all other members using the ' .
-                    'syntax "!groupname". Don\'t see a group you like? Try ' .
-                    '[searching for one](%%%%action.groupsearch%%%%) or ' .
-                    '[start your own!](%%%%action.newgroup%%%%)'));
-*/
-        }
+            if (! (common_config('site','closed') || common_config('site','inviteonly'))) {
+                $message .= _('Why not [register an account](%%action.register%%) and be the first to post!');
+            }
+       }
 
-        $this->elementStart('div', 'blankfiller');
+        $this->elementStart('div', 'guide');
         $this->raw(common_markup_to_html($message));
         $this->elementEnd('div');
     }
@@ -233,6 +215,10 @@ class PublicAction extends Action
 
         $cnt = $nl->show();
 
+        if ($cnt == 0) {
+            $this->showEmptyList();
+        }
+
         $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
                           $this->page, 'public');
     }