summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/showstream.php3
-rw-r--r--actions/subscribers.php4
-rw-r--r--actions/subscriptions.php4
-rw-r--r--lib/gallery.php36
4 files changed, 34 insertions, 13 deletions
diff --git a/actions/showstream.php b/actions/showstream.php
index f339e0898..d9637c377 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -204,7 +204,8 @@ class ShowstreamAction extends StreamAction {
$subs = DB_DataObject::factory('subscription');
$subs->subscriber = $profile->id;
-
+ $subs->orderBy('created DESC');
+
# We ask for an extra one to know if we need to do another page
$subs->limit(0, SUBSCRIPTIONS + 1);
diff --git a/actions/subscribers.php b/actions/subscribers.php
index f5548d653..de374d57a 100644
--- a/actions/subscribers.php
+++ b/actions/subscribers.php
@@ -43,4 +43,8 @@ class SubscribersAction extends GalleryAction {
function div_class() {
return 'subscribers';
}
+
+ function get_other(&$subs) {
+ return $subs->subscriber;
+ }
} \ No newline at end of file
diff --git a/actions/subscriptions.php b/actions/subscriptions.php
index aba974f6e..10aef54d8 100644
--- a/actions/subscriptions.php
+++ b/actions/subscriptions.php
@@ -43,4 +43,8 @@ class SubscriptionsAction extends GalleryAction {
function div_class() {
return 'subscriptions';
}
+
+ function get_other(&$subs) {
+ return $subs->subscribed;
+ }
} \ No newline at end of file
diff --git a/lib/gallery.php b/lib/gallery.php
index 6d21b8310..d0c55d634 100644
--- a/lib/gallery.php
+++ b/lib/gallery.php
@@ -68,15 +68,25 @@ class GalleryAction extends Action {
$subs_count = $subs->find();
- common_element_start('div', $this->div_class());
-
- $idx = 0;
+ if ($subs_count == 0) {
+ common_element('p', _t('Nobody to show!'));
+ return;
+ }
+
+ common_element_start('ul', $this->div_class());
- while ($subs->fetch()) {
+ for ($idx = 0; $idx < min($subs_count, AVATARS_PER_PAGE); $idx++) {
+
+ $result = $subs->fetch();
- $idx++;
+ if (!$result) {
+ common_debug('Ran out of subscribers too early.', __FILE__);
+ break;
+ }
- $other = Profile::staticGet($subs->subscribed);
+ $other = Profile::staticGet($this->get_other($subs));
+
+ common_element_start('li');
common_element_start('a', array('title' => ($other->fullname) ?
$other->fullname :
@@ -97,14 +107,12 @@ class GalleryAction extends Action {
common_element_end('a');
# XXX: subscribe form here
-
- if ($idx == AVATARS_PER_PAGE) {
- break;
- }
+
+ common_element_end('li');
}
- common_element_end('div');
-
+ common_element_end('ul');
+
common_pagination($page > 1,
$subs_count > AVATARS_PER_PAGE,
$page,
@@ -123,6 +131,10 @@ class GalleryAction extends Action {
function define_subs(&$subs, &$profile) {
return;
}
+
+ function get_other(&$subs) {
+ return NULL;
+ }
function div_class() {
return '';