From 8f64c247fd64e1cce12489c212e55dae16e28c39 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 19 Mar 2009 11:36:24 -0400 Subject: redirect to original URL or URI for remote notices --- actions/shownotice.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/actions/shownotice.php b/actions/shownotice.php index d5f35cd84..ccae49bb3 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -177,10 +177,17 @@ class ShownoticeAction extends Action { parent::handle($args); - $this->showPage(); + if ($this->notice->is_local == 0) { + if (!empty($this->notice->url)) { + common_redirect($this->notice->url, 301); + } else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) { + common_redirect($this->notice->uri, 301); + } + } else { + $this->showPage(); + } } - /** * Don't show local navigation * @@ -191,7 +198,6 @@ class ShownoticeAction extends Action { } - /** * Fill the content area of the page * @@ -208,8 +214,6 @@ class ShownoticeAction extends Action $this->elementEnd('ul'); } - - /** * Don't show page notice * @@ -220,7 +224,6 @@ class ShownoticeAction extends Action { } - /** * Don't show aside * @@ -230,7 +233,6 @@ class ShownoticeAction extends Action function showAside() { } - /** * Extra content * -- cgit v1.2.3-54-g00ecf From 2e3f228b4bdb7bfc59a1fd0ce52fbebde7071566 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 22 Mar 2009 15:23:40 -0400 Subject: variable name error --- lib/ping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ping.php b/lib/ping.php index 2cbec2f21..d7472b920 100644 --- a/lib/ping.php +++ b/lib/ping.php @@ -48,7 +48,7 @@ function ping_broadcast_notice($notice) { 'header' => "Content-Type: text/xml\r\n". "User-Agent: Laconica/".LACONICA_VERSION."\r\n", - 'content' => $request))); + 'content' => $req))); $file = file_get_contents($notify_url, false, $context); $response = xmlrpc_decode($file); if (xmlrpc_is_fault($response)) { -- cgit v1.2.3-54-g00ecf From 149fa14bd42e7ba1fe00ae69df189db02f8779df Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 22 Mar 2009 15:34:09 -0400 Subject: not correctly checking results of XML-RPC request --- lib/ping.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ping.php b/lib/ping.php index d7472b920..3de541e9a 100644 --- a/lib/ping.php +++ b/lib/ping.php @@ -50,7 +50,15 @@ function ping_broadcast_notice($notice) { "User-Agent: Laconica/".LACONICA_VERSION."\r\n", 'content' => $req))); $file = file_get_contents($notify_url, false, $context); + + if ($file === false || mb_strlen($file) == 0) { + common_log(LOG_WARNING, + "XML-RPC empty results for ping ($notify_url, $notice->id) "); + continue; + } + $response = xmlrpc_decode($file); + if (xmlrpc_is_fault($response)) { common_log(LOG_WARNING, "XML-RPC error for ping ($notify_url, $notice->id) ". -- cgit v1.2.3-54-g00ecf From a1e37b2bd26e817a6fb1e3781c787de66d530cb6 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 23 Mar 2009 15:44:17 -0400 Subject: show subscribe button and block form again --- lib/profilelist.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/profilelist.php b/lib/profilelist.php index bd9b51958..a4cc23555 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -109,7 +109,7 @@ class ProfileList extends Widget $this->out->elementEnd('span'); $this->out->elementEnd('a'); - if ($this->profile->fullname !== '') { + if (!empty($this->profile->fullname)) { $this->out->elementStart('dl', 'entity_fn'); $this->out->element('dt', null, 'Full name'); $this->out->elementStart('dd'); @@ -119,7 +119,7 @@ class ProfileList extends Widget $this->out->elementEnd('dd'); $this->out->elementEnd('dl'); } - if ($this->profile->location !== '') { + if (!empty($this->profile->location)) { $this->out->elementStart('dl', 'entity_location'); $this->out->element('dt', null, _('Location')); $this->out->elementStart('dd', 'label'); @@ -127,7 +127,7 @@ class ProfileList extends Widget $this->out->elementEnd('dd'); $this->out->elementEnd('dl'); } - if ($this->profile->homepage !== '') { + if (!empty($this->profile->homepage)) { $this->out->elementStart('dl', 'entity_url'); $this->out->element('dt', null, _('URL')); $this->out->elementStart('dd'); @@ -138,7 +138,7 @@ class ProfileList extends Widget $this->out->elementEnd('dd'); $this->out->elementEnd('dl'); } - if ($this->profile->bio !== '') { + if (!empty($this->profile->bio)) { $this->out->elementStart('dl', 'entity_note'); $this->out->element('dt', null, _('Note')); $this->out->elementStart('dd', 'note'); @@ -194,11 +194,12 @@ class ProfileList extends Widget $this->out->elementStart('ul'); - if (!$is_own) { - # XXX: special-case for user looking at own - # subscriptions page + // Is this a logged-in user, looking at someone else's + // profile? + + if (!empty($user) && $this->profile->id != $user->id) { $this->out->elementStart('li', 'entity_subscribe'); - if (!is_null($user) && $user->isSubscribed($this->profile)) { + if ($user->isSubscribed($this->profile)) { $usf = new UnsubscribeForm($this->out, $this->profile); $usf->show(); } else { @@ -207,6 +208,9 @@ class ProfileList extends Widget } $this->out->elementEnd('li'); $this->out->elementStart('li', 'entity_block'); + if ($user->id == $this->owner->id) { + $this->showBlockForm(); + } $this->out->elementEnd('li'); } -- cgit v1.2.3-54-g00ecf From a148569705b252c334925160a7972c3da140e374 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 24 Mar 2009 10:29:30 -0400 Subject: include text of notice in favourites notification --- lib/mail.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/mail.php b/lib/mail.php index dde7571eb..27a1d99dc 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -554,17 +554,19 @@ function mail_notify_fave($other, $user, $notice) $body = sprintf(_("%1\$s just added your notice from %2\$s". " as one of their favorites.\n\n" . - "In case you forgot, you can see the text". - " of your notice here:\n\n" . + "The URL of your notice is:\n\n" . "%3\$s\n\n" . - "You can see the list of %1\$s's favorites here:\n\n" . + "The text of your notice is:\n\n" . "%4\$s\n\n" . + "You can see the list of %1\$s's favorites here:\n\n" . + "%5\$s\n\n" . "Faithfully yours,\n" . - "%5\$s\n"), + "%6\$s\n"), $bestname, common_exact_date($notice->created), common_local_url('shownotice', array('notice' => $notice->id)), + $notice->content, common_local_url('showfavorites', array('nickname' => $user->nickname)), common_config('site', 'name')); -- cgit v1.2.3-54-g00ecf