From e28c4689cee5a832c281b0329c9d279e4bbd9d33 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 1 Apr 2009 18:29:10 -0400 Subject: add sup with arguments --- actions/sup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/sup.php b/actions/sup.php index 8ef9207fa..246b3299d 100644 --- a/actions/sup.php +++ b/actions/sup.php @@ -45,7 +45,7 @@ class SupAction extends Action function availablePeriods() { static $periods = array(86400, 43200, 21600, 7200, - 3600, 1800, 600, 300, 120, + 3600, 1800, 600, 300, 120, 60, 30, 15); $available = array(); foreach ($periods as $period) { -- cgit v1.2.3-54-g00ecf From 26194cd1d6dbd7ceb021b8e215e7a7ad7b29116f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 2 Apr 2009 06:10:32 -0400 Subject: i18n for legend in remote sub form --- actions/remotesubscribe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php index 2e721a38b..0b1174896 100644 --- a/actions/remotesubscribe.php +++ b/actions/remotesubscribe.php @@ -97,7 +97,7 @@ class RemotesubscribeAction extends Action 'class' => 'form_settings', 'action' => common_local_url('remotesubscribe'))); $this->elementStart('fieldset'); - $this->element('legend', 'Subscribe to a remote user'); + $this->element('legend', _('Subscribe to a remote user')); $this->hidden('token', common_session_token()); $this->elementStart('ul', 'form_data'); -- cgit v1.2.3-54-g00ecf From 5f79653acb56867b6e31fd56f2d16cbc77622fbc Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 3 Apr 2009 14:00:52 -0400 Subject: redirect FOAF file on non-canonical nickname --- actions/foaf.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/foaf.php b/actions/foaf.php index 3a99835b4..aa78b91c3 100644 --- a/actions/foaf.php +++ b/actions/foaf.php @@ -33,7 +33,24 @@ class FoafAction extends Action function prepare($args) { parent::prepare($args); - $this->nickname = $this->trimmed('nickname'); + + $nickname_arg = $this->arg('nickname'); + + if (empty($nickname_arg)) { + $this->clientError(_('No such user.'), 404); + return false; + } + + $this->nickname = common_canonical_nickname($nickname_arg); + + // Permanent redirect on non-canonical nickname + + if ($nickname_arg != $this->nickname) { + common_redirect(common_local_url('foaf', + array('nickname' => $this->nickname)), + 301); + return false; + } $this->user = User::staticGet('nickname', $this->nickname); -- cgit v1.2.3-54-g00ecf From 5eacffcb3a29e6a997e50483d99eb0bf15711b2c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 3 Apr 2009 14:18:29 -0400 Subject: try to reduce memory usage in FOAF output --- actions/foaf.php | 44 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 10 deletions(-) (limited to 'actions') diff --git a/actions/foaf.php b/actions/foaf.php index aa78b91c3..416935b1b 100644 --- a/actions/foaf.php +++ b/actions/foaf.php @@ -139,20 +139,30 @@ class FoafAction extends Action if ($sub->find()) { while ($sub->fetch()) { - if ($sub->token) { + if (!empty($sub->token)) { $other = Remote_profile::staticGet('id', $sub->subscribed); } else { $other = User::staticGet('id', $sub->subscribed); } - if (!$other) { + if (empty($other)) { common_debug('Got a bad subscription: '.print_r($sub,true)); continue; } $this->element('knows', array('rdf:resource' => $other->uri)); - $person[$other->uri] = array(LISTENEE, $other); + $person[$other->uri] = array(LISTENEE, + $other->id, + $other->nickname, + (empty($sub->token)) ? 'User' : 'Remote_profile'); + $other->free(); + $other = null; + unset($other); } } + $sub->free(); + $sub = null; + unset($sub); + // Get people who subscribe to user $sub = new Subscription(); @@ -173,25 +183,36 @@ class FoafAction extends Action if (array_key_exists($other->uri, $person)) { $person[$other->uri][0] = BOTH; } else { - $person[$other->uri] = array(LISTENER, $other); + $person[$other->uri] = array(LISTENER, + $other->id, + $other->nickname, + (empty($sub->token)) ? 'User' : 'Remote_profile'); } + $other->free(); + $other = null; + unset($other); } } + $sub->free(); + $sub = null; + unset($sub); + $this->elementEnd('Person'); foreach ($person as $uri => $p) { $foaf_url = null; - if ($p[1] instanceof User) { - $foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname)); + list($type, $id, $nickname, $cls) = $p; + if ($cls == 'User') { + $foaf_url = common_local_url('foaf', array('nickname' => $nickname)); } - $this->profile = Profile::staticGet($p[1]->id); + $profile = Profile::staticGet($id); $this->elementStart('Person', array('rdf:about' => $uri)); - if ($p[0] == LISTENER || $p[0] == BOTH) { + if ($type == LISTENER || $type == BOTH) { $this->element('knows', array('rdf:resource' => $this->user->uri)); } - $this->showMicrobloggingAccount($this->profile, ($p[1] instanceof User) ? - common_root_url() : null); + $this->showMicrobloggingAccount($profile, ($cls == 'User') ? + common_root_url() : null); if ($foaf_url) { $this->element('rdfs:seeAlso', array('rdf:resource' => $foaf_url)); } @@ -199,6 +220,9 @@ class FoafAction extends Action if ($foaf_url) { $this->showPpd($foaf_url, $uri); } + $profile->free(); + $profile = null; + unset($profile); } $this->elementEnd('rdf:RDF'); -- cgit v1.2.3-54-g00ecf From 4d4e6ead9c98afeb43e5913b734eea9b5c783955 Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Fri, 3 Apr 2009 19:16:35 +0000 Subject: added filler text to public tagcloud for when it's empty, encouraging user to post and/or register. --- actions/public.php | 16 ---------------- actions/publictagcloud.php | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'actions') diff --git a/actions/public.php b/actions/public.php index 96c766a57..fca90488f 100644 --- a/actions/public.php +++ b/actions/public.php @@ -184,25 +184,9 @@ class PublicAction extends Action if (common_logged_in()) { $message .= _('Be the first to post!'); -/* - sprintf(_('You are logged in... %%%%site.name%%%% groups let you find and talk with ' . - 'people of similar interests. After you join a group ' . - 'you can send messages to all other members using the ' . - 'syntax "!groupname". Don\'t see a group you like? Try ' . - '[searching for one](%%%%action.groupsearch%%%%) or ' . - '[start your own!](%%%%action.newgroup%%%%)')); -*/ } else { $message .= _('Why not [register an account](%%action.register%%) and be the first to post!'); -/* - sprintf(_('You are not logged in... %%%%site.name%%%% groups let you find and talk with ' . - 'people of similar interests. After you join a group ' . - 'you can send messages to all other members using the ' . - 'syntax "!groupname". Don\'t see a group you like? Try ' . - '[searching for one](%%%%action.groupsearch%%%%) or ' . - '[start your own!](%%%%action.newgroup%%%%)')); -*/ } $this->elementStart('div', 'blankfiller'); diff --git a/actions/publictagcloud.php b/actions/publictagcloud.php index 6f5fc7541..5322372b2 100644 --- a/actions/publictagcloud.php +++ b/actions/publictagcloud.php @@ -62,6 +62,24 @@ class PublictagcloudAction extends Action $this->element('p', 'instructions', sprintf(_('These are most popular recent tags on %s '), common_config('site', 'name'))); + + $tags = new Notice_tag(); + if ($tags->count()) { + return; + } + + $message = _('Noone has posted a notice with a [hashtag](%%doc.tags%%) yet.') . ' '; + + if (common_logged_in()) { + $message .= _('Be the first to post one!'); + } + else { + $message .= _('Why not [register an account](%%action.register%%) and be the first to post one!'); + } + + $this->elementStart('div', 'blankfiller'); + $this->raw(common_markup_to_html($message)); + $this->elementEnd('div'); } function showLocalNav() -- cgit v1.2.3-54-g00ecf From e1fec6db2fdc9c28878c8f87bd5b55d1b1e5e1fa Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Fri, 3 Apr 2009 20:34:27 +0000 Subject: Simplified code for empty public timeline. --- actions/public.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'actions') diff --git a/actions/public.php b/actions/public.php index fca90488f..5a2720a9a 100644 --- a/actions/public.php +++ b/actions/public.php @@ -168,14 +168,13 @@ class PublicAction extends Action function showPageNotice() { - $notice = Notice::publicStream(0, 1); + $notice = new Notice; if (!$notice) { $this->serverError(_('Could not retrieve public stream.')); return; } - // no notices in the public stream, let's get out of here if ($notice->count()) { return; } -- cgit v1.2.3-54-g00ecf From 96982477220316ee7af0326dc6ff42d2438b540e Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Fri, 3 Apr 2009 20:35:18 +0000 Subject: Added filler text to popular page for when it's empty, encouraging user to add favorites and/or register. --- actions/favorited.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'actions') diff --git a/actions/favorited.php b/actions/favorited.php index 231b97897..20a354674 100644 --- a/actions/favorited.php +++ b/actions/favorited.php @@ -143,6 +143,25 @@ class FavoritedAction extends Action $this->elementStart('div', 'instructions'); $this->raw($output); $this->elementEnd('div'); + + $favorite = new Fave; + + if ($favorite->count()) { + return; + } + + $message = _('Favorite notices appear on this page but noone has favorited one yet.') . ' '; + + if (common_logged_in()) { + $message .= _('Be the first to add a notice to your favorites by clicking the fave button next to any notice you like.'); + } + else { + $message .= _('Why not [register an account](%%action.register%%) and be the first to add a notice to your favorites!'); + } + + $this->elementStart('div', 'blankfiller'); + $this->raw(common_markup_to_html($message)); + $this->elementEnd('div'); } /** -- cgit v1.2.3-54-g00ecf From 439d521c86e07fc7bc0c84e62022fc160f8f0fcf Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Fri, 3 Apr 2009 20:37:29 +0000 Subject: Tiny change to the public tag cloud dealing with empty page. --- actions/publictagcloud.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/publictagcloud.php b/actions/publictagcloud.php index 5322372b2..5bc7e0cbf 100644 --- a/actions/publictagcloud.php +++ b/actions/publictagcloud.php @@ -63,7 +63,7 @@ class PublictagcloudAction extends Action sprintf(_('These are most popular recent tags on %s '), common_config('site', 'name'))); - $tags = new Notice_tag(); + $tags = new Notice_tag; if ($tags->count()) { return; } -- cgit v1.2.3-54-g00ecf