class AllAction extends ProfileAction
{
- var $notice;
-
function isReadOnly($args)
{
return true;
}
- function prepare($args)
- {
- parent::prepare($args);
- $cur = common_current_user();
-
- if (!empty($cur) && $cur->id == $this->user->id) {
- $this->notice = $this->user->noticeInbox(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
- } else {
- $this->notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
- }
-
- if($this->page > 1 && $this->notice->N == 0){
- $this->serverError(_('No such page'),$code=404);
- }
-
- return true;
- }
-
function handle($args)
{
parent::handle($args);
function showContent()
{
- $nl = new NoticeList($this->notice, $this);
+ $cur = common_current_user();
+
+ if (!empty($cur) && $cur->id == $this->user->id) {
+ $notice = $this->user->noticeInbox(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+ } else {
+ $notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+ }
+
+ $nl = new NoticeList($notice, $this);
$cnt = $nl->show();
return;
}
- if($this->page > 1 && $this->notice->N == 0){
+ if($this->page > 0 && $this->notice->N == 0){
$this->serverError(_('No such page'),$code=404);
}
class RepliesAction extends OwnerDesignAction
{
var $page = null;
- var $notice;
/**
* Prepare the object
common_set_returnto($this->selfUrl());
- $this->notice = $this->user->getReplies(($this->page-1) * NOTICES_PER_PAGE,
- NOTICES_PER_PAGE + 1);
-
- if($this->page > 1 && $this->notice->N == 0){
- $this->serverError(_('No such page'),$code=404);
- }
-
return true;
}
function showContent()
{
- $nl = new NoticeList($this->notice, $this);
+ $notice = $this->user->getReplies(($this->page-1) * NOTICES_PER_PAGE,
+ NOTICES_PER_PAGE + 1);
+
+ $nl = new NoticeList($notice, $this);
$cnt = $nl->show();
if (0 === $cnt) {
common_set_returnto($this->selfUrl());
- $cur = common_current_user();
-
- if (!empty($cur) && $cur->id == $this->user->id) {
-
- // Show imported/gateway notices as well as local if
- // the user is looking at his own favorites
-
- $this->notice = $this->user->favoriteNotices(($this->page-1)*NOTICES_PER_PAGE,
- NOTICES_PER_PAGE + 1, true);
- } else {
- $this->notice = $this->user->favoriteNotices(($this->page-1)*NOTICES_PER_PAGE,
- NOTICES_PER_PAGE + 1, false);
- }
-
- if (empty($this->notice)) {
- $this->serverError(_('Could not retrieve favorite notices.'));
- return;
- }
-
- if($this->page > 1 && $this->notice->N == 0){
- $this->serverError(_('No such page'),$code=404);
- }
-
return true;
}
function showContent()
{
- $nl = new NoticeList($this->notice, $this);
+ $cur = common_current_user();
+
+ if (!empty($cur) && $cur->id == $this->user->id) {
+
+ // Show imported/gateway notices as well as local if
+ // the user is looking at his own favorites
+
+ $notice = $this->user->favoriteNotices(($this->page-1)*NOTICES_PER_PAGE,
+ NOTICES_PER_PAGE + 1, true);
+ } else {
+ $notice = $this->user->favoriteNotices(($this->page-1)*NOTICES_PER_PAGE,
+ NOTICES_PER_PAGE + 1, false);
+ }
+
+ if (empty($notice)) {
+ $this->serverError(_('Could not retrieve favorite notices.'));
+ return;
+ }
+
+ $nl = new NoticeList($notice, $this);
$cnt = $nl->show();
if (0 == $cnt) {
class TagAction extends Action
{
-
- var $notice;
-
function prepare($args)
{
parent::prepare($args);
common_set_returnto($this->selfUrl());
- $this->notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
-
- if($this->page > 1 && $this->notice->N == 0){
- $this->serverError(_('No such page'),$code=404);
- }
-
return true;
}
function showContent()
{
- $nl = new NoticeList($this->notice, $this);
+ $notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
+
+ $nl = new NoticeList($notice, $this);
$cnt = $nl->show();