* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-abstract class ProfileAction extends ManagedAction
+abstract class ProfileAction extends ManagedAction implements NoticestreamAction
{
var $page = null;
var $tag = null;
protected function prepare(array $args=array())
{
- // this will call ->doPreparation() which lower classes can use
+ // this will call ->doPreparation() which child classes use to set $this->target
parent::prepare($args);
if ($this->target->hasRole(Profile_role::SILENCED)
common_set_returnto($this->selfUrl());
// fetch the actual stream stuff
- $this->profileActionPreparation();
+ $stream = $this->getStream();
+ $this->notice = $stream->getNotices(($this->page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+
+ if ($this->page > 1 && $this->notice->N == 0) {
+ // TRANS: Client error when page not found (404).
+ $this->clientError(_('No such page.'), 404);
+ }
+
return true;
}
return $this->target;
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
// TRANS: H2 text for user statistics.
$this->element('h2', null, _('Statistics'));
- $profile = $this->target;
- $actionParams = array('nickname' => $profile->nickname);
+ $actionParams = array('nickname' => $this->target->nickname);
$stats = array(
array(
'id' => 'user-id',
// TRANS: Label for user statistics.
'label' => _('User ID'),
- 'value' => $profile->id,
+ 'value' => $this->target->id,
),
array(
'id' => 'member-since',
// TRANS: Label for user statistics.
'label' => _('Member since'),
- 'value' => date('j M Y', strtotime($profile->created))
+ 'value' => date('j M Y', strtotime($this->target->created))
),
array(
'id' => 'notices',
);
// Give plugins a chance to add stats entries
- Event::handle('ProfileStats', array($profile, &$stats));
+ Event::handle('ProfileStats', array($this->target, &$stats));
foreach ($stats as $row) {
$this->showStatsRow($row);
class SubscribersMiniList extends ProfileMiniList
{
- function newListItem($profile)
+ function newListItem(Profile $profile)
{
return new SubscribersMiniListItem($profile, $this->action);
}