X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=actions%2Fpublic.php;h=b68b2ff793dc99d44ca606508a4b5c3e71481b1f;hb=9f356b55c6f419468771c0f3c2450010c0242abe;hp=322a52963e8da6d6198957e61caea251dab5e0b8;hpb=5dc1291b59a1079cbe9bab05d12dae06b8e4c96d;p=quix0rs-gnu-social.git diff --git a/actions/public.php b/actions/public.php index 322a52963e..b68b2ff793 100644 --- a/actions/public.php +++ b/actions/public.php @@ -59,6 +59,7 @@ class PublicAction extends Action */ var $page = null; + var $notice; function isReadOnly($args) { @@ -84,6 +85,18 @@ class PublicAction extends Action common_set_returnto($this->selfUrl()); + $this->notice = Notice::publicStream(($this->page-1)*NOTICES_PER_PAGE, + NOTICES_PER_PAGE + 1); + + if (!$this->notice) { + $this->serverError(_('Could not retrieve public stream.')); + return; + } + + if($this->page > 1 && $this->notice->N == 0){ + $this->serverError(_('No such page'),$code=404); + } + return true; } @@ -165,7 +178,8 @@ class PublicAction extends Action } else { if (! (common_config('site','closed') || common_config('site','inviteonly'))) { - $message .= _('Why not [register an account](%%action.register%%) and be the first to post!'); + $message .= sprintf(_('Why not [register an account](%%%%action.%s%%%%) and be the first to post!'), + (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); } } @@ -185,15 +199,7 @@ class PublicAction extends Action function showContent() { - $notice = Notice::publicStream(($this->page-1)*NOTICES_PER_PAGE, - NOTICES_PER_PAGE + 1); - - if (!$notice) { - $this->serverError(_('Could not retrieve public stream.')); - return; - } - - $nl = new NoticeList($notice, $this); + $nl = new NoticeList($this->notice, $this); $cnt = $nl->show(); @@ -220,9 +226,11 @@ class PublicAction extends Action function showAnonymousMessage() { if (! (common_config('site','closed') || common_config('site','inviteonly'))) { - $m = _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . - 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' . - '[Join now](%%action.register%%) to share notices about yourself with friends, family, and colleagues! ([Read more](%%doc.help%%))'); + $m = sprintf(_('This is %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . + 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' . + '[Join now](%%%%action.%s%%%%) to share notices about yourself with friends, family, and colleagues! ' . + '([Read more](%%%%doc.help%%%%))'), + (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); } else { $m = _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . 'based on the Free Software [Laconica](http://laconi.ca/) tool.');