From 8ba43f18cdfad31415bc9e26b2d4be9e9b4465c0 Mon Sep 17 00:00:00 2001 From: CiaranG Date: Sat, 21 Mar 2009 14:16:54 +0000 Subject: Changes to router setup to make notice search RSS feed work --- lib/router.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/router.php b/lib/router.php index e39dc217a..83b3ffe60 100644 --- a/lib/router.php +++ b/lib/router.php @@ -136,10 +136,14 @@ class Router foreach (array('group', 'people', 'notice') as $s) { $m->connect('search/'.$s, array('action' => $s.'search')); - $m->connect('search/'.$s.'?q=:q', array('action' => $s.'search'), array('q' => '.+')); + $m->connect('search/'.$s.'?q=:q', array('action' => $s.'search'),array('q' => '.+')); } + // The second of these is needed to make the link work correctly + // when inserted into the page. The first is needed to match the + // route on the way in. Seems to be another Net_URL_Mapper bug to me. $m->connect('search/notice/rss', array('action' => 'noticesearchrss')); + $m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'),array('q' => '.+')); // notice @@ -421,6 +425,8 @@ class Router function build($action, $args=null, $params=null, $fragment=null) { + if($params!=null) + common_log(LOG_DEBUG,"build: ".$action." ".print_r($args,true)." ".print_r($params,true)); $action_arg = array('action' => $action); if ($args) { @@ -429,6 +435,8 @@ class Router $args = $action_arg; } + if($params!=null) + common_log(LOG_DEBUG,"generate args:".print_r($args,true)); return $this->m->generate($args, $params, $fragment); } } -- cgit v1.2.3-54-g00ecf From c4072ef7c930b82b74f8e90f6554974b761c686c Mon Sep 17 00:00:00 2001 From: CiaranG Date: Sat, 21 Mar 2009 14:18:38 +0000 Subject: RSS 1.0 actions were reading the stream from the database twice. Inefficient, but more importantly made notice search RSS fail with a DB error due to double search on a DB_DataObject instance --- lib/rssaction.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/rssaction.php b/lib/rssaction.php index 66c2d9e8c..ddba862dc 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -94,11 +94,11 @@ class Rss10Action extends Action function handle($args) { - // Get the list of notices - $this->notices = $this->getNotices(); // Parent handling, including cache check parent::handle($args); - $this->showRss($this->limit); + // Get the list of notices + $this->notices = $this->getNotices($this->limit); + $this->showRss(); } /** @@ -132,15 +132,13 @@ class Rss10Action extends Action return null; } - function showRss($limit=0) + function showRss() { - $notices = $this->getNotices($limit); - $this->initRss(); - $this->showChannel($notices); + $this->showChannel(); $this->showImage(); - foreach ($notices as $n) { + foreach ($this->notices as $n) { $this->showItem($n); } @@ -148,7 +146,7 @@ class Rss10Action extends Action $this->endRss(); } - function showChannel($notices) + function showChannel() { $channel = $this->getChannel(); @@ -167,7 +165,7 @@ class Rss10Action extends Action $this->elementStart('items'); $this->elementStart('rdf:Seq'); - foreach ($notices as $notice) { + foreach ($this->notices as $notice) { $this->element('sioct:MicroblogPost', array('rdf:resource' => $notice->uri)); } -- cgit v1.2.3-54-g00ecf From e947d9fdd1245d5b785df8c709d620e7d0940991 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(-) (limited to 'lib') 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 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(-) (limited to 'lib') 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(+) (limited to 'lib') 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 3ef4f251acbe8ebdfd9d7f1ea43b7344b7332b73 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 22 Mar 2009 16:58:38 -0400 Subject: One function for producing Atom entry for a Notice Took the various places that we create an atom entry for a notice, and jammed them together into one function of the notice class, and then used that function. Also, added Atom threading extension and categories for hashtags. --- classes/Notice.php | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/jabber.php | 57 ++++++++++----------------------- lib/twitterapi.php | 30 +++++------------ 3 files changed, 118 insertions(+), 63 deletions(-) (limited to 'lib') diff --git a/classes/Notice.php b/classes/Notice.php index 3087e39a7..44a6aeb98 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -799,4 +799,98 @@ class Notice extends Memcached_DataObject } } } + + function asAtomEntry($namespace=false, $source=false) + { + $profile = $this->getProfile(); + + $xs = new XMLStringer(true); + + if ($namespace) { + $attrs = array('xmlns' => 'http://www.w3.org/2005/Atom', + 'xmlns:thr' => 'http://purl.org/syndication/thread/1.0'); + } else { + $attrs = array(); + } + + $xs->elementStart('entry', $attrs); + + if ($source) { + $xs->elementStart('source'); + $xs->element('title', null, $profile->nickname . " - " . common_config('site', 'name')); + $xs->element('link', array('href' => $profile->profileurl)); + $user = User::staticGet('id', $profile->id); + if (!empty($user)) { + $atom_feed = common_local_url('api', + array('apiaction' => 'statuses', + 'method' => 'user_timeline', + 'argument' => $profile->nickname.'.atom')); + $xs->element('link', array('rel' => 'self', + 'type' => 'application/atom+xml', + 'href' => $profile->profileurl)); + $xs->element('link', array('rel' => 'license', + 'href' => common_config('license', 'url'))); + } + + $xs->element('icon', null, $profile->avatarUrl(AVATAR_PROFILE_SIZE)); + } + + $xs->elementStart('author'); + $xs->element('name', null, $profile->nickname); + $xs->element('uri', null, $profile->profileurl); + $xs->elementEnd('author'); + + if ($source) { + $xs->elementEnd('source'); + } + + $xs->element('title', null, $this->content); + $xs->element('summary', null, $this->content); + + $xs->element('link', array('rel' => 'alternate', + 'href' => $this->bestUrl())); + + $xs->element('id', null, $this->uri); + + $xs->element('published', null, common_date_w3dtf($this->created)); + $xs->element('updated', null, common_date_w3dtf($this->modified)); + + if ($this->reply_to) { + $reply_notice = Notice::staticGet('id', $this->reply_to); + if (!empty($reply_notice)) { + $xs->element('link', array('rel' => 'related', + 'href' => $reply_notice->bestUrl())); + $xs->element('thr:in-reply-to', + array('ref' => $reply_notice->uri, + 'href' => $reply_notice->bestUrl())); + } + } + + $xs->element('content', array('type' => 'html'), $this->rendered); + + $tag = new Notice_tag(); + $tag->notice_id = $this->id; + if ($tag->find()) { + while ($tag->fetch()) { + $xs->element('category', array('term' => $tag->tag)); + } + } + $tag->free(); + + $xs->elementEnd('entry'); + + return $xs->getString(); + } + + function bestUrl() + { + if (!empty($this->url)) { + return $this->url; + } else if (!empty($this->uri) && preg_match('/^https?:/', $this->uri)) { + return $this->uri; + } else { + return common_local_url('shownotice', + array('notice' => $this->id)); + } + } } diff --git a/lib/jabber.php b/lib/jabber.php index 3cd3b0d37..9108d1c47 100644 --- a/lib/jabber.php +++ b/lib/jabber.php @@ -163,50 +163,25 @@ function jabber_send_notice($to, $notice) function jabber_format_entry($profile, $notice) { - // FIXME: notice url might be remote - - $noticeurl = common_local_url('shownotice', - array('notice' => $notice->id)); - - $msg = jabber_format_notice($profile, $notice); - - $self_url = common_local_url('userrss', array('nickname' => $profile->nickname)); - - $entry = "\n\n"; - $entry .= "\n"; - $entry .= "" . $profile->nickname . " - " . common_config('site', 'name') . "\n"; - $entry .= "\n"; - $entry .= "\n"; - $entry .= "" . $profile->nickname . "\n"; - $entry .= "" . $profile->avatarUrl(AVATAR_PROFILE_SIZE) . "\n"; - $entry .= "\n"; - $entry .= "" . htmlspecialchars($msg) . "\n"; - $entry .= "" . htmlspecialchars($msg) . "\n"; - $entry .= "\n"; - $entry .= "". $notice->uri . "\n"; - $entry .= "".common_date_w3dtf($notice->created)."\n"; - $entry .= "".common_date_w3dtf($notice->modified)."\n"; - if ($notice->reply_to) { - $replyurl = common_local_url('shownotice', - array('notice' => $notice->reply_to)); - $entry .= "\n"; + $entry = $notice->asAtomEntry(true, true); + + $xs = new XMLStringer(); + $xs->elementStart('html', array('xmlns' => 'http://jabber.org/protocol/xhtml-im')); + $xs->elementStart('body', array('xmlns' => 'http://www.w3.org/1999/xhtml')); + $xs->element('a', array('href' => $profile->profileurl), + $profile->nickname); + $xs->text(": "); + if (!empty($notice->rendered)) { + $xs->raw($notice->rendered); + } else { + $xs->raw(common_render_content($notice->content, $notice)); } - $entry .= "\n"; - - $html = "\n\n"; - $html .= "\n"; - $html .= "".$profile->nickname.": "; - $html .= ($notice->rendered) ? $notice->rendered : common_render_content($notice->content, $notice); - $html .= "\n\n"; - $html .= "\n\n"; - - $address = "\n"; - $address .= "
\n"; - $address .= "\n"; + $xs->elementEnd('body'); + $xs->elementEnd('html'); - // FIXME: include a pubsub event, too. + $html = $xs->asString(); - return $html . $entry . $address; + return $html . ' ' . $entry; } /** diff --git a/lib/twitterapi.php b/lib/twitterapi.php index e7239acd5..b8357c688 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -238,21 +238,6 @@ class TwitterapiAction extends Action $this->elementEnd('item'); } - function show_twitter_atom_entry($entry) - { - $this->elementStart('entry'); - $this->element('title', null, $entry['title']); - $this->element('content', array('type' => 'html'), $entry['content']); - $this->element('id', null, $entry['id']); - $this->element('published', null, $entry['published']); - $this->element('updated', null, $entry['updated']); - $this->element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), null); - $this->elementStart('author'); - $this->element('name', null, $entry['author']); - $this->elementEnd('author'); - $this->elementEnd('entry'); - } - function show_json_objects($objects) { print(json_encode($objects)); @@ -383,7 +368,7 @@ class TwitterapiAction extends Action } if (!is_null($selfuri)) { - $this->element('link', array('href' => $selfuri, + $this->element('link', array('href' => $selfuri, 'rel' => 'self', 'type' => 'application/atom+xml'), null); } @@ -392,13 +377,11 @@ class TwitterapiAction extends Action if (is_array($notice)) { foreach ($notice as $n) { - $entry = $this->twitter_rss_entry_array($n); - $this->show_twitter_atom_entry($entry); + $this->raw($n->asAtomEntry()); } } else { while ($notice->fetch()) { - $entry = $this->twitter_rss_entry_array($notice); - $this->show_twitter_atom_entry($entry); + $this->raw($notice->asAtomEntry()); } } @@ -578,13 +561,16 @@ class TwitterapiAction extends Action function init_twitter_atom() { $this->startXML(); - $this->elementStart('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', 'xml:lang' => 'en-US')); + // FIXME: don't hardcode the language here! + $this->elementStart('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', + 'xml:lang' => 'en-US', + 'xmlns:thr' => 'http://purl.org/syndication/thread/1.0')); } function end_twitter_atom() { - $this->endXML(); $this->elementEnd('feed'); + $this->endXML(); } function show_profile($profile, $content_type='xml', $notice=null) -- cgit v1.2.3-54-g00ecf From 14afe2d26874ed30a0ccef5e0acda2c5171afcde 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(-) (limited to 'lib') 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 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(-) (limited to 'lib') 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 fc6b7e28d46dea9526fbda0c56747dd2d4d960e9 Mon Sep 17 00:00:00 2001 From: CiaranG Date: Mon, 23 Mar 2009 22:45:03 +0000 Subject: Fixed jabber code broken in 3ef4f251acbe8ebdfd9d7f1ea43b7344b7332b73 --- lib/jabber.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/jabber.php b/lib/jabber.php index 9108d1c47..7d584ad01 100644 --- a/lib/jabber.php +++ b/lib/jabber.php @@ -179,7 +179,7 @@ function jabber_format_entry($profile, $notice) $xs->elementEnd('body'); $xs->elementEnd('html'); - $html = $xs->asString(); + $html = $xs->getString(); return $html . ' ' . $entry; } -- cgit v1.2.3-54-g00ecf From 88269b288a2b62543cf867d92b6e7cc41d44b922 Mon Sep 17 00:00:00 2001 From: CiaranG Date: Tue, 24 Mar 2009 08:05:02 +0000 Subject: Fix to Korean language selection - see ticket #1351 --- lib/language.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/language.php b/lib/language.php index 6791df699..cd6498d30 100644 --- a/lib/language.php +++ b/lib/language.php @@ -115,7 +115,7 @@ function get_all_languages() { 'he' => array('q' => 0.5, 'lang' => 'he_IL', 'name' => 'Hebrew', 'direction' => 'rtl'), 'it' => array('q' => 1, 'lang' => 'it_IT', 'name' => 'Italian', 'direction' => 'ltr'), 'jp' => array('q' => 0.5, 'lang' => 'ja_JP', 'name' => 'Japanese', 'direction' => 'ltr'), - 'ko' => array('q' => 0.9, 'lang' => 'ko', 'name' => 'Korean', 'direction' => 'ltr'), + 'ko' => array('q' => 0.9, 'lang' => 'ko_KR', 'name' => 'Korean', 'direction' => 'ltr'), 'mk' => array('q' => 0.5, 'lang' => 'mk_MK', 'name' => 'Macedonian', 'direction' => 'ltr'), 'nb' => array('q' => 0.1, 'lang' => 'nb_NO', 'name' => 'Norwegian (Bokmål)', 'direction' => 'ltr'), 'no' => array('q' => 0.1, 'lang' => 'nb_NO', 'name' => 'Norwegian (Bokmål)', 'direction' => 'ltr'), -- 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(-) (limited to 'lib') 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 From 2c8f67f6a9b4e93161e7cae0c38162cb8991e0ef Mon Sep 17 00:00:00 2001 From: CiaranG Date: Wed, 25 Mar 2009 15:39:58 +0000 Subject: A different search pagination fix (see ticket #1333) that doesn't require fixing the upstream code, thus undoing the change made in d64be5108d69ff4068d4383ab121a3ba7388ada3 --- extlib/Net/URL/Mapper/Path.php | 9 ++------- lib/router.php | 12 +++++++++++- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/extlib/Net/URL/Mapper/Path.php b/extlib/Net/URL/Mapper/Path.php index eb1c34a3f..b541002c7 100644 --- a/extlib/Net/URL/Mapper/Path.php +++ b/extlib/Net/URL/Mapper/Path.php @@ -241,12 +241,7 @@ class Net_URL_Mapper_Path } $path = '/'.trim(Net_URL::resolvePath($path), '/'); if (!empty($qstring)) { - if (!strpos($path, '?')) { - $path .= '?'; - } else { - $path .= '&'; - } - $path .= http_build_query($qstring); + $path .= '?'.http_build_query($qstring); } if (!empty($anchor)) { $path .= '#'.ltrim($anchor, '#'); @@ -432,4 +427,4 @@ class Net_URL_Mapper_Path } -?> +?> \ No newline at end of file diff --git a/lib/router.php b/lib/router.php index 83b3ffe60..d1217ca3c 100644 --- a/lib/router.php +++ b/lib/router.php @@ -437,6 +437,16 @@ class Router if($params!=null) common_log(LOG_DEBUG,"generate args:".print_r($args,true)); - return $this->m->generate($args, $params, $fragment); + $url=$this->m->generate($args, $params, $fragment); + + // Due to a bug in the Net_URL_Mapper code, the returned URL may + // contain a malformed query of the form ?p1=v1?p2=v2?p3=v3. We + // repair that here rather than modifying the upstream code... + $qpos = strpos($url,'?'); + if ($qpos !== false) { + $url = substr($url, 0, $qpos+1) . + str_replace('?', '&', substr($url, $qpos+1)); + } + return $url; } } -- cgit v1.2.3-54-g00ecf From 55e8a6ca1b0af8e05a7ee22735585ef5ebd66fc6 Mon Sep 17 00:00:00 2001 From: CiaranG Date: Wed, 25 Mar 2009 15:39:58 +0000 Subject: A different search pagination fix (see ticket #1333) that doesn't require fixing the upstream code, thus undoing the change made in d64be5108d69ff4068d4383ab121a3ba7388ada3 Merged. --- extlib/Net/URL/Mapper/Path.php | 9 ++------- lib/router.php | 12 +++++++++++- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/extlib/Net/URL/Mapper/Path.php b/extlib/Net/URL/Mapper/Path.php index eb1c34a3f..b541002c7 100644 --- a/extlib/Net/URL/Mapper/Path.php +++ b/extlib/Net/URL/Mapper/Path.php @@ -241,12 +241,7 @@ class Net_URL_Mapper_Path } $path = '/'.trim(Net_URL::resolvePath($path), '/'); if (!empty($qstring)) { - if (!strpos($path, '?')) { - $path .= '?'; - } else { - $path .= '&'; - } - $path .= http_build_query($qstring); + $path .= '?'.http_build_query($qstring); } if (!empty($anchor)) { $path .= '#'.ltrim($anchor, '#'); @@ -432,4 +427,4 @@ class Net_URL_Mapper_Path } -?> +?> \ No newline at end of file diff --git a/lib/router.php b/lib/router.php index e39dc217a..135e07a0f 100644 --- a/lib/router.php +++ b/lib/router.php @@ -429,6 +429,16 @@ class Router $args = $action_arg; } - return $this->m->generate($args, $params, $fragment); + $url = $this->m->generate($args, $params, $fragment); + + // Due to a bug in the Net_URL_Mapper code, the returned URL may + // contain a malformed query of the form ?p1=v1?p2=v2?p3=v3. We + // repair that here rather than modifying the upstream code... + $qpos = strpos($url,'?'); + if ($qpos !== false) { + $url = substr($url, 0, $qpos+1) . + str_replace('?', '&', substr($url, $qpos+1)); + } + return $url; } } -- cgit v1.2.3-54-g00ecf From a13bfa5848705d23353783f195b67c088a72a8cb Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 25 Mar 2009 18:16:20 +0000 Subject: Ticket http://laconi.ca/trac/ticket/1274 Minimised form_notice markup by removing unordered lists. There is a minor CSS rule reassignment done by changing the selectors. There is no visual change in the final result. --- lib/messageform.php | 10 --------- lib/noticeform.php | 9 -------- theme/base/css/display.css | 51 ++++++++-------------------------------------- 3 files changed, 9 insertions(+), 61 deletions(-) (limited to 'lib') diff --git a/lib/messageform.php b/lib/messageform.php index f41508305..b8878ec1f 100644 --- a/lib/messageform.php +++ b/lib/messageform.php @@ -132,20 +132,14 @@ class MessageForm extends Form $mutual_users->free(); unset($mutual_users); - $this->out->elementStart('ul', 'form_data'); - $this->out->elementStart('li', array('id' => 'notice_to')); $this->out->dropdown('to', _('To'), $mutual, null, false, ($this->to) ? $this->to->id : null); - $this->out->elementEnd('li'); - $this->out->elementStart('li', array('id' => 'notice_text')); $this->out->element('textarea', array('id' => 'notice_data-text', 'cols' => 35, 'rows' => 4, 'name' => 'content'), ($this->content) ? $this->content : ''); - $this->out->elementEnd('li'); - $this->out->elementEnd('ul'); } /** @@ -156,14 +150,10 @@ class MessageForm extends Form function formActions() { - $this->out->elementStart('ul', 'form_actions'); - $this->out->elementStart('li', array('id' => 'notice_submit')); $this->out->element('input', array('id' => 'notice_action-submit', 'class' => 'submit', 'name' => 'message_send', 'type' => 'submit', 'value' => _('Send'))); - $this->out->elementEnd('li'); - $this->out->elementEnd('ul'); } } diff --git a/lib/noticeform.php b/lib/noticeform.php index 0c991c969..606b5d028 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -134,9 +134,6 @@ class NoticeForm extends Form function formData() { - - $this->out->elementStart('ul', 'form_data'); - $this->out->elementStart('li', array('id' => 'notice_text')); $this->out->element('label', array('for' => 'notice_data-text'), sprintf(_('What\'s up, %s?'), $this->user->nickname)); // XXX: vary by defined max size @@ -145,8 +142,6 @@ class NoticeForm extends Form 'rows' => 4, 'name' => 'status_textarea'), ($this->content) ? $this->content : ''); - $this->out->elementEnd('li'); - $this->out->elementEnd('ul'); $this->out->elementStart('dl', 'form_note'); $this->out->element('dt', null, _('Available characters')); @@ -168,14 +163,10 @@ class NoticeForm extends Form function formActions() { - $this->out->elementStart('ul', 'form_actions'); - $this->out->elementStart('li', array('id' => 'notice_submit')); $this->out->element('input', array('id' => 'notice_action-submit', 'class' => 'submit', 'name' => 'status_submit', 'type' => 'submit', 'value' => _('Send'))); - $this->out->elementEnd('li'); - $this->out->elementEnd('ul'); } } diff --git a/theme/base/css/display.css b/theme/base/css/display.css index a10ec0223..90cd00d55 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -421,6 +421,7 @@ padding:0; display:none; } #form_notice textarea { +float:left; border-radius:7px; -moz-border-radius:7px; -webkit-border-radius:7px; @@ -431,30 +432,19 @@ padding:7px 7px 16px 7px; } #form_notice label { display:block; +float:left; font-size:1.3em; margin-bottom:7px; } -#form_notice .form_data li { -float:left; -} - -#form_notice #notice_attach_file label, #form_notice #notice_submit label { display:none; } - -#form_notice #notice_attachment { -margin-top:25px; -margin-left:4px; -} - #form_notice .form_note { position:absolute; top:99px; right:98px; z-index:9; } - #form_notice .form_note dt { font-weight:bold; display:none; @@ -464,42 +454,19 @@ font-weight:bold; line-height:1.15; padding:1px 2px; } - -#form_notice #notice_data-attach_view { -position:absolute; -top:25px; -right:30px; -margin-left:4px; -padding:0; -width:16px; -height:16px; -border:0; -text-indent:-9999px; -} -#form_notice .form_actions { +#form_notice #notice_action-submit { +width:60px; +padding:8px; position:absolute; bottom:0; right:0; } -#form_notice .form_actions input.submit { -width:60px; -padding:8px; -} - -#form_notice li { -margin-bottom:0; -} - -#form_notice #notice_to { -margin-bottom:7px; -} - -#notice_to label { -float:left; -margin-right:18px; +#form_notice label[for=to] { margin-top:11px; } -#notice_to select { +#form_notice select[id=to] { +margin-bottom:7px; +margin-left:18px; float:left; } /*end FORM NOTICE*/ -- cgit v1.2.3-54-g00ecf From 07eae0ce4d927851a839cf50d5cb9b7a06b979a2 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 26 Mar 2009 15:03:59 -0400 Subject: Support SSL for some, all, or no pages Support SSL URLs either for all pages; no pages; or for sensitive pages accepting passwords, like login, registration, API, and others. --- README | 10 ++++++++++ config.php.sample | 10 ++++++++++ lib/common.php | 2 ++ lib/util.php | 31 ++++++++++++++++++++++++++----- 4 files changed, 48 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/README b/README index 7feb7d90b..62f4f1863 100644 --- a/README +++ b/README @@ -925,6 +925,16 @@ dupelimit: Time in which it's not OK for the same person to post the same notice; default = 60 seconds. logo: URL of an image file to use as the logo for the site. Overrides the logo in the theme, if any. +ssl: Whether to use SSL and https:// URLs for some or all pages. + Possible values are 'always' (use it for all pages), 'never' + (don't use it for any pages), or 'sometimes' (use it for + sensitive pages that include passwords like login and registration, + but not for regular pages). Default to 'never'. +sslserver: use an alternate server name for SSL URLs, like + 'secure.example.org'. You should be careful to set cookie + parameters correctly so that both the SSL server and the + "normal" server can access the session cookie and + preferably other cookies as well. db -- diff --git a/config.php.sample b/config.php.sample index 529e86f15..d62a54fe7 100644 --- a/config.php.sample +++ b/config.php.sample @@ -174,3 +174,13 @@ $config['sphinx']['port'] = 3312; #http://taguri.org/ Examples: #$config['integration']['taguri'] = 'example.net,2008'; #$config['integration']['taguri'] = 'admin@example.net,2009-03-09' + +#Don't use SSL +#$config['site']['ssl'] = 'never'; +#Use SSL only for sensitive pages (like login, password change) +#$config['site']['ssl'] = 'sometimes'; +#Use SSL for all pages +#$config['site']['ssl'] = 'always'; + +#Use a different hostname for SSL-encrypted pages +#$config['site']['sslserver'] = 'secure.example.org'; diff --git a/lib/common.php b/lib/common.php index 1ca9e521b..d9d0ab277 100644 --- a/lib/common.php +++ b/lib/common.php @@ -87,6 +87,8 @@ $config = 'closed' => false, 'inviteonly' => false, 'private' => false, + 'ssl' => 'never', + 'sslserver' => null, 'dupelimit' => 60), # default for same person saying the same thing 'syslog' => array('appname' => 'laconica', # for syslog diff --git a/lib/util.php b/lib/util.php index a43666fa5..0a1137a77 100644 --- a/lib/util.php +++ b/lib/util.php @@ -713,25 +713,46 @@ function common_relative_profile($sender, $nickname, $dt=null) function common_local_url($action, $args=null, $params=null, $fragment=null) { + static $sensitive = array('login', 'register', 'passwordsettings', + 'twittersettings', 'finishopenidlogin', + 'api'); + $r = Router::get(); $path = $r->build($action, $args, $params, $fragment); + $ssl = in_array($action, $sensitive); + if (common_config('site','fancy')) { - $url = common_path(mb_substr($path, 1)); + $url = common_path(mb_substr($path, 1), $ssl); } else { if (mb_strpos($path, '/index.php') === 0) { - $url = common_path(mb_substr($path, 1)); + $url = common_path(mb_substr($path, 1), $ssl); } else { - $url = common_path('index.php'.$path); + $url = common_path('index.php'.$path, $ssl); } } return $url; } -function common_path($relative) +function common_path($relative, $ssl=false) { $pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : ''; - return "http://".common_config('site', 'server').'/'.$pathpart.$relative; + + if (($ssl && (common_config('site', 'ssl') === 'sometimes')) + || common_config('site', 'ssl') === 'always') { + $proto = 'https'; + if (is_string(common_config('site', 'sslserver')) && + mb_strlen(common_config('site', 'sslserver')) > 0) { + $serverpart = common_config('site', 'sslserver'); + } else { + $serverpart = common_config('site', 'server'); + } + } else { + $proto = 'http'; + $serverpart = common_config('site', 'server'); + } + + return $proto.'://'.$serverpart.'/'.$pathpart.$relative; } function common_date_string($dt) -- cgit v1.2.3-54-g00ecf From fe426a3152db14e175e3a5bb819c4eca4279b6f7 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 28 Mar 2009 17:36:39 -0400 Subject: welcome notice, default sub for new users --- README | 14 ++++++++++++++ classes/User.php | 42 ++++++++++++++++++++++++++++++++++++++++++ lib/common.php | 3 +++ lib/noticelist.php | 1 + 4 files changed, 60 insertions(+) (limited to 'lib') diff --git a/README b/README index 62f4f1863..95f9edcea 100644 --- a/README +++ b/README @@ -1179,6 +1179,20 @@ banned: an array of usernames and/or profile IDs of 'banned' profiles. not be accepted at all. (Compare with blacklisted users above, whose posts just won't show up in the public stream.) +newuser +------- + +Options with new users. + +subscribe: nickname of a user account to automatically subscribe new + users to. Typically this would be system account for e.g. + service updates or announcements. Users are able to unsub + if they want. Default is null; no auto subscribe. +welcome: nickname of a user account that sends welcome messages to new + users. Can be the same as 'subscribe' account, although on + busy servers it may be a good idea to keep that one just for + 'urgent' messages. Default is null; no message. + Troubleshooting =============== diff --git a/classes/User.php b/classes/User.php index d9f30bec5..e9e472fe1 100644 --- a/classes/User.php +++ b/classes/User.php @@ -273,12 +273,54 @@ class User extends Memcached_DataObject $user->emailChanged(); } + // Default system subscription + + $defnick = common_config('newuser', 'default'); + + if (!empty($defnick)) { + $defuser = User::staticGet('nickname', $defnick); + if (empty($defuser)) { + common_log(LOG_WARNING, sprintf("Default user %s does not exist.", $defnick), + __FILE__); + } else { + $defsub = new Subscription(); + $defsub->subscriber = $user->id; + $defsub->subscribed = $defuser->id; + $defsub->created = $user->created; + + $result = $defsub->insert(); + + if (!$result) { + common_log_db_error($defsub, 'INSERT', __FILE__); + return false; + } + } + } + $profile->query('COMMIT'); if ($email && !$user->email) { mail_confirm_address($user, $confirm->code, $profile->nickname, $email); } + // Welcome message + + $welcome = common_config('newuser', 'welcome'); + + if (!empty($welcome)) { + $welcomeuser = User::staticGet('nickname', $welcome); + if (empty($welcomeuser)) { + common_log(LOG_WARNING, sprintf("Welcome user %s does not exist.", $defnick), + __FILE__); + } else { + $notice = Notice::saveNew($welcomeuser->id, + sprintf(_('Welcome to %1$s, @%2$s!'), + common_config('site', 'name'), + $user->nickname), + 'system'); + } + } + return $user; } diff --git a/lib/common.php b/lib/common.php index d9d0ab277..c2037c3ad 100644 --- a/lib/common.php +++ b/lib/common.php @@ -153,6 +153,9 @@ $config = array('notify' => array()), 'inboxes' => array('enabled' => true), # on by default for new sites + 'newuser' => + array('subscribe' => null, + 'welcome' => null), ); $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options'); diff --git a/lib/noticelist.php b/lib/noticelist.php index 9fc0126b3..6af301839 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -387,6 +387,7 @@ class NoticeListItem extends Widget case 'xmpp': case 'mail': case 'omb': + case 'system': case 'api': $this->out->element('dd', null, $source_name); break; -- cgit v1.2.3-54-g00ecf From 3af66807161628969395bfb65ada38f977c94edf Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 30 Mar 2009 10:17:10 -0400 Subject: add a title to attention notice links --- lib/util.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/util.php b/lib/util.php index a43666fa5..7b2930914 100644 --- a/lib/util.php +++ b/lib/util.php @@ -622,9 +622,13 @@ function common_at_link($sender_id, $nickname) $url = $recipient->profileurl; } $xs = new XMLStringer(false); + $attrs = array('href' => $url, + 'class' => 'url'); + if (!empty($recipient->fullname)) { + $attrs['title'] = $recipient->fullname . ' (' . $recipient->nickname . ')'; + } $xs->elementStart('span', 'vcard'); - $xs->elementStart('a', array('href' => $url, - 'class' => 'url')); + $xs->elementStart('a', $attrs); $xs->element('span', 'fn nickname', $nickname); $xs->elementEnd('a'); $xs->elementEnd('span'); -- cgit v1.2.3-54-g00ecf From d5ac986b800858348dec746d64c8b907043ba225 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 30 Mar 2009 10:26:36 -0400 Subject: add titles to group links in notices --- lib/util.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/util.php b/lib/util.php index 7b2930914..ef73adc36 100644 --- a/lib/util.php +++ b/lib/util.php @@ -643,10 +643,14 @@ function common_group_link($sender_id, $nickname) $sender = Profile::staticGet($sender_id); $group = User_group::staticGet('nickname', common_canonical_nickname($nickname)); if ($group && $sender->isMember($group)) { + $attrs = array('href' => $group->permalink(), + 'class' => 'url'); + if (!empty($group->fullname)) { + $attrs['title'] = $group->fullname . ' (' . $group->nickname . ')'; + } $xs = new XMLStringer(); $xs->elementStart('span', 'vcard'); - $xs->elementStart('a', array('href' => $group->permalink(), - 'class' => 'url')); + $xs->elementStart('a', $attrs); $xs->element('span', 'fn nickname', $nickname); $xs->elementEnd('a'); $xs->elementEnd('span'); -- cgit v1.2.3-54-g00ecf From a68836acb4c43500dbff89be1faec19969bc34c2 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 30 Mar 2009 10:38:26 -0400 Subject: add full name title to notice list link --- lib/noticelist.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/noticelist.php b/lib/noticelist.php index 9fc0126b3..8523f2e63 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -258,8 +258,12 @@ class NoticeListItem extends Widget function showAuthor() { $this->out->elementStart('span', 'vcard author'); - $this->out->elementStart('a', array('href' => $this->profile->profileurl, - 'class' => 'url')); + $attrs = array('href' => $this->profile->profileurl, + 'class' => 'url'); + if (!empty($this->profile->fullname)) { + $attrs['title'] = $this->profile->fullname . ' (' . $this->profile->nickname . ') '; + } + $this->out->elementStart('a', $attrs); $this->showAvatar(); $this->showNickname(); $this->out->elementEnd('a'); -- cgit v1.2.3-54-g00ecf From 148310e5fc78e69f6bde3683855009dc3d8d485b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 28 Mar 2009 17:36:39 -0400 Subject: welcome notice, default sub for new users --- README | 14 ++++++++++++++ classes/User.php | 42 ++++++++++++++++++++++++++++++++++++++++++ lib/common.php | 3 +++ lib/noticelist.php | 1 + 4 files changed, 60 insertions(+) (limited to 'lib') diff --git a/README b/README index 71760ce4f..73cb95367 100644 --- a/README +++ b/README @@ -1169,6 +1169,20 @@ banned: an array of usernames and/or profile IDs of 'banned' profiles. not be accepted at all. (Compare with blacklisted users above, whose posts just won't show up in the public stream.) +newuser +------- + +Options with new users. + +subscribe: nickname of a user account to automatically subscribe new + users to. Typically this would be system account for e.g. + service updates or announcements. Users are able to unsub + if they want. Default is null; no auto subscribe. +welcome: nickname of a user account that sends welcome messages to new + users. Can be the same as 'subscribe' account, although on + busy servers it may be a good idea to keep that one just for + 'urgent' messages. Default is null; no message. + Troubleshooting =============== diff --git a/classes/User.php b/classes/User.php index d9f30bec5..e9e472fe1 100644 --- a/classes/User.php +++ b/classes/User.php @@ -273,12 +273,54 @@ class User extends Memcached_DataObject $user->emailChanged(); } + // Default system subscription + + $defnick = common_config('newuser', 'default'); + + if (!empty($defnick)) { + $defuser = User::staticGet('nickname', $defnick); + if (empty($defuser)) { + common_log(LOG_WARNING, sprintf("Default user %s does not exist.", $defnick), + __FILE__); + } else { + $defsub = new Subscription(); + $defsub->subscriber = $user->id; + $defsub->subscribed = $defuser->id; + $defsub->created = $user->created; + + $result = $defsub->insert(); + + if (!$result) { + common_log_db_error($defsub, 'INSERT', __FILE__); + return false; + } + } + } + $profile->query('COMMIT'); if ($email && !$user->email) { mail_confirm_address($user, $confirm->code, $profile->nickname, $email); } + // Welcome message + + $welcome = common_config('newuser', 'welcome'); + + if (!empty($welcome)) { + $welcomeuser = User::staticGet('nickname', $welcome); + if (empty($welcomeuser)) { + common_log(LOG_WARNING, sprintf("Welcome user %s does not exist.", $defnick), + __FILE__); + } else { + $notice = Notice::saveNew($welcomeuser->id, + sprintf(_('Welcome to %1$s, @%2$s!'), + common_config('site', 'name'), + $user->nickname), + 'system'); + } + } + return $user; } diff --git a/lib/common.php b/lib/common.php index 1ca9e521b..caad705a4 100644 --- a/lib/common.php +++ b/lib/common.php @@ -151,6 +151,9 @@ $config = array('notify' => array()), 'inboxes' => array('enabled' => true), # on by default for new sites + 'newuser' => + array('subscribe' => null, + 'welcome' => null), ); $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options'); diff --git a/lib/noticelist.php b/lib/noticelist.php index 8523f2e63..4182d8808 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -391,6 +391,7 @@ class NoticeListItem extends Widget case 'xmpp': case 'mail': case 'omb': + case 'system': case 'api': $this->out->element('dd', null, $source_name); break; -- cgit v1.2.3-54-g00ecf From 47b89aa2c3a3e07d6dc63cd5be1d558af8ece233 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 30 Mar 2009 15:05:50 -0400 Subject: Changes to router setup to make notice search RSS feed work Conflicts: lib/router.php --- lib/router.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/router.php b/lib/router.php index 135e07a0f..77794aaf7 100644 --- a/lib/router.php +++ b/lib/router.php @@ -136,10 +136,14 @@ class Router foreach (array('group', 'people', 'notice') as $s) { $m->connect('search/'.$s, array('action' => $s.'search')); - $m->connect('search/'.$s.'?q=:q', array('action' => $s.'search'), array('q' => '.+')); + $m->connect('search/'.$s.'?q=:q', array('action' => $s.'search'),array('q' => '.+')); } + // The second of these is needed to make the link work correctly + // when inserted into the page. The first is needed to match the + // route on the way in. Seems to be another Net_URL_Mapper bug to me. $m->connect('search/notice/rss', array('action' => 'noticesearchrss')); + $m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'),array('q' => '.+')); // notice -- cgit v1.2.3-54-g00ecf From e149f3d64b5c0a58b299fb607824a1cd515836a4 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 26 Mar 2009 15:03:59 -0400 Subject: Support SSL for some, all, or no pages Support SSL URLs either for all pages; no pages; or for sensitive pages accepting passwords, like login, registration, API, and others. --- README | 10 ++++++++++ config.php.sample | 10 ++++++++++ lib/common.php | 2 ++ lib/util.php | 31 ++++++++++++++++++++++++++----- 4 files changed, 48 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/README b/README index 73cb95367..70815c141 100644 --- a/README +++ b/README @@ -925,6 +925,16 @@ dupelimit: Time in which it's not OK for the same person to post the same notice; default = 60 seconds. logo: URL of an image file to use as the logo for the site. Overrides the logo in the theme, if any. +ssl: Whether to use SSL and https:// URLs for some or all pages. + Possible values are 'always' (use it for all pages), 'never' + (don't use it for any pages), or 'sometimes' (use it for + sensitive pages that include passwords like login and registration, + but not for regular pages). Default to 'never'. +sslserver: use an alternate server name for SSL URLs, like + 'secure.example.org'. You should be careful to set cookie + parameters correctly so that both the SSL server and the + "normal" server can access the session cookie and + preferably other cookies as well. db -- diff --git a/config.php.sample b/config.php.sample index 529e86f15..d62a54fe7 100644 --- a/config.php.sample +++ b/config.php.sample @@ -174,3 +174,13 @@ $config['sphinx']['port'] = 3312; #http://taguri.org/ Examples: #$config['integration']['taguri'] = 'example.net,2008'; #$config['integration']['taguri'] = 'admin@example.net,2009-03-09' + +#Don't use SSL +#$config['site']['ssl'] = 'never'; +#Use SSL only for sensitive pages (like login, password change) +#$config['site']['ssl'] = 'sometimes'; +#Use SSL for all pages +#$config['site']['ssl'] = 'always'; + +#Use a different hostname for SSL-encrypted pages +#$config['site']['sslserver'] = 'secure.example.org'; diff --git a/lib/common.php b/lib/common.php index caad705a4..c2037c3ad 100644 --- a/lib/common.php +++ b/lib/common.php @@ -87,6 +87,8 @@ $config = 'closed' => false, 'inviteonly' => false, 'private' => false, + 'ssl' => 'never', + 'sslserver' => null, 'dupelimit' => 60), # default for same person saying the same thing 'syslog' => array('appname' => 'laconica', # for syslog diff --git a/lib/util.php b/lib/util.php index ef73adc36..fdcae0aca 100644 --- a/lib/util.php +++ b/lib/util.php @@ -721,25 +721,46 @@ function common_relative_profile($sender, $nickname, $dt=null) function common_local_url($action, $args=null, $params=null, $fragment=null) { + static $sensitive = array('login', 'register', 'passwordsettings', + 'twittersettings', 'finishopenidlogin', + 'api'); + $r = Router::get(); $path = $r->build($action, $args, $params, $fragment); + $ssl = in_array($action, $sensitive); + if (common_config('site','fancy')) { - $url = common_path(mb_substr($path, 1)); + $url = common_path(mb_substr($path, 1), $ssl); } else { if (mb_strpos($path, '/index.php') === 0) { - $url = common_path(mb_substr($path, 1)); + $url = common_path(mb_substr($path, 1), $ssl); } else { - $url = common_path('index.php'.$path); + $url = common_path('index.php'.$path, $ssl); } } return $url; } -function common_path($relative) +function common_path($relative, $ssl=false) { $pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : ''; - return "http://".common_config('site', 'server').'/'.$pathpart.$relative; + + if (($ssl && (common_config('site', 'ssl') === 'sometimes')) + || common_config('site', 'ssl') === 'always') { + $proto = 'https'; + if (is_string(common_config('site', 'sslserver')) && + mb_strlen(common_config('site', 'sslserver')) > 0) { + $serverpart = common_config('site', 'sslserver'); + } else { + $serverpart = common_config('site', 'server'); + } + } else { + $proto = 'http'; + $serverpart = common_config('site', 'server'); + } + + return $proto.'://'.$serverpart.'/'.$pathpart.$relative; } function common_date_string($dt) -- cgit v1.2.3-54-g00ecf From 1fbf9a042e2e7ed1f67dfad9b7fe3b96019bd1a3 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 31 Mar 2009 10:09:11 -0400 Subject: give the correct root url when SSL enabled --- lib/openid.php | 2 +- lib/util.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/openid.php b/lib/openid.php index 3aa488b6d..f3769c6fc 100644 --- a/lib/openid.php +++ b/lib/openid.php @@ -160,7 +160,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) $auth_request->addExtension($sreg_request); } - $trust_root = common_path(''); + $trust_root = common_root_url(true); $process_url = common_local_url($returnto); if ($auth_request->shouldSendRedirect()) { diff --git a/lib/util.php b/lib/util.php index fdcae0aca..98a3ae844 100644 --- a/lib/util.php +++ b/lib/util.php @@ -952,9 +952,9 @@ function common_profile_url($nickname) // Should make up a reasonable root URL -function common_root_url() +function common_root_url($ssl=false) { - return common_path(''); + return common_path('', $ssl); } // returns $bytes bytes of random data as a hexadecimal string -- cgit v1.2.3-54-g00ecf From b112b326402200c164fc5c9678d4aff656f7afd4 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 1 Apr 2009 01:03:00 +0000 Subject: Selector to allow styles when a user is logged in. --- lib/action.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/action.php b/lib/action.php index f0baa062c..5d0d5b758 100644 --- a/lib/action.php +++ b/lib/action.php @@ -326,7 +326,9 @@ class Action extends HTMLOutputter // lawsuit */ function showBody() { - $this->elementStart('body', array('id' => $this->trimmed('action'))); + $this->elementStart('body', (common_current_user()) ? array('id' => $this->trimmed('action'), + 'class' => 'user_in') + : array('id' => $this->trimmed('action'))); $this->elementStart('div', array('id' => 'wrap')); if (Event::handle('StartShowHeader', array($this))) { $this->showHeader(); -- cgit v1.2.3-54-g00ecf From 783d292739886811ab41215c614940d24214358f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 1 Apr 2009 01:03:00 +0000 Subject: Selector to allow styles when a user is logged in. --- lib/action.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/action.php b/lib/action.php index 975c2bfcb..f9f3c35d9 100644 --- a/lib/action.php +++ b/lib/action.php @@ -299,7 +299,9 @@ class Action extends HTMLOutputter // lawsuit */ function showBody() { - $this->elementStart('body', array('id' => $this->trimmed('action'))); + $this->elementStart('body', (common_current_user()) ? array('id' => $this->trimmed('action'), + 'class' => 'user_in') + : array('id' => $this->trimmed('action'))); $this->elementStart('div', array('id' => 'wrap')); if (Event::handle('StartShowHeader', array($this))) { $this->showHeader(); -- cgit v1.2.3-54-g00ecf From e7381493ad036e686f82f432066f00ff911ad5d5 Mon Sep 17 00:00:00 2001 From: CiaranG Date: Wed, 1 Apr 2009 18:11:02 +0100 Subject: Return redirect code correctly as HTTP status, not a header. Fixes ticket #1371 --- lib/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/util.php b/lib/util.php index fdcae0aca..26f1ff179 100644 --- a/lib/util.php +++ b/lib/util.php @@ -850,7 +850,7 @@ function common_redirect($url, $code=307) 303 => "See Other", 307 => "Temporary Redirect"); - header("Status: ${code} $status[$code]"); + header('HTTP/1.1 '.$code.' '.$status[$code]); header("Location: $url"); $xo = new XMLOutputter(); -- cgit v1.2.3-54-g00ecf From c172cbafaa9ba17ff8ca5c6dd07741bd0de96871 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 1 Apr 2009 15:30:59 -0400 Subject: Try to do intelligent redirect codes After fixing the redirect code output, there are a lot of weirdnesses with e.g. form handling. Try to add explicit redirect codes where needed -- principly when handling a POST. --- actions/block.php | 11 ++++++----- actions/deletenotice.php | 2 +- actions/disfavor.php | 5 +++-- actions/editgroup.php | 3 +-- actions/favor.php | 7 ++++--- actions/finishaddopenid.php | 2 +- actions/finishopenidlogin.php | 5 +++-- actions/finishremotesubscribe.php | 3 ++- actions/joingroup.php | 3 ++- actions/leavegroup.php | 3 ++- actions/login.php | 2 +- actions/logout.php | 8 ++++---- actions/newgroup.php | 2 +- actions/nudge.php | 7 ++++--- actions/remotesubscribe.php | 4 ++-- actions/smssettings.php | 3 ++- actions/subedit.php | 3 ++- actions/subscribe.php | 3 ++- actions/tag.php | 4 +++- actions/tagother.php | 3 ++- actions/unblock.php | 5 +++-- actions/unsubscribe.php | 3 ++- lib/openid.php | 2 +- lib/settingsaction.php | 4 ++-- 24 files changed, 56 insertions(+), 41 deletions(-) (limited to 'lib') diff --git a/actions/block.php b/actions/block.php index e77b634c8..34f991dc6 100644 --- a/actions/block.php +++ b/actions/block.php @@ -93,7 +93,8 @@ class BlockAction extends Action if ($this->arg('no')) { $cur = common_current_user(); $other = Profile::staticGet('id', $this->arg('blockto')); - common_redirect(common_local_url('showstream', array('nickname' => $other->nickname))); + common_redirect(common_local_url('showstream', array('nickname' => $other->nickname)), + 303); } elseif ($this->arg('yes')) { $this->blockProfile(); } elseif ($this->arg('blockto')) { @@ -102,7 +103,6 @@ class BlockAction extends Action } } - function showContent() { $this->areYouSureForm(); } @@ -110,7 +110,7 @@ class BlockAction extends Action function title() { return _('Block user'); } - + function showNoticeForm() { // nop } @@ -178,10 +178,11 @@ class BlockAction extends Action } if ($action) { - common_redirect(common_local_url($action, $args)); + common_redirect(common_local_url($action, $args), 303); } else { common_redirect(common_local_url('subscriptions', - array('nickname' => $cur->nickname))); + array('nickname' => $cur->nickname)), + 303); } } } diff --git a/actions/deletenotice.php b/actions/deletenotice.php index 16e2df889..6c350b33a 100644 --- a/actions/deletenotice.php +++ b/actions/deletenotice.php @@ -141,6 +141,6 @@ class DeletenoticeAction extends DeleteAction $url = common_local_url('public'); } - common_redirect($url); + common_redirect($url, 303); } } diff --git a/actions/disfavor.php b/actions/disfavor.php index 90bab3cca..bc13b09da 100644 --- a/actions/disfavor.php +++ b/actions/disfavor.php @@ -49,7 +49,7 @@ class DisfavorAction extends Action { /** * Class handler. - * + * * @param array $args query arguments * * @return void @@ -100,7 +100,8 @@ class DisfavorAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('showfavorites', - array('nickname' => $user->nickname))); + array('nickname' => $user->nickname)), + 303); } } } diff --git a/actions/editgroup.php b/actions/editgroup.php index e7e79040a..39dad0465 100644 --- a/actions/editgroup.php +++ b/actions/editgroup.php @@ -166,7 +166,6 @@ class EditgroupAction extends Action return; } - $nickname = common_canonical_nickname($this->trimmed('nickname')); $fullname = $this->trimmed('fullname'); $homepage = $this->trimmed('homepage'); @@ -221,7 +220,7 @@ class EditgroupAction extends Action if ($this->group->nickname != $orig->nickname) { common_redirect(common_local_url('editgroup', array('nickname' => $nickname)), - 307); + 303); } else { $this->showForm(_('Options saved.')); } diff --git a/actions/favor.php b/actions/favor.php index 3940df688..3b7d979eb 100644 --- a/actions/favor.php +++ b/actions/favor.php @@ -52,7 +52,7 @@ class FavorAction extends Action { /** * Class handler. - * + * * @param array $args query arguments * * @return void @@ -100,13 +100,14 @@ class FavorAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('showfavorites', - array('nickname' => $user->nickname))); + array('nickname' => $user->nickname)), + 303); } } /** * Notifies a user when his notice is favorited. - * + * * @param class $notice favorited notice * @param class $user user declaring a favorite * diff --git a/actions/finishaddopenid.php b/actions/finishaddopenid.php index 8f10505cf..32bceecfd 100644 --- a/actions/finishaddopenid.php +++ b/actions/finishaddopenid.php @@ -139,7 +139,7 @@ class FinishaddopenidAction extends Action oid_set_last($display); - common_redirect(common_local_url('openidsettings')); + common_redirect(common_local_url('openidsettings'), 303); } } diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php index 52d9be29c..952185742 100644 --- a/actions/finishopenidlogin.php +++ b/actions/finishopenidlogin.php @@ -271,7 +271,8 @@ class FinishopenidloginAction extends Action common_rememberme($user); } unset($_SESSION['openid_rememberme']); - common_redirect(common_local_url('showstream', array('nickname' => $user->nickname))); + common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)), + 303); } function connectUser() @@ -324,7 +325,7 @@ class FinishopenidloginAction extends Action array('nickname' => $nickname)); } - common_redirect($url); + common_redirect($url, 303); } function bestNewNickname($display, $sreg) diff --git a/actions/finishremotesubscribe.php b/actions/finishremotesubscribe.php index eaf57c2d8..d54c29a60 100644 --- a/actions/finishremotesubscribe.php +++ b/actions/finishremotesubscribe.php @@ -230,7 +230,8 @@ class FinishremotesubscribeAction extends Action # show up close to the top of the page common_redirect(common_local_url('subscribers', array('nickname' => - $user->nickname))); + $user->nickname)), + 303); } function add_avatar($profile, $url) diff --git a/actions/joingroup.php b/actions/joingroup.php index eeea4a37b..a5d82ddc7 100644 --- a/actions/joingroup.php +++ b/actions/joingroup.php @@ -143,7 +143,8 @@ class JoingroupAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('groupmembers', array('nickname' => - $this->group->nickname))); + $this->group->nickname)), + 303); } } } \ No newline at end of file diff --git a/actions/leavegroup.php b/actions/leavegroup.php index eb30d0e50..215ccd901 100644 --- a/actions/leavegroup.php +++ b/actions/leavegroup.php @@ -147,7 +147,8 @@ class LeavegroupAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('groupmembers', array('nickname' => - $this->group->nickname))); + $this->group->nickname)), + 303); } } } diff --git a/actions/login.php b/actions/login.php index b049791fb..59c6b4874 100644 --- a/actions/login.php +++ b/actions/login.php @@ -138,7 +138,7 @@ class LoginAction extends Action $nickname)); } - common_redirect($url); + common_redirect($url, 303); } /** diff --git a/actions/logout.php b/actions/logout.php index 3977f90a0..b7681be38 100644 --- a/actions/logout.php +++ b/actions/logout.php @@ -46,10 +46,10 @@ require_once INSTALLDIR.'/lib/openid.php'; */ class LogoutAction extends Action { - + /** * This is read only. - * + * * @return boolean true */ function isReadOnly() @@ -59,7 +59,7 @@ class LogoutAction extends Action /** * Class handler. - * + * * @param array $args array of arguments * * @return nothing @@ -73,7 +73,7 @@ class LogoutAction extends Action common_set_user(null); common_real_login(false); // not logged in common_forgetme(); // don't log back in! - common_redirect(common_local_url('public')); + common_redirect(common_local_url('public'), 303); } } } diff --git a/actions/newgroup.php b/actions/newgroup.php index cbd8dfeec..67cd6b2f1 100644 --- a/actions/newgroup.php +++ b/actions/newgroup.php @@ -193,7 +193,7 @@ class NewgroupAction extends Action $group->query('COMMIT'); - common_redirect($group->homeUrl(), 307); + common_redirect($group->homeUrl(), 303); } function nicknameExists($nickname) diff --git a/actions/nudge.php b/actions/nudge.php index bc3d48478..b4e5e01dd 100644 --- a/actions/nudge.php +++ b/actions/nudge.php @@ -50,7 +50,7 @@ class NudgeAction extends Action { /** * Class handler. - * + * * @param array $args array of arguments * * @return nothing @@ -75,7 +75,7 @@ class NudgeAction extends Action // CSRF protection $token = $this->trimmed('token'); - + if (!$token || $token != common_session_token()) { $this->clientError(_('There was a problem with your session token. Try again, please.')); return; @@ -100,7 +100,8 @@ class NudgeAction extends Action } else { // display a confirmation to the user common_redirect(common_local_url('showstream', - array('nickname' => $other->nickname))); + array('nickname' => $other->nickname)), + 303); } } diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php index af130f425..2e721a38b 100644 --- a/actions/remotesubscribe.php +++ b/actions/remotesubscribe.php @@ -99,7 +99,7 @@ class RemotesubscribeAction extends Action $this->elementStart('fieldset'); $this->element('legend', 'Subscribe to a remote user'); $this->hidden('token', common_session_token()); - + $this->elementStart('ul', 'form_data'); $this->elementStart('li'); $this->input('nickname', _('User nickname'), $this->nickname, @@ -407,7 +407,7 @@ class RemotesubscribeAction extends Action # Redirect to authorization service - common_redirect($req->to_url()); + common_redirect($req->to_url(), 303); return; } } diff --git a/actions/smssettings.php b/actions/smssettings.php index a5f75d266..922bab9a4 100644 --- a/actions/smssettings.php +++ b/actions/smssettings.php @@ -488,7 +488,8 @@ class SmssettingsAction extends ConnectSettingsAction } common_redirect(common_local_url('confirmaddress', - array('code' => $code))); + array('code' => $code)), + 303); } /** diff --git a/actions/subedit.php b/actions/subedit.php index 89081ffc7..8ca2d7914 100644 --- a/actions/subedit.php +++ b/actions/subedit.php @@ -85,7 +85,8 @@ class SubeditAction extends Action } common_redirect(common_local_url('subscriptions', - array('nickname' => $cur->nickname))); + array('nickname' => $cur->nickname)), + 303); } } } diff --git a/actions/subscribe.php b/actions/subscribe.php index f761992de..0bc522867 100644 --- a/actions/subscribe.php +++ b/actions/subscribe.php @@ -75,7 +75,8 @@ class SubscribeAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('subscriptions', array('nickname' => - $user->nickname))); + $user->nickname)), + 303); } } } diff --git a/actions/tag.php b/actions/tag.php index 231f2c299..d15f64498 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -33,7 +33,9 @@ class TagAction extends Action } if ($this->tag != $taginput) { - common_redirect(common_local_url('tag', array('tag' => $this->tag))); + common_redirect(common_local_url('tag', array('tag' => $this->tag)), + 301); + return false; } $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; diff --git a/actions/tagother.php b/actions/tagother.php index 0d18945a0..0c5bb7cf3 100644 --- a/actions/tagother.php +++ b/actions/tagother.php @@ -221,7 +221,8 @@ class TagotherAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url($action, array('nickname' => - $user->nickname))); + $user->nickname)), + 303); } } diff --git a/actions/unblock.php b/actions/unblock.php index bad496353..8573b2a87 100644 --- a/actions/unblock.php +++ b/actions/unblock.php @@ -116,10 +116,11 @@ class UnblockAction extends Action } } if ($action) { - common_redirect(common_local_url($action, $args)); + common_redirect(common_local_url($action, $args), 303); } else { common_redirect(common_local_url('subscriptions', - array('nickname' => $cur->nickname))); + array('nickname' => $cur->nickname)), + 303); } } } diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php index b1e2b6425..7dcab04c0 100644 --- a/actions/unsubscribe.php +++ b/actions/unsubscribe.php @@ -77,7 +77,8 @@ class UnsubscribeAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('subscriptions', array('nickname' => - $user->nickname))); + $user->nickname)), + 303); } } } diff --git a/lib/openid.php b/lib/openid.php index f3769c6fc..3af7a39cf 100644 --- a/lib/openid.php +++ b/lib/openid.php @@ -171,7 +171,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) } else if (Auth_OpenID::isFailure($redirect_url)) { return sprintf(_('Could not redirect to server: %s'), $redirect_url->message); } else { - common_redirect($redirect_url); + common_redirect($redirect_url, 303); } } else { // Generate form markup and render it. diff --git a/lib/settingsaction.php b/lib/settingsaction.php index 53c807c6f..db20c5804 100644 --- a/lib/settingsaction.php +++ b/lib/settingsaction.php @@ -78,9 +78,9 @@ class SettingsAction extends Action common_set_returnto($this->selfUrl()); $user = common_current_user(); if ($user->hasOpenID()) { - common_redirect(common_local_url('openidlogin')); + common_redirect(common_local_url('openidlogin'), 303); } else { - common_redirect(common_local_url('login')); + common_redirect(common_local_url('login'), 303); } } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->handlePost(); -- cgit v1.2.3-54-g00ecf 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 +- lib/router.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') 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) { diff --git a/lib/router.php b/lib/router.php index ae5b5e16b..6fb2f9487 100644 --- a/lib/router.php +++ b/lib/router.php @@ -107,6 +107,9 @@ class Router $m->connect('main/'.$a, array('action' => $a)); } + $m->connect('main/sup/:seconds', array('action' => 'sup'), + array('seconds' => '[0-9]+')); + $m->connect('main/tagother/:id', array('action' => 'tagother')); // these take a code -- cgit v1.2.3-54-g00ecf From e2898db087c5ae43587235ce3c97b11fff5867a4 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 3 Apr 2009 12:51:43 -0400 Subject: add finishaddopenid to list of sensitive pages to use with ssl --- lib/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/util.php b/lib/util.php index f08e70754..73410e289 100644 --- a/lib/util.php +++ b/lib/util.php @@ -723,7 +723,7 @@ function common_local_url($action, $args=null, $params=null, $fragment=null) { static $sensitive = array('login', 'register', 'passwordsettings', 'twittersettings', 'finishopenidlogin', - 'api'); + 'finishaddopenid', 'api'); $r = Router::get(); $path = $r->build($action, $args, $params, $fragment); -- cgit v1.2.3-54-g00ecf