if (!$user) {
$this->no_such_user();
+ return;
}
$profile = $user->getProfile();
if (!$profile) {
common_server_error(_t('User record exists without profile.'));
+ return;
}
# Looks like we're good; show the header
$this->show_last_notice($profile);
- if ($cur) {
+ if ($cur && $cur->id != $profile->id) {
if ($cur->isSubscribed($profile)) {
$this->show_unsubscribe_form($profile);
} else {
function notice_form() {
common_element_start('form', array('id' => 'newnotice', 'method' => 'POST',
'action' => common_local_url('newnotice')));
- common_element('textarea', array('rows' => 4, 'cols' => 80, 'id' => 'content'));
- common_element('input', array('type' => 'submit'), 'Send');
+ common_element('textarea', array('rows' => 4, 'cols' => 80,
+ 'name' => 'content',
+ 'id' => 'content'));
+ common_element('input', array('type' => 'submit', 'value' => 'Send'));
common_element_end('form');
}
'name' => 'subscribeto',
'type' => 'hidden',
'value' => $profile->nickname));
- common_element('input', array('type' => 'submit'), _t('subscribe'));
+ common_element('input', array('type' => 'submit', 'value' => _t('Subscribe')));
common_element_end('form');
}
$subs->subscriber = $profile->id;
$subs_count = $subs->count();
+ if (!$subs_count) {
+ $subs_count = 0;
+ }
+
$subbed = DB_DataObject::factory('subscription');
$subbed->subscribed = $profile->id;
$subbed_count = $subbed->count();
+ if (!$subbed_count) {
+ $subbed_count = 0;
+ }
+
$notices = DB_DataObject::factory('notice');
$notices->profile_id = $profile->id;
$notice_count = $notices->count();
+
+ if (!$notice_count) {
+ $notice_count = 0;
+ }
# Other stats...?
common_element_start('dl', 'statistics');
$page = $this->arg('page') || 1;
- $notice->limit((($page-1)*NOTICES_PER_PAGE) + 1, NOTICES_PER_PAGE);
+ $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
$notice->find();
while ($notice->fetch()) {
$this->show_notice($notice);
}
-
+ # XXX: show a link for the next page
common_element_end('div');
}
$notice = DB_DataObject::factory('notice');
$notice->profile_id = $profile->id;
$notice->orderBy('created DESC');
- $notice->limit(1, 1);
+ $notice->limit(0, 1);
$notice->find();
while ($notice->fetch()) {