From edbc0c665cc65875b4d14b79939233b1c9c06bb6 Mon Sep 17 00:00:00 2001
From: Evan Prodromou <evan@prodromou.name>
Date: Tue, 23 Dec 2008 14:19:07 -0500
Subject: replace all tabs with four spaces

The PEAR coding standards decree: no tabs, but indent by four spaces.
I've done a global search-and-replace on all tabs, replacing them by
four spaces. This is a huge change, but it will go a long way to
getting us towards phpcs-compliance. And that means better code
readability, and that means more participation.

darcs-hash:20081223191907-84dde-21e8efe210e6d5d54e935a22d0cee5c7bbfc007d.gz
---
 actions/twitapihelp.php | 50 ++++++++++++++++++++++++-------------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

(limited to 'actions/twitapihelp.php')

diff --git a/actions/twitapihelp.php b/actions/twitapihelp.php
index c5d503e11..d268b7c82 100644
--- a/actions/twitapihelp.php
+++ b/actions/twitapihelp.php
@@ -23,30 +23,30 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapihelpAction extends TwitterapiAction {
 
-	/* Returns the string "ok" in the requested format with a 200 OK HTTP status code.
-	 * URL:http://identi.ca/api/help/test.format
-	 * Formats: xml, json
-	 */
-	function test($args, $apidata) {
-		parent::handle($args);
-
-		if ($apidata['content-type'] == 'xml') {
-			$this->init_document('xml');
-			common_element('ok', NULL, 'true');
-			$this->end_document('xml');
-		} elseif ($apidata['content-type'] == 'json') {
-			$this->init_document('json');
-			print '"ok"';
-			$this->end_document('json');
-		} else {
-			common_user_error(_('API method not found!'), $code=404);
-		}
-
-	}
-
-	function downtime_schedule($args, $apidata) {
-		parent::handle($args);
-		common_server_error(_('API method under construction.'), $code=501);
-	}
+    /* Returns the string "ok" in the requested format with a 200 OK HTTP status code.
+     * URL:http://identi.ca/api/help/test.format
+     * Formats: xml, json
+     */
+    function test($args, $apidata) {
+        parent::handle($args);
+
+        if ($apidata['content-type'] == 'xml') {
+            $this->init_document('xml');
+            common_element('ok', NULL, 'true');
+            $this->end_document('xml');
+        } elseif ($apidata['content-type'] == 'json') {
+            $this->init_document('json');
+            print '"ok"';
+            $this->end_document('json');
+        } else {
+            common_user_error(_('API method not found!'), $code=404);
+        }
+
+    }
+
+    function downtime_schedule($args, $apidata) {
+        parent::handle($args);
+        common_server_error(_('API method under construction.'), $code=501);
+    }
 
 }
\ No newline at end of file
-- 
cgit v1.2.3-54-g00ecf


From eb2f9c98ac115ce67e9a740b200c832153ffa05c Mon Sep 17 00:00:00 2001
From: Evan Prodromou <evan@prodromou.name>
Date: Tue, 23 Dec 2008 14:21:29 -0500
Subject: replace NULL with null

Another global search-and-replace update. Here, I've replaced the PHP
keyword 'NULL' with its lowercase version. This is another PEAR code
standards change.

darcs-hash:20081223192129-84dde-4a0182e0ec16a01ad88745ad3e08f7cb501aee0b.gz
---
 _darcs/inventory                                   |     8 +
 ...dde-4a0182e0ec16a01ad88745ad3e08f7cb501aee0b.gz |   Bin 0 -> 8209 bytes
 _darcs/pristine/actions/allrss.php                 |     6 +-
 _darcs/pristine/actions/api.php                    |     4 +-
 _darcs/pristine/actions/block.php                  |     4 +-
 _darcs/pristine/actions/confirmaddress.php         |     2 +-
 _darcs/pristine/actions/deletenotice.php           |     4 +-
 _darcs/pristine/actions/deleteprofile.php          |    10 +-
 _darcs/pristine/actions/emailsettings.php          |    16 +-
 _darcs/pristine/actions/favorited.php              |     2 +-
 _darcs/pristine/actions/favoritesrss.php           |     4 +-
 _darcs/pristine/actions/featured.php               |     2 +-
 _darcs/pristine/actions/finishaddopenid.php        |     2 +-
 _darcs/pristine/actions/finishopenidlogin.php      |    28 +-
 _darcs/pristine/actions/finishremotesubscribe.php  |     2 +-
 _darcs/pristine/actions/foaf.php                   |    16 +-
 _darcs/pristine/actions/imsettings.php             |    12 +-
 _darcs/pristine/actions/invite.php                 |    22 +-
 _darcs/pristine/actions/login.php                  |    10 +-
 _darcs/pristine/actions/logout.php                 |     2 +-
 _darcs/pristine/actions/newmessage.php             |     4 +-
 _darcs/pristine/actions/newnotice.php              |    10 +-
 _darcs/pristine/actions/noticesearchrss.php        |     2 +-
 _darcs/pristine/actions/openidlogin.php            |     8 +-
 _darcs/pristine/actions/openidsettings.php         |    12 +-
 _darcs/pristine/actions/opensearch.php             |    12 +-
 _darcs/pristine/actions/othersettings.php          |     6 +-
 _darcs/pristine/actions/peoplesearch.php           |     4 +-
 _darcs/pristine/actions/peopletag.php              |     4 +-
 _darcs/pristine/actions/profilesettings.php        |     8 +-
 _darcs/pristine/actions/public.php                 |     2 +-
 _darcs/pristine/actions/publicrss.php              |     2 +-
 _darcs/pristine/actions/publicxrds.php             |    14 +-
 _darcs/pristine/actions/recoverpassword.php        |    20 +-
 _darcs/pristine/actions/register.php               |     6 +-
 _darcs/pristine/actions/remotesubscribe.php        |    36 +-
 _darcs/pristine/actions/repliesrss.php             |     6 +-
 _darcs/pristine/actions/showmessage.php            |     4 +-
 _darcs/pristine/actions/shownotice.php             |     8 +-
 _darcs/pristine/actions/showstream.php             |     4 +-
 _darcs/pristine/actions/smssettings.php            |    20 +-
 _darcs/pristine/actions/subedit.php                |     2 +-
 _darcs/pristine/actions/tagother.php               |     8 +-
 _darcs/pristine/actions/tagrss.php                 |     2 +-
 _darcs/pristine/actions/twitapidirect_messages.php |    20 +-
 _darcs/pristine/actions/twitapifriendships.php     |     2 +-
 _darcs/pristine/actions/twitapihelp.php            |     2 +-
 _darcs/pristine/actions/twitapistatuses.php        |     6 +-
 _darcs/pristine/actions/twittersettings.php        |    10 +-
 _darcs/pristine/actions/unblock.php                |     2 +-
 _darcs/pristine/actions/userauthorization.php      |     6 +-
 _darcs/pristine/actions/userbyid.php               |     2 +-
 _darcs/pristine/actions/userrss.php                |    10 +-
 _darcs/pristine/actions/xrds.php                   |    20 +-
 _darcs/pristine/classes/Avatar.php                 |     6 +-
 _darcs/pristine/classes/Channel.php                |    10 +-
 _darcs/pristine/classes/Command.php                |    34 +-
 _darcs/pristine/classes/CommandInterpreter.php     |    52 +-
 _darcs/pristine/classes/Confirm_address.php        |     2 +-
 _darcs/pristine/classes/Consumer.php               |     2 +-
 _darcs/pristine/classes/Fave.php                   |     2 +-
 _darcs/pristine/classes/Foreign_link.php           |     8 +-
 _darcs/pristine/classes/Foreign_service.php        |     2 +-
 _darcs/pristine/classes/Foreign_subscription.php   |     2 +-
 _darcs/pristine/classes/Foreign_user.php           |     4 +-
 _darcs/pristine/classes/Invitation.php             |     2 +-
 _darcs/pristine/classes/Memcached_DataObject.php   |     6 +-
 _darcs/pristine/classes/Message.php                |     2 +-
 _darcs/pristine/classes/Nonce.php                  |     2 +-
 _darcs/pristine/classes/Notice.php                 |    18 +-
 _darcs/pristine/classes/NoticeWrapper.php          |     2 +-
 _darcs/pristine/classes/Notice_inbox.php           |     2 +-
 _darcs/pristine/classes/Notice_source.php          |     2 +-
 _darcs/pristine/classes/Notice_tag.php             |     2 +-
 _darcs/pristine/classes/Profile.php                |    20 +-
 _darcs/pristine/classes/Profile_block.php          |     2 +-
 _darcs/pristine/classes/Profile_tag.php            |     2 +-
 _darcs/pristine/classes/Queue_item.php             |    10 +-
 _darcs/pristine/classes/Remember_me.php            |     2 +-
 _darcs/pristine/classes/Remote_profile.php         |     2 +-
 _darcs/pristine/classes/Reply.php                  |     2 +-
 _darcs/pristine/classes/Sms_carrier.php            |     2 +-
 _darcs/pristine/classes/Subscription.php           |     2 +-
 _darcs/pristine/classes/Token.php                  |     2 +-
 _darcs/pristine/classes/User.php                   |    18 +-
 _darcs/pristine/classes/User_openid.php            |     2 +-
 _darcs/pristine/lib/common.php                     |    18 +-
 _darcs/pristine/lib/deleteaction.php               |     4 +-
 _darcs/pristine/lib/facebookaction.php             |     6 +-
 _darcs/pristine/lib/oauthstore.php                 |    16 +-
 _darcs/pristine/lib/omb.php                        |    14 +-
 _darcs/pristine/lib/openid.php                     |    12 +-
 _darcs/pristine/lib/personal.php                   |     2 +-
 _darcs/pristine/lib/profilelist.php                |     8 +-
 _darcs/pristine/lib/queuehandler.php               |     8 +-
 _darcs/pristine/lib/rssaction.php                  |    32 +-
 _darcs/pristine/lib/searchaction.php               |    10 +-
 _darcs/pristine/lib/settingsaction.php             |     6 +-
 _darcs/pristine/lib/twitter.php                    |     4 +-
 _darcs/pristine/lib/twitterapi.php                 |    74 +-
 _darcs/pristine/lib/xmppqueuehandler.php           |     6 +-
 _darcs/pristine/scripts/enjitqueuehandler.php      |     2 +-
 _darcs/pristine/scripts/fixup_inboxes.php          |     2 +-
 _darcs/pristine/scripts/fixup_notices_rendered.php |     2 +-
 _darcs/pristine/scripts/jabberqueuehandler.php     |     2 +-
 _darcs/pristine/scripts/maildaemon.php             |     8 +-
 _darcs/pristine/scripts/ombqueuehandler.php        |     2 +-
 _darcs/pristine/scripts/smsqueuehandler.php        |     2 +-
 _darcs/pristine/scripts/xmppconfirmhandler.php     |     8 +-
 _darcs/pristine/scripts/xmppdaemon.php             |    18 +-
 _darcs/tentative_pristine                          | 29165 +------------------
 actions/allrss.php                                 |     6 +-
 actions/api.php                                    |     4 +-
 actions/block.php                                  |     4 +-
 actions/confirmaddress.php                         |     2 +-
 actions/deletenotice.php                           |     4 +-
 actions/deleteprofile.php                          |    10 +-
 actions/emailsettings.php                          |    16 +-
 actions/favorited.php                              |     2 +-
 actions/favoritesrss.php                           |     4 +-
 actions/featured.php                               |     2 +-
 actions/finishaddopenid.php                        |     2 +-
 actions/finishopenidlogin.php                      |    28 +-
 actions/finishremotesubscribe.php                  |     2 +-
 actions/foaf.php                                   |    16 +-
 actions/imsettings.php                             |    12 +-
 actions/invite.php                                 |    22 +-
 actions/login.php                                  |    10 +-
 actions/logout.php                                 |     2 +-
 actions/newmessage.php                             |     4 +-
 actions/newnotice.php                              |    10 +-
 actions/noticesearchrss.php                        |     2 +-
 actions/openidlogin.php                            |     8 +-
 actions/openidsettings.php                         |    12 +-
 actions/opensearch.php                             |    12 +-
 actions/othersettings.php                          |     6 +-
 actions/peoplesearch.php                           |     4 +-
 actions/peopletag.php                              |     4 +-
 actions/profilesettings.php                        |     8 +-
 actions/public.php                                 |     2 +-
 actions/publicrss.php                              |     2 +-
 actions/publicxrds.php                             |    14 +-
 actions/recoverpassword.php                        |    20 +-
 actions/register.php                               |     6 +-
 actions/remotesubscribe.php                        |    36 +-
 actions/repliesrss.php                             |     6 +-
 actions/showmessage.php                            |     4 +-
 actions/shownotice.php                             |     8 +-
 actions/showstream.php                             |     4 +-
 actions/smssettings.php                            |    20 +-
 actions/subedit.php                                |     2 +-
 actions/tagother.php                               |     8 +-
 actions/tagrss.php                                 |     2 +-
 actions/twitapidirect_messages.php                 |    20 +-
 actions/twitapifriendships.php                     |     2 +-
 actions/twitapihelp.php                            |     2 +-
 actions/twitapistatuses.php                        |     6 +-
 actions/twittersettings.php                        |    10 +-
 actions/unblock.php                                |     2 +-
 actions/userauthorization.php                      |     6 +-
 actions/userbyid.php                               |     2 +-
 actions/userrss.php                                |    10 +-
 actions/xrds.php                                   |    20 +-
 classes/Avatar.php                                 |     6 +-
 classes/Channel.php                                |    10 +-
 classes/Command.php                                |    34 +-
 classes/CommandInterpreter.php                     |    52 +-
 classes/Confirm_address.php                        |     2 +-
 classes/Consumer.php                               |     2 +-
 classes/Fave.php                                   |     2 +-
 classes/Foreign_link.php                           |     8 +-
 classes/Foreign_service.php                        |     2 +-
 classes/Foreign_subscription.php                   |     2 +-
 classes/Foreign_user.php                           |     4 +-
 classes/Invitation.php                             |     2 +-
 classes/Memcached_DataObject.php                   |     6 +-
 classes/Message.php                                |     2 +-
 classes/Nonce.php                                  |     2 +-
 classes/Notice.php                                 |    18 +-
 classes/NoticeWrapper.php                          |     2 +-
 classes/Notice_inbox.php                           |     2 +-
 classes/Notice_source.php                          |     2 +-
 classes/Notice_tag.php                             |     2 +-
 classes/Profile.php                                |    20 +-
 classes/Profile_block.php                          |     2 +-
 classes/Profile_tag.php                            |     2 +-
 classes/Queue_item.php                             |    10 +-
 classes/Remember_me.php                            |     2 +-
 classes/Remote_profile.php                         |     2 +-
 classes/Reply.php                                  |     2 +-
 classes/Sms_carrier.php                            |     2 +-
 classes/Subscription.php                           |     2 +-
 classes/Token.php                                  |     2 +-
 classes/User.php                                   |    18 +-
 classes/User_openid.php                            |     2 +-
 lib/common.php                                     |    18 +-
 lib/deleteaction.php                               |     4 +-
 lib/facebookaction.php                             |     6 +-
 lib/oauthstore.php                                 |    16 +-
 lib/omb.php                                        |    14 +-
 lib/openid.php                                     |    12 +-
 lib/personal.php                                   |     2 +-
 lib/profilelist.php                                |     8 +-
 lib/queuehandler.php                               |     8 +-
 lib/rssaction.php                                  |    32 +-
 lib/searchaction.php                               |    10 +-
 lib/settingsaction.php                             |     6 +-
 lib/twitter.php                                    |     4 +-
 lib/twitterapi.php                                 |    74 +-
 lib/xmppqueuehandler.php                           |     6 +-
 scripts/enjitqueuehandler.php                      |     2 +-
 scripts/fixup_inboxes.php                          |     2 +-
 scripts/fixup_notices_rendered.php                 |     2 +-
 scripts/jabberqueuehandler.php                     |     2 +-
 scripts/maildaemon.php                             |     8 +-
 scripts/ombqueuehandler.php                        |     2 +-
 scripts/smsqueuehandler.php                        |     2 +-
 scripts/xmppconfirmhandler.php                     |     8 +-
 scripts/xmppdaemon.php                             |    18 +-
 219 files changed, 2157 insertions(+), 28868 deletions(-)
 create mode 100644 _darcs/patches/20081223192129-84dde-4a0182e0ec16a01ad88745ad3e08f7cb501aee0b.gz

(limited to 'actions/twitapihelp.php')

diff --git a/_darcs/inventory b/_darcs/inventory
index f49b758ab..3137b8080 100644
--- a/_darcs/inventory
+++ b/_darcs/inventory
@@ -59,4 +59,12 @@ Evan Prodromou <evan@prodromou.name>**20081223191907
  getting us towards phpcs-compliance. And that means better code
  readability, and that means more participation.
  
+] 
+[replace NULL with null
+Evan Prodromou <evan@prodromou.name>**20081223192129
+ 
+ Another global search-and-replace update. Here, I've replaced the PHP
+ keyword 'NULL' with its lowercase version. This is another PEAR code
+ standards change.
+ 
 ] 
\ No newline at end of file
diff --git a/_darcs/patches/20081223192129-84dde-4a0182e0ec16a01ad88745ad3e08f7cb501aee0b.gz b/_darcs/patches/20081223192129-84dde-4a0182e0ec16a01ad88745ad3e08f7cb501aee0b.gz
new file mode 100644
index 000000000..cc317a43e
Binary files /dev/null and b/_darcs/patches/20081223192129-84dde-4a0182e0ec16a01ad88745ad3e08f7cb501aee0b.gz differ
diff --git a/_darcs/pristine/actions/allrss.php b/_darcs/pristine/actions/allrss.php
index d28fcea49..851cd0ad5 100644
--- a/_darcs/pristine/actions/allrss.php
+++ b/_darcs/pristine/actions/allrss.php
@@ -25,7 +25,7 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class AllrssAction extends Rss10Action {
 
-    var $user = NULL;
+    var $user = null;
 
     function init() {
         $nickname = $this->trimmed('nickname');
@@ -69,9 +69,9 @@ class AllrssAction extends Rss10Action {
         $user = $this->user;
         $profile = $user->getProfile();
         if (!$profile) {
-            return NULL;
+            return null;
         }
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-        return ($avatar) ? $avatar->url : NULL;
+        return ($avatar) ? $avatar->url : null;
     }
 }
\ No newline at end of file
diff --git a/_darcs/pristine/actions/api.php b/_darcs/pristine/actions/api.php
index e03961e21..e7646a7bb 100644
--- a/_darcs/pristine/actions/api.php
+++ b/_darcs/pristine/actions/api.php
@@ -152,8 +152,8 @@ class ApiAction extends Action {
             header('Content-Type: application/xml; charset=utf-8');
             common_start_xml();
             common_element_start('hash');
-            common_element('error', NULL, $msg);
-            common_element('request', NULL, $_SERVER['REQUEST_URI']);
+            common_element('error', null, $msg);
+            common_element('request', null, $_SERVER['REQUEST_URI']);
             common_element_end('hash');
             common_end_xml();
         } else if ($this->content_type == 'json')  {
diff --git a/_darcs/pristine/actions/block.php b/_darcs/pristine/actions/block.php
index 20ba81edb..cfcd29848 100644
--- a/_darcs/pristine/actions/block.php
+++ b/_darcs/pristine/actions/block.php
@@ -21,7 +21,7 @@ if (!defined('LACONICA')) { exit(1); }
 
 class BlockAction extends Action {
 
-    var $profile = NULL;
+    var $profile = null;
 
     function prepare($args) {
 
@@ -77,7 +77,7 @@ class BlockAction extends Action {
 
         common_show_header(_('Block user'));
 
-        common_element('p', NULL,
+        common_element('p', null,
                        _('Are you sure you want to block this user? '.
                          'Afterwards, they will be unsubscribed from you, '.
                          'unable to subscribe to you in the future, and '.
diff --git a/_darcs/pristine/actions/confirmaddress.php b/_darcs/pristine/actions/confirmaddress.php
index 9d97c8205..562b70fe9 100644
--- a/_darcs/pristine/actions/confirmaddress.php
+++ b/_darcs/pristine/actions/confirmaddress.php
@@ -88,7 +88,7 @@ class ConfirmaddressAction extends Action {
         $cur->query('COMMIT');
 
         common_show_header(_('Confirm Address'));
-        common_element('p', NULL,
+        common_element('p', null,
                        sprintf(_('The address "%s" has been confirmed for your account.'), $cur->$type));
         common_show_footer();
     }
diff --git a/_darcs/pristine/actions/deletenotice.php b/_darcs/pristine/actions/deletenotice.php
index ba348c5fa..0777918d2 100644
--- a/_darcs/pristine/actions/deletenotice.php
+++ b/_darcs/pristine/actions/deletenotice.php
@@ -41,7 +41,7 @@ class DeletenoticeAction extends DeleteAction {
         return _('Delete notice');
     }
 
-    function show_form($error=NULL) {
+    function show_form($error=null) {
         $user = common_current_user();
 
         common_show_header($this->get_title(), array($this, 'show_header'), $error,
@@ -91,7 +91,7 @@ class DeletenoticeAction extends DeleteAction {
             $notice->delete();
         } else {
             if ($url) {
-                common_set_returnto(NULL);
+                common_set_returnto(null);
             } else {
                 $url = common_local_url('public');
             }
diff --git a/_darcs/pristine/actions/deleteprofile.php b/_darcs/pristine/actions/deleteprofile.php
index 29797bc76..503b3666d 100644
--- a/_darcs/pristine/actions/deleteprofile.php
+++ b/_darcs/pristine/actions/deleteprofile.php
@@ -36,9 +36,9 @@ class DeleteprofileAction extends Action {
         return _('Export and delete your user information.');
     }
 
-    function form_header($title, $msg=NULL, $success=false) {
+    function form_header($title, $msg=null, $success=false) {
         common_show_header($title,
-                           NULL,
+                           null,
                            array($msg, $success),
                            array($this, 'show_top'));
     }
@@ -84,9 +84,9 @@ class DeleteprofileAction extends Action {
         common_element_end('li');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $this->form_header(_('Delete my account'), $msg, $success);
-        common_element('h2', NULL, _('Delete my account confirmation'));
+        common_element('h2', null, _('Delete my account confirmation'));
         $this->show_confirm_delete_form();
         common_show_footer();
     }
@@ -213,7 +213,7 @@ class DeleteprofileAction extends Action {
         $n_users_deleted = $user->delete();
 
         // logout and redirect to public
-        common_set_user(NULL);
+        common_set_user(null);
         common_real_login(false); # not logged in
         common_forgetme(); # don't log back in!
         common_redirect(common_local_url('public'));
diff --git a/_darcs/pristine/actions/emailsettings.php b/_darcs/pristine/actions/emailsettings.php
index b77817c8e..06b3ef29f 100644
--- a/_darcs/pristine/actions/emailsettings.php
+++ b/_darcs/pristine/actions/emailsettings.php
@@ -27,7 +27,7 @@ class EmailsettingsAction extends SettingsAction {
         return _('Manage how you get email from %%site.name%%.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $user = common_current_user();
         $this->form_header(_('Email Settings'), $msg, $success);
         common_element_start('form', array('method' => 'post',
@@ -36,7 +36,7 @@ class EmailsettingsAction extends SettingsAction {
                                            common_local_url('emailsettings')));
         common_hidden('token', common_session_token());
 
-        common_element('h2', NULL, _('Address'));
+        common_element('h2', null, _('Address'));
 
         if ($user->email) {
             common_element_start('p');
@@ -58,14 +58,14 @@ class EmailsettingsAction extends SettingsAction {
                 common_submit('cancel', _('Cancel'));
             } else {
                 common_input('email', _('Email Address'),
-                             ($this->arg('email')) ? $this->arg('email') : NULL,
+                             ($this->arg('email')) ? $this->arg('email') : null,
                              _('Email address, like "UserName@example.org"'));
                 common_submit('add', _('Add'));
             }
         }
 
         if ($user->email) {
-            common_element('h2', NULL, _('Incoming email'));
+            common_element('h2', null, _('Incoming email'));
             
             if ($user->incomingemail) {
                 common_element_start('p');
@@ -83,7 +83,7 @@ class EmailsettingsAction extends SettingsAction {
             common_submit('newincoming', _('New'));
         }
         
-        common_element('h2', NULL, _('Preferences'));
+        common_element('h2', null, _('Preferences'));
 
         common_checkbox('emailnotifysub',
                         _('Send me notices of new subscriptions through email.'),
@@ -118,7 +118,7 @@ class EmailsettingsAction extends SettingsAction {
         if ($confirm->find(TRUE)) {
             return $confirm;
         } else {
-            return NULL;
+            return null;
         }
     }
 
@@ -273,7 +273,7 @@ class EmailsettingsAction extends SettingsAction {
 
         $user->query('BEGIN');
         $original = clone($user);
-        $user->email = NULL;
+        $user->email = null;
         $result = $user->updateKeys($original);
         if (!$result) {
             common_log_db_error($user, 'UPDATE', __FILE__);
@@ -294,7 +294,7 @@ class EmailsettingsAction extends SettingsAction {
         }
         
         $orig = clone($user);
-        $user->incomingemail = NULL;
+        $user->incomingemail = null;
 
         if (!$user->updateKeys($orig)) {
             common_log_db_error($user, 'UPDATE', __FILE__);
diff --git a/_darcs/pristine/actions/favorited.php b/_darcs/pristine/actions/favorited.php
index 6a465df96..e69630d50 100644
--- a/_darcs/pristine/actions/favorited.php
+++ b/_darcs/pristine/actions/favorited.php
@@ -29,7 +29,7 @@ class FavoritedAction extends StreamAction {
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
         common_show_header(_('Popular notices'),
-                           array($this, 'show_header'), NULL,
+                           array($this, 'show_header'), null,
                            array($this, 'show_top'));
 
         $this->show_notices($page);
diff --git a/_darcs/pristine/actions/favoritesrss.php b/_darcs/pristine/actions/favoritesrss.php
index 642d4f880..7071812d7 100644
--- a/_darcs/pristine/actions/favoritesrss.php
+++ b/_darcs/pristine/actions/favoritesrss.php
@@ -25,7 +25,7 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class FavoritesrssAction extends Rss10Action {
 
-    var $user = NULL;
+    var $user = null;
     
     function init() {
         $nickname = $this->trimmed('nickname');
@@ -68,6 +68,6 @@ class FavoritesrssAction extends Rss10Action {
     }
 
     function get_image() {
-        return NULL;
+        return null;
     }
 }
\ No newline at end of file
diff --git a/_darcs/pristine/actions/featured.php b/_darcs/pristine/actions/featured.php
index 2ff4f7745..f478a4017 100644
--- a/_darcs/pristine/actions/featured.php
+++ b/_darcs/pristine/actions/featured.php
@@ -30,7 +30,7 @@ class FeaturedAction extends StreamAction {
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
         common_show_header(_('Featured users'),
-                           array($this, 'show_header'), NULL,
+                           array($this, 'show_header'), null,
                            array($this, 'show_top'));
 
         $this->show_notices($page);
diff --git a/_darcs/pristine/actions/finishaddopenid.php b/_darcs/pristine/actions/finishaddopenid.php
index 07024e091..7607688de 100644
--- a/_darcs/pristine/actions/finishaddopenid.php
+++ b/_darcs/pristine/actions/finishaddopenid.php
@@ -97,7 +97,7 @@ class FinishaddopenidAction extends Action {
 
     function message($msg) {
         common_show_header(_('OpenID Login'));
-        common_element('p', NULL, $msg);
+        common_element('p', null, $msg);
         common_show_footer();
     }
 }
diff --git a/_darcs/pristine/actions/finishopenidlogin.php b/_darcs/pristine/actions/finishopenidlogin.php
index a2a778f31..ae5b136a2 100644
--- a/_darcs/pristine/actions/finishopenidlogin.php
+++ b/_darcs/pristine/actions/finishopenidlogin.php
@@ -52,7 +52,7 @@ class FinishopenidloginAction extends Action {
         }
     }
 
-    function show_top($error=NULL) {
+    function show_top($error=null) {
         if ($error) {
             common_element('div', array('class' => 'error'), $error);
         } else {
@@ -62,17 +62,17 @@ class FinishopenidloginAction extends Action {
         }
     }
 
-    function show_form($error=NULL, $username=NULL) {
-        common_show_header(_('OpenID Account Setup'), NULL, $error,
+    function show_form($error=null, $username=null) {
+        common_show_header(_('OpenID Account Setup'), null, $error,
                            array($this, 'show_top'));
 
         common_element_start('form', array('method' => 'post',
                                            'id' => 'account_connect',
                                            'action' => common_local_url('finishopenidlogin')));
         common_hidden('token', common_session_token());
-        common_element('h2', NULL,
+        common_element('h2', null,
                        _('Create new account'));
-        common_element('p', NULL,
+        common_element('p', null,
                        _('Create a new user with this nickname.'));
         common_input('newname', _('New nickname'),
                      ($username) ? $username : '',
@@ -88,9 +88,9 @@ class FinishopenidloginAction extends Action {
         common_text(_(' except this private data: password, email address, IM address, phone number.'));
         common_element_end('p');
         common_submit('create', _('Create'));
-        common_element('h2', NULL,
+        common_element('h2', null,
                        _('Connect existing account'));
-        common_element('p', NULL,
+        common_element('p', null,
                        _('If you already have an account, login with your username and password to connect it to your OpenID.'));
         common_input('nickname', _('Existing nickname'));
         common_password('password', _('Password'));
@@ -141,14 +141,14 @@ class FinishopenidloginAction extends Action {
                 $this->go_home($user->nickname);
             } else {
                 $this->save_values($display, $canonical, $sreg);
-                $this->show_form(NULL, $this->best_new_nickname($display, $sreg));
+                $this->show_form(null, $this->best_new_nickname($display, $sreg));
             }
         }
     }
 
     function message($msg) {
         common_show_header(_('OpenID Login'));
-        common_element('p', NULL, $msg);
+        common_element('p', null, $msg);
         common_show_footer();
     }
 
@@ -290,7 +290,7 @@ class FinishopenidloginAction extends Action {
         $url = common_get_returnto();
         if ($url) {
             # We don't have to return to it again
-            common_set_returnto(NULL);
+            common_set_returnto(null);
         } else {
             $url = common_local_url('all',
                                     array('nickname' =>
@@ -329,7 +329,7 @@ class FinishopenidloginAction extends Action {
 
         # XXX: others?
 
-        return NULL;
+        return null;
     }
 
     function is_new_nickname($str) {
@@ -369,7 +369,7 @@ class FinishopenidloginAction extends Action {
 
         foreach ($bad as $badpart) {
             if (array_key_exists($badpart, $parts)) {
-                return NULL;
+                return null;
             }
         }
 
@@ -403,14 +403,14 @@ class FinishopenidloginAction extends Action {
             }
         }
 
-        return NULL;
+        return null;
     }
 
     function xri_to_nickname($xri) {
         $base = $this->xri_base($xri);
 
         if (!$base) {
-            return NULL;
+            return null;
         } else {
             # =evan.prodromou
             # or @gratis*evan.prodromou
diff --git a/_darcs/pristine/actions/finishremotesubscribe.php b/_darcs/pristine/actions/finishremotesubscribe.php
index c3387cf02..edd4ae541 100644
--- a/_darcs/pristine/actions/finishremotesubscribe.php
+++ b/_darcs/pristine/actions/finishremotesubscribe.php
@@ -278,7 +278,7 @@ class FinishremotesubscribeAction extends Action {
         common_debug('got result: "'.print_r($result,TRUE).'"', __FILE__);
 
         if ($result->status != 200) {
-            return NULL;
+            return null;
         }
 
         parse_str($result->body, $return);
diff --git a/_darcs/pristine/actions/foaf.php b/_darcs/pristine/actions/foaf.php
index 310ba2c19..218e20f5f 100644
--- a/_darcs/pristine/actions/foaf.php
+++ b/_darcs/pristine/actions/foaf.php
@@ -66,21 +66,21 @@ class FoafAction extends Action {
         # XXX: might not be a person
         common_element_start('Person', array('rdf:about' =>
                                              $user->uri));
-        common_element('mbox_sha1sum', NULL, sha1('mailto:' . $user->email));
+        common_element('mbox_sha1sum', null, sha1('mailto:' . $user->email));
         if ($profile->fullname) {
-            common_element('name', NULL, $profile->fullname);
+            common_element('name', null, $profile->fullname);
         }
         if ($profile->homepage) {
             common_element('homepage', array('rdf:resource' => $profile->homepage));
         }
         if ($profile->bio) {
-            common_element('rdfs:comment', NULL, $profile->bio);
+            common_element('rdfs:comment', null, $profile->bio);
         }
         # XXX: more structured location data
         if ($profile->location) {
             common_element_start('based_near');
             common_element_start('geo:SpatialThing');
-            common_element('name', NULL, $profile->location);
+            common_element('name', null, $profile->location);
             common_element_end('geo:SpatialThing');
             common_element_end('based_near');
         }
@@ -156,7 +156,7 @@ class FoafAction extends Action {
         common_element_end('Person');
 
         foreach ($person as $uri => $p) {
-            $foaf_url = NULL;
+            $foaf_url = null;
             if ($p[1] instanceof User) {
                 $foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname));
             }
@@ -166,7 +166,7 @@ class FoafAction extends Action {
                 common_element('knows', array('rdf:resource' => $user->uri));
             }
             $this->show_microblogging_account($profile, ($p[1] instanceof User) ?
-                                              common_root_url() : NULL);
+                                              common_root_url() : null);
             if ($foaf_url) {
                 common_element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
             }
@@ -186,7 +186,7 @@ class FoafAction extends Action {
         common_element_end('PersonalProfileDocument');
     }
 
-    function show_microblogging_account($profile, $service=NULL) {
+    function show_microblogging_account($profile, $service=null) {
         # Their account
         common_element_start('holdsAccount');
         common_element_start('OnlineAccount');
@@ -194,7 +194,7 @@ class FoafAction extends Action {
             common_element('accountServiceHomepage', array('rdf:resource' =>
                                                            $service));
         }
-        common_element('accountName', NULL, $profile->nickname);
+        common_element('accountName', null, $profile->nickname);
         common_element('homepage', array('rdf:resource' => $profile->profileurl));
         common_element_end('OnlineAccount');
         common_element_end('holdsAccount');
diff --git a/_darcs/pristine/actions/imsettings.php b/_darcs/pristine/actions/imsettings.php
index d0c47f7fd..8f546f8e7 100644
--- a/_darcs/pristine/actions/imsettings.php
+++ b/_darcs/pristine/actions/imsettings.php
@@ -28,7 +28,7 @@ class ImsettingsAction extends SettingsAction {
         return _('You can send and receive notices through Jabber/GTalk [instant messages](%%doc.im%%). Configure your address and settings below.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $user = common_current_user();
         $this->form_header(_('IM Settings'), $msg, $success);
         common_element_start('form', array('method' => 'post',
@@ -37,7 +37,7 @@ class ImsettingsAction extends SettingsAction {
                                            common_local_url('imsettings')));
         common_hidden('token', common_session_token());
 
-        common_element('h2', NULL, _('Address'));
+        common_element('h2', null, _('Address'));
 
         if ($user->jabber) {
             common_element_start('p');
@@ -59,13 +59,13 @@ class ImsettingsAction extends SettingsAction {
                 common_submit('cancel', _('Cancel'));
             } else {
                 common_input('jabber', _('IM Address'),
-                             ($this->arg('jabber')) ? $this->arg('jabber') : NULL,
+                             ($this->arg('jabber')) ? $this->arg('jabber') : null,
                          sprintf(_('Jabber or GTalk address, like "UserName@example.org". First, make sure to add %s to your buddy list in your IM client or on GTalk.'), jabber_daemon_address()));
                 common_submit('add', _('Add'));
             }
         }
 
-        common_element('h2', NULL, _('Preferences'));
+        common_element('h2', null, _('Preferences'));
 
         common_checkbox('jabbernotify',
                         _('Send me notices through Jabber/GTalk.'),
@@ -93,7 +93,7 @@ class ImsettingsAction extends SettingsAction {
         if ($confirm->find(TRUE)) {
             return $confirm;
         } else {
-            return NULL;
+            return null;
         }
     }
 
@@ -244,7 +244,7 @@ class ImsettingsAction extends SettingsAction {
 
         $user->query('BEGIN');
         $original = clone($user);
-        $user->jabber = NULL;
+        $user->jabber = null;
         $result = $user->updateKeys($original);
         if (!$result) {
             common_log_db_error($user, 'UPDATE', __FILE__);
diff --git a/_darcs/pristine/actions/invite.php b/_darcs/pristine/actions/invite.php
index e5cc6ad01..feef94d0f 100644
--- a/_darcs/pristine/actions/invite.php
+++ b/_darcs/pristine/actions/invite.php
@@ -85,49 +85,49 @@ class InviteAction extends Action {
 
         common_show_header(_('Invitation(s) sent'));
         if ($already) {
-            common_element('p', NULL, _('You are already subscribed to these users:'));
+            common_element('p', null, _('You are already subscribed to these users:'));
             common_element_start('ul');
             foreach ($already as $other) {
-                common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
+                common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
             }
             common_element_end('ul');
         }
         if ($subbed) {
-            common_element('p', NULL, _('These people are already users and you were automatically subscribed to them:'));
+            common_element('p', null, _('These people are already users and you were automatically subscribed to them:'));
             common_element_start('ul');
             foreach ($subbed as $other) {
-                common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
+                common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
             }
             common_element_end('ul');
         }
         if ($sent) {
-            common_element('p', NULL, _('Invitation(s) sent to the following people:'));
+            common_element('p', null, _('Invitation(s) sent to the following people:'));
             common_element_start('ul');
             foreach ($sent as $other) {
-                common_element('li', NULL, $other);
+                common_element('li', null, $other);
             }
             common_element_end('ul');
-            common_element('p', NULL, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
+            common_element('p', null, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
         }
         common_show_footer();
     }
 
-    function show_top($error=NULL) {
+    function show_top($error=null) {
         if ($error) {
             common_element('p', 'error', $error);
         } else {
             common_element_start('div', 'instructions');
-            common_element('p', NULL,
+            common_element('p', null,
                            _('Use this form to invite your friends and colleagues to use this service.'));
             common_element_end('div');
         }
     }
 
-    function show_form($error=NULL) {
+    function show_form($error=null) {
 
         global $config;
 
-        common_show_header(_('Invite new users'), NULL, $error, array($this, 'show_top'));
+        common_show_header(_('Invite new users'), null, $error, array($this, 'show_top'));
 
         common_element_start('form', array('method' => 'post',
                                            'id' => 'invite',
diff --git a/_darcs/pristine/actions/login.php b/_darcs/pristine/actions/login.php
index 5e4d45149..f3509519e 100644
--- a/_darcs/pristine/actions/login.php
+++ b/_darcs/pristine/actions/login.php
@@ -63,7 +63,7 @@ class LoginAction extends Action {
             $url = common_get_returnto();
             if ($url) {
                 # We don't have to return to it again
-                common_set_returnto(NULL);
+                common_set_returnto(null);
             } else {
                 $url = common_local_url('all',
                                         array('nickname' =>
@@ -91,7 +91,7 @@ class LoginAction extends Action {
         $url = common_get_returnto();
         if ($url) {
             # We don't have to return to it again
-            common_set_returnto(NULL);
+            common_set_returnto(null);
         } else {
             $url = common_local_url('all',
                                     array('nickname' =>
@@ -100,8 +100,8 @@ class LoginAction extends Action {
         common_redirect($url);
     }
 
-    function show_form($error=NULL) {
-        common_show_header(_('Login'), NULL, $error, array($this, 'show_top'));
+    function show_form($error=null) {
+        common_show_header(_('Login'), null, $error, array($this, 'show_top'));
         common_element_start('form', array('method' => 'post',
                                            'id' => 'login',
                                            'action' => common_local_url('login')));
@@ -138,7 +138,7 @@ class LoginAction extends Action {
         }
     }
 
-    function show_top($error=NULL) {
+    function show_top($error=null) {
         if ($error) {
             common_element('p', 'error', $error);
         } else {
diff --git a/_darcs/pristine/actions/logout.php b/_darcs/pristine/actions/logout.php
index 5f7b9d502..4c59e47ad 100644
--- a/_darcs/pristine/actions/logout.php
+++ b/_darcs/pristine/actions/logout.php
@@ -32,7 +32,7 @@ class LogoutAction extends Action {
         if (!common_logged_in()) {
             common_user_error(_('Not logged in.'));
         } else {
-            common_set_user(NULL);
+            common_set_user(null);
             common_real_login(false); # not logged in
             common_forgetme(); # don't log back in!
             common_redirect(common_local_url('public'));
diff --git a/_darcs/pristine/actions/newmessage.php b/_darcs/pristine/actions/newmessage.php
index 121fc4246..eb582c2a5 100644
--- a/_darcs/pristine/actions/newmessage.php
+++ b/_darcs/pristine/actions/newmessage.php
@@ -98,7 +98,7 @@ class NewmessageAction extends Action {
         common_message_form($content, $user, $to);
     }
 
-    function show_form($msg=NULL) {
+    function show_form($msg=null) {
         
         $content = $this->trimmed('content');
         $user = common_current_user();
@@ -117,7 +117,7 @@ class NewmessageAction extends Action {
             return;
         }
         
-        common_show_header(_('New message'), NULL,
+        common_show_header(_('New message'), null,
                            array($content, $user, $other),
                            array($this, 'show_top'));
         
diff --git a/_darcs/pristine/actions/newnotice.php b/_darcs/pristine/actions/newnotice.php
index 7c3ad8815..98556c36b 100644
--- a/_darcs/pristine/actions/newnotice.php
+++ b/_darcs/pristine/actions/newnotice.php
@@ -78,7 +78,7 @@ class NewnoticeAction extends Action {
 
         $replyto = $this->trimmed('inreplyto');
 
-        $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? NULL : $replyto);
+        $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? null : $replyto);
 
         if (is_string($notice)) {
             $this->show_form($notice);
@@ -121,11 +121,11 @@ class NewnoticeAction extends Action {
         common_element_end('html');
     }
 
-    function show_top($content=NULL) {
-        common_notice_form(NULL, $content);
+    function show_top($content=null) {
+        common_notice_form(null, $content);
     }
 
-    function show_form($msg=NULL) {
+    function show_form($msg=null) {
         if ($msg && $this->boolean('ajax')) {
             $this->ajax_error_msg($msg);
             return;
@@ -138,7 +138,7 @@ class NewnoticeAction extends Action {
                 $content = '@' . $profile->nickname . ' ';
             }
         }
-        common_show_header(_('New notice'), NULL, $content,
+        common_show_header(_('New notice'), null, $content,
                            array($this, 'show_top'));
         if ($msg) {
             common_element('p', array('id' => 'error'), $msg);
diff --git a/_darcs/pristine/actions/noticesearchrss.php b/_darcs/pristine/actions/noticesearchrss.php
index a7df62ca0..d61234df8 100644
--- a/_darcs/pristine/actions/noticesearchrss.php
+++ b/_darcs/pristine/actions/noticesearchrss.php
@@ -65,6 +65,6 @@ class NoticesearchrssAction extends Rss10Action {
     }
 
     function get_image() {
-        return NULL;
+        return null;
     }
 }
diff --git a/_darcs/pristine/actions/openidlogin.php b/_darcs/pristine/actions/openidlogin.php
index 6192dfc34..1bf37f28f 100644
--- a/_darcs/pristine/actions/openidlogin.php
+++ b/_darcs/pristine/actions/openidlogin.php
@@ -52,7 +52,7 @@ class OpenidloginAction extends Action {
             }
         } else {
             $openid_url = oid_get_last();
-            $this->show_form(NULL, $openid_url);
+            $this->show_form(null, $openid_url);
         }
     }
 
@@ -60,7 +60,7 @@ class OpenidloginAction extends Action {
         return _('Login with an [OpenID](%%doc.openid%%) account.');
     }
 
-    function show_top($error=NULL) {
+    function show_top($error=null) {
         if ($error) {
             common_element('div', array('class' => 'error'), $error);
         } else {
@@ -72,8 +72,8 @@ class OpenidloginAction extends Action {
         }
     }
 
-    function show_form($error=NULL, $openid_url) {
-        common_show_header(_('OpenID Login'), NULL, $error, array($this, 'show_top'));
+    function show_form($error=null, $openid_url) {
+        common_show_header(_('OpenID Login'), null, $error, array($this, 'show_top'));
         $formaction = common_local_url('openidlogin');
         common_element_start('form', array('method' => 'post',
                                            'id' => 'openidlogin',
diff --git a/_darcs/pristine/actions/openidsettings.php b/_darcs/pristine/actions/openidsettings.php
index dd575bb73..9c0eda6f0 100644
--- a/_darcs/pristine/actions/openidsettings.php
+++ b/_darcs/pristine/actions/openidsettings.php
@@ -30,7 +30,7 @@ class OpenidsettingsAction extends SettingsAction {
                   ' Manage your associated OpenIDs from here.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
 
         $user = common_current_user();
 
@@ -41,8 +41,8 @@ class OpenidsettingsAction extends SettingsAction {
                                            'action' =>
                                            common_local_url('openidsettings')));
         common_hidden('token', common_session_token());
-        common_element('h2', NULL, _('Add OpenID'));
-        common_element('p', NULL,
+        common_element('h2', null, _('Add OpenID'));
+        common_element('p', null,
                        _('If you want to add an OpenID to your account, ' .
                           'enter it in the box below and click "Add".'));
         common_element_start('p');
@@ -66,11 +66,11 @@ class OpenidsettingsAction extends SettingsAction {
 
         if ($cnt > 0) {
 
-            common_element('h2', NULL, _('Remove OpenID'));
+            common_element('h2', null, _('Remove OpenID'));
 
             if ($cnt == 1 && !$user->password) {
 
-                common_element('p', NULL,
+                common_element('p', null,
                                _('Removing your only OpenID would make it impossible to log in! ' .
                                   'If you need to remove it, add another OpenID first.'));
 
@@ -83,7 +83,7 @@ class OpenidsettingsAction extends SettingsAction {
 
             } else {
 
-                common_element('p', NULL,
+                common_element('p', null,
                                _('You can remove an OpenID from your account '.
                                   'by clicking the button marked "Remove".'));
                 $idx = 0;
diff --git a/_darcs/pristine/actions/opensearch.php b/_darcs/pristine/actions/opensearch.php
index 707e929fb..dcde160a4 100644
--- a/_darcs/pristine/actions/opensearch.php
+++ b/_darcs/pristine/actions/opensearch.php
@@ -42,16 +42,16 @@ class OpensearchAction extends Action {
         common_element_start('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
 
         $short_name =  common_config('site', 'name').' '.$short_name;
-        common_element('ShortName', NULL, $short_name);
-        common_element('Contact', NULL, common_config('site', 'email'));
+        common_element('ShortName', null, $short_name);
+        common_element('Contact', null, common_config('site', 'email'));
         common_element('Url', array('type' => 'text/html', 'method' => 'get',
                        'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
         common_element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
         common_element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
-        common_element('AdultContent', NULL, 'false');
-        common_element('Language', NULL, common_language());
-        common_element('OutputEncoding', NULL, 'UTF-8');
-        common_element('InputEncoding', NULL, 'UTF-8');
+        common_element('AdultContent', null, 'false');
+        common_element('Language', null, common_language());
+        common_element('OutputEncoding', null, 'UTF-8');
+        common_element('InputEncoding', null, 'UTF-8');
 
         common_element_end('OpenSearchDescription');
         common_end_xml();
diff --git a/_darcs/pristine/actions/othersettings.php b/_darcs/pristine/actions/othersettings.php
index 9b824cea2..1da6577cb 100644
--- a/_darcs/pristine/actions/othersettings.php
+++ b/_darcs/pristine/actions/othersettings.php
@@ -27,12 +27,12 @@ class OthersettingsAction extends SettingsAction {
         return _('Manage various other options.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $user = common_current_user();
 
         $this->form_header(_('Other Settings'), $msg, $success);
 
-        common_element('h2', NULL, _('URL Auto-shortening'));
+        common_element('h2', null, _('URL Auto-shortening'));
         common_element_start('form', array('method' => 'post',
                                            'id' => 'othersettings',
                                            'action' =>
@@ -57,7 +57,7 @@ class OthersettingsAction extends SettingsAction {
 
         common_element_end('form');
 
-//        common_element('h2', NULL, _('Delete my account'));
+//        common_element('h2', null, _('Delete my account'));
 //        $this->show_delete_form();
 
         common_show_footer();
diff --git a/_darcs/pristine/actions/peoplesearch.php b/_darcs/pristine/actions/peoplesearch.php
index f89de53f7..a52ac317f 100644
--- a/_darcs/pristine/actions/peoplesearch.php
+++ b/_darcs/pristine/actions/peoplesearch.php
@@ -68,8 +68,8 @@ class PeoplesearchAction extends SearchAction {
 
 class PeopleSearchResults extends ProfileList {
 
-    var $terms = NULL;
-    var $pattern = NULL;
+    var $terms = null;
+    var $pattern = null;
     
     function __construct($profile, $terms) {
         parent::__construct($profile);
diff --git a/_darcs/pristine/actions/peopletag.php b/_darcs/pristine/actions/peopletag.php
index f03a3c8af..0327ecbc2 100644
--- a/_darcs/pristine/actions/peopletag.php
+++ b/_darcs/pristine/actions/peopletag.php
@@ -43,7 +43,7 @@ class PeopletagAction extends Action {
         # Looks like we're good; show the header
 
         common_show_header(sprintf(_('Users self-tagged with %s - page %d'), $tag, $page),
-                           NULL, $tag, array($this, 'show_top'));
+                           null, $tag, array($this, 'show_top'));
 
         $this->show_people($tag, $page);
 
@@ -94,7 +94,7 @@ class PeopletagAction extends Action {
     }
 
     function get_title() {
-        return NULL;
+        return null;
     }
 
     function show_header($arr) {
diff --git a/_darcs/pristine/actions/profilesettings.php b/_darcs/pristine/actions/profilesettings.php
index 3d92161ab..0fa1288dc 100644
--- a/_darcs/pristine/actions/profilesettings.php
+++ b/_darcs/pristine/actions/profilesettings.php
@@ -28,14 +28,14 @@ class ProfilesettingsAction extends SettingsAction {
                   'so people know more about you.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $this->form_header(_('Profile settings'), $msg, $success);
         $this->show_settings_form();
-        common_element('h2', NULL, _('Avatar'));
+        common_element('h2', null, _('Avatar'));
         $this->show_avatar_form();
-        common_element('h2', NULL, _('Change password'));
+        common_element('h2', null, _('Change password'));
         $this->show_password_form();
-//        common_element('h2', NULL, _('Delete my account'));
+//        common_element('h2', null, _('Delete my account'));
 //        $this->show_delete_form();
         common_show_footer();
     }
diff --git a/_darcs/pristine/actions/public.php b/_darcs/pristine/actions/public.php
index 422e4bc98..60238e54d 100644
--- a/_darcs/pristine/actions/public.php
+++ b/_darcs/pristine/actions/public.php
@@ -31,7 +31,7 @@ class PublicAction extends StreamAction {
         header('X-XRDS-Location: '. common_local_url('publicxrds'));
 
         common_show_header(_('Public timeline'),
-                           array($this, 'show_header'), NULL,
+                           array($this, 'show_header'), null,
                            array($this, 'show_top'));
 
         # XXX: Public sidebar here?
diff --git a/_darcs/pristine/actions/publicrss.php b/_darcs/pristine/actions/publicrss.php
index fa86de1d9..764f0fae2 100644
--- a/_darcs/pristine/actions/publicrss.php
+++ b/_darcs/pristine/actions/publicrss.php
@@ -52,6 +52,6 @@ class PublicrssAction extends Rss10Action {
     }
 
     function get_image() {
-        return NULL;
+        return null;
     }
 }
\ No newline at end of file
diff --git a/_darcs/pristine/actions/publicxrds.php b/_darcs/pristine/actions/publicxrds.php
index ffd65c8c9..5e3349185 100644
--- a/_darcs/pristine/actions/publicxrds.php
+++ b/_darcs/pristine/actions/publicxrds.php
@@ -42,7 +42,7 @@ class PublicxrdsAction extends Action {
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
 
-        common_element('Type', NULL, 'xri://$xrds*simple');
+        common_element('Type', null, 'xri://$xrds*simple');
 
         foreach (array('finishopenidlogin', 'finishaddopenid', 'finishimmediate') as $finish) {
             $this->show_service(Auth_OpenID_RP_RETURN_TO_URL_TYPE,
@@ -55,24 +55,24 @@ class PublicxrdsAction extends Action {
         common_end_xml();
     }
 
-    function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
+    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
         common_element_start('Service');
         if ($uri) {
-            common_element('URI', NULL, $uri);
+            common_element('URI', null, $uri);
         }
-        common_element('Type', NULL, $type);
+        common_element('Type', null, $type);
         if ($params) {
             foreach ($params as $param) {
-                common_element('Type', NULL, $param);
+                common_element('Type', null, $param);
             }
         }
         if ($sigs) {
             foreach ($sigs as $sig) {
-                common_element('Type', NULL, $sig);
+                common_element('Type', null, $sig);
             }
         }
         if ($localId) {
-            common_element('LocalID', NULL, $localId);
+            common_element('LocalID', null, $localId);
         }
         common_element_end('Service');
     }
diff --git a/_darcs/pristine/actions/recoverpassword.php b/_darcs/pristine/actions/recoverpassword.php
index 1263fee9b..068d582fa 100644
--- a/_darcs/pristine/actions/recoverpassword.php
+++ b/_darcs/pristine/actions/recoverpassword.php
@@ -132,12 +132,12 @@ class RecoverpasswordAction extends Action {
         unset($_SESSION['tempuser']);
     }
 
-    function show_top($msg=NULL) {
+    function show_top($msg=null) {
         if ($msg) {
             common_element('div', 'error', $msg);
         } else {
             common_element_start('div', 'instructions');
-            common_element('p', NULL, 
+            common_element('p', null, 
                            _('If you\'ve forgotten or lost your' .
                               ' password, you can get a new one sent to' .
                               ' the email address you have stored ' .
@@ -146,7 +146,7 @@ class RecoverpasswordAction extends Action {
         }
     }
 
-    function show_password_top($msg=NULL) {
+    function show_password_top($msg=null) {
         if ($msg) {
             common_element('div', 'error', $msg);
         } else {
@@ -156,9 +156,9 @@ class RecoverpasswordAction extends Action {
         }
     }
 
-    function show_form($msg=NULL) {
+    function show_form($msg=null) {
 
-        common_show_header(_('Recover password'), NULL,
+        common_show_header(_('Recover password'), null,
         $msg, array($this, 'show_top'));
 
         common_element_start('form', array('method' => 'post',
@@ -173,9 +173,9 @@ class RecoverpasswordAction extends Action {
         common_show_footer();
     }
 
-    function show_password_form($msg=NULL) {
+    function show_password_form($msg=null) {
 
-        common_show_header(_('Reset password'), NULL,
+        common_show_header(_('Reset password'), null,
         $msg, array($this, 'show_password_top'));
 
         common_element_start('form', array('method' => 'post',
@@ -224,7 +224,7 @@ class RecoverpasswordAction extends Action {
             $confirm_email = Confirm_address::staticGet('user_id', $user->id);
             if ($confirm_email && $confirm_email->address_type != 'email') {
                 # Skip non-email confirmations
-                $confirm_email = NULL;
+                $confirm_email = null;
             }
         }
 
@@ -267,7 +267,7 @@ class RecoverpasswordAction extends Action {
         mail_to_user($user, _('Password recovery requested'), $body, $confirm->address);
 
         common_show_header(_('Password recovery requested'));
-        common_element('p', NULL,
+        common_element('p', null,
                        _('Instructions for recovering your password ' .
                           'have been sent to the email address registered to your ' .
                           'account.'));
@@ -324,7 +324,7 @@ class RecoverpasswordAction extends Action {
         common_real_login(true);
 
         common_show_header(_('Password saved.'));
-        common_element('p', NULL, _('New password successfully saved. ' .
+        common_element('p', null, _('New password successfully saved. ' .
                                      'You are now logged in.'));
         common_show_footer();
     }
diff --git a/_darcs/pristine/actions/register.php b/_darcs/pristine/actions/register.php
index 011aa3f09..f3eaf6122 100644
--- a/_darcs/pristine/actions/register.php
+++ b/_darcs/pristine/actions/register.php
@@ -149,7 +149,7 @@ class RegisterAction extends Action {
         return ($user !== false);
     }
 
-    function show_top($error=NULL) {
+    function show_top($error=null) {
         if ($error) {
             common_element('p', 'error', $error);
         } else {
@@ -164,7 +164,7 @@ class RegisterAction extends Action {
         }
     }
 
-    function show_form($error=NULL) {
+    function show_form($error=null) {
         global $config;
 
         $code = $this->trimmed('code');
@@ -178,7 +178,7 @@ class RegisterAction extends Action {
             return;
         }
 
-        common_show_header(_('Register'), NULL, $error, array($this, 'show_top'));
+        common_show_header(_('Register'), null, $error, array($this, 'show_top'));
         common_element_start('form', array('method' => 'post',
                                            'id' => 'login',
                                            'action' => common_local_url('register')));
diff --git a/_darcs/pristine/actions/remotesubscribe.php b/_darcs/pristine/actions/remotesubscribe.php
index 14e8cb068..be2cb1025 100644
--- a/_darcs/pristine/actions/remotesubscribe.php
+++ b/_darcs/pristine/actions/remotesubscribe.php
@@ -55,7 +55,7 @@ class RemotesubscribeAction extends Action {
                   ' enter your profile URL below.');
     }
 
-    function show_top($err=NULL) {
+    function show_top($err=null) {
         if ($err) {
             common_element('div', 'error', $err);
         } else {
@@ -67,10 +67,10 @@ class RemotesubscribeAction extends Action {
         }
     }
 
-    function show_form($err=NULL) {
+    function show_form($err=null) {
         $nickname = $this->trimmed('nickname');
         $profile = $this->trimmed('profile_url');
-        common_show_header(_('Remote subscribe'), NULL, $err,
+        common_show_header(_('Remote subscribe'), null, $err,
                            array($this, 'show_top'));
         # id = remotesubscribe conflicts with the
         # button on profile page
@@ -153,7 +153,7 @@ class RemotesubscribeAction extends Action {
     }
 
     function get_user() {
-        $user = NULL;
+        $user = null;
         $nickname = $this->trimmed('nickname');
         if ($nickname) {
             $user = User::staticGet('nickname', $nickname);
@@ -173,7 +173,7 @@ class RemotesubscribeAction extends Action {
         $oauth_services = omb_get_services($xrds, OAUTH_DISCOVERY);
 
         if (!$oauth_services) {
-            return NULL;
+            return null;
         }
 
         $oauth_service = $oauth_services[0];
@@ -181,17 +181,17 @@ class RemotesubscribeAction extends Action {
         $oauth_xrd = $this->getXRD($oauth_service, $xrds);
 
         if (!$oauth_xrd) {
-            return NULL;
+            return null;
         }
 
         if (!$this->addServices($oauth_xrd, $oauth_endpoints, $omb)) {
-            return NULL;
+            return null;
         }
 
         $omb_services = omb_get_services($xrds, OMB_NAMESPACE);
 
         if (!$omb_services) {
-            return NULL;
+            return null;
         }
 
         $omb_service = $omb_services[0];
@@ -199,23 +199,23 @@ class RemotesubscribeAction extends Action {
         $omb_xrd = $this->getXRD($omb_service, $xrds);
 
         if (!$omb_xrd) {
-            return NULL;
+            return null;
         }
 
         if (!$this->addServices($omb_xrd, $omb_endpoints, $omb)) {
-            return NULL;
+            return null;
         }
 
         # XXX: check that we got all the services we needed
 
         foreach (array_merge($omb_endpoints, $oauth_endpoints) as $type) {
             if (!array_key_exists($type, $omb) || !$omb[$type]) {
-                return NULL;
+                return null;
             }
         }
 
         if (!omb_local_id($omb[OAUTH_ENDPOINT_REQUEST])) {
-            return NULL;
+            return null;
         }
 
         return $omb;
@@ -225,7 +225,7 @@ class RemotesubscribeAction extends Action {
         $uri = omb_service_uri($main_service);
         if (strpos($uri, "#") !== 0) {
             # FIXME: more rigorous handling of external service definitions
-            return NULL;
+            return null;
         }
         $id = substr($uri, 1);
         $nodes = $main_xrds->allXrdNodes;
@@ -239,7 +239,7 @@ class RemotesubscribeAction extends Action {
                 return new Auth_Yadis_XRDS($parser, $bogus_nodes);
             }
         }
-        return NULL;
+        return null;
     }
 
     function addServices($xrd, $types, &$omb) {
@@ -267,12 +267,12 @@ class RemotesubscribeAction extends Action {
         $params = array();
         parse_str($parsed['query'], $params);
 
-        $req = OAuthRequest::from_consumer_and_token($con, NULL, "POST", $url, $params);
+        $req = OAuthRequest::from_consumer_and_token($con, null, "POST", $url, $params);
 
         $listener = omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]);
 
         if (!$listener) {
-            return NULL;
+            return null;
         }
 
         $req->set_parameter('omb_listener', $listener);
@@ -280,7 +280,7 @@ class RemotesubscribeAction extends Action {
 
         # XXX: test to see if endpoint accepts this signature method
 
-        $req->sign_request(omb_hmac_sha1(), $con, NULL);
+        $req->sign_request(omb_hmac_sha1(), $con, null);
 
         # We re-use this tool's fetcher, since it's pretty good
 
@@ -291,7 +291,7 @@ class RemotesubscribeAction extends Action {
                                  array('User-Agent' => 'Laconica/' . LACONICA_VERSION));
 
         if ($result->status != 200) {
-            return NULL;
+            return null;
         }
 
         parse_str($result->body, $return);
diff --git a/_darcs/pristine/actions/repliesrss.php b/_darcs/pristine/actions/repliesrss.php
index 3689ea1f8..9652ae9ea 100644
--- a/_darcs/pristine/actions/repliesrss.php
+++ b/_darcs/pristine/actions/repliesrss.php
@@ -25,7 +25,7 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class RepliesrssAction extends Rss10Action {
 
-    var $user = NULL;
+    var $user = null;
 
     function init() {
         $nickname = $this->trimmed('nickname');
@@ -71,9 +71,9 @@ class RepliesrssAction extends Rss10Action {
         $user = $this->user;
         $profile = $user->getProfile();
         if (!$profile) {
-            return NULL;
+            return null;
         }
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-        return ($avatar) ? $avatar->url : NULL;
+        return ($avatar) ? $avatar->url : null;
     }
 }
\ No newline at end of file
diff --git a/_darcs/pristine/actions/showmessage.php b/_darcs/pristine/actions/showmessage.php
index f35f3eede..a5e03c72d 100644
--- a/_darcs/pristine/actions/showmessage.php
+++ b/_darcs/pristine/actions/showmessage.php
@@ -53,7 +53,7 @@ class ShowmessageAction extends MailboxAction {
     function get_title($user, $page) {
         $message = $this->get_message();
         if (!$message) {
-            return NULL;
+            return null;
         }
         
         if ($user->id == $message->from_profile) {
@@ -85,7 +85,7 @@ class ShowmessageAction extends MailboxAction {
             return $message->getFrom();
         } else {
             # This shouldn't happen
-            return NULL;
+            return null;
         }
     }
     
diff --git a/_darcs/pristine/actions/shownotice.php b/_darcs/pristine/actions/shownotice.php
index 74d197ed1..04af61a6f 100644
--- a/_darcs/pristine/actions/shownotice.php
+++ b/_darcs/pristine/actions/shownotice.php
@@ -23,9 +23,9 @@ require_once(INSTALLDIR.'/lib/stream.php');
 
 class ShownoticeAction extends StreamAction {
 
-    var $notice = NULL;
-    var $profile = NULL;
-    var $avatar = NULL;
+    var $notice = null;
+    var $profile = null;
+    var $avatar = null;
 
     function prepare($args) {
 
@@ -73,7 +73,7 @@ class ShownoticeAction extends StreamAction {
         common_show_header(sprintf(_('%1$s\'s status on %2$s'),
                                    $this->profile->nickname,
                                    common_exact_date($this->notice->created)),
-                           array($this, 'show_header'), NULL,
+                           array($this, 'show_header'), null,
                            array($this, 'show_top'));
 
         common_element_start('ul', array('id' => 'notices'));
diff --git a/_darcs/pristine/actions/showstream.php b/_darcs/pristine/actions/showstream.php
index f8525348d..485c2e3d1 100644
--- a/_darcs/pristine/actions/showstream.php
+++ b/_darcs/pristine/actions/showstream.php
@@ -285,7 +285,7 @@ class ShowstreamAction extends StreamAction {
 
         common_element_start('div', array('id' => 'subscriptions'));
 
-        common_element('h2', NULL, _('Subscriptions'));
+        common_element('h2', null, _('Subscriptions'));
 
         if ($subs_count > 0) {
 
@@ -415,7 +415,7 @@ class ShowstreamAction extends StreamAction {
 
     function show_last_notice($profile) {
 
-        common_element('h2', NULL, _('Currently'));
+        common_element('h2', null, _('Currently'));
 
         $notice = $profile->getCurrentNotice();
 
diff --git a/_darcs/pristine/actions/smssettings.php b/_darcs/pristine/actions/smssettings.php
index 506801e97..71ab39514 100644
--- a/_darcs/pristine/actions/smssettings.php
+++ b/_darcs/pristine/actions/smssettings.php
@@ -28,7 +28,7 @@ class SmssettingsAction extends EmailsettingsAction {
         return _('You can receive SMS messages through email from %%site.name%%.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $user = common_current_user();
         $this->form_header(_('SMS Settings'), $msg, $success);
         common_element_start('form', array('method' => 'post',
@@ -36,7 +36,7 @@ class SmssettingsAction extends EmailsettingsAction {
                                            'action' =>
                                            common_local_url('smssettings')));
         common_hidden('token', common_session_token());
-        common_element('h2', NULL, _('Address'));
+        common_element('h2', null, _('Address'));
 
         if ($user->sms) {
             common_element_start('p');
@@ -60,12 +60,12 @@ class SmssettingsAction extends EmailsettingsAction {
                 common_hidden('carrier', $confirm->address_extra);
                 common_element_end('p');
                 common_submit('cancel', _('Cancel'));
-                common_input('code', _('Confirmation code'), NULL,
+                common_input('code', _('Confirmation code'), null,
                              _('Enter the code you received on your phone.'));
                 common_submit('confirm', _('Confirm'));
             } else {
                 common_input('sms', _('SMS Phone number'),
-                             ($this->arg('sms')) ? $this->arg('sms') : NULL,
+                             ($this->arg('sms')) ? $this->arg('sms') : null,
                              _('Phone number, no punctuation or spaces, with area code'));
                 $this->carrier_select();
                 common_submit('add', _('Add'));
@@ -73,7 +73,7 @@ class SmssettingsAction extends EmailsettingsAction {
         }
 
         if ($user->sms) {
-            common_element('h2', NULL, _('Incoming email'));
+            common_element('h2', null, _('Incoming email'));
             
             if ($user->incomingemail) {
                 common_element_start('p');
@@ -91,7 +91,7 @@ class SmssettingsAction extends EmailsettingsAction {
             common_submit('newincoming', _('New'));
         }
         
-        common_element('h2', NULL, _('Preferences'));
+        common_element('h2', null, _('Preferences'));
         
         common_checkbox('smsnotify',
                         _('Send me notices through SMS; I understand I may incur exorbitant charges from my carrier.'),
@@ -111,7 +111,7 @@ class SmssettingsAction extends EmailsettingsAction {
         if ($confirm->find(TRUE)) {
             return $confirm;
         } else {
-            return NULL;
+            return null;
         }
     }
 
@@ -268,9 +268,9 @@ class SmssettingsAction extends EmailsettingsAction {
 
         $user->query('BEGIN');
         $original = clone($user);
-        $user->sms = NULL;
-        $user->carrier = NULL;        
-        $user->smsemail = NULL;        
+        $user->sms = null;
+        $user->carrier = null;        
+        $user->smsemail = null;        
         $result = $user->updateKeys($original);
         if (!$result) {
             common_log_db_error($user, 'UPDATE', __FILE__);
diff --git a/_darcs/pristine/actions/subedit.php b/_darcs/pristine/actions/subedit.php
index 1d095ab9a..db935eb28 100644
--- a/_darcs/pristine/actions/subedit.php
+++ b/_darcs/pristine/actions/subedit.php
@@ -21,7 +21,7 @@ if (!defined('LACONICA')) { exit(1); }
 
 class SubeditAction extends Action {
 
-    var $profile = NULL;
+    var $profile = null;
 
     function prepare($args) {
 
diff --git a/_darcs/pristine/actions/tagother.php b/_darcs/pristine/actions/tagother.php
index 832671ae7..4691fef07 100644
--- a/_darcs/pristine/actions/tagother.php
+++ b/_darcs/pristine/actions/tagother.php
@@ -49,12 +49,12 @@ class TagotherAction extends Action {
         }
     }
 
-    function show_form($profile, $error=NULL) {
+    function show_form($profile, $error=null) {
 
         $user = common_current_user();
 
         common_show_header(_('Tag a person'),
-                           NULL, array($profile, $error), array($this, 'show_top'));
+                           null, array($profile, $error), array($this, 'show_top'));
 
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
 
@@ -178,13 +178,13 @@ class TagotherAction extends Action {
         }
     }
 
-    function show_top($arr = NULL) {
+    function show_top($arr = null) {
         list($profile, $error) = $arr;
         if ($error) {
             common_element('p', 'error', $error);
         } else {
             common_element_start('div', 'instructions');
-            common_element('p', NULL,
+            common_element('p', null,
                            _('Use this form to add tags to your subscribers or subscriptions.'));
             common_element_end('div');
         }
diff --git a/_darcs/pristine/actions/tagrss.php b/_darcs/pristine/actions/tagrss.php
index 45639fec4..6199a285d 100644
--- a/_darcs/pristine/actions/tagrss.php
+++ b/_darcs/pristine/actions/tagrss.php
@@ -41,7 +41,7 @@ class TagrssAction extends Rss10Action {
         $tag = $this->tag;
 
         if (is_null($tag)) {
-            return NULL;
+            return null;
         }
 
         $notice = Notice_tag::getStream($tag->tag, 0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
diff --git a/_darcs/pristine/actions/twitapidirect_messages.php b/_darcs/pristine/actions/twitapidirect_messages.php
index 2e3b50173..7adb4eadd 100644
--- a/_darcs/pristine/actions/twitapidirect_messages.php
+++ b/_darcs/pristine/actions/twitapidirect_messages.php
@@ -228,12 +228,12 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
         $this->init_document('rss');
 
         common_element_start('channel');
-        common_element('title', NULL, $title);
+        common_element('title', null, $title);
 
-        common_element('link', NULL, $link);
-        common_element('description', NULL, $subtitle);
-        common_element('language', NULL, 'en-us');
-        common_element('ttl', NULL, '40');
+        common_element('link', null, $link);
+        common_element('description', null, $subtitle);
+        common_element('language', null, 'en-us');
+        common_element('ttl', null, '40');
 
         if (is_array($message)) {
             foreach ($message as $m) {
@@ -256,12 +256,12 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
 
         $this->init_document('atom');
 
-        common_element('title', NULL, $title);
+        common_element('title', null, $title);
         $siteserver = common_config('site', 'server');
-        common_element('id', NULL, "tag:$siteserver,2008:DirectMessage");
-        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
-        common_element('updated', NULL, common_date_iso8601(strftime('%c')));
-        common_element('subtitle', NULL, $subtitle);
+        common_element('id', null, "tag:$siteserver,2008:DirectMessage");
+        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
+        common_element('updated', null, common_date_iso8601(strftime('%c')));
+        common_element('subtitle', null, $subtitle);
 
         if (is_array($message)) {
             foreach ($message as $m) {
diff --git a/_darcs/pristine/actions/twitapifriendships.php b/_darcs/pristine/actions/twitapifriendships.php
index d352b933b..a52f0fe4d 100644
--- a/_darcs/pristine/actions/twitapifriendships.php
+++ b/_darcs/pristine/actions/twitapifriendships.php
@@ -138,7 +138,7 @@ class TwitapifriendshipsAction extends TwitterapiAction {
         switch ($apidata['content-type']) {
          case 'xml':
             $this->init_document('xml');
-            common_element('friends', NULL, $result);
+            common_element('friends', null, $result);
             $this->end_document('xml');
             break;
          case 'json':
diff --git a/_darcs/pristine/actions/twitapihelp.php b/_darcs/pristine/actions/twitapihelp.php
index d268b7c82..f0e9adfdb 100644
--- a/_darcs/pristine/actions/twitapihelp.php
+++ b/_darcs/pristine/actions/twitapihelp.php
@@ -32,7 +32,7 @@ class TwitapihelpAction extends TwitterapiAction {
 
         if ($apidata['content-type'] == 'xml') {
             $this->init_document('xml');
-            common_element('ok', NULL, 'true');
+            common_element('ok', null, 'true');
             $this->end_document('xml');
         } elseif ($apidata['content-type'] == 'json') {
             $this->init_document('json');
diff --git a/_darcs/pristine/actions/twitapistatuses.php b/_darcs/pristine/actions/twitapistatuses.php
index c33643a3c..ffa94b309 100644
--- a/_darcs/pristine/actions/twitapistatuses.php
+++ b/_darcs/pristine/actions/twitapistatuses.php
@@ -112,7 +112,7 @@ class TwitapistatusesAction extends TwitterapiAction {
 
         $since = strtotime($this->arg('since'));
 
-        $user = $this->get_user(NULL, $apidata);
+        $user = $this->get_user(null, $apidata);
         $this->auth_user = $user;
 
         $profile = $user->getProfile();
@@ -200,7 +200,7 @@ class TwitapistatusesAction extends TwitterapiAction {
         # FriendFeed's SUP protocol
         # Also added RSS and Atom feeds
 
-        $suplink = common_local_url('sup', NULL, $user->id);
+        $suplink = common_local_url('sup', null, $user->id);
         header('X-SUP-ID: '.$suplink);
 
         # XXX: since
@@ -291,7 +291,7 @@ class TwitapistatusesAction extends TwitterapiAction {
             $apidata['api_arg'] = $n->id;
         } else {
 
-            $reply_to = NULL;
+            $reply_to = null;
 
             if ($in_reply_to_status_id) {
 
diff --git a/_darcs/pristine/actions/twittersettings.php b/_darcs/pristine/actions/twittersettings.php
index e300e699a..8cbd39fbd 100644
--- a/_darcs/pristine/actions/twittersettings.php
+++ b/_darcs/pristine/actions/twittersettings.php
@@ -30,10 +30,10 @@ class TwittersettingsAction extends SettingsAction {
             'and subscribe to Twitter friends already here.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $user = common_current_user();
         $profile = $user->getProfile();
-        $fuser = NULL;
+        $fuser = null;
         $flink = Foreign_link::getByUserID($user->id, 1); // 1 == Twitter
 
         if ($flink) {
@@ -47,7 +47,7 @@ class TwittersettingsAction extends SettingsAction {
                                            common_local_url('twittersettings')));
         common_hidden('token', common_session_token());
 
-        common_element('h2', NULL, _('Twitter Account'));
+        common_element('h2', null, _('Twitter Account'));
 
         if ($fuser) {
             common_element_start('p');
@@ -67,7 +67,7 @@ class TwittersettingsAction extends SettingsAction {
             common_password('twitter_password', _('Twitter password'));
         }
 
-        common_element('h2', NULL, _('Preferences'));
+        common_element('h2', null, _('Preferences'));
 
         common_checkbox('noticesync', _('Automatically send my notices to Twitter.'),
                         ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
@@ -126,7 +126,7 @@ class TwittersettingsAction extends SettingsAction {
 
         if ($friends_count > 0) {
 
-            common_element('h3', NULL, _('Twitter Friends'));
+            common_element('h3', null, _('Twitter Friends'));
             common_element_start('div', array('id' => 'subscriptions'));
             common_element_start('ul', array('id' => 'subscriptions_avatars'));
 
diff --git a/_darcs/pristine/actions/unblock.php b/_darcs/pristine/actions/unblock.php
index 6a86c2bf0..51ec0ae57 100644
--- a/_darcs/pristine/actions/unblock.php
+++ b/_darcs/pristine/actions/unblock.php
@@ -21,7 +21,7 @@ if (!defined('LACONICA')) { exit(1); }
 
 class UnblockAction extends Action {
 
-    var $profile = NULL;
+    var $profile = null;
 
     function prepare($args) {
 
diff --git a/_darcs/pristine/actions/userauthorization.php b/_darcs/pristine/actions/userauthorization.php
index 97809f197..58ec36fc8 100644
--- a/_darcs/pristine/actions/userauthorization.php
+++ b/_darcs/pristine/actions/userauthorization.php
@@ -81,7 +81,7 @@ class UserauthorizationAction extends Action {
         $avatar = $req->get_parameter('omb_listenee_avatar');
 
         common_show_header(_('Authorize subscription'));
-        common_element('p', NULL, _('Please check these details to make sure '.
+        common_element('p', null, _('Please check these details to make sure '.
                                      'that you want to subscribe to this user\'s notices. '.
                                      'If you didn\'t just ask to subscribe to someone\'s notices, '.
                                      'click "Cancel".'));
@@ -320,7 +320,7 @@ class UserauthorizationAction extends Action {
 
     function show_accept_message($tok) {
         common_show_header(_('Subscription authorized'));
-        common_element('p', NULL,
+        common_element('p', null,
                        _('The subscription has been authorized, but no '.
                           'callback URL was passed. Check with the site\'s instructions for '.
                           'details on how to authorize the subscription. Your subscription token is:'));
@@ -330,7 +330,7 @@ class UserauthorizationAction extends Action {
 
     function show_reject_message($tok) {
         common_show_header(_('Subscription rejected'));
-        common_element('p', NULL,
+        common_element('p', null,
                        _('The subscription has been rejected, but no '.
                           'callback URL was passed. Check with the site\'s instructions for '.
                           'details on how to fully reject the subscription.'));
diff --git a/_darcs/pristine/actions/userbyid.php b/_darcs/pristine/actions/userbyid.php
index 4eab8758c..3fa92e9ce 100644
--- a/_darcs/pristine/actions/userbyid.php
+++ b/_darcs/pristine/actions/userbyid.php
@@ -38,7 +38,7 @@ class UserbyidAction extends Action {
 
         // support redirecting to FOAF rdf/xml if the agent prefers it
         $page_prefs = 'application/rdf+xml,text/html,application/xhtml+xml,application/xml;q=0.3,text/xml;q=0.2';
-        $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : NULL;
+        $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
         $type = common_negotiate_type(common_accept_to_prefs($httpaccept),
                                       common_accept_to_prefs($page_prefs));
         $page = $type == 'application/rdf+xml' ? 'foaf' : 'showstream';
diff --git a/_darcs/pristine/actions/userrss.php b/_darcs/pristine/actions/userrss.php
index b5cb5a40a..6089718ae 100644
--- a/_darcs/pristine/actions/userrss.php
+++ b/_darcs/pristine/actions/userrss.php
@@ -25,7 +25,7 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class UserrssAction extends Rss10Action {
 
-    var $user = NULL;
+    var $user = null;
 
     function init() {
         $nickname = $this->trimmed('nickname');
@@ -44,7 +44,7 @@ class UserrssAction extends Rss10Action {
         $user = $this->user;
         
         if (is_null($user)) {
-            return NULL;
+            return null;
         }
         
         $notice = $user->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
@@ -74,16 +74,16 @@ class UserrssAction extends Rss10Action {
         if (!$profile) {
             common_log_db_error($user, 'SELECT', __FILE__);
             $this->server_error(_('User without matching profile'));
-            return NULL;
+            return null;
         }
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-        return ($avatar) ? $avatar->url : NULL;
+        return ($avatar) ? $avatar->url : null;
     }
 
     # override parent to add X-SUP-ID URL
     
     function init_rss($limit=0) {
-        $url = common_local_url('sup', NULL, $this->user->id);
+        $url = common_local_url('sup', null, $this->user->id);
         header('X-SUP-ID: '.$url);
         parent::init_rss($limit);
     }
diff --git a/_darcs/pristine/actions/xrds.php b/_darcs/pristine/actions/xrds.php
index 9788c87aa..54baf64be 100644
--- a/_darcs/pristine/actions/xrds.php
+++ b/_darcs/pristine/actions/xrds.php
@@ -50,7 +50,7 @@ class XrdsAction extends Action {
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
 
-        common_element('Type', NULL, 'xri://$xrds*simple');
+        common_element('Type', null, 'xri://$xrds*simple');
 
         $this->show_service(OAUTH_ENDPOINT_REQUEST,
                             common_local_url('requesttoken'),
@@ -69,7 +69,7 @@ class XrdsAction extends Action {
                             array(OAUTH_HMAC_SHA1));
 
         $this->show_service(OAUTH_ENDPOINT_RESOURCE,
-                            NULL,
+                            null,
                             array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
                             array(OAUTH_HMAC_SHA1));
 
@@ -82,7 +82,7 @@ class XrdsAction extends Action {
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
 
-        common_element('Type', NULL, 'xri://$xrds*simple');
+        common_element('Type', null, 'xri://$xrds*simple');
 
         $this->show_service(OMB_ENDPOINT_POSTNOTICE,
                             common_local_url('postnotice'));
@@ -95,7 +95,7 @@ class XrdsAction extends Action {
         common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
                                           'version' => '2.0'));
 
-        common_element('Type', NULL, 'xri://$xrds*simple');
+        common_element('Type', null, 'xri://$xrds*simple');
 
         $this->show_service(OAUTH_DISCOVERY,
                             '#oauth');
@@ -108,24 +108,24 @@ class XrdsAction extends Action {
         common_end_xml();
     }
 
-    function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
+    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
         common_element_start('Service');
         if ($uri) {
-            common_element('URI', NULL, $uri);
+            common_element('URI', null, $uri);
         }
-        common_element('Type', NULL, $type);
+        common_element('Type', null, $type);
         if ($params) {
             foreach ($params as $param) {
-                common_element('Type', NULL, $param);
+                common_element('Type', null, $param);
             }
         }
         if ($sigs) {
             foreach ($sigs as $sig) {
-                common_element('Type', NULL, $sig);
+                common_element('Type', null, $sig);
             }
         }
         if ($localId) {
-            common_element('LocalID', NULL, $localId);
+            common_element('LocalID', null, $localId);
         }
         common_element_end('Service');
     }
diff --git a/_darcs/pristine/classes/Avatar.php b/_darcs/pristine/classes/Avatar.php
index e63668a33..bde983d79 100644
--- a/_darcs/pristine/classes/Avatar.php
+++ b/_darcs/pristine/classes/Avatar.php
@@ -21,7 +21,7 @@ class Avatar extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -72,7 +72,7 @@ class Avatar extends Memcached_DataObject
         if ($scaled->insert()) {
             return $scaled;
         } else {
-            return NULL;
+            return null;
         }
     }
 
@@ -85,7 +85,7 @@ class Avatar extends Memcached_DataObject
         } else if ($this->mediatype == 'image/png') {
             return imagecreatefrompng($filepath);
         } else {
-            return NULL;
+            return null;
         }
     }
     
diff --git a/_darcs/pristine/classes/Channel.php b/_darcs/pristine/classes/Channel.php
index 384fe8bb1..ea3530406 100644
--- a/_darcs/pristine/classes/Channel.php
+++ b/_darcs/pristine/classes/Channel.php
@@ -38,13 +38,13 @@ class Channel {
     }
     
     function source() {
-        return NULL;
+        return null;
     }
 }
 
 class XMPPChannel extends Channel {
 
-    var $conn = NULL;
+    var $conn = null;
     
     function source() {
         return 'xmpp';
@@ -111,7 +111,7 @@ class WebChannel extends Channel {
         # XXX: even better, redirect to appropriate page
         #      depending on what command was run
         common_show_header(_('Command results'));
-        common_element('p', NULL, $text);
+        common_element('p', null, $text);
         common_show_footer();
     }
     
@@ -149,13 +149,13 @@ class AjaxWebChannel extends WebChannel {
 
 class MailChannel extends Channel {
 
-    var $addr = NULL;
+    var $addr = null;
 
     function source() {
         return 'mail';
     }
     
-    function __construct($addr=NULL) {
+    function __construct($addr=null) {
         $this->addr = $addr;
     }
     
diff --git a/_darcs/pristine/classes/Command.php b/_darcs/pristine/classes/Command.php
index ff44b9d1e..b146005a7 100644
--- a/_darcs/pristine/classes/Command.php
+++ b/_darcs/pristine/classes/Command.php
@@ -23,9 +23,9 @@ require_once(INSTALLDIR.'/classes/Channel.php');
 
 class Command {
     
-    var $user = NULL;
+    var $user = null;
     
-    function __construct($user=NULL) {
+    function __construct($user=null) {
         $this->user = $user;
     }
     
@@ -47,7 +47,7 @@ class TrackOffCommand extends UnimplementedCommand {
 }
 
 class TrackCommand extends UnimplementedCommand {
-    var $word = NULL;
+    var $word = null;
     function __construct($user, $word) {
         parent::__construct($user);
         $this->word = $word;
@@ -55,7 +55,7 @@ class TrackCommand extends UnimplementedCommand {
 }
 
 class UntrackCommand extends UnimplementedCommand {
-    var $word = NULL;
+    var $word = null;
     function __construct($user, $word) {
         parent::__construct($user);
         $this->word = $word;
@@ -63,7 +63,7 @@ class UntrackCommand extends UnimplementedCommand {
 }
 
 class NudgeCommand extends UnimplementedCommand {
-    var $other = NULL;
+    var $other = null;
     function __construct($user, $other) {
         parent::__construct($user);
         $this->other = $other;
@@ -71,7 +71,7 @@ class NudgeCommand extends UnimplementedCommand {
 }
 
 class InviteCommand extends UnimplementedCommand {
-    var $other = NULL;
+    var $other = null;
     function __construct($user, $other) {
         parent::__construct($user);
         $this->other = $other;
@@ -104,7 +104,7 @@ class StatsCommand extends Command {
 
 class FavCommand extends Command {
     
-    var $other = NULL;
+    var $other = null;
     
     function __construct($user, $other) {
         parent::__construct($user);
@@ -148,7 +148,7 @@ class FavCommand extends Command {
 }
 
 class WhoisCommand extends Command {
-    var $other = NULL;
+    var $other = null;
     function __construct($user, $other) {
         parent::__construct($user);
         $this->other = $other;
@@ -182,8 +182,8 @@ class WhoisCommand extends Command {
 }
 
 class MessageCommand extends Command {
-    var $other = NULL;
-    var $text = NULL;
+    var $other = null;
+    var $text = null;
     function __construct($user, $other, $text) {
         parent::__construct($user);
         $this->other = $other;
@@ -225,7 +225,7 @@ class MessageCommand extends Command {
 
 class GetCommand extends Command {
     
-    var $other = NULL;
+    var $other = null;
     
     function __construct($user, $other) {
         parent::__construct($user);
@@ -255,7 +255,7 @@ class GetCommand extends Command {
 
 class SubCommand extends Command {
     
-    var $other = NULL;
+    var $other = null;
     
     function __construct($user, $other) {
         parent::__construct($user);
@@ -281,7 +281,7 @@ class SubCommand extends Command {
 
 class UnsubCommand extends Command {
 
-    var $other = NULL;
+    var $other = null;
     
     function __construct($user, $other) {
         parent::__construct($user);
@@ -305,8 +305,8 @@ class UnsubCommand extends Command {
 }
 
 class OffCommand extends Command {
-    var $other = NULL;
-    function __construct($user, $other=NULL) {
+    var $other = null;
+    function __construct($user, $other=null) {
         parent::__construct($user);
         $this->other = $other;
     }
@@ -324,8 +324,8 @@ class OffCommand extends Command {
 }
 
 class OnCommand extends Command {
-    var $other = NULL;
-    function __construct($user, $other=NULL) {
+    var $other = null;
+    function __construct($user, $other=null) {
         parent::__construct($user);
         $this->other = $other;
     }
diff --git a/_darcs/pristine/classes/CommandInterpreter.php b/_darcs/pristine/classes/CommandInterpreter.php
index 8192fb1a9..db02ce541 100644
--- a/_darcs/pristine/classes/CommandInterpreter.php
+++ b/_darcs/pristine/classes/CommandInterpreter.php
@@ -37,14 +37,14 @@ class CommandInterpreter {
         switch(strtolower($cmd)) {
          case 'help':
             if ($arg) {
-                return NULL;
+                return null;
             }
             return new HelpCommand($user);
          case 'on':
             if ($arg) {
                 list($other, $extra) = explode(' ', $arg, 2);
                 if ($extra) {
-                    return NULL;
+                    return null;
                 } else {
                     return new OnCommand($user, $other);
                 }
@@ -55,7 +55,7 @@ class CommandInterpreter {
             if ($arg) {
                 list($other, $extra) = explode(' ', $arg, 2);
                 if ($extra) {
-                    return NULL;
+                    return null;
                 } else {
                     return new OffCommand($user, $other);
                 }
@@ -65,105 +65,105 @@ class CommandInterpreter {
          case 'stop':
          case 'quit':
             if ($arg) {
-                return NULL;
+                return null;
             } else {
                 return new OffCommand($user);
             }
          case 'follow':
          case 'sub':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new SubCommand($user, $other);
             }
          case 'leave':
          case 'unsub':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new UnsubCommand($user, $other);
             }
          case 'get':
          case 'last':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new GetCommand($user, $other);
             }
          case 'd':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if (!$extra) {
-                return NULL;
+                return null;
             } else {
                 return new MessageCommand($user, $other, $extra);
             }
          case 'whois':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new WhoisCommand($user, $other);
             }
          case 'fav':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new FavCommand($user, $other);
             }
          case 'nudge':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new NudgeCommand($user, $other);
             }
          case 'stats':
             if ($arg) {
-                return NULL;
+                return null;
             }
             return new StatsCommand($user);
          case 'invite':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new InviteCommand($user, $other);
             }
          case 'track':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($word, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else if ($word == 'off') {
                 return new TrackOffCommand($user);
             } else {
@@ -171,11 +171,11 @@ class CommandInterpreter {
             }
          case 'untrack':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($word, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else if ($word == 'all') {
                 return new TrackOffCommand($user);
             } else {
@@ -184,7 +184,7 @@ class CommandInterpreter {
          case 'tracks':
          case 'tracking':
             if ($arg) {
-                return NULL;
+                return null;
             }
             return new TrackingCommand($user);
          default:
diff --git a/_darcs/pristine/classes/Confirm_address.php b/_darcs/pristine/classes/Confirm_address.php
index 10661ff5c..71f2d0c72 100644
--- a/_darcs/pristine/classes/Confirm_address.php
+++ b/_darcs/pristine/classes/Confirm_address.php
@@ -20,7 +20,7 @@ class Confirm_address extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Consumer.php b/_darcs/pristine/classes/Consumer.php
index d18e6feeb..c598312aa 100644
--- a/_darcs/pristine/classes/Consumer.php
+++ b/_darcs/pristine/classes/Consumer.php
@@ -16,7 +16,7 @@ class Consumer extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Fave.php b/_darcs/pristine/classes/Fave.php
index b70a8a897..5d938d149 100644
--- a/_darcs/pristine/classes/Fave.php
+++ b/_darcs/pristine/classes/Fave.php
@@ -15,7 +15,7 @@ class Fave extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Fave',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Fave',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Foreign_link.php b/_darcs/pristine/classes/Foreign_link.php
index 7ce0df833..41a95e641 100644
--- a/_darcs/pristine/classes/Foreign_link.php
+++ b/_darcs/pristine/classes/Foreign_link.php
@@ -21,7 +21,7 @@ class Foreign_link extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -38,7 +38,7 @@ class Foreign_link extends Memcached_DataObject
             return $flink;
         }
 
-        return NULL;        
+        return null;        
     }
     
     static function getByForeignID($foreign_id, $service) {
@@ -51,7 +51,7 @@ class Foreign_link extends Memcached_DataObject
             return $flink;
         }
 
-        return NULL;        
+        return null;        
     }
         
     # Convenience methods
@@ -66,7 +66,7 @@ class Foreign_link extends Memcached_DataObject
             return $fuser;
         }
         
-        return NULL;        
+        return null;        
     }
     
     function getUser() {
diff --git a/_darcs/pristine/classes/Foreign_service.php b/_darcs/pristine/classes/Foreign_service.php
index 18ef83d69..128411b71 100644
--- a/_darcs/pristine/classes/Foreign_service.php
+++ b/_darcs/pristine/classes/Foreign_service.php
@@ -17,7 +17,7 @@ class Foreign_service extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Foreign_subscription.php b/_darcs/pristine/classes/Foreign_subscription.php
index 315064067..d8e8569fb 100644
--- a/_darcs/pristine/classes/Foreign_subscription.php
+++ b/_darcs/pristine/classes/Foreign_subscription.php
@@ -16,7 +16,7 @@ class Foreign_subscription extends Memcached_DataObject
     public $created;                         // datetime()   not_null
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Foreign_user.php b/_darcs/pristine/classes/Foreign_user.php
index 396680128..f8a980884 100644
--- a/_darcs/pristine/classes/Foreign_user.php
+++ b/_darcs/pristine/classes/Foreign_user.php
@@ -18,7 +18,7 @@ class Foreign_user extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -36,7 +36,7 @@ class Foreign_user extends Memcached_DataObject
             return $fuser;
         }
         
-        return NULL;        
+        return null;        
     }
     
     function updateKeys(&$orig) {
diff --git a/_darcs/pristine/classes/Invitation.php b/_darcs/pristine/classes/Invitation.php
index 1477391b0..ff6456445 100644
--- a/_darcs/pristine/classes/Invitation.php
+++ b/_darcs/pristine/classes/Invitation.php
@@ -17,7 +17,7 @@ class Invitation extends Memcached_DataObject
     public $created;                         // datetime()   not_null
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Memcached_DataObject.php b/_darcs/pristine/classes/Memcached_DataObject.php
index 7699e1b38..1d12730c9 100644
--- a/_darcs/pristine/classes/Memcached_DataObject.php
+++ b/_darcs/pristine/classes/Memcached_DataObject.php
@@ -23,7 +23,7 @@ require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
 
 class Memcached_DataObject extends DB_DataObject 
 {
-    function &staticGet($cls, $k, $v=NULL) {
+    function &staticGet($cls, $k, $v=null) {
         if (is_null($v)) {
             $v = $k;
             # XXX: HACK!
@@ -56,7 +56,7 @@ class Memcached_DataObject extends DB_DataObject
             if ($i->find(true)) {
                 $i->encache();
             } else {
-                $i = NULL;
+                $i = null;
             }
             return $i;
         }
@@ -67,7 +67,7 @@ class Memcached_DataObject extends DB_DataObject
         return $result;
     }
     
-    function update($orig=NULL) {
+    function update($orig=null) {
         if (is_object($orig) && $orig instanceof Memcached_DataObject) {
             $orig->decache(); # might be different keys
         }
diff --git a/_darcs/pristine/classes/Message.php b/_darcs/pristine/classes/Message.php
index dc527fcb1..e04fbb3c0 100644
--- a/_darcs/pristine/classes/Message.php
+++ b/_darcs/pristine/classes/Message.php
@@ -22,7 +22,7 @@ class Message extends Memcached_DataObject
     public $source;                          // varchar(32)  
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Message',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Message',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Nonce.php b/_darcs/pristine/classes/Nonce.php
index 89d673c53..54d20de9c 100644
--- a/_darcs/pristine/classes/Nonce.php
+++ b/_darcs/pristine/classes/Nonce.php
@@ -18,7 +18,7 @@ class Nonce extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Notice.php b/_darcs/pristine/classes/Notice.php
index 35e03e342..e6152812c 100644
--- a/_darcs/pristine/classes/Notice.php
+++ b/_darcs/pristine/classes/Notice.php
@@ -48,7 +48,7 @@ class Notice extends Memcached_DataObject
     public $source;                             // varchar(32)
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -91,7 +91,7 @@ class Notice extends Memcached_DataObject
         return true;
     }
 
-    static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL, $uri=NULL) {
+    static function saveNew($profile_id, $content, $source=null, $is_local=1, $reply_to=null, $uri=null) {
 
         $profile = Profile::staticGet($profile_id);
 
@@ -293,7 +293,7 @@ class Notice extends Memcached_DataObject
     # XXX: too many args; we need to move to named params or even a separate
     # class for notice streams
 
-    static function getStream($qry, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $order=NULL, $since=NULL) {
+    static function getStream($qry, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $order=null, $since=null) {
 
         if (common_config('memcached', 'enabled')) {
 
@@ -383,7 +383,7 @@ class Notice extends Memcached_DataObject
         # If outside our cache window, just go to the DB
 
         if ($offset + $limit > NOTICE_CACHE_WINDOW) {
-            return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
+            return Notice::getStreamDirect($qry, $offset, $limit, null, null, $order, null);
         }
 
         # Get the cache; if we can't, just go to the DB
@@ -391,7 +391,7 @@ class Notice extends Memcached_DataObject
         $cache = common_memcache();
 
         if (!$cache) {
-            return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
+            return Notice::getStreamDirect($qry, $offset, $limit, null, null, $order, null);
         }
 
         # Get the notices out of the cache
@@ -423,7 +423,7 @@ class Notice extends Memcached_DataObject
             # bet with our DB.
 
             $new_notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW,
-                                                  $last_id, NULL, $order, NULL);
+                                                  $last_id, null, $order, null);
 
             if ($new_notice) {
                 $new_notices = array();
@@ -447,7 +447,7 @@ class Notice extends Memcached_DataObject
 
         # Otherwise, get the full cache window out of the DB
 
-        $notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW, NULL, NULL, $order, NULL);
+        $notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW, null, null, $order, null);
 
         # If there are no hits, just return the value
 
@@ -477,7 +477,7 @@ class Notice extends Memcached_DataObject
         return $wrapper;
     }
 
-    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=NULL) {
+    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null) {
 
         $parts = array();
 
@@ -496,7 +496,7 @@ class Notice extends Memcached_DataObject
 
         return Notice::getStream($qry,
                                  'public',
-                                 $offset, $limit, $since_id, $before_id, NULL, $since);
+                                 $offset, $limit, $since_id, $before_id, null, $since);
     }
 
     function addToInboxes() {
diff --git a/_darcs/pristine/classes/NoticeWrapper.php b/_darcs/pristine/classes/NoticeWrapper.php
index edecb3092..19ae37c1b 100644
--- a/_darcs/pristine/classes/NoticeWrapper.php
+++ b/_darcs/pristine/classes/NoticeWrapper.php
@@ -35,7 +35,7 @@ class NoticeWrapper extends Notice {
     public $is_local;                        // tinyint(1)  
     public $source;                          // varchar(32)  
 
-    var $notices = NULL;
+    var $notices = null;
     var $i = -1;
     
     function __construct($arr) {
diff --git a/_darcs/pristine/classes/Notice_inbox.php b/_darcs/pristine/classes/Notice_inbox.php
index cc482bd19..922ba2660 100644
--- a/_darcs/pristine/classes/Notice_inbox.php
+++ b/_darcs/pristine/classes/Notice_inbox.php
@@ -33,7 +33,7 @@ class Notice_inbox extends Memcached_DataObject
     public $source;                          // tinyint(1)   default_1
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Notice_source.php b/_darcs/pristine/classes/Notice_source.php
index e0a41b927..a12397b0b 100644
--- a/_darcs/pristine/classes/Notice_source.php
+++ b/_darcs/pristine/classes/Notice_source.php
@@ -17,7 +17,7 @@ class Notice_source extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Notice_tag.php b/_darcs/pristine/classes/Notice_tag.php
index 84c4a1020..8c3911f76 100644
--- a/_darcs/pristine/classes/Notice_tag.php
+++ b/_darcs/pristine/classes/Notice_tag.php
@@ -30,7 +30,7 @@ class Notice_tag extends Memcached_DataObject
     public $created;                         // datetime()   not_null
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Profile.php b/_darcs/pristine/classes/Profile.php
index 1f4508bf1..b95cbf993 100644
--- a/_darcs/pristine/classes/Profile.php
+++ b/_darcs/pristine/classes/Profile.php
@@ -41,12 +41,12 @@ class Profile extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function getAvatar($width, $height=NULL) {
+    function getAvatar($width, $height=null) {
         if (is_null($height)) {
             $height = $width;
         }
@@ -62,7 +62,7 @@ class Profile extends Memcached_DataObject
         if ($avatar->find(true)) {
             return $avatar;
         } else {
-            return NULL;
+            return null;
         }
     }
 
@@ -71,12 +71,12 @@ class Profile extends Memcached_DataObject
         $info = @getimagesize($source);
 
         if (!$info) {
-            return NULL;
+            return null;
         }
 
         $filename = common_avatar_filename($this->id,
                                            image_type_to_extension($info[2]),
-                                           NULL, common_timestamp());
+                                           null, common_timestamp());
         $filepath = common_avatar_path($filename);
 
         copy($source, $filepath);
@@ -96,12 +96,12 @@ class Profile extends Memcached_DataObject
 
         if (!$this->delete_avatars()) {
             @unlink($filepath);
-            return NULL;
+            return null;
         }
 
         if (!$avatar->insert()) {
             @unlink($filepath);
-            return NULL;
+            return null;
         }
 
         foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
@@ -109,7 +109,7 @@ class Profile extends Memcached_DataObject
             if (!($avatar->width == $size && $avatar->height == $size)) {
                 $s = $avatar->scale($size);
                 if (!$s) {
-                    return NULL;
+                    return null;
                 }
             }
         }
@@ -132,7 +132,7 @@ class Profile extends Memcached_DataObject
     }
 
     # Get latest notice on or before date; default now
-    function getCurrentNotice($dt=NULL) {
+    function getCurrentNotice($dt=null) {
         $notice = new Notice();
         $notice->profile_id = $this->id;
         if ($dt) {
@@ -143,7 +143,7 @@ class Profile extends Memcached_DataObject
         if ($notice->find(true)) {
             return $notice;
         }
-        return NULL;
+        return null;
     }
 
     function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) {
diff --git a/_darcs/pristine/classes/Profile_block.php b/_darcs/pristine/classes/Profile_block.php
index 6ea26a3bc..41d6701eb 100644
--- a/_darcs/pristine/classes/Profile_block.php
+++ b/_darcs/pristine/classes/Profile_block.php
@@ -36,7 +36,7 @@ class Profile_block extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Profile_tag.php b/_darcs/pristine/classes/Profile_tag.php
index 2daabf867..5c508c84f 100644
--- a/_darcs/pristine/classes/Profile_tag.php
+++ b/_darcs/pristine/classes/Profile_tag.php
@@ -16,7 +16,7 @@ class Profile_tag extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Queue_item.php b/_darcs/pristine/classes/Queue_item.php
index e54b4976b..f2fc0be03 100644
--- a/_darcs/pristine/classes/Queue_item.php
+++ b/_darcs/pristine/classes/Queue_item.php
@@ -16,7 +16,7 @@ class Queue_item extends Memcached_DataObject
     public $claimed;                         // datetime()  
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -28,7 +28,7 @@ class Queue_item extends Memcached_DataObject
         $qi = new Queue_item();
         $qi->transport = $transport;
         $qi->orderBy('created');
-        $qi->whereAdd('claimed is NULL');
+        $qi->whereAdd('claimed is null');
 
         $qi->limit(1);
 
@@ -36,7 +36,7 @@ class Queue_item extends Memcached_DataObject
 
         if ($cnt) {
             # XXX: potential race condition
-            # can we force it to only update if claimed is still NULL
+            # can we force it to only update if claimed is still null
             # (or old)?
             common_log(LOG_INFO, 'claiming queue item = ' . $qi->notice_id . ' for transport ' . $transport);
             $orig = clone($qi);
@@ -49,7 +49,7 @@ class Queue_item extends Memcached_DataObject
                 common_log(LOG_INFO, 'claim failed.');
             }
         }
-        $qi = NULL;
-        return NULL;
+        $qi = null;
+        return null;
     }
 }
diff --git a/_darcs/pristine/classes/Remember_me.php b/_darcs/pristine/classes/Remember_me.php
index 5bbd6cf17..9d3f9378f 100644
--- a/_darcs/pristine/classes/Remember_me.php
+++ b/_darcs/pristine/classes/Remember_me.php
@@ -15,7 +15,7 @@ class Remember_me extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Remote_profile.php b/_darcs/pristine/classes/Remote_profile.php
index c961dcca2..66b0f3a5c 100644
--- a/_darcs/pristine/classes/Remote_profile.php
+++ b/_darcs/pristine/classes/Remote_profile.php
@@ -38,7 +38,7 @@ class Remote_profile extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Reply.php b/_darcs/pristine/classes/Reply.php
index d71ce3afb..10d6ced5b 100644
--- a/_darcs/pristine/classes/Reply.php
+++ b/_darcs/pristine/classes/Reply.php
@@ -16,7 +16,7 @@ class Reply extends Memcached_DataObject
     public $replied_id;                      // int(4)  
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Reply',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Reply',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Sms_carrier.php b/_darcs/pristine/classes/Sms_carrier.php
index f6e0791f9..b4a9d8655 100644
--- a/_darcs/pristine/classes/Sms_carrier.php
+++ b/_darcs/pristine/classes/Sms_carrier.php
@@ -17,7 +17,7 @@ class Sms_carrier extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Subscription.php b/_darcs/pristine/classes/Subscription.php
index a3b5e4b90..d70f99550 100644
--- a/_darcs/pristine/classes/Subscription.php
+++ b/_darcs/pristine/classes/Subscription.php
@@ -40,7 +40,7 @@ class Subscription extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Token.php b/_darcs/pristine/classes/Token.php
index d180ecebe..3c88444c8 100644
--- a/_darcs/pristine/classes/Token.php
+++ b/_darcs/pristine/classes/Token.php
@@ -19,7 +19,7 @@ class Token extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Token',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Token',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/User.php b/_darcs/pristine/classes/User.php
index c2c6ad57f..29e6a86e9 100644
--- a/_darcs/pristine/classes/User.php
+++ b/_darcs/pristine/classes/User.php
@@ -62,7 +62,7 @@ class User extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -118,10 +118,10 @@ class User extends Memcached_DataObject
         return !in_array($nickname, $merged);
     }
 
-    function getCurrentNotice($dt=NULL) {
+    function getCurrentNotice($dt=null) {
         $profile = $this->getProfile();
         if (!$profile) {
-            return NULL;
+            return null;
         }
         return $profile->getCurrentNotice($dt);
     }
@@ -336,20 +336,20 @@ class User extends Memcached_DataObject
         return $user;
     }
 
-    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
+    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
         $qry =
           'SELECT notice.* ' .
           'FROM notice JOIN reply ON notice.id = reply.notice_id ' .
           'WHERE reply.profile_id = %d ';
         return Notice::getStream(sprintf($qry, $this->id),
                                  'user:replies:'.$this->id,
-                                 $offset, $limit, $since_id, $before_id, NULL, $since);
+                                 $offset, $limit, $since_id, $before_id, null, $since);
     }
 
-        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
+        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
         $profile = $this->getProfile();
         if (!$profile) {
-            return NULL;
+            return null;
         } else {
             return $profile->getNotices($offset, $limit, $since_id, $before_id);
         }
@@ -365,7 +365,7 @@ class User extends Memcached_DataObject
                                  $offset, $limit);
     }
 
-        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
+        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
         $enabled = common_config('inboxes', 'enabled');
 
         # Complicated code, depending on whether we support inboxes yet
@@ -377,7 +377,7 @@ class User extends Memcached_DataObject
               'SELECT notice.* ' .
               'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' .
               'WHERE subscription.subscriber = %d ';
-            $order = NULL;
+            $order = null;
         } else if ($enabled === true ||
                ($enabled == 'transitional' && $this->inboxed == 1)) {
 
diff --git a/_darcs/pristine/classes/User_openid.php b/_darcs/pristine/classes/User_openid.php
index ad68f7402..7dc476dc4 100644
--- a/_darcs/pristine/classes/User_openid.php
+++ b/_darcs/pristine/classes/User_openid.php
@@ -17,7 +17,7 @@ class User_openid extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/lib/common.php b/_darcs/pristine/lib/common.php
index 95ba64d0f..3e162f781 100644
--- a/_darcs/pristine/lib/common.php
+++ b/_darcs/pristine/lib/common.php
@@ -58,16 +58,16 @@ $config =
               'server' => 'localhost',
               'theme' => 'default',
               'path' => '/',
-              'logfile' => NULL,
+              'logfile' => null,
               'fancy' => false,
               'locale_path' => INSTALLDIR.'/locale',
               'language' => 'en_US',
               'languages' => get_all_languages(),
               'email' =>
-              array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : NULL,
-              'broughtby' => NULL,
+              array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : null,
+              'broughtby' => null,
               'timezone' => 'UTC',
-              'broughtbyurl' => NULL,
+              'broughtbyurl' => null,
               'closed' => false,
               'inviteonly' => false,
               'private' => false),
@@ -82,19 +82,19 @@ $config =
               'image' => 'http://i.creativecommons.org/l/by/3.0/88x31.png'),
         'mail' =>
         array('backend' => 'mail',
-              'params' => NULL),
+              'params' => null),
         'nickname' =>
         array('blacklist' => array(),
               'featured' => array()),
         'profile' =>
         array('banned' => array()),
         'avatar' =>
-        array('server' => NULL),
+        array('server' => null),
         'public' =>
         array('localonly' => true,
               'blacklist' => array()),
         'theme' =>
-        array('server' => NULL),
+        array('server' => null),
         'throttle' =>
         array('enabled' => false, // whether to throttle edits; false by default
               'count' => 20, // number of allowed messages in timespan
@@ -107,7 +107,7 @@ $config =
               'encryption' => true,
               'resource' => 'uniquename',
               'password' => 'blahblahblah',
-              'host' => NULL, # only set if != server
+              'host' => null, # only set if != server
               'debug' => false, # print extra debug info
               'public' => array()), # JIDs of users who want to receive the public stream
         'sphinx' =>
@@ -140,7 +140,7 @@ $config['db'] =
         'class_location' => INSTALLDIR . '/classes',
         'require_prefix' => 'classes/',
         'class_prefix' => '',
-        'mirror' => NULL,
+        'mirror' => null,
         'db_driver' => 'DB', # XXX: JanRain libs only work with DB
         'quote_identifiers' => false,
         'type' => 'mysql' );
diff --git a/_darcs/pristine/lib/deleteaction.php b/_darcs/pristine/lib/deleteaction.php
index 335070cc4..a7de6b8fb 100644
--- a/_darcs/pristine/lib/deleteaction.php
+++ b/_darcs/pristine/lib/deleteaction.php
@@ -43,7 +43,7 @@ class DeleteAction extends Action {
         }
     }
 
-    function show_top($arr=NULL) {
+    function show_top($arr=null) {
         $instr = $this->get_instructions();
         $output = common_markup_to_html($instr);
         common_element_start('div', 'instructions');
@@ -52,7 +52,7 @@ class DeleteAction extends Action {
     }
 
     function get_title() {
-        return NULL;
+        return null;
     }
 
     function show_header() {
diff --git a/_darcs/pristine/lib/facebookaction.php b/_darcs/pristine/lib/facebookaction.php
index 67595861f..731460f12 100644
--- a/_darcs/pristine/lib/facebookaction.php
+++ b/_darcs/pristine/lib/facebookaction.php
@@ -81,7 +81,7 @@ class FacebookAction extends Action {
 
         $fbml_main = "<fb:narrow>$content $html</fb:narrow>";
 
-        $facebook->api_client->profile_setFBML(NULL, $fbuid, $fbml, NULL, NULL, $fbml_main);
+        $facebook->api_client->profile_setFBML(null, $fbuid, $fbml, null, null, $fbml_main);
     }
 
     # Display methods
@@ -235,7 +235,7 @@ class FacebookAction extends Action {
         return $html;
     }
 
-    function pagination($have_before, $have_after, $page, $fbaction, $args=NULL) {
+    function pagination($have_before, $have_after, $page, $fbaction, $args=null) {
 
         $html = '';
 
@@ -266,7 +266,7 @@ class FacebookAction extends Action {
         }
     }
 
-    function pagination_url($fbaction, $args=NULL) {
+    function pagination_url($fbaction, $args=null) {
         global $config;
 
         $extra = '';
diff --git a/_darcs/pristine/lib/oauthstore.php b/_darcs/pristine/lib/oauthstore.php
index aa705be30..421b618b7 100644
--- a/_darcs/pristine/lib/oauthstore.php
+++ b/_darcs/pristine/lib/oauthstore.php
@@ -33,7 +33,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
             $con->seed = common_good_rand(16);
             $con->created = DB_DataObject_Cast::dateTime();
             if (!$con->insert()) {
-                return NULL;
+                return null;
             }
         }
         return new OAuthConsumer($con->consumer_key, '');
@@ -47,7 +47,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         if ($t->find(true)) {
             return new OAuthToken($t->tok, $t->secret);
         } else {
-            return NULL;
+            return null;
         }
     }
 
@@ -75,7 +75,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         $t->state = 0; # unauthorized
         $t->created = DB_DataObject_Cast::dateTime();
         if (!$t->insert()) {
-            return NULL;
+            return null;
         } else {
             return new OAuthToken($t->tok, $t->secret);
         }
@@ -104,35 +104,35 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
             if (!$at->insert()) {
                 $e = $at->_lastError;
                 common_debug('access token "'.$at->tok.'" not inserted: "'.$e->message.'"', __FILE__);
-                return NULL;
+                return null;
             } else {
                 common_debug('access token "'.$at->tok.'" inserted', __FILE__);
                 # burn the old one
                 $orig_rt = clone($rt);
                 $rt->state = 2; # used
                 if (!$rt->update($orig_rt)) {
-                    return NULL;
+                    return null;
                 }
                 common_debug('request token "'.$rt->tok.'" updated', __FILE__);
                 # Update subscription
                 # XXX: mixing levels here
                 $sub = Subscription::staticGet('token', $rt->tok);
                 if (!$sub) {
-                    return NULL;
+                    return null;
                 }
                 common_debug('subscription for request token found', __FILE__);
                 $orig_sub = clone($sub);
                 $sub->token = $at->tok;
                 $sub->secret = $at->secret;
                 if (!$sub->update($orig_sub)) {
-                    return NULL;
+                    return null;
                 } else {
                     common_debug('subscription updated to use access token', __FILE__);
                     return new OAuthToken($at->tok, $at->secret);
                 }
             }
         } else {
-            return NULL;
+            return null;
         }
     }
 
diff --git a/_darcs/pristine/lib/omb.php b/_darcs/pristine/lib/omb.php
index 94ccc2ecd..8199b0679 100644
--- a/_darcs/pristine/lib/omb.php
+++ b/_darcs/pristine/lib/omb.php
@@ -44,7 +44,7 @@ define('OAUTH_POST_BODY', OAUTH_NAMESPACE.'parameters/post-body');
 define('OAUTH_HMAC_SHA1', OAUTH_NAMESPACE.'signature/HMAC-SHA1');
 
 function omb_oauth_consumer() {
-    static $con = NULL;
+    static $con = null;
     if (!$con) {
         $con = new OAuthConsumer(common_root_url(), '');
     }
@@ -61,7 +61,7 @@ function omb_oauth_server() {
 }
 
 function omb_oauth_datastore() {
-    static $store = NULL;
+    static $store = null;
     if (!$store) {
         $store = new LaconicaOAuthDataStore();
     }
@@ -69,7 +69,7 @@ function omb_oauth_datastore() {
 }
 
 function omb_hmac_sha1() {
-    static $hmac_method = NULL;
+    static $hmac_method = null;
     if (!$hmac_method) {
         $hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
     }
@@ -91,22 +91,22 @@ function omb_match_service($service, $type) {
 
 function omb_service_uri($service) {
     if (!$service) {
-        return NULL;
+        return null;
     }
     $uris = $service->getURIs();
     if (!$uris) {
-        return NULL;
+        return null;
     }
     return $uris[0];
 }
 
 function omb_local_id($service) {
     if (!$service) {
-        return NULL;
+        return null;
     }
     $els = $service->getElements('xrd:LocalID');
     if (!$els) {
-        return NULL;
+        return null;
     }
     $el = $els[0];
     return $service->parser->content($el);
diff --git a/_darcs/pristine/lib/openid.php b/_darcs/pristine/lib/openid.php
index ebc5ed168..3ca359fa1 100644
--- a/_darcs/pristine/lib/openid.php
+++ b/_darcs/pristine/lib/openid.php
@@ -32,7 +32,7 @@ define('OPENID_COOKIE_EXPIRY', round(365.25 * 24 * 60 * 60));
 define('OPENID_COOKIE_KEY', 'lastusedopenid');
 
 function oid_store() {
-    static $store = NULL;
+    static $store = null;
     if (!$store) {
         # Can't be called statically
         $user = new User();
@@ -63,7 +63,7 @@ function oid_get_last() {
     if ($openid_url && strlen($openid_url) > 0) {
         return $openid_url;
     } else {
-        return NULL;
+        return null;
     }
 }
 
@@ -85,7 +85,7 @@ function oid_link_user($id, $canonical, $display) {
 }
 
 function oid_get_user($openid_url) {
-    $user = NULL;
+    $user = null;
     $oid = User_openid::staticGet('canonical', $openid_url);
     if ($oid) {
         $user = User::staticGet('id', $oid->user_id);
@@ -93,7 +93,7 @@ function oid_get_user($openid_url) {
     return $user;
 }
 
-function oid_check_immediate($openid_url, $backto=NULL) {
+function oid_check_immediate($openid_url, $backto=null) {
     if (!$backto) {
         $action = $_REQUEST['action'];
         $args = common_copy_args($_GET);
@@ -177,9 +177,9 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) {
         if (Auth_OpenID::isFailure($form_html)) {
             $this->show_form(sprintf(_('Could not create OpenID form: %s'), $form_html->message));
         } else {
-            common_show_header(_('OpenID Auto-Submit'), NULL, NULL, '_oid_print_instructions');
+            common_show_header(_('OpenID Auto-Submit'), null, null, '_oid_print_instructions');
             common_raw($form_html);
-            common_element('script', NULL,
+            common_element('script', null,
                            '$(document).ready(function() { ' .
                            '    $("#'. $form_id .'").submit(); '.
                            '});');
diff --git a/_darcs/pristine/lib/personal.php b/_darcs/pristine/lib/personal.php
index 1928349a3..7ff9305f1 100644
--- a/_darcs/pristine/lib/personal.php
+++ b/_darcs/pristine/lib/personal.php
@@ -32,7 +32,7 @@ class PersonalAction extends Action {
 
     function views_menu() {
 
-        $user = NULL;
+        $user = null;
         $action = $this->trimmed('action');
         $nickname = $this->trimmed('nickname');
 
diff --git a/_darcs/pristine/lib/profilelist.php b/_darcs/pristine/lib/profilelist.php
index e32c5c254..9929c8647 100644
--- a/_darcs/pristine/lib/profilelist.php
+++ b/_darcs/pristine/lib/profilelist.php
@@ -24,11 +24,11 @@ define('PROFILES_PER_PAGE', 20);
 
 class ProfileList {
 
-    var $profile = NULL;
-    var $owner = NULL;
-    var $action = NULL;
+    var $profile = null;
+    var $owner = null;
+    var $action = null;
 
-    function __construct($profile, $owner=NULL, $action=NULL) {
+    function __construct($profile, $owner=null, $action=null) {
         $this->profile = $profile;
         $this->owner = $owner;
         $this->action = $action;
diff --git a/_darcs/pristine/lib/queuehandler.php b/_darcs/pristine/lib/queuehandler.php
index 5e3905f59..ecf58f69f 100644
--- a/_darcs/pristine/lib/queuehandler.php
+++ b/_darcs/pristine/lib/queuehandler.php
@@ -29,7 +29,7 @@ class QueueHandler extends Daemon {
 
     var $_id = 'generic';
 
-    function QueueHandler($id=NULL) {
+    function QueueHandler($id=null) {
         if ($id) {
             $this->set_id($id);
         }
@@ -52,7 +52,7 @@ class QueueHandler extends Daemon {
     }
     
     function transport() {
-        return NULL;
+        return null;
     }
     
     function start() {
@@ -83,7 +83,7 @@ class QueueHandler extends Daemon {
                     if (!$result) {
                         $this->log(LOG_WARNING, 'Failed broadcast for notice ID = ' . $notice->id);
                         $orig = $qi;
-                        $qi->claimed = NULL;
+                        $qi->claimed = null;
                         $qi->update($orig);
                         $this->log(LOG_WARNING, 'Abandoned claim for notice ID = ' . $notice->id);
                         continue;
@@ -91,7 +91,7 @@ class QueueHandler extends Daemon {
                     $this->log(LOG_INFO, 'finished broadcasting notice ID = ' . $notice->id);
                     $notice->free();
                     unset($notice);
-                    $notice = NULL;
+                    $notice = null;
                 } else {
                     $this->log(LOG_WARNING, 'queue item for notice that does not exist');
                 }
diff --git a/_darcs/pristine/lib/rssaction.php b/_darcs/pristine/lib/rssaction.php
index b64796888..a21ce3a97 100644
--- a/_darcs/pristine/lib/rssaction.php
+++ b/_darcs/pristine/lib/rssaction.php
@@ -55,7 +55,7 @@ class Rss10Action extends Action {
     }
 
     function get_image() {
-        return NULL;
+        return null;
     }
 
     function show_rss($limit=0) {
@@ -84,9 +84,9 @@ class Rss10Action extends Action {
         $image = $this->get_image();
 
         common_element_start('channel', array('rdf:about' => $channel['url']));
-        common_element('title', NULL, $channel['title']);
-        common_element('link', NULL, $channel['link']);
-        common_element('description', NULL, $channel['description']);
+        common_element('title', null, $channel['title']);
+        common_element('link', null, $channel['link']);
+        common_element('description', null, $channel['description']);
         common_element('cc:licence', array('rdf:resource' => common_config('license','url')));
 
         if ($image) {
@@ -111,9 +111,9 @@ class Rss10Action extends Action {
         if ($image) {
             $channel = $this->get_channel();
             common_element_start('image', array('rdf:about' => $image));
-            common_element('title', NULL, $channel['title']);
-            common_element('link', NULL, $channel['link']);
-            common_element('url', NULL, $image);
+            common_element('title', null, $channel['title']);
+            common_element('link', null, $channel['link']);
+            common_element('url', null, $image);
             common_element_end('image');
         }
     }
@@ -124,11 +124,11 @@ class Rss10Action extends Action {
         $creator_uri = common_profile_uri($profile);
         common_element_start('item', array('rdf:about' => $notice->uri));
         $title = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
-        common_element('title', NULL, $title);
-        common_element('link', NULL, $nurl);
-        common_element('description', NULL, $profile->nickname."'s status on ".common_exact_date($notice->created));
-        common_element('dc:date', NULL, common_date_w3dtf($notice->created));
-        common_element('dc:creator', NULL, ($profile->fullname) ? $profile->fullname : $profile->nickname);
+        common_element('title', null, $title);
+        common_element('link', null, $nurl);
+        common_element('description', null, $profile->nickname."'s status on ".common_exact_date($notice->created));
+        common_element('dc:date', null, common_date_w3dtf($notice->created));
+        common_element('dc:creator', null, ($profile->fullname) ? $profile->fullname : $profile->nickname);
         common_element('sioc:has_creator', array('rdf:resource' => $creator_uri));
         common_element('laconica:postIcon', array('rdf:resource' => common_profile_avatar_url($profile)));
         common_element('cc:licence', array('rdf:resource' => common_config('license', 'url')));
@@ -141,11 +141,11 @@ class Rss10Action extends Action {
             $id = $profile->id;
             $nickname = $profile->nickname;
             common_element_start('sioc:User', array('rdf:about' => $uri));
-            common_element('foaf:nick', NULL, $nickname);
+            common_element('foaf:nick', null, $nickname);
             if ($profile->fullname) {
-                common_element('foaf:name', NULL, $profile->fullname);
+                common_element('foaf:name', null, $profile->fullname);
             }
-            common_element('sioc:id', NULL, $id);
+            common_element('sioc:id', null, $id);
             $avatar = common_profile_avatar_url($profile);
             common_element('sioc:avatar', array('rdf:resource' => $avatar));
             common_element_end('sioc:User');
@@ -175,7 +175,7 @@ class Rss10Action extends Action {
                                               'http://laconi.ca/ont/',
                                               'xmlns' => 'http://purl.org/rss/1.0/'));
         common_element_start('sioc:Site', array('rdf:about' => common_root_url()));
-        common_element('sioc:name', NULL, common_config('site', 'name'));
+        common_element('sioc:name', null, common_config('site', 'name'));
         common_element_start('sioc:container_of');
         common_element('sioc:Container', array('rdf:about' =>
                                                $channel['url']));
diff --git a/_darcs/pristine/lib/searchaction.php b/_darcs/pristine/lib/searchaction.php
index 8634bd99c..3eec91832 100644
--- a/_darcs/pristine/lib/searchaction.php
+++ b/_darcs/pristine/lib/searchaction.php
@@ -30,7 +30,7 @@ class SearchAction extends Action {
         $this->show_form();
     }
 
-    function show_top($arr=NULL) {
+    function show_top($arr=null) {
         if ($arr) {
             $error = $arr[1];
         }
@@ -47,14 +47,14 @@ class SearchAction extends Action {
     }
 
     function get_title() {
-        return NULL;
+        return null;
     }
 
     function show_header($arr) {
         return;
     }
 
-    function show_form($error=NULL) {
+    function show_form($error=null) {
         global $config;
 
         $q = $this->trimmed('q');
@@ -99,11 +99,11 @@ class SearchAction extends Action {
                 array(
                       _('People'),
                       _('Find people on this site'),
-                      ($action != 'peoplesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL),
+                      ($action != 'peoplesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : null),
                 'noticesearch' =>
                 array( _('Text'),
                        _('Find content of notices'),
-                       ($action != 'noticesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL)
+                       ($action != 'noticesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : null)
                 );
         $this->nav_menu($menu);
     }
diff --git a/_darcs/pristine/lib/settingsaction.php b/_darcs/pristine/lib/settingsaction.php
index 3021eb192..208d2a1b6 100644
--- a/_darcs/pristine/lib/settingsaction.php
+++ b/_darcs/pristine/lib/settingsaction.php
@@ -44,7 +44,7 @@ class SettingsAction extends Action {
         return false;
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         return false;
     }
 
@@ -55,9 +55,9 @@ class SettingsAction extends Action {
         }
     }
 
-    function form_header($title, $msg=NULL, $success=false) {
+    function form_header($title, $msg=null, $success=false) {
         common_show_header($title,
-                           NULL,
+                           null,
                            array($msg, $success),
                            array($this, 'show_top'));
     }
diff --git a/_darcs/pristine/lib/twitter.php b/_darcs/pristine/lib/twitter.php
index c1d2de0ea..1212875ea 100644
--- a/_darcs/pristine/lib/twitter.php
+++ b/_darcs/pristine/lib/twitter.php
@@ -148,13 +148,13 @@ function retreive_twitter_friends($twitter_id, $screen_name, $password) {
         $data = get_twitter_data($uri . $i, $screen_name, $password);
 
         if (!$data) {
-            return NULL;
+            return null;
         }
 
         $more_friends = json_decode($data);
 
         if (!$more_friends) {
-            return NULL;
+            return null;
         }
 
          $friends = array_merge($friends, $more_friends);
diff --git a/_darcs/pristine/lib/twitterapi.php b/_darcs/pristine/lib/twitterapi.php
index 3122caf12..ed86c77c4 100644
--- a/_darcs/pristine/lib/twitterapi.php
+++ b/_darcs/pristine/lib/twitterapi.php
@@ -34,15 +34,15 @@ class TwitterapiAction extends Action {
         $twitter_user['name'] = $profile->getBestName();
         $twitter_user['followers_count'] = $this->count_subscriptions($profile);
         $twitter_user['screen_name'] = $profile->nickname;
-        $twitter_user['description'] = ($profile->bio) ? $profile->bio : NULL;
-        $twitter_user['location'] = ($profile->location) ? $profile->location : NULL;
+        $twitter_user['description'] = ($profile->bio) ? $profile->bio : null;
+        $twitter_user['location'] = ($profile->location) ? $profile->location : null;
         $twitter_user['id'] = intval($profile->id);
 
         $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
 
         $twitter_user['profile_image_url'] = ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE);
         $twitter_user['protected'] = 'false'; # not supported by Laconica yet
-        $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : NULL;
+        $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : null;
 
         if ($get_notice) {
             $notice = $profile->getCurrentNotice();
@@ -63,10 +63,10 @@ class TwitterapiAction extends Action {
         $twitter_status['text'] = $notice->content;
         $twitter_status['truncated'] = 'false'; # Not possible on Laconica
         $twitter_status['created_at'] = $this->date_twitter($notice->created);
-        $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : NULL;
+        $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : null;
         $twitter_status['source'] = $this->source_link($notice->source);
         $twitter_status['id'] = intval($notice->id);
-        $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : NULL;
+        $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : null;
 
         if (isset($this->auth_user)) {
             $twitter_status['favorited'] = ($this->auth_user->hasFave($notice)) ? 'true' : 'false';
@@ -157,10 +157,10 @@ class TwitterapiAction extends Action {
                 $this->show_twitter_xml_user($twitter_status['user']);
                 break;
             case 'text':
-                common_element($element, NULL, common_xml_safe_str($value));
+                common_element($element, null, common_xml_safe_str($value));
                 break;
             default:
-                common_element($element, NULL, $value);
+                common_element($element, null, $value);
             }
         }
         common_element_end('status');
@@ -172,7 +172,7 @@ class TwitterapiAction extends Action {
             if ($element == 'status') {
                 $this->show_twitter_xml_status($twitter_user['status']);
             } else {
-                common_element($element, NULL, $value);
+                common_element($element, null, $value);
             }
         }
         common_element_end($role);
@@ -180,22 +180,22 @@ class TwitterapiAction extends Action {
 
     function show_twitter_rss_item($entry) {
         common_element_start('item');
-        common_element('title', NULL, $entry['title']);
-        common_element('description', NULL, $entry['description']);
-        common_element('pubDate', NULL, $entry['pubDate']);
-        common_element('guid', NULL, $entry['guid']);
-        common_element('link', NULL, $entry['link']);
+        common_element('title', null, $entry['title']);
+        common_element('description', null, $entry['description']);
+        common_element('pubDate', null, $entry['pubDate']);
+        common_element('guid', null, $entry['guid']);
+        common_element('link', null, $entry['link']);
         common_element_end('item');
     }
 
     function show_twitter_atom_entry($entry) {
         common_element_start('entry');
-        common_element('title', NULL, $entry['title']);
+        common_element('title', null, $entry['title']);
         common_element('content', array('type' => 'html'), $entry['content']);
-        common_element('id', NULL, $entry['id']);
-        common_element('published', NULL, $entry['published']);
-        common_element('updated', NULL, $entry['updated']);
-        common_element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), NULL);
+        common_element('id', null, $entry['id']);
+        common_element('published', null, $entry['published']);
+        common_element('updated', null, $entry['updated']);
+        common_element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), null);
         common_element_end('entry');
     }
 
@@ -240,10 +240,10 @@ class TwitterapiAction extends Action {
                 $this->show_twitter_xml_user($value, $element);
                 break;
             case 'text':
-                common_element($element, NULL, common_xml_safe_str($value));
+                common_element($element, null, common_xml_safe_str($value));
                 break;
             default:
-                common_element($element, NULL, $value);
+                common_element($element, null, $value);
             }
         }
         common_element_end('direct_message');
@@ -270,13 +270,13 @@ class TwitterapiAction extends Action {
         $this->end_document('xml');
     }
 
-    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=NULL) {
+    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null) {
 
         $this->init_document('rss');
 
         common_element_start('channel');
-        common_element('title', NULL, $title);
-        common_element('link', NULL, $link);
+        common_element('title', null, $title);
+        common_element('link', null, $link);
         if (!is_null($suplink)) {
             # For FriendFeed's SUP protocol
             common_element('link', array('xmlns' => 'http://www.w3.org/2005/Atom',
@@ -284,9 +284,9 @@ class TwitterapiAction extends Action {
                                          'href' => $suplink,
                                          'type' => 'application/json'));
         }
-        common_element('description', NULL, $subtitle);
-        common_element('language', NULL, 'en-us');
-        common_element('ttl', NULL, '40');
+        common_element('description', null, $subtitle);
+        common_element('language', null, 'en-us');
+        common_element('ttl', null, '40');
 
         if (is_array($notice)) {
             foreach ($notice as $n) {
@@ -304,20 +304,20 @@ class TwitterapiAction extends Action {
         $this->end_twitter_rss();
     }
 
-    function show_atom_timeline($notice, $title, $id, $link, $subtitle=NULL, $suplink=NULL) {
+    function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null) {
 
         $this->init_document('atom');
 
-        common_element('title', NULL, $title);
-        common_element('id', NULL, $id);
-        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
+        common_element('title', null, $title);
+        common_element('id', null, $id);
+        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
         if (!is_null($suplink)) {
             # For FriendFeed's SUP protocol
             common_element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup',
                                          'href' => $suplink,
                                          'type' => 'application/json'));
         }
-        common_element('subtitle', NULL, $subtitle);
+        common_element('subtitle', null, $subtitle);
 
         if (is_array($notice)) {
             foreach ($notice as $n) {
@@ -377,7 +377,7 @@ class TwitterapiAction extends Action {
         } else {
             common_debug("Can't get notice: $reply_id", __FILE__);
         }
-        return NULL;
+        return null;
     }
 
     // XXX: Candidate for a general utility method somewhere?
@@ -488,8 +488,8 @@ class TwitterapiAction extends Action {
         if ($content_type == 'xml') {
             $this->init_document('xml');
             common_element_start('hash');
-            common_element('error', NULL, $msg);
-            common_element('request', NULL, $_SERVER['REQUEST_URI']);
+            common_element('error', null, $msg);
+            common_element('request', null, $_SERVER['REQUEST_URI']);
             common_element_end('hash');
             $this->end_document('xml');
         } else {
@@ -521,7 +521,7 @@ class TwitterapiAction extends Action {
         common_element_end('feed');
     }
 
-    function show_profile($profile, $content_type='xml', $notice=NULL) {
+    function show_profile($profile, $content_type='xml', $notice=null) {
         $profile_array = $this->twitter_user_array($profile, true);
         switch ($content_type) {
          case 'xml':
@@ -537,7 +537,7 @@ class TwitterapiAction extends Action {
         return;
     }
 
-    function get_user($id, $apidata=NULL) {
+    function get_user($id, $apidata=null) {
         if (!$id) {
             return $apidata['user'];
         } else if (is_numeric($id)) {
@@ -556,7 +556,7 @@ class TwitterapiAction extends Action {
             if ($user) {
                 return $user->getProfile();
             } else {
-                return NULL;
+                return null;
             }
         }
     }
diff --git a/_darcs/pristine/lib/xmppqueuehandler.php b/_darcs/pristine/lib/xmppqueuehandler.php
index 33b987291..10c754a5b 100644
--- a/_darcs/pristine/lib/xmppqueuehandler.php
+++ b/_darcs/pristine/lib/xmppqueuehandler.php
@@ -38,14 +38,14 @@ class XmppQueueHandler extends QueueHandler {
             $this->conn->addEventHandler('message', 'forward_message', $this);
             $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
             $this->conn->setReconnectTimeout(600);
-            jabber_send_presence("Send me a message to post a notice", 'available', NULL, 'available', -1);
+            jabber_send_presence("Send me a message to post a notice", 'available', null, 'available', -1);
         }
         return !is_null($this->conn);
     }
     
     function handle_reconnect(&$pl) {
         $this->conn->processUntil('session_start');
-        $this->conn->presence(NULL, 'available', NULL, 'available', -1);
+        $this->conn->presence(null, 'available', null, 'available', -1);
     }
 
     function idle($timeout=0) {
@@ -71,7 +71,7 @@ class XmppQueueHandler extends QueueHandler {
             return;
         }
         $this->log(LOG_INFO, 'Forwarding message from ' . $pl['from'] . ' to ' . $listener);
-        $this->conn->message($this->listener(), $pl['body'], 'chat', NULL, $this->ofrom($pl['from']));
+        $this->conn->message($this->listener(), $pl['body'], 'chat', null, $this->ofrom($pl['from']));
     }
 
     function ofrom($from) {
diff --git a/_darcs/pristine/scripts/enjitqueuehandler.php b/_darcs/pristine/scripts/enjitqueuehandler.php
index cfb253753..1c033603f 100644
--- a/_darcs/pristine/scripts/enjitqueuehandler.php
+++ b/_darcs/pristine/scripts/enjitqueuehandler.php
@@ -117,7 +117,7 @@ class EnjitQueueHandler extends QueueHandler {
 
 mb_internal_encoding('UTF-8');
 
-$id = ($argc > 1) ? $argv[1] : NULL;
+$id = ($argc > 1) ? $argv[1] : null;
 
 $handler = new EnjitQueueHandler($id);
 
diff --git a/_darcs/pristine/scripts/fixup_inboxes.php b/_darcs/pristine/scripts/fixup_inboxes.php
index e631a80ed..a5c8a0a5a 100644
--- a/_darcs/pristine/scripts/fixup_inboxes.php
+++ b/_darcs/pristine/scripts/fixup_inboxes.php
@@ -34,7 +34,7 @@ define('LACONICA', true);
 
 require_once(INSTALLDIR . '/lib/common.php');
 
-$start_at = ($argc > 1) ? $argv[1] : NULL;
+$start_at = ($argc > 1) ? $argv[1] : null;
 
 common_log(LOG_INFO, 'Updating user inboxes.');
 
diff --git a/_darcs/pristine/scripts/fixup_notices_rendered.php b/_darcs/pristine/scripts/fixup_notices_rendered.php
index 1fa9f394e..c27185546 100644
--- a/_darcs/pristine/scripts/fixup_notices_rendered.php
+++ b/_darcs/pristine/scripts/fixup_notices_rendered.php
@@ -31,7 +31,7 @@ require_once(INSTALLDIR . '/lib/common.php');
 
 common_log(LOG_INFO, 'Starting to render old notices.');
 
-$start_at = ($argc > 1) ? $argv[1] : NULL;
+$start_at = ($argc > 1) ? $argv[1] : null;
 
 $notice = new Notice();
 if ($start_at) {
diff --git a/_darcs/pristine/scripts/jabberqueuehandler.php b/_darcs/pristine/scripts/jabberqueuehandler.php
index 8e33cfaf0..271aab22b 100644
--- a/_darcs/pristine/scripts/jabberqueuehandler.php
+++ b/_darcs/pristine/scripts/jabberqueuehandler.php
@@ -35,7 +35,7 @@ set_error_handler('common_error_handler');
 
 class JabberQueueHandler extends XmppQueueHandler {
 
-    var $conn = NULL;
+    var $conn = null;
 
     function transport() {
         return 'jabber';
diff --git a/_darcs/pristine/scripts/maildaemon.php b/_darcs/pristine/scripts/maildaemon.php
index 6d8507514..886e72ba7 100644
--- a/_darcs/pristine/scripts/maildaemon.php
+++ b/_darcs/pristine/scripts/maildaemon.php
@@ -42,7 +42,7 @@ class MailerDaemon {
     function handle_message($fname='php://stdin') {
         list($from, $to, $msg) = $this->parse_message($fname);
         if (!$from || !$to || !$msg) {
-            $this->error(NULL, _('Could not parse message.'));
+            $this->error(null, _('Could not parse message.'));
         }
         common_log(LOG_INFO, "Mail from $from to $to: " .substr($msg, 0, 20));
         $user = $this->user_from($from);
@@ -74,7 +74,7 @@ class MailerDaemon {
     function user_from($from_hdr) {
         $froms = mailparse_rfc822_parse_addresses($from_hdr);
         if (!$froms) {
-            return NULL;
+            return null;
         }
         $from = $froms[0];
         $addr = common_canonical_email($from['address']);
@@ -140,7 +140,7 @@ class MailerDaemon {
                                                 'decode_headers' => true,
                                                 'decode_bodies' => true));
         if (!$parsed) {
-            return NULL;
+            return null;
         }
 
         $from = $parsed->headers['from'];
@@ -167,7 +167,7 @@ class MailerDaemon {
     }
 
     function unsupported_type($type) {
-        $this->error(NULL, "Unsupported message type: " . $type);
+        $this->error(null, "Unsupported message type: " . $type);
     }
 
     function cleanup_msg($msg) {
diff --git a/_darcs/pristine/scripts/ombqueuehandler.php b/_darcs/pristine/scripts/ombqueuehandler.php
index 31ae20f00..43c0980b6 100644
--- a/_darcs/pristine/scripts/ombqueuehandler.php
+++ b/_darcs/pristine/scripts/ombqueuehandler.php
@@ -67,7 +67,7 @@ ini_set("max_input_time", "0");
 set_time_limit(0);
 mb_internal_encoding('UTF-8');
 
-$id = ($argc > 1) ? $argv[1] : NULL;
+$id = ($argc > 1) ? $argv[1] : null;
 
 $handler = new OmbQueueHandler($id);
 
diff --git a/_darcs/pristine/scripts/smsqueuehandler.php b/_darcs/pristine/scripts/smsqueuehandler.php
index f17429d96..f8b2e9d53 100644
--- a/_darcs/pristine/scripts/smsqueuehandler.php
+++ b/_darcs/pristine/scripts/smsqueuehandler.php
@@ -57,7 +57,7 @@ ini_set("max_input_time", "0");
 set_time_limit(0);
 mb_internal_encoding('UTF-8');
 
-$id = ($argc > 1) ? $argv[1] : NULL;
+$id = ($argc > 1) ? $argv[1] : null;
 
 $handler = new SmsQueueHandler($id);
 
diff --git a/_darcs/pristine/scripts/xmppconfirmhandler.php b/_darcs/pristine/scripts/xmppconfirmhandler.php
index 454616ca0..9e177b3fa 100644
--- a/_darcs/pristine/scripts/xmppconfirmhandler.php
+++ b/_darcs/pristine/scripts/xmppconfirmhandler.php
@@ -101,8 +101,8 @@ class XmppConfirmHandler extends XmppQueueHandler {
 
     function next_confirm() {
         $confirm = new Confirm_address();
-        $confirm->whereAdd('claimed IS NULL');
-        $confirm->whereAdd('sent IS NULL');
+        $confirm->whereAdd('claimed IS null');
+        $confirm->whereAdd('sent IS null');
         # XXX: eventually we could do other confirmations in the queue, too
         $confirm->address_type = 'jabber';
         $confirm->orderBy('modified DESC');
@@ -122,12 +122,12 @@ class XmppConfirmHandler extends XmppQueueHandler {
                 return false;
             }
         }
-        return NULL;
+        return null;
     }
 
     function clear_old_confirm_claims() {
         $confirm = new Confirm();
-        $confirm->claimed = NULL;
+        $confirm->claimed = null;
         $confirm->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
         $confirm->update(DB_DATAOBJECT_WHEREADD_ONLY);
         $confirm->free();
diff --git a/_darcs/pristine/scripts/xmppdaemon.php b/_darcs/pristine/scripts/xmppdaemon.php
index cd27a2c14..ead842928 100644
--- a/_darcs/pristine/scripts/xmppdaemon.php
+++ b/_darcs/pristine/scripts/xmppdaemon.php
@@ -39,7 +39,7 @@ set_error_handler('common_error_handler');
 
 class XMPPDaemon extends Daemon {
 
-    function XMPPDaemon($resource=NULL) {
+    function XMPPDaemon($resource=null) {
         static $attrs = array('server', 'port', 'user', 'password', 'host');
 
         foreach ($attrs as $attr)
@@ -71,7 +71,7 @@ class XMPPDaemon extends Daemon {
         $this->conn->setReconnectTimeout(600);
 
         jabber_send_presence("Send me a message to post a notice", 'available',
-                             NULL, 'available', 100);
+                             null, 'available', 100);
         return !$this->conn->isDisconnected();
     }
 
@@ -92,7 +92,7 @@ class XMPPDaemon extends Daemon {
 
     function handle_reconnect(&$pl) {
         $this->conn->processUntil('session_start');
-        $this->conn->presence('Send me a message to post a notice', 'available', NULL, 'available', 100);
+        $this->conn->presence('Send me a message to post a notice', 'available', null, 'available', 100);
     }
 
     function get_user($from) {
@@ -165,30 +165,30 @@ class XMPPDaemon extends Daemon {
         $addresses = $xml->sub('addresses');
         if (!$addresses) {
             $this->log(LOG_WARNING, 'Forwarded message without addresses');
-            return NULL;
+            return null;
         }
         $address = $addresses->sub('address');
         if (!$address) {
             $this->log(LOG_WARNING, 'Forwarded message without address');
-            return NULL;
+            return null;
         }
         if (!array_key_exists('type', $address->attrs)) {
             $this->log(LOG_WARNING, 'No type for forwarded message');
-            return NULL;
+            return null;
         }
         $type = $address->attrs['type'];
         if ($type != 'ofrom') {
             $this->log(LOG_WARNING, 'Type of forwarded message is not ofrom');
-            return NULL;
+            return null;
         }
         if (!array_key_exists('jid', $address->attrs)) {
             $this->log(LOG_WARNING, 'No jid for forwarded message');
-            return NULL;
+            return null;
         }
         $jid = $address->attrs['jid'];
         if (!$jid) {
             $this->log(LOG_WARNING, 'Could not get jid from address');
-            return NULL;
+            return null;
         }
         $this->log(LOG_DEBUG, 'Got message forwarded from jid ' . $jid);
         return $jid;
diff --git a/_darcs/tentative_pristine b/_darcs/tentative_pristine
index ffadf4b71..62c02a301 100644
--- a/_darcs/tentative_pristine
+++ b/_darcs/tentative_pristine
@@ -1,28057 +1,1338 @@
-hunk ./actions/accesstoken.php 25
--	function handle($args) {
--		parent::handle($args);
--		try {
--			common_debug('getting request from env variables', __FILE__);
--			common_remove_magic_from_request();
--			$req = OAuthRequest::from_request();
--			common_debug('getting a server', __FILE__);
--			$server = omb_oauth_server();
--			common_debug('fetching the access token', __FILE__);
--			$token = $server->fetch_access_token($req);
--			common_debug('got this token: "'.print_r($token,TRUE).'"', __FILE__);
--			common_debug('printing the access token', __FILE__);
--			print $token;
--		} catch (OAuthException $e) {
--			common_server_error($e->getMessage());
--		}
--	}
-+    function handle($args) {
-+        parent::handle($args);
-+        try {
-+            common_debug('getting request from env variables', __FILE__);
-+            common_remove_magic_from_request();
-+            $req = OAuthRequest::from_request();
-+            common_debug('getting a server', __FILE__);
-+            $server = omb_oauth_server();
-+            common_debug('fetching the access token', __FILE__);
-+            $token = $server->fetch_access_token($req);
-+            common_debug('got this token: "'.print_r($token,TRUE).'"', __FILE__);
-+            common_debug('printing the access token', __FILE__);
-+            print $token;
-+        } catch (OAuthException $e) {
-+            common_server_error($e->getMessage());
-+        }
-+    }
-hunk ./actions/all.php 26
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/all.php 28
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/all.php 30
--		$nickname = common_canonical_nickname($this->arg('nickname'));
--		$user = User::staticGet('nickname', $nickname);
-+        $nickname = common_canonical_nickname($this->arg('nickname'));
-+        $user = User::staticGet('nickname', $nickname);
-hunk ./actions/all.php 33
--		if (!$user) {
--			$this->client_error(_('No such user.'));
--			return;
--		}
-+        if (!$user) {
-+            $this->client_error(_('No such user.'));
-+            return;
-+        }
-hunk ./actions/all.php 38
--		$profile = $user->getProfile();
-+        $profile = $user->getProfile();
-hunk ./actions/all.php 40
--		if (!$profile) {
--			common_server_error(_('User has no profile.'));
--			return;
--		}
-+        if (!$profile) {
-+            common_server_error(_('User has no profile.'));
-+            return;
-+        }
-hunk ./actions/all.php 45
--		# Looks like we're good; show the header
-+        # Looks like we're good; show the header
-hunk ./actions/all.php 47
--		common_show_header(sprintf(_("%s and friends"), $profile->nickname),
--						   array($this, 'show_header'), $user,
--						   array($this, 'show_top'));
-+        common_show_header(sprintf(_("%s and friends"), $profile->nickname),
-+                           array($this, 'show_header'), $user,
-+                           array($this, 'show_top'));
-hunk ./actions/all.php 51
--		$this->show_notices($user);
-+        $this->show_notices($user);
-hunk ./actions/all.php 53
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/all.php 56
--	function show_header($user) {
--		common_element('link', array('rel' => 'alternate',
--									 'href' => common_local_url('allrss', array('nickname' =>
--																			   $user->nickname)),
--									 'type' => 'application/rss+xml',
--									 'title' => sprintf(_('Feed for friends of %s'), $user->nickname)));
--	}
-+    function show_header($user) {
-+        common_element('link', array('rel' => 'alternate',
-+                                     'href' => common_local_url('allrss', array('nickname' =>
-+                                                                               $user->nickname)),
-+                                     'type' => 'application/rss+xml',
-+                                     'title' => sprintf(_('Feed for friends of %s'), $user->nickname)));
-+    }
-hunk ./actions/all.php 64
--	function show_top($user) {
--		$cur = common_current_user();
-+    function show_top($user) {
-+        $cur = common_current_user();
-hunk ./actions/all.php 67
--		if ($cur && $cur->id == $user->id) {
--			common_notice_form('all');
--		}
-+        if ($cur && $cur->id == $user->id) {
-+            common_notice_form('all');
-+        }
-hunk ./actions/all.php 71
--		$this->views_menu();
-+        $this->views_menu();
-hunk ./actions/all.php 73
--		$this->show_feeds_list(array(0=>array('href'=>common_local_url('allrss', array('nickname' => $user->nickname)),
--											  'type' => 'rss',
--											  'version' => 'RSS 1.0',
--											  'item' => 'allrss')));
--	}
-+        $this->show_feeds_list(array(0=>array('href'=>common_local_url('allrss', array('nickname' => $user->nickname)),
-+                                              'type' => 'rss',
-+                                              'version' => 'RSS 1.0',
-+                                              'item' => 'allrss')));
-+    }
-hunk ./actions/all.php 79
--	function show_notices($user) {
-+    function show_notices($user) {
-hunk ./actions/all.php 81
--		$page = $this->trimmed('page');
--		if (!$page) {
--			$page = 1;
--		}
-+        $page = $this->trimmed('page');
-+        if (!$page) {
-+            $page = 1;
-+        }
-hunk ./actions/all.php 86
--		$notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
-+        $notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
-hunk ./actions/all.php 90
--		common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
--						  $page, 'all', array('nickname' => $user->nickname));
--	}
-+        common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
-+                          $page, 'all', array('nickname' => $user->nickname));
-+    }
 hunk ./actions/allrss.php 28
--	var $user = NULL;
-+    var $user = NULL;
-hunk ./actions/allrss.php 30
--	function init() {
--		$nickname = $this->trimmed('nickname');
--		$this->user = User::staticGet('nickname', $nickname);
-+    function init() {
-+        $nickname = $this->trimmed('nickname');
-+        $this->user = User::staticGet('nickname', $nickname);
-hunk ./actions/allrss.php 34
--		if (!$this->user) {
--			common_user_error(_('No such user.'));
--			return false;
--		} else {
--			return true;
--		}
--	}
-+        if (!$this->user) {
-+            common_user_error(_('No such user.'));
-+            return false;
-+        } else {
-+            return true;
-+        }
-+    }
-hunk ./actions/allrss.php 42
--	function get_notices($limit=0) {
-+    function get_notices($limit=0) {
-hunk ./actions/allrss.php 44
--		$user = $this->user;
--		
--		$notice = $user->noticesWithFriends(0, $limit);
--											
--		while ($notice->fetch()) {
--			$notices[] = clone($notice);
--		}
-+        $user = $this->user;
-+        
-+        $notice = $user->noticesWithFriends(0, $limit);
-+                                            
-+        while ($notice->fetch()) {
-+            $notices[] = clone($notice);
-+        }
-hunk ./actions/allrss.php 52
--		return $notices;
--	}
-+        return $notices;
-+    }
-hunk ./actions/allrss.php 55
--	function get_channel() {
--		$user = $this->user;
--		$c = array('url' => common_local_url('allrss',
--											 array('nickname' =>
--												   $user->nickname)),
--				   'title' => sprintf(_('%s and friends'), $user->nickname),
--				   'link' => common_local_url('all',
--											 array('nickname' =>
--												   $user->nickname)),
--				   'description' => sprintf(_('Feed for friends of %s'), $user->nickname));
--		return $c;
--	}
-+    function get_channel() {
-+        $user = $this->user;
-+        $c = array('url' => common_local_url('allrss',
-+                                             array('nickname' =>
-+                                                   $user->nickname)),
-+                   'title' => sprintf(_('%s and friends'), $user->nickname),
-+                   'link' => common_local_url('all',
-+                                             array('nickname' =>
-+                                                   $user->nickname)),
-+                   'description' => sprintf(_('Feed for friends of %s'), $user->nickname));
-+        return $c;
-+    }
-hunk ./actions/allrss.php 68
--	function get_image() {
--		$user = $this->user;
--		$profile = $user->getProfile();
--		if (!$profile) {
--			return NULL;
--		}
--		$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
--		return ($avatar) ? $avatar->url : NULL;
--	}
-+    function get_image() {
-+        $user = $this->user;
-+        $profile = $user->getProfile();
-+        if (!$profile) {
-+            return NULL;
-+        }
-+        $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-+        return ($avatar) ? $avatar->url : NULL;
-+    }
-hunk ./actions/api.php 13
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./actions/api.php 17
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./actions/api.php 24
--	var $user;
--	var $content_type;
--	var $api_arg;
--	var $api_method;
--	var $api_action;
-+    var $user;
-+    var $content_type;
-+    var $api_arg;
-+    var $api_method;
-+    var $api_action;
-hunk ./actions/api.php 30
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/api.php 33
--		$this->api_action = $this->arg('apiaction');
--		$method = $this->arg('method');
--		$argument = $this->arg('argument');
-+        $this->api_action = $this->arg('apiaction');
-+        $method = $this->arg('method');
-+        $argument = $this->arg('argument');
-hunk ./actions/api.php 37
--		if (isset($argument)) {
--			$cmdext = explode('.', $argument);
--			$this->api_arg =  $cmdext[0];
--			$this->api_method = $method;
--			$this->content_type = strtolower($cmdext[1]);
--		} else {
-+        if (isset($argument)) {
-+            $cmdext = explode('.', $argument);
-+            $this->api_arg =  $cmdext[0];
-+            $this->api_method = $method;
-+            $this->content_type = strtolower($cmdext[1]);
-+        } else {
-hunk ./actions/api.php 44
--			# Requested format / content-type will be an extension on the method
--			$cmdext = explode('.', $method);
--			$this->api_method = $cmdext[0];
--			$this->content_type = strtolower($cmdext[1]);
--		}
-+            # Requested format / content-type will be an extension on the method
-+            $cmdext = explode('.', $method);
-+            $this->api_method = $cmdext[0];
-+            $this->content_type = strtolower($cmdext[1]);
-+        }
-hunk ./actions/api.php 50
--		if ($this->requires_auth()) {
--			if (!isset($_SERVER['PHP_AUTH_USER'])) {
-+        if ($this->requires_auth()) {
-+            if (!isset($_SERVER['PHP_AUTH_USER'])) {
-hunk ./actions/api.php 53
--				# This header makes basic auth go
--				header('WWW-Authenticate: Basic realm="Laconica API"');
-+                # This header makes basic auth go
-+                header('WWW-Authenticate: Basic realm="Laconica API"');
-hunk ./actions/api.php 56
--				# If the user hits cancel -- bam!
--				$this->show_basic_auth_error();
--			} else {
--				$nickname = $_SERVER['PHP_AUTH_USER'];
--				$password = $_SERVER['PHP_AUTH_PW'];
--				$user = common_check_user($nickname, $password);
-+                # If the user hits cancel -- bam!
-+                $this->show_basic_auth_error();
-+            } else {
-+                $nickname = $_SERVER['PHP_AUTH_USER'];
-+                $password = $_SERVER['PHP_AUTH_PW'];
-+                $user = common_check_user($nickname, $password);
-hunk ./actions/api.php 63
--				if ($user) {
--					$this->user = $user;
--					$this->process_command();
--				} else {
--					# basic authentication failed
--					$this->show_basic_auth_error();
--				}
--			}
--		} else {
-+                if ($user) {
-+                    $this->user = $user;
-+                    $this->process_command();
-+                } else {
-+                    # basic authentication failed
-+                    $this->show_basic_auth_error();
-+                }
-+            }
-+        } else {
-hunk ./actions/api.php 73
--			# Look for the user in the session
--			if (common_logged_in()) {
--			 	$this->user = common_current_user();
--			}
-+            # Look for the user in the session
-+            if (common_logged_in()) {
-+                 $this->user = common_current_user();
-+            }
-hunk ./actions/api.php 78
--			$this->process_command();
--		}
--	}
-+            $this->process_command();
-+        }
-+    }
-hunk ./actions/api.php 82
--	function process_command() {
--		$action = "twitapi$this->api_action";
--		$actionfile = INSTALLDIR."/actions/$action.php";
-+    function process_command() {
-+        $action = "twitapi$this->api_action";
-+        $actionfile = INSTALLDIR."/actions/$action.php";
-hunk ./actions/api.php 86
--		if (file_exists($actionfile)) {
--			require_once($actionfile);
--			$action_class = ucfirst($action)."Action";
--			$action_obj = new $action_class();
-+        if (file_exists($actionfile)) {
-+            require_once($actionfile);
-+            $action_class = ucfirst($action)."Action";
-+            $action_obj = new $action_class();
-hunk ./actions/api.php 95
--			if (method_exists($action_obj, $this->api_method)) {
--				$apidata = array(	'content-type' => $this->content_type,
--									'api_method' => $this->api_method,
--									'api_arg' => $this->api_arg,
--									'user' => $this->user);
-+            if (method_exists($action_obj, $this->api_method)) {
-+                $apidata = array(    'content-type' => $this->content_type,
-+                                    'api_method' => $this->api_method,
-+                                    'api_arg' => $this->api_arg,
-+                                    'user' => $this->user);
-hunk ./actions/api.php 101
--				call_user_func(array($action_obj, $this->api_method), $_REQUEST, $apidata);
--			} else {
--				common_user_error("API method not found!", $code=404);
--			}
--		} else {
--			common_user_error("API method not found!", $code=404);
--		}
--	}
-+                call_user_func(array($action_obj, $this->api_method), $_REQUEST, $apidata);
-+            } else {
-+                common_user_error("API method not found!", $code=404);
-+            }
-+        } else {
-+            common_user_error("API method not found!", $code=404);
-+        }
-+    }
-hunk ./actions/api.php 110
--	# Whitelist of API methods that don't need authentication
--	function requires_auth() {
--		static $noauth = array( 'statuses/public_timeline',
--								'statuses/show',
--								'users/show',
--								'help/test',
--								'help/downtime_schedule');
-+    # Whitelist of API methods that don't need authentication
-+    function requires_auth() {
-+        static $noauth = array( 'statuses/public_timeline',
-+                                'statuses/show',
-+                                'users/show',
-+                                'help/test',
-+                                'help/downtime_schedule');
-hunk ./actions/api.php 118
--		static $bareauth = array('statuses/user_timeline',
--								 'statuses/friends',
--								 'statuses/followers',
--								 'favorites/favorites');
-+        static $bareauth = array('statuses/user_timeline',
-+                                 'statuses/friends',
-+                                 'statuses/followers',
-+                                 'favorites/favorites');
-hunk ./actions/api.php 129
--		$fullname = "$this->api_action/$this->api_method";
-+        $fullname = "$this->api_action/$this->api_method";
-hunk ./actions/api.php 131
--		if (in_array($fullname, $bareauth)) {
--			# bareauth: only needs auth if without an argument
--			if ($this->api_arg) {
--				return false;
--			} else {
--				return true;
--			}
--		} else if (in_array($fullname, $noauth)) {
--			# noauth: never needs auth
--			return false;
--		} else {
--			# everybody else needs auth
--			return true;
--		}
--	}
-+        if (in_array($fullname, $bareauth)) {
-+            # bareauth: only needs auth if without an argument
-+            if ($this->api_arg) {
-+                return false;
-+            } else {
-+                return true;
-+            }
-+        } else if (in_array($fullname, $noauth)) {
-+            # noauth: never needs auth
-+            return false;
-+        } else {
-+            # everybody else needs auth
-+            return true;
-+        }
-+    }
-hunk ./actions/api.php 147
--	function show_basic_auth_error() {
--		header('HTTP/1.1 401 Unauthorized');
--		$msg = 'Could not authenticate you.';
-+    function show_basic_auth_error() {
-+        header('HTTP/1.1 401 Unauthorized');
-+        $msg = 'Could not authenticate you.';
-hunk ./actions/api.php 151
--		if ($this->content_type == 'xml') {
--			header('Content-Type: application/xml; charset=utf-8');
--			common_start_xml();
--			common_element_start('hash');
--			common_element('error', NULL, $msg);
--			common_element('request', NULL, $_SERVER['REQUEST_URI']);
--			common_element_end('hash');
--			common_end_xml();
--		} else if ($this->content_type == 'json')  {
--			header('Content-Type: application/json; charset=utf-8');
--			$error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);
--			print(json_encode($error_array));
--		} else {
--			header('Content-type: text/plain');
--			print "$msg\n";
--		}
--	}
-+        if ($this->content_type == 'xml') {
-+            header('Content-Type: application/xml; charset=utf-8');
-+            common_start_xml();
-+            common_element_start('hash');
-+            common_element('error', NULL, $msg);
-+            common_element('request', NULL, $_SERVER['REQUEST_URI']);
-+            common_element_end('hash');
-+            common_end_xml();
-+        } else if ($this->content_type == 'json')  {
-+            header('Content-Type: application/json; charset=utf-8');
-+            $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);
-+            print(json_encode($error_array));
-+        } else {
-+            header('Content-type: text/plain');
-+            print "$msg\n";
-+        }
-+    }
-hunk ./actions/api.php 169
--	function is_readonly() {
--		# NOTE: before handle(), can't use $this->arg
--		$apiaction = $_REQUEST['apiaction'];
--		$method = $_REQUEST['method'];
--		list($cmdtext, $fmt) = explode('.', $method);
-+    function is_readonly() {
-+        # NOTE: before handle(), can't use $this->arg
-+        $apiaction = $_REQUEST['apiaction'];
-+        $method = $_REQUEST['method'];
-+        list($cmdtext, $fmt) = explode('.', $method);
-hunk ./actions/api.php 175
--		static $write_methods = array(
--			'account' => array('update_location', 'update_delivery_device', 'end_session'),
--			'blocks' => array('create', 'destroy'),
--			'direct_messages' => array('create', 'destroy'),
--			'favorites' => array('create', 'destroy'),
--			'friendships' => array('create', 'destroy'),
--			'help' => array(),
--			'notifications' => array('follow', 'leave'),
--			'statuses' => array('update', 'destroy'),
--			'users' => array()
--		);
-+        static $write_methods = array(
-+            'account' => array('update_location', 'update_delivery_device', 'end_session'),
-+            'blocks' => array('create', 'destroy'),
-+            'direct_messages' => array('create', 'destroy'),
-+            'favorites' => array('create', 'destroy'),
-+            'friendships' => array('create', 'destroy'),
-+            'help' => array(),
-+            'notifications' => array('follow', 'leave'),
-+            'statuses' => array('update', 'destroy'),
-+            'users' => array()
-+        );
-hunk ./actions/api.php 187
--		if (array_key_exists($apiaction, $write_methods)) {
--			if (!in_array($cmdtext, $write_methods[$apiaction])) {
--				return true;
--			}
--		}
-+        if (array_key_exists($apiaction, $write_methods)) {
-+            if (!in_array($cmdtext, $write_methods[$apiaction])) {
-+                return true;
-+            }
-+        }
-hunk ./actions/api.php 193
--		return false;
--	}
-+        return false;
-+    }
-hunk ./actions/avatarbynickname.php 27
--        	$this->client_error(_('No nickname.'));
--			return;
--		}
--		$size = $this->trimmed('size');
-+            $this->client_error(_('No nickname.'));
-+            return;
-+        }
-+        $size = $this->trimmed('size');
-hunk ./actions/avatarbynickname.php 32
--        	$this->client_error(_('No size.'));
--			return;
--		}
--		$size = strtolower($size);
--		if (!in_array($size, array('original', '96', '48', '24'))) {
--        	$this->client_error(_('Invalid size.'));
--			return;
--		}
-+            $this->client_error(_('No size.'));
-+            return;
-+        }
-+        $size = strtolower($size);
-+        if (!in_array($size, array('original', '96', '48', '24'))) {
-+            $this->client_error(_('Invalid size.'));
-+            return;
-+        }
-hunk ./actions/avatarbynickname.php 41
--		$user = User::staticGet('nickname', $nickname);
--		if (!$user) {
--        	$this->client_error(_('No such user.'));
--			return;
--		}
--		$profile = $user->getProfile();
--		if (!$profile) {
--        	$this->client_error(_('User has no profile.'));
--			return;
--		}
--		if ($size == 'original') {
--			$avatar = $profile->getOriginal();
--		} else {
--			$avatar = $profile->getAvatar($size+0);
--		}
-+        $user = User::staticGet('nickname', $nickname);
-+        if (!$user) {
-+            $this->client_error(_('No such user.'));
-+            return;
-+        }
-+        $profile = $user->getProfile();
-+        if (!$profile) {
-+            $this->client_error(_('User has no profile.'));
-+            return;
-+        }
-+        if ($size == 'original') {
-+            $avatar = $profile->getOriginal();
-+        } else {
-+            $avatar = $profile->getAvatar($size+0);
-+        }
-hunk ./actions/avatarbynickname.php 57
--		if ($avatar) {
--			$url = $avatar->url;
--		} else {
--			if ($size == 'original') {
--				$url = common_default_avatar(AVATAR_PROFILE_SIZE);
--			} else {
--				$url = common_default_avatar($size+0);
--			}
--		}
--		common_redirect($url, 302);
--	}
-+        if ($avatar) {
-+            $url = $avatar->url;
-+        } else {
-+            if ($size == 'original') {
-+                $url = common_default_avatar(AVATAR_PROFILE_SIZE);
-+            } else {
-+                $url = common_default_avatar($size+0);
-+            }
-+        }
-+        common_redirect($url, 302);
-+    }
-hunk ./actions/block.php 35
--		$token = $this->trimmed('token');
-+        $token = $this->trimmed('token');
-hunk ./actions/block.php 37
--		if (!$token || $token != common_session_token()) {
--			$this->client_error(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        if (!$token || $token != common_session_token()) {
-+            $this->client_error(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/block.php 78
--		common_show_header(_('Block user'));
-+        common_show_header(_('Block user'));
-hunk ./actions/confirmaddress.php 46
--		$type = $confirm->address_type;
--		if (!in_array($type, array('email', 'jabber', 'sms'))) {
--			$this->server_error(sprintf(_('Unrecognized address type %s'), $type));
--			return;
--		}
-+        $type = $confirm->address_type;
-+        if (!in_array($type, array('email', 'jabber', 'sms'))) {
-+            $this->server_error(sprintf(_('Unrecognized address type %s'), $type));
-+            return;
-+        }
-hunk ./actions/confirmaddress.php 53
--			return;
--		}
-+            return;
-+        }
-hunk ./actions/confirmaddress.php 60
--		$cur->$type = $confirm->address;
-+        $cur->$type = $confirm->address;
-hunk ./actions/confirmaddress.php 62
--		if ($type == 'sms') {
--			$cur->carrier = ($confirm->address_extra)+0;
--			$carrier = Sms_carrier::staticGet($cur->carrier);
--			$cur->smsemail = $carrier->toEmailAddress($cur->sms);
--		}
-+        if ($type == 'sms') {
-+            $cur->carrier = ($confirm->address_extra)+0;
-+            $carrier = Sms_carrier::staticGet($cur->carrier);
-+            $cur->smsemail = $carrier->toEmailAddress($cur->sms);
-+        }
-hunk ./actions/confirmaddress.php 68
--		$result = $cur->updateKeys($orig_user);
-+        $result = $cur->updateKeys($orig_user);
-hunk ./actions/confirmaddress.php 71
--			common_log_db_error($cur, 'UPDATE', __FILE__);
-+            common_log_db_error($cur, 'UPDATE', __FILE__);
-hunk ./actions/confirmaddress.php 76
--		if ($type == 'email') {
--		    $cur->emailChanged();
--		}
-+        if ($type == 'email') {
-+            $cur->emailChanged();
-+        }
-hunk ./actions/confirmaddress.php 83
--			common_log_db_error($confirm, 'DELETE', __FILE__);
-+            common_log_db_error($confirm, 'DELETE', __FILE__);
-hunk ./actions/deletenotice.php 25
--	function handle($args) {
--		parent::handle($args);
--		# XXX: Ajax!
-+    function handle($args) {
-+        parent::handle($args);
-+        # XXX: Ajax!
-hunk ./actions/deletenotice.php 29
--		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
--			$this->delete_notice();
--		} else if ($_SERVER['REQUEST_METHOD'] == 'GET') {
--			$this->show_form();
--		}
--	}
-+        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-+            $this->delete_notice();
-+        } else if ($_SERVER['REQUEST_METHOD'] == 'GET') {
-+            $this->show_form();
-+        }
-+    }
-hunk ./actions/deletenotice.php 36
--	function get_instructions() {
--		return _('You are about to permanently delete a notice.  Once this is done, it cannot be undone.');
--	}
-+    function get_instructions() {
-+        return _('You are about to permanently delete a notice.  Once this is done, it cannot be undone.');
-+    }
-hunk ./actions/deletenotice.php 40
--	function get_title() {
--		return _('Delete notice');
--	}
-+    function get_title() {
-+        return _('Delete notice');
-+    }
+-    var $user = NULL;
++    var $user = null;
+hunk ./actions/allrss.php 72
+-            return NULL;
++            return null;
+hunk ./actions/allrss.php 75
+-        return ($avatar) ? $avatar->url : NULL;
++        return ($avatar) ? $avatar->url : null;
+hunk ./actions/api.php 155
+-            common_element('error', NULL, $msg);
+-            common_element('request', NULL, $_SERVER['REQUEST_URI']);
++            common_element('error', null, $msg);
++            common_element('request', null, $_SERVER['REQUEST_URI']);
+hunk ./actions/block.php 24
+-    var $profile = NULL;
++    var $profile = null;
+hunk ./actions/block.php 80
+-        common_element('p', NULL,
++        common_element('p', null,
+hunk ./actions/confirmaddress.php 91
+-        common_element('p', NULL,
++        common_element('p', null,
 hunk ./actions/deletenotice.php 44
--	function show_form($error=NULL) {
--		$user = common_current_user();
-+    function show_form($error=NULL) {
-+        $user = common_current_user();
-hunk ./actions/deletenotice.php 47
--		common_show_header($this->get_title(), array($this, 'show_header'), $error,
--						   array($this, 'show_top'));
--		common_element_start('form', array('id' => 'notice_delete_form',
--								   'method' => 'post',
--								   'action' => common_local_url('deletenotice')));
--		common_hidden('token', common_session_token());
--		common_hidden('notice', $this->trimmed('notice'));
--		common_element_start('p');
--		common_element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?'));
-+        common_show_header($this->get_title(), array($this, 'show_header'), $error,
-+                           array($this, 'show_top'));
-+        common_element_start('form', array('id' => 'notice_delete_form',
-+                                   'method' => 'post',
-+                                   'action' => common_local_url('deletenotice')));
-+        common_hidden('token', common_session_token());
-+        common_hidden('notice', $this->trimmed('notice'));
-+        common_element_start('p');
-+        common_element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?'));
-hunk ./actions/deletenotice.php 57
--		common_element('input', array('id' => 'submit_no',
--						  'name' => 'submit',
--						  'type' => 'submit',
--						  'value' => _('No')));
--		common_element('input', array('id' => 'submit_yes',
--						  'name' => 'submit',
--						  'type' => 'submit',
--						  'value' => _('Yes')));
--		common_element_end('p');
--		common_element_end('form');
--		common_show_footer();
--	}
-+        common_element('input', array('id' => 'submit_no',
-+                          'name' => 'submit',
-+                          'type' => 'submit',
-+                          'value' => _('No')));
-+        common_element('input', array('id' => 'submit_yes',
-+                          'name' => 'submit',
-+                          'type' => 'submit',
-+                          'value' => _('Yes')));
-+        common_element_end('p');
-+        common_element_end('form');
-+        common_show_footer();
-+    }
-hunk ./actions/deletenotice.php 70
--	function delete_notice() {
--		# CSRF protection
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
--		$url = common_get_returnto();
--		$confirmed = $this->trimmed('submit');
--		if ($confirmed == _('Yes')) {
--			$user = common_current_user();
--			$notice_id = $this->trimmed('notice');
--			$notice = Notice::staticGet($notice_id);
--			$replies = new Reply;
--			$replies->get('notice_id', $notice_id);
-+    function delete_notice() {
-+        # CSRF protection
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-+        $url = common_get_returnto();
-+        $confirmed = $this->trimmed('submit');
-+        if ($confirmed == _('Yes')) {
-+            $user = common_current_user();
-+            $notice_id = $this->trimmed('notice');
-+            $notice = Notice::staticGet($notice_id);
-+            $replies = new Reply;
-+            $replies->get('notice_id', $notice_id);
-hunk ./actions/deletenotice.php 86
--			common_dequeue_notice($notice);
--			if (common_config('memcached', 'enabled')) {
--				$notice->blowSubsCache();
--			}
--			$replies->delete();
--			$notice->delete();
--		} else {
--			if ($url) {
--				common_set_returnto(NULL);
--			} else {
--				$url = common_local_url('public');
--			}
--		}
--		common_redirect($url);
--	}
-+            common_dequeue_notice($notice);
-+            if (common_config('memcached', 'enabled')) {
-+                $notice->blowSubsCache();
-+            }
-+            $replies->delete();
-+            $notice->delete();
-+        } else {
-+            if ($url) {
-+                common_set_returnto(NULL);
-+            } else {
-+                $url = common_local_url('public');
-+            }
-+        }
-+        common_redirect($url);
-+    }
-hunk ./actions/deleteprofile.php 35
--	function get_instructions() {
--		return _('Export and delete your user information.');
--	}
-+    function get_instructions() {
-+        return _('Export and delete your user information.');
-+    }
+-    function show_form($error=NULL) {
++    function show_form($error=null) {
+hunk ./actions/deletenotice.php 94
+-                common_set_returnto(NULL);
++                common_set_returnto(null);
 hunk ./actions/deleteprofile.php 39
--	function form_header($title, $msg=NULL, $success=false) {
--		common_show_header($title,
--		                   NULL,
--		                   array($msg, $success),
--						   array($this, 'show_top'));
--	}
-+    function form_header($title, $msg=NULL, $success=false) {
-+        common_show_header($title,
-+                           NULL,
-+                           array($msg, $success),
-+                           array($this, 'show_top'));
-+    }
-hunk ./actions/deleteprofile.php 46
--	function show_feeds_list($feeds) {
--		common_element_start('div', array('class' => 'feedsdel'));
--		common_element('p', null, 'Feeds:');
--		common_element_start('ul', array('class' => 'xoxo'));
-+    function show_feeds_list($feeds) {
-+        common_element_start('div', array('class' => 'feedsdel'));
-+        common_element('p', null, 'Feeds:');
-+        common_element_start('ul', array('class' => 'xoxo'));
-hunk ./actions/deleteprofile.php 51
--		foreach ($feeds as $key => $value) {
--			$this->common_feed_item($feeds[$key]);
--		}
--		common_element_end('ul');
--		common_element_end('div');
--	}
-+        foreach ($feeds as $key => $value) {
-+            $this->common_feed_item($feeds[$key]);
-+        }
-+        common_element_end('ul');
-+        common_element_end('div');
-+    }
-hunk ./actions/deleteprofile.php 59
--	function common_feed_item($feed) {
-+    function common_feed_item($feed) {
-hunk ./actions/deleteprofile.php 61
--		$nickname = $user->nickname;
-+        $nickname = $user->nickname;
-hunk ./actions/deleteprofile.php 63
--		switch($feed['item']) {
--			case 'notices': default:
--				$feed_classname = $feed['type'];
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = "$nickname's ".$feed['version']." notice feed";
--				$feed['textContent'] = "RSS";
--				break;
-+        switch($feed['item']) {
-+            case 'notices': default:
-+                $feed_classname = $feed['type'];
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = "$nickname's ".$feed['version']." notice feed";
-+                $feed['textContent'] = "RSS";
-+                break;
-hunk ./actions/deleteprofile.php 71
--			case 'foaf':
--				$feed_classname = "foaf";
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = "$nickname's FOAF file";
--				$feed['textContent'] = "FOAF";
--				break;
--		}
--		common_element_start('li');
--		common_element('a', array('href' => $feed['href'],
--								  'class' => $feed_classname,
--								  'type' => $feed_mimetype,
--								  'title' => $feed_title),
--							$feed['textContent']);
--		common_element_end('li');
--	}
-+            case 'foaf':
-+                $feed_classname = "foaf";
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = "$nickname's FOAF file";
-+                $feed['textContent'] = "FOAF";
-+                break;
-+        }
-+        common_element_start('li');
-+        common_element('a', array('href' => $feed['href'],
-+                                  'class' => $feed_classname,
-+                                  'type' => $feed_mimetype,
-+                                  'title' => $feed_title),
-+                            $feed['textContent']);
-+        common_element_end('li');
-+    }
+-    function form_header($title, $msg=NULL, $success=false) {
++    function form_header($title, $msg=null, $success=false) {
+hunk ./actions/deleteprofile.php 41
+-                           NULL,
++                           null,
 hunk ./actions/deleteprofile.php 87
--	function show_form($msg=NULL, $success=false) {
--		$this->form_header(_('Delete my account'), $msg, $success);
--		common_element('h2', NULL, _('Delete my account confirmation'));
--		$this->show_confirm_delete_form();
--		common_show_footer();
--	}
-+    function show_form($msg=NULL, $success=false) {
-+        $this->form_header(_('Delete my account'), $msg, $success);
-+        common_element('h2', NULL, _('Delete my account confirmation'));
-+        $this->show_confirm_delete_form();
-+        common_show_footer();
-+    }
-hunk ./actions/deleteprofile.php 94
--	function show_confirm_delete_form() {
--		$user = common_current_user();
-+    function show_confirm_delete_form() {
-+        $user = common_current_user();
-hunk ./actions/deleteprofile.php 100
--		common_element_start('form', array('method' => 'POST',
--										   'id' => 'delete',
--										   'action' =>
--										   common_local_url('deleteprofile')));
-+        common_element_start('form', array('method' => 'POST',
-+                                           'id' => 'delete',
-+                                           'action' =>
-+                                           common_local_url('deleteprofile')));
-hunk ./actions/deleteprofile.php 105
--		common_hidden('token', common_session_token());
-+        common_hidden('token', common_session_token());
-hunk ./actions/deleteprofile.php 108
--		$this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
--											  'type' => 'rss',
--											  'version' => 'RSS 1.0',
--											  'item' => 'notices'),
--									 1=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
--											  'type' => 'rdf',
--											  'version' => 'FOAF',
--											  'item' => 'foaf')));
-+        $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
-+                                              'type' => 'rss',
-+                                              'version' => 'RSS 1.0',
-+                                              'item' => 'notices'),
-+                                     1=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
-+                                              'type' => 'rdf',
-+                                              'version' => 'FOAF',
-+                                              'item' => 'foaf')));
-hunk ./actions/deleteprofile.php 119
--		common_submit('deleteaccount', _('Delete my account'));
--		common_element_end('form');
-+        common_submit('deleteaccount', _('Delete my account'));
-+        common_element_end('form');
-hunk ./actions/deleteprofile.php 123
--	function handle_post() {
--		# CSRF protection
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+    function handle_post() {
-+        # CSRF protection
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/deleteprofile.php 137
--	function delete_account() {
--		$user = common_current_user();
--		assert(!is_null($user)); # should already be checked
-+    function delete_account() {
-+        $user = common_current_user();
-+        assert(!is_null($user)); # should already be checked
-hunk ./actions/deleteprofile.php 222
--	function show_top($arr) {
--		$msg = $arr[0];
--		$success = $arr[1];
--		if ($msg) {
--			$this->message($msg, $success);
--		} else {
--			$inst = $this->get_instructions();
--			$output = common_markup_to_html($inst);
--			common_element_start('div', 'instructions');
--			common_raw($output);
--			common_element_end('div');
--		}
--		$this->settings_menu();
--	}
-+    function show_top($arr) {
-+        $msg = $arr[0];
-+        $success = $arr[1];
-+        if ($msg) {
-+            $this->message($msg, $success);
-+        } else {
-+            $inst = $this->get_instructions();
-+            $output = common_markup_to_html($inst);
-+            common_element_start('div', 'instructions');
-+            common_raw($output);
-+            common_element_end('div');
-+        }
-+        $this->settings_menu();
-+    }
-hunk ./actions/deleteprofile.php 239
--		$menu =
--		  array('profilesettings' =>
--				array(_('Profile'),
--					  _('Change your profile settings')),
--				'emailsettings' =>
--				array(_('Email'),
--					  _('Change email handling')),
--				'openidsettings' =>
--				array(_('OpenID'),
--					  _('Add or remove OpenIDs')),
--				'smssettings' =>
--				array(_('SMS'),
--					  _('Updates by SMS')),
--				'imsettings' =>
--				array(_('IM'),
--					  _('Updates by instant messenger (IM)')),
--				'twittersettings' =>
--				array(_('Twitter'),
--					  _('Twitter integration options')),
--				'othersettings' =>
--				array(_('Other'),
--					  _('Other options')));
-+        $menu =
-+          array('profilesettings' =>
-+                array(_('Profile'),
-+                      _('Change your profile settings')),
-+                'emailsettings' =>
-+                array(_('Email'),
-+                      _('Change email handling')),
-+                'openidsettings' =>
-+                array(_('OpenID'),
-+                      _('Add or remove OpenIDs')),
-+                'smssettings' =>
-+                array(_('SMS'),
-+                      _('Updates by SMS')),
-+                'imsettings' =>
-+                array(_('IM'),
-+                      _('Updates by instant messenger (IM)')),
-+                'twittersettings' =>
-+                array(_('Twitter'),
-+                      _('Twitter integration options')),
-+                'othersettings' =>
-+                array(_('Other'),
-+                      _('Other options')));
-hunk ./actions/deleteprofile.php 265
--			if ($menuaction == 'imsettings' &&
--				!common_config('xmpp', 'enabled')) {
--				continue;
--			}
-+            if ($menuaction == 'imsettings' &&
-+                !common_config('xmpp', 'enabled')) {
-+                continue;
-+            }
-hunk ./actions/disfavor.php 24
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/disfavor.php 26
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/disfavor.php 28
--		if (!common_logged_in()) {
--			common_user_error(_('Not logged in.'));
--			return;
--		}
-+        if (!common_logged_in()) {
-+            common_user_error(_('Not logged in.'));
-+            return;
-+        }
-hunk ./actions/disfavor.php 33
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/disfavor.php 35
--		if ($_SERVER['REQUEST_METHOD'] != 'POST') {
--			common_redirect(common_local_url('showfavorites', array('nickname' => $user->nickname)));
--			return;
--		}
-+        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-+            common_redirect(common_local_url('showfavorites', array('nickname' => $user->nickname)));
-+            return;
-+        }
-hunk ./actions/disfavor.php 40
--		$id = $this->trimmed('notice');
-+        $id = $this->trimmed('notice');
-hunk ./actions/disfavor.php 42
--		$notice = Notice::staticGet($id);
-+        $notice = Notice::staticGet($id);
-hunk ./actions/disfavor.php 44
--		$token = $this->trimmed('token-'.$notice->id);
-+        $token = $this->trimmed('token-'.$notice->id);
-hunk ./actions/disfavor.php 46
--		if (!$token || $token != common_session_token()) {
--			$this->client_error(_("There was a problem with your session token. Try again, please."));
--			return;
--		}
-+        if (!$token || $token != common_session_token()) {
-+            $this->client_error(_("There was a problem with your session token. Try again, please."));
-+            return;
-+        }
-hunk ./actions/disfavor.php 51
--		$fave = new Fave();
--		$fave->user_id = $this->id;
--		$fave->notice_id = $notice->id;
--		if (!$fave->find(true)) {
--			$this->client_error(_('This notice is not a favorite!'));
--			return;
--		}
-+        $fave = new Fave();
-+        $fave->user_id = $this->id;
-+        $fave->notice_id = $notice->id;
-+        if (!$fave->find(true)) {
-+            $this->client_error(_('This notice is not a favorite!'));
-+            return;
-+        }
-hunk ./actions/disfavor.php 59
--		$result = $fave->delete();
-+        $result = $fave->delete();
-hunk ./actions/disfavor.php 61
--		if (!$result) {
--			common_log_db_error($fave, 'DELETE', __FILE__);
--			$this->server_error(_('Could not delete favorite.'));
--			return;
--		}
--		
--		$user->blowFavesCache();
-+        if (!$result) {
-+            common_log_db_error($fave, 'DELETE', __FILE__);
-+            $this->server_error(_('Could not delete favorite.'));
-+            return;
-+        }
-+        
-+        $user->blowFavesCache();
-hunk ./actions/disfavor.php 69
--		if ($this->boolean('ajax')) {
--			common_start_html('text/xml;charset=utf-8', true);
--			common_element_start('head');
--			common_element('title', null, _('Add to favorites'));
--			common_element_end('head');
--			common_element_start('body');
--			common_favor_form($notice);
--			common_element_end('body');
--			common_element_end('html');
--		} else {
--			common_redirect(common_local_url('showfavorites',
--											 array('nickname' => $user->nickname)));
--		}
--	}
-+        if ($this->boolean('ajax')) {
-+            common_start_html('text/xml;charset=utf-8', true);
-+            common_element_start('head');
-+            common_element('title', null, _('Add to favorites'));
-+            common_element_end('head');
-+            common_element_start('body');
-+            common_favor_form($notice);
-+            common_element_end('body');
-+            common_element_end('html');
-+        } else {
-+            common_redirect(common_local_url('showfavorites',
-+                                             array('nickname' => $user->nickname)));
-+        }
-+    }
-hunk ./actions/doc.php 24
--	function handle($args) {
--		parent::handle($args);
--		$title = $this->trimmed('title');
--		$filename = INSTALLDIR.'/doc/'.$title;
--		if (!file_exists($filename)) {
--			common_user_error(_('No such document.'));
--			return;
--		}
--		$c = file_get_contents($filename);
--		$output = common_markup_to_html($c);
--		common_show_header(_(ucfirst($title)));
--		common_raw($output);
--		common_show_footer();
--	}
-+    function handle($args) {
-+        parent::handle($args);
-+        $title = $this->trimmed('title');
-+        $filename = INSTALLDIR.'/doc/'.$title;
-+        if (!file_exists($filename)) {
-+            common_user_error(_('No such document.'));
-+            return;
-+        }
-+        $c = file_get_contents($filename);
-+        $output = common_markup_to_html($c);
-+        common_show_header(_(ucfirst($title)));
-+        common_raw($output);
-+        common_show_footer();
-+    }
-hunk ./actions/emailsettings.php 26
--	function get_instructions() {
--		return _('Manage how you get email from %%site.name%%.');
--	}
-+    function get_instructions() {
-+        return _('Manage how you get email from %%site.name%%.');
-+    }
+-    function show_form($msg=NULL, $success=false) {
++    function show_form($msg=null, $success=false) {
+hunk ./actions/deleteprofile.php 89
+-        common_element('h2', NULL, _('Delete my account confirmation'));
++        common_element('h2', null, _('Delete my account confirmation'));
+hunk ./actions/deleteprofile.php 216
+-        common_set_user(NULL);
++        common_set_user(null);
 hunk ./actions/emailsettings.php 30
--	function show_form($msg=NULL, $success=false) {
--		$user = common_current_user();
--		$this->form_header(_('Email Settings'), $msg, $success);
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'emailsettings',
--										   'action' =>
--										   common_local_url('emailsettings')));
--		common_hidden('token', common_session_token());
-+    function show_form($msg=NULL, $success=false) {
-+        $user = common_current_user();
-+        $this->form_header(_('Email Settings'), $msg, $success);
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'emailsettings',
-+                                           'action' =>
-+                                           common_local_url('emailsettings')));
-+        common_hidden('token', common_session_token());
+-    function show_form($msg=NULL, $success=false) {
++    function show_form($msg=null, $success=false) {
 hunk ./actions/emailsettings.php 39
--		common_element('h2', NULL, _('Address'));
-+        common_element('h2', NULL, _('Address'));
-hunk ./actions/emailsettings.php 41
--		if ($user->email) {
--			common_element_start('p');
--			common_element('span', 'address confirmed', $user->email);
--			common_element('span', 'input_instructions',
--			               _('Current confirmed email address.'));
--			common_hidden('email', $user->email);
--			common_element_end('p');
--			common_submit('remove', _('Remove'));
--		} else {
--			$confirm = $this->get_confirmation();
--			if ($confirm) {
--				common_element_start('p');
--				common_element('span', 'address unconfirmed', $confirm->address);
--				common_element('span', 'input_instructions',
--							   _('Awaiting confirmation on this address. Check your inbox (and spam box!) for a message with further instructions.'));
--				common_hidden('email', $confirm->address);
--				common_element_end('p');
--				common_submit('cancel', _('Cancel'));
--			} else {
--				common_input('email', _('Email Address'),
--							 ($this->arg('email')) ? $this->arg('email') : NULL,
--							 _('Email address, like "UserName@example.org"'));
--				common_submit('add', _('Add'));
--			}
--		}
-+        if ($user->email) {
-+            common_element_start('p');
-+            common_element('span', 'address confirmed', $user->email);
-+            common_element('span', 'input_instructions',
-+                           _('Current confirmed email address.'));
-+            common_hidden('email', $user->email);
-+            common_element_end('p');
-+            common_submit('remove', _('Remove'));
-+        } else {
-+            $confirm = $this->get_confirmation();
-+            if ($confirm) {
-+                common_element_start('p');
-+                common_element('span', 'address unconfirmed', $confirm->address);
-+                common_element('span', 'input_instructions',
-+                               _('Awaiting confirmation on this address. Check your inbox (and spam box!) for a message with further instructions.'));
-+                common_hidden('email', $confirm->address);
-+                common_element_end('p');
-+                common_submit('cancel', _('Cancel'));
-+            } else {
-+                common_input('email', _('Email Address'),
-+                             ($this->arg('email')) ? $this->arg('email') : NULL,
-+                             _('Email address, like "UserName@example.org"'));
-+                common_submit('add', _('Add'));
-+            }
-+        }
-hunk ./actions/emailsettings.php 67
--		if ($user->email) {
--			common_element('h2', NULL, _('Incoming email'));
--			
--			if ($user->incomingemail) {
--				common_element_start('p');
--				common_element('span', 'address', $user->incomingemail);
--				common_element('span', 'input_instructions',
--							   _('Send email to this address to post new notices.'));
--				common_element_end('p');
--				common_submit('removeincoming', _('Remove'));
--			}
--			
--			common_element_start('p');
--			common_element('span', 'input_instructions',
--						   _('Make a new email address for posting to; cancels the old one.'));
--			common_element_end('p');
--			common_submit('newincoming', _('New'));
--		}
--		
--		common_element('h2', NULL, _('Preferences'));
-+        if ($user->email) {
-+            common_element('h2', NULL, _('Incoming email'));
-+            
-+            if ($user->incomingemail) {
-+                common_element_start('p');
-+                common_element('span', 'address', $user->incomingemail);
-+                common_element('span', 'input_instructions',
-+                               _('Send email to this address to post new notices.'));
-+                common_element_end('p');
-+                common_submit('removeincoming', _('Remove'));
-+            }
-+            
-+            common_element_start('p');
-+            common_element('span', 'input_instructions',
-+                           _('Make a new email address for posting to; cancels the old one.'));
-+            common_element_end('p');
-+            common_submit('newincoming', _('New'));
-+        }
-+        
-+        common_element('h2', NULL, _('Preferences'));
-hunk ./actions/emailsettings.php 88
--		common_checkbox('emailnotifysub',
--		                _('Send me notices of new subscriptions through email.'),
--		                $user->emailnotifysub);
--		common_checkbox('emailnotifyfav',
--		                _('Send me email when someone adds my notice as a favorite.'),
--		                $user->emailnotifyfav);
--		common_checkbox('emailnotifymsg',
--		                _('Send me email when someone sends me a private message.'),
--		                $user->emailnotifymsg);
--		common_checkbox('emailnotifynudge',
--		                _('Allow friends to nudge me and send me an email.'),
--		                $user->emailnotifynudge);
--		common_checkbox('emailpost',
--						_('I want to post notices by email.'),
--						$user->emailpost);
--		common_checkbox('emailmicroid',
--		                _('Publish a MicroID for my email address.'),
--		                $user->emailmicroid);
-+        common_checkbox('emailnotifysub',
-+                        _('Send me notices of new subscriptions through email.'),
-+                        $user->emailnotifysub);
-+        common_checkbox('emailnotifyfav',
-+                        _('Send me email when someone adds my notice as a favorite.'),
-+                        $user->emailnotifyfav);
-+        common_checkbox('emailnotifymsg',
-+                        _('Send me email when someone sends me a private message.'),
-+                        $user->emailnotifymsg);
-+        common_checkbox('emailnotifynudge',
-+                        _('Allow friends to nudge me and send me an email.'),
-+                        $user->emailnotifynudge);
-+        common_checkbox('emailpost',
-+                        _('I want to post notices by email.'),
-+                        $user->emailpost);
-+        common_checkbox('emailmicroid',
-+                        _('Publish a MicroID for my email address.'),
-+                        $user->emailmicroid);
-hunk ./actions/emailsettings.php 107
--		common_submit('save', _('Save'));
--		
--		common_element_end('form');
--		common_show_footer();
--	}
-+        common_submit('save', _('Save'));
-+        
-+        common_element_end('form');
-+        common_show_footer();
-+    }
-hunk ./actions/emailsettings.php 113
--	function get_confirmation() {
--		$user = common_current_user();
--		$confirm = new Confirm_address();
--		$confirm->user_id = $user->id;
--		$confirm->address_type = 'email';
--		if ($confirm->find(TRUE)) {
--			return $confirm;
--		} else {
--			return NULL;
--		}
--	}
-+    function get_confirmation() {
-+        $user = common_current_user();
-+        $confirm = new Confirm_address();
-+        $confirm->user_id = $user->id;
-+        $confirm->address_type = 'email';
-+        if ($confirm->find(TRUE)) {
-+            return $confirm;
-+        } else {
-+            return NULL;
-+        }
-+    }
-hunk ./actions/emailsettings.php 125
--	function handle_post() {
-+    function handle_post() {
-hunk ./actions/emailsettings.php 127
--		# CSRF protection
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        # CSRF protection
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/emailsettings.php 134
--		if ($this->arg('save')) {
--			$this->save_preferences();
--		} else if ($this->arg('add')) {
--			$this->add_address();
--		} else if ($this->arg('cancel')) {
--			$this->cancel_confirmation();
--		} else if ($this->arg('remove')) {
--			$this->remove_address();
--		} else if ($this->arg('removeincoming')) {
--			$this->remove_incoming();
--		} else if ($this->arg('newincoming')) {
--			$this->new_incoming();
--		} else {
--			$this->show_form(_('Unexpected form submission.'));
--		}
--	}
-+        if ($this->arg('save')) {
-+            $this->save_preferences();
-+        } else if ($this->arg('add')) {
-+            $this->add_address();
-+        } else if ($this->arg('cancel')) {
-+            $this->cancel_confirmation();
-+        } else if ($this->arg('remove')) {
-+            $this->remove_address();
-+        } else if ($this->arg('removeincoming')) {
-+            $this->remove_incoming();
-+        } else if ($this->arg('newincoming')) {
-+            $this->new_incoming();
-+        } else {
-+            $this->show_form(_('Unexpected form submission.'));
-+        }
-+    }
-hunk ./actions/emailsettings.php 151
--	function save_preferences() {
-+    function save_preferences() {
-hunk ./actions/emailsettings.php 153
--		$emailnotifysub = $this->boolean('emailnotifysub');
--		$emailnotifyfav = $this->boolean('emailnotifyfav');
--		$emailnotifymsg = $this->boolean('emailnotifymsg');
--		$emailnotifynudge = $this->boolean('emailnotifynudge');
--		$emailmicroid = $this->boolean('emailmicroid');
--		$emailpost = $this->boolean('emailpost');
-+        $emailnotifysub = $this->boolean('emailnotifysub');
-+        $emailnotifyfav = $this->boolean('emailnotifyfav');
-+        $emailnotifymsg = $this->boolean('emailnotifymsg');
-+        $emailnotifynudge = $this->boolean('emailnotifynudge');
-+        $emailmicroid = $this->boolean('emailmicroid');
-+        $emailpost = $this->boolean('emailpost');
-hunk ./actions/emailsettings.php 160
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/emailsettings.php 162
--		assert(!is_null($user)); # should already be checked
-+        assert(!is_null($user)); # should already be checked
-hunk ./actions/emailsettings.php 164
--		$user->query('BEGIN');
-+        $user->query('BEGIN');
-hunk ./actions/emailsettings.php 166
--		$original = clone($user);
-+        $original = clone($user);
-hunk ./actions/emailsettings.php 168
--		$user->emailnotifysub = $emailnotifysub;
--		$user->emailnotifyfav = $emailnotifyfav;
--		$user->emailnotifymsg = $emailnotifymsg;
--		$user->emailnotifynudge = $emailnotifynudge;
--		$user->emailmicroid = $emailmicroid;
--		$user->emailpost = $emailpost;
-+        $user->emailnotifysub = $emailnotifysub;
-+        $user->emailnotifyfav = $emailnotifyfav;
-+        $user->emailnotifymsg = $emailnotifymsg;
-+        $user->emailnotifynudge = $emailnotifynudge;
-+        $user->emailmicroid = $emailmicroid;
-+        $user->emailpost = $emailpost;
-hunk ./actions/emailsettings.php 175
--		$result = $user->update($original);
-+        $result = $user->update($original);
-hunk ./actions/emailsettings.php 177
--		if ($result === FALSE) {
--			common_log_db_error($user, 'UPDATE', __FILE__);
--			common_server_error(_('Couldn\'t update user.'));
--			return;
--		}
-+        if ($result === FALSE) {
-+            common_log_db_error($user, 'UPDATE', __FILE__);
-+            common_server_error(_('Couldn\'t update user.'));
-+            return;
-+        }
-hunk ./actions/emailsettings.php 183
--		$user->query('COMMIT');
-+        $user->query('COMMIT');
-hunk ./actions/emailsettings.php 185
--		$this->show_form(_('Preferences saved.'), true);
--	}
-+        $this->show_form(_('Preferences saved.'), true);
-+    }
-hunk ./actions/emailsettings.php 188
--	function add_address() {
-+    function add_address() {
-hunk ./actions/emailsettings.php 190
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/emailsettings.php 192
--		$email = $this->trimmed('email');
-+        $email = $this->trimmed('email');
-hunk ./actions/emailsettings.php 194
--		# Some validation
-+        # Some validation
-hunk ./actions/emailsettings.php 196
--		if (!$email) {
--			$this->show_form(_('No email address.'));
--			return;
--		}
-+        if (!$email) {
-+            $this->show_form(_('No email address.'));
-+            return;
-+        }
-hunk ./actions/emailsettings.php 201
--		$email = common_canonical_email($email);
-+        $email = common_canonical_email($email);
-hunk ./actions/emailsettings.php 203
--		if (!$email) {
--		    $this->show_form(_('Cannot normalize that email address'));
--		    return;
--		}
--		if (!Validate::email($email, true)) {
--		    $this->show_form(_('Not a valid email address'));
--		    return;
--		} else if ($user->email == $email) {
--		    $this->show_form(_('That is already your email address.'));
--		    return;
--		} else if ($this->email_exists($email)) {
--		    $this->show_form(_('That email address already belongs to another user.'));
--		    return;
--		}
-+        if (!$email) {
-+            $this->show_form(_('Cannot normalize that email address'));
-+            return;
-+        }
-+        if (!Validate::email($email, true)) {
-+            $this->show_form(_('Not a valid email address'));
-+            return;
-+        } else if ($user->email == $email) {
-+            $this->show_form(_('That is already your email address.'));
-+            return;
-+        } else if ($this->email_exists($email)) {
-+            $this->show_form(_('That email address already belongs to another user.'));
-+            return;
-+        }
-hunk ./actions/emailsettings.php 218
--  		$confirm = new Confirm_address();
--   		$confirm->address = $email;
--   		$confirm->address_type = 'email';
--   		$confirm->user_id = $user->id;
--   		$confirm->code = common_confirmation_code(64);
-+          $confirm = new Confirm_address();
-+           $confirm->address = $email;
-+           $confirm->address_type = 'email';
-+           $confirm->user_id = $user->id;
-+           $confirm->code = common_confirmation_code(64);
-hunk ./actions/emailsettings.php 224
--		$result = $confirm->insert();
-+        $result = $confirm->insert();
-hunk ./actions/emailsettings.php 226
--		if ($result === FALSE) {
--			common_log_db_error($confirm, 'INSERT', __FILE__);
--			common_server_error(_('Couldn\'t insert confirmation code.'));
--			return;
--		}
-+        if ($result === FALSE) {
-+            common_log_db_error($confirm, 'INSERT', __FILE__);
-+            common_server_error(_('Couldn\'t insert confirmation code.'));
-+            return;
-+        }
-hunk ./actions/emailsettings.php 232
--		mail_confirm_address($user, $confirm->code, $user->nickname, $email);
-+        mail_confirm_address($user, $confirm->code, $user->nickname, $email);
-hunk ./actions/emailsettings.php 234
--		$msg = _('A confirmation code was sent to the email address you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
-+        $msg = _('A confirmation code was sent to the email address you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
-hunk ./actions/emailsettings.php 236
--		$this->show_form($msg, TRUE);
--	}
-+        $this->show_form($msg, TRUE);
-+    }
-hunk ./actions/emailsettings.php 239
--	function cancel_confirmation() {
--		$email = $this->arg('email');
--		$confirm = $this->get_confirmation();
--		if (!$confirm) {
--			$this->show_form(_('No pending confirmation to cancel.'));
--			return;
--		}
--		if ($confirm->address != $email) {
--			$this->show_form(_('That is the wrong IM address.'));
--			return;
--		}
-+    function cancel_confirmation() {
-+        $email = $this->arg('email');
-+        $confirm = $this->get_confirmation();
-+        if (!$confirm) {
-+            $this->show_form(_('No pending confirmation to cancel.'));
-+            return;
-+        }
-+        if ($confirm->address != $email) {
-+            $this->show_form(_('That is the wrong IM address.'));
-+            return;
-+        }
-hunk ./actions/emailsettings.php 254
--			common_log_db_error($confirm, 'DELETE', __FILE__);
-+            common_log_db_error($confirm, 'DELETE', __FILE__);
-hunk ./actions/emailsettings.php 260
--	}
-+    }
-hunk ./actions/emailsettings.php 262
--	function remove_address() {
-+    function remove_address() {
-hunk ./actions/emailsettings.php 264
--		$user = common_current_user();
--		$email = $this->arg('email');
-+        $user = common_current_user();
-+        $email = $this->arg('email');
-hunk ./actions/emailsettings.php 267
--		# Maybe an old tab open...?
-+        # Maybe an old tab open...?
-hunk ./actions/emailsettings.php 269
--		if ($user->email != $email) {
--		    $this->show_form(_('That is not your email address.'));
--		    return;
--		}
-+        if ($user->email != $email) {
-+            $this->show_form(_('That is not your email address.'));
-+            return;
-+        }
-hunk ./actions/emailsettings.php 274
--		$user->query('BEGIN');
--		$original = clone($user);
--		$user->email = NULL;
--		$result = $user->updateKeys($original);
--		if (!$result) {
--			common_log_db_error($user, 'UPDATE', __FILE__);
--			common_server_error(_('Couldn\'t update user.'));
--			return;
--		}
--		$user->query('COMMIT');
-+        $user->query('BEGIN');
-+        $original = clone($user);
-+        $user->email = NULL;
-+        $result = $user->updateKeys($original);
-+        if (!$result) {
-+            common_log_db_error($user, 'UPDATE', __FILE__);
-+            common_server_error(_('Couldn\'t update user.'));
-+            return;
-+        }
-+        $user->query('COMMIT');
-hunk ./actions/emailsettings.php 285
--		$this->show_form(_('The address was removed.'), TRUE);
--	}
-+        $this->show_form(_('The address was removed.'), TRUE);
-+    }
-hunk ./actions/emailsettings.php 288
--	function remove_incoming() {
--		$user = common_current_user();
--		
--		if (!$user->incomingemail) {
--			$this->show_form(_('No incoming email address.'));
--			return;
--		}
--		
--		$orig = clone($user);
--		$user->incomingemail = NULL;
-+    function remove_incoming() {
-+        $user = common_current_user();
-+        
-+        if (!$user->incomingemail) {
-+            $this->show_form(_('No incoming email address.'));
-+            return;
-+        }
-+        
-+        $orig = clone($user);
-+        $user->incomingemail = NULL;
-hunk ./actions/emailsettings.php 299
--		if (!$user->updateKeys($orig)) {
--			common_log_db_error($user, 'UPDATE', __FILE__);
--			$this->server_error(_("Couldn't update user record."));
--		}
--		
--		$this->show_form(_('Incoming email address removed.'), TRUE);
--	}
-+        if (!$user->updateKeys($orig)) {
-+            common_log_db_error($user, 'UPDATE', __FILE__);
-+            $this->server_error(_("Couldn't update user record."));
-+        }
-+        
-+        $this->show_form(_('Incoming email address removed.'), TRUE);
-+    }
-hunk ./actions/emailsettings.php 307
--	function new_incoming() {
--		$user = common_current_user();
--		
--		$orig = clone($user);
--		$user->incomingemail = mail_new_incoming_address();
--		
--		if (!$user->updateKeys($orig)) {
--			common_log_db_error($user, 'UPDATE', __FILE__);
--			$this->server_error(_("Couldn't update user record."));
--		}
-+    function new_incoming() {
-+        $user = common_current_user();
-+        
-+        $orig = clone($user);
-+        $user->incomingemail = mail_new_incoming_address();
-+        
-+        if (!$user->updateKeys($orig)) {
-+            common_log_db_error($user, 'UPDATE', __FILE__);
-+            $this->server_error(_("Couldn't update user record."));
-+        }
-hunk ./actions/emailsettings.php 318
--		$this->show_form(_('New incoming email address added.'), TRUE);
--	}
--	
--	function email_exists($email) {
--		$user = common_current_user();
--		$other = User::staticGet('email', $email);
--		if (!$other) {
--			return false;
--		} else {
--			return $other->id != $user->id;
--		}
--	}
-+        $this->show_form(_('New incoming email address added.'), TRUE);
-+    }
-+    
-+    function email_exists($email) {
-+        $user = common_current_user();
-+        $other = User::staticGet('email', $email);
-+        if (!$other) {
-+            return false;
-+        } else {
-+            return $other->id != $user->id;
-+        }
-+    }
-hunk ./actions/facebookhome.php 13
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./actions/facebookhome.php 17
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./actions/facebookhome.php 26
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/facebookhome.php 29
--		$this->login();
--	}
-+        $this->login();
-+    }
-hunk ./actions/facebookhome.php 32
--	function login() {
-+    function login() {
-hunk ./actions/facebookhome.php 34
--		$user = null;
-+        $user = null;
-hunk ./actions/facebookhome.php 36
--		$facebook = $this->get_facebook();
--		$fbuid = $facebook->require_login();
-+        $facebook = $this->get_facebook();
-+        $fbuid = $facebook->require_login();
-hunk ./actions/facebookhome.php 39
--		# check to see whether there's already a Facebook link for this user
--		$flink = Foreign_link::getByForeignID($fbuid, 2); // 2 == Facebook
-+        # check to see whether there's already a Facebook link for this user
-+        $flink = Foreign_link::getByForeignID($fbuid, 2); // 2 == Facebook
-hunk ./actions/facebookhome.php 42
--		if ($flink) {
-+        if ($flink) {
-hunk ./actions/facebookhome.php 44
--			$user = $flink->getUser();
--			$this->show_home($facebook, $fbuid, $user);
-+            $user = $flink->getUser();
-+            $this->show_home($facebook, $fbuid, $user);
-hunk ./actions/facebookhome.php 47
--		} else {
-+        } else {
-hunk ./actions/facebookhome.php 49
--			# Make the user put in her Laconica creds
--			$nickname = common_canonical_nickname($this->trimmed('nickname'));
--			$password = $this->arg('password');
-+            # Make the user put in her Laconica creds
-+            $nickname = common_canonical_nickname($this->trimmed('nickname'));
-+            $password = $this->arg('password');
-hunk ./actions/facebookhome.php 53
--			if ($nickname) {
-+            if ($nickname) {
-hunk ./actions/facebookhome.php 55
--				if (common_check_user($nickname, $password)) {
-+                if (common_check_user($nickname, $password)) {
-hunk ./actions/facebookhome.php 58
--					$user = User::staticGet('nickname', $nickname);
-+                    $user = User::staticGet('nickname', $nickname);
-hunk ./actions/facebookhome.php 60
--					if (!$user) {
--						echo '<fb:error message="Coudln\'t get user!" />';
--						$this->show_login_form();
--					}
-+                    if (!$user) {
-+                        echo '<fb:error message="Coudln\'t get user!" />';
-+                        $this->show_login_form();
-+                    }
-hunk ./actions/facebookhome.php 65
--					$flink = DB_DataObject::factory('foreign_link');
--					$flink->user_id = $user->id;
--					$flink->foreign_id = $fbuid;
--					$flink->service = 2; # Facebook
--					$flink->created = common_sql_now();
-+                    $flink = DB_DataObject::factory('foreign_link');
-+                    $flink->user_id = $user->id;
-+                    $flink->foreign_id = $fbuid;
-+                    $flink->service = 2; # Facebook
-+                    $flink->created = common_sql_now();
-hunk ./actions/facebookhome.php 71
--					# $this->set_flags($flink, $noticesync, $replysync, $friendsync);
-+                    # $this->set_flags($flink, $noticesync, $replysync, $friendsync);
-hunk ./actions/facebookhome.php 73
--					$flink_id = $flink->insert();
-+                    $flink_id = $flink->insert();
-hunk ./actions/facebookhome.php 75
--					if ($flink_id) {
--						echo '<fb:success message="You can now use the Identi.ca from Facebook!" />';
--					}
-+                    if ($flink_id) {
-+                        echo '<fb:success message="You can now use the Identi.ca from Facebook!" />';
-+                    }
-hunk ./actions/facebookhome.php 79
--					$this->show_home($facebook, $fbuid, $user);
-+                    $this->show_home($facebook, $fbuid, $user);
-hunk ./actions/facebookhome.php 81
--					return;
--				} else {
--					echo '<fb:error message="Incorrect username or password." />';
--				}
--			}
-+                    return;
-+                } else {
-+                    echo '<fb:error message="Incorrect username or password." />';
-+                }
-+            }
-hunk ./actions/facebookhome.php 87
--			$this->show_login_form();
--		}
-+            $this->show_login_form();
-+        }
-hunk ./actions/facebookhome.php 90
--	}
-+    }
-hunk ./actions/facebookhome.php 92
--	function show_home($facebook, $fbuid, $user) {
-+    function show_home($facebook, $fbuid, $user) {
-hunk ./actions/facebookhome.php 94
--		$this->show_header('Home');
-+        $this->show_header('Home');
-hunk ./actions/facebookhome.php 96
--		echo $this->show_notices($user);
--		$this->update_profile_box($facebook, $fbuid, $user);
-+        echo $this->show_notices($user);
-+        $this->update_profile_box($facebook, $fbuid, $user);
-hunk ./actions/facebookhome.php 99
--		$this->show_footer();
--	}
-+        $this->show_footer();
-+    }
-hunk ./actions/facebookhome.php 102
--	function show_notices($user) {
-+    function show_notices($user) {
-hunk ./actions/facebookhome.php 104
--		$page = $this->trimmed('page');
--		if (!$page) {
--			$page = 1;
--		}
-+        $page = $this->trimmed('page');
-+        if (!$page) {
-+            $page = 1;
-+        }
-hunk ./actions/facebookhome.php 109
--		$notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
-+        $notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
-hunk ./actions/facebookhome.php 111
--		echo '<ul id="notices">';
-+        echo '<ul id="notices">';
-hunk ./actions/facebookhome.php 113
--		$cnt = 0;
-+        $cnt = 0;
-hunk ./actions/facebookhome.php 115
--		while ($notice->fetch() && $cnt <= NOTICES_PER_PAGE) {
--			$cnt++;
-+        while ($notice->fetch() && $cnt <= NOTICES_PER_PAGE) {
-+            $cnt++;
-hunk ./actions/facebookhome.php 118
--			if ($cnt > NOTICES_PER_PAGE) {
--				break;
--			}
-+            if ($cnt > NOTICES_PER_PAGE) {
-+                break;
-+            }
-hunk ./actions/facebookhome.php 122
--			echo $this->render_notice($notice);
--		}
-+            echo $this->render_notice($notice);
-+        }
-hunk ./actions/facebookhome.php 125
--		echo '<ul>';
-+        echo '<ul>';
-hunk ./actions/facebookhome.php 127
--		$this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
--						  $page, 'index.php', array('nickname' => $user->nickname));
-+        $this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
-+                          $page, 'index.php', array('nickname' => $user->nickname));
-hunk ./actions/facebookhome.php 130
--	}
-+    }
-hunk ./actions/facebookinvite.php 13
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./actions/facebookinvite.php 17
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./actions/facebookinvite.php 26
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/facebookinvite.php 29
--		$this->display();
--	}
-+        $this->display();
-+    }
-hunk ./actions/facebookinvite.php 32
--	function display() {
-+    function display() {
-hunk ./actions/facebookinvite.php 34
--		$facebook = $this->get_facebook();
-+        $facebook = $this->get_facebook();
-hunk ./actions/facebookinvite.php 36
--		$fbuid = $facebook->require_login();
-+        $fbuid = $facebook->require_login();
-hunk ./actions/facebookinvite.php 38
--		$this->show_header('Invite');
-+        $this->show_header('Invite');
-hunk ./actions/facebookinvite.php 40
--		echo '<h2>Coming soon...</h2>';
-+        echo '<h2>Coming soon...</h2>';
-hunk ./actions/facebookinvite.php 42
--		$this->show_footer();
-+        $this->show_footer();
-hunk ./actions/facebookinvite.php 44
--	}
-+    }
-hunk ./actions/facebookremove.php 13
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./actions/facebookremove.php 17
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./actions/facebookremove.php 26
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/facebookremove.php 29
--		$secret = common_config('facebook', 'secret');
-+        $secret = common_config('facebook', 'secret');
-hunk ./actions/facebookremove.php 31
--		$sig = '';
-+        $sig = '';
-hunk ./actions/facebookremove.php 33
--		ksort($_POST);
-+        ksort($_POST);
-hunk ./actions/facebookremove.php 35
--		foreach ($_POST as $key => $val) {
--			if (substr($key, 0, 7) == 'fb_sig_') {
--				$sig .= substr($key, 7) . '=' . $val;
--			}
--		 }
-+        foreach ($_POST as $key => $val) {
-+            if (substr($key, 0, 7) == 'fb_sig_') {
-+                $sig .= substr($key, 7) . '=' . $val;
-+            }
-+         }
-hunk ./actions/facebookremove.php 41
--		$sig .= $secret;
--		$verify = md5($sig);
-+        $sig .= $secret;
-+        $verify = md5($sig);
-hunk ./actions/facebookremove.php 44
--		if ($verify == $this->arg('fb_sig')) {
-+        if ($verify == $this->arg('fb_sig')) {
-hunk ./actions/facebookremove.php 46
--			$flink = Foreign_link::getByForeignID($this->arg('fb_sig_user'), 2);
-+            $flink = Foreign_link::getByForeignID($this->arg('fb_sig_user'), 2);
-hunk ./actions/facebookremove.php 48
--			common_debug("Removing foreign link to Facebook - local user ID: $flink->user_id, Facebook ID: $flink->foreign_id");
-+            common_debug("Removing foreign link to Facebook - local user ID: $flink->user_id, Facebook ID: $flink->foreign_id");
-hunk ./actions/facebookremove.php 50
--			$result = $flink->delete();
-+            $result = $flink->delete();
-hunk ./actions/facebookremove.php 52
--			if (!$result) {
--				common_log_db_error($flink, 'DELETE', __FILE__);
--				common_server_error(_('Couldn\'t remove Facebook user.'));
--				return;
--			}
-+            if (!$result) {
-+                common_log_db_error($flink, 'DELETE', __FILE__);
-+                common_server_error(_('Couldn\'t remove Facebook user.'));
-+                return;
-+            }
-hunk ./actions/facebookremove.php 58
--		} else {
--			# Someone bad tried to remove facebook link?
--			common_log(LOG_ERR, "Someone from $_SERVER[REMOTE_ADDR] " .
--				'unsuccessfully tried to remove a foreign link to Facebook!');
--		}
--	}
-+        } else {
-+            # Someone bad tried to remove facebook link?
-+            common_log(LOG_ERR, "Someone from $_SERVER[REMOTE_ADDR] " .
-+                'unsuccessfully tried to remove a foreign link to Facebook!');
-+        }
-+    }
-hunk ./actions/facebooksettings.php 13
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./actions/facebooksettings.php 17
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./actions/facebooksettings.php 26
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/facebooksettings.php 29
--		$this->display();
--	}
-+        $this->display();
-+    }
-hunk ./actions/facebooksettings.php 32
--	function display() {
-+    function display() {
-hunk ./actions/facebooksettings.php 34
--		$facebook = $this->get_facebook();
-+        $facebook = $this->get_facebook();
-hunk ./actions/facebooksettings.php 36
--		$fbuid = $facebook->require_login();
-+        $fbuid = $facebook->require_login();
-hunk ./actions/facebooksettings.php 38
--		$fbml = '<fb:if-section-not-added section="profile">'
--			.'<h2>Add an Identi.ca box to your profile!</h2>'
--			.'<fb:add-section-button section="profile"/>'
--			.'</fb:if-section-not-added>';
-+        $fbml = '<fb:if-section-not-added section="profile">'
-+            .'<h2>Add an Identi.ca box to your profile!</h2>'
-+            .'<fb:add-section-button section="profile"/>'
-+            .'</fb:if-section-not-added>';
-hunk ./actions/facebooksettings.php 44
--		$this->show_header('Settings');
-+        $this->show_header('Settings');
-hunk ./actions/facebooksettings.php 46
--		echo $fbml;
-+        echo $fbml;
-hunk ./actions/facebooksettings.php 48
--		$this->show_footer();
-+        $this->show_footer();
-hunk ./actions/facebooksettings.php 50
--	}
-+    }
-hunk ./actions/favor.php 26
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/favor.php 29
--		if (!common_logged_in()) {
--			common_user_error(_('Not logged in.'));
--			return;
--		}
-+        if (!common_logged_in()) {
-+            common_user_error(_('Not logged in.'));
-+            return;
-+        }
-hunk ./actions/favor.php 34
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/favor.php 36
--		if ($_SERVER['REQUEST_METHOD'] != 'POST') {
--			common_redirect(common_local_url('showfavorites', array('nickname' => $user->nickname)));
--			return;
--		}
-+        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-+            common_redirect(common_local_url('showfavorites', array('nickname' => $user->nickname)));
-+            return;
-+        }
-hunk ./actions/favor.php 41
--		$id = $this->trimmed('notice');
-+        $id = $this->trimmed('notice');
-hunk ./actions/favor.php 43
--		$notice = Notice::staticGet($id);
-+        $notice = Notice::staticGet($id);
-hunk ./actions/favor.php 45
--		# CSRF protection
-+        # CSRF protection
-hunk ./actions/favor.php 47
--		$token = $this->trimmed('token-'.$notice->id);
--		if (!$token || $token != common_session_token()) {
--			$this->client_error(_("There was a problem with your session token. Try again, please."));
--			return;
--		}
-+        $token = $this->trimmed('token-'.$notice->id);
-+        if (!$token || $token != common_session_token()) {
-+            $this->client_error(_("There was a problem with your session token. Try again, please."));
-+            return;
-+        }
-hunk ./actions/favor.php 53
--		if ($user->hasFave($notice)) {
--			$this->client_error(_('This notice is already a favorite!'));
--			return;
--		}
-+        if ($user->hasFave($notice)) {
-+            $this->client_error(_('This notice is already a favorite!'));
-+            return;
-+        }
-hunk ./actions/favor.php 58
--		$fave = Fave::addNew($user, $notice);
-+        $fave = Fave::addNew($user, $notice);
-hunk ./actions/favor.php 60
--		if (!$fave) {
--			$this->server_error(_('Could not create favorite.'));
--			return;
--		}
-+        if (!$fave) {
-+            $this->server_error(_('Could not create favorite.'));
-+            return;
-+        }
-hunk ./actions/favor.php 65
--		$this->notify($fave, $notice, $user);
--		$user->blowFavesCache();
--		
--		if ($this->boolean('ajax')) {
--			common_start_html('text/xml;charset=utf-8', true);
--			common_element_start('head');
--			common_element('title', null, _('Disfavor favorite'));
--			common_element_end('head');
--			common_element_start('body');
--			common_disfavor_form($notice);
--			common_element_end('body');
--			common_element_end('html');
--		} else {
--			common_redirect(common_local_url('showfavorites',
--											 array('nickname' => $user->nickname)));
--		}
--	}
-+        $this->notify($fave, $notice, $user);
-+        $user->blowFavesCache();
-+        
-+        if ($this->boolean('ajax')) {
-+            common_start_html('text/xml;charset=utf-8', true);
-+            common_element_start('head');
-+            common_element('title', null, _('Disfavor favorite'));
-+            common_element_end('head');
-+            common_element_start('body');
-+            common_disfavor_form($notice);
-+            common_element_end('body');
-+            common_element_end('html');
-+        } else {
-+            common_redirect(common_local_url('showfavorites',
-+                                             array('nickname' => $user->nickname)));
-+        }
-+    }
-hunk ./actions/favor.php 83
--	function notify($fave, $notice, $user) {
--	    $other = User::staticGet('id', $notice->profile_id);
--		if ($other && $other->id != $user->id) {
--			if ($other->email && $other->emailnotifyfav) {
--				mail_notify_fave($other, $user, $notice);
--			}
--			# XXX: notify by IM
--			# XXX: notify by SMS
--		}
--	}
-+    function notify($fave, $notice, $user) {
-+        $other = User::staticGet('id', $notice->profile_id);
-+        if ($other && $other->id != $user->id) {
-+            if ($other->email && $other->emailnotifyfav) {
-+                mail_notify_fave($other, $user, $notice);
-+            }
-+            # XXX: notify by IM
-+            # XXX: notify by SMS
-+        }
-+    }
-hunk ./actions/favorited.php 13
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./actions/favorited.php 17
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./actions/favorited.php 26
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/favorited.php 29
--		$page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-+        $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-hunk ./actions/favorited.php 31
--		common_show_header(_('Popular notices'),
--						   array($this, 'show_header'), NULL,
--						   array($this, 'show_top'));
-+        common_show_header(_('Popular notices'),
-+                           array($this, 'show_header'), NULL,
-+                           array($this, 'show_top'));
-hunk ./actions/favorited.php 35
--		$this->show_notices($page);
-+        $this->show_notices($page);
-hunk ./actions/favorited.php 37
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/favorited.php 40
--	function show_top() {
--		$instr = $this->get_instructions();
--		$output = common_markup_to_html($instr);
--		common_element_start('div', 'instructions');
--		common_raw($output);
--		common_element_end('div');
--		$this->public_views_menu();
--	}
-+    function show_top() {
-+        $instr = $this->get_instructions();
-+        $output = common_markup_to_html($instr);
-+        common_element_start('div', 'instructions');
-+        common_raw($output);
-+        common_element_end('div');
-+        $this->public_views_menu();
-+    }
-hunk ./actions/favorited.php 49
--	function show_header() {
-+    function show_header() {
-hunk ./actions/favorited.php 51
--	}
-+    }
-hunk ./actions/favorited.php 53
--	function get_instructions() {
--		return _('Showing recently popular notices');
--	}
-+    function get_instructions() {
-+        return _('Showing recently popular notices');
-+    }
-hunk ./actions/favorited.php 57
--	function show_notices($page) {
-+    function show_notices($page) {
-hunk ./actions/favorited.php 59
--		$qry = 'SELECT notice.*, sum(exp(-(now() - fave.modified) / %s)) as weight ' .
--				'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
--				'GROUP BY fave.notice_id ' .
--				'ORDER BY weight DESC';
-+        $qry = 'SELECT notice.*, sum(exp(-(now() - fave.modified) / %s)) as weight ' .
-+                'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
-+                'GROUP BY fave.notice_id ' .
-+                'ORDER BY weight DESC';
-hunk ./actions/favorited.php 64
--		$offset = ($page - 1) * NOTICES_PER_PAGE;
--		$limit = NOTICES_PER_PAGE + 1;
-+        $offset = ($page - 1) * NOTICES_PER_PAGE;
-+        $limit = NOTICES_PER_PAGE + 1;
-hunk ./actions/favorited.php 67
--		if (common_config('db','type') == 'pgsql') {
--			$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
--		} else {
--			$qry .= ' LIMIT ' . $offset . ', ' . $limit;
--		}
-+        if (common_config('db','type') == 'pgsql') {
-+            $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
-+        } else {
-+            $qry .= ' LIMIT ' . $offset . ', ' . $limit;
-+        }
-hunk ./actions/favorited.php 73
--		# Figure out how to cache this query
-+        # Figure out how to cache this query
-hunk ./actions/favorited.php 75
--		$notice = new Notice;
--		$notice->query(sprintf($qry, common_config('popular', 'dropoff')));
-+        $notice = new Notice;
-+        $notice->query(sprintf($qry, common_config('popular', 'dropoff')));
-hunk ./actions/favorited.php 78
--		common_element_start('ul', array('id' => 'notices'));
-+        common_element_start('ul', array('id' => 'notices'));
-hunk ./actions/favorited.php 80
--		$cnt = 0;
-+        $cnt = 0;
-hunk ./actions/favorited.php 82
--		while ($notice->fetch() && $cnt <= NOTICES_PER_PAGE) {
--			$cnt++;
-+        while ($notice->fetch() && $cnt <= NOTICES_PER_PAGE) {
-+            $cnt++;
-hunk ./actions/favorited.php 85
--			if ($cnt > NOTICES_PER_PAGE) {
--				break;
--			}
-+            if ($cnt > NOTICES_PER_PAGE) {
-+                break;
-+            }
-hunk ./actions/favorited.php 91
--		}
-+        }
-hunk ./actions/favorited.php 93
--		common_element_end('ul');
-+        common_element_end('ul');
-hunk ./actions/favorited.php 95
--		common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
--						  $page, 'favorited');
--	}
-+        common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
-+                          $page, 'favorited');
-+    }
+-        common_element('h2', NULL, _('Address'));
++        common_element('h2', null, _('Address'));
+hunk ./actions/emailsettings.php 61
+-                             ($this->arg('email')) ? $this->arg('email') : NULL,
++                             ($this->arg('email')) ? $this->arg('email') : null,
+hunk ./actions/emailsettings.php 68
+-            common_element('h2', NULL, _('Incoming email'));
++            common_element('h2', null, _('Incoming email'));
+hunk ./actions/emailsettings.php 86
+-        common_element('h2', NULL, _('Preferences'));
++        common_element('h2', null, _('Preferences'));
+hunk ./actions/emailsettings.php 121
+-            return NULL;
++            return null;
+hunk ./actions/emailsettings.php 276
+-        $user->email = NULL;
++        $user->email = null;
+hunk ./actions/emailsettings.php 297
+-        $user->incomingemail = NULL;
++        $user->incomingemail = null;
+hunk ./actions/favorited.php 32
+-                           array($this, 'show_header'), NULL,
++                           array($this, 'show_header'), null,
 hunk ./actions/favoritesrss.php 28
--	var $user = NULL;
--	
--	function init() {
--		$nickname = $this->trimmed('nickname');
--		$this->user = User::staticGet('nickname', $nickname);
-+    var $user = NULL;
-+    
-+    function init() {
-+        $nickname = $this->trimmed('nickname');
-+        $this->user = User::staticGet('nickname', $nickname);
-hunk ./actions/favoritesrss.php 34
--		if (!$this->user) {
--			common_user_error(_('No such user.'));
--			return false;
--		} else {
--			return true;
--		}
--	}
-+        if (!$this->user) {
-+            common_user_error(_('No such user.'));
-+            return false;
-+        } else {
-+            return true;
-+        }
-+    }
-hunk ./actions/favoritesrss.php 42
--	function get_notices($limit=0) {
-+    function get_notices($limit=0) {
-hunk ./actions/favoritesrss.php 44
--		$user = $this->user;
-+        $user = $this->user;
-hunk ./actions/favoritesrss.php 46
--		$notice = $user->favoriteNotices(0, $limit);
-+        $notice = $user->favoriteNotices(0, $limit);
-hunk ./actions/favoritesrss.php 48
--		$notices = array();
-+        $notices = array();
-hunk ./actions/favoritesrss.php 50
--		while ($notice->fetch()) {
--			$notices[] = clone($notice);
--		}
-+        while ($notice->fetch()) {
-+            $notices[] = clone($notice);
-+        }
-hunk ./actions/favoritesrss.php 54
--		return $notices;
--	}
-+        return $notices;
-+    }
-hunk ./actions/favoritesrss.php 57
--	function get_channel() {
--		$user = $this->user;
--		$c = array('url' => common_local_url('favoritesrss',
--											 array('nickname' =>
--												   $user->nickname)),
--				   'title' => sprintf(_("%s favorite notices"), $user->nickname),
--				   'link' => common_local_url('showfavorites',
--											 array('nickname' =>
--												   $user->nickname)),
--				   'description' => sprintf(_('Feed of favorite notices of %s'), $user->nickname));
--		return $c;
--	}
-+    function get_channel() {
-+        $user = $this->user;
-+        $c = array('url' => common_local_url('favoritesrss',
-+                                             array('nickname' =>
-+                                                   $user->nickname)),
-+                   'title' => sprintf(_("%s favorite notices"), $user->nickname),
-+                   'link' => common_local_url('showfavorites',
-+                                             array('nickname' =>
-+                                                   $user->nickname)),
-+                   'description' => sprintf(_('Feed of favorite notices of %s'), $user->nickname));
-+        return $c;
-+    }
-hunk ./actions/favoritesrss.php 70
--	function get_image() {
--		return NULL;
--	}
-+    function get_image() {
-+        return NULL;
-+    }
-hunk ./actions/featured.php 13
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./actions/featured.php 17
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./actions/featured.php 27
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/featured.php 30
--		$page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-+        $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-hunk ./actions/featured.php 32
--		common_show_header(_('Featured users'),
--						   array($this, 'show_header'), NULL,
--						   array($this, 'show_top'));
-+        common_show_header(_('Featured users'),
-+                           array($this, 'show_header'), NULL,
-+                           array($this, 'show_top'));
-hunk ./actions/featured.php 36
--		$this->show_notices($page);
-+        $this->show_notices($page);
-hunk ./actions/featured.php 38
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/featured.php 41
--	function show_top() {
--		$instr = $this->get_instructions();
--		$output = common_markup_to_html($instr);
--		common_element_start('div', 'instructions');
--		common_raw($output);
--		common_element_end('div');
--		$this->public_views_menu();
--	}
-+    function show_top() {
-+        $instr = $this->get_instructions();
-+        $output = common_markup_to_html($instr);
-+        common_element_start('div', 'instructions');
-+        common_raw($output);
-+        common_element_end('div');
-+        $this->public_views_menu();
-+    }
-hunk ./actions/featured.php 50
--	function show_header() {
--	}
-+    function show_header() {
-+    }
-hunk ./actions/featured.php 53
--	function get_instructions() {
--		return _('Featured users');
--	}
-+    function get_instructions() {
-+        return _('Featured users');
-+    }
-hunk ./actions/featured.php 57
--	function show_notices($page) {
-+    function show_notices($page) {
-hunk ./actions/featured.php 59
--		// XXX: Note I'm doing it this two-stage way because a raw query
--		// with a JOIN was *not* working. --Zach
-+        // XXX: Note I'm doing it this two-stage way because a raw query
-+        // with a JOIN was *not* working. --Zach
-hunk ./actions/featured.php 62
--		$featured_nicks = common_config('nickname', 'featured');
-+        $featured_nicks = common_config('nickname', 'featured');
-hunk ./actions/featured.php 64
--		if (count($featured_nicks) > 0) {
-+        if (count($featured_nicks) > 0) {
-hunk ./actions/featured.php 66
--			$quoted = array();
-+            $quoted = array();
-hunk ./actions/featured.php 68
--			foreach ($featured_nicks as $nick) {
--				$quoted[] = "'$nick'";
--			}
-+            foreach ($featured_nicks as $nick) {
-+                $quoted[] = "'$nick'";
-+            }
-hunk ./actions/featured.php 72
--			$user = new User;
--			$user->whereAdd(sprintf('nickname IN (%s)', implode(',', $quoted)));
--			$user->limit(($page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
--			$user->orderBy('user.nickname ASC');
-+            $user = new User;
-+            $user->whereAdd(sprintf('nickname IN (%s)', implode(',', $quoted)));
-+            $user->limit(($page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
-+            $user->orderBy('user.nickname ASC');
-hunk ./actions/featured.php 77
--			$user->find();
-+            $user->find();
-hunk ./actions/featured.php 79
--			$profile_ids = array();
-+            $profile_ids = array();
-hunk ./actions/featured.php 81
--			while ($user->fetch()) {
--				$profile_ids[] = $user->id;
--			}
-+            while ($user->fetch()) {
-+                $profile_ids[] = $user->id;
-+            }
-hunk ./actions/featured.php 85
--			$profile = new Profile;
--			$profile->whereAdd(sprintf('profile.id IN (%s)', implode(',', $profile_ids)));
--			$profile->orderBy('nickname ASC');
-+            $profile = new Profile;
-+            $profile->whereAdd(sprintf('profile.id IN (%s)', implode(',', $profile_ids)));
-+            $profile->orderBy('nickname ASC');
-hunk ./actions/featured.php 89
--			$cnt = $profile->find();
-+            $cnt = $profile->find();
-hunk ./actions/featured.php 91
--			if ($cnt > 0) {
--				$featured = new ProfileList($profile);
--				$featured->show_list();
--			}
-+            if ($cnt > 0) {
-+                $featured = new ProfileList($profile);
-+                $featured->show_list();
-+            }
-hunk ./actions/featured.php 96
--			$profile->free();
-+            $profile->free();
-hunk ./actions/featured.php 98
--			common_pagination($page > 1, $cnt > PROFILES_PER_PAGE, $page, 'featured');
--		}
--	}
-+            common_pagination($page > 1, $cnt > PROFILES_PER_PAGE, $page, 'featured');
-+        }
-+    }
-hunk ./actions/finishaddopenid.php 26
--	function handle($args) {
--		parent::handle($args);
--		if (!common_logged_in()) {
--			common_user_error(_('Not logged in.'));
--		} else {
--			$this->try_login();
--		}
--	}
--	
--	function try_login() {
-+    function handle($args) {
-+        parent::handle($args);
-+        if (!common_logged_in()) {
-+            common_user_error(_('Not logged in.'));
-+        } else {
-+            $this->try_login();
-+        }
-+    }
-+    
-+    function try_login() {
-hunk ./actions/finishaddopenid.php 37
--		$consumer =& oid_consumer();
-+        $consumer =& oid_consumer();
-hunk ./actions/finishaddopenid.php 39
--		$response = $consumer->complete(common_local_url('finishaddopenid'));
-+        $response = $consumer->complete(common_local_url('finishaddopenid'));
-hunk ./actions/finishaddopenid.php 41
--		if ($response->status == Auth_OpenID_CANCEL) {
--			$this->message(_('OpenID authentication cancelled.'));
--			return;
--		} else if ($response->status == Auth_OpenID_FAILURE) {
--			// Authentication failed; display the error message.
--			$this->message(sprintf(_('OpenID authentication failed: %s'), $response->message));
--		} else if ($response->status == Auth_OpenID_SUCCESS) {
-+        if ($response->status == Auth_OpenID_CANCEL) {
-+            $this->message(_('OpenID authentication cancelled.'));
-+            return;
-+        } else if ($response->status == Auth_OpenID_FAILURE) {
-+            // Authentication failed; display the error message.
-+            $this->message(sprintf(_('OpenID authentication failed: %s'), $response->message));
-+        } else if ($response->status == Auth_OpenID_SUCCESS) {
-hunk ./actions/finishaddopenid.php 49
--			$display = $response->getDisplayIdentifier();
--			$canonical = ($response->endpoint && $response->endpoint->canonicalID) ?
--			  $response->endpoint->canonicalID : $display;
-+            $display = $response->getDisplayIdentifier();
-+            $canonical = ($response->endpoint && $response->endpoint->canonicalID) ?
-+              $response->endpoint->canonicalID : $display;
-hunk ./actions/finishaddopenid.php 53
--			$sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response);
-+            $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response);
-hunk ./actions/finishaddopenid.php 55
--			if ($sreg_resp) {
--				$sreg = $sreg_resp->contents();
--			}
-+            if ($sreg_resp) {
-+                $sreg = $sreg_resp->contents();
-+            }
-hunk ./actions/finishaddopenid.php 59
--			$cur =& common_current_user();
--			$other = oid_get_user($canonical);
-+            $cur =& common_current_user();
-+            $other = oid_get_user($canonical);
-hunk ./actions/finishaddopenid.php 62
--			if ($other) {
--				if ($other->id == $cur->id) {
--					$this->message(_('You already have this OpenID!'));
--				} else {
--					$this->message(_('Someone else already has this OpenID.'));
--				}
--				return;
--			}
-+            if ($other) {
-+                if ($other->id == $cur->id) {
-+                    $this->message(_('You already have this OpenID!'));
-+                } else {
-+                    $this->message(_('Someone else already has this OpenID.'));
-+                }
-+                return;
-+            }
-hunk ./actions/finishaddopenid.php 71
--			# start a transaction
-+            # start a transaction
-hunk ./actions/finishaddopenid.php 73
--			$cur->query('BEGIN');
-+            $cur->query('BEGIN');
-hunk ./actions/finishaddopenid.php 75
--			$result = oid_link_user($cur->id, $canonical, $display);
-+            $result = oid_link_user($cur->id, $canonical, $display);
-hunk ./actions/finishaddopenid.php 77
--			if (!$result) {
--				$this->message(_('Error connecting user.'));
--				return;
--			}
--			if ($sreg) {
--				if (!oid_update_user($cur, $sreg)) {
--					$this->message(_('Error updating profile'));
--					return;
--				}
--			}
-+            if (!$result) {
-+                $this->message(_('Error connecting user.'));
-+                return;
-+            }
-+            if ($sreg) {
-+                if (!oid_update_user($cur, $sreg)) {
-+                    $this->message(_('Error updating profile'));
-+                    return;
-+                }
-+            }
-hunk ./actions/finishaddopenid.php 88
--			# success!
-+            # success!
-hunk ./actions/finishaddopenid.php 90
--			$cur->query('COMMIT');
-+            $cur->query('COMMIT');
-hunk ./actions/finishaddopenid.php 92
--			oid_set_last($display);
-+            oid_set_last($display);
-hunk ./actions/finishaddopenid.php 94
--			common_redirect(common_local_url('openidsettings'));
--		}
--	}
-+            common_redirect(common_local_url('openidsettings'));
-+        }
-+    }
-hunk ./actions/finishaddopenid.php 98
--	function message($msg) {
--		common_show_header(_('OpenID Login'));
--		common_element('p', NULL, $msg);
--		common_show_footer();
--	}
-+    function message($msg) {
-+        common_show_header(_('OpenID Login'));
-+        common_element('p', NULL, $msg);
-+        common_show_footer();
-+    }
-hunk ./actions/finishimmediate.php 26
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/finishimmediate.php 29
--		$consumer = oid_consumer();
-+        $consumer = oid_consumer();
-hunk ./actions/finishimmediate.php 31
--		$response = $consumer->complete(common_local_url('finishimmediate'));
-+        $response = $consumer->complete(common_local_url('finishimmediate'));
-hunk ./actions/finishimmediate.php 33
--		if ($response->status == Auth_OpenID_SUCCESS) {
--			$display = $response->getDisplayIdentifier();
--			$canonical = ($response->endpoint->canonicalID) ?
--			  $response->endpoint->canonicalID : $response->getDisplayIdentifier();
-+        if ($response->status == Auth_OpenID_SUCCESS) {
-+            $display = $response->getDisplayIdentifier();
-+            $canonical = ($response->endpoint->canonicalID) ?
-+              $response->endpoint->canonicalID : $response->getDisplayIdentifier();
-hunk ./actions/finishimmediate.php 38
--			$user = oid_get_user($canonical);
-+            $user = oid_get_user($canonical);
-hunk ./actions/finishimmediate.php 40
--			if ($user) {
--				oid_update_user($user, $sreg);
--				oid_set_last($display); # refresh for another year
--				common_set_user($user->nickname);
--				$this->go_backto();
--				return;
--			}
--		}
-+            if ($user) {
-+                oid_update_user($user, $sreg);
-+                oid_set_last($display); # refresh for another year
-+                common_set_user($user->nickname);
-+                $this->go_backto();
-+                return;
-+            }
-+        }
-hunk ./actions/finishimmediate.php 49
--		# Failure! Clear openid so we don't try it again
-+        # Failure! Clear openid so we don't try it again
-hunk ./actions/finishimmediate.php 51
--		oid_clear_last();
--		$this->go_backto();
--		return;
--	}
-+        oid_clear_last();
-+        $this->go_backto();
-+        return;
-+    }
-hunk ./actions/finishimmediate.php 56
--	function go_backto() {
--		common_ensure_session();
--		$backto = $_SESSION['openid_immediate_backto'];
--		if (!$backto) {
--			# gar. Well, push them to the public page
--			$backto = common_local_url('public');
--		}
--		common_redirect($backto);
--	}
-+    function go_backto() {
-+        common_ensure_session();
-+        $backto = $_SESSION['openid_immediate_backto'];
-+        if (!$backto) {
-+            # gar. Well, push them to the public page
-+            $backto = common_local_url('public');
-+        }
-+        common_redirect($backto);
-+    }
-hunk ./actions/finishopenidlogin.php 26
--	function handle($args) {
--		parent::handle($args);
--		if (common_logged_in()) {
--			common_user_error(_('Already logged in.'));
--		} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
--			$token = $this->trimmed('token');
--			if (!$token || $token != common_session_token()) {
--				$this->show_form(_('There was a problem with your session token. Try again, please.'));
--				return;
--			}
--			if ($this->arg('create')) {
--				if (!$this->boolean('license')) {
--					$this->show_form(_('You can\'t register if you don\'t agree to the license.'),
--									 $this->trimmed('newname'));
--					return;
--				}
--				$this->create_new_user();
--			} else if ($this->arg('connect')) {
--				$this->connect_user();
--			} else {
--				common_debug(print_r($this->args, true), __FILE__);
--				$this->show_form(_('Something weird happened.'),
--								 $this->trimmed('newname'));
--			}
--		} else {
--			$this->try_login();
--		}
--	}
-+    function handle($args) {
-+        parent::handle($args);
-+        if (common_logged_in()) {
-+            common_user_error(_('Already logged in.'));
-+        } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-+            $token = $this->trimmed('token');
-+            if (!$token || $token != common_session_token()) {
-+                $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+                return;
-+            }
-+            if ($this->arg('create')) {
-+                if (!$this->boolean('license')) {
-+                    $this->show_form(_('You can\'t register if you don\'t agree to the license.'),
-+                                     $this->trimmed('newname'));
-+                    return;
-+                }
-+                $this->create_new_user();
-+            } else if ($this->arg('connect')) {
-+                $this->connect_user();
-+            } else {
-+                common_debug(print_r($this->args, true), __FILE__);
-+                $this->show_form(_('Something weird happened.'),
-+                                 $this->trimmed('newname'));
-+            }
-+        } else {
-+            $this->try_login();
-+        }
-+    }
+-    var $user = NULL;
++    var $user = null;
+hunk ./actions/favoritesrss.php 71
+-        return NULL;
++        return null;
+hunk ./actions/featured.php 33
+-                           array($this, 'show_header'), NULL,
++                           array($this, 'show_header'), null,
+hunk ./actions/finishaddopenid.php 100
+-        common_element('p', NULL, $msg);
++        common_element('p', null, $msg);
 hunk ./actions/finishopenidlogin.php 55
--	function show_top($error=NULL) {
--		if ($error) {
--			common_element('div', array('class' => 'error'), $error);
--		} else {
--			global $config;
--			common_element('div', 'instructions',
--						   sprintf(_('This is the first time you\'ve logged into %s so we must connect your OpenID to a local account. You can either create a new account, or connect with your existing account, if you have one.'), $config['site']['name']));
--		}
--	}
-+    function show_top($error=NULL) {
-+        if ($error) {
-+            common_element('div', array('class' => 'error'), $error);
-+        } else {
-+            global $config;
-+            common_element('div', 'instructions',
-+                           sprintf(_('This is the first time you\'ve logged into %s so we must connect your OpenID to a local account. You can either create a new account, or connect with your existing account, if you have one.'), $config['site']['name']));
-+        }
-+    }
+-    function show_top($error=NULL) {
++    function show_top($error=null) {
 hunk ./actions/finishopenidlogin.php 65
--	function show_form($error=NULL, $username=NULL) {
--		common_show_header(_('OpenID Account Setup'), NULL, $error,
--						   array($this, 'show_top'));
-+    function show_form($error=NULL, $username=NULL) {
-+        common_show_header(_('OpenID Account Setup'), NULL, $error,
-+                           array($this, 'show_top'));
-hunk ./actions/finishopenidlogin.php 69
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'account_connect',
--										   'action' => common_local_url('finishopenidlogin')));
--		common_hidden('token', common_session_token());
--		common_element('h2', NULL,
--					   _('Create new account'));
--		common_element('p', NULL,
--					   _('Create a new user with this nickname.'));
--		common_input('newname', _('New nickname'),
--					 ($username) ? $username : '',
--					 _('1-64 lowercase letters or numbers, no punctuation or spaces'));
--		common_element_start('p');
--		common_element('input', array('type' => 'checkbox',
--									  'id' => 'license',
--									  'name' => 'license',
--									  'value' => 'true'));
--		common_text(_('My text and files are available under '));
--		common_element('a', array(href => common_config('license', 'url')),
--					   common_config('license', 'title'));
--		common_text(_(' except this private data: password, email address, IM address, phone number.'));
--		common_element_end('p');
--		common_submit('create', _('Create'));
--		common_element('h2', NULL,
--					   _('Connect existing account'));
--		common_element('p', NULL,
--					   _('If you already have an account, login with your username and password to connect it to your OpenID.'));
--		common_input('nickname', _('Existing nickname'));
--		common_password('password', _('Password'));
--		common_submit('connect', _('Connect'));
--		common_element_end('form');
--		common_show_footer();
--	}
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'account_connect',
-+                                           'action' => common_local_url('finishopenidlogin')));
-+        common_hidden('token', common_session_token());
-+        common_element('h2', NULL,
-+                       _('Create new account'));
-+        common_element('p', NULL,
-+                       _('Create a new user with this nickname.'));
-+        common_input('newname', _('New nickname'),
-+                     ($username) ? $username : '',
-+                     _('1-64 lowercase letters or numbers, no punctuation or spaces'));
-+        common_element_start('p');
-+        common_element('input', array('type' => 'checkbox',
-+                                      'id' => 'license',
-+                                      'name' => 'license',
-+                                      'value' => 'true'));
-+        common_text(_('My text and files are available under '));
-+        common_element('a', array(href => common_config('license', 'url')),
-+                       common_config('license', 'title'));
-+        common_text(_(' except this private data: password, email address, IM address, phone number.'));
-+        common_element_end('p');
-+        common_submit('create', _('Create'));
-+        common_element('h2', NULL,
-+                       _('Connect existing account'));
-+        common_element('p', NULL,
-+                       _('If you already have an account, login with your username and password to connect it to your OpenID.'));
-+        common_input('nickname', _('Existing nickname'));
-+        common_password('password', _('Password'));
-+        common_submit('connect', _('Connect'));
-+        common_element_end('form');
-+        common_show_footer();
-+    }
-hunk ./actions/finishopenidlogin.php 102
--	function try_login() {
-+    function try_login() {
-hunk ./actions/finishopenidlogin.php 104
--		$consumer = oid_consumer();
-+        $consumer = oid_consumer();
-hunk ./actions/finishopenidlogin.php 106
--		$response = $consumer->complete(common_local_url('finishopenidlogin'));
-+        $response = $consumer->complete(common_local_url('finishopenidlogin'));
-hunk ./actions/finishopenidlogin.php 108
--		if ($response->status == Auth_OpenID_CANCEL) {
--			$this->message(_('OpenID authentication cancelled.'));
--			return;
--		} else if ($response->status == Auth_OpenID_FAILURE) {
--			// Authentication failed; display the error message.
--			$this->message(sprintf(_('OpenID authentication failed: %s'), $response->message));
--		} else if ($response->status == Auth_OpenID_SUCCESS) {
--			// This means the authentication succeeded; extract the
--			// identity URL and Simple Registration data (if it was
--			// returned).
--			$display = $response->getDisplayIdentifier();
--			$canonical = ($response->endpoint->canonicalID) ?
--			  $response->endpoint->canonicalID : $response->getDisplayIdentifier();
-+        if ($response->status == Auth_OpenID_CANCEL) {
-+            $this->message(_('OpenID authentication cancelled.'));
-+            return;
-+        } else if ($response->status == Auth_OpenID_FAILURE) {
-+            // Authentication failed; display the error message.
-+            $this->message(sprintf(_('OpenID authentication failed: %s'), $response->message));
-+        } else if ($response->status == Auth_OpenID_SUCCESS) {
-+            // This means the authentication succeeded; extract the
-+            // identity URL and Simple Registration data (if it was
-+            // returned).
-+            $display = $response->getDisplayIdentifier();
-+            $canonical = ($response->endpoint->canonicalID) ?
-+              $response->endpoint->canonicalID : $response->getDisplayIdentifier();
-hunk ./actions/finishopenidlogin.php 122
--			$sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response);
-+            $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response);
-hunk ./actions/finishopenidlogin.php 124
--			if ($sreg_resp) {
--				$sreg = $sreg_resp->contents();
--			}
-+            if ($sreg_resp) {
-+                $sreg = $sreg_resp->contents();
-+            }
-hunk ./actions/finishopenidlogin.php 128
--			$user = oid_get_user($canonical);
-+            $user = oid_get_user($canonical);
-hunk ./actions/finishopenidlogin.php 130
--			if ($user) {
--				oid_set_last($display);
--				# XXX: commented out at @edd's request until better
--				# control over how data flows from OpenID provider.
--				# oid_update_user($user, $sreg);
--				common_set_user($user);
--				common_real_login(true);
--				if (isset($_SESSION['openid_rememberme']) && $_SESSION['openid_rememberme']) {
--					common_rememberme($user);
--				}
-+            if ($user) {
-+                oid_set_last($display);
-+                # XXX: commented out at @edd's request until better
-+                # control over how data flows from OpenID provider.
-+                # oid_update_user($user, $sreg);
-+                common_set_user($user);
-+                common_real_login(true);
-+                if (isset($_SESSION['openid_rememberme']) && $_SESSION['openid_rememberme']) {
-+                    common_rememberme($user);
-+                }
-hunk ./actions/finishopenidlogin.php 141
--				$this->go_home($user->nickname);
--			} else {
--				$this->save_values($display, $canonical, $sreg);
--				$this->show_form(NULL, $this->best_new_nickname($display, $sreg));
--			}
--		}
--	}
-+                $this->go_home($user->nickname);
-+            } else {
-+                $this->save_values($display, $canonical, $sreg);
-+                $this->show_form(NULL, $this->best_new_nickname($display, $sreg));
-+            }
-+        }
-+    }
-hunk ./actions/finishopenidlogin.php 149
--	function message($msg) {
--		common_show_header(_('OpenID Login'));
--		common_element('p', NULL, $msg);
--		common_show_footer();
--	}
-+    function message($msg) {
-+        common_show_header(_('OpenID Login'));
-+        common_element('p', NULL, $msg);
-+        common_show_footer();
-+    }
-hunk ./actions/finishopenidlogin.php 155
--	function save_values($display, $canonical, $sreg) {
--		common_ensure_session();
--		$_SESSION['openid_display'] = $display;
--		$_SESSION['openid_canonical'] = $canonical;
--		$_SESSION['openid_sreg'] = $sreg;
--	}
-+    function save_values($display, $canonical, $sreg) {
-+        common_ensure_session();
-+        $_SESSION['openid_display'] = $display;
-+        $_SESSION['openid_canonical'] = $canonical;
-+        $_SESSION['openid_sreg'] = $sreg;
-+    }
-hunk ./actions/finishopenidlogin.php 162
--	function get_saved_values() {
--		return array($_SESSION['openid_display'],
--					 $_SESSION['openid_canonical'],
--					 $_SESSION['openid_sreg']);
--	}
-+    function get_saved_values() {
-+        return array($_SESSION['openid_display'],
-+                     $_SESSION['openid_canonical'],
-+                     $_SESSION['openid_sreg']);
-+    }
-hunk ./actions/finishopenidlogin.php 168
--	function create_new_user() {
-+    function create_new_user() {
-hunk ./actions/finishopenidlogin.php 172
--		if (common_config('site', 'closed') || common_config('site', 'inviteonly')) {
--			common_user_error(_('Registration not allowed.'));
-+        if (common_config('site', 'closed') || common_config('site', 'inviteonly')) {
-+            common_user_error(_('Registration not allowed.'));
-hunk ./actions/finishopenidlogin.php 177
--		$nickname = $this->trimmed('newname');
-+        $nickname = $this->trimmed('newname');
-hunk ./actions/finishopenidlogin.php 179
--		if (!Validate::string($nickname, array('min_length' => 1,
--											   'max_length' => 64,
--											   'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
--			$this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
--			return;
--		}
-+        if (!Validate::string($nickname, array('min_length' => 1,
-+                                               'max_length' => 64,
-+                                               'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
-+            $this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
-+            return;
-+        }
-hunk ./actions/finishopenidlogin.php 186
--		if (!User::allowed_nickname($nickname)) {
--			$this->show_form(_('Nickname not allowed.'));
--			return;
--		}
-+        if (!User::allowed_nickname($nickname)) {
-+            $this->show_form(_('Nickname not allowed.'));
-+            return;
-+        }
-hunk ./actions/finishopenidlogin.php 191
--		if (User::staticGet('nickname', $nickname)) {
--			$this->show_form(_('Nickname already in use. Try another one.'));
--			return;
--		}
-+        if (User::staticGet('nickname', $nickname)) {
-+            $this->show_form(_('Nickname already in use. Try another one.'));
-+            return;
-+        }
-hunk ./actions/finishopenidlogin.php 196
--		list($display, $canonical, $sreg) = $this->get_saved_values();
-+        list($display, $canonical, $sreg) = $this->get_saved_values();
-hunk ./actions/finishopenidlogin.php 198
--		if (!$display || !$canonical) {
--			common_server_error(_('Stored OpenID not found.'));
--			return;
--		}
-+        if (!$display || !$canonical) {
-+            common_server_error(_('Stored OpenID not found.'));
-+            return;
-+        }
-hunk ./actions/finishopenidlogin.php 203
--		# Possible race condition... let's be paranoid
-+        # Possible race condition... let's be paranoid
-hunk ./actions/finishopenidlogin.php 205
--		$other = oid_get_user($canonical);
-+        $other = oid_get_user($canonical);
-hunk ./actions/finishopenidlogin.php 207
--		if ($other) {
--			common_server_error(_('Creating new account for OpenID that already has a user.'));
--			return;
--		}
-+        if ($other) {
-+            common_server_error(_('Creating new account for OpenID that already has a user.'));
-+            return;
-+        }
-hunk ./actions/finishopenidlogin.php 212
--		if ($sreg['country']) {
--			if ($sreg['postcode']) {
--				# XXX: use postcode to get city and region
--				# XXX: also, store postcode somewhere -- it's valuable!
--				$location = $sreg['postcode'] . ', ' . $sreg['country'];
--			} else {
--				$location = $sreg['country'];
--			}
--		}
-+        if ($sreg['country']) {
-+            if ($sreg['postcode']) {
-+                # XXX: use postcode to get city and region
-+                # XXX: also, store postcode somewhere -- it's valuable!
-+                $location = $sreg['postcode'] . ', ' . $sreg['country'];
-+            } else {
-+                $location = $sreg['country'];
-+            }
-+        }
-hunk ./actions/finishopenidlogin.php 222
--		if ($sreg['fullname'] && strlen($sreg['fullname']) <= 255) {
--			$fullname = $sreg['fullname'];
--		}
-+        if ($sreg['fullname'] && strlen($sreg['fullname']) <= 255) {
-+            $fullname = $sreg['fullname'];
-+        }
-hunk ./actions/finishopenidlogin.php 226
--		if ($sreg['email'] && Validate::email($sreg['email'], true)) {
--			$email = $sreg['email'];
--		}
-+        if ($sreg['email'] && Validate::email($sreg['email'], true)) {
-+            $email = $sreg['email'];
-+        }
-hunk ./actions/finishopenidlogin.php 230
--		# XXX: add language
--		# XXX: add timezone
-+        # XXX: add language
-+        # XXX: add timezone
-hunk ./actions/finishopenidlogin.php 233
--		$user = User::register(array('nickname' => $nickname,
--									 'email' => $email,
--									 'fullname' => $fullname,
--									 'location' => $location));
-+        $user = User::register(array('nickname' => $nickname,
-+                                     'email' => $email,
-+                                     'fullname' => $fullname,
-+                                     'location' => $location));
-hunk ./actions/finishopenidlogin.php 238
--		$result = oid_link_user($user->id, $canonical, $display);
-+        $result = oid_link_user($user->id, $canonical, $display);
-hunk ./actions/finishopenidlogin.php 240
--		oid_set_last($display);
--		common_set_user($user);
--		common_real_login(true);
-+        oid_set_last($display);
-+        common_set_user($user);
-+        common_real_login(true);
-hunk ./actions/finishopenidlogin.php 244
--			common_rememberme($user);
--		}
-+            common_rememberme($user);
-+        }
-hunk ./actions/finishopenidlogin.php 247
--		common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)));
--	}
-+        common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)));
-+    }
-hunk ./actions/finishopenidlogin.php 250
--	function connect_user() {
-+    function connect_user() {
-hunk ./actions/finishopenidlogin.php 252
--		$nickname = $this->trimmed('nickname');
--		$password = $this->trimmed('password');
-+        $nickname = $this->trimmed('nickname');
-+        $password = $this->trimmed('password');
-hunk ./actions/finishopenidlogin.php 255
--		if (!common_check_user($nickname, $password)) {
--			$this->show_form(_('Invalid username or password.'));
--			return;
--		}
-+        if (!common_check_user($nickname, $password)) {
-+            $this->show_form(_('Invalid username or password.'));
-+            return;
-+        }
-hunk ./actions/finishopenidlogin.php 260
--		# They're legit!
-+        # They're legit!
-hunk ./actions/finishopenidlogin.php 262
--		$user = User::staticGet('nickname', $nickname);
-+        $user = User::staticGet('nickname', $nickname);
-hunk ./actions/finishopenidlogin.php 264
--		list($display, $canonical, $sreg) = $this->get_saved_values();
-+        list($display, $canonical, $sreg) = $this->get_saved_values();
-hunk ./actions/finishopenidlogin.php 266
--		if (!$display || !$canonical) {
--			common_server_error(_('Stored OpenID not found.'));
--			return;
--		}
-+        if (!$display || !$canonical) {
-+            common_server_error(_('Stored OpenID not found.'));
-+            return;
-+        }
-hunk ./actions/finishopenidlogin.php 271
--		$result = oid_link_user($user->id, $canonical, $display);
-+        $result = oid_link_user($user->id, $canonical, $display);
-hunk ./actions/finishopenidlogin.php 273
--		if (!$result) {
--			common_server_error(_('Error connecting user to OpenID.'));
--			return;
--		}
-+        if (!$result) {
-+            common_server_error(_('Error connecting user to OpenID.'));
-+            return;
-+        }
-hunk ./actions/finishopenidlogin.php 278
--		oid_update_user($user, $sreg);
--		oid_set_last($display);
--		common_set_user($user);
--		common_real_login(true);
-+        oid_update_user($user, $sreg);
-+        oid_set_last($display);
-+        common_set_user($user);
-+        common_real_login(true);
-hunk ./actions/finishopenidlogin.php 283
--			common_rememberme($user);
--		}
--		unset($_SESSION['openid_rememberme']);
--		$this->go_home($user->nickname);
--	}
-+            common_rememberme($user);
-+        }
-+        unset($_SESSION['openid_rememberme']);
-+        $this->go_home($user->nickname);
-+    }
-hunk ./actions/finishopenidlogin.php 289
--	function go_home($nickname) {
--		$url = common_get_returnto();
--		if ($url) {
--			# We don't have to return to it again
--			common_set_returnto(NULL);
--		} else {
--			$url = common_local_url('all',
--									array('nickname' =>
--										  $nickname));
--		}
--		common_redirect($url);
--	}
-+    function go_home($nickname) {
-+        $url = common_get_returnto();
-+        if ($url) {
-+            # We don't have to return to it again
-+            common_set_returnto(NULL);
-+        } else {
-+            $url = common_local_url('all',
-+                                    array('nickname' =>
-+                                          $nickname));
-+        }
-+        common_redirect($url);
-+    }
-hunk ./actions/finishopenidlogin.php 302
--	function best_new_nickname($display, $sreg) {
-+    function best_new_nickname($display, $sreg) {
-hunk ./actions/finishopenidlogin.php 304
--		# Try the passed-in nickname
-+        # Try the passed-in nickname
-hunk ./actions/finishopenidlogin.php 306
--		if ($sreg['nickname']) {
--			$nickname = $this->nicknamize($sreg['nickname']);
--			if ($this->is_new_nickname($nickname)) {
--				return $nickname;
--			}
--		}
-+        if ($sreg['nickname']) {
-+            $nickname = $this->nicknamize($sreg['nickname']);
-+            if ($this->is_new_nickname($nickname)) {
-+                return $nickname;
-+            }
-+        }
-hunk ./actions/finishopenidlogin.php 313
--		# Try the full name
-+        # Try the full name
-hunk ./actions/finishopenidlogin.php 315
--		if ($sreg['fullname']) {
--			$fullname = $this->nicknamize($sreg['fullname']);
--			if ($this->is_new_nickname($fullname)) {
--				return $fullname;
--			}
--		}
-+        if ($sreg['fullname']) {
-+            $fullname = $this->nicknamize($sreg['fullname']);
-+            if ($this->is_new_nickname($fullname)) {
-+                return $fullname;
-+            }
-+        }
-hunk ./actions/finishopenidlogin.php 322
--		# Try the URL
-+        # Try the URL
-hunk ./actions/finishopenidlogin.php 324
--		$from_url = $this->openid_to_nickname($display);
-+        $from_url = $this->openid_to_nickname($display);
-hunk ./actions/finishopenidlogin.php 326
--		if ($from_url && $this->is_new_nickname($from_url)) {
--			return $from_url;
--		}
-+        if ($from_url && $this->is_new_nickname($from_url)) {
-+            return $from_url;
-+        }
-hunk ./actions/finishopenidlogin.php 330
--		# XXX: others?
-+        # XXX: others?
+-    function show_form($error=NULL, $username=NULL) {
+-        common_show_header(_('OpenID Account Setup'), NULL, $error,
++    function show_form($error=null, $username=null) {
++        common_show_header(_('OpenID Account Setup'), null, $error,
+hunk ./actions/finishopenidlogin.php 73
+-        common_element('h2', NULL,
++        common_element('h2', null,
+hunk ./actions/finishopenidlogin.php 75
+-        common_element('p', NULL,
++        common_element('p', null,
+hunk ./actions/finishopenidlogin.php 91
+-        common_element('h2', NULL,
++        common_element('h2', null,
+hunk ./actions/finishopenidlogin.php 93
+-        common_element('p', NULL,
++        common_element('p', null,
+hunk ./actions/finishopenidlogin.php 144
+-                $this->show_form(NULL, $this->best_new_nickname($display, $sreg));
++                $this->show_form(null, $this->best_new_nickname($display, $sreg));
+hunk ./actions/finishopenidlogin.php 151
+-        common_element('p', NULL, $msg);
++        common_element('p', null, $msg);
+hunk ./actions/finishopenidlogin.php 293
+-            common_set_returnto(NULL);
++            common_set_returnto(null);
 hunk ./actions/finishopenidlogin.php 332
--		return NULL;
--	}
-+        return NULL;
-+    }
-hunk ./actions/finishopenidlogin.php 335
--	function is_new_nickname($str) {
--		if (!Validate::string($str, array('min_length' => 1,
--										  'max_length' => 64,
--										  'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
--			return false;
--		}
--	if (!User::allowed_nickname($str)) {
--			return false;
--		}
--		if (User::staticGet('nickname', $str)) {
--			return false;
--		}
--		return true;
--	}
-+    function is_new_nickname($str) {
-+        if (!Validate::string($str, array('min_length' => 1,
-+                                          'max_length' => 64,
-+                                          'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
-+            return false;
-+        }
-+    if (!User::allowed_nickname($str)) {
-+            return false;
-+        }
-+        if (User::staticGet('nickname', $str)) {
-+            return false;
-+        }
-+        return true;
-+    }
-hunk ./actions/finishopenidlogin.php 350
--	function openid_to_nickname($openid) {
-+    function openid_to_nickname($openid) {
-hunk ./actions/finishopenidlogin.php 352
--			return $this->xri_to_nickname($openid);
--		} else {
--			return $this->url_to_nickname($openid);
--		}
--	}
-+            return $this->xri_to_nickname($openid);
-+        } else {
-+            return $this->url_to_nickname($openid);
-+        }
-+    }
-hunk ./actions/finishopenidlogin.php 358
--	# We try to use an OpenID URL as a legal Laconica user name in this order
--	# 1. Plain hostname, like http://evanp.myopenid.com/
--	# 2. One element in path, like http://profile.typekey.com/EvanProdromou/
--	#    or http://getopenid.com/evanprodromou
-+    # We try to use an OpenID URL as a legal Laconica user name in this order
-+    # 1. Plain hostname, like http://evanp.myopenid.com/
-+    # 2. One element in path, like http://profile.typekey.com/EvanProdromou/
-+    #    or http://getopenid.com/evanprodromou
-hunk ./actions/finishopenidlogin.php 364
--		static $bad = array('query', 'user', 'password', 'port', 'fragment');
-+        static $bad = array('query', 'user', 'password', 'port', 'fragment');
-hunk ./actions/finishopenidlogin.php 366
--	    $parts = parse_url($openid);
-+        $parts = parse_url($openid);
-hunk ./actions/finishopenidlogin.php 368
--		# If any of these parts exist, this won't work
-+        # If any of these parts exist, this won't work
-hunk ./actions/finishopenidlogin.php 370
--		foreach ($bad as $badpart) {
--			if (array_key_exists($badpart, $parts)) {
--				return NULL;
--			}
--		}
-+        foreach ($bad as $badpart) {
-+            if (array_key_exists($badpart, $parts)) {
-+                return NULL;
-+            }
-+        }
-hunk ./actions/finishopenidlogin.php 376
--		# We just have host and/or path
-+        # We just have host and/or path
-hunk ./actions/finishopenidlogin.php 378
--		# If it's just a host...
--		if (array_key_exists('host', $parts) &&
--			(!array_key_exists('path', $parts) || strcmp($parts['path'], '/') == 0))
--		{
--			$hostparts = explode('.', $parts['host']);
-+        # If it's just a host...
-+        if (array_key_exists('host', $parts) &&
-+            (!array_key_exists('path', $parts) || strcmp($parts['path'], '/') == 0))
-+        {
-+            $hostparts = explode('.', $parts['host']);
-hunk ./actions/finishopenidlogin.php 384
--			# Try to catch common idiom of nickname.service.tld
-+            # Try to catch common idiom of nickname.service.tld
-hunk ./actions/finishopenidlogin.php 386
--			if ((count($hostparts) > 2) &&
--				(strlen($hostparts[count($hostparts) - 2]) > 3) && # try to skip .co.uk, .com.au
--				(strcmp($hostparts[0], 'www') != 0))
--			{
--				return $this->nicknamize($hostparts[0]);
--			} else {
--				# Do the whole hostname
--				return $this->nicknamize($parts['host']);
--			}
--		} else {
--			if (array_key_exists('path', $parts)) {
--				# Strip starting, ending slashes
--				$path = preg_replace('@/$@', '', $parts['path']);
--				$path = preg_replace('@^/@', '', $path);
--				if (strpos($path, '/') === false) {
--					return $this->nicknamize($path);
--				}
--			}
--		}
-+            if ((count($hostparts) > 2) &&
-+                (strlen($hostparts[count($hostparts) - 2]) > 3) && # try to skip .co.uk, .com.au
-+                (strcmp($hostparts[0], 'www') != 0))
-+            {
-+                return $this->nicknamize($hostparts[0]);
-+            } else {
-+                # Do the whole hostname
-+                return $this->nicknamize($parts['host']);
-+            }
-+        } else {
-+            if (array_key_exists('path', $parts)) {
-+                # Strip starting, ending slashes
-+                $path = preg_replace('@/$@', '', $parts['path']);
-+                $path = preg_replace('@^/@', '', $path);
-+                if (strpos($path, '/') === false) {
-+                    return $this->nicknamize($path);
-+                }
-+            }
-+        }
+-        return NULL;
++        return null;
+hunk ./actions/finishopenidlogin.php 372
+-                return NULL;
++                return null;
 hunk ./actions/finishopenidlogin.php 406
--		return NULL;
--	}
-+        return NULL;
-+    }
-hunk ./actions/finishopenidlogin.php 409
--	function xri_to_nickname($xri) {
--		$base = $this->xri_base($xri);
-+    function xri_to_nickname($xri) {
-+        $base = $this->xri_base($xri);
-hunk ./actions/finishopenidlogin.php 412
--		if (!$base) {
--			return NULL;
--		} else {
--			# =evan.prodromou
--			# or @gratis*evan.prodromou
--			$parts = explode('*', substr($base, 1));
--			return $this->nicknamize(array_pop($parts));
--		}
--	}
-+        if (!$base) {
-+            return NULL;
-+        } else {
-+            # =evan.prodromou
-+            # or @gratis*evan.prodromou
-+            $parts = explode('*', substr($base, 1));
-+            return $this->nicknamize(array_pop($parts));
-+        }
-+    }
-hunk ./actions/finishopenidlogin.php 422
--	function xri_base($xri) {
--		if (substr($xri, 0, 6) == 'xri://') {
--			return substr($xri, 6);
--		} else {
--			return $xri;
--		}
--	}
-+    function xri_base($xri) {
-+        if (substr($xri, 0, 6) == 'xri://') {
-+            return substr($xri, 6);
-+        } else {
-+            return $xri;
-+        }
-+    }
-hunk ./actions/finishopenidlogin.php 430
--	# Given a string, try to make it work as a nickname
-+    # Given a string, try to make it work as a nickname
-hunk ./actions/finishopenidlogin.php 432
--	function nicknamize($str) {
--		$str = preg_replace('/\W/', '', $str);
--		return strtolower($str);
--	}
-+    function nicknamize($str) {
-+        $str = preg_replace('/\W/', '', $str);
-+        return strtolower($str);
-+    }
-hunk ./actions/finishremotesubscribe.php 26
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/finishremotesubscribe.php 28
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/finishremotesubscribe.php 30
--		if (common_logged_in()) {
--			common_user_error(_('You can use the local subscription!'));
--		    return;
--		}
-+        if (common_logged_in()) {
-+            common_user_error(_('You can use the local subscription!'));
-+            return;
-+        }
-hunk ./actions/finishremotesubscribe.php 35
--		$omb = $_SESSION['oauth_authorization_request'];
-+        $omb = $_SESSION['oauth_authorization_request'];
-hunk ./actions/finishremotesubscribe.php 37
--		if (!$omb) {
--			common_user_error(_('Not expecting this response!'));
--			return;
--		}
-+        if (!$omb) {
-+            common_user_error(_('Not expecting this response!'));
-+            return;
-+        }
-hunk ./actions/finishremotesubscribe.php 42
--		common_debug('stored request: '.print_r($omb,true), __FILE__);
-+        common_debug('stored request: '.print_r($omb,true), __FILE__);
-hunk ./actions/finishremotesubscribe.php 44
--		common_remove_magic_from_request();
--		$req = OAuthRequest::from_request();
-+        common_remove_magic_from_request();
-+        $req = OAuthRequest::from_request();
-hunk ./actions/finishremotesubscribe.php 47
--		$token = $req->get_parameter('oauth_token');
-+        $token = $req->get_parameter('oauth_token');
-hunk ./actions/finishremotesubscribe.php 49
--		# I think this is the success metric
-+        # I think this is the success metric
-hunk ./actions/finishremotesubscribe.php 51
--		if ($token != $omb['token']) {
--			common_user_error(_('Not authorized.'));
--			return;
--		}
-+        if ($token != $omb['token']) {
-+            common_user_error(_('Not authorized.'));
-+            return;
-+        }
-hunk ./actions/finishremotesubscribe.php 56
--		$version = $req->get_parameter('omb_version');
-+        $version = $req->get_parameter('omb_version');
-hunk ./actions/finishremotesubscribe.php 58
--		if ($version != OMB_VERSION_01) {
--			common_user_error(_('Unknown version of OMB protocol.'));
--			return;
--		}
-+        if ($version != OMB_VERSION_01) {
-+            common_user_error(_('Unknown version of OMB protocol.'));
-+            return;
-+        }
-hunk ./actions/finishremotesubscribe.php 63
--		$nickname = $req->get_parameter('omb_listener_nickname');
-+        $nickname = $req->get_parameter('omb_listener_nickname');
-hunk ./actions/finishremotesubscribe.php 65
--		if (!$nickname) {
--			common_user_error(_('No nickname provided by remote server.'));
--			return;
--		}
-+        if (!$nickname) {
-+            common_user_error(_('No nickname provided by remote server.'));
-+            return;
-+        }
-hunk ./actions/finishremotesubscribe.php 70
--		$profile_url = $req->get_parameter('omb_listener_profile');
-+        $profile_url = $req->get_parameter('omb_listener_profile');
-hunk ./actions/finishremotesubscribe.php 72
--		if (!$profile_url) {
--			common_user_error(_('No profile URL returned by server.'));
--			return;
--		}
-+        if (!$profile_url) {
-+            common_user_error(_('No profile URL returned by server.'));
-+            return;
-+        }
-hunk ./actions/finishremotesubscribe.php 77
--		if (!Validate::uri($profile_url, array('allowed_schemes' => array('http', 'https')))) {
--			common_user_error(_('Invalid profile URL returned by server.'));
--			return;
--		}
-+        if (!Validate::uri($profile_url, array('allowed_schemes' => array('http', 'https')))) {
-+            common_user_error(_('Invalid profile URL returned by server.'));
-+            return;
-+        }
-hunk ./actions/finishremotesubscribe.php 82
--		if ($profile_url == common_local_url('showstream', array('nickname' => $nickname))) {
--			common_user_error(_('You can use the local subscription!'));
--		    return;
--		}
-+        if ($profile_url == common_local_url('showstream', array('nickname' => $nickname))) {
-+            common_user_error(_('You can use the local subscription!'));
-+            return;
-+        }
-hunk ./actions/finishremotesubscribe.php 87
--		common_debug('listenee: "'.$omb['listenee'].'"', __FILE__);
-+        common_debug('listenee: "'.$omb['listenee'].'"', __FILE__);
-hunk ./actions/finishremotesubscribe.php 89
--		$user = User::staticGet('nickname', $omb['listenee']);
-+        $user = User::staticGet('nickname', $omb['listenee']);
-hunk ./actions/finishremotesubscribe.php 91
--		if (!$user) {
--			common_user_error(_('User being listened to doesn\'t exist.'));
--			return;
--		}
-+        if (!$user) {
-+            common_user_error(_('User being listened to doesn\'t exist.'));
-+            return;
-+        }
-hunk ./actions/finishremotesubscribe.php 96
--		$other = User::staticGet('uri', $omb['listener']);
-+        $other = User::staticGet('uri', $omb['listener']);
-hunk ./actions/finishremotesubscribe.php 98
--		if ($other) {
--			common_user_error(_('You can use the local subscription!'));
--			return;
--		}
-+        if ($other) {
-+            common_user_error(_('You can use the local subscription!'));
-+            return;
-+        }
-hunk ./actions/finishremotesubscribe.php 103
--		$fullname = $req->get_parameter('omb_listener_fullname');
--		$homepage = $req->get_parameter('omb_listener_homepage');
--		$bio = $req->get_parameter('omb_listener_bio');
--		$location = $req->get_parameter('omb_listener_location');
--		$avatar_url = $req->get_parameter('omb_listener_avatar');
-+        $fullname = $req->get_parameter('omb_listener_fullname');
-+        $homepage = $req->get_parameter('omb_listener_homepage');
-+        $bio = $req->get_parameter('omb_listener_bio');
-+        $location = $req->get_parameter('omb_listener_location');
-+        $avatar_url = $req->get_parameter('omb_listener_avatar');
-hunk ./actions/finishremotesubscribe.php 109
--		list($newtok, $newsecret) = $this->access_token($omb);
-+        list($newtok, $newsecret) = $this->access_token($omb);
-hunk ./actions/finishremotesubscribe.php 111
--		if (!$newtok || !$newsecret) {
--			common_user_error(_('Couldn\'t convert request tokens to access tokens.'));
--			return;
--		}
-+        if (!$newtok || !$newsecret) {
-+            common_user_error(_('Couldn\'t convert request tokens to access tokens.'));
-+            return;
-+        }
-hunk ./actions/finishremotesubscribe.php 116
--		# XXX: possible attack point; subscribe and return someone else's profile URI
-+        # XXX: possible attack point; subscribe and return someone else's profile URI
-hunk ./actions/finishremotesubscribe.php 118
--		$remote = Remote_profile::staticGet('uri', $omb['listener']);
-+        $remote = Remote_profile::staticGet('uri', $omb['listener']);
-hunk ./actions/finishremotesubscribe.php 120
--		if ($remote) {
--			$exists = true;
--			$profile = Profile::staticGet($remote->id);
--			$orig_remote = clone($remote);
--			$orig_profile = clone($profile);
--			# XXX: compare current postNotice and updateProfile URLs to the ones
--			# stored in the DB to avoid (possibly...) above attack
--		} else {
--			$exists = false;
--			$remote = new Remote_profile();
--			$remote->uri = $omb['listener'];
--			$profile = new Profile();
--		}
-+        if ($remote) {
-+            $exists = true;
-+            $profile = Profile::staticGet($remote->id);
-+            $orig_remote = clone($remote);
-+            $orig_profile = clone($profile);
-+            # XXX: compare current postNotice and updateProfile URLs to the ones
-+            # stored in the DB to avoid (possibly...) above attack
-+        } else {
-+            $exists = false;
-+            $remote = new Remote_profile();
-+            $remote->uri = $omb['listener'];
-+            $profile = new Profile();
-+        }
-hunk ./actions/finishremotesubscribe.php 134
--		$profile->nickname = $nickname;
--		$profile->profileurl = $profile_url;
-+        $profile->nickname = $nickname;
-+        $profile->profileurl = $profile_url;
-hunk ./actions/finishremotesubscribe.php 137
--		if ($fullname) {
--			$profile->fullname = $fullname;
--		}
--		if ($homepage) {
--			$profile->homepage = $homepage;
--		}
--		if ($bio) {
--			$profile->bio = $bio;
--		}
--		if ($location) {
--			$profile->location = $location;
--		}
-+        if ($fullname) {
-+            $profile->fullname = $fullname;
-+        }
-+        if ($homepage) {
-+            $profile->homepage = $homepage;
-+        }
-+        if ($bio) {
-+            $profile->bio = $bio;
-+        }
-+        if ($location) {
-+            $profile->location = $location;
-+        }
-hunk ./actions/finishremotesubscribe.php 150
--		if ($exists) {
--			$profile->update($orig_profile);
--		} else {
--			$profile->created = DB_DataObject_Cast::dateTime(); # current time
--			$id = $profile->insert();
--			if (!$id) {
--				common_server_error(_('Error inserting new profile'));
--				return;
--			}
--			$remote->id = $id;
--		}
-+        if ($exists) {
-+            $profile->update($orig_profile);
-+        } else {
-+            $profile->created = DB_DataObject_Cast::dateTime(); # current time
-+            $id = $profile->insert();
-+            if (!$id) {
-+                common_server_error(_('Error inserting new profile'));
-+                return;
-+            }
-+            $remote->id = $id;
-+        }
-hunk ./actions/finishremotesubscribe.php 162
--		if ($avatar_url) {
--			if (!$this->add_avatar($profile, $avatar_url)) {
--				common_server_error(_('Error inserting avatar'));
--				return;
--			}
--		}
-+        if ($avatar_url) {
-+            if (!$this->add_avatar($profile, $avatar_url)) {
-+                common_server_error(_('Error inserting avatar'));
-+                return;
-+            }
-+        }
-hunk ./actions/finishremotesubscribe.php 169
--		$remote->postnoticeurl = $omb['post_notice_url'];
--		$remote->updateprofileurl = $omb['update_profile_url'];
-+        $remote->postnoticeurl = $omb['post_notice_url'];
-+        $remote->updateprofileurl = $omb['update_profile_url'];
-hunk ./actions/finishremotesubscribe.php 172
--		if ($exists) {
--			if (!$remote->update($orig_remote)) {
--				common_server_error(_('Error updating remote profile'));
--				return;
--			}
--		} else {
--			$remote->created = DB_DataObject_Cast::dateTime(); # current time
--			if (!$remote->insert()) {
--				common_server_error(_('Error inserting remote profile'));
--				return;
--			}
--		}
-+        if ($exists) {
-+            if (!$remote->update($orig_remote)) {
-+                common_server_error(_('Error updating remote profile'));
-+                return;
-+            }
-+        } else {
-+            $remote->created = DB_DataObject_Cast::dateTime(); # current time
-+            if (!$remote->insert()) {
-+                common_server_error(_('Error inserting remote profile'));
-+                return;
-+            }
-+        }
-hunk ./actions/finishremotesubscribe.php 190
--		$sub = new Subscription();
-+        $sub = new Subscription();
-hunk ./actions/finishremotesubscribe.php 192
--		$sub->subscriber = $remote->id;
--		$sub->subscribed = $user->id;
-+        $sub->subscriber = $remote->id;
-+        $sub->subscribed = $user->id;
-hunk ./actions/finishremotesubscribe.php 205
--		$sub->token = $newtok;
--		$sub->secret = $newsecret;
-+        $sub->token = $newtok;
-+        $sub->secret = $newsecret;
-hunk ./actions/finishremotesubscribe.php 214
--		if (!$result) {
-+        if (!$result) {
-hunk ./actions/finishremotesubscribe.php 216
--			common_user_error(_('Couldn\'t insert new subscription.'));
--			return;
--		}
-+            common_user_error(_('Couldn\'t insert new subscription.'));
-+            return;
-+        }
-hunk ./actions/finishremotesubscribe.php 220
--		# Notify user, if necessary
-+        # Notify user, if necessary
-hunk ./actions/finishremotesubscribe.php 222
--		mail_subscribe_notify_profile($user, $profile);
-+        mail_subscribe_notify_profile($user, $profile);
-hunk ./actions/finishremotesubscribe.php 224
--		# Clear the data
--		unset($_SESSION['oauth_authorization_request']);
-+        # Clear the data
-+        unset($_SESSION['oauth_authorization_request']);
-hunk ./actions/finishremotesubscribe.php 227
--		# If we show subscriptions in reverse chron order, this should
--		# show up close to the top of the page
-+        # If we show subscriptions in reverse chron order, this should
-+        # show up close to the top of the page
-hunk ./actions/finishremotesubscribe.php 230
--		common_redirect(common_local_url('subscribers', array('nickname' =>
--															 $user->nickname)));
--	}
-+        common_redirect(common_local_url('subscribers', array('nickname' =>
-+                                                             $user->nickname)));
-+    }
-hunk ./actions/finishremotesubscribe.php 234
--	function add_avatar($profile, $url) {
--		$temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
--		copy($url, $temp_filename);
--		return $profile->setOriginal($temp_filename);
--	}
-+    function add_avatar($profile, $url) {
-+        $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
-+        copy($url, $temp_filename);
-+        return $profile->setOriginal($temp_filename);
-+    }
-hunk ./actions/finishremotesubscribe.php 240
--	function access_token($omb) {
-+    function access_token($omb) {
-hunk ./actions/finishremotesubscribe.php 242
--		common_debug('starting request for access token', __FILE__);
-+        common_debug('starting request for access token', __FILE__);
-hunk ./actions/finishremotesubscribe.php 244
--		$con = omb_oauth_consumer();
--		$tok = new OAuthToken($omb['token'], $omb['secret']);
-+        $con = omb_oauth_consumer();
-+        $tok = new OAuthToken($omb['token'], $omb['secret']);
-hunk ./actions/finishremotesubscribe.php 247
--		common_debug('using request token "'.$tok.'"', __FILE__);
-+        common_debug('using request token "'.$tok.'"', __FILE__);
-hunk ./actions/finishremotesubscribe.php 249
--		$url = $omb['access_token_url'];
-+        $url = $omb['access_token_url'];
-hunk ./actions/finishremotesubscribe.php 251
--		common_debug('using access token url "'.$url.'"', __FILE__);
-+        common_debug('using access token url "'.$url.'"', __FILE__);
-hunk ./actions/finishremotesubscribe.php 253
--		# XXX: Is this the right thing to do? Strip off GET params and make them
--		# POST params? Seems wrong to me.
-+        # XXX: Is this the right thing to do? Strip off GET params and make them
-+        # POST params? Seems wrong to me.
-hunk ./actions/finishremotesubscribe.php 256
--		$parsed = parse_url($url);
--		$params = array();
--		parse_str($parsed['query'], $params);
-+        $parsed = parse_url($url);
-+        $params = array();
-+        parse_str($parsed['query'], $params);
-hunk ./actions/finishremotesubscribe.php 260
--		$req = OAuthRequest::from_consumer_and_token($con, $tok, "POST", $url, $params);
-+        $req = OAuthRequest::from_consumer_and_token($con, $tok, "POST", $url, $params);
-hunk ./actions/finishremotesubscribe.php 262
--		$req->set_parameter('omb_version', OMB_VERSION_01);
-+        $req->set_parameter('omb_version', OMB_VERSION_01);
-hunk ./actions/finishremotesubscribe.php 264
--		# XXX: test to see if endpoint accepts this signature method
-+        # XXX: test to see if endpoint accepts this signature method
-hunk ./actions/finishremotesubscribe.php 266
--		$req->sign_request(omb_hmac_sha1(), $con, $tok);
-+        $req->sign_request(omb_hmac_sha1(), $con, $tok);
-hunk ./actions/finishremotesubscribe.php 268
--		# We re-use this tool's fetcher, since it's pretty good
-+        # We re-use this tool's fetcher, since it's pretty good
-hunk ./actions/finishremotesubscribe.php 270
--		common_debug('posting to access token url "'.$req->get_normalized_http_url().'"', __FILE__);
--		common_debug('posting request data "'.$req->to_postdata().'"', __FILE__);
-+        common_debug('posting to access token url "'.$req->get_normalized_http_url().'"', __FILE__);
-+        common_debug('posting request data "'.$req->to_postdata().'"', __FILE__);
-hunk ./actions/finishremotesubscribe.php 273
--		$fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
--		$result = $fetcher->post($req->get_normalized_http_url(),
--								 $req->to_postdata(),
-+        $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
-+        $result = $fetcher->post($req->get_normalized_http_url(),
-+                                 $req->to_postdata(),
-hunk ./actions/finishremotesubscribe.php 278
--		common_debug('got result: "'.print_r($result,TRUE).'"', __FILE__);
-+        common_debug('got result: "'.print_r($result,TRUE).'"', __FILE__);
-hunk ./actions/finishremotesubscribe.php 280
--		if ($result->status != 200) {
--			return NULL;
--		}
-+        if ($result->status != 200) {
-+            return NULL;
-+        }
-hunk ./actions/finishremotesubscribe.php 284
--		parse_str($result->body, $return);
-+        parse_str($result->body, $return);
-hunk ./actions/finishremotesubscribe.php 286
--		return array($return['oauth_token'], $return['oauth_token_secret']);
--	}
-+        return array($return['oauth_token'], $return['oauth_token_secret']);
-+    }
-hunk ./actions/foaf.php 28
--	function is_readonly() {
--		return true;
--	}
-+    function is_readonly() {
-+        return true;
-+    }
-hunk ./actions/foaf.php 32
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/foaf.php 35
--		$nickname = $this->trimmed('nickname');
-+        $nickname = $this->trimmed('nickname');
-hunk ./actions/foaf.php 37
--		$user = User::staticGet('nickname', $nickname);
-+        $user = User::staticGet('nickname', $nickname);
-hunk ./actions/foaf.php 39
--		if (!$user) {
--			common_user_error(_('No such user.'), 404);
--			return;
--		}
-+        if (!$user) {
-+            common_user_error(_('No such user.'), 404);
-+            return;
-+        }
-hunk ./actions/foaf.php 44
--		$profile = $user->getProfile();
-+        $profile = $user->getProfile();
-hunk ./actions/foaf.php 46
--		if (!$profile) {
--			common_server_error(_('User has no profile.'), 500);
--			return;
--		}
-+        if (!$profile) {
-+            common_server_error(_('User has no profile.'), 500);
-+            return;
-+        }
-hunk ./actions/foaf.php 51
--		header('Content-Type: application/rdf+xml');
-+        header('Content-Type: application/rdf+xml');
-hunk ./actions/foaf.php 53
--		common_start_xml();
--		common_element_start('rdf:RDF', array('xmlns:rdf' =>
--											  'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
--											  'xmlns:rdfs' =>
--											  'http://www.w3.org/2000/01/rdf-schema#',
--											  'xmlns:geo' =>
--											  'http://www.w3.org/2003/01/geo/wgs84_pos#',
--											  'xmlns' => 'http://xmlns.com/foaf/0.1/'));
-+        common_start_xml();
-+        common_element_start('rdf:RDF', array('xmlns:rdf' =>
-+                                              'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
-+                                              'xmlns:rdfs' =>
-+                                              'http://www.w3.org/2000/01/rdf-schema#',
-+                                              'xmlns:geo' =>
-+                                              'http://www.w3.org/2003/01/geo/wgs84_pos#',
-+                                              'xmlns' => 'http://xmlns.com/foaf/0.1/'));
-hunk ./actions/foaf.php 62
--		# This is the document about the user
-+        # This is the document about the user
-hunk ./actions/foaf.php 64
--		$this->show_ppd('', $user->uri);
-+        $this->show_ppd('', $user->uri);
-hunk ./actions/foaf.php 66
--		# XXX: might not be a person
--		common_element_start('Person', array('rdf:about' =>
--											 $user->uri));
--		common_element('mbox_sha1sum', NULL, sha1('mailto:' . $user->email));
--		if ($profile->fullname) {
--			common_element('name', NULL, $profile->fullname);
--		}
--		if ($profile->homepage) {
--			common_element('homepage', array('rdf:resource' => $profile->homepage));
--		}
--		if ($profile->bio) {
--			common_element('rdfs:comment', NULL, $profile->bio);
--		}
--		# XXX: more structured location data
--		if ($profile->location) {
--			common_element_start('based_near');
--			common_element_start('geo:SpatialThing');
--			common_element('name', NULL, $profile->location);
--			common_element_end('geo:SpatialThing');
--			common_element_end('based_near');
--		}
-+        # XXX: might not be a person
-+        common_element_start('Person', array('rdf:about' =>
-+                                             $user->uri));
-+        common_element('mbox_sha1sum', NULL, sha1('mailto:' . $user->email));
-+        if ($profile->fullname) {
-+            common_element('name', NULL, $profile->fullname);
-+        }
-+        if ($profile->homepage) {
-+            common_element('homepage', array('rdf:resource' => $profile->homepage));
-+        }
-+        if ($profile->bio) {
-+            common_element('rdfs:comment', NULL, $profile->bio);
-+        }
-+        # XXX: more structured location data
-+        if ($profile->location) {
-+            common_element_start('based_near');
-+            common_element_start('geo:SpatialThing');
-+            common_element('name', NULL, $profile->location);
-+            common_element_end('geo:SpatialThing');
-+            common_element_end('based_near');
-+        }
-hunk ./actions/foaf.php 88
--		$this->show_microblogging_account($profile, common_root_url());
-+        $this->show_microblogging_account($profile, common_root_url());
-hunk ./actions/foaf.php 90
--		$avatar = $profile->getOriginalAvatar();
-+        $avatar = $profile->getOriginalAvatar();
-hunk ./actions/foaf.php 92
--		if ($avatar) {
--			common_element_start('img');
--			common_element_start('Image', array('rdf:about' => $avatar->url));
--			foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
--				$scaled = $profile->getAvatar($size);
--				if (!$scaled->original) { # sometimes the original has one of our scaled sizes
--					common_element_start('thumbnail');
--					common_element('Image', array('rdf:about' => $scaled->url));
--					common_element_end('thumbnail');
--				}
--			}
--			common_element_end('Image');
--			common_element_end('img');
--		}
-+        if ($avatar) {
-+            common_element_start('img');
-+            common_element_start('Image', array('rdf:about' => $avatar->url));
-+            foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
-+                $scaled = $profile->getAvatar($size);
-+                if (!$scaled->original) { # sometimes the original has one of our scaled sizes
-+                    common_element_start('thumbnail');
-+                    common_element('Image', array('rdf:about' => $scaled->url));
-+                    common_element_end('thumbnail');
-+                }
-+            }
-+            common_element_end('Image');
-+            common_element_end('img');
-+        }
-hunk ./actions/foaf.php 107
--		# Get people user is subscribed to
-+        # Get people user is subscribed to
-hunk ./actions/foaf.php 109
--		$person = array();
-+        $person = array();
-hunk ./actions/foaf.php 111
--		$sub = new Subscription();
--		$sub->subscriber = $profile->id;
--		$sub->whereAdd('subscriber != subscribed');
--		
--		if ($sub->find()) {
--			while ($sub->fetch()) {
--				if ($sub->token) {
--					$other = Remote_profile::staticGet('id', $sub->subscribed);
--				} else {
--					$other = User::staticGet('id', $sub->subscribed);
--				}
--				if (!$other) {
--					common_debug('Got a bad subscription: '.print_r($sub,TRUE));
--					continue;
--				}
--				common_element('knows', array('rdf:resource' => $other->uri));
--				$person[$other->uri] = array(LISTENEE, $other);
--			}
--		}
-+        $sub = new Subscription();
-+        $sub->subscriber = $profile->id;
-+        $sub->whereAdd('subscriber != subscribed');
-+        
-+        if ($sub->find()) {
-+            while ($sub->fetch()) {
-+                if ($sub->token) {
-+                    $other = Remote_profile::staticGet('id', $sub->subscribed);
-+                } else {
-+                    $other = User::staticGet('id', $sub->subscribed);
-+                }
-+                if (!$other) {
-+                    common_debug('Got a bad subscription: '.print_r($sub,TRUE));
-+                    continue;
-+                }
-+                common_element('knows', array('rdf:resource' => $other->uri));
-+                $person[$other->uri] = array(LISTENEE, $other);
-+            }
-+        }
-hunk ./actions/foaf.php 131
--		# Get people who subscribe to user
-+        # Get people who subscribe to user
-hunk ./actions/foaf.php 133
--		$sub = new Subscription();
--		$sub->subscribed = $profile->id;
--		$sub->whereAdd('subscriber != subscribed');
-+        $sub = new Subscription();
-+        $sub->subscribed = $profile->id;
-+        $sub->whereAdd('subscriber != subscribed');
-hunk ./actions/foaf.php 137
--		if ($sub->find()) {
--			while ($sub->fetch()) {
--				if ($sub->token) {
--					$other = Remote_profile::staticGet('id', $sub->subscriber);
--				} else {
--					$other = User::staticGet('id', $sub->subscriber);
--				}
--				if (!$other) {
--					common_debug('Got a bad subscription: '.print_r($sub,TRUE));
--					continue;
--				}
--				if (array_key_exists($other->uri, $person)) {
--					$person[$other->uri][0] = BOTH;
--				} else {
--					$person[$other->uri] = array(LISTENER, $other);
--				}
--			}
--		}
-+        if ($sub->find()) {
-+            while ($sub->fetch()) {
-+                if ($sub->token) {
-+                    $other = Remote_profile::staticGet('id', $sub->subscriber);
-+                } else {
-+                    $other = User::staticGet('id', $sub->subscriber);
-+                }
-+                if (!$other) {
-+                    common_debug('Got a bad subscription: '.print_r($sub,TRUE));
-+                    continue;
-+                }
-+                if (array_key_exists($other->uri, $person)) {
-+                    $person[$other->uri][0] = BOTH;
-+                } else {
-+                    $person[$other->uri] = array(LISTENER, $other);
-+                }
-+            }
-+        }
-hunk ./actions/foaf.php 156
--		common_element_end('Person');
-+        common_element_end('Person');
-hunk ./actions/foaf.php 158
--		foreach ($person as $uri => $p) {
--			$foaf_url = NULL;
--			if ($p[1] instanceof User) {
--				$foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname));
--			}
--			$profile = Profile::staticGet($p[1]->id);
--			common_element_start('Person', array('rdf:about' => $uri));
--			if ($p[0] == LISTENER || $p[0] == BOTH) {
--				common_element('knows', array('rdf:resource' => $user->uri));
--			}
--			$this->show_microblogging_account($profile, ($p[1] instanceof User) ?
--											  common_root_url() : NULL);
--			if ($foaf_url) {
--				common_element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
--			}
--			common_element_end('Person');
--			if ($foaf_url) {
--				$this->show_ppd($foaf_url, $uri);
--			}
--		}
-+        foreach ($person as $uri => $p) {
-+            $foaf_url = NULL;
-+            if ($p[1] instanceof User) {
-+                $foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname));
-+            }
-+            $profile = Profile::staticGet($p[1]->id);
-+            common_element_start('Person', array('rdf:about' => $uri));
-+            if ($p[0] == LISTENER || $p[0] == BOTH) {
-+                common_element('knows', array('rdf:resource' => $user->uri));
-+            }
-+            $this->show_microblogging_account($profile, ($p[1] instanceof User) ?
-+                                              common_root_url() : NULL);
-+            if ($foaf_url) {
-+                common_element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
-+            }
-+            common_element_end('Person');
-+            if ($foaf_url) {
-+                $this->show_ppd($foaf_url, $uri);
-+            }
-+        }
-hunk ./actions/foaf.php 179
--		common_element_end('rdf:RDF');
--	}
-+        common_element_end('rdf:RDF');
-+    }
-hunk ./actions/foaf.php 182
--	function show_ppd($foaf_url, $person_uri) {
--		common_element_start('PersonalProfileDocument', array('rdf:about' => $foaf_url));
--		common_element('maker', array('rdf:resource' => $person_uri));
--		common_element('primaryTopic', array('rdf:resource' => $person_uri));
--		common_element_end('PersonalProfileDocument');
--	}
-+    function show_ppd($foaf_url, $person_uri) {
-+        common_element_start('PersonalProfileDocument', array('rdf:about' => $foaf_url));
-+        common_element('maker', array('rdf:resource' => $person_uri));
-+        common_element('primaryTopic', array('rdf:resource' => $person_uri));
-+        common_element_end('PersonalProfileDocument');
-+    }
+-        return NULL;
++        return null;
+hunk ./actions/finishopenidlogin.php 413
+-            return NULL;
++            return null;
+hunk ./actions/finishremotesubscribe.php 281
+-            return NULL;
++            return null;
+hunk ./actions/foaf.php 69
+-        common_element('mbox_sha1sum', NULL, sha1('mailto:' . $user->email));
++        common_element('mbox_sha1sum', null, sha1('mailto:' . $user->email));
+hunk ./actions/foaf.php 71
+-            common_element('name', NULL, $profile->fullname);
++            common_element('name', null, $profile->fullname);
+hunk ./actions/foaf.php 77
+-            common_element('rdfs:comment', NULL, $profile->bio);
++            common_element('rdfs:comment', null, $profile->bio);
+hunk ./actions/foaf.php 83
+-            common_element('name', NULL, $profile->location);
++            common_element('name', null, $profile->location);
+hunk ./actions/foaf.php 159
+-            $foaf_url = NULL;
++            $foaf_url = null;
+hunk ./actions/foaf.php 169
+-                                              common_root_url() : NULL);
++                                              common_root_url() : null);
 hunk ./actions/foaf.php 189
--	function show_microblogging_account($profile, $service=NULL) {
--		# Their account
--		common_element_start('holdsAccount');
--		common_element_start('OnlineAccount');
--		if ($service) {
--			common_element('accountServiceHomepage', array('rdf:resource' =>
--														   $service));
--		}
--		common_element('accountName', NULL, $profile->nickname);
--		common_element('homepage', array('rdf:resource' => $profile->profileurl));
--		common_element_end('OnlineAccount');
--		common_element_end('holdsAccount');
--	}
-+    function show_microblogging_account($profile, $service=NULL) {
-+        # Their account
-+        common_element_start('holdsAccount');
-+        common_element_start('OnlineAccount');
-+        if ($service) {
-+            common_element('accountServiceHomepage', array('rdf:resource' =>
-+                                                           $service));
-+        }
-+        common_element('accountName', NULL, $profile->nickname);
-+        common_element('homepage', array('rdf:resource' => $profile->profileurl));
-+        common_element_end('OnlineAccount');
-+        common_element_end('holdsAccount');
-+    }
-hunk ./actions/imsettings.php 27
--	function get_instructions() {
--		return _('You can send and receive notices through Jabber/GTalk [instant messages](%%doc.im%%). Configure your address and settings below.');
--	}
-+    function get_instructions() {
-+        return _('You can send and receive notices through Jabber/GTalk [instant messages](%%doc.im%%). Configure your address and settings below.');
-+    }
+-    function show_microblogging_account($profile, $service=NULL) {
++    function show_microblogging_account($profile, $service=null) {
+hunk ./actions/foaf.php 197
+-        common_element('accountName', NULL, $profile->nickname);
++        common_element('accountName', null, $profile->nickname);
 hunk ./actions/imsettings.php 31
--	function show_form($msg=NULL, $success=false) {
--		$user = common_current_user();
--		$this->form_header(_('IM Settings'), $msg, $success);
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'imsettings',
--										   'action' =>
--										   common_local_url('imsettings')));
--		common_hidden('token', common_session_token());
-+    function show_form($msg=NULL, $success=false) {
-+        $user = common_current_user();
-+        $this->form_header(_('IM Settings'), $msg, $success);
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'imsettings',
-+                                           'action' =>
-+                                           common_local_url('imsettings')));
-+        common_hidden('token', common_session_token());
+-    function show_form($msg=NULL, $success=false) {
++    function show_form($msg=null, $success=false) {
 hunk ./actions/imsettings.php 40
--		common_element('h2', NULL, _('Address'));
-+        common_element('h2', NULL, _('Address'));
-hunk ./actions/imsettings.php 42
--		if ($user->jabber) {
--			common_element_start('p');
--			common_element('span', 'address confirmed', $user->jabber);
--			common_element('span', 'input_instructions',
--			               _('Current confirmed Jabber/GTalk address.'));
--			common_hidden('jabber', $user->jabber);
--			common_element_end('p');
--			common_submit('remove', _('Remove'));
--		} else {
--			$confirm = $this->get_confirmation();
--			if ($confirm) {
--				common_element_start('p');
--				common_element('span', 'address unconfirmed', $confirm->address);
--				common_element('span', 'input_instructions',
--			  	              sprintf(_('Awaiting confirmation on this address. Check your Jabber/GTalk account for a message with further instructions. (Did you add %s to your buddy list?)'), jabber_daemon_address()));
--				common_hidden('jabber', $confirm->address);
--				common_element_end('p');
--				common_submit('cancel', _('Cancel'));
--			} else {
--				common_input('jabber', _('IM Address'),
--						 	($this->arg('jabber')) ? $this->arg('jabber') : NULL,
--						 sprintf(_('Jabber or GTalk address, like "UserName@example.org". First, make sure to add %s to your buddy list in your IM client or on GTalk.'), jabber_daemon_address()));
--				common_submit('add', _('Add'));
--			}
--		}
-+        if ($user->jabber) {
-+            common_element_start('p');
-+            common_element('span', 'address confirmed', $user->jabber);
-+            common_element('span', 'input_instructions',
-+                           _('Current confirmed Jabber/GTalk address.'));
-+            common_hidden('jabber', $user->jabber);
-+            common_element_end('p');
-+            common_submit('remove', _('Remove'));
-+        } else {
-+            $confirm = $this->get_confirmation();
-+            if ($confirm) {
-+                common_element_start('p');
-+                common_element('span', 'address unconfirmed', $confirm->address);
-+                common_element('span', 'input_instructions',
-+                                sprintf(_('Awaiting confirmation on this address. Check your Jabber/GTalk account for a message with further instructions. (Did you add %s to your buddy list?)'), jabber_daemon_address()));
-+                common_hidden('jabber', $confirm->address);
-+                common_element_end('p');
-+                common_submit('cancel', _('Cancel'));
-+            } else {
-+                common_input('jabber', _('IM Address'),
-+                             ($this->arg('jabber')) ? $this->arg('jabber') : NULL,
-+                         sprintf(_('Jabber or GTalk address, like "UserName@example.org". First, make sure to add %s to your buddy list in your IM client or on GTalk.'), jabber_daemon_address()));
-+                common_submit('add', _('Add'));
-+            }
-+        }
+-        common_element('h2', NULL, _('Address'));
++        common_element('h2', null, _('Address'));
+hunk ./actions/imsettings.php 62
+-                             ($this->arg('jabber')) ? $this->arg('jabber') : NULL,
++                             ($this->arg('jabber')) ? $this->arg('jabber') : null,
 hunk ./actions/imsettings.php 68
--		common_element('h2', NULL, _('Preferences'));
-+        common_element('h2', NULL, _('Preferences'));
-hunk ./actions/imsettings.php 70
--		common_checkbox('jabbernotify',
--		                _('Send me notices through Jabber/GTalk.'),
--		                $user->jabbernotify);
--		common_checkbox('updatefrompresence',
--		                _('Post a notice when my Jabber/GTalk status changes.'),
--		                $user->updatefrompresence);
--		common_checkbox('jabberreplies',
--		                _('Send me replies through Jabber/GTalk from people I\'m not subscribed to.'),
--		                $user->jabberreplies);
--		common_checkbox('jabbermicroid',
--		                _('Publish a MicroID for my Jabber/GTalk address.'),
--		                $user->jabbermicroid);
--		common_submit('save', _('Save'));
-+        common_checkbox('jabbernotify',
-+                        _('Send me notices through Jabber/GTalk.'),
-+                        $user->jabbernotify);
-+        common_checkbox('updatefrompresence',
-+                        _('Post a notice when my Jabber/GTalk status changes.'),
-+                        $user->updatefrompresence);
-+        common_checkbox('jabberreplies',
-+                        _('Send me replies through Jabber/GTalk from people I\'m not subscribed to.'),
-+                        $user->jabberreplies);
-+        common_checkbox('jabbermicroid',
-+                        _('Publish a MicroID for my Jabber/GTalk address.'),
-+                        $user->jabbermicroid);
-+        common_submit('save', _('Save'));
-hunk ./actions/imsettings.php 84
--		common_element_end('form');
--		common_show_footer();
--	}
-+        common_element_end('form');
-+        common_show_footer();
-+    }
-hunk ./actions/imsettings.php 88
--	function get_confirmation() {
--		$user = common_current_user();
--		$confirm = new Confirm_address();
--		$confirm->user_id = $user->id;
--		$confirm->address_type = 'jabber';
--		if ($confirm->find(TRUE)) {
--			return $confirm;
--		} else {
--			return NULL;
--		}
--	}
-+    function get_confirmation() {
-+        $user = common_current_user();
-+        $confirm = new Confirm_address();
-+        $confirm->user_id = $user->id;
-+        $confirm->address_type = 'jabber';
-+        if ($confirm->find(TRUE)) {
-+            return $confirm;
-+        } else {
-+            return NULL;
-+        }
-+    }
-hunk ./actions/imsettings.php 100
--	function handle_post() {
-+    function handle_post() {
-hunk ./actions/imsettings.php 102
--		# CSRF protection
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        # CSRF protection
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/imsettings.php 109
--		if ($this->arg('save')) {
--			$this->save_preferences();
--		} else if ($this->arg('add')) {
--			$this->add_address();
--		} else if ($this->arg('cancel')) {
--			$this->cancel_confirmation();
--		} else if ($this->arg('remove')) {
--			$this->remove_address();
--		} else {
--			$this->show_form(_('Unexpected form submission.'));
--		}
--	}
-+        if ($this->arg('save')) {
-+            $this->save_preferences();
-+        } else if ($this->arg('add')) {
-+            $this->add_address();
-+        } else if ($this->arg('cancel')) {
-+            $this->cancel_confirmation();
-+        } else if ($this->arg('remove')) {
-+            $this->remove_address();
-+        } else {
-+            $this->show_form(_('Unexpected form submission.'));
-+        }
-+    }
-hunk ./actions/imsettings.php 122
--	function save_preferences() {
-+    function save_preferences() {
-hunk ./actions/imsettings.php 124
--		$jabbernotify = $this->boolean('jabbernotify');
--		$updatefrompresence = $this->boolean('updatefrompresence');
--		$jabberreplies = $this->boolean('jabberreplies');
--		$jabbermicroid = $this->boolean('jabbermicroid');
-+        $jabbernotify = $this->boolean('jabbernotify');
-+        $updatefrompresence = $this->boolean('updatefrompresence');
-+        $jabberreplies = $this->boolean('jabberreplies');
-+        $jabbermicroid = $this->boolean('jabbermicroid');
-hunk ./actions/imsettings.php 129
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/imsettings.php 131
--		assert(!is_null($user)); # should already be checked
-+        assert(!is_null($user)); # should already be checked
-hunk ./actions/imsettings.php 133
--		$user->query('BEGIN');
-+        $user->query('BEGIN');
-hunk ./actions/imsettings.php 135
--		$original = clone($user);
-+        $original = clone($user);
-hunk ./actions/imsettings.php 137
--		$user->jabbernotify = $jabbernotify;
--		$user->updatefrompresence = $updatefrompresence;
--		$user->jabberreplies = $jabberreplies;
--		$user->jabbermicroid = $jabbermicroid;
-+        $user->jabbernotify = $jabbernotify;
-+        $user->updatefrompresence = $updatefrompresence;
-+        $user->jabberreplies = $jabberreplies;
-+        $user->jabbermicroid = $jabbermicroid;
-hunk ./actions/imsettings.php 142
--		$result = $user->update($original);
-+        $result = $user->update($original);
-hunk ./actions/imsettings.php 144
--		if ($result === FALSE) {
--			common_log_db_error($user, 'UPDATE', __FILE__);
--			common_server_error(_('Couldn\'t update user.'));
--			return;
--		}
-+        if ($result === FALSE) {
-+            common_log_db_error($user, 'UPDATE', __FILE__);
-+            common_server_error(_('Couldn\'t update user.'));
-+            return;
-+        }
-hunk ./actions/imsettings.php 150
--		$user->query('COMMIT');
-+        $user->query('COMMIT');
-hunk ./actions/imsettings.php 152
--		$this->show_form(_('Preferences saved.'), true);
--	}
-+        $this->show_form(_('Preferences saved.'), true);
-+    }
-hunk ./actions/imsettings.php 155
--	function add_address() {
-+    function add_address() {
-hunk ./actions/imsettings.php 157
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/imsettings.php 159
--		$jabber = $this->trimmed('jabber');
-+        $jabber = $this->trimmed('jabber');
-hunk ./actions/imsettings.php 161
--		# Some validation
-+        # Some validation
-hunk ./actions/imsettings.php 163
--		if (!$jabber) {
--			$this->show_form(_('No Jabber ID.'));
--			return;
--		}
-+        if (!$jabber) {
-+            $this->show_form(_('No Jabber ID.'));
-+            return;
-+        }
-hunk ./actions/imsettings.php 168
--		$jabber = jabber_normalize_jid($jabber);
-+        $jabber = jabber_normalize_jid($jabber);
-hunk ./actions/imsettings.php 170
--		if (!$jabber) {
--		    $this->show_form(_('Cannot normalize that Jabber ID'));
--		    return;
--		}
--		if (!jabber_valid_base_jid($jabber)) {
--		    $this->show_form(_('Not a valid Jabber ID'));
--		    return;
--		} else if ($user->jabber == $jabber) {
--		    $this->show_form(_('That is already your Jabber ID.'));
--		    return;
--		} else if ($this->jabber_exists($jabber)) {
--		    $this->show_form(_('Jabber ID already belongs to another user.'));
--		    return;
--		}
-+        if (!$jabber) {
-+            $this->show_form(_('Cannot normalize that Jabber ID'));
-+            return;
-+        }
-+        if (!jabber_valid_base_jid($jabber)) {
-+            $this->show_form(_('Not a valid Jabber ID'));
-+            return;
-+        } else if ($user->jabber == $jabber) {
-+            $this->show_form(_('That is already your Jabber ID.'));
-+            return;
-+        } else if ($this->jabber_exists($jabber)) {
-+            $this->show_form(_('Jabber ID already belongs to another user.'));
-+            return;
-+        }
-hunk ./actions/imsettings.php 185
--  		$confirm = new Confirm_address();
--   		$confirm->address = $jabber;
--   		$confirm->address_type = 'jabber';
--   		$confirm->user_id = $user->id;
--   		$confirm->code = common_confirmation_code(64);
-+          $confirm = new Confirm_address();
-+           $confirm->address = $jabber;
-+           $confirm->address_type = 'jabber';
-+           $confirm->user_id = $user->id;
-+           $confirm->code = common_confirmation_code(64);
-hunk ./actions/imsettings.php 191
--		$result = $confirm->insert();
-+        $result = $confirm->insert();
-hunk ./actions/imsettings.php 193
--		if ($result === FALSE) {
--			common_log_db_error($confirm, 'INSERT', __FILE__);
--			common_server_error(_('Couldn\'t insert confirmation code.'));
--			return;
--		}
-+        if ($result === FALSE) {
-+            common_log_db_error($confirm, 'INSERT', __FILE__);
-+            common_server_error(_('Couldn\'t insert confirmation code.'));
-+            return;
-+        }
-hunk ./actions/imsettings.php 199
--		if (!common_config('queue', 'enabled')) {
--			jabber_confirm_address($confirm->code,
--								   $user->nickname,
--								   $jabber);
--		}
-+        if (!common_config('queue', 'enabled')) {
-+            jabber_confirm_address($confirm->code,
-+                                   $user->nickname,
-+                                   $jabber);
-+        }
-hunk ./actions/imsettings.php 205
--		$msg = sprintf(_('A confirmation code was sent to the IM address you added. You must approve %s for sending messages to you.'), jabber_daemon_address());
-+        $msg = sprintf(_('A confirmation code was sent to the IM address you added. You must approve %s for sending messages to you.'), jabber_daemon_address());
-hunk ./actions/imsettings.php 207
--		$this->show_form($msg, TRUE);
--	}
-+        $this->show_form($msg, TRUE);
-+    }
-hunk ./actions/imsettings.php 210
--	function cancel_confirmation() {
--		$jabber = $this->arg('jabber');
--		$confirm = $this->get_confirmation();
--		if (!$confirm) {
--			$this->show_form(_('No pending confirmation to cancel.'));
--			return;
--		}
--		if ($confirm->address != $jabber) {
--			$this->show_form(_('That is the wrong IM address.'));
--			return;
--		}
-+    function cancel_confirmation() {
-+        $jabber = $this->arg('jabber');
-+        $confirm = $this->get_confirmation();
-+        if (!$confirm) {
-+            $this->show_form(_('No pending confirmation to cancel.'));
-+            return;
-+        }
-+        if ($confirm->address != $jabber) {
-+            $this->show_form(_('That is the wrong IM address.'));
-+            return;
-+        }
-hunk ./actions/imsettings.php 225
--			common_log_db_error($confirm, 'DELETE', __FILE__);
-+            common_log_db_error($confirm, 'DELETE', __FILE__);
-hunk ./actions/imsettings.php 231
--	}
-+    }
-hunk ./actions/imsettings.php 233
--	function remove_address() {
-+    function remove_address() {
-hunk ./actions/imsettings.php 235
--		$user = common_current_user();
--		$jabber = $this->arg('jabber');
-+        $user = common_current_user();
-+        $jabber = $this->arg('jabber');
-hunk ./actions/imsettings.php 238
--		# Maybe an old tab open...?
-+        # Maybe an old tab open...?
-hunk ./actions/imsettings.php 240
--		if ($user->jabber != $jabber) {
--		    $this->show_form(_('That is not your Jabber ID.'));
--		    return;
--		}
-+        if ($user->jabber != $jabber) {
-+            $this->show_form(_('That is not your Jabber ID.'));
-+            return;
-+        }
-hunk ./actions/imsettings.php 245
--		$user->query('BEGIN');
--		$original = clone($user);
--		$user->jabber = NULL;
--		$result = $user->updateKeys($original);
--		if (!$result) {
--			common_log_db_error($user, 'UPDATE', __FILE__);
--			common_server_error(_('Couldn\'t update user.'));
--			return;
--		}
--		$user->query('COMMIT');
-+        $user->query('BEGIN');
-+        $original = clone($user);
-+        $user->jabber = NULL;
-+        $result = $user->updateKeys($original);
-+        if (!$result) {
-+            common_log_db_error($user, 'UPDATE', __FILE__);
-+            common_server_error(_('Couldn\'t update user.'));
-+            return;
-+        }
-+        $user->query('COMMIT');
-hunk ./actions/imsettings.php 256
--		# XXX: unsubscribe to the old address
-+        # XXX: unsubscribe to the old address
-hunk ./actions/imsettings.php 258
--		$this->show_form(_('The address was removed.'), TRUE);
--	}
-+        $this->show_form(_('The address was removed.'), TRUE);
-+    }
-hunk ./actions/imsettings.php 261
--	function jabber_exists($jabber) {
--		$user = common_current_user();
--		$other = User::staticGet('jabber', $jabber);
--		if (!$other) {
--			return false;
--		} else {
--			return $other->id != $user->id;
--		}
--	}
-+    function jabber_exists($jabber) {
-+        $user = common_current_user();
-+        $other = User::staticGet('jabber', $jabber);
-+        if (!$other) {
-+            return false;
-+        } else {
-+            return $other->id != $user->id;
-+        }
-+    }
-hunk ./actions/invite.php 24
--	function is_readonly() {
--		return false;
--	}
-+    function is_readonly() {
-+        return false;
-+    }
-hunk ./actions/invite.php 30
--		if (!common_logged_in()) {
--			$this->client_error(sprintf(_('You must be logged in to invite other users to use %s'),
--										common_config('site', 'name')));
--			return;
--		} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
--			$this->send_invitations();
--		} else {
--			$this->show_form();
--		}
--	}
-+        if (!common_logged_in()) {
-+            $this->client_error(sprintf(_('You must be logged in to invite other users to use %s'),
-+                                        common_config('site', 'name')));
-+            return;
-+        } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-+            $this->send_invitations();
-+        } else {
-+            $this->show_form();
-+        }
-+    }
-hunk ./actions/invite.php 41
--	function send_invitations() {
-+    function send_invitations() {
-hunk ./actions/invite.php 43
--		# CSRF protection
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        # CSRF protection
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/invite.php 50
--		$user = common_current_user();
--		$profile = $user->getProfile();
-+        $user = common_current_user();
-+        $profile = $user->getProfile();
-hunk ./actions/invite.php 53
--		$bestname = $profile->getBestName();
--		$sitename = common_config('site', 'name');
--		$personal = $this->trimmed('personal');
-+        $bestname = $profile->getBestName();
-+        $sitename = common_config('site', 'name');
-+        $personal = $this->trimmed('personal');
-hunk ./actions/invite.php 57
--		$addresses = explode("\n", $this->trimmed('addresses'));
-+        $addresses = explode("\n", $this->trimmed('addresses'));
-hunk ./actions/invite.php 59
--		foreach ($addresses as $email) {
--			$email = trim($email);
--			if (!Validate::email($email, true)) {
--				$this->show_form(sprintf(_('Invalid email address: %s'), $email));
--				return;
--			}
--		}
-+        foreach ($addresses as $email) {
-+            $email = trim($email);
-+            if (!Validate::email($email, true)) {
-+                $this->show_form(sprintf(_('Invalid email address: %s'), $email));
-+                return;
-+            }
-+        }
-hunk ./actions/invite.php 67
--		$already = array();
--		$subbed = array();
-+        $already = array();
-+        $subbed = array();
-hunk ./actions/invite.php 70
--		foreach ($addresses as $email) {
--			$email = common_canonical_email($email);
--			$other = User::staticGet('email', $email);
--			if ($other) {
--				if ($user->isSubscribed($other)) {
--					$already[] = $other;
--				} else {
--					subs_subscribe_to($user, $other);
--					$subbed[] = $other;
--				}
--			} else {
--				$sent[] = $email;
--				$this->send_invitation($email, $user, $personal);
--			}
--		}
-+        foreach ($addresses as $email) {
-+            $email = common_canonical_email($email);
-+            $other = User::staticGet('email', $email);
-+            if ($other) {
-+                if ($user->isSubscribed($other)) {
-+                    $already[] = $other;
-+                } else {
-+                    subs_subscribe_to($user, $other);
-+                    $subbed[] = $other;
-+                }
-+            } else {
-+                $sent[] = $email;
-+                $this->send_invitation($email, $user, $personal);
-+            }
-+        }
-hunk ./actions/invite.php 86
--		common_show_header(_('Invitation(s) sent'));
--		if ($already) {
--			common_element('p', NULL, _('You are already subscribed to these users:'));
--			common_element_start('ul');
--			foreach ($already as $other) {
--				common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
--			}
--			common_element_end('ul');
--		}
--		if ($subbed) {
--			common_element('p', NULL, _('These people are already users and you were automatically subscribed to them:'));
--			common_element_start('ul');
--			foreach ($subbed as $other) {
--				common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
--			}
--			common_element_end('ul');
--		}
--		if ($sent) {
--			common_element('p', NULL, _('Invitation(s) sent to the following people:'));
--			common_element_start('ul');
--			foreach ($sent as $other) {
--				common_element('li', NULL, $other);
--			}
--			common_element_end('ul');
--			common_element('p', NULL, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
--		}
--		common_show_footer();
--	}
-+        common_show_header(_('Invitation(s) sent'));
-+        if ($already) {
-+            common_element('p', NULL, _('You are already subscribed to these users:'));
-+            common_element_start('ul');
-+            foreach ($already as $other) {
-+                common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
-+            }
-+            common_element_end('ul');
-+        }
-+        if ($subbed) {
-+            common_element('p', NULL, _('These people are already users and you were automatically subscribed to them:'));
-+            common_element_start('ul');
-+            foreach ($subbed as $other) {
-+                common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
-+            }
-+            common_element_end('ul');
-+        }
-+        if ($sent) {
-+            common_element('p', NULL, _('Invitation(s) sent to the following people:'));
-+            common_element_start('ul');
-+            foreach ($sent as $other) {
-+                common_element('li', NULL, $other);
-+            }
-+            common_element_end('ul');
-+            common_element('p', NULL, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
-+        }
-+        common_show_footer();
-+    }
+-        common_element('h2', NULL, _('Preferences'));
++        common_element('h2', null, _('Preferences'));
+hunk ./actions/imsettings.php 96
+-            return NULL;
++            return null;
+hunk ./actions/imsettings.php 247
+-        $user->jabber = NULL;
++        $user->jabber = null;
+hunk ./actions/invite.php 88
+-            common_element('p', NULL, _('You are already subscribed to these users:'));
++            common_element('p', null, _('You are already subscribed to these users:'));
+hunk ./actions/invite.php 91
+-                common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
++                common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
+hunk ./actions/invite.php 96
+-            common_element('p', NULL, _('These people are already users and you were automatically subscribed to them:'));
++            common_element('p', null, _('These people are already users and you were automatically subscribed to them:'));
+hunk ./actions/invite.php 99
+-                common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
++                common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
+hunk ./actions/invite.php 104
+-            common_element('p', NULL, _('Invitation(s) sent to the following people:'));
++            common_element('p', null, _('Invitation(s) sent to the following people:'));
+hunk ./actions/invite.php 107
+-                common_element('li', NULL, $other);
++                common_element('li', null, $other);
+hunk ./actions/invite.php 110
+-            common_element('p', NULL, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
++            common_element('p', null, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
 hunk ./actions/invite.php 115
--	function show_top($error=NULL) {
--		if ($error) {
--			common_element('p', 'error', $error);
--		} else {
--			common_element_start('div', 'instructions');
--			common_element('p', NULL,
--						   _('Use this form to invite your friends and colleagues to use this service.'));
--			common_element_end('div');
--		}
--	}
-+    function show_top($error=NULL) {
-+        if ($error) {
-+            common_element('p', 'error', $error);
-+        } else {
-+            common_element_start('div', 'instructions');
-+            common_element('p', NULL,
-+                           _('Use this form to invite your friends and colleagues to use this service.'));
-+            common_element_end('div');
-+        }
-+    }
+-    function show_top($error=NULL) {
++    function show_top($error=null) {
+hunk ./actions/invite.php 120
+-            common_element('p', NULL,
++            common_element('p', null,
 hunk ./actions/invite.php 126
--	function show_form($error=NULL) {
-+    function show_form($error=NULL) {
-hunk ./actions/invite.php 128
--		global $config;
-+        global $config;
+-    function show_form($error=NULL) {
++    function show_form($error=null) {
 hunk ./actions/invite.php 130
--		common_show_header(_('Invite new users'), NULL, $error, array($this, 'show_top'));
-+        common_show_header(_('Invite new users'), NULL, $error, array($this, 'show_top'));
-hunk ./actions/invite.php 132
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'invite',
--										   'action' => common_local_url('invite')));
--		common_hidden('token', common_session_token());
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'invite',
-+                                           'action' => common_local_url('invite')));
-+        common_hidden('token', common_session_token());
-hunk ./actions/invite.php 137
--		common_textarea('addresses', _('Email addresses'),
--						$this->trimmed('addresses'),
--						_('Addresses of friends to invite (one per line)'));
-+        common_textarea('addresses', _('Email addresses'),
-+                        $this->trimmed('addresses'),
-+                        _('Addresses of friends to invite (one per line)'));
-hunk ./actions/invite.php 141
--		common_textarea('personal', _('Personal message'),
--						$this->trimmed('personal'),
--						_('Optionally add a personal message to the invitation.'));
-+        common_textarea('personal', _('Personal message'),
-+                        $this->trimmed('personal'),
-+                        _('Optionally add a personal message to the invitation.'));
-hunk ./actions/invite.php 145
--		common_submit('send', _('Send'));
-+        common_submit('send', _('Send'));
-hunk ./actions/invite.php 147
--		common_element_end('form');
-+        common_element_end('form');
-hunk ./actions/invite.php 149
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/invite.php 152
--	function send_invitation($email, $user, $personal) {
-+    function send_invitation($email, $user, $personal) {
-hunk ./actions/invite.php 154
--		$profile = $user->getProfile();
--		$bestname = $profile->getBestName();
-+        $profile = $user->getProfile();
-+        $bestname = $profile->getBestName();
-hunk ./actions/invite.php 157
--		$sitename = common_config('site', 'name');
-+        $sitename = common_config('site', 'name');
-hunk ./actions/invite.php 159
--		$invite = new Invitation();
-+        $invite = new Invitation();
-hunk ./actions/invite.php 161
--		$invite->address = $email;
--		$invite->address_type = 'email';
--		$invite->code = common_confirmation_code(128);
--		$invite->user_id = $user->id;
--		$invite->created = common_sql_now();
-+        $invite->address = $email;
-+        $invite->address_type = 'email';
-+        $invite->code = common_confirmation_code(128);
-+        $invite->user_id = $user->id;
-+        $invite->created = common_sql_now();
-hunk ./actions/invite.php 167
--		if (!$invite->insert()) {
--			common_log_db_error($invite, 'INSERT', __FILE__);
--			return false;
--		}
-+        if (!$invite->insert()) {
-+            common_log_db_error($invite, 'INSERT', __FILE__);
-+            return false;
-+        }
-hunk ./actions/invite.php 172
--		$recipients = array($email);
-+        $recipients = array($email);
-hunk ./actions/invite.php 174
--		$headers['From'] = mail_notify_from();
--		$headers['To'] = $email;
--		$headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename);
-+        $headers['From'] = mail_notify_from();
-+        $headers['To'] = $email;
-+        $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename);
-hunk ./actions/invite.php 178
--		$body = sprintf(_("%1\$s has invited you to join them on %2\$s (%3\$s).\n\n".
--						  "%2\$s is a micro-blogging service that lets you keep up-to-date with people you know and people who interest you.\n\n".
--						  "You can also share news about yourself, your thoughts, or your life online with people who know about you. ".
--						  "It's also great for meeting new people who share your interests.\n\n".
--						  "%1\$s said:\n\n%4\$s\n\n".
--						  "You can see %1\$s's profile page on %2\$s here:\n\n".
--						  "%5\$s\n\n".
--						  "If you'd like to try the service, click on the link below to accept the invitation.\n\n".
--						  "%6\$s\n\n".
--						  "If not, you can ignore this message. Thanks for your patience and your time.\n\n".
--						  "Sincerely, %2\$s\n"),
--						$bestname,
--						$sitename,
--						common_root_url(),
--						$personal,
--						common_local_url('showstream', array('nickname' => $user->nickname)),
--						common_local_url('register', array('code' => $invite->code)));
-+        $body = sprintf(_("%1\$s has invited you to join them on %2\$s (%3\$s).\n\n".
-+                          "%2\$s is a micro-blogging service that lets you keep up-to-date with people you know and people who interest you.\n\n".
-+                          "You can also share news about yourself, your thoughts, or your life online with people who know about you. ".
-+                          "It's also great for meeting new people who share your interests.\n\n".
-+                          "%1\$s said:\n\n%4\$s\n\n".
-+                          "You can see %1\$s's profile page on %2\$s here:\n\n".
-+                          "%5\$s\n\n".
-+                          "If you'd like to try the service, click on the link below to accept the invitation.\n\n".
-+                          "%6\$s\n\n".
-+                          "If not, you can ignore this message. Thanks for your patience and your time.\n\n".
-+                          "Sincerely, %2\$s\n"),
-+                        $bestname,
-+                        $sitename,
-+                        common_root_url(),
-+                        $personal,
-+                        common_local_url('showstream', array('nickname' => $user->nickname)),
-+                        common_local_url('register', array('code' => $invite->code)));
-hunk ./actions/invite.php 196
--		mail_send($recipients, $headers, $body);
--	}
-+        mail_send($recipients, $headers, $body);
-+    }
-hunk ./actions/login.php 24
--	function is_readonly() {
--		return true;
--	}
-+    function is_readonly() {
-+        return true;
-+    }
-hunk ./actions/login.php 28
--	function handle($args) {
--		parent::handle($args);
--		if (common_is_real_login()) {
--			common_user_error(_('Already logged in.'));
--		} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
--			$this->check_login();
--		} else {
--			$this->show_form();
--		}
--	}
-+    function handle($args) {
-+        parent::handle($args);
-+        if (common_is_real_login()) {
-+            common_user_error(_('Already logged in.'));
-+        } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-+            $this->check_login();
-+        } else {
-+            $this->show_form();
-+        }
-+    }
-hunk ./actions/login.php 39
--	function check_login() {
--		# XXX: login throttle
-+    function check_login() {
-+        # XXX: login throttle
-hunk ./actions/login.php 42
--		# CSRF protection - token set in common_notice_form()
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->client_error(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        # CSRF protection - token set in common_notice_form()
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->client_error(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/login.php 49
--		$nickname = common_canonical_nickname($this->trimmed('nickname'));
--		$password = $this->arg('password');
--		if (common_check_user($nickname, $password)) {
--			# success!
--			if (!common_set_user($nickname)) {
--				common_server_error(_('Error setting user.'));
--				return;
--			}
--			common_real_login(true);
--			if ($this->boolean('rememberme')) {
--				common_debug('Adding rememberme cookie for ' . $nickname);
--				common_rememberme();
--			}
--			# success!
--			$url = common_get_returnto();
--			if ($url) {
--				# We don't have to return to it again
--				common_set_returnto(NULL);
--			} else {
--				$url = common_local_url('all',
--										array('nickname' =>
--											  $nickname));
--			}
--			common_redirect($url);
--		} else {
--			$this->show_form(_('Incorrect username or password.'));
--			return;
--		}
-+        $nickname = common_canonical_nickname($this->trimmed('nickname'));
-+        $password = $this->arg('password');
-+        if (common_check_user($nickname, $password)) {
-+            # success!
-+            if (!common_set_user($nickname)) {
-+                common_server_error(_('Error setting user.'));
-+                return;
-+            }
-+            common_real_login(true);
-+            if ($this->boolean('rememberme')) {
-+                common_debug('Adding rememberme cookie for ' . $nickname);
-+                common_rememberme();
-+            }
-+            # success!
-+            $url = common_get_returnto();
-+            if ($url) {
-+                # We don't have to return to it again
-+                common_set_returnto(NULL);
-+            } else {
-+                $url = common_local_url('all',
-+                                        array('nickname' =>
-+                                              $nickname));
-+            }
-+            common_redirect($url);
-+        } else {
-+            $this->show_form(_('Incorrect username or password.'));
-+            return;
-+        }
-hunk ./actions/login.php 78
--		# success!
--		if (!common_set_user($user)) {
--			common_server_error(_('Error setting user.'));
--			return;
--		}
-+        # success!
-+        if (!common_set_user($user)) {
-+            common_server_error(_('Error setting user.'));
-+            return;
-+        }
-hunk ./actions/login.php 84
--		common_real_login(true);
-+        common_real_login(true);
-hunk ./actions/login.php 86
--		if ($this->boolean('rememberme')) {
--			common_debug('Adding rememberme cookie for ' . $nickname);
--			common_rememberme($user);
--		}
--		# success!
--		$url = common_get_returnto();
--		if ($url) {
--			# We don't have to return to it again
--			common_set_returnto(NULL);
--		} else {
--			$url = common_local_url('all',
--									array('nickname' =>
--										  $nickname));
--		}
--		common_redirect($url);
--	}
-+        if ($this->boolean('rememberme')) {
-+            common_debug('Adding rememberme cookie for ' . $nickname);
-+            common_rememberme($user);
-+        }
-+        # success!
-+        $url = common_get_returnto();
-+        if ($url) {
-+            # We don't have to return to it again
-+            common_set_returnto(NULL);
-+        } else {
-+            $url = common_local_url('all',
-+                                    array('nickname' =>
-+                                          $nickname));
-+        }
-+        common_redirect($url);
-+    }
+-        common_show_header(_('Invite new users'), NULL, $error, array($this, 'show_top'));
++        common_show_header(_('Invite new users'), null, $error, array($this, 'show_top'));
+hunk ./actions/login.php 66
+-                common_set_returnto(NULL);
++                common_set_returnto(null);
+hunk ./actions/login.php 94
+-            common_set_returnto(NULL);
++            common_set_returnto(null);
 hunk ./actions/login.php 103
--	function show_form($error=NULL) {
--		common_show_header(_('Login'), NULL, $error, array($this, 'show_top'));
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'login',
--										   'action' => common_local_url('login')));
--		common_input('nickname', _('Nickname'));
--		common_password('password', _('Password'));
--		common_checkbox('rememberme', _('Remember me'), false,
--		                _('Automatically login in the future; ' .
--		                   'not for shared computers!'));
--		common_submit('submit', _('Login'));
--		common_hidden('token', common_session_token());
--		common_element_end('form');
--		common_element_start('p');
--		common_element('a', array('href' => common_local_url('recoverpassword')),
--					   _('Lost or forgotten password?'));
--		common_element_end('p');
--		common_show_footer();
--	}
-+    function show_form($error=NULL) {
-+        common_show_header(_('Login'), NULL, $error, array($this, 'show_top'));
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'login',
-+                                           'action' => common_local_url('login')));
-+        common_input('nickname', _('Nickname'));
-+        common_password('password', _('Password'));
-+        common_checkbox('rememberme', _('Remember me'), false,
-+                        _('Automatically login in the future; ' .
-+                           'not for shared computers!'));
-+        common_submit('submit', _('Login'));
-+        common_hidden('token', common_session_token());
-+        common_element_end('form');
-+        common_element_start('p');
-+        common_element('a', array('href' => common_local_url('recoverpassword')),
-+                       _('Lost or forgotten password?'));
-+        common_element_end('p');
-+        common_show_footer();
-+    }
-hunk ./actions/login.php 123
--	function get_instructions() {
--		if (common_logged_in() &&
--			!common_is_real_login() &&
--			common_get_returnto())
--		{
--			# rememberme logins have to reauthenticate before
--			# changing any profile settings (cookie-stealing protection)
--			return _('For security reasons, please re-enter your ' .
--					 'user name and password ' .
--					 'before changing your settings.');
--		} else {
--			return _('Login with your username and password. ' .
--					 'Don\'t have a username yet? ' .
--					 '[Register](%%action.register%%) a new account, or ' .
--					 'try [OpenID](%%action.openidlogin%%). ');
--		}
--	}
-+    function get_instructions() {
-+        if (common_logged_in() &&
-+            !common_is_real_login() &&
-+            common_get_returnto())
-+        {
-+            # rememberme logins have to reauthenticate before
-+            # changing any profile settings (cookie-stealing protection)
-+            return _('For security reasons, please re-enter your ' .
-+                     'user name and password ' .
-+                     'before changing your settings.');
-+        } else {
-+            return _('Login with your username and password. ' .
-+                     'Don\'t have a username yet? ' .
-+                     '[Register](%%action.register%%) a new account, or ' .
-+                     'try [OpenID](%%action.openidlogin%%). ');
-+        }
-+    }
+-    function show_form($error=NULL) {
+-        common_show_header(_('Login'), NULL, $error, array($this, 'show_top'));
++    function show_form($error=null) {
++        common_show_header(_('Login'), null, $error, array($this, 'show_top'));
 hunk ./actions/login.php 141
--	function show_top($error=NULL) {
--		if ($error) {
--			common_element('p', 'error', $error);
--		} else {
--			$instr = $this->get_instructions();
--			$output = common_markup_to_html($instr);
--			common_element_start('div', 'instructions');
--			common_raw($output);
--			common_element_end('div');
--		}
--	}
-+    function show_top($error=NULL) {
-+        if ($error) {
-+            common_element('p', 'error', $error);
-+        } else {
-+            $instr = $this->get_instructions();
-+            $output = common_markup_to_html($instr);
-+            common_element_start('div', 'instructions');
-+            common_raw($output);
-+            common_element_end('div');
-+        }
-+    }
-hunk ./actions/logout.php 25
--	
--	function is_readonly() {
--		return true;
--	}
--	
--	function handle($args) {
--		parent::handle($args);
--		if (!common_logged_in()) {
--			common_user_error(_('Not logged in.'));
--		} else {
--			common_set_user(NULL);
--			common_real_login(false); # not logged in
--			common_forgetme(); # don't log back in!
--			common_redirect(common_local_url('public'));
--		}
--	}
-+    
-+    function is_readonly() {
-+        return true;
-+    }
-+    
-+    function handle($args) {
-+        parent::handle($args);
-+        if (!common_logged_in()) {
-+            common_user_error(_('Not logged in.'));
-+        } else {
-+            common_set_user(NULL);
-+            common_real_login(false); # not logged in
-+            common_forgetme(); # don't log back in!
-+            common_redirect(common_local_url('public'));
-+        }
-+    }
-hunk ./actions/microsummary.php 24
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/microsummary.php 26
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/microsummary.php 28
--		$nickname = common_canonical_nickname($this->arg('nickname'));
--		$user = User::staticGet('nickname', $nickname);
-+        $nickname = common_canonical_nickname($this->arg('nickname'));
-+        $user = User::staticGet('nickname', $nickname);
-hunk ./actions/microsummary.php 31
--		if (!$user) {
--			$this->client_error(_('No such user'), 404);
--			return;
--		}
--		
--		$notice = $user->getCurrentNotice();
--		
--		if (!$notice) {
--			$this->client_error(_('No current status'), 404);
--		}
--		
--		header('Content-Type: text/plain');
--		
--		print $user->nickname . ': ' . $notice->content;
--	}
-+        if (!$user) {
-+            $this->client_error(_('No such user'), 404);
-+            return;
-+        }
-+        
-+        $notice = $user->getCurrentNotice();
-+        
-+        if (!$notice) {
-+            $this->client_error(_('No current status'), 404);
-+        }
-+        
-+        header('Content-Type: text/plain');
-+        
-+        print $user->nickname . ': ' . $notice->content;
-+    }
-hunk ./actions/newmessage.php 23
--	
--	function handle($args) {
--		parent::handle($args);
-+    
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/newmessage.php 27
--		if (!common_logged_in()) {
--			$this->client_error(_('Not logged in.'), 403);
--		} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
--			$this->save_new_message();
--		} else {
--			$this->show_form();
--		}
--	}
-+        if (!common_logged_in()) {
-+            $this->client_error(_('Not logged in.'), 403);
-+        } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-+            $this->save_new_message();
-+        } else {
-+            $this->show_form();
-+        }
-+    }
-hunk ./actions/newmessage.php 36
--	function save_new_message() {
--		$user = common_current_user();
--		assert($user); # XXX: maybe an error instead...
-+    function save_new_message() {
-+        $user = common_current_user();
-+        assert($user); # XXX: maybe an error instead...
-hunk ./actions/newmessage.php 40
--		# CSRF protection
--		
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
--		
--		$content = $this->trimmed('content');
--		$to = $this->trimmed('to');
--		
--		if (!$content) {
--			$this->show_form(_('No content!'));
--			return;
--		} else {
--			$content_shortened = common_shorten_links($content);
-+        # CSRF protection
-+        
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-+        
-+        $content = $this->trimmed('content');
-+        $to = $this->trimmed('to');
-+        
-+        if (!$content) {
-+            $this->show_form(_('No content!'));
-+            return;
-+        } else {
-+            $content_shortened = common_shorten_links($content);
-hunk ./actions/newmessage.php 57
--			if (mb_strlen($content_shortened) > 140) {
--				common_debug("Content = '$content_shortened'", __FILE__);
--				common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
--				$this->show_form(_('That\'s too long. Max message size is 140 chars.'));
--				return;
--			}
--		}
-+            if (mb_strlen($content_shortened) > 140) {
-+                common_debug("Content = '$content_shortened'", __FILE__);
-+                common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
-+                $this->show_form(_('That\'s too long. Max message size is 140 chars.'));
-+                return;
-+            }
-+        }
-hunk ./actions/newmessage.php 65
--		$other = User::staticGet('id', $to);
--		
--		if (!$other) {
--			$this->show_form(_('No recipient specified.'));
--			return;
--		} else if (!$user->mutuallySubscribed($other)) {
--			$this->client_error(_('You can\'t send a message to this user.'), 404);
--			return;
--		} else if ($user->id == $other->id) {
--			$this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), 403);
--			return;
--		}
--		
--		$message = Message::saveNew($user->id, $other->id, $content, 'web');
--		
--		if (is_string($message)) {
--			$this->show_form($message);
--			return;
--		}
-+        $other = User::staticGet('id', $to);
-+        
-+        if (!$other) {
-+            $this->show_form(_('No recipient specified.'));
-+            return;
-+        } else if (!$user->mutuallySubscribed($other)) {
-+            $this->client_error(_('You can\'t send a message to this user.'), 404);
-+            return;
-+        } else if ($user->id == $other->id) {
-+            $this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), 403);
-+            return;
-+        }
-+        
-+        $message = Message::saveNew($user->id, $other->id, $content, 'web');
-+        
-+        if (is_string($message)) {
-+            $this->show_form($message);
-+            return;
-+        }
-hunk ./actions/newmessage.php 85
--		$this->notify($user, $other, $message);
-+        $this->notify($user, $other, $message);
-hunk ./actions/newmessage.php 87
--		$url = common_local_url('outbox', array('nickname' => $user->nickname));
-+        $url = common_local_url('outbox', array('nickname' => $user->nickname));
-hunk ./actions/newmessage.php 89
--		common_redirect($url, 303);
--	}
-+        common_redirect($url, 303);
-+    }
-hunk ./actions/newmessage.php 92
--	function show_top($params) {
-+    function show_top($params) {
-hunk ./actions/newmessage.php 94
--		list($content, $user, $to) = $params;
--		
--		assert(!is_null($user));
-+        list($content, $user, $to) = $params;
-+        
-+        assert(!is_null($user));
-hunk ./actions/newmessage.php 98
--		common_message_form($content, $user, $to);
--	}
-+        common_message_form($content, $user, $to);
-+    }
+-    function show_top($error=NULL) {
++    function show_top($error=null) {
+hunk ./actions/logout.php 35
+-            common_set_user(NULL);
++            common_set_user(null);
 hunk ./actions/newmessage.php 101
--	function show_form($msg=NULL) {
--		
--		$content = $this->trimmed('content');
--		$user = common_current_user();
-+    function show_form($msg=NULL) {
-+        
-+        $content = $this->trimmed('content');
-+        $user = common_current_user();
-hunk ./actions/newmessage.php 106
--		$to = $this->trimmed('to');
--		
--		$other = User::staticGet('id', $to);
-+        $to = $this->trimmed('to');
-+        
-+        $other = User::staticGet('id', $to);
-hunk ./actions/newmessage.php 110
--		if (!$other) {
--			$this->client_error(_('No such user'), 404);
--			return;
--		}
-+        if (!$other) {
-+            $this->client_error(_('No such user'), 404);
-+            return;
-+        }
-hunk ./actions/newmessage.php 115
--		if (!$user->mutuallySubscribed($other)) {
--			$this->client_error(_('You can\'t send a message to this user.'), 404);
--			return;
--		}
--		
--		common_show_header(_('New message'), NULL,
--						   array($content, $user, $other),
--		                   array($this, 'show_top'));
--		
--		if ($msg) {
--			common_element('p', array('id'=>'error'), $msg);
--		}
--		
--		common_show_footer();
--	}
--	
--	function notify($from, $to, $message) {
--		mail_notify_message($message, $from, $to);
--		# XXX: Jabber, SMS notifications... probably queued
--	}
-+        if (!$user->mutuallySubscribed($other)) {
-+            $this->client_error(_('You can\'t send a message to this user.'), 404);
-+            return;
-+        }
-+        
-+        common_show_header(_('New message'), NULL,
-+                           array($content, $user, $other),
-+                           array($this, 'show_top'));
-+        
-+        if ($msg) {
-+            common_element('p', array('id'=>'error'), $msg);
-+        }
-+        
-+        common_show_footer();
-+    }
-+    
-+    function notify($from, $to, $message) {
-+        mail_notify_message($message, $from, $to);
-+        # XXX: Jabber, SMS notifications... probably queued
-+    }
-hunk ./actions/newnotice.php 13
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./actions/newnotice.php 17
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./actions/newnotice.php 26
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/newnotice.php 29
--		if (!common_logged_in()) {
--			common_user_error(_('Not logged in.'));
--		} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-+        if (!common_logged_in()) {
-+            common_user_error(_('Not logged in.'));
-+        } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-hunk ./actions/newnotice.php 33
--			# CSRF protection - token set in common_notice_form()
--			$token = $this->trimmed('token');
--			if (!$token || $token != common_session_token()) {
--				$this->client_error(_('There was a problem with your session token. Try again, please.'));
--				return;
--			}
-+            # CSRF protection - token set in common_notice_form()
-+            $token = $this->trimmed('token');
-+            if (!$token || $token != common_session_token()) {
-+                $this->client_error(_('There was a problem with your session token. Try again, please.'));
-+                return;
-+            }
-hunk ./actions/newnotice.php 40
--			$this->save_new_notice();
--		} else {
--			$this->show_form();
--		}
--	}
-+            $this->save_new_notice();
-+        } else {
-+            $this->show_form();
-+        }
-+    }
-hunk ./actions/newnotice.php 46
--	function save_new_notice() {
-+    function save_new_notice() {
-hunk ./actions/newnotice.php 48
--		$user = common_current_user();
--		assert($user); # XXX: maybe an error instead...
--		$content = $this->trimmed('status_textarea');
-+        $user = common_current_user();
-+        assert($user); # XXX: maybe an error instead...
-+        $content = $this->trimmed('status_textarea');
-hunk ./actions/newnotice.php 52
--		if (!$content) {
--			$this->show_form(_('No content!'));
--			return;
--		} else {
--			$content_shortened = common_shorten_links($content);
-+        if (!$content) {
-+            $this->show_form(_('No content!'));
-+            return;
-+        } else {
-+            $content_shortened = common_shorten_links($content);
-hunk ./actions/newnotice.php 58
--			if (mb_strlen($content_shortened) > 140) {
--				common_debug("Content = '$content_shortened'", __FILE__);
--				common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
--				$this->show_form(_('That\'s too long. Max notice size is 140 chars.'));
--				return;
--			}
--		}
-+            if (mb_strlen($content_shortened) > 140) {
-+                common_debug("Content = '$content_shortened'", __FILE__);
-+                common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
-+                $this->show_form(_('That\'s too long. Max notice size is 140 chars.'));
-+                return;
-+            }
-+        }
-hunk ./actions/newnotice.php 66
--		$inter = new CommandInterpreter();
-+        $inter = new CommandInterpreter();
-hunk ./actions/newnotice.php 68
--		$cmd = $inter->handle_command($user, $content_shortened);
-+        $cmd = $inter->handle_command($user, $content_shortened);
-hunk ./actions/newnotice.php 70
--		if ($cmd) {
--			if ($this->boolean('ajax')) {
--				$cmd->execute(new AjaxWebChannel());
--			} else {
--				$cmd->execute(new WebChannel());
--			}
--			return;
--		}
-+        if ($cmd) {
-+            if ($this->boolean('ajax')) {
-+                $cmd->execute(new AjaxWebChannel());
-+            } else {
-+                $cmd->execute(new WebChannel());
-+            }
-+            return;
-+        }
-hunk ./actions/newnotice.php 79
--		$replyto = $this->trimmed('inreplyto');
-+        $replyto = $this->trimmed('inreplyto');
+-    function show_form($msg=NULL) {
++    function show_form($msg=null) {
+hunk ./actions/newmessage.php 120
+-        common_show_header(_('New message'), NULL,
++        common_show_header(_('New message'), null,
 hunk ./actions/newnotice.php 81
--		$notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? NULL : $replyto);
-+        $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? NULL : $replyto);
-hunk ./actions/newnotice.php 83
--		if (is_string($notice)) {
--			$this->show_form($notice);
--			return;
--		}
-+        if (is_string($notice)) {
-+            $this->show_form($notice);
-+            return;
-+        }
-hunk ./actions/newnotice.php 88
--		common_broadcast_notice($notice);
-+        common_broadcast_notice($notice);
-hunk ./actions/newnotice.php 90
--		if ($this->boolean('ajax')) {
--			common_start_html('text/xml;charset=utf-8', true);
--			common_element_start('head');
--			common_element('title', null, _('Notice posted'));
--			common_element_end('head');
--			common_element_start('body');
--			$this->show_notice($notice);
--			common_element_end('body');
--			common_element_end('html');
--		} else {
--			$returnto = $this->trimmed('returnto');
-+        if ($this->boolean('ajax')) {
-+            common_start_html('text/xml;charset=utf-8', true);
-+            common_element_start('head');
-+            common_element('title', null, _('Notice posted'));
-+            common_element_end('head');
-+            common_element_start('body');
-+            $this->show_notice($notice);
-+            common_element_end('body');
-+            common_element_end('html');
-+        } else {
-+            $returnto = $this->trimmed('returnto');
-hunk ./actions/newnotice.php 102
--			if ($returnto) {
--				$url = common_local_url($returnto,
--										array('nickname' => $user->nickname));
--			} else {
--				$url = common_local_url('shownotice',
--										array('notice' => $notice->id));
--			}
--			common_redirect($url, 303);
--		}
--	}
-+            if ($returnto) {
-+                $url = common_local_url($returnto,
-+                                        array('nickname' => $user->nickname));
-+            } else {
-+                $url = common_local_url('shownotice',
-+                                        array('notice' => $notice->id));
-+            }
-+            common_redirect($url, 303);
-+        }
-+    }
-hunk ./actions/newnotice.php 113
--	function ajax_error_msg($msg) {
--		common_start_html('text/xml;charset=utf-8', true);
--		common_element_start('head');
--		common_element('title', null, _('Ajax Error'));
--		common_element_end('head');
--		common_element_start('body');
--		common_element('p', array('id' => 'error'), $msg);
--		common_element_end('body');
--		common_element_end('html');
--	}
-+    function ajax_error_msg($msg) {
-+        common_start_html('text/xml;charset=utf-8', true);
-+        common_element_start('head');
-+        common_element('title', null, _('Ajax Error'));
-+        common_element_end('head');
-+        common_element_start('body');
-+        common_element('p', array('id' => 'error'), $msg);
-+        common_element_end('body');
-+        common_element_end('html');
-+    }
+-        $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? NULL : $replyto);
++        $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? null : $replyto);
 hunk ./actions/newnotice.php 124
--	function show_top($content=NULL) {
--		common_notice_form(NULL, $content);
--	}
-+    function show_top($content=NULL) {
-+        common_notice_form(NULL, $content);
-+    }
+-    function show_top($content=NULL) {
+-        common_notice_form(NULL, $content);
++    function show_top($content=null) {
++        common_notice_form(null, $content);
 hunk ./actions/newnotice.php 128
--	function show_form($msg=NULL) {
--		if ($msg && $this->boolean('ajax')) {
--			$this->ajax_error_msg($msg);
--			return;
--		}
--		$content = $this->trimmed('status_textarea');
--		if (!$content) {
--			$replyto = $this->trimmed('replyto');
--			$profile = Profile::staticGet('nickname', $replyto);
--			if ($profile) {
--				$content = '@' . $profile->nickname . ' ';
--			}
--		}
--		common_show_header(_('New notice'), NULL, $content,
--						   array($this, 'show_top'));
--		if ($msg) {
--			common_element('p', array('id' => 'error'), $msg);
--		}
--		common_show_footer();
--	}
-+    function show_form($msg=NULL) {
-+        if ($msg && $this->boolean('ajax')) {
-+            $this->ajax_error_msg($msg);
-+            return;
-+        }
-+        $content = $this->trimmed('status_textarea');
-+        if (!$content) {
-+            $replyto = $this->trimmed('replyto');
-+            $profile = Profile::staticGet('nickname', $replyto);
-+            if ($profile) {
-+                $content = '@' . $profile->nickname . ' ';
-+            }
-+        }
-+        common_show_header(_('New notice'), NULL, $content,
-+                           array($this, 'show_top'));
-+        if ($msg) {
-+            common_element('p', array('id' => 'error'), $msg);
-+        }
-+        common_show_footer();
-+    }
-hunk ./actions/newnotice.php 149
--	function show_notice($notice) {
-+    function show_notice($notice) {
-hunk ./actions/newnotice.php 152
--	}
-+    }
-hunk ./actions/noticesearch.php 28
--	function get_instructions() {
--		return _('Search for notices on %%site.name%% by their contents. Separate search terms by spaces; they must be 3 characters or more.');
--	}
-+    function get_instructions() {
-+        return _('Search for notices on %%site.name%% by their contents. Separate search terms by spaces; they must be 3 characters or more.');
-+    }
-hunk ./actions/noticesearch.php 32
--	function get_title() {
--		return _('Text search');
--	}
-+    function get_title() {
-+        return _('Text search');
-+    }
-hunk ./actions/noticesearch.php 36
--	function show_results($q, $page) {
-+    function show_results($q, $page) {
-hunk ./actions/noticesearch.php 38
--		$notice = new Notice();
-+        $notice = new Notice();
-hunk ./actions/noticesearch.php 40
--		# lcase it for comparison
--		$q = strtolower($q);
-+        # lcase it for comparison
-+        $q = strtolower($q);
-hunk ./actions/noticesearch.php 46
--		# Ask for an extra to see if there's more.
--		$search_engine->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
-+        # Ask for an extra to see if there's more.
-+        $search_engine->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
-hunk ./actions/noticesearch.php 53
--	    	$cnt = $notice->find();
-+            $cnt = $notice->find();
-+        }
-+        if ($cnt > 0) {
-+            $terms = preg_split('/[\s,]+/', $q);
-+            common_element_start('ul', array('id' => 'notices'));
-+            for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
-+                if ($notice->fetch()) {
-+                    $this->show_notice($notice, $terms);
-+                } else {
-+                    // shouldn't happen!
-+                    break;
-+                }
-+            }
-+            common_element_end('ul');
-+        } else {
-+            common_element('p', 'error', _('No results'));
-hunk ./actions/noticesearch.php 70
--		if ($cnt > 0) {
--			$terms = preg_split('/[\s,]+/', $q);
--			common_element_start('ul', array('id' => 'notices'));
--			for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
--				if ($notice->fetch()) {
--					$this->show_notice($notice, $terms);
--				} else {
--					// shouldn't happen!
--					break;
--				}
--			}
--			common_element_end('ul');
--		} else {
--			common_element('p', 'error', _('No results'));
--		}
-hunk ./actions/noticesearch.php 71
--		common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
--						  $page, 'noticesearch', array('q' => $q));
--	}
-+        common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
-+                          $page, 'noticesearch', array('q' => $q));
-+    }
-hunk ./actions/noticesearch.php 75
--	function show_header($arr) {
--		if ($arr) {
--			$q = $arr[0];
--		}
--		if ($q) {
--			common_element('link', array('rel' => 'alternate',
--										 'href' => common_local_url('noticesearchrss',
--																	array('q' => $q)),
--										 'type' => 'application/rss+xml',
--										 'title' => _('Search Stream Feed')));
--		}
--	}
-+    function show_header($arr) {
-+        if ($arr) {
-+            $q = $arr[0];
-+        }
-+        if ($q) {
-+            common_element('link', array('rel' => 'alternate',
-+                                         'href' => common_local_url('noticesearchrss',
-+                                                                    array('q' => $q)),
-+                                         'type' => 'application/rss+xml',
-+                                         'title' => _('Search Stream Feed')));
-+        }
-+    }
-hunk ./actions/noticesearch.php 88
--	# XXX: refactor and combine with StreamAction::show_notice()
-+    # XXX: refactor and combine with StreamAction::show_notice()
-hunk ./actions/noticesearch.php 90
--	function show_notice($notice, $terms) {
--		$profile = $notice->getProfile();
--		if (!$profile) {
--			common_log_db_error($notice, 'SELECT', __FILE__);
--			$this->server_error(_('Notice without matching profile'));
--			return;
--		}
--		# XXX: RDFa
--		common_element_start('li', array('class' => 'notice_single',
--										  'id' => 'notice-' . $notice->id));
--		$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
--		common_element_start('a', array('href' => $profile->profileurl));
--		common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
--									'class' => 'avatar stream',
--									'width' => AVATAR_STREAM_SIZE,
--									'height' => AVATAR_STREAM_SIZE,
--									'alt' =>
--									($profile->fullname) ? $profile->fullname :
--									$profile->nickname));
--		common_element_end('a');
--		common_element('a', array('href' => $profile->profileurl,
--								  'class' => 'nickname'),
--					   $profile->nickname);
--		# FIXME: URL, image, video, audio
--		common_element_start('p', array('class' => 'content'));
--		if ($notice->rendered) {
--			common_raw($this->highlight($notice->rendered, $terms));
--		} else {
--			# XXX: may be some uncooked notices in the DB,
--			# we cook them right now. This should probably disappear in future
--			# versions (>> 0.4.x)
--			common_raw($this->highlight(common_render_content($notice->content, $notice), $terms));
--		}
--		common_element_end('p');
--		$noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
--		common_element_start('p', 'time');
--		common_element('a', array('class' => 'permalink',
--								  'href' => $noticeurl,
--								  'title' => common_exact_date($notice->created)),
--					   common_date_string($notice->created));
--		if ($notice->reply_to) {
--			$replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
--			common_text(' (');
--			common_element('a', array('class' => 'inreplyto',
--									  'href' => $replyurl),
--						   _('in reply to...'));
--			common_text(')');
--		}
--		common_element_start('a',
--							 array('href' => common_local_url('newnotice',
--															  array('replyto' => $profile->nickname)),
--								   'onclick' => 'doreply("'.$profile->nickname.'"); return false',
--								   'title' => _('reply'),
--								   'class' => 'replybutton'));
--		common_hidden('posttoken', common_session_token());
--		
--		common_raw('&rarr;');
--		common_element_end('a');
--		common_element_end('p');
--		common_element_end('li');
--	}
-+    function show_notice($notice, $terms) {
-+        $profile = $notice->getProfile();
-+        if (!$profile) {
-+            common_log_db_error($notice, 'SELECT', __FILE__);
-+            $this->server_error(_('Notice without matching profile'));
-+            return;
-+        }
-+        # XXX: RDFa
-+        common_element_start('li', array('class' => 'notice_single',
-+                                          'id' => 'notice-' . $notice->id));
-+        $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
-+        common_element_start('a', array('href' => $profile->profileurl));
-+        common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
-+                                    'class' => 'avatar stream',
-+                                    'width' => AVATAR_STREAM_SIZE,
-+                                    'height' => AVATAR_STREAM_SIZE,
-+                                    'alt' =>
-+                                    ($profile->fullname) ? $profile->fullname :
-+                                    $profile->nickname));
-+        common_element_end('a');
-+        common_element('a', array('href' => $profile->profileurl,
-+                                  'class' => 'nickname'),
-+                       $profile->nickname);
-+        # FIXME: URL, image, video, audio
-+        common_element_start('p', array('class' => 'content'));
-+        if ($notice->rendered) {
-+            common_raw($this->highlight($notice->rendered, $terms));
-+        } else {
-+            # XXX: may be some uncooked notices in the DB,
-+            # we cook them right now. This should probably disappear in future
-+            # versions (>> 0.4.x)
-+            common_raw($this->highlight(common_render_content($notice->content, $notice), $terms));
-+        }
-+        common_element_end('p');
-+        $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
-+        common_element_start('p', 'time');
-+        common_element('a', array('class' => 'permalink',
-+                                  'href' => $noticeurl,
-+                                  'title' => common_exact_date($notice->created)),
-+                       common_date_string($notice->created));
-+        if ($notice->reply_to) {
-+            $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
-+            common_text(' (');
-+            common_element('a', array('class' => 'inreplyto',
-+                                      'href' => $replyurl),
-+                           _('in reply to...'));
-+            common_text(')');
-+        }
-+        common_element_start('a',
-+                             array('href' => common_local_url('newnotice',
-+                                                              array('replyto' => $profile->nickname)),
-+                                   'onclick' => 'doreply("'.$profile->nickname.'"); return false',
-+                                   'title' => _('reply'),
-+                                   'class' => 'replybutton'));
-+        common_hidden('posttoken', common_session_token());
-+        
-+        common_raw('&rarr;');
-+        common_element_end('a');
-+        common_element_end('p');
-+        common_element_end('li');
-+    }
-hunk ./actions/noticesearch.php 152
--	function highlight($text, $terms) {
--		/* Highligh serach terms */
--		$pattern = '/('.implode('|',array_map('htmlspecialchars', $terms)).')/i';
--		$result = preg_replace($pattern, '<strong>\\1</strong>', $text);
-+    function highlight($text, $terms) {
-+        /* Highligh serach terms */
-+        $pattern = '/('.implode('|',array_map('htmlspecialchars', $terms)).')/i';
-+        $result = preg_replace($pattern, '<strong>\\1</strong>', $text);
-hunk ./actions/noticesearch.php 157
--		/* Remove highlighting from inside links, loop incase multiple highlights in links */
--		$pattern = '/(href="[^"]*)<strong>('.implode('|',array_map('htmlspecialchars', $terms)).')<\/strong>([^"]*")/iU';
--		do {
--			$result = preg_replace($pattern, '\\1\\2\\3', $result, -1, $count);
--		} while ($count);
--		return $result;
--	}
-+        /* Remove highlighting from inside links, loop incase multiple highlights in links */
-+        $pattern = '/(href="[^"]*)<strong>('.implode('|',array_map('htmlspecialchars', $terms)).')<\/strong>([^"]*")/iU';
-+        do {
-+            $result = preg_replace($pattern, '\\1\\2\\3', $result, -1, $count);
-+        } while ($count);
-+        return $result;
-+    }
-hunk ./actions/noticesearchrss.php 28
--	function init() {
--		return true;
--	}
-+    function init() {
-+        return true;
-+    }
-hunk ./actions/noticesearchrss.php 32
--	function get_notices($limit=0) {
-+    function get_notices($limit=0) {
-hunk ./actions/noticesearchrss.php 34
--		$q = $this->trimmed('q');
--		$notices = array();
-+        $q = $this->trimmed('q');
-+        $notices = array();
-hunk ./actions/noticesearchrss.php 37
--		$notice = new Notice();
-+        $notice = new Notice();
-hunk ./actions/noticesearchrss.php 39
--		# lcase it for comparison
--		$q = strtolower($q);
-+        # lcase it for comparison
-+        $q = strtolower($q);
-hunk ./actions/noticesearchrss.php 45
--		if (!$limit) $limit = 20;
-+        if (!$limit) $limit = 20;
-hunk ./actions/noticesearchrss.php 48
--		$notice->find();
-+        $notice->find();
-hunk ./actions/noticesearchrss.php 50
--		while ($notice->fetch()) {
--			$notices[] = clone($notice);
--		}
-+        while ($notice->fetch()) {
-+            $notices[] = clone($notice);
-+        }
-hunk ./actions/noticesearchrss.php 54
--		return $notices;
--	}
-+        return $notices;
-+    }
-hunk ./actions/noticesearchrss.php 57
--	function get_channel() {
--		global $config;
--		$q = $this->trimmed('q');
--		$c = array('url' => common_local_url('noticesearchrss', array('q' => $q)),
--				   'title' => $config['site']['name'] . sprintf(_(' Search Stream for "%s"'), $q),
--				   'link' => common_local_url('noticesearch', array('q' => $q)),
--				   'description' => sprintf(_('All updates matching search term "%s"'), $q));
--		return $c;
--	}
-+    function get_channel() {
-+        global $config;
-+        $q = $this->trimmed('q');
-+        $c = array('url' => common_local_url('noticesearchrss', array('q' => $q)),
-+                   'title' => $config['site']['name'] . sprintf(_(' Search Stream for "%s"'), $q),
-+                   'link' => common_local_url('noticesearch', array('q' => $q)),
-+                   'description' => sprintf(_('All updates matching search term "%s"'), $q));
-+        return $c;
-+    }
-hunk ./actions/noticesearchrss.php 67
--	function get_image() {
--		return NULL;
--	}
-+    function get_image() {
-+        return NULL;
-+    }
-hunk ./actions/nudge.php 26
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/nudge.php 29
--		if (!common_logged_in()) {
--			$this->client_error(_('Not logged in.'));
--			return;
--		}
-+        if (!common_logged_in()) {
-+            $this->client_error(_('Not logged in.'));
-+            return;
-+        }
-hunk ./actions/nudge.php 34
--		$user = common_current_user();
--		$other = User::staticGet('nickname', $this->arg('nickname'));
-+        $user = common_current_user();
-+        $other = User::staticGet('nickname', $this->arg('nickname'));
-hunk ./actions/nudge.php 37
--		if ($_SERVER['REQUEST_METHOD'] != 'POST') {
--			common_redirect(common_local_url('showstream', array('nickname' => $other->nickname)));
--			return;
--		}
-+        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-+            common_redirect(common_local_url('showstream', array('nickname' => $other->nickname)));
-+            return;
-+        }
-hunk ./actions/nudge.php 42
--		# CSRF protection
-+        # CSRF protection
-hunk ./actions/nudge.php 44
--		$token = $this->trimmed('token');
--		
--		if (!$token || $token != common_session_token()) {
--			$this->client_error(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        $token = $this->trimmed('token');
-+        
-+        if (!$token || $token != common_session_token()) {
-+            $this->client_error(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/nudge.php 56
--		$this->notify($user, $other);
-+        $this->notify($user, $other);
-hunk ./actions/nudge.php 58
--		if ($this->boolean('ajax')) {
--			common_start_html('text/xml;charset=utf-8', true);
--			common_element_start('head');
--			common_element('title', null, _('Nudge sent'));
--			common_element_end('head');
--			common_element_start('body');
--			common_nudge_response();
--			common_element_end('body');
--			common_element_end('html');
--		} else {
-+        if ($this->boolean('ajax')) {
-+            common_start_html('text/xml;charset=utf-8', true);
-+            common_element_start('head');
-+            common_element('title', null, _('Nudge sent'));
-+            common_element_end('head');
-+            common_element_start('body');
-+            common_nudge_response();
-+            common_element_end('body');
-+            common_element_end('html');
-+        } else {
-hunk ./actions/nudge.php 69
--			common_redirect(common_local_url('showstream',
--											 array('nickname' => $other->nickname)));
--		}
--	}
-+            common_redirect(common_local_url('showstream',
-+                                             array('nickname' => $other->nickname)));
-+        }
-+    }
-hunk ./actions/nudge.php 74
--	function notify($user, $other) {
--		if ($other->id != $user->id) {
--			if ($other->email && $other->emailnotifynudge) {
--				mail_notify_nudge($user, $other);
--			}
--			# XXX: notify by IM
--			# XXX: notify by SMS
--		}
--	}
-+    function notify($user, $other) {
-+        if ($other->id != $user->id) {
-+            if ($other->email && $other->emailnotifynudge) {
-+                mail_notify_nudge($user, $other);
-+            }
-+            # XXX: notify by IM
-+            # XXX: notify by SMS
-+        }
-+    }
-hunk ./actions/openidlogin.php 26
--	function handle($args) {
--		parent::handle($args);
--		if (common_logged_in()) {
--			common_user_error(_('Already logged in.'));
--		} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
--			$openid_url = $this->trimmed('openid_url');
-+    function handle($args) {
-+        parent::handle($args);
-+        if (common_logged_in()) {
-+            common_user_error(_('Already logged in.'));
-+        } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-+            $openid_url = $this->trimmed('openid_url');
-hunk ./actions/openidlogin.php 33
--			# CSRF protection
--			$token = $this->trimmed('token');
--			if (!$token || $token != common_session_token()) {
--				$this->show_form(_('There was a problem with your session token. Try again, please.'), $openid_url);
--				return;
--			}
-+            # CSRF protection
-+            $token = $this->trimmed('token');
-+            if (!$token || $token != common_session_token()) {
-+                $this->show_form(_('There was a problem with your session token. Try again, please.'), $openid_url);
-+                return;
-+            }
-hunk ./actions/openidlogin.php 40
--			$rememberme = $this->boolean('rememberme');
--			
--			common_ensure_session();
--			
--			$_SESSION['openid_rememberme'] = $rememberme;
--			
--			$result = oid_authenticate($openid_url,
--									   'finishopenidlogin');
--			
--			if (is_string($result)) { # error message
--				unset($_SESSION['openid_rememberme']);
--				$this->show_form($result, $openid_url);
--			}
--		} else {
--			$openid_url = oid_get_last();
--			$this->show_form(NULL, $openid_url);
--		}
--	}
-+            $rememberme = $this->boolean('rememberme');
-+            
-+            common_ensure_session();
-+            
-+            $_SESSION['openid_rememberme'] = $rememberme;
-+            
-+            $result = oid_authenticate($openid_url,
-+                                       'finishopenidlogin');
-+            
-+            if (is_string($result)) { # error message
-+                unset($_SESSION['openid_rememberme']);
-+                $this->show_form($result, $openid_url);
-+            }
-+        } else {
-+            $openid_url = oid_get_last();
-+            $this->show_form(NULL, $openid_url);
-+        }
-+    }
-hunk ./actions/openidlogin.php 59
--	function get_instructions() {
--		return _('Login with an [OpenID](%%doc.openid%%) account.');
--	}
-+    function get_instructions() {
-+        return _('Login with an [OpenID](%%doc.openid%%) account.');
-+    }
+-    function show_form($msg=NULL) {
++    function show_form($msg=null) {
+hunk ./actions/newnotice.php 141
+-        common_show_header(_('New notice'), NULL, $content,
++        common_show_header(_('New notice'), null, $content,
+hunk ./actions/noticesearchrss.php 68
+-        return NULL;
++        return null;
+hunk ./actions/openidlogin.php 55
+-            $this->show_form(NULL, $openid_url);
++            $this->show_form(null, $openid_url);
 hunk ./actions/openidlogin.php 63
--	function show_top($error=NULL) {
--		if ($error) {
--			common_element('div', array('class' => 'error'), $error);
--		} else {
--			$instr = $this->get_instructions();
--			$output = common_markup_to_html($instr);
--			common_element_start('div', 'instructions');
--			common_raw($output);
--			common_element_end('div');
--		}
--	}
-+    function show_top($error=NULL) {
-+        if ($error) {
-+            common_element('div', array('class' => 'error'), $error);
-+        } else {
-+            $instr = $this->get_instructions();
-+            $output = common_markup_to_html($instr);
-+            common_element_start('div', 'instructions');
-+            common_raw($output);
-+            common_element_end('div');
-+        }
-+    }
+-    function show_top($error=NULL) {
++    function show_top($error=null) {
 hunk ./actions/openidlogin.php 75
--	function show_form($error=NULL, $openid_url) {
--		common_show_header(_('OpenID Login'), NULL, $error, array($this, 'show_top'));
--		$formaction = common_local_url('openidlogin');
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'openidlogin',
--										   'action' => $formaction));
--		common_hidden('token', common_session_token());
--		common_input('openid_url', _('OpenID URL'),
--					 $openid_url,
--					 _('Your OpenID URL'));
--		common_checkbox('rememberme', _('Remember me'), false,
--		                _('Automatically login in the future; ' .
--		                   'not for shared computers!'));
--		common_submit('submit', _('Login'));
--		common_element_end('form');
--		common_show_footer();
--	}
-+    function show_form($error=NULL, $openid_url) {
-+        common_show_header(_('OpenID Login'), NULL, $error, array($this, 'show_top'));
-+        $formaction = common_local_url('openidlogin');
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'openidlogin',
-+                                           'action' => $formaction));
-+        common_hidden('token', common_session_token());
-+        common_input('openid_url', _('OpenID URL'),
-+                     $openid_url,
-+                     _('Your OpenID URL'));
-+        common_checkbox('rememberme', _('Remember me'), false,
-+                        _('Automatically login in the future; ' .
-+                           'not for shared computers!'));
-+        common_submit('submit', _('Login'));
-+        common_element_end('form');
-+        common_show_footer();
-+    }
-hunk ./actions/openidsettings.php 27
--	function get_instructions() {
--		return _('[OpenID](%%doc.openid%%) lets you log into many sites ' .
--		          ' with the same user account. '.
--		          ' Manage your associated OpenIDs from here.');
--	}
-+    function get_instructions() {
-+        return _('[OpenID](%%doc.openid%%) lets you log into many sites ' .
-+                  ' with the same user account. '.
-+                  ' Manage your associated OpenIDs from here.');
-+    }
+-    function show_form($error=NULL, $openid_url) {
+-        common_show_header(_('OpenID Login'), NULL, $error, array($this, 'show_top'));
++    function show_form($error=null, $openid_url) {
++        common_show_header(_('OpenID Login'), null, $error, array($this, 'show_top'));
 hunk ./actions/openidsettings.php 33
--	function show_form($msg=NULL, $success=false) {
-+    function show_form($msg=NULL, $success=false) {
-hunk ./actions/openidsettings.php 35
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/openidsettings.php 37
--		$this->form_header(_('OpenID settings'), $msg, $success);
-+        $this->form_header(_('OpenID settings'), $msg, $success);
-hunk ./actions/openidsettings.php 39
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'openidadd',
--										   'action' =>
--										   common_local_url('openidsettings')));
--		common_hidden('token', common_session_token());
--		common_element('h2', NULL, _('Add OpenID'));
--		common_element('p', NULL,
--					   _('If you want to add an OpenID to your account, ' .
--						  'enter it in the box below and click "Add".'));
--		common_element_start('p');
--		common_element('label', array('for' => 'openid_url'),
--					   _('OpenID URL'));
--		common_element('input', array('name' => 'openid_url',
--									  'type' => 'text',
--									  'id' => 'openid_url'));
--		common_element('input', array('type' => 'submit',
--									  'id' => 'add',
--									  'name' => 'add',
--									  'class' => 'submit',
--									  'value' => _('Add')));
--		common_element_end('p');
--		common_element_end('form');
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'openidadd',
-+                                           'action' =>
-+                                           common_local_url('openidsettings')));
-+        common_hidden('token', common_session_token());
-+        common_element('h2', NULL, _('Add OpenID'));
-+        common_element('p', NULL,
-+                       _('If you want to add an OpenID to your account, ' .
-+                          'enter it in the box below and click "Add".'));
-+        common_element_start('p');
-+        common_element('label', array('for' => 'openid_url'),
-+                       _('OpenID URL'));
-+        common_element('input', array('name' => 'openid_url',
-+                                      'type' => 'text',
-+                                      'id' => 'openid_url'));
-+        common_element('input', array('type' => 'submit',
-+                                      'id' => 'add',
-+                                      'name' => 'add',
-+                                      'class' => 'submit',
-+                                      'value' => _('Add')));
-+        common_element_end('p');
-+        common_element_end('form');
-hunk ./actions/openidsettings.php 62
--		$oid = new User_openid();
--		$oid->user_id = $user->id;
-+        $oid = new User_openid();
-+        $oid->user_id = $user->id;
-hunk ./actions/openidsettings.php 65
--		$cnt = $oid->find();
-+        $cnt = $oid->find();
-hunk ./actions/openidsettings.php 67
--		if ($cnt > 0) {
-+        if ($cnt > 0) {
+-    function show_form($msg=NULL, $success=false) {
++    function show_form($msg=null, $success=false) {
+hunk ./actions/openidsettings.php 44
+-        common_element('h2', NULL, _('Add OpenID'));
+-        common_element('p', NULL,
++        common_element('h2', null, _('Add OpenID'));
++        common_element('p', null,
 hunk ./actions/openidsettings.php 69
--			common_element('h2', NULL, _('Remove OpenID'));
-+            common_element('h2', NULL, _('Remove OpenID'));
-hunk ./actions/openidsettings.php 71
--			if ($cnt == 1 && !$user->password) {
-+            if ($cnt == 1 && !$user->password) {
+-            common_element('h2', NULL, _('Remove OpenID'));
++            common_element('h2', null, _('Remove OpenID'));
 hunk ./actions/openidsettings.php 73
--				common_element('p', NULL,
--							   _('Removing your only OpenID would make it impossible to log in! ' .
--								  'If you need to remove it, add another OpenID first.'));
-+                common_element('p', NULL,
-+                               _('Removing your only OpenID would make it impossible to log in! ' .
-+                                  'If you need to remove it, add another OpenID first.'));
-hunk ./actions/openidsettings.php 77
--				if ($oid->fetch()) {
--					common_element_start('p');
--					common_element('a', array('href' => $oid->canonical),
--								   $oid->display);
--					common_element_end('p');
--				}
-+                if ($oid->fetch()) {
-+                    common_element_start('p');
-+                    common_element('a', array('href' => $oid->canonical),
-+                                   $oid->display);
-+                    common_element_end('p');
-+                }
-hunk ./actions/openidsettings.php 84
--			} else {
-+            } else {
+-                common_element('p', NULL,
++                common_element('p', null,
 hunk ./actions/openidsettings.php 86
--				common_element('p', NULL,
--							   _('You can remove an OpenID from your account '.
--								  'by clicking the button marked "Remove".'));
--				$idx = 0;
-+                common_element('p', NULL,
-+                               _('You can remove an OpenID from your account '.
-+                                  'by clicking the button marked "Remove".'));
-+                $idx = 0;
-hunk ./actions/openidsettings.php 91
--				while ($oid->fetch()) {
--					common_element_start('form', array('method' => 'POST',
--													   'id' => 'openiddelete' . $idx,
--													   'action' =>
--													   common_local_url('openidsettings')));
--					common_element_start('p');
--					common_hidden('token', common_session_token());
--					common_element('a', array('href' => $oid->canonical),
--								   $oid->display);
--					common_element('input', array('type' => 'hidden',
--												  'id' => 'openid_url'.$idx,
--												  'name' => 'openid_url',
--												  'value' => $oid->canonical));
--					common_element('input', array('type' => 'submit',
--												  'id' => 'remove'.$idx,
--												  'name' => 'remove',
--												  'class' => 'submit',
--												  'value' => _('Remove')));
--					common_element_end('p');
--					common_element_end('form');
--					$idx++;
--				}
--			}
--		}
-+                while ($oid->fetch()) {
-+                    common_element_start('form', array('method' => 'POST',
-+                                                       'id' => 'openiddelete' . $idx,
-+                                                       'action' =>
-+                                                       common_local_url('openidsettings')));
-+                    common_element_start('p');
-+                    common_hidden('token', common_session_token());
-+                    common_element('a', array('href' => $oid->canonical),
-+                                   $oid->display);
-+                    common_element('input', array('type' => 'hidden',
-+                                                  'id' => 'openid_url'.$idx,
-+                                                  'name' => 'openid_url',
-+                                                  'value' => $oid->canonical));
-+                    common_element('input', array('type' => 'submit',
-+                                                  'id' => 'remove'.$idx,
-+                                                  'name' => 'remove',
-+                                                  'class' => 'submit',
-+                                                  'value' => _('Remove')));
-+                    common_element_end('p');
-+                    common_element_end('form');
-+                    $idx++;
-+                }
-+            }
-+        }
-hunk ./actions/openidsettings.php 116
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/openidsettings.php 119
--	function handle_post() {
--		# CSRF protection
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+    function handle_post() {
-+        # CSRF protection
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/openidsettings.php 127
--		if ($this->arg('add')) {
--			$result = oid_authenticate($this->trimmed('openid_url'), 'finishaddopenid');
--			if (is_string($result)) { # error message
--				$this->show_form($result);
--			}
--		} else if ($this->arg('remove')) {
--			$this->remove_openid();
--		} else {
--			$this->show_form(_('Something weird happened.'));
--		}
--	}
-+        if ($this->arg('add')) {
-+            $result = oid_authenticate($this->trimmed('openid_url'), 'finishaddopenid');
-+            if (is_string($result)) { # error message
-+                $this->show_form($result);
-+            }
-+        } else if ($this->arg('remove')) {
-+            $this->remove_openid();
-+        } else {
-+            $this->show_form(_('Something weird happened.'));
-+        }
-+    }
-hunk ./actions/openidsettings.php 139
--	function remove_openid() {
-+    function remove_openid() {
-hunk ./actions/openidsettings.php 141
--		$openid_url = $this->trimmed('openid_url');
--		$oid = User_openid::staticGet('canonical', $openid_url);
--		if (!$oid) {
--			$this->show_form(_('No such OpenID.'));
--			return;
--		}
--		$cur = common_current_user();
--		if (!$cur || $oid->user_id != $cur->id) {
--			$this->show_form(_('That OpenID does not belong to you.'));
--			return;
--		}
--		$oid->delete();
--		$this->show_form(_('OpenID removed.'), true);
--		return;
--	}
-+        $openid_url = $this->trimmed('openid_url');
-+        $oid = User_openid::staticGet('canonical', $openid_url);
-+        if (!$oid) {
-+            $this->show_form(_('No such OpenID.'));
-+            return;
-+        }
-+        $cur = common_current_user();
-+        if (!$cur || $oid->user_id != $cur->id) {
-+            $this->show_form(_('That OpenID does not belong to you.'));
-+            return;
-+        }
-+        $oid->delete();
-+        $this->show_form(_('OpenID removed.'), true);
-+        return;
-+    }
-hunk ./actions/opensearch.php 24
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/opensearch.php 26
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/opensearch.php 28
--		$type = $this->trimmed('type');
-+        $type = $this->trimmed('type');
-hunk ./actions/opensearch.php 30
--		$short_name = '';
--		if ($type == 'people') {
--			$type = 'peoplesearch';
--			$short_name = _('People Search');
--		} else {
--			$short_name = _('Notice Search');
--			$type = 'noticesearch';
--		}
-+        $short_name = '';
-+        if ($type == 'people') {
-+            $type = 'peoplesearch';
-+            $short_name = _('People Search');
-+        } else {
-+            $short_name = _('Notice Search');
-+            $type = 'noticesearch';
-+        }
-hunk ./actions/opensearch.php 39
--		header('Content-Type: text/html');
-+        header('Content-Type: text/html');
-hunk ./actions/opensearch.php 41
--		common_start_xml();
--		common_element_start('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
-+        common_start_xml();
-+        common_element_start('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
-hunk ./actions/opensearch.php 44
--		$short_name =  common_config('site', 'name').' '.$short_name;
--		common_element('ShortName', NULL, $short_name);
--		common_element('Contact', NULL, common_config('site', 'email'));
--		common_element('Url', array('type' => 'text/html', 'method' => 'get',
--					   'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
--		common_element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
--		common_element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
--		common_element('AdultContent', NULL, 'false');
--		common_element('Language', NULL, common_language());
--		common_element('OutputEncoding', NULL, 'UTF-8');
--		common_element('InputEncoding', NULL, 'UTF-8');
-+        $short_name =  common_config('site', 'name').' '.$short_name;
-+        common_element('ShortName', NULL, $short_name);
-+        common_element('Contact', NULL, common_config('site', 'email'));
-+        common_element('Url', array('type' => 'text/html', 'method' => 'get',
-+                       'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
-+        common_element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
-+        common_element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
-+        common_element('AdultContent', NULL, 'false');
-+        common_element('Language', NULL, common_language());
-+        common_element('OutputEncoding', NULL, 'UTF-8');
-+        common_element('InputEncoding', NULL, 'UTF-8');
-hunk ./actions/opensearch.php 56
--		common_element_end('OpenSearchDescription');
--		common_end_xml();
--	}
-+        common_element_end('OpenSearchDescription');
-+        common_end_xml();
-+    }
-hunk ./actions/othersettings.php 26
--	function get_instructions() {
--		return _('Manage various other options.');
--	}
-+    function get_instructions() {
-+        return _('Manage various other options.');
-+    }
+-                common_element('p', NULL,
++                common_element('p', null,
+hunk ./actions/opensearch.php 45
+-        common_element('ShortName', NULL, $short_name);
+-        common_element('Contact', NULL, common_config('site', 'email'));
++        common_element('ShortName', null, $short_name);
++        common_element('Contact', null, common_config('site', 'email'));
+hunk ./actions/opensearch.php 51
+-        common_element('AdultContent', NULL, 'false');
+-        common_element('Language', NULL, common_language());
+-        common_element('OutputEncoding', NULL, 'UTF-8');
+-        common_element('InputEncoding', NULL, 'UTF-8');
++        common_element('AdultContent', null, 'false');
++        common_element('Language', null, common_language());
++        common_element('OutputEncoding', null, 'UTF-8');
++        common_element('InputEncoding', null, 'UTF-8');
 hunk ./actions/othersettings.php 30
--	function show_form($msg=NULL, $success=false) {
--		$user = common_current_user();
-+    function show_form($msg=NULL, $success=false) {
-+        $user = common_current_user();
-hunk ./actions/othersettings.php 33
--		$this->form_header(_('Other Settings'), $msg, $success);
-+        $this->form_header(_('Other Settings'), $msg, $success);
+-    function show_form($msg=NULL, $success=false) {
++    function show_form($msg=null, $success=false) {
 hunk ./actions/othersettings.php 35
--		common_element('h2', NULL, _('URL Auto-shortening'));
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'othersettings',
--										   'action' =>
--										   common_local_url('othersettings')));
--		common_hidden('token', common_session_token());
-+        common_element('h2', NULL, _('URL Auto-shortening'));
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'othersettings',
-+                                           'action' =>
-+                                           common_local_url('othersettings')));
-+        common_hidden('token', common_session_token());
-hunk ./actions/othersettings.php 42
--		$services = array(
--			'' => 'None',
-+        $services = array(
-+            '' => 'None',
-hunk ./actions/othersettings.php 48
--			'tinyurl.com' => 'tinyurl.com',
--			'is.gd' => 'is.gd',
--			'snipr.com' => 'snipr.com',
--			'metamark.net' => 'metamark.net'
--		);
-+            'tinyurl.com' => 'tinyurl.com',
-+            'is.gd' => 'is.gd',
-+            'snipr.com' => 'snipr.com',
-+            'metamark.net' => 'metamark.net'
-+        );
-hunk ./actions/othersettings.php 54
--		common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), FALSE, $user->urlshorteningservice);
-+        common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), FALSE, $user->urlshorteningservice);
-hunk ./actions/othersettings.php 56
--		common_submit('save', _('Save'));
-+        common_submit('save', _('Save'));
-hunk ./actions/othersettings.php 58
--		common_element_end('form');
-+        common_element_end('form');
+-        common_element('h2', NULL, _('URL Auto-shortening'));
++        common_element('h2', null, _('URL Auto-shortening'));
 hunk ./actions/othersettings.php 60
--//		common_element('h2', NULL, _('Delete my account'));
--//		$this->show_delete_form();
-+//        common_element('h2', NULL, _('Delete my account'));
-+//        $this->show_delete_form();
-hunk ./actions/othersettings.php 63
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/othersettings.php 66
--	function show_feeds_list($feeds) {
--		common_element_start('div', array('class' => 'feedsdel'));
--		common_element('p', null, 'Feeds:');
--		common_element_start('ul', array('class' => 'xoxo'));
-+    function show_feeds_list($feeds) {
-+        common_element_start('div', array('class' => 'feedsdel'));
-+        common_element('p', null, 'Feeds:');
-+        common_element_start('ul', array('class' => 'xoxo'));
-hunk ./actions/othersettings.php 71
--		foreach ($feeds as $key => $value) {
--			$this->common_feed_item($feeds[$key]);
--		}
--		common_element_end('ul');
--		common_element_end('div');
--	}
-+        foreach ($feeds as $key => $value) {
-+            $this->common_feed_item($feeds[$key]);
-+        }
-+        common_element_end('ul');
-+        common_element_end('div');
-+    }
-hunk ./actions/othersettings.php 79
--	function common_feed_item($feed) {
-+    function common_feed_item($feed) {
-hunk ./actions/othersettings.php 81
--		$nickname = $user->nickname;
-+        $nickname = $user->nickname;
-hunk ./actions/othersettings.php 83
--		switch($feed['item']) {
--			case 'notices': default:
--				$feed_classname = $feed['type'];
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = "$nickname's ".$feed['version']." notice feed";
--				$feed['textContent'] = "RSS";
--				break;
-+        switch($feed['item']) {
-+            case 'notices': default:
-+                $feed_classname = $feed['type'];
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = "$nickname's ".$feed['version']." notice feed";
-+                $feed['textContent'] = "RSS";
-+                break;
-hunk ./actions/othersettings.php 91
--			case 'foaf':
--				$feed_classname = "foaf";
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = "$nickname's FOAF file";
--				$feed['textContent'] = "FOAF";
--				break;
--		}
--		common_element_start('li');
--		common_element('a', array('href' => $feed['href'],
--								  'class' => $feed_classname,
--								  'type' => $feed_mimetype,
--								  'title' => $feed_title),
--							$feed['textContent']);
--		common_element_end('li');
--	}
-+            case 'foaf':
-+                $feed_classname = "foaf";
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = "$nickname's FOAF file";
-+                $feed['textContent'] = "FOAF";
-+                break;
-+        }
-+        common_element_start('li');
-+        common_element('a', array('href' => $feed['href'],
-+                                  'class' => $feed_classname,
-+                                  'type' => $feed_mimetype,
-+                                  'title' => $feed_title),
-+                            $feed['textContent']);
-+        common_element_end('li');
-+    }
-hunk ./actions/othersettings.php 107
--//	function show_delete_form() {
--//		$user = common_current_user();
-+//    function show_delete_form() {
-+//        $user = common_current_user();
-hunk ./actions/othersettings.php 113
--//		common_element_start('form', array('method' => 'POST',
--//										   'id' => 'delete',
--//										   'action' =>
--//										   common_local_url('deleteprofile')));
-+//        common_element_start('form', array('method' => 'POST',
-+//                                           'id' => 'delete',
-+//                                           'action' =>
-+//                                           common_local_url('deleteprofile')));
-hunk ./actions/othersettings.php 118
--//		common_hidden('token', common_session_token());
-+//        common_hidden('token', common_session_token());
-hunk ./actions/othersettings.php 121
--//		$this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
--//											  'type' => 'rss',
--//											  'version' => 'RSS 1.0',
--//											  'item' => 'notices'),
--//									 1=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
--//											  'type' => 'rdf',
--//											  'version' => 'FOAF',
--//											  'item' => 'foaf')));
-+//        $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
-+//                                              'type' => 'rss',
-+//                                              'version' => 'RSS 1.0',
-+//                                              'item' => 'notices'),
-+//                                     1=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
-+//                                              'type' => 'rdf',
-+//                                              'version' => 'FOAF',
-+//                                              'item' => 'foaf')));
-hunk ./actions/othersettings.php 130
--//		common_submit('deleteaccount', _('Delete my account'));
--//		common_element_end('form');
--//	}
-+//        common_submit('deleteaccount', _('Delete my account'));
-+//        common_element_end('form');
-+//    }
-hunk ./actions/othersettings.php 134
--	function handle_post() {
-+    function handle_post() {
-hunk ./actions/othersettings.php 136
--		# CSRF protection
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        # CSRF protection
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/othersettings.php 143
--		if ($this->arg('save')) {
--			$this->save_preferences();
--		}else {
--			$this->show_form(_('Unexpected form submission.'));
--		}
--	}
-+        if ($this->arg('save')) {
-+            $this->save_preferences();
-+        }else {
-+            $this->show_form(_('Unexpected form submission.'));
-+        }
-+    }
-hunk ./actions/othersettings.php 150
--	function save_preferences() {
-+    function save_preferences() {
-hunk ./actions/othersettings.php 152
--		$urlshorteningservice = $this->trimmed('urlshorteningservice');
-+        $urlshorteningservice = $this->trimmed('urlshorteningservice');
-hunk ./actions/othersettings.php 154
--		if (!is_null($urlshorteningservice) && strlen($urlshorteningservice) > 50) {
--			$this->show_form(_('URL shortening service is too long (max 50 chars).'));
--			return;
--		}
-+        if (!is_null($urlshorteningservice) && strlen($urlshorteningservice) > 50) {
-+            $this->show_form(_('URL shortening service is too long (max 50 chars).'));
-+            return;
-+        }
-hunk ./actions/othersettings.php 159
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/othersettings.php 161
--		assert(!is_null($user)); # should already be checked
-+        assert(!is_null($user)); # should already be checked
-hunk ./actions/othersettings.php 163
--		$user->query('BEGIN');
-+        $user->query('BEGIN');
-hunk ./actions/othersettings.php 165
--		$original = clone($user);
-+        $original = clone($user);
-hunk ./actions/othersettings.php 167
--		$user->urlshorteningservice = $urlshorteningservice;
-+        $user->urlshorteningservice = $urlshorteningservice;
-hunk ./actions/othersettings.php 169
--		$result = $user->update($original);
-+        $result = $user->update($original);
-hunk ./actions/othersettings.php 171
--		if ($result === FALSE) {
--			common_log_db_error($user, 'UPDATE', __FILE__);
--			common_server_error(_('Couldn\'t update user.'));
--			return;
--		}
-+        if ($result === FALSE) {
-+            common_log_db_error($user, 'UPDATE', __FILE__);
-+            common_server_error(_('Couldn\'t update user.'));
-+            return;
-+        }
-hunk ./actions/othersettings.php 177
--		$user->query('COMMIT');
-+        $user->query('COMMIT');
-hunk ./actions/othersettings.php 179
--		$this->show_form(_('Preferences saved.'), true);
--	}
-+        $this->show_form(_('Preferences saved.'), true);
-+    }
-hunk ./actions/peoplesearch.php 27
--	function get_instructions() {
--		return _('Search for people on %%site.name%% by their name, location, or interests. ' .
--				  'Separate the terms by spaces; they must be 3 characters or more.');
--	}
-+    function get_instructions() {
-+        return _('Search for people on %%site.name%% by their name, location, or interests. ' .
-+                  'Separate the terms by spaces; they must be 3 characters or more.');
-+    }
-hunk ./actions/peoplesearch.php 32
--	function get_title() {
--		return _('People search');
--	}
-+    function get_title() {
-+        return _('People search');
-+    }
-hunk ./actions/peoplesearch.php 36
--	function show_results($q, $page) {
-+    function show_results($q, $page) {
-hunk ./actions/peoplesearch.php 38
--		$profile = new Profile();
-+        $profile = new Profile();
-hunk ./actions/peoplesearch.php 40
--		# lcase it for comparison
--		$q = strtolower($q);
-+        # lcase it for comparison
-+        $q = strtolower($q);
-hunk ./actions/peoplesearch.php 46
--		# Ask for an extra to see if there's more.
-+        # Ask for an extra to see if there's more.
-hunk ./actions/peoplesearch.php 52
--		    $cnt = $profile->find();
-+            $cnt = $profile->find();
-+        }
-+        if ($cnt > 0) {
-+            $terms = preg_split('/[\s,]+/', $q);
-+            $results = new PeopleSearchResults($profile, $terms);
-+            $results->show_list();
-+        } else {
-+            common_element('p', 'error', _('No results'));
-hunk ./actions/peoplesearch.php 61
--		if ($cnt > 0) {
--			$terms = preg_split('/[\s,]+/', $q);
--			$results = new PeopleSearchResults($profile, $terms);
--			$results->show_list();
--		} else {
--			common_element('p', 'error', _('No results'));
--		}
-hunk ./actions/peoplesearch.php 62
--		$profile->free();
--		
--		common_pagination($page > 1, $cnt > PROFILES_PER_PAGE,
--						  $page, 'peoplesearch', array('q' => $q));
--	}
-+        $profile->free();
-+        
-+        common_pagination($page > 1, $cnt > PROFILES_PER_PAGE,
-+                          $page, 'peoplesearch', array('q' => $q));
-+    }
+-//        common_element('h2', NULL, _('Delete my account'));
++//        common_element('h2', null, _('Delete my account'));
 hunk ./actions/peoplesearch.php 71
--	var $terms = NULL;
--	var $pattern = NULL;
--	
--	function __construct($profile, $terms) {
--		parent::__construct($profile);
--		$this->terms = array_map('preg_quote', 
--								 array_map('htmlspecialchars', $terms));
--		$this->pattern = '/('.implode('|',$terms).')/i';
--	}
--	
--	function highlight($text) {
--		return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
--	}
-+    var $terms = NULL;
-+    var $pattern = NULL;
-+    
-+    function __construct($profile, $terms) {
-+        parent::__construct($profile);
-+        $this->terms = array_map('preg_quote', 
-+                                 array_map('htmlspecialchars', $terms));
-+        $this->pattern = '/('.implode('|',$terms).')/i';
-+    }
-+    
-+    function highlight($text) {
-+        return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
-+    }
-hunk ./actions/peopletag.php 25
--	
--	function handle($args) {
-+    
-+    function handle($args) {
-hunk ./actions/peopletag.php 28
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/peopletag.php 30
--		$tag = $this->trimmed('tag');
--		
--		if (!common_valid_profile_tag($tag)) {
--			$this->client_error(sprintf(_('Not a valid people tag: %s'), $tag));
--			return;
--		}
-+        $tag = $this->trimmed('tag');
-+        
-+        if (!common_valid_profile_tag($tag)) {
-+            $this->client_error(sprintf(_('Not a valid people tag: %s'), $tag));
-+            return;
-+        }
-hunk ./actions/peopletag.php 37
--		$page = $this->trimmed('page');
--		
--		if (!$page) {
--			$page = 1;
--		}
--		
--		# Looks like we're good; show the header
-+        $page = $this->trimmed('page');
-+        
-+        if (!$page) {
-+            $page = 1;
-+        }
-+        
-+        # Looks like we're good; show the header
-hunk ./actions/peopletag.php 45
--		common_show_header(sprintf(_('Users self-tagged with %s - page %d'), $tag, $page),
--						   NULL, $tag, array($this, 'show_top'));
-+        common_show_header(sprintf(_('Users self-tagged with %s - page %d'), $tag, $page),
-+                           NULL, $tag, array($this, 'show_top'));
-hunk ./actions/peopletag.php 48
--		$this->show_people($tag, $page);
-+        $this->show_people($tag, $page);
-hunk ./actions/peopletag.php 50
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/peopletag.php 53
--	function show_people($tag, $page) {
--		
--		$profile = new Profile();
-+    function show_people($tag, $page) {
-+        
-+        $profile = new Profile();
-hunk ./actions/peopletag.php 57
--		$offset = ($page-1)*PROFILES_PER_PAGE;
--		$limit = PROFILES_PER_PAGE + 1;
--		
--		if (common_config('db','type') == 'pgsql') {
--			$lim = ' LIMIT ' . $limit . ' OFFSET ' . $offset;
--		} else {
--			$lim = ' LIMIT ' . $offset . ', ' . $limit;
--		}
-+        $offset = ($page-1)*PROFILES_PER_PAGE;
-+        $limit = PROFILES_PER_PAGE + 1;
-+        
-+        if (common_config('db','type') == 'pgsql') {
-+            $lim = ' LIMIT ' . $limit . ' OFFSET ' . $offset;
-+        } else {
-+            $lim = ' LIMIT ' . $offset . ', ' . $limit;
-+        }
-hunk ./actions/peopletag.php 66
--		# XXX: memcached this
--		
--		$profile->query(sprintf('SELECT profile.* ' .
--								'FROM profile JOIN profile_tag ' .
--								'ON profile.id = profile_tag.tagger ' .
--								'WHERE profile_tag.tagger = profile_tag.tagged ' .
--								'AND tag = "%s" ' .
--								'ORDER BY profile_tag.modified DESC ' . 
--								$lim, $tag));
-+        # XXX: memcached this
-+        
-+        $profile->query(sprintf('SELECT profile.* ' .
-+                                'FROM profile JOIN profile_tag ' .
-+                                'ON profile.id = profile_tag.tagger ' .
-+                                'WHERE profile_tag.tagger = profile_tag.tagged ' .
-+                                'AND tag = "%s" ' .
-+                                'ORDER BY profile_tag.modified DESC ' . 
-+                                $lim, $tag));
-hunk ./actions/peopletag.php 76
--		$pl = new ProfileList($profile);
--		$cnt = $pl->show_list();
--		
--		common_pagination($page > 1,
--						  $cnt > PROFILES_PER_PAGE,
--						  $page,
--						  $this->trimmed('action'),
--						  array('tag' => $tag));
--	}
--	
--	function show_top($tag) {
--		$instr = sprintf(_('These are users who have tagged themselves "%s" ' .
--						   'to show a common interest, characteristic, hobby or job.'), $tag);
--		common_element_start('div', 'instructions');
--		common_element_start('p');
--		common_text($instr);
--		common_element_end('p');
--		common_element_end('div');
--	}
-+        $pl = new ProfileList($profile);
-+        $cnt = $pl->show_list();
-+        
-+        common_pagination($page > 1,
-+                          $cnt > PROFILES_PER_PAGE,
-+                          $page,
-+                          $this->trimmed('action'),
-+                          array('tag' => $tag));
-+    }
-+    
-+    function show_top($tag) {
-+        $instr = sprintf(_('These are users who have tagged themselves "%s" ' .
-+                           'to show a common interest, characteristic, hobby or job.'), $tag);
-+        common_element_start('div', 'instructions');
-+        common_element_start('p');
-+        common_text($instr);
-+        common_element_end('p');
-+        common_element_end('div');
-+    }
-hunk ./actions/peopletag.php 96
--	function get_title() {
--		return NULL;
--	}
-+    function get_title() {
-+        return NULL;
-+    }
-hunk ./actions/peopletag.php 100
--	function show_header($arr) {
--		return;
--	}
-+    function show_header($arr) {
-+        return;
-+    }
-hunk ./actions/postnotice.php 25
--	function handle($args) {
--		parent::handle($args);
--		try {
--			common_remove_magic_from_request();
--			$req = OAuthRequest::from_request();
--			# Note: server-to-server function!
--			$server = omb_oauth_server();
--			list($consumer, $token) = $server->verify_request($req);
--			if ($this->save_notice($req, $consumer, $token)) {
--				print "omb_version=".OMB_VERSION_01;
--			}
--		} catch (OAuthException $e) {
--			common_server_error($e->getMessage());
--			return;
--		}
--	}
-+    function handle($args) {
-+        parent::handle($args);
-+        try {
-+            common_remove_magic_from_request();
-+            $req = OAuthRequest::from_request();
-+            # Note: server-to-server function!
-+            $server = omb_oauth_server();
-+            list($consumer, $token) = $server->verify_request($req);
-+            if ($this->save_notice($req, $consumer, $token)) {
-+                print "omb_version=".OMB_VERSION_01;
-+            }
-+        } catch (OAuthException $e) {
-+            common_server_error($e->getMessage());
-+            return;
-+        }
-+    }
-hunk ./actions/postnotice.php 42
--	function save_notice(&$req, &$consumer, &$token) {
--		$version = $req->get_parameter('omb_version');
--		if ($version != OMB_VERSION_01) {
--			common_user_error(_('Unsupported OMB version'), 400);
--			return false;
--		}
--		# First, check to see
--		$listenee =  $req->get_parameter('omb_listenee');
--		$remote_profile = Remote_profile::staticGet('uri', $listenee);
--		if (!$remote_profile) {
--			common_user_error(_('Profile unknown'), 403);
--			return false;
--		}
--		$sub = Subscription::staticGet('token', $token->key);
--		if (!$sub) {
--			common_user_error(_('No such subscription'), 403);
--			return false;
--		}
--		$content = $req->get_parameter('omb_notice_content');
-+    function save_notice(&$req, &$consumer, &$token) {
-+        $version = $req->get_parameter('omb_version');
-+        if ($version != OMB_VERSION_01) {
-+            common_user_error(_('Unsupported OMB version'), 400);
-+            return false;
-+        }
-+        # First, check to see
-+        $listenee =  $req->get_parameter('omb_listenee');
-+        $remote_profile = Remote_profile::staticGet('uri', $listenee);
-+        if (!$remote_profile) {
-+            common_user_error(_('Profile unknown'), 403);
-+            return false;
-+        }
-+        $sub = Subscription::staticGet('token', $token->key);
-+        if (!$sub) {
-+            common_user_error(_('No such subscription'), 403);
-+            return false;
-+        }
-+        $content = $req->get_parameter('omb_notice_content');
-hunk ./actions/postnotice.php 66
--		$notice_uri = $req->get_parameter('omb_notice');
--		if (!Validate::uri($notice_uri) &&
--			!common_valid_tag($notice_uri)) {
--			common_user_error(_('Invalid notice uri'), 400);
--			return false;
--		}
--		$notice_url = $req->get_parameter('omb_notice_url');
--		if ($notice_url && !common_valid_http_url($notice_url)) {
--			common_user_error(_('Invalid notice url'), 400);
--			return false;
--		}
--		$notice = Notice::staticGet('uri', $notice_uri);
--		if (!$notice) {
--			$notice = Notice::saveNew($remote_profile->id, $content, 'omb', false, 0, $notice_uri);
--			if (is_string($notice)) {
--				common_server_serror($notice, 500);
--				return false;
--			}
--			common_broadcast_notice($notice, true);
--		}
--		return true;
--	}
-+        $notice_uri = $req->get_parameter('omb_notice');
-+        if (!Validate::uri($notice_uri) &&
-+            !common_valid_tag($notice_uri)) {
-+            common_user_error(_('Invalid notice uri'), 400);
-+            return false;
-+        }
-+        $notice_url = $req->get_parameter('omb_notice_url');
-+        if ($notice_url && !common_valid_http_url($notice_url)) {
-+            common_user_error(_('Invalid notice url'), 400);
-+            return false;
-+        }
-+        $notice = Notice::staticGet('uri', $notice_uri);
-+        if (!$notice) {
-+            $notice = Notice::saveNew($remote_profile->id, $content, 'omb', false, 0, $notice_uri);
-+            if (is_string($notice)) {
-+                common_server_serror($notice, 500);
-+                return false;
-+            }
-+            common_broadcast_notice($notice, true);
-+        }
-+        return true;
-+    }
-hunk ./actions/profilesettings.php 26
--	function get_instructions() {
--		return _('You can update your personal profile info here '.
--				  'so people know more about you.');
--	}
-+    function get_instructions() {
-+        return _('You can update your personal profile info here '.
-+                  'so people know more about you.');
-+    }
+-    var $terms = NULL;
+-    var $pattern = NULL;
++    var $terms = null;
++    var $pattern = null;
+hunk ./actions/peopletag.php 46
+-                           NULL, $tag, array($this, 'show_top'));
++                           null, $tag, array($this, 'show_top'));
+hunk ./actions/peopletag.php 97
+-        return NULL;
++        return null;
 hunk ./actions/profilesettings.php 31
--	function show_form($msg=NULL, $success=false) {
--		$this->form_header(_('Profile settings'), $msg, $success);
--		$this->show_settings_form();
--		common_element('h2', NULL, _('Avatar'));
--		$this->show_avatar_form();
--		common_element('h2', NULL, _('Change password'));
--		$this->show_password_form();
--//		common_element('h2', NULL, _('Delete my account'));
--//		$this->show_delete_form();
--		common_show_footer();
--	}
-+    function show_form($msg=NULL, $success=false) {
-+        $this->form_header(_('Profile settings'), $msg, $success);
-+        $this->show_settings_form();
-+        common_element('h2', NULL, _('Avatar'));
-+        $this->show_avatar_form();
-+        common_element('h2', NULL, _('Change password'));
-+        $this->show_password_form();
-+//        common_element('h2', NULL, _('Delete my account'));
-+//        $this->show_delete_form();
-+        common_show_footer();
-+    }
-hunk ./actions/profilesettings.php 43
--	function handle_post() {
-+    function handle_post() {
-hunk ./actions/profilesettings.php 45
--		# CSRF protection
-+        # CSRF protection
-hunk ./actions/profilesettings.php 47
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/profilesettings.php 53
--		if ($this->arg('save')) {
--			$this->save_profile();
--		} else if ($this->arg('upload')) {
--			$this->upload_avatar();
--		} else if ($this->arg('changepass')) {
--			$this->change_password();
--		}
-+        if ($this->arg('save')) {
-+            $this->save_profile();
-+        } else if ($this->arg('upload')) {
-+            $this->upload_avatar();
-+        } else if ($this->arg('changepass')) {
-+            $this->change_password();
-+        }
-hunk ./actions/profilesettings.php 61
--	}
-+    }
-hunk ./actions/profilesettings.php 63
--	function show_settings_form() {
-+    function show_settings_form() {
-hunk ./actions/profilesettings.php 65
--		$user = common_current_user();
--		$profile = $user->getProfile();
-+        $user = common_current_user();
-+        $profile = $user->getProfile();
-hunk ./actions/profilesettings.php 68
--		common_element_start('form', array('method' => 'POST',
--										   'id' => 'profilesettings',
--										   'action' =>
--										   common_local_url('profilesettings')));
--		common_hidden('token', common_session_token());
--		
--		# too much common patterns here... abstractable?
--		
--		common_input('nickname', _('Nickname'),
--					 ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
--					 _('1-64 lowercase letters or numbers, no punctuation or spaces'));
--		common_input('fullname', _('Full name'),
--					 ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
--		common_input('homepage', _('Homepage'),
--					 ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
--					 _('URL of your homepage, blog, or profile on another site'));
--		common_textarea('bio', _('Bio'),
--						($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
--						_('Describe yourself and your interests in 140 chars'));
--		common_input('location', _('Location'),
--					 ($this->arg('location')) ? $this->arg('location') : $profile->location,
--					 _('Where you are, like "City, State (or Region), Country"'));
--		common_input('tags', _('Tags'),
--					 ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
--					 _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
-+        common_element_start('form', array('method' => 'POST',
-+                                           'id' => 'profilesettings',
-+                                           'action' =>
-+                                           common_local_url('profilesettings')));
-+        common_hidden('token', common_session_token());
-+        
-+        # too much common patterns here... abstractable?
-+        
-+        common_input('nickname', _('Nickname'),
-+                     ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
-+                     _('1-64 lowercase letters or numbers, no punctuation or spaces'));
-+        common_input('fullname', _('Full name'),
-+                     ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
-+        common_input('homepage', _('Homepage'),
-+                     ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
-+                     _('URL of your homepage, blog, or profile on another site'));
-+        common_textarea('bio', _('Bio'),
-+                        ($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
-+                        _('Describe yourself and your interests in 140 chars'));
-+        common_input('location', _('Location'),
-+                     ($this->arg('location')) ? $this->arg('location') : $profile->location,
-+                     _('Where you are, like "City, State (or Region), Country"'));
-+        common_input('tags', _('Tags'),
-+                     ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
-+                     _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
-hunk ./actions/profilesettings.php 94
--		$language = common_language();
--		common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), TRUE, $language);
--		$timezone = common_timezone();
--		$timezones = array();
--		foreach(DateTimeZone::listIdentifiers() as $k => $v) {
--			$timezones[$v] = $v;
--		}
--		common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), TRUE, $timezone);
-+        $language = common_language();
-+        common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), TRUE, $language);
-+        $timezone = common_timezone();
-+        $timezones = array();
-+        foreach(DateTimeZone::listIdentifiers() as $k => $v) {
-+            $timezones[$v] = $v;
-+        }
-+        common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), TRUE, $timezone);
-hunk ./actions/profilesettings.php 103
--		common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'),
--						($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe);
-+        common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'),
-+                        ($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe);
-hunk ./actions/profilesettings.php 106
--		common_submit('save', _('Save'));
-+        common_submit('save', _('Save'));
-hunk ./actions/profilesettings.php 108
--		common_element_end('form');
-+        common_element_end('form');
-hunk ./actions/profilesettings.php 111
--	}
-+    }
-hunk ./actions/profilesettings.php 113
--	function show_avatar_form() {
-+    function show_avatar_form() {
-hunk ./actions/profilesettings.php 115
--		$user = common_current_user();
--		$profile = $user->getProfile();
-+        $user = common_current_user();
-+        $profile = $user->getProfile();
-hunk ./actions/profilesettings.php 118
--		if (!$profile) {
--			common_log_db_error($user, 'SELECT', __FILE__);
--			$this->server_error(_('User without matching profile'));
--			return;
--		}
--		
--		$original = $profile->getOriginalAvatar();
-+        if (!$profile) {
-+            common_log_db_error($user, 'SELECT', __FILE__);
-+            $this->server_error(_('User without matching profile'));
-+            return;
-+        }
-+        
-+        $original = $profile->getOriginalAvatar();
-hunk ./actions/profilesettings.php 127
--		common_element_start('form', array('enctype' => 'multipart/form-data',
--										   'method' => 'POST',
--										   'id' => 'avatar',
--										   'action' =>
--										   common_local_url('profilesettings')));
--		common_hidden('token', common_session_token());
-+        common_element_start('form', array('enctype' => 'multipart/form-data',
-+                                           'method' => 'POST',
-+                                           'id' => 'avatar',
-+                                           'action' =>
-+                                           common_local_url('profilesettings')));
-+        common_hidden('token', common_session_token());
-hunk ./actions/profilesettings.php 134
--		if ($original) {
--			common_element('img', array('src' => $original->url,
--										'class' => 'avatar original',
--										'width' => $original->width,
--										'height' => $original->height,
--										'alt' => $user->nickname));
--		}
-+        if ($original) {
-+            common_element('img', array('src' => $original->url,
-+                                        'class' => 'avatar original',
-+                                        'width' => $original->width,
-+                                        'height' => $original->height,
-+                                        'alt' => $user->nickname));
-+        }
-hunk ./actions/profilesettings.php 142
--		$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-+        $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-hunk ./actions/profilesettings.php 144
--		if ($avatar) {
--			common_element('img', array('src' => $avatar->url,
--										'class' => 'avatar profile',
--										'width' => AVATAR_PROFILE_SIZE,
--										'height' => AVATAR_PROFILE_SIZE,
--										'alt' => $user->nickname));
--		}
-+        if ($avatar) {
-+            common_element('img', array('src' => $avatar->url,
-+                                        'class' => 'avatar profile',
-+                                        'width' => AVATAR_PROFILE_SIZE,
-+                                        'height' => AVATAR_PROFILE_SIZE,
-+                                        'alt' => $user->nickname));
-+        }
-hunk ./actions/profilesettings.php 153
--		common_element('input', array('name' => 'MAX_FILE_SIZE',
--									  'type' => 'hidden',
--									  'id' => 'MAX_FILE_SIZE',
--									  'value' => MAX_AVATAR_SIZE));
-+        common_element('input', array('name' => 'MAX_FILE_SIZE',
-+                                      'type' => 'hidden',
-+                                      'id' => 'MAX_FILE_SIZE',
-+                                      'value' => MAX_AVATAR_SIZE));
-hunk ./actions/profilesettings.php 158
--		common_element_start('p');
-+        common_element_start('p');
-hunk ./actions/profilesettings.php 161
--		common_element('input', array('name' => 'avatarfile',
--									  'type' => 'file',
--									  'id' => 'avatarfile'));
--		common_element_end('p');
-+        common_element('input', array('name' => 'avatarfile',
-+                                      'type' => 'file',
-+                                      'id' => 'avatarfile'));
-+        common_element_end('p');
-hunk ./actions/profilesettings.php 166
--		common_submit('upload', _('Upload'));
--		common_element_end('form');
-+        common_submit('upload', _('Upload'));
-+        common_element_end('form');
-hunk ./actions/profilesettings.php 169
--	}
-+    }
-hunk ./actions/profilesettings.php 171
--	function show_password_form() {
-+    function show_password_form() {
-hunk ./actions/profilesettings.php 173
--		$user = common_current_user();
--		common_element_start('form', array('method' => 'POST',
--										   'id' => 'password',
--										   'action' =>
--										   common_local_url('profilesettings')));
-+        $user = common_current_user();
-+        common_element_start('form', array('method' => 'POST',
-+                                           'id' => 'password',
-+                                           'action' =>
-+                                           common_local_url('profilesettings')));
-hunk ./actions/profilesettings.php 179
--		common_hidden('token', common_session_token());
-+        common_hidden('token', common_session_token());
-hunk ./actions/profilesettings.php 181
--		# Users who logged in with OpenID won't have a pwd
--		if ($user->password) {
--			common_password('oldpassword', _('Old password'));
--		}
--		common_password('newpassword', _('New password'),
--						_('6 or more characters'));
--		common_password('confirm', _('Confirm'),
--						_('same as password above'));
--		common_submit('changepass', _('Change'));
--		common_element_end('form');
--	}
-+        # Users who logged in with OpenID won't have a pwd
-+        if ($user->password) {
-+            common_password('oldpassword', _('Old password'));
-+        }
-+        common_password('newpassword', _('New password'),
-+                        _('6 or more characters'));
-+        common_password('confirm', _('Confirm'),
-+                        _('same as password above'));
-+        common_submit('changepass', _('Change'));
-+        common_element_end('form');
-+    }
-hunk ./actions/profilesettings.php 193
--	function save_profile() {
--		$nickname = $this->trimmed('nickname');
--		$fullname = $this->trimmed('fullname');
--		$homepage = $this->trimmed('homepage');
--		$bio = $this->trimmed('bio');
--		$location = $this->trimmed('location');
--		$autosubscribe = $this->boolean('autosubscribe');
--		$language = $this->trimmed('language');
--		$timezone = $this->trimmed('timezone');
--		$tagstring = $this->trimmed('tags');
--		
--		# Some validation
-+    function save_profile() {
-+        $nickname = $this->trimmed('nickname');
-+        $fullname = $this->trimmed('fullname');
-+        $homepage = $this->trimmed('homepage');
-+        $bio = $this->trimmed('bio');
-+        $location = $this->trimmed('location');
-+        $autosubscribe = $this->boolean('autosubscribe');
-+        $language = $this->trimmed('language');
-+        $timezone = $this->trimmed('timezone');
-+        $tagstring = $this->trimmed('tags');
-+        
-+        # Some validation
-hunk ./actions/profilesettings.php 206
--		if (!Validate::string($nickname, array('min_length' => 1,
--											   'max_length' => 64,
--											   'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
--			$this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
--			return;
--		} else if (!User::allowed_nickname($nickname)) {
--			$this->show_form(_('Not a valid nickname.'));
--			return;
--		} else if (!is_null($homepage) && (strlen($homepage) > 0) &&
--				   !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
--			$this->show_form(_('Homepage is not a valid URL.'));
--			return;
--		} else if (!is_null($fullname) && strlen($fullname) > 255) {
--			$this->show_form(_('Full name is too long (max 255 chars).'));
--			return;
--		} else if (!is_null($bio) && strlen($bio) > 140) {
--			$this->show_form(_('Bio is too long (max 140 chars).'));
--			return;
--		} else if (!is_null($location) && strlen($location) > 255) {
--			$this->show_form(_('Location is too long (max 255 chars).'));
--			return;
--		}  else if (is_null($timezone) || !in_array($timezone, DateTimeZone::listIdentifiers())) {
--			$this->show_form(_('Timezone not selected.'));
--			return;
--		} else if ($this->nickname_exists($nickname)) {
--			$this->show_form(_('Nickname already in use. Try another one.'));
--			return;
-+        if (!Validate::string($nickname, array('min_length' => 1,
-+                                               'max_length' => 64,
-+                                               'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
-+            $this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
-+            return;
-+        } else if (!User::allowed_nickname($nickname)) {
-+            $this->show_form(_('Not a valid nickname.'));
-+            return;
-+        } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
-+                   !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
-+            $this->show_form(_('Homepage is not a valid URL.'));
-+            return;
-+        } else if (!is_null($fullname) && strlen($fullname) > 255) {
-+            $this->show_form(_('Full name is too long (max 255 chars).'));
-+            return;
-+        } else if (!is_null($bio) && strlen($bio) > 140) {
-+            $this->show_form(_('Bio is too long (max 140 chars).'));
-+            return;
-+        } else if (!is_null($location) && strlen($location) > 255) {
-+            $this->show_form(_('Location is too long (max 255 chars).'));
-+            return;
-+        }  else if (is_null($timezone) || !in_array($timezone, DateTimeZone::listIdentifiers())) {
-+            $this->show_form(_('Timezone not selected.'));
-+            return;
-+        } else if ($this->nickname_exists($nickname)) {
-+            $this->show_form(_('Nickname already in use. Try another one.'));
-+            return;
-hunk ./actions/profilesettings.php 234
--        	$this->show_form(_('Language is too long (max 50 chars).'));
--			return;
--		}
-+            $this->show_form(_('Language is too long (max 50 chars).'));
-+            return;
-+        }
-hunk ./actions/profilesettings.php 238
--		if ($tagstring) {
--			$tags = array_map('common_canonical_tag', preg_split('/[\s,]+/', $tagstring));
--		} else {
--			$tags = array();
--		}
--			
--		foreach ($tags as $tag) {
--			if (!common_valid_profile_tag($tag)) {
--				$this->show_form(sprintf(_('Invalid tag: "%s"'), $tag));
--				return;
--			}
--		}
--		
--		$user = common_current_user();
-+        if ($tagstring) {
-+            $tags = array_map('common_canonical_tag', preg_split('/[\s,]+/', $tagstring));
-+        } else {
-+            $tags = array();
-+        }
-+            
-+        foreach ($tags as $tag) {
-+            if (!common_valid_profile_tag($tag)) {
-+                $this->show_form(sprintf(_('Invalid tag: "%s"'), $tag));
-+                return;
-+            }
-+        }
-+        
-+        $user = common_current_user();
-hunk ./actions/profilesettings.php 253
--		$user->query('BEGIN');
-+        $user->query('BEGIN');
-hunk ./actions/profilesettings.php 255
--		if ($user->nickname != $nickname ||
--			$user->language != $language ||
--			$user->timezone != $timezone) {
-+        if ($user->nickname != $nickname ||
-+            $user->language != $language ||
-+            $user->timezone != $timezone) {
-hunk ./actions/profilesettings.php 259
--			common_debug('Updating user nickname from ' . $user->nickname . ' to ' . $nickname,
--						 __FILE__);
--			common_debug('Updating user language from ' . $user->language . ' to ' . $language,
--						 __FILE__);
--			common_debug('Updating user timezone from ' . $user->timezone . ' to ' . $timezone,
--						 __FILE__);
-+            common_debug('Updating user nickname from ' . $user->nickname . ' to ' . $nickname,
-+                         __FILE__);
-+            common_debug('Updating user language from ' . $user->language . ' to ' . $language,
-+                         __FILE__);
-+            common_debug('Updating user timezone from ' . $user->timezone . ' to ' . $timezone,
-+                         __FILE__);
-hunk ./actions/profilesettings.php 266
--			$original = clone($user);
-+            $original = clone($user);
-hunk ./actions/profilesettings.php 268
--			$user->nickname = $nickname;
--			$user->language = $language;
--			$user->timezone = $timezone;
-+            $user->nickname = $nickname;
-+            $user->language = $language;
-+            $user->timezone = $timezone;
-hunk ./actions/profilesettings.php 272
--			$result = $user->updateKeys($original);
-+            $result = $user->updateKeys($original);
-hunk ./actions/profilesettings.php 274
--			if ($result === FALSE) {
--				common_log_db_error($user, 'UPDATE', __FILE__);
--				common_server_error(_('Couldn\'t update user.'));
--				return;
--			} else {
--				# Re-initialize language environment if it changed
--				common_init_language();
--			}
--		}
-+            if ($result === FALSE) {
-+                common_log_db_error($user, 'UPDATE', __FILE__);
-+                common_server_error(_('Couldn\'t update user.'));
-+                return;
-+            } else {
-+                # Re-initialize language environment if it changed
-+                common_init_language();
-+            }
-+        }
-hunk ./actions/profilesettings.php 284
--		# XXX: XOR
-+        # XXX: XOR
-hunk ./actions/profilesettings.php 286
--		if ($user->autosubscribe ^ $autosubscribe) {
-+        if ($user->autosubscribe ^ $autosubscribe) {
-hunk ./actions/profilesettings.php 288
--			$original = clone($user);
-+            $original = clone($user);
-hunk ./actions/profilesettings.php 290
--			$user->autosubscribe = $autosubscribe;
-+            $user->autosubscribe = $autosubscribe;
-hunk ./actions/profilesettings.php 292
--			$result = $user->update($original);
-+            $result = $user->update($original);
-hunk ./actions/profilesettings.php 294
--			if ($result === FALSE) {
--				common_log_db_error($user, 'UPDATE', __FILE__);
--				common_server_error(_('Couldn\'t update user for autosubscribe.'));
--				return;
--			}
--		}
-+            if ($result === FALSE) {
-+                common_log_db_error($user, 'UPDATE', __FILE__);
-+                common_server_error(_('Couldn\'t update user for autosubscribe.'));
-+                return;
-+            }
-+        }
-hunk ./actions/profilesettings.php 301
--		$profile = $user->getProfile();
-+        $profile = $user->getProfile();
-hunk ./actions/profilesettings.php 303
--		$orig_profile = clone($profile);
-+        $orig_profile = clone($profile);
-hunk ./actions/profilesettings.php 305
--		$profile->nickname = $user->nickname;
--		$profile->fullname = $fullname;
--		$profile->homepage = $homepage;
--		$profile->bio = $bio;
--		$profile->location = $location;
--		$profile->profileurl = common_profile_url($nickname);
-+        $profile->nickname = $user->nickname;
-+        $profile->fullname = $fullname;
-+        $profile->homepage = $homepage;
-+        $profile->bio = $bio;
-+        $profile->location = $location;
-+        $profile->profileurl = common_profile_url($nickname);
-hunk ./actions/profilesettings.php 312
--		common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
--		common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
-+        common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
-+        common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
-hunk ./actions/profilesettings.php 315
--		$result = $profile->update($orig_profile);
-+        $result = $profile->update($orig_profile);
-hunk ./actions/profilesettings.php 317
--		if (!$result) {
--			common_log_db_error($profile, 'UPDATE', __FILE__);
--			common_server_error(_('Couldn\'t save profile.'));
--			return;
--		}
-+        if (!$result) {
-+            common_log_db_error($profile, 'UPDATE', __FILE__);
-+            common_server_error(_('Couldn\'t save profile.'));
-+            return;
-+        }
-hunk ./actions/profilesettings.php 323
--		# Set the user tags
--		
--		$result = $user->setSelfTags($tags);
-+        # Set the user tags
-+        
-+        $result = $user->setSelfTags($tags);
-hunk ./actions/profilesettings.php 327
--		if (!$result) {
--			common_server_error(_('Couldn\'t save tags.'));
--			return;
--		}
--		
--		$user->query('COMMIT');
-+        if (!$result) {
-+            common_server_error(_('Couldn\'t save tags.'));
-+            return;
-+        }
-+        
-+        $user->query('COMMIT');
-hunk ./actions/profilesettings.php 334
--		common_broadcast_profile($profile);
-+        common_broadcast_profile($profile);
-hunk ./actions/profilesettings.php 336
--		$this->show_form(_('Settings saved.'), TRUE);
--	}
-+        $this->show_form(_('Settings saved.'), TRUE);
-+    }
-hunk ./actions/profilesettings.php 340
--	function upload_avatar() {
--		switch ($_FILES['avatarfile']['error']) {
--		 case UPLOAD_ERR_OK: # success, jump out
--			break;
--		 case UPLOAD_ERR_INI_SIZE:
--		 case UPLOAD_ERR_FORM_SIZE:
--			$this->show_form(_('That file is too big.'));
--			return;
--		 case UPLOAD_ERR_PARTIAL:
--			@unlink($_FILES['avatarfile']['tmp_name']);
--			$this->show_form(_('Partial upload.'));
--			return;
--		 default:
--			$this->show_form(_('System error uploading file.'));
--			return;
--		}
-+    function upload_avatar() {
-+        switch ($_FILES['avatarfile']['error']) {
-+         case UPLOAD_ERR_OK: # success, jump out
-+            break;
-+         case UPLOAD_ERR_INI_SIZE:
-+         case UPLOAD_ERR_FORM_SIZE:
-+            $this->show_form(_('That file is too big.'));
-+            return;
-+         case UPLOAD_ERR_PARTIAL:
-+            @unlink($_FILES['avatarfile']['tmp_name']);
-+            $this->show_form(_('Partial upload.'));
-+            return;
-+         default:
-+            $this->show_form(_('System error uploading file.'));
-+            return;
-+        }
-hunk ./actions/profilesettings.php 357
--		$info = @getimagesize($_FILES['avatarfile']['tmp_name']);
-+        $info = @getimagesize($_FILES['avatarfile']['tmp_name']);
-hunk ./actions/profilesettings.php 359
--		if (!$info) {
--			@unlink($_FILES['avatarfile']['tmp_name']);
--			$this->show_form(_('Not an image or corrupt file.'));
--			return;
--		}
-+        if (!$info) {
-+            @unlink($_FILES['avatarfile']['tmp_name']);
-+            $this->show_form(_('Not an image or corrupt file.'));
-+            return;
-+        }
-hunk ./actions/profilesettings.php 365
--		switch ($info[2]) {
--		 case IMAGETYPE_GIF:
--		 case IMAGETYPE_JPEG:
--		 case IMAGETYPE_PNG:
--			break;
--		 default:
--			$this->show_form(_('Unsupported image file format.'));
--			return;
--		}
-+        switch ($info[2]) {
-+         case IMAGETYPE_GIF:
-+         case IMAGETYPE_JPEG:
-+         case IMAGETYPE_PNG:
-+            break;
-+         default:
-+            $this->show_form(_('Unsupported image file format.'));
-+            return;
-+        }
-hunk ./actions/profilesettings.php 375
--		$user = common_current_user();
--		$profile = $user->getProfile();
-+        $user = common_current_user();
-+        $profile = $user->getProfile();
-hunk ./actions/profilesettings.php 378
--		if ($profile->setOriginal($_FILES['avatarfile']['tmp_name'])) {
--			$this->show_form(_('Avatar updated.'), true);
--		} else {
--			$this->show_form(_('Failed updating avatar.'));
--		}
-+        if ($profile->setOriginal($_FILES['avatarfile']['tmp_name'])) {
-+            $this->show_form(_('Avatar updated.'), true);
-+        } else {
-+            $this->show_form(_('Failed updating avatar.'));
-+        }
-hunk ./actions/profilesettings.php 384
--		@unlink($_FILES['avatarfile']['tmp_name']);
--	}
-+        @unlink($_FILES['avatarfile']['tmp_name']);
-+    }
-hunk ./actions/profilesettings.php 387
--	function nickname_exists($nickname) {
--		$user = common_current_user();
--		$other = User::staticGet('nickname', $nickname);
--		if (!$other) {
--			return false;
--		} else {
--			return $other->id != $user->id;
--		}
--	}
-+    function nickname_exists($nickname) {
-+        $user = common_current_user();
-+        $other = User::staticGet('nickname', $nickname);
-+        if (!$other) {
-+            return false;
-+        } else {
-+            return $other->id != $user->id;
-+        }
-+    }
-hunk ./actions/profilesettings.php 397
--	function change_password() {
-+    function change_password() {
-hunk ./actions/profilesettings.php 399
--		$user = common_current_user();
--		assert(!is_null($user)); # should already be checked
-+        $user = common_current_user();
-+        assert(!is_null($user)); # should already be checked
-hunk ./actions/profilesettings.php 402
--		# FIXME: scrub input
-+        # FIXME: scrub input
-hunk ./actions/profilesettings.php 404
--		$newpassword = $this->arg('newpassword');
--		$confirm = $this->arg('confirm');
--		$token = $this->arg('token');
-+        $newpassword = $this->arg('newpassword');
-+        $confirm = $this->arg('confirm');
-+        $token = $this->arg('token');
-hunk ./actions/profilesettings.php 408
--		if (0 != strcmp($newpassword, $confirm)) {
--			$this->show_form(_('Passwords don\'t match.'));
--			return;
--		}
-+        if (0 != strcmp($newpassword, $confirm)) {
-+            $this->show_form(_('Passwords don\'t match.'));
-+            return;
-+        }
-hunk ./actions/profilesettings.php 413
--		if ($user->password) {
--			$oldpassword = $this->arg('oldpassword');
-+        if ($user->password) {
-+            $oldpassword = $this->arg('oldpassword');
-hunk ./actions/profilesettings.php 416
--			if (!common_check_user($user->nickname, $oldpassword)) {
--				$this->show_form(_('Incorrect old password'));
--				return;
--			}
--		}
-+            if (!common_check_user($user->nickname, $oldpassword)) {
-+                $this->show_form(_('Incorrect old password'));
-+                return;
-+            }
-+        }
-hunk ./actions/profilesettings.php 422
--		$original = clone($user);
-+        $original = clone($user);
-hunk ./actions/profilesettings.php 424
--		$user->password = common_munge_password($newpassword, $user->id);
-+        $user->password = common_munge_password($newpassword, $user->id);
-hunk ./actions/profilesettings.php 426
--		$val = $user->validate();
--		if ($val !== TRUE) {
--			$this->show_form(_('Error saving user; invalid.'));
--			return;
--		}
-+        $val = $user->validate();
-+        if ($val !== TRUE) {
-+            $this->show_form(_('Error saving user; invalid.'));
-+            return;
-+        }
-hunk ./actions/profilesettings.php 432
--		if (!$user->update($original)) {
--			common_server_error(_('Can\'t save new password.'));
--			return;
--		}
-+        if (!$user->update($original)) {
-+            common_server_error(_('Can\'t save new password.'));
-+            return;
-+        }
-hunk ./actions/profilesettings.php 437
--		$this->show_form(_('Password saved.'), true);
--	}
-+        $this->show_form(_('Password saved.'), true);
-+    }
-hunk ./actions/public.php 26
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/public.php 29
--		$page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-+        $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-hunk ./actions/public.php 31
--		header('X-XRDS-Location: '. common_local_url('publicxrds'));
-+        header('X-XRDS-Location: '. common_local_url('publicxrds'));
-hunk ./actions/public.php 33
--		common_show_header(_('Public timeline'),
--						   array($this, 'show_header'), NULL,
--						   array($this, 'show_top'));
-+        common_show_header(_('Public timeline'),
-+                           array($this, 'show_header'), NULL,
-+                           array($this, 'show_top'));
-hunk ./actions/public.php 37
--		# XXX: Public sidebar here?
-+        # XXX: Public sidebar here?
-hunk ./actions/public.php 39
--		$this->show_notices($page);
-+        $this->show_notices($page);
-hunk ./actions/public.php 41
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/public.php 44
--	function show_top() {
--		if (common_logged_in()) {
--			common_notice_form('public');
--		} else {
--			$instr = $this->get_instructions();
--			$output = common_markup_to_html($instr);
--			common_element_start('div', 'instructions');
--			common_raw($output);
--			common_element_end('div');
--		}
-+    function show_top() {
-+        if (common_logged_in()) {
-+            common_notice_form('public');
-+        } else {
-+            $instr = $this->get_instructions();
-+            $output = common_markup_to_html($instr);
-+            common_element_start('div', 'instructions');
-+            common_raw($output);
-+            common_element_end('div');
-+        }
-hunk ./actions/public.php 55
--		$this->public_views_menu();
-+        $this->public_views_menu();
-hunk ./actions/public.php 57
--		$this->show_feeds_list(array(0=>array('href'=>common_local_url('publicrss'),
--											  'type' => 'rss',
--											  'version' => 'RSS 1.0',
--											  'item' => 'publicrss'),
--									 1=>array('href'=>common_local_url('publicatom'),
--											  'type' => 'atom',
--											  'version' => 'Atom 1.0',
--											  'item' => 'publicatom')));
--	}
-+        $this->show_feeds_list(array(0=>array('href'=>common_local_url('publicrss'),
-+                                              'type' => 'rss',
-+                                              'version' => 'RSS 1.0',
-+                                              'item' => 'publicrss'),
-+                                     1=>array('href'=>common_local_url('publicatom'),
-+                                              'type' => 'atom',
-+                                              'version' => 'Atom 1.0',
-+                                              'item' => 'publicatom')));
-+    }
-hunk ./actions/public.php 67
--	function get_instructions() {
--		return _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
--				 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' .
--				 '[Join now](%%action.register%%) to share notices about yourself with friends, family, and colleagues! ([Read more](%%doc.help%%))');
--	}
-+    function get_instructions() {
-+        return _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
-+                 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' .
-+                 '[Join now](%%action.register%%) to share notices about yourself with friends, family, and colleagues! ([Read more](%%doc.help%%))');
-+    }
-hunk ./actions/public.php 73
--	function show_header() {
--		common_element('link', array('rel' => 'alternate',
--									 'href' => common_local_url('publicrss'),
--									 'type' => 'application/rss+xml',
--									 'title' => _('Public Stream Feed')));
--		# for client side of OpenID authentication
--		common_element('meta', array('http-equiv' => 'X-XRDS-Location',
--									 'content' => common_local_url('publicxrds')));
--	}
-+    function show_header() {
-+        common_element('link', array('rel' => 'alternate',
-+                                     'href' => common_local_url('publicrss'),
-+                                     'type' => 'application/rss+xml',
-+                                     'title' => _('Public Stream Feed')));
-+        # for client side of OpenID authentication
-+        common_element('meta', array('http-equiv' => 'X-XRDS-Location',
-+                                     'content' => common_local_url('publicxrds')));
-+    }
-hunk ./actions/public.php 83
--	function show_notices($page) {
-+    function show_notices($page) {
-hunk ./actions/public.php 85
--		$cnt = 0;
--		$notice = Notice::publicStream(($page-1)*NOTICES_PER_PAGE,
--									   NOTICES_PER_PAGE + 1);
-+        $cnt = 0;
-+        $notice = Notice::publicStream(($page-1)*NOTICES_PER_PAGE,
-+                                       NOTICES_PER_PAGE + 1);
-hunk ./actions/public.php 89
--		if (!$notice) {
-+        if (!$notice) {
-hunk ./actions/public.php 92
--		}
-+        }
-hunk ./actions/public.php 96
--		common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
--						  $page, 'public');
--	}
-+        common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
-+                          $page, 'public');
-+    }
-hunk ./actions/publicrss.php 28
--	function init() {
--		return true;
--	}
-+    function init() {
-+        return true;
-+    }
-hunk ./actions/publicrss.php 32
--	function get_notices($limit=0) {
--		
--		$notices = array();
--		
--		$notice = Notice::publicStream(0, ($limit == 0) ? 48 : $limit);
--		
--		while ($notice->fetch()) {
--			$notices[] = clone($notice);
--		}
--		
--		return $notices;
--	}
-+    function get_notices($limit=0) {
-+        
-+        $notices = array();
-+        
-+        $notice = Notice::publicStream(0, ($limit == 0) ? 48 : $limit);
-+        
-+        while ($notice->fetch()) {
-+            $notices[] = clone($notice);
-+        }
-+        
-+        return $notices;
-+    }
-hunk ./actions/publicrss.php 45
--	function get_channel() {
--		global $config;
--		$c = array('url' => common_local_url('publicrss'),
--				   'title' => sprintf(_('%s Public Stream'), $config['site']['name']),
--				   'link' => common_local_url('public'),
--				   'description' => sprintf(_('All updates for %s'), $config['site']['name']));
--		return $c;
--	}
-+    function get_channel() {
-+        global $config;
-+        $c = array('url' => common_local_url('publicrss'),
-+                   'title' => sprintf(_('%s Public Stream'), $config['site']['name']),
-+                   'link' => common_local_url('public'),
-+                   'description' => sprintf(_('All updates for %s'), $config['site']['name']));
-+        return $c;
-+    }
-hunk ./actions/publicrss.php 54
--	function get_image() {
--		return NULL;
--	}
-+    function get_image() {
-+        return NULL;
-+    }
-hunk ./actions/publicxrds.php 28
--	function is_readonly() {
--		return true;
--	}
-+    function is_readonly() {
-+        return true;
-+    }
-hunk ./actions/publicxrds.php 32
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/publicxrds.php 34
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/publicxrds.php 36
--		header('Content-Type: application/xrds+xml');
-+        header('Content-Type: application/xrds+xml');
-hunk ./actions/publicxrds.php 38
--		common_start_xml();
--		common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
-+        common_start_xml();
-+        common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
-hunk ./actions/publicxrds.php 41
--		common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
--										  'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
--										  'version' => '2.0'));
-+        common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
-+                                          'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
-+                                          'version' => '2.0'));
+-    function show_form($msg=NULL, $success=false) {
++    function show_form($msg=null, $success=false) {
+hunk ./actions/profilesettings.php 34
+-        common_element('h2', NULL, _('Avatar'));
++        common_element('h2', null, _('Avatar'));
+hunk ./actions/profilesettings.php 36
+-        common_element('h2', NULL, _('Change password'));
++        common_element('h2', null, _('Change password'));
+hunk ./actions/profilesettings.php 38
+-//        common_element('h2', NULL, _('Delete my account'));
++//        common_element('h2', null, _('Delete my account'));
+hunk ./actions/public.php 34
+-                           array($this, 'show_header'), NULL,
++                           array($this, 'show_header'), null,
+hunk ./actions/publicrss.php 55
+-        return NULL;
++        return null;
 hunk ./actions/publicxrds.php 45
--		common_element('Type', NULL, 'xri://$xrds*simple');
-+        common_element('Type', NULL, 'xri://$xrds*simple');
-hunk ./actions/publicxrds.php 47
--		foreach (array('finishopenidlogin', 'finishaddopenid', 'finishimmediate') as $finish) {
--			$this->show_service(Auth_OpenID_RP_RETURN_TO_URL_TYPE,
--								common_local_url($finish));
--		}
-+        foreach (array('finishopenidlogin', 'finishaddopenid', 'finishimmediate') as $finish) {
-+            $this->show_service(Auth_OpenID_RP_RETURN_TO_URL_TYPE,
-+                                common_local_url($finish));
-+        }
-hunk ./actions/publicxrds.php 52
--		common_element_end('XRD');
-+        common_element_end('XRD');
-hunk ./actions/publicxrds.php 54
--		common_element_end('XRDS');
--		common_end_xml();
--	}
-+        common_element_end('XRDS');
-+        common_end_xml();
-+    }
+-        common_element('Type', NULL, 'xri://$xrds*simple');
++        common_element('Type', null, 'xri://$xrds*simple');
 hunk ./actions/publicxrds.php 58
--	function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
--		common_element_start('Service');
--		if ($uri) {
--			common_element('URI', NULL, $uri);
--		}
--		common_element('Type', NULL, $type);
--		if ($params) {
--			foreach ($params as $param) {
--				common_element('Type', NULL, $param);
--			}
--		}
--		if ($sigs) {
--			foreach ($sigs as $sig) {
--				common_element('Type', NULL, $sig);
--			}
--		}
--		if ($localId) {
--			common_element('LocalID', NULL, $localId);
--		}
--		common_element_end('Service');
--	}
-+    function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
-+        common_element_start('Service');
-+        if ($uri) {
-+            common_element('URI', NULL, $uri);
-+        }
-+        common_element('Type', NULL, $type);
-+        if ($params) {
-+            foreach ($params as $param) {
-+                common_element('Type', NULL, $param);
-+            }
-+        }
-+        if ($sigs) {
-+            foreach ($sigs as $sig) {
-+                common_element('Type', NULL, $sig);
-+            }
-+        }
-+        if ($localId) {
-+            common_element('LocalID', NULL, $localId);
-+        }
-+        common_element_end('Service');
-+    }
-hunk ./actions/recoverpassword.php 31
--			$this->client_error(_('You are already logged in!'));
-+            $this->client_error(_('You are already logged in!'));
-hunk ./actions/recoverpassword.php 34
--        	if ($this->arg('recover')) {
--            	$this->recover_password();
-+            if ($this->arg('recover')) {
-+                $this->recover_password();
-hunk ./actions/recoverpassword.php 37
--            	$this->reset_password();
--			} else {
--				$this->client_error(_('Unexpected form submission.'));
--			}
--		} else {
--			if ($this->trimmed('code')) {
--        		$this->check_code();
--        	} else {
--        		$this->show_form();
--			}
--		}
--	}
-+                $this->reset_password();
-+            } else {
-+                $this->client_error(_('Unexpected form submission.'));
-+            }
-+        } else {
-+            if ($this->trimmed('code')) {
-+                $this->check_code();
-+            } else {
-+                $this->show_form();
-+            }
-+        }
-+    }
-hunk ./actions/recoverpassword.php 50
--	function check_code() {
-+    function check_code() {
-hunk ./actions/recoverpassword.php 52
--		$code = $this->trimmed('code');
--		$confirm = Confirm_address::staticGet('code', $code);
-+        $code = $this->trimmed('code');
-+        $confirm = Confirm_address::staticGet('code', $code);
-hunk ./actions/recoverpassword.php 55
--		if (!$confirm) {
--			$this->client_error(_('No such recovery code.'));
--			return;
--		}
--		if ($confirm->address_type != 'recover') {
--			$this->client_error(_('Not a recovery code.'));
--			return;
--		}
-+        if (!$confirm) {
-+            $this->client_error(_('No such recovery code.'));
-+            return;
-+        }
-+        if ($confirm->address_type != 'recover') {
-+            $this->client_error(_('Not a recovery code.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 64
--		$user = User::staticGet($confirm->user_id);
-+        $user = User::staticGet($confirm->user_id);
-hunk ./actions/recoverpassword.php 66
--		if (!$user) {
--			$this->server_error(_('Recovery code for unknown user.'));
--			return;
--		}
-+        if (!$user) {
-+            $this->server_error(_('Recovery code for unknown user.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 71
--		$touched = strtotime($confirm->modified);
--		$email = $confirm->address;
-+        $touched = strtotime($confirm->modified);
-+        $email = $confirm->address;
-hunk ./actions/recoverpassword.php 74
--		# Burn this code
-+        # Burn this code
-hunk ./actions/recoverpassword.php 76
--		$result = $confirm->delete();
-+        $result = $confirm->delete();
-hunk ./actions/recoverpassword.php 78
--		if (!$result) {
--			common_log_db_error($confirm, 'DELETE', __FILE__);
--			common_server_error(_('Error with confirmation code.'));
--			return;
--		}
-+        if (!$result) {
-+            common_log_db_error($confirm, 'DELETE', __FILE__);
-+            common_server_error(_('Error with confirmation code.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 84
--		# These should be reaped, but for now we just check mod time
--		# Note: it's still deleted; let's avoid a second attempt!
-+        # These should be reaped, but for now we just check mod time
-+        # Note: it's still deleted; let's avoid a second attempt!
-hunk ./actions/recoverpassword.php 87
--		if ((time() - $touched) > MAX_RECOVERY_TIME) {
--			common_log(LOG_WARNING, 
--					   'Attempted redemption on recovery code ' .
--					   'that is ' . $touched . ' seconds old. ');
--			$this->client_error(_('This confirmation code is too old. ' .
--			                       'Please start again.'));
--			return;
--		}
-+        if ((time() - $touched) > MAX_RECOVERY_TIME) {
-+            common_log(LOG_WARNING, 
-+                       'Attempted redemption on recovery code ' .
-+                       'that is ' . $touched . ' seconds old. ');
-+            $this->client_error(_('This confirmation code is too old. ' .
-+                                   'Please start again.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 96
--		# If we used an outstanding confirmation to send the email,
--		# it's been confirmed at this point.
-+        # If we used an outstanding confirmation to send the email,
-+        # it's been confirmed at this point.
-hunk ./actions/recoverpassword.php 99
--		if (!$user->email) {
--			$orig = clone($user);
--			$user->email = $email;
--			$result = $user->updateKeys($orig);
--			if (!$result) {
--				common_log_db_error($user, 'UPDATE', __FILE__);
--				$this->server_error(_('Could not update user with confirmed email address.'));
--				return;
--			}
--		}
-+        if (!$user->email) {
-+            $orig = clone($user);
-+            $user->email = $email;
-+            $result = $user->updateKeys($orig);
-+            if (!$result) {
-+                common_log_db_error($user, 'UPDATE', __FILE__);
-+                $this->server_error(_('Could not update user with confirmed email address.'));
-+                return;
-+            }
-+        }
-hunk ./actions/recoverpassword.php 110
--		# Success!
-+        # Success!
-hunk ./actions/recoverpassword.php 112
--		$this->set_temp_user($user);
--		$this->show_password_form();
--	}
-+        $this->set_temp_user($user);
-+        $this->show_password_form();
-+    }
-hunk ./actions/recoverpassword.php 116
--	function set_temp_user(&$user) {
--		common_ensure_session();
--		$_SESSION['tempuser'] = $user->id;
--	}
-+    function set_temp_user(&$user) {
-+        common_ensure_session();
-+        $_SESSION['tempuser'] = $user->id;
-+    }
-hunk ./actions/recoverpassword.php 121
--	function get_temp_user() {
--		common_ensure_session();
--		$user_id = $_SESSION['tempuser'];
--		if ($user_id) {
--			$user = User::staticGet($user_id);
--		}
--		return $user;
--	}
-+    function get_temp_user() {
-+        common_ensure_session();
-+        $user_id = $_SESSION['tempuser'];
-+        if ($user_id) {
-+            $user = User::staticGet($user_id);
-+        }
-+        return $user;
-+    }
-hunk ./actions/recoverpassword.php 130
--	function clear_temp_user() {
--		common_ensure_session();
--		unset($_SESSION['tempuser']);
--	}
-+    function clear_temp_user() {
-+        common_ensure_session();
-+        unset($_SESSION['tempuser']);
-+    }
+-    function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
++    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
+hunk ./actions/publicxrds.php 61
+-            common_element('URI', NULL, $uri);
++            common_element('URI', null, $uri);
+hunk ./actions/publicxrds.php 63
+-        common_element('Type', NULL, $type);
++        common_element('Type', null, $type);
+hunk ./actions/publicxrds.php 66
+-                common_element('Type', NULL, $param);
++                common_element('Type', null, $param);
+hunk ./actions/publicxrds.php 71
+-                common_element('Type', NULL, $sig);
++                common_element('Type', null, $sig);
+hunk ./actions/publicxrds.php 75
+-            common_element('LocalID', NULL, $localId);
++            common_element('LocalID', null, $localId);
 hunk ./actions/recoverpassword.php 135
--	function show_top($msg=NULL) {
--		if ($msg) {
-+    function show_top($msg=NULL) {
-+        if ($msg) {
-hunk ./actions/recoverpassword.php 138
--		} else {
--			common_element_start('div', 'instructions');
--			common_element('p', NULL, 
--						   _('If you\'ve forgotten or lost your' .
--						      ' password, you can get a new one sent to' .
--						      ' the email address you have stored ' .
--						      ' in your account.'));
--			common_element_end('div');
--		}
--	}
-+        } else {
-+            common_element_start('div', 'instructions');
-+            common_element('p', NULL, 
-+                           _('If you\'ve forgotten or lost your' .
-+                              ' password, you can get a new one sent to' .
-+                              ' the email address you have stored ' .
-+                              ' in your account.'));
-+            common_element_end('div');
-+        }
-+    }
+-    function show_top($msg=NULL) {
++    function show_top($msg=null) {
+hunk ./actions/recoverpassword.php 140
+-            common_element('p', NULL, 
++            common_element('p', null, 
 hunk ./actions/recoverpassword.php 149
--	function show_password_top($msg=NULL) {
--		if ($msg) {
-+    function show_password_top($msg=NULL) {
-+        if ($msg) {
-hunk ./actions/recoverpassword.php 152
--		} else {
--			common_element('div', 'instructions',
--						   _('You\'ve been identified. Enter a ' .
--						      ' new password below. '));
--		}
--	}
-+        } else {
-+            common_element('div', 'instructions',
-+                           _('You\'ve been identified. Enter a ' .
-+                              ' new password below. '));
-+        }
-+    }
+-    function show_password_top($msg=NULL) {
++    function show_password_top($msg=null) {
 hunk ./actions/recoverpassword.php 159
--	function show_form($msg=NULL) {
-+    function show_form($msg=NULL) {
+-    function show_form($msg=NULL) {
++    function show_form($msg=null) {
 hunk ./actions/recoverpassword.php 161
--		common_show_header(_('Recover password'), NULL,
--		$msg, array($this, 'show_top'));
-+        common_show_header(_('Recover password'), NULL,
-+        $msg, array($this, 'show_top'));
-hunk ./actions/recoverpassword.php 164
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'recoverpassword',
--										   'action' => common_local_url('recoverpassword')));
--		common_input('nicknameoremail', _('Nickname or email'),
--					 $this->trimmed('nicknameoremail'),
--		             _('Your nickname on this server, ' .
--		                'or your registered email address.'));
--		common_submit('recover', _('Recover'));
--		common_element_end('form');
--		common_show_footer();
--	}
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'recoverpassword',
-+                                           'action' => common_local_url('recoverpassword')));
-+        common_input('nicknameoremail', _('Nickname or email'),
-+                     $this->trimmed('nicknameoremail'),
-+                     _('Your nickname on this server, ' .
-+                        'or your registered email address.'));
-+        common_submit('recover', _('Recover'));
-+        common_element_end('form');
-+        common_show_footer();
-+    }
+-        common_show_header(_('Recover password'), NULL,
++        common_show_header(_('Recover password'), null,
 hunk ./actions/recoverpassword.php 176
--	function show_password_form($msg=NULL) {
-+    function show_password_form($msg=NULL) {
+-    function show_password_form($msg=NULL) {
++    function show_password_form($msg=null) {
 hunk ./actions/recoverpassword.php 178
--		common_show_header(_('Reset password'), NULL,
--		$msg, array($this, 'show_password_top'));
-+        common_show_header(_('Reset password'), NULL,
-+        $msg, array($this, 'show_password_top'));
-hunk ./actions/recoverpassword.php 181
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'recoverpassword',
--										   'action' => common_local_url('recoverpassword')));
--		common_hidden('token', common_session_token());
--		common_password('newpassword', _('New password'),
--						_('6 or more characters, and don\'t forget it!'));
--		common_password('confirm', _('Confirm'),
--						_('Same as password above'));
--		common_submit('reset', _('Reset'));
--		common_element_end('form');
--		common_show_footer();
--	}
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'recoverpassword',
-+                                           'action' => common_local_url('recoverpassword')));
-+        common_hidden('token', common_session_token());
-+        common_password('newpassword', _('New password'),
-+                        _('6 or more characters, and don\'t forget it!'));
-+        common_password('confirm', _('Confirm'),
-+                        _('Same as password above'));
-+        common_submit('reset', _('Reset'));
-+        common_element_end('form');
-+        common_show_footer();
-+    }
-hunk ./actions/recoverpassword.php 194
--	function recover_password() {
--		$nore = $this->trimmed('nicknameoremail');
--		if (!$nore) {
--			$this->show_form(_('Enter a nickname or email address.'));
--			return;
--		}
-+    function recover_password() {
-+        $nore = $this->trimmed('nicknameoremail');
-+        if (!$nore) {
-+            $this->show_form(_('Enter a nickname or email address.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 201
--		$user = User::staticGet('email', common_canonical_email($nore));
-+        $user = User::staticGet('email', common_canonical_email($nore));
-hunk ./actions/recoverpassword.php 203
--		if (!$user) {
--			$user = User::staticGet('nickname', common_canonical_nickname($nore));
--		}
-+        if (!$user) {
-+            $user = User::staticGet('nickname', common_canonical_nickname($nore));
-+        }
-hunk ./actions/recoverpassword.php 207
--		# See if it's an unconfirmed email address
-+        # See if it's an unconfirmed email address
-hunk ./actions/recoverpassword.php 209
--		if (!$user) {
--			$confirm_email = Confirm_address::staticGet('address', common_canonical_email($nore));
--			if ($confirm_email && $confirm_email->address_type == 'email') {
--				$user = User::staticGet($confirm_email->user_id);
--			}
--		}
-+        if (!$user) {
-+            $confirm_email = Confirm_address::staticGet('address', common_canonical_email($nore));
-+            if ($confirm_email && $confirm_email->address_type == 'email') {
-+                $user = User::staticGet($confirm_email->user_id);
-+            }
-+        }
-hunk ./actions/recoverpassword.php 216
--		if (!$user) {
--			$this->show_form(_('No user with that email address or username.'));
--			return;
--		}
-+        if (!$user) {
-+            $this->show_form(_('No user with that email address or username.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 221
--		# Try to get an unconfirmed email address if they used a user name
-+        # Try to get an unconfirmed email address if they used a user name
-hunk ./actions/recoverpassword.php 223
--		if (!$user->email && !$confirm_email) {
--			$confirm_email = Confirm_address::staticGet('user_id', $user->id);
--			if ($confirm_email && $confirm_email->address_type != 'email') {
--				# Skip non-email confirmations
--				$confirm_email = NULL;
--			}
--		}
-+        if (!$user->email && !$confirm_email) {
-+            $confirm_email = Confirm_address::staticGet('user_id', $user->id);
-+            if ($confirm_email && $confirm_email->address_type != 'email') {
-+                # Skip non-email confirmations
-+                $confirm_email = NULL;
-+            }
-+        }
-hunk ./actions/recoverpassword.php 231
--		if (!$user->email && !$confirm_email) {
--			$this->client_error(_('No registered email address for that user.'));
--			return;
--		}
-+        if (!$user->email && !$confirm_email) {
-+            $this->client_error(_('No registered email address for that user.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 236
--		# Success! We have a valid user and a confirmed or unconfirmed email address
-+        # Success! We have a valid user and a confirmed or unconfirmed email address
-hunk ./actions/recoverpassword.php 238
--		$confirm = new Confirm_address();
--		$confirm->code = common_confirmation_code(128);
--		$confirm->address_type = 'recover';
--		$confirm->user_id = $user->id;
--		$confirm->address = (isset($user->email)) ? $user->email : $confirm_email->address;
-+        $confirm = new Confirm_address();
-+        $confirm->code = common_confirmation_code(128);
-+        $confirm->address_type = 'recover';
-+        $confirm->user_id = $user->id;
-+        $confirm->address = (isset($user->email)) ? $user->email : $confirm_email->address;
-hunk ./actions/recoverpassword.php 244
--		if (!$confirm->insert()) {
--			common_log_db_error($confirm, 'INSERT', __FILE__);
--			$this->server_error(_('Error saving address confirmation.'));
--			return;
--		}
-+        if (!$confirm->insert()) {
-+            common_log_db_error($confirm, 'INSERT', __FILE__);
-+            $this->server_error(_('Error saving address confirmation.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 250
--		$body = "Hey, $user->nickname.";
--		$body .= "\n\n";
--		$body .= 'Someone just asked for a new password ' .
--		         'for this account on ' . common_config('site', 'name') . '.';
--		$body .= "\n\n";
--		$body .= 'If it was you, and you want to confirm, use the URL below:';
--		$body .= "\n\n";
--		$body .= "\t".common_local_url('recoverpassword',
--								   array('code' => $confirm->code));
--		$body .= "\n\n";
--		$body .= 'If not, just ignore this message.';
--		$body .= "\n\n";
--		$body .= 'Thanks for your time, ';
--		$body .= "\n";
--		$body .= common_config('site', 'name');
--		$body .= "\n";
-+        $body = "Hey, $user->nickname.";
-+        $body .= "\n\n";
-+        $body .= 'Someone just asked for a new password ' .
-+                 'for this account on ' . common_config('site', 'name') . '.';
-+        $body .= "\n\n";
-+        $body .= 'If it was you, and you want to confirm, use the URL below:';
-+        $body .= "\n\n";
-+        $body .= "\t".common_local_url('recoverpassword',
-+                                   array('code' => $confirm->code));
-+        $body .= "\n\n";
-+        $body .= 'If not, just ignore this message.';
-+        $body .= "\n\n";
-+        $body .= 'Thanks for your time, ';
-+        $body .= "\n";
-+        $body .= common_config('site', 'name');
-+        $body .= "\n";
-hunk ./actions/recoverpassword.php 267
--		mail_to_user($user, _('Password recovery requested'), $body, $confirm->address);
-+        mail_to_user($user, _('Password recovery requested'), $body, $confirm->address);
-hunk ./actions/recoverpassword.php 269
--		common_show_header(_('Password recovery requested'));
--		common_element('p', NULL,
--		               _('Instructions for recovering your password ' .
--		                  'have been sent to the email address registered to your ' .
--		                  'account.'));
--		common_show_footer();
--	}
-+        common_show_header(_('Password recovery requested'));
-+        common_element('p', NULL,
-+                       _('Instructions for recovering your password ' .
-+                          'have been sent to the email address registered to your ' .
-+                          'account.'));
-+        common_show_footer();
-+    }
-hunk ./actions/recoverpassword.php 277
--	function reset_password() {
-+    function reset_password() {
-hunk ./actions/recoverpassword.php 279
--		# CSRF protection
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        # CSRF protection
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 286
--		$user = $this->get_temp_user();
-+        $user = $this->get_temp_user();
-hunk ./actions/recoverpassword.php 288
--		if (!$user) {
--			$this->client_error(_('Unexpected password reset.'));
--			return;
--		}
-+        if (!$user) {
-+            $this->client_error(_('Unexpected password reset.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 293
--		$newpassword = $this->trimmed('newpassword');
--		$confirm = $this->trimmed('confirm');
-+        $newpassword = $this->trimmed('newpassword');
-+        $confirm = $this->trimmed('confirm');
-hunk ./actions/recoverpassword.php 296
--		if (!$newpassword || strlen($newpassword) < 6) {
--			$this->show_password_form(_('Password must be 6 chars or more.'));
--			return;
--		}
--		if ($newpassword != $confirm) {
--			$this->show_password_form(_('Password and confirmation do not match.'));
--			return;
--		}
-+        if (!$newpassword || strlen($newpassword) < 6) {
-+            $this->show_password_form(_('Password must be 6 chars or more.'));
-+            return;
-+        }
-+        if ($newpassword != $confirm) {
-+            $this->show_password_form(_('Password and confirmation do not match.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 305
--		# OK, we're ready to go
-+        # OK, we're ready to go
-hunk ./actions/recoverpassword.php 307
--		$original = clone($user);
-+        $original = clone($user);
-hunk ./actions/recoverpassword.php 309
--		$user->password = common_munge_password($newpassword, $user->id);
-+        $user->password = common_munge_password($newpassword, $user->id);
-hunk ./actions/recoverpassword.php 311
--		if (!$user->update($original)) {
--			common_log_db_error($user, 'UPDATE', __FILE__);
--			common_server_error(_('Can\'t save new password.'));
--			return;
--		}
-+        if (!$user->update($original)) {
-+            common_log_db_error($user, 'UPDATE', __FILE__);
-+            common_server_error(_('Can\'t save new password.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 317
--		$this->clear_temp_user();
-+        $this->clear_temp_user();
-hunk ./actions/recoverpassword.php 319
--		if (!common_set_user($user->nickname)) {
--			common_server_error(_('Error setting user.'));
--			return;
--		}
-+        if (!common_set_user($user->nickname)) {
-+            common_server_error(_('Error setting user.'));
-+            return;
-+        }
-hunk ./actions/recoverpassword.php 324
--		common_real_login(true);
-+        common_real_login(true);
-hunk ./actions/recoverpassword.php 326
--		common_show_header(_('Password saved.'));
--		common_element('p', NULL, _('New password successfully saved. ' .
--		                             'You are now logged in.'));
--		common_show_footer();
--	}
-+        common_show_header(_('Password saved.'));
-+        common_element('p', NULL, _('New password successfully saved. ' .
-+                                     'You are now logged in.'));
-+        common_show_footer();
-+    }
-hunk ./actions/register.php 24
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/register.php 27
--		if (common_config('site', 'closed')) {
--			common_user_error(_('Registration not allowed.'));
--		} else if (common_logged_in()) {
--			common_user_error(_('Already logged in.'));
--		} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
--			$this->try_register();
--		} else {
--			$this->show_form();
--		}
--	}
-+        if (common_config('site', 'closed')) {
-+            common_user_error(_('Registration not allowed.'));
-+        } else if (common_logged_in()) {
-+            common_user_error(_('Already logged in.'));
-+        } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-+            $this->try_register();
-+        } else {
-+            $this->show_form();
-+        }
-+    }
-hunk ./actions/register.php 38
--	function try_register() {
-+    function try_register() {
-hunk ./actions/register.php 40
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/register.php 46
--		$nickname = $this->trimmed('nickname');
--		$email = $this->trimmed('email');
--		$fullname = $this->trimmed('fullname');
--		$homepage = $this->trimmed('homepage');
--		$bio = $this->trimmed('bio');
--		$location = $this->trimmed('location');
-+        $nickname = $this->trimmed('nickname');
-+        $email = $this->trimmed('email');
-+        $fullname = $this->trimmed('fullname');
-+        $homepage = $this->trimmed('homepage');
-+        $bio = $this->trimmed('bio');
-+        $location = $this->trimmed('location');
-hunk ./actions/register.php 53
--		# We don't trim these... whitespace is OK in a password!
-+        # We don't trim these... whitespace is OK in a password!
-hunk ./actions/register.php 55
--		$password = $this->arg('password');
--		$confirm = $this->arg('confirm');
-+        $password = $this->arg('password');
-+        $confirm = $this->arg('confirm');
-hunk ./actions/register.php 58
--		# invitation code, if any
-+        # invitation code, if any
-hunk ./actions/register.php 60
--		$code = $this->trimmed('code');
-+        $code = $this->trimmed('code');
-hunk ./actions/register.php 62
--		if ($code) {
--			$invite = Invitation::staticGet($code);
--		}
-+        if ($code) {
-+            $invite = Invitation::staticGet($code);
-+        }
-hunk ./actions/register.php 66
--		if (common_config('site', 'inviteonly') && !($code && $invite)) {
--			$this->client_error(_('Sorry, only invited people can register.'));
--			return;
--		}
-+        if (common_config('site', 'inviteonly') && !($code && $invite)) {
-+            $this->client_error(_('Sorry, only invited people can register.'));
-+            return;
-+        }
-hunk ./actions/register.php 71
--		# Input scrubbing
-+        # Input scrubbing
-hunk ./actions/register.php 73
--		$nickname = common_canonical_nickname($nickname);
--		$email = common_canonical_email($email);
-+        $nickname = common_canonical_nickname($nickname);
-+        $email = common_canonical_email($email);
-hunk ./actions/register.php 76
--		if (!$this->boolean('license')) {
--			$this->show_form(_('You can\'t register if you don\'t agree to the license.'));
--		} else if ($email && !Validate::email($email, true)) {
--			$this->show_form(_('Not a valid email address.'));
--		} else if (!Validate::string($nickname, array('min_length' => 1,
--													  'max_length' => 64,
--													  'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
--			$this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
--		} else if ($this->nickname_exists($nickname)) {
--			$this->show_form(_('Nickname already in use. Try another one.'));
--		} else if (!User::allowed_nickname($nickname)) {
--			$this->show_form(_('Not a valid nickname.'));
--		} else if ($this->email_exists($email)) {
--			$this->show_form(_('Email address already exists.'));
--		} else if (!is_null($homepage) && (strlen($homepage) > 0) &&
--				   !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
--			$this->show_form(_('Homepage is not a valid URL.'));
--			return;
--		} else if (!is_null($fullname) && strlen($fullname) > 255) {
--			$this->show_form(_('Full name is too long (max 255 chars).'));
--			return;
--		} else if (!is_null($bio) && strlen($bio) > 140) {
--			$this->show_form(_('Bio is too long (max 140 chars).'));
--			return;
--		} else if (!is_null($location) && strlen($location) > 255) {
--			$this->show_form(_('Location is too long (max 255 chars).'));
--			return;
--		} else if (strlen($password) < 6) {
--			$this->show_form(_('Password must be 6 or more characters.'));
--			return;
--		} else if ($password != $confirm) {
--			$this->show_form(_('Passwords don\'t match.'));
--		} else if ($user = User::register(array('nickname' => $nickname, 'password' => $password, 'email' => $email,
--												'fullname' => $fullname, 'homepage' => $homepage, 'bio' => $bio,
--												'location' => $location, 'code' => $code))) {
--			if (!$user) {
--				$this->show_form(_('Invalid username or password.'));
--				return;
--			}
--			# success!
--			if (!common_set_user($user)) {
--				common_server_error(_('Error setting user.'));
--				return;
--			}
--			# this is a real login
--			common_real_login(true);
--			if ($this->boolean('rememberme')) {
--				common_debug('Adding rememberme cookie for ' . $nickname);
--				common_rememberme($user);
--			}
--			# Re-init language env in case it changed (not yet, but soon)
--			common_init_language();
--			$this->show_success();
--		} else {
--			$this->show_form(_('Invalid username or password.'));
--		}
--	}
-+        if (!$this->boolean('license')) {
-+            $this->show_form(_('You can\'t register if you don\'t agree to the license.'));
-+        } else if ($email && !Validate::email($email, true)) {
-+            $this->show_form(_('Not a valid email address.'));
-+        } else if (!Validate::string($nickname, array('min_length' => 1,
-+                                                      'max_length' => 64,
-+                                                      'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
-+            $this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
-+        } else if ($this->nickname_exists($nickname)) {
-+            $this->show_form(_('Nickname already in use. Try another one.'));
-+        } else if (!User::allowed_nickname($nickname)) {
-+            $this->show_form(_('Not a valid nickname.'));
-+        } else if ($this->email_exists($email)) {
-+            $this->show_form(_('Email address already exists.'));
-+        } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
-+                   !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
-+            $this->show_form(_('Homepage is not a valid URL.'));
-+            return;
-+        } else if (!is_null($fullname) && strlen($fullname) > 255) {
-+            $this->show_form(_('Full name is too long (max 255 chars).'));
-+            return;
-+        } else if (!is_null($bio) && strlen($bio) > 140) {
-+            $this->show_form(_('Bio is too long (max 140 chars).'));
-+            return;
-+        } else if (!is_null($location) && strlen($location) > 255) {
-+            $this->show_form(_('Location is too long (max 255 chars).'));
-+            return;
-+        } else if (strlen($password) < 6) {
-+            $this->show_form(_('Password must be 6 or more characters.'));
-+            return;
-+        } else if ($password != $confirm) {
-+            $this->show_form(_('Passwords don\'t match.'));
-+        } else if ($user = User::register(array('nickname' => $nickname, 'password' => $password, 'email' => $email,
-+                                                'fullname' => $fullname, 'homepage' => $homepage, 'bio' => $bio,
-+                                                'location' => $location, 'code' => $code))) {
-+            if (!$user) {
-+                $this->show_form(_('Invalid username or password.'));
-+                return;
-+            }
-+            # success!
-+            if (!common_set_user($user)) {
-+                common_server_error(_('Error setting user.'));
-+                return;
-+            }
-+            # this is a real login
-+            common_real_login(true);
-+            if ($this->boolean('rememberme')) {
-+                common_debug('Adding rememberme cookie for ' . $nickname);
-+                common_rememberme($user);
-+            }
-+            # Re-init language env in case it changed (not yet, but soon)
-+            common_init_language();
-+            $this->show_success();
-+        } else {
-+            $this->show_form(_('Invalid username or password.'));
-+        }
-+    }
-hunk ./actions/register.php 134
--	# checks if *CANONICAL* nickname exists
-+    # checks if *CANONICAL* nickname exists
-hunk ./actions/register.php 136
--	function nickname_exists($nickname) {
--		$user = User::staticGet('nickname', $nickname);
--		return ($user !== false);
--	}
-+    function nickname_exists($nickname) {
-+        $user = User::staticGet('nickname', $nickname);
-+        return ($user !== false);
-+    }
-hunk ./actions/register.php 141
--	# checks if *CANONICAL* email exists
-+    # checks if *CANONICAL* email exists
-hunk ./actions/register.php 143
--	function email_exists($email) {
--		$email = common_canonical_email($email);
--		if (!$email || strlen($email) == 0) {
--			return false;
--		}
--		$user = User::staticGet('email', $email);
--		return ($user !== false);
--	}
-+    function email_exists($email) {
-+        $email = common_canonical_email($email);
-+        if (!$email || strlen($email) == 0) {
-+            return false;
-+        }
-+        $user = User::staticGet('email', $email);
-+        return ($user !== false);
-+    }
+-        common_show_header(_('Reset password'), NULL,
++        common_show_header(_('Reset password'), null,
+hunk ./actions/recoverpassword.php 227
+-                $confirm_email = NULL;
++                $confirm_email = null;
+hunk ./actions/recoverpassword.php 270
+-        common_element('p', NULL,
++        common_element('p', null,
+hunk ./actions/recoverpassword.php 327
+-        common_element('p', NULL, _('New password successfully saved. ' .
++        common_element('p', null, _('New password successfully saved. ' .
 hunk ./actions/register.php 152
--	function show_top($error=NULL) {
--		if ($error) {
--			common_element('p', 'error', $error);
--		} else {
--			$instr = common_markup_to_html(_('With this form you can create a new account. ' .
--											 'You can then post notices and link up to friends and colleagues. '.
--											 '(Have an [OpenID](http://openid.net/)? ' .
--											 'Try our [OpenID registration](%%action.openidlogin%%)!)'));
-+    function show_top($error=NULL) {
-+        if ($error) {
-+            common_element('p', 'error', $error);
-+        } else {
-+            $instr = common_markup_to_html(_('With this form you can create a new account. ' .
-+                                             'You can then post notices and link up to friends and colleagues. '.
-+                                             '(Have an [OpenID](http://openid.net/)? ' .
-+                                             'Try our [OpenID registration](%%action.openidlogin%%)!)'));
-hunk ./actions/register.php 161
--			common_element_start('div', 'instructions');
--			common_raw($instr);
--			common_element_end('div');
--		}
--	}
-+            common_element_start('div', 'instructions');
-+            common_raw($instr);
-+            common_element_end('div');
-+        }
-+    }
+-    function show_top($error=NULL) {
++    function show_top($error=null) {
 hunk ./actions/register.php 167
--	function show_form($error=NULL) {
--		global $config;
-+    function show_form($error=NULL) {
-+        global $config;
-hunk ./actions/register.php 170
--		$code = $this->trimmed('code');
-+        $code = $this->trimmed('code');
-hunk ./actions/register.php 172
--		if ($code) {
--			$invite = Invitation::staticGet($code);
--		}
-+        if ($code) {
-+            $invite = Invitation::staticGet($code);
-+        }
-hunk ./actions/register.php 176
--		if (common_config('site', 'inviteonly') && !($code && $invite)) {
--			$this->client_error(_('Sorry, only invited people can register.'));
--			return;
--		}
-+        if (common_config('site', 'inviteonly') && !($code && $invite)) {
-+            $this->client_error(_('Sorry, only invited people can register.'));
-+            return;
-+        }
+-    function show_form($error=NULL) {
++    function show_form($error=null) {
 hunk ./actions/register.php 181
--		common_show_header(_('Register'), NULL, $error, array($this, 'show_top'));
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'login',
--										   'action' => common_local_url('register')));
-+        common_show_header(_('Register'), NULL, $error, array($this, 'show_top'));
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'login',
-+                                           'action' => common_local_url('register')));
-hunk ./actions/register.php 186
--		common_hidden('token', common_session_token());
-+        common_hidden('token', common_session_token());
-hunk ./actions/register.php 188
--		if ($code) {
--			common_hidden('code', $code);
--		}
-+        if ($code) {
-+            common_hidden('code', $code);
-+        }
-hunk ./actions/register.php 192
--		common_input('nickname', _('Nickname'), $this->trimmed('nickname'),
--					 _('1-64 lowercase letters or numbers, no punctuation or spaces. Required.'));
--		common_password('password', _('Password'),
--						_('6 or more characters. Required.'));
--		common_password('confirm', _('Confirm'),
--						_('Same as password above. Required.'));
--		if ($invite && $invite->address_type == 'email') {
--			common_input('email', _('Email'), $invite->address,
--					 _('Used only for updates, announcements, and password recovery'));
--		} else {
--			common_input('email', _('Email'), $this->trimmed('email'),
--						 _('Used only for updates, announcements, and password recovery'));
--		}
--		common_input('fullname', _('Full name'),
--					 $this->trimmed('fullname'),
--					  _('Longer name, preferably your "real" name'));
--		common_input('homepage', _('Homepage'),
--					 $this->trimmed('homepage'),
--					 _('URL of your homepage, blog, or profile on another site'));
--		common_textarea('bio', _('Bio'),
--						$this->trimmed('bio'),
--						 _('Describe yourself and your interests in 140 chars'));
--		common_input('location', _('Location'),
--					 $this->trimmed('location'),
--					 _('Where you are, like "City, State (or Region), Country"'));
--		common_checkbox('rememberme', _('Remember me'),
--						$this->boolean('rememberme'),
--		                _('Automatically login in the future; not for shared computers!'));
--		common_element_start('p');
--		$attrs = array('type' => 'checkbox',
--					   'id' => 'license',
--					   'name' => 'license',
--					   'value' => 'true');
--		if ($this->boolean('license')) {
--			$attrs['checked'] = 'checked';
--		}
--		common_element('input', $attrs);
--	    common_text(_('My text and files are available under '));
--		common_element('a', array('href' => $config['license']['url']),
--					   $config['license']['title']);
--		common_text(_(' except this private data: password, email address, IM address, phone number.'));
--		common_element_end('p');
--		common_submit('submit', _('Register'));
--		common_element_end('form');
--		common_show_footer();
--	}
-+        common_input('nickname', _('Nickname'), $this->trimmed('nickname'),
-+                     _('1-64 lowercase letters or numbers, no punctuation or spaces. Required.'));
-+        common_password('password', _('Password'),
-+                        _('6 or more characters. Required.'));
-+        common_password('confirm', _('Confirm'),
-+                        _('Same as password above. Required.'));
-+        if ($invite && $invite->address_type == 'email') {
-+            common_input('email', _('Email'), $invite->address,
-+                     _('Used only for updates, announcements, and password recovery'));
-+        } else {
-+            common_input('email', _('Email'), $this->trimmed('email'),
-+                         _('Used only for updates, announcements, and password recovery'));
-+        }
-+        common_input('fullname', _('Full name'),
-+                     $this->trimmed('fullname'),
-+                      _('Longer name, preferably your "real" name'));
-+        common_input('homepage', _('Homepage'),
-+                     $this->trimmed('homepage'),
-+                     _('URL of your homepage, blog, or profile on another site'));
-+        common_textarea('bio', _('Bio'),
-+                        $this->trimmed('bio'),
-+                         _('Describe yourself and your interests in 140 chars'));
-+        common_input('location', _('Location'),
-+                     $this->trimmed('location'),
-+                     _('Where you are, like "City, State (or Region), Country"'));
-+        common_checkbox('rememberme', _('Remember me'),
-+                        $this->boolean('rememberme'),
-+                        _('Automatically login in the future; not for shared computers!'));
-+        common_element_start('p');
-+        $attrs = array('type' => 'checkbox',
-+                       'id' => 'license',
-+                       'name' => 'license',
-+                       'value' => 'true');
-+        if ($this->boolean('license')) {
-+            $attrs['checked'] = 'checked';
-+        }
-+        common_element('input', $attrs);
-+        common_text(_('My text and files are available under '));
-+        common_element('a', array('href' => $config['license']['url']),
-+                       $config['license']['title']);
-+        common_text(_(' except this private data: password, email address, IM address, phone number.'));
-+        common_element_end('p');
-+        common_submit('submit', _('Register'));
-+        common_element_end('form');
-+        common_show_footer();
-+    }
-hunk ./actions/register.php 239
--	function show_success() {
--		$nickname = $this->arg('nickname');
--		common_show_header(_('Registration successful'));
--		common_element_start('div', 'success');
--		$instr = sprintf(_('Congratulations, %s! And welcome to %%%%site.name%%%%. From here, you may want to...'. "\n\n" .
--						   '* Go to [your profile](%s) and post your first message.' .  "\n" .
--						   '* Add a [Jabber/GTalk address](%%%%action.imsettings%%%%) so you can send notices through instant messages.' . "\n" .
--						   '* [Search for people](%%%%action.peoplesearch%%%%) that you may know or that share your interests. ' . "\n" .
--						   '* Update your [profile settings](%%%%action.profilesettings%%%%) to tell others more about you. ' . "\n" .
--						   '* Read over the [online docs](%%%%doc.help%%%%) for features you may have missed. ' . "\n\n" .
--						   'Thanks for signing up and we hope you enjoy using this service.'),
--						 $nickname, common_local_url('showstream', array('nickname' => $nickname)));
--		common_raw(common_markup_to_html($instr));
--		$have_email = $this->trimmed('email');
--		if ($have_email) {
--			$emailinstr = _('(You should receive a message by email momentarily, with ' .
--							'instructions on how to confirm your email address.)');
--			common_raw(common_markup_to_html($emailinstr));
--		}
--		common_element_end('div');
--		common_show_footer();
--	}
-+    function show_success() {
-+        $nickname = $this->arg('nickname');
-+        common_show_header(_('Registration successful'));
-+        common_element_start('div', 'success');
-+        $instr = sprintf(_('Congratulations, %s! And welcome to %%%%site.name%%%%. From here, you may want to...'. "\n\n" .
-+                           '* Go to [your profile](%s) and post your first message.' .  "\n" .
-+                           '* Add a [Jabber/GTalk address](%%%%action.imsettings%%%%) so you can send notices through instant messages.' . "\n" .
-+                           '* [Search for people](%%%%action.peoplesearch%%%%) that you may know or that share your interests. ' . "\n" .
-+                           '* Update your [profile settings](%%%%action.profilesettings%%%%) to tell others more about you. ' . "\n" .
-+                           '* Read over the [online docs](%%%%doc.help%%%%) for features you may have missed. ' . "\n\n" .
-+                           'Thanks for signing up and we hope you enjoy using this service.'),
-+                         $nickname, common_local_url('showstream', array('nickname' => $nickname)));
-+        common_raw(common_markup_to_html($instr));
-+        $have_email = $this->trimmed('email');
-+        if ($have_email) {
-+            $emailinstr = _('(You should receive a message by email momentarily, with ' .
-+                            'instructions on how to confirm your email address.)');
-+            common_raw(common_markup_to_html($emailinstr));
-+        }
-+        common_element_end('div');
-+        common_show_footer();
-+    }
-hunk ./actions/remotesubscribe.php 26
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/remotesubscribe.php 28
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/remotesubscribe.php 30
--		if (common_logged_in()) {
--			common_user_error(_('You can use the local subscription!'));
--		    return;
--		}
-+        if (common_logged_in()) {
-+            common_user_error(_('You can use the local subscription!'));
-+            return;
-+        }
-hunk ./actions/remotesubscribe.php 35
--		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-+        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-hunk ./actions/remotesubscribe.php 37
--			# CSRF protection
--			$token = $this->trimmed('token');
--			if (!$token || $token != common_session_token()) {
--				$this->show_form(_('There was a problem with your session token. Try again, please.'));
--				return;
--			}
-+            # CSRF protection
-+            $token = $this->trimmed('token');
-+            if (!$token || $token != common_session_token()) {
-+                $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+                return;
-+            }
-hunk ./actions/remotesubscribe.php 44
--			$this->remote_subscription();
--		} else {
--			$this->show_form();
--		}
--	}
-+            $this->remote_subscription();
-+        } else {
-+            $this->show_form();
-+        }
-+    }
-hunk ./actions/remotesubscribe.php 50
--	function get_instructions() {
--		return _('To subscribe, you can [login](%%action.login%%),' .
--		          ' or [register](%%action.register%%) a new ' .
--		          ' account. If you already have an account ' .
--		          ' on a [compatible microblogging site](%%doc.openmublog%%), ' .
--		          ' enter your profile URL below.');
--	}
-+    function get_instructions() {
-+        return _('To subscribe, you can [login](%%action.login%%),' .
-+                  ' or [register](%%action.register%%) a new ' .
-+                  ' account. If you already have an account ' .
-+                  ' on a [compatible microblogging site](%%doc.openmublog%%), ' .
-+                  ' enter your profile URL below.');
-+    }
+-        common_show_header(_('Register'), NULL, $error, array($this, 'show_top'));
++        common_show_header(_('Register'), null, $error, array($this, 'show_top'));
 hunk ./actions/remotesubscribe.php 58
--	function show_top($err=NULL) {
--		if ($err) {
--			common_element('div', 'error', $err);
--		} else {
--			$instructions = $this->get_instructions();
--			$output = common_markup_to_html($instructions);
--			common_element_start('div', 'instructions');
--			common_raw($output);
--			common_element_end('p');
--		}
--	}
-+    function show_top($err=NULL) {
-+        if ($err) {
-+            common_element('div', 'error', $err);
-+        } else {
-+            $instructions = $this->get_instructions();
-+            $output = common_markup_to_html($instructions);
-+            common_element_start('div', 'instructions');
-+            common_raw($output);
-+            common_element_end('p');
-+        }
-+    }
+-    function show_top($err=NULL) {
++    function show_top($err=null) {
 hunk ./actions/remotesubscribe.php 70
--	function show_form($err=NULL) {
--		$nickname = $this->trimmed('nickname');
--		$profile = $this->trimmed('profile_url');
--		common_show_header(_('Remote subscribe'), NULL, $err,
--						   array($this, 'show_top'));
--		# id = remotesubscribe conflicts with the
--		# button on profile page
--		common_element_start('form', array('id' => 'remsub', 'method' => 'post',
--										   'action' => common_local_url('remotesubscribe')));
--		common_hidden('token', common_session_token());
--		common_input('nickname', _('User nickname'), $nickname,
--					 _('Nickname of the user you want to follow'));
--		common_input('profile_url', _('Profile URL'), $profile,
--					 _('URL of your profile on another compatible microblogging service'));
--		common_submit('submit', _('Subscribe'));
--		common_element_end('form');
--		common_show_footer();
--	}
-+    function show_form($err=NULL) {
-+        $nickname = $this->trimmed('nickname');
-+        $profile = $this->trimmed('profile_url');
-+        common_show_header(_('Remote subscribe'), NULL, $err,
-+                           array($this, 'show_top'));
-+        # id = remotesubscribe conflicts with the
-+        # button on profile page
-+        common_element_start('form', array('id' => 'remsub', 'method' => 'post',
-+                                           'action' => common_local_url('remotesubscribe')));
-+        common_hidden('token', common_session_token());
-+        common_input('nickname', _('User nickname'), $nickname,
-+                     _('Nickname of the user you want to follow'));
-+        common_input('profile_url', _('Profile URL'), $profile,
-+                     _('URL of your profile on another compatible microblogging service'));
-+        common_submit('submit', _('Subscribe'));
-+        common_element_end('form');
-+        common_show_footer();
-+    }
-hunk ./actions/remotesubscribe.php 89
--	function remote_subscription() {
--		$user = $this->get_user();
-+    function remote_subscription() {
-+        $user = $this->get_user();
-hunk ./actions/remotesubscribe.php 92
--		if (!$user) {
--			$this->show_form(_('No such user.'));
--			return;
--		}
-+        if (!$user) {
-+            $this->show_form(_('No such user.'));
-+            return;
-+        }
-hunk ./actions/remotesubscribe.php 97
--		$profile = $this->trimmed('profile_url');
-+        $profile = $this->trimmed('profile_url');
-hunk ./actions/remotesubscribe.php 99
--		if (!$profile) {
--			$this->show_form(_('No such user.'));
--			return;
--		}
-+        if (!$profile) {
-+            $this->show_form(_('No such user.'));
-+            return;
-+        }
-hunk ./actions/remotesubscribe.php 104
--		if (!Validate::uri($profile, array('allowed_schemes' => array('http', 'https')))) {
--			$this->show_form(_('Invalid profile URL (bad format)'));
--			return;
--		}
-+        if (!Validate::uri($profile, array('allowed_schemes' => array('http', 'https')))) {
-+            $this->show_form(_('Invalid profile URL (bad format)'));
-+            return;
-+        }
-hunk ./actions/remotesubscribe.php 109
--		$fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
--		$yadis = Auth_Yadis_Yadis::discover($profile, $fetcher);
-+        $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
-+        $yadis = Auth_Yadis_Yadis::discover($profile, $fetcher);
-hunk ./actions/remotesubscribe.php 112
--		if (!$yadis || $yadis->failed) {
--			$this->show_form(_('Not a valid profile URL (no YADIS document).'));
--			return;
--		}
-+        if (!$yadis || $yadis->failed) {
-+            $this->show_form(_('Not a valid profile URL (no YADIS document).'));
-+            return;
-+        }
-hunk ./actions/remotesubscribe.php 117
--		# XXX: a little liberal for sites that accidentally put whitespace before the xml declaration
-+        # XXX: a little liberal for sites that accidentally put whitespace before the xml declaration
-hunk ./actions/remotesubscribe.php 121
--		if (!$xrds) {
--			$this->show_form(_('Not a valid profile URL (no XRDS defined).'));
--			return;
--		}
-+        if (!$xrds) {
-+            $this->show_form(_('Not a valid profile URL (no XRDS defined).'));
-+            return;
-+        }
-hunk ./actions/remotesubscribe.php 126
--		$omb = $this->getOmb($xrds);
-+        $omb = $this->getOmb($xrds);
-hunk ./actions/remotesubscribe.php 128
--		if (!$omb) {
--			$this->show_form(_('Not a valid profile URL (incorrect services).'));
--			return;
--		}
-+        if (!$omb) {
-+            $this->show_form(_('Not a valid profile URL (incorrect services).'));
-+            return;
-+        }
-hunk ./actions/remotesubscribe.php 133
--		if (omb_service_uri($omb[OAUTH_ENDPOINT_REQUEST]) ==
--			common_local_url('requesttoken'))
--		{
--			$this->show_form(_('That\'s a local profile! Login to subscribe.'));
--			return;
--		}
-+        if (omb_service_uri($omb[OAUTH_ENDPOINT_REQUEST]) ==
-+            common_local_url('requesttoken'))
-+        {
-+            $this->show_form(_('That\'s a local profile! Login to subscribe.'));
-+            return;
-+        }
-hunk ./actions/remotesubscribe.php 140
--		if (User::staticGet('uri', omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]))) {
--			$this->show_form(_('That\'s a local profile! Login to subscribe.'));
--			return;
--		}
-+        if (User::staticGet('uri', omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]))) {
-+            $this->show_form(_('That\'s a local profile! Login to subscribe.'));
-+            return;
-+        }
-hunk ./actions/remotesubscribe.php 145
--		list($token, $secret) = $this->request_token($omb);
-+        list($token, $secret) = $this->request_token($omb);
-hunk ./actions/remotesubscribe.php 147
--		if (!$token || !$secret) {
--			$this->show_form(_('Couldn\'t get a request token.'));
--			return;
--		}
-+        if (!$token || !$secret) {
-+            $this->show_form(_('Couldn\'t get a request token.'));
-+            return;
-+        }
-hunk ./actions/remotesubscribe.php 152
--		$this->request_authorization($user, $omb, $token, $secret);
--	}
-+        $this->request_authorization($user, $omb, $token, $secret);
-+    }
-hunk ./actions/remotesubscribe.php 155
--	function get_user() {
--		$user = NULL;
--		$nickname = $this->trimmed('nickname');
--		if ($nickname) {
--			$user = User::staticGet('nickname', $nickname);
--		}
--		return $user;
--	}
-+    function get_user() {
-+        $user = NULL;
-+        $nickname = $this->trimmed('nickname');
-+        if ($nickname) {
-+            $user = User::staticGet('nickname', $nickname);
-+        }
-+        return $user;
-+    }
-hunk ./actions/remotesubscribe.php 164
--	function getOmb($xrds) {
-+    function getOmb($xrds) {
-hunk ./actions/remotesubscribe.php 166
--	    static $omb_endpoints = array(OMB_ENDPOINT_UPDATEPROFILE, OMB_ENDPOINT_POSTNOTICE);
--		static $oauth_endpoints = array(OAUTH_ENDPOINT_REQUEST, OAUTH_ENDPOINT_AUTHORIZE,
--										OAUTH_ENDPOINT_ACCESS);
--		$omb = array();
-+        static $omb_endpoints = array(OMB_ENDPOINT_UPDATEPROFILE, OMB_ENDPOINT_POSTNOTICE);
-+        static $oauth_endpoints = array(OAUTH_ENDPOINT_REQUEST, OAUTH_ENDPOINT_AUTHORIZE,
-+                                        OAUTH_ENDPOINT_ACCESS);
-+        $omb = array();
-hunk ./actions/remotesubscribe.php 171
--		# XXX: the following code could probably be refactored to eliminate dupes
-+        # XXX: the following code could probably be refactored to eliminate dupes
-hunk ./actions/remotesubscribe.php 173
--		$oauth_services = omb_get_services($xrds, OAUTH_DISCOVERY);
-+        $oauth_services = omb_get_services($xrds, OAUTH_DISCOVERY);
-hunk ./actions/remotesubscribe.php 175
--		if (!$oauth_services) {
--			return NULL;
--		}
-+        if (!$oauth_services) {
-+            return NULL;
-+        }
-hunk ./actions/remotesubscribe.php 179
--		$oauth_service = $oauth_services[0];
-+        $oauth_service = $oauth_services[0];
-hunk ./actions/remotesubscribe.php 181
--		$oauth_xrd = $this->getXRD($oauth_service, $xrds);
-+        $oauth_xrd = $this->getXRD($oauth_service, $xrds);
-hunk ./actions/remotesubscribe.php 183
--		if (!$oauth_xrd) {
--			return NULL;
--		}
-+        if (!$oauth_xrd) {
-+            return NULL;
-+        }
-hunk ./actions/remotesubscribe.php 187
--		if (!$this->addServices($oauth_xrd, $oauth_endpoints, $omb)) {
--			return NULL;
--		}
-+        if (!$this->addServices($oauth_xrd, $oauth_endpoints, $omb)) {
-+            return NULL;
-+        }
-hunk ./actions/remotesubscribe.php 191
--		$omb_services = omb_get_services($xrds, OMB_NAMESPACE);
-+        $omb_services = omb_get_services($xrds, OMB_NAMESPACE);
-hunk ./actions/remotesubscribe.php 193
--		if (!$omb_services) {
--			return NULL;
--		}
-+        if (!$omb_services) {
-+            return NULL;
-+        }
-hunk ./actions/remotesubscribe.php 197
--		$omb_service = $omb_services[0];
-+        $omb_service = $omb_services[0];
-hunk ./actions/remotesubscribe.php 199
--		$omb_xrd = $this->getXRD($omb_service, $xrds);
-+        $omb_xrd = $this->getXRD($omb_service, $xrds);
-hunk ./actions/remotesubscribe.php 201
--		if (!$omb_xrd) {
--			return NULL;
--		}
-+        if (!$omb_xrd) {
-+            return NULL;
-+        }
-hunk ./actions/remotesubscribe.php 205
--		if (!$this->addServices($omb_xrd, $omb_endpoints, $omb)) {
--			return NULL;
--		}
-+        if (!$this->addServices($omb_xrd, $omb_endpoints, $omb)) {
-+            return NULL;
-+        }
-hunk ./actions/remotesubscribe.php 209
--		# XXX: check that we got all the services we needed
-+        # XXX: check that we got all the services we needed
-hunk ./actions/remotesubscribe.php 211
--		foreach (array_merge($omb_endpoints, $oauth_endpoints) as $type) {
--			if (!array_key_exists($type, $omb) || !$omb[$type]) {
--				return NULL;
--			}
--		}
-+        foreach (array_merge($omb_endpoints, $oauth_endpoints) as $type) {
-+            if (!array_key_exists($type, $omb) || !$omb[$type]) {
-+                return NULL;
-+            }
-+        }
-hunk ./actions/remotesubscribe.php 217
--		if (!omb_local_id($omb[OAUTH_ENDPOINT_REQUEST])) {
--			return NULL;
--		}
-+        if (!omb_local_id($omb[OAUTH_ENDPOINT_REQUEST])) {
-+            return NULL;
-+        }
-hunk ./actions/remotesubscribe.php 221
--		return $omb;
--	}
-+        return $omb;
-+    }
-hunk ./actions/remotesubscribe.php 224
--	function getXRD($main_service, $main_xrds) {
--		$uri = omb_service_uri($main_service);
--		if (strpos($uri, "#") !== 0) {
--			# FIXME: more rigorous handling of external service definitions
--			return NULL;
--		}
--		$id = substr($uri, 1);
--		$nodes = $main_xrds->allXrdNodes;
--		$parser = $main_xrds->parser;
--		foreach ($nodes as $node) {
--			$attrs = $parser->attributes($node);
--			if (array_key_exists('xml:id', $attrs) &&
--				$attrs['xml:id'] == $id) {
--				# XXX: trick the constructor into thinking this is the only node
--				$bogus_nodes = array($node);
--				return new Auth_Yadis_XRDS($parser, $bogus_nodes);
--			}
--		}
--		return NULL;
--	}
-+    function getXRD($main_service, $main_xrds) {
-+        $uri = omb_service_uri($main_service);
-+        if (strpos($uri, "#") !== 0) {
-+            # FIXME: more rigorous handling of external service definitions
-+            return NULL;
-+        }
-+        $id = substr($uri, 1);
-+        $nodes = $main_xrds->allXrdNodes;
-+        $parser = $main_xrds->parser;
-+        foreach ($nodes as $node) {
-+            $attrs = $parser->attributes($node);
-+            if (array_key_exists('xml:id', $attrs) &&
-+                $attrs['xml:id'] == $id) {
-+                # XXX: trick the constructor into thinking this is the only node
-+                $bogus_nodes = array($node);
-+                return new Auth_Yadis_XRDS($parser, $bogus_nodes);
-+            }
-+        }
-+        return NULL;
-+    }
-hunk ./actions/remotesubscribe.php 245
--	function addServices($xrd, $types, &$omb) {
--		foreach ($types as $type) {
--			$matches = omb_get_services($xrd, $type);
--			if ($matches) {
--				$omb[$type] = $matches[0];
--			} else {
--				# no match for type
--				return false;
--			}
--		}
--		return true;
--	}
-+    function addServices($xrd, $types, &$omb) {
-+        foreach ($types as $type) {
-+            $matches = omb_get_services($xrd, $type);
-+            if ($matches) {
-+                $omb[$type] = $matches[0];
-+            } else {
-+                # no match for type
-+                return false;
-+            }
-+        }
-+        return true;
-+    }
-hunk ./actions/remotesubscribe.php 258
--	function request_token($omb) {
--		$con = omb_oauth_consumer();
-+    function request_token($omb) {
-+        $con = omb_oauth_consumer();
-hunk ./actions/remotesubscribe.php 261
--		$url = omb_service_uri($omb[OAUTH_ENDPOINT_REQUEST]);
-+        $url = omb_service_uri($omb[OAUTH_ENDPOINT_REQUEST]);
-hunk ./actions/remotesubscribe.php 263
--		# XXX: Is this the right thing to do? Strip off GET params and make them
--		# POST params? Seems wrong to me.
-+        # XXX: Is this the right thing to do? Strip off GET params and make them
-+        # POST params? Seems wrong to me.
-hunk ./actions/remotesubscribe.php 266
--		$parsed = parse_url($url);
--		$params = array();
--		parse_str($parsed['query'], $params);
-+        $parsed = parse_url($url);
-+        $params = array();
-+        parse_str($parsed['query'], $params);
+-    function show_form($err=NULL) {
++    function show_form($err=null) {
+hunk ./actions/remotesubscribe.php 73
+-        common_show_header(_('Remote subscribe'), NULL, $err,
++        common_show_header(_('Remote subscribe'), null, $err,
+hunk ./actions/remotesubscribe.php 156
+-        $user = NULL;
++        $user = null;
+hunk ./actions/remotesubscribe.php 176
+-            return NULL;
++            return null;
+hunk ./actions/remotesubscribe.php 184
+-            return NULL;
++            return null;
+hunk ./actions/remotesubscribe.php 188
+-            return NULL;
++            return null;
+hunk ./actions/remotesubscribe.php 194
+-            return NULL;
++            return null;
+hunk ./actions/remotesubscribe.php 202
+-            return NULL;
++            return null;
+hunk ./actions/remotesubscribe.php 206
+-            return NULL;
++            return null;
+hunk ./actions/remotesubscribe.php 213
+-                return NULL;
++                return null;
+hunk ./actions/remotesubscribe.php 218
+-            return NULL;
++            return null;
+hunk ./actions/remotesubscribe.php 228
+-            return NULL;
++            return null;
+hunk ./actions/remotesubscribe.php 242
+-        return NULL;
++        return null;
 hunk ./actions/remotesubscribe.php 270
--		$req = OAuthRequest::from_consumer_and_token($con, NULL, "POST", $url, $params);
-+        $req = OAuthRequest::from_consumer_and_token($con, NULL, "POST", $url, $params);
-hunk ./actions/remotesubscribe.php 272
--		$listener = omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]);
-+        $listener = omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]);
-hunk ./actions/remotesubscribe.php 274
--		if (!$listener) {
--			return NULL;
--		}
-+        if (!$listener) {
-+            return NULL;
-+        }
-hunk ./actions/remotesubscribe.php 278
--		$req->set_parameter('omb_listener', $listener);
--		$req->set_parameter('omb_version', OMB_VERSION_01);
-+        $req->set_parameter('omb_listener', $listener);
-+        $req->set_parameter('omb_version', OMB_VERSION_01);
-hunk ./actions/remotesubscribe.php 281
--		# XXX: test to see if endpoint accepts this signature method
-+        # XXX: test to see if endpoint accepts this signature method
+-        $req = OAuthRequest::from_consumer_and_token($con, NULL, "POST", $url, $params);
++        $req = OAuthRequest::from_consumer_and_token($con, null, "POST", $url, $params);
+hunk ./actions/remotesubscribe.php 275
+-            return NULL;
++            return null;
 hunk ./actions/remotesubscribe.php 283
--		$req->sign_request(omb_hmac_sha1(), $con, NULL);
-+        $req->sign_request(omb_hmac_sha1(), $con, NULL);
-hunk ./actions/remotesubscribe.php 285
--		# We re-use this tool's fetcher, since it's pretty good
-+        # We re-use this tool's fetcher, since it's pretty good
-hunk ./actions/remotesubscribe.php 287
--		$fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
-+        $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
-hunk ./actions/remotesubscribe.php 289
--		$result = $fetcher->post($req->get_normalized_http_url(),
--								 $req->to_postdata(),
-+        $result = $fetcher->post($req->get_normalized_http_url(),
-+                                 $req->to_postdata(),
-hunk ./actions/remotesubscribe.php 293
--		if ($result->status != 200) {
--			return NULL;
--		}
-+        if ($result->status != 200) {
-+            return NULL;
-+        }
-hunk ./actions/remotesubscribe.php 297
--		parse_str($result->body, $return);
-+        parse_str($result->body, $return);
-hunk ./actions/remotesubscribe.php 299
--		return array($return['oauth_token'], $return['oauth_token_secret']);
--	}
-+        return array($return['oauth_token'], $return['oauth_token_secret']);
-+    }
-hunk ./actions/remotesubscribe.php 302
--	function request_authorization($user, $omb, $token, $secret) {
--		global $config; # for license URL
-+    function request_authorization($user, $omb, $token, $secret) {
-+        global $config; # for license URL
-hunk ./actions/remotesubscribe.php 305
--		$con = omb_oauth_consumer();
--		$tok = new OAuthToken($token, $secret);
-+        $con = omb_oauth_consumer();
-+        $tok = new OAuthToken($token, $secret);
-hunk ./actions/remotesubscribe.php 308
--		$url = omb_service_uri($omb[OAUTH_ENDPOINT_AUTHORIZE]);
-+        $url = omb_service_uri($omb[OAUTH_ENDPOINT_AUTHORIZE]);
-hunk ./actions/remotesubscribe.php 310
--		# XXX: Is this the right thing to do? Strip off GET params and make them
--		# POST params? Seems wrong to me.
-+        # XXX: Is this the right thing to do? Strip off GET params and make them
-+        # POST params? Seems wrong to me.
-hunk ./actions/remotesubscribe.php 313
--		$parsed = parse_url($url);
--		$params = array();
--		parse_str($parsed['query'], $params);
-+        $parsed = parse_url($url);
-+        $params = array();
-+        parse_str($parsed['query'], $params);
-hunk ./actions/remotesubscribe.php 317
--		$req = OAuthRequest::from_consumer_and_token($con, $tok, 'GET', $url, $params);
-+        $req = OAuthRequest::from_consumer_and_token($con, $tok, 'GET', $url, $params);
-hunk ./actions/remotesubscribe.php 319
--		# We send over a ton of information. This lets the other
--		# server store info about our user, and it lets the current
--		# user decide if they really want to authorize the subscription.
-+        # We send over a ton of information. This lets the other
-+        # server store info about our user, and it lets the current
-+        # user decide if they really want to authorize the subscription.
-hunk ./actions/remotesubscribe.php 323
--		$req->set_parameter('omb_version', OMB_VERSION_01);
--		$req->set_parameter('omb_listener', omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]));
--		$req->set_parameter('omb_listenee', $user->uri);
--		$req->set_parameter('omb_listenee_profile', common_profile_url($user->nickname));
--		$req->set_parameter('omb_listenee_nickname', $user->nickname);
--		$req->set_parameter('omb_listenee_license', $config['license']['url']);
-+        $req->set_parameter('omb_version', OMB_VERSION_01);
-+        $req->set_parameter('omb_listener', omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]));
-+        $req->set_parameter('omb_listenee', $user->uri);
-+        $req->set_parameter('omb_listenee_profile', common_profile_url($user->nickname));
-+        $req->set_parameter('omb_listenee_nickname', $user->nickname);
-+        $req->set_parameter('omb_listenee_license', $config['license']['url']);
-hunk ./actions/remotesubscribe.php 330
--		$profile = $user->getProfile();
--		if (!$profile) {
--			common_log_db_error($user, 'SELECT', __FILE__);
--			$this->server_error(_('User without matching profile'));
--			return;
--		}
-+        $profile = $user->getProfile();
-+        if (!$profile) {
-+            common_log_db_error($user, 'SELECT', __FILE__);
-+            $this->server_error(_('User without matching profile'));
-+            return;
-+        }
-hunk ./actions/remotesubscribe.php 337
--		if ($profile->fullname) {
--			$req->set_parameter('omb_listenee_fullname', $profile->fullname);
--		}
--		if ($profile->homepage) {
--			$req->set_parameter('omb_listenee_homepage', $profile->homepage);
--		}
--		if ($profile->bio) {
--			$req->set_parameter('omb_listenee_bio', $profile->bio);
--		}
--		if ($profile->location) {
--			$req->set_parameter('omb_listenee_location', $profile->location);
--		}
--		$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
--		if ($avatar) {
--			$req->set_parameter('omb_listenee_avatar', $avatar->url);
--		}
-+        if ($profile->fullname) {
-+            $req->set_parameter('omb_listenee_fullname', $profile->fullname);
-+        }
-+        if ($profile->homepage) {
-+            $req->set_parameter('omb_listenee_homepage', $profile->homepage);
-+        }
-+        if ($profile->bio) {
-+            $req->set_parameter('omb_listenee_bio', $profile->bio);
-+        }
-+        if ($profile->location) {
-+            $req->set_parameter('omb_listenee_location', $profile->location);
-+        }
-+        $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-+        if ($avatar) {
-+            $req->set_parameter('omb_listenee_avatar', $avatar->url);
-+        }
-hunk ./actions/remotesubscribe.php 354
--		# XXX: add a nonce to prevent replay attacks
-+        # XXX: add a nonce to prevent replay attacks
-hunk ./actions/remotesubscribe.php 356
--		$req->set_parameter('oauth_callback', common_local_url('finishremotesubscribe'));
-+        $req->set_parameter('oauth_callback', common_local_url('finishremotesubscribe'));
-hunk ./actions/remotesubscribe.php 358
--		# XXX: test to see if endpoint accepts this signature method
-+        # XXX: test to see if endpoint accepts this signature method
-hunk ./actions/remotesubscribe.php 360
--		$req->sign_request(omb_hmac_sha1(), $con, $tok);
-+        $req->sign_request(omb_hmac_sha1(), $con, $tok);
-hunk ./actions/remotesubscribe.php 362
--		# store all our info here
-+        # store all our info here
-hunk ./actions/remotesubscribe.php 364
--		$omb['listenee'] = $user->nickname;
--		$omb['listener'] = omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]);
--		$omb['token'] = $token;
--		$omb['secret'] = $secret;
--		# call doesn't work after bounce back so we cache; maybe serialization issue...?
--		$omb['access_token_url'] = omb_service_uri($omb[OAUTH_ENDPOINT_ACCESS]);
--		$omb['post_notice_url'] = omb_service_uri($omb[OMB_ENDPOINT_POSTNOTICE]);
--		$omb['update_profile_url'] = omb_service_uri($omb[OMB_ENDPOINT_UPDATEPROFILE]);
-+        $omb['listenee'] = $user->nickname;
-+        $omb['listener'] = omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]);
-+        $omb['token'] = $token;
-+        $omb['secret'] = $secret;
-+        # call doesn't work after bounce back so we cache; maybe serialization issue...?
-+        $omb['access_token_url'] = omb_service_uri($omb[OAUTH_ENDPOINT_ACCESS]);
-+        $omb['post_notice_url'] = omb_service_uri($omb[OMB_ENDPOINT_POSTNOTICE]);
-+        $omb['update_profile_url'] = omb_service_uri($omb[OMB_ENDPOINT_UPDATEPROFILE]);
-hunk ./actions/remotesubscribe.php 373
--		common_ensure_session();
-+        common_ensure_session();
-hunk ./actions/remotesubscribe.php 375
--		$_SESSION['oauth_authorization_request'] = $omb;
-+        $_SESSION['oauth_authorization_request'] = $omb;
-hunk ./actions/remotesubscribe.php 377
--		# Redirect to authorization service
-+        # Redirect to authorization service
-hunk ./actions/remotesubscribe.php 379
--		common_redirect($req->to_url());
--		return;
--	}
-+        common_redirect($req->to_url());
-+        return;
-+    }
-hunk ./actions/remotesubscribe.php 383
--	function make_nonce() {
--		return common_good_rand(16);
--	}
-+    function make_nonce() {
-+        return common_good_rand(16);
-+    }
-hunk ./actions/replies.php 26
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/replies.php 28
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/replies.php 30
--		$nickname = common_canonical_nickname($this->arg('nickname'));
--		$user = User::staticGet('nickname', $nickname);
-+        $nickname = common_canonical_nickname($this->arg('nickname'));
-+        $user = User::staticGet('nickname', $nickname);
-hunk ./actions/replies.php 33
--		if (!$user) {
--			$this->no_such_user();
--			return;
--		}
-+        if (!$user) {
-+            $this->no_such_user();
-+            return;
-+        }
-hunk ./actions/replies.php 38
--		$profile = $user->getProfile();
-+        $profile = $user->getProfile();
-hunk ./actions/replies.php 40
--		if (!$profile) {
--			common_server_error(_('User has no profile.'));
--			return;
--		}
-+        if (!$profile) {
-+            common_server_error(_('User has no profile.'));
-+            return;
-+        }
-hunk ./actions/replies.php 45
--		# Looks like we're good; show the header
-+        # Looks like we're good; show the header
-hunk ./actions/replies.php 47
--		common_show_header(sprintf(_("Replies to %s"), $profile->nickname),
--						   array($this, 'show_header'), $user,
--						   array($this, 'show_top'));
-+        common_show_header(sprintf(_("Replies to %s"), $profile->nickname),
-+                           array($this, 'show_header'), $user,
-+                           array($this, 'show_top'));
-hunk ./actions/replies.php 51
--		$this->show_replies($user);
-+        $this->show_replies($user);
-hunk ./actions/replies.php 53
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/replies.php 56
--	function no_such_user() {
--		common_user_error(_('No such user.'));
--	}
-+    function no_such_user() {
-+        common_user_error(_('No such user.'));
-+    }
-hunk ./actions/replies.php 60
--	function show_header($user) {
--		common_element('link', array('rel' => 'alternate',
--									 'href' => common_local_url('repliesrss', array('nickname' =>
--																					$user->nickname)),
--									 'type' => 'application/rss+xml',
--									 'title' => sprintf(_('Feed for replies to %s'), $user->nickname)));
--	}
-+    function show_header($user) {
-+        common_element('link', array('rel' => 'alternate',
-+                                     'href' => common_local_url('repliesrss', array('nickname' =>
-+                                                                                    $user->nickname)),
-+                                     'type' => 'application/rss+xml',
-+                                     'title' => sprintf(_('Feed for replies to %s'), $user->nickname)));
-+    }
-hunk ./actions/replies.php 68
--	function show_top($user) {
--		$cur = common_current_user();
-+    function show_top($user) {
-+        $cur = common_current_user();
-hunk ./actions/replies.php 71
--		if ($cur && $cur->id == $user->id) {
--			common_notice_form('replies');
--		}
-+        if ($cur && $cur->id == $user->id) {
-+            common_notice_form('replies');
-+        }
-hunk ./actions/replies.php 75
--		$this->views_menu();
-+        $this->views_menu();
-hunk ./actions/replies.php 77
--		$this->show_feeds_list(array(0=>array('href'=>common_local_url('repliesrss', array('nickname' => $user->nickname)),
--											  'type' => 'rss',
--											  'version' => 'RSS 1.0',
--											  'item' => 'repliesrss')));
--	}
-+        $this->show_feeds_list(array(0=>array('href'=>common_local_url('repliesrss', array('nickname' => $user->nickname)),
-+                                              'type' => 'rss',
-+                                              'version' => 'RSS 1.0',
-+                                              'item' => 'repliesrss')));
-+    }
-hunk ./actions/replies.php 83
--	function show_replies($user) {
-+    function show_replies($user) {
-hunk ./actions/replies.php 85
--		$page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-+        $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-hunk ./actions/replies.php 87
--		$notice = $user->getReplies(($page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
-+        $notice = $user->getReplies(($page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
-hunk ./actions/replies.php 89
--		$cnt = $this->show_notice_list($notice);
-+        $cnt = $this->show_notice_list($notice);
-hunk ./actions/replies.php 91
--		common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
--						  $page, 'replies', array('nickname' => $user->nickname));
--	}
-+        common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
-+                          $page, 'replies', array('nickname' => $user->nickname));
-+    }
+-        $req->sign_request(omb_hmac_sha1(), $con, NULL);
++        $req->sign_request(omb_hmac_sha1(), $con, null);
+hunk ./actions/remotesubscribe.php 294
+-            return NULL;
++            return null;
 hunk ./actions/repliesrss.php 28
--	var $user = NULL;
-+    var $user = NULL;
-hunk ./actions/repliesrss.php 30
--	function init() {
--		$nickname = $this->trimmed('nickname');
--		$this->user = User::staticGet('nickname', $nickname);
-+    function init() {
-+        $nickname = $this->trimmed('nickname');
-+        $this->user = User::staticGet('nickname', $nickname);
-hunk ./actions/repliesrss.php 34
--		if (!$this->user) {
--			common_user_error(_('No such user.'));
--			return false;
--		} else {
--			return true;
--		}
--	}
-+        if (!$this->user) {
-+            common_user_error(_('No such user.'));
-+            return false;
-+        } else {
-+            return true;
-+        }
-+    }
-hunk ./actions/repliesrss.php 42
--	function get_notices($limit=0) {
-+    function get_notices($limit=0) {
-hunk ./actions/repliesrss.php 44
--		$user = $this->user;
-+        $user = $this->user;
-hunk ./actions/repliesrss.php 46
--		$notice = $user->getReplies(0, ($limit == 0) ? 48 : $limit);
-+        $notice = $user->getReplies(0, ($limit == 0) ? 48 : $limit);
-hunk ./actions/repliesrss.php 48
--		$notices = array();
--		
--		while ($notice->fetch()) {
--			$notices[] = clone($notice);
--		}
-+        $notices = array();
-+        
-+        while ($notice->fetch()) {
-+            $notices[] = clone($notice);
-+        }
-hunk ./actions/repliesrss.php 54
--		return $notices;
--	}
-+        return $notices;
-+    }
-hunk ./actions/repliesrss.php 57
--	function get_channel() {
--		$user = $this->user;
--		$c = array('url' => common_local_url('repliesrss',
--											 array('nickname' =>
--												   $user->nickname)),
--				   'title' => sprintf(_("Replies to %s"), $user->nickname),
--				   'link' => common_local_url('replies',
--											  array('nickname' =>
--													$user->nickname)),
--				   'description' => sprintf(_('Feed for replies to %s'), $user->nickname));
--		return $c;
--	}
-+    function get_channel() {
-+        $user = $this->user;
-+        $c = array('url' => common_local_url('repliesrss',
-+                                             array('nickname' =>
-+                                                   $user->nickname)),
-+                   'title' => sprintf(_("Replies to %s"), $user->nickname),
-+                   'link' => common_local_url('replies',
-+                                              array('nickname' =>
-+                                                    $user->nickname)),
-+                   'description' => sprintf(_('Feed for replies to %s'), $user->nickname));
-+        return $c;
-+    }
-hunk ./actions/repliesrss.php 70
--	function get_image() {
--		$user = $this->user;
--		$profile = $user->getProfile();
--		if (!$profile) {
--			return NULL;
--		}
--		$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
--		return ($avatar) ? $avatar->url : NULL;
--	}
-+    function get_image() {
-+        $user = $this->user;
-+        $profile = $user->getProfile();
-+        if (!$profile) {
-+            return NULL;
-+        }
-+        $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-+        return ($avatar) ? $avatar->url : NULL;
-+    }
-hunk ./actions/requesttoken.php 25
--	
--	function is_readonly() {
--		return false;
--	}
--	
--	function handle($args) {
--		parent::handle($args);
--		try {
--			common_remove_magic_from_request();
--			$req = OAuthRequest::from_request();
--			$server = omb_oauth_server();
--			$token = $server->fetch_request_token($req);
--			print $token;
--		} catch (OAuthException $e) {
--			common_server_error($e->getMessage());
--		}
--	}
-+    
-+    function is_readonly() {
-+        return false;
-+    }
-+    
-+    function handle($args) {
-+        parent::handle($args);
-+        try {
-+            common_remove_magic_from_request();
-+            $req = OAuthRequest::from_request();
-+            $server = omb_oauth_server();
-+            $token = $server->fetch_request_token($req);
-+            print $token;
-+        } catch (OAuthException $e) {
-+            common_server_error($e->getMessage());
-+        }
-+    }
-hunk ./actions/showfavorites.php 26
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/showfavorites.php 28
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/showfavorites.php 30
--		$nickname = common_canonical_nickname($this->arg('nickname'));
--		$user = User::staticGet('nickname', $nickname);
-+        $nickname = common_canonical_nickname($this->arg('nickname'));
-+        $user = User::staticGet('nickname', $nickname);
-hunk ./actions/showfavorites.php 33
--		if (!$user) {
--			$this->client_error(_('No such user.'));
--			return;
--		}
-+        if (!$user) {
-+            $this->client_error(_('No such user.'));
-+            return;
-+        }
-hunk ./actions/showfavorites.php 38
--		$profile = $user->getProfile();
-+        $profile = $user->getProfile();
-hunk ./actions/showfavorites.php 40
--		if (!$profile) {
--			common_server_error(_('User has no profile.'));
--			return;
--		}
-+        if (!$profile) {
-+            common_server_error(_('User has no profile.'));
-+            return;
-+        }
-hunk ./actions/showfavorites.php 45
--		# Looks like we're good; show the header
-+        # Looks like we're good; show the header
-hunk ./actions/showfavorites.php 47
--		common_show_header(sprintf(_("%s favorite notices"), $profile->nickname),
--						   array($this, 'show_header'), $user,
--						   array($this, 'show_top'));
-+        common_show_header(sprintf(_("%s favorite notices"), $profile->nickname),
-+                           array($this, 'show_header'), $user,
-+                           array($this, 'show_top'));
-hunk ./actions/showfavorites.php 51
--		$this->show_notices($user);
-+        $this->show_notices($user);
-hunk ./actions/showfavorites.php 53
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/showfavorites.php 56
--	function show_header($user) {
--		common_element('link', array('rel' => 'alternate',
--									 'href' => common_local_url('favoritesrss', array('nickname' =>
--																					  $user->nickname)),
--									 'type' => 'application/rss+xml',
--									 'title' => sprintf(_('Feed for favorites of %s'), $user->nickname)));
--	}
-+    function show_header($user) {
-+        common_element('link', array('rel' => 'alternate',
-+                                     'href' => common_local_url('favoritesrss', array('nickname' =>
-+                                                                                      $user->nickname)),
-+                                     'type' => 'application/rss+xml',
-+                                     'title' => sprintf(_('Feed for favorites of %s'), $user->nickname)));
-+    }
-hunk ./actions/showfavorites.php 64
--	function show_top($user) {
--		$cur = common_current_user();
-+    function show_top($user) {
-+        $cur = common_current_user();
-hunk ./actions/showfavorites.php 67
--		if ($cur && $cur->id == $user->id) {
--			common_notice_form('all');
--		}
-+        if ($cur && $cur->id == $user->id) {
-+            common_notice_form('all');
-+        }
-hunk ./actions/showfavorites.php 71
--		$this->show_feeds_list(array(0=>array('href'=>common_local_url('favoritesrss', array('nickname' => $user->nickname)),
--											  'type' => 'rss',
--											  'version' => 'RSS 1.0',
--											  'item' => 'Favorites')));
--		$this->views_menu();
--	}
-+        $this->show_feeds_list(array(0=>array('href'=>common_local_url('favoritesrss', array('nickname' => $user->nickname)),
-+                                              'type' => 'rss',
-+                                              'version' => 'RSS 1.0',
-+                                              'item' => 'Favorites')));
-+        $this->views_menu();
-+    }
-hunk ./actions/showfavorites.php 78
--	function show_notices($user) {
-+    function show_notices($user) {
-hunk ./actions/showfavorites.php 80
--		$page = $this->trimmed('page');
--		if (!$page) {
--			$page = 1;
--		}
-+        $page = $this->trimmed('page');
-+        if (!$page) {
-+            $page = 1;
-+        }
-hunk ./actions/showfavorites.php 85
--		$notice = $user->favoriteNotices(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
-+        $notice = $user->favoriteNotices(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
-hunk ./actions/showfavorites.php 87
--		if (!$notice) {
--			$this->server_error(_('Could not retrieve favorite notices.'));
--			return;
--		}
-+        if (!$notice) {
-+            $this->server_error(_('Could not retrieve favorite notices.'));
-+            return;
-+        }
-hunk ./actions/showfavorites.php 94
--		common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
--						  $page, 'showfavorites', array('nickname' => $user->nickname));
--	}
-+        common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
-+                          $page, 'showfavorites', array('nickname' => $user->nickname));
-+    }
-hunk ./actions/showmessage.php 26
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/showmessage.php 28
--		Action::handle($args);
-+        Action::handle($args);
-hunk ./actions/showmessage.php 30
--		$message = $this->get_message();
-+        $message = $this->get_message();
-hunk ./actions/showmessage.php 32
--		if (!$message) {
--			$this->client_error(_('No such message.'), 404);
--			return;
--		}
--		
--		$cur = common_current_user();
--		
--		if ($cur && ($cur->id == $message->from_profile || $cur->id == $message->to_profile)) {
--			$this->show_page($cur, 1);
--		} else {
--			$this->client_error(_('Only the sender and recipient may read this message.'), 403);
--			return;
--		}
--	}
--	
--	function get_message() {
--		$id = $this->trimmed('message');
--		$message = Message::staticGet('id', $id);
--		return $message;
--	}
--	
--	function get_title($user, $page) {
--		$message = $this->get_message();
--		if (!$message) {
--			return NULL;
--		}
--		
--		if ($user->id == $message->from_profile) {
--			$to = $message->getTo();
--			$title = sprintf(_("Message to %1\$s on %2\$s"),
--							 $to->nickname,
--							 common_exact_date($message->created));
--		} else if ($user->id == $message->to_profile) {
--			$from = $message->getFrom();
--			$title = sprintf(_("Message from %1\$s on %2\$s"),
--							 $from->nickname,
--							 common_exact_date($message->created));
--		}
--		return $title;
--	}
-+        if (!$message) {
-+            $this->client_error(_('No such message.'), 404);
-+            return;
-+        }
-+        
-+        $cur = common_current_user();
-+        
-+        if ($cur && ($cur->id == $message->from_profile || $cur->id == $message->to_profile)) {
-+            $this->show_page($cur, 1);
-+        } else {
-+            $this->client_error(_('Only the sender and recipient may read this message.'), 403);
-+            return;
-+        }
-+    }
-+    
-+    function get_message() {
-+        $id = $this->trimmed('message');
-+        $message = Message::staticGet('id', $id);
-+        return $message;
-+    }
-+    
-+    function get_title($user, $page) {
-+        $message = $this->get_message();
-+        if (!$message) {
-+            return NULL;
-+        }
-+        
-+        if ($user->id == $message->from_profile) {
-+            $to = $message->getTo();
-+            $title = sprintf(_("Message to %1\$s on %2\$s"),
-+                             $to->nickname,
-+                             common_exact_date($message->created));
-+        } else if ($user->id == $message->to_profile) {
-+            $from = $message->getFrom();
-+            $title = sprintf(_("Message from %1\$s on %2\$s"),
-+                             $from->nickname,
-+                             common_exact_date($message->created));
-+        }
-+        return $title;
-+    }
-hunk ./actions/showmessage.php 73
--	function get_messages($user, $page) {
--		$message = new Message();
--		$message->id = $this->trimmed('message');
--		$message->find();
--		return $message;
--	}
--	
--	function get_message_profile($message) {
--		$user = common_current_user();
--		if ($user->id == $message->from_profile) {
--			return $message->getTo();
--		} else if ($user->id == $message->to_profile) {
--			return $message->getFrom();
--		} else {
--			# This shouldn't happen
--			return NULL;
--		}
--	}
--	
--	function get_instructions() {
--		return '';
--	}
--	
--	function views_menu() {
--		return;
--	}
-+    function get_messages($user, $page) {
-+        $message = new Message();
-+        $message->id = $this->trimmed('message');
-+        $message->find();
-+        return $message;
-+    }
-+    
-+    function get_message_profile($message) {
-+        $user = common_current_user();
-+        if ($user->id == $message->from_profile) {
-+            return $message->getTo();
-+        } else if ($user->id == $message->to_profile) {
-+            return $message->getFrom();
-+        } else {
-+            # This shouldn't happen
-+            return NULL;
-+        }
-+    }
-+    
-+    function get_instructions() {
-+        return '';
-+    }
-+    
-+    function views_menu() {
-+        return;
-+    }
-hunk ./actions/showmessage.php 100
--	
-+    
+-    var $user = NULL;
++    var $user = null;
+hunk ./actions/repliesrss.php 74
+-            return NULL;
++            return null;
+hunk ./actions/repliesrss.php 77
+-        return ($avatar) ? $avatar->url : NULL;
++        return ($avatar) ? $avatar->url : null;
+hunk ./actions/showmessage.php 56
+-            return NULL;
++            return null;
+hunk ./actions/showmessage.php 88
+-            return NULL;
++            return null;
 hunk ./actions/shownotice.php 26
--	var $notice = NULL;
--	var $profile = NULL;
--	var $avatar = NULL;
-+    var $notice = NULL;
-+    var $profile = NULL;
-+    var $avatar = NULL;
-hunk ./actions/shownotice.php 30
--	function prepare($args) {
-+    function prepare($args) {
-hunk ./actions/shownotice.php 32
--		parent::prepare($args);
-+        parent::prepare($args);
-hunk ./actions/shownotice.php 34
--		$id = $this->arg('notice');
--		$this->notice = Notice::staticGet($id);
-+        $id = $this->arg('notice');
-+        $this->notice = Notice::staticGet($id);
-hunk ./actions/shownotice.php 37
--		if (!$this->notice) {
--			$this->client_error(_('No such notice.'), 404);
--			return false;
--		}
-+        if (!$this->notice) {
-+            $this->client_error(_('No such notice.'), 404);
-+            return false;
-+        }
-hunk ./actions/shownotice.php 42
--		$this->profile = $this->notice->getProfile();
-+        $this->profile = $this->notice->getProfile();
-hunk ./actions/shownotice.php 44
--		if (!$this->profile) {
--			$this->server_error(_('Notice has no profile'), 500);
--			return false;
--		}
-+        if (!$this->profile) {
-+            $this->server_error(_('Notice has no profile'), 500);
-+            return false;
-+        }
-hunk ./actions/shownotice.php 49
--		$this->avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
-+        $this->avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
-hunk ./actions/shownotice.php 51
--		return true;
--	}
-+        return true;
-+    }
-hunk ./actions/shownotice.php 54
--	function last_modified() {
--		return max(strtotime($this->notice->created),
--				   strtotime($this->profile->modified),
--				   ($this->avatar) ? strtotime($this->avatar->modified) : 0);
--	}
-+    function last_modified() {
-+        return max(strtotime($this->notice->created),
-+                   strtotime($this->profile->modified),
-+                   ($this->avatar) ? strtotime($this->avatar->modified) : 0);
-+    }
-hunk ./actions/shownotice.php 60
--	function etag() {
--		return 'W/"' . implode(':', array($this->arg('action'),
--										  common_language(),
--										  $this->notice->id,
--										  strtotime($this->notice->created),
--										  strtotime($this->profile->modified),
--										  ($this->avatar) ? strtotime($this->avatar->modified) : 0)) . '"';
--	}
-+    function etag() {
-+        return 'W/"' . implode(':', array($this->arg('action'),
-+                                          common_language(),
-+                                          $this->notice->id,
-+                                          strtotime($this->notice->created),
-+                                          strtotime($this->profile->modified),
-+                                          ($this->avatar) ? strtotime($this->avatar->modified) : 0)) . '"';
-+    }
-hunk ./actions/shownotice.php 69
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/shownotice.php 71
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/shownotice.php 73
--		common_show_header(sprintf(_('%1$s\'s status on %2$s'),
--								   $this->profile->nickname,
--								   common_exact_date($this->notice->created)),
--						   array($this, 'show_header'), NULL,
--						   array($this, 'show_top'));
-+        common_show_header(sprintf(_('%1$s\'s status on %2$s'),
-+                                   $this->profile->nickname,
-+                                   common_exact_date($this->notice->created)),
-+                           array($this, 'show_header'), NULL,
-+                           array($this, 'show_top'));
-hunk ./actions/shownotice.php 79
--		common_element_start('ul', array('id' => 'notices'));
-+        common_element_start('ul', array('id' => 'notices'));
-hunk ./actions/shownotice.php 82
--		common_element_end('ul');
-+        common_element_end('ul');
-hunk ./actions/shownotice.php 84
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/shownotice.php 87
--	function show_header() {
-+    function show_header() {
-hunk ./actions/shownotice.php 89
--		$user = User::staticGet($this->profile->id);
-+        $user = User::staticGet($this->profile->id);
-hunk ./actions/shownotice.php 91
--		if (!$user) {
--			return;
--		}
-+        if (!$user) {
-+            return;
-+        }
-hunk ./actions/shownotice.php 95
--		if ($user->emailmicroid && $user->email && $this->notice->uri) {
--			common_element('meta', array('name' => 'microid',
--										 'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($this->notice->uri))));
--		}
-+        if ($user->emailmicroid && $user->email && $this->notice->uri) {
-+            common_element('meta', array('name' => 'microid',
-+                                         'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($this->notice->uri))));
-+        }
-hunk ./actions/shownotice.php 100
--		if ($user->jabbermicroid && $user->jabber && $this->notice->uri) {
--			common_element('meta', array('name' => 'microid',
--										 'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($this->notice->uri))));
--		}
--	}
-+        if ($user->jabbermicroid && $user->jabber && $this->notice->uri) {
-+            common_element('meta', array('name' => 'microid',
-+                                         'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($this->notice->uri))));
-+        }
-+    }
-hunk ./actions/shownotice.php 106
--	function show_top() {
--		$cur = common_current_user();
--		if ($cur && $cur->id == $this->profile->id) {
--			common_notice_form();
--		}
--	}
-+    function show_top() {
-+        $cur = common_current_user();
-+        if ($cur && $cur->id == $this->profile->id) {
-+            common_notice_form();
-+        }
-+    }
-hunk ./actions/shownotice.php 113
--	function no_such_notice() {
--		common_user_error(_('No such notice.'));
--	}
-+    function no_such_notice() {
-+        common_user_error(_('No such notice.'));
-+    }
-hunk ./actions/showstream.php 29
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/showstream.php 31
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/showstream.php 34
--		$nickname = common_canonical_nickname($nickname_arg);
-+        $nickname = common_canonical_nickname($nickname_arg);
-hunk ./actions/showstream.php 47
--		$user = User::staticGet('nickname', $nickname);
-+        $user = User::staticGet('nickname', $nickname);
-hunk ./actions/showstream.php 49
--		if (!$user) {
--			$this->no_such_user();
--			return;
--		}
-+        if (!$user) {
-+            $this->no_such_user();
-+            return;
-+        }
-hunk ./actions/showstream.php 54
--		$profile = $user->getProfile();
-+        $profile = $user->getProfile();
-hunk ./actions/showstream.php 56
--		if (!$profile) {
--			common_server_error(_('User has no profile.'));
--			return;
--		}
-+        if (!$profile) {
-+            common_server_error(_('User has no profile.'));
-+            return;
-+        }
-hunk ./actions/showstream.php 61
--		# Looks like we're good; start output
-+        # Looks like we're good; start output
-hunk ./actions/showstream.php 63
--		# For YADIS discovery, we also have a <meta> tag
-+        # For YADIS discovery, we also have a <meta> tag
-hunk ./actions/showstream.php 65
--		header('X-XRDS-Location: '. common_local_url('xrds', array('nickname' =>
--																   $user->nickname)));
-+        header('X-XRDS-Location: '. common_local_url('xrds', array('nickname' =>
-+                                                                   $user->nickname)));
-hunk ./actions/showstream.php 68
--		common_show_header($profile->nickname,
--						   array($this, 'show_header'), $user,
--						   array($this, 'show_top'));
-+        common_show_header($profile->nickname,
-+                           array($this, 'show_header'), $user,
-+                           array($this, 'show_top'));
-hunk ./actions/showstream.php 72
--		$this->show_profile($profile);
-+        $this->show_profile($profile);
-hunk ./actions/showstream.php 74
--		$this->show_notices($user);
-+        $this->show_notices($user);
-hunk ./actions/showstream.php 76
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/showstream.php 79
--	function show_top($user) {
--		$cur = common_current_user();
-+    function show_top($user) {
-+        $cur = common_current_user();
-hunk ./actions/showstream.php 82
--		if ($cur && $cur->id == $user->id) {
--			common_notice_form('showstream');
--		}
-+        if ($cur && $cur->id == $user->id) {
-+            common_notice_form('showstream');
-+        }
-hunk ./actions/showstream.php 86
--		$this->views_menu();
-+        $this->views_menu();
-hunk ./actions/showstream.php 88
--		$this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('nickname' => $user->nickname)),
--											  'type' => 'rss',
--											  'version' => 'RSS 1.0',
--											  'item' => 'notices'),
--									 1=>array('href'=>common_local_url('usertimeline', array('nickname' => $user->nickname)),
--											  'type' => 'atom',
--											  'version' => 'Atom 1.0',
--											  'item' => 'usertimeline'),
-+        $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('nickname' => $user->nickname)),
-+                                              'type' => 'rss',
-+                                              'version' => 'RSS 1.0',
-+                                              'item' => 'notices'),
-+                                     1=>array('href'=>common_local_url('usertimeline', array('nickname' => $user->nickname)),
-+                                              'type' => 'atom',
-+                                              'version' => 'Atom 1.0',
-+                                              'item' => 'usertimeline'),
-hunk ./actions/showstream.php 97
--									 2=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
--											  'type' => 'rdf',
--											  'version' => 'FOAF',
--											  'item' => 'foaf')));
--	}
-+                                     2=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
-+                                              'type' => 'rdf',
-+                                              'version' => 'FOAF',
-+                                              'item' => 'foaf')));
-+    }
-hunk ./actions/showstream.php 103
--	function show_header($user) {
--		# Feeds
--		common_element('link', array('rel' => 'alternate',
--									 'href' => common_local_url('api',
--																array('apiaction' => 'statuses',
--																	  'method' => 'user_timeline.rss',
--																	  'argument' => $user->nickname)),
--									 'type' => 'application/rss+xml',
--									 'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
--		common_element('link', array('rel' => 'alternate feed',
--									 'href' => common_local_url('api',
--																array('apiaction' => 'statuses',
--																	  'method' => 'user_timeline.atom',
--																	  'argument' => $user->nickname)),
--									 'type' => 'application/atom+xml',
--									 'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
--		common_element('link', array('rel' => 'alternate',
--									 'href' => common_local_url('userrss', array('nickname' =>
--																			   $user->nickname)),
--									 'type' => 'application/rdf+xml',
--									 'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
--		# FOAF
--		common_element('link', array('rel' => 'meta',
--									 'href' => common_local_url('foaf', array('nickname' =>
--																			  $user->nickname)),
--									 'type' => 'application/rdf+xml',
--									 'title' => 'FOAF'));
--		# for remote subscriptions etc.
--		common_element('meta', array('http-equiv' => 'X-XRDS-Location',
--									 'content' => common_local_url('xrds', array('nickname' =>
--																			   $user->nickname))));
--		$profile = $user->getProfile();
--		if ($profile->bio) {
--			common_element('meta', array('name' => 'description',
--										 'content' => $profile->bio));
--		}
-+    function show_header($user) {
-+        # Feeds
-+        common_element('link', array('rel' => 'alternate',
-+                                     'href' => common_local_url('api',
-+                                                                array('apiaction' => 'statuses',
-+                                                                      'method' => 'user_timeline.rss',
-+                                                                      'argument' => $user->nickname)),
-+                                     'type' => 'application/rss+xml',
-+                                     'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
-+        common_element('link', array('rel' => 'alternate feed',
-+                                     'href' => common_local_url('api',
-+                                                                array('apiaction' => 'statuses',
-+                                                                      'method' => 'user_timeline.atom',
-+                                                                      'argument' => $user->nickname)),
-+                                     'type' => 'application/atom+xml',
-+                                     'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
-+        common_element('link', array('rel' => 'alternate',
-+                                     'href' => common_local_url('userrss', array('nickname' =>
-+                                                                               $user->nickname)),
-+                                     'type' => 'application/rdf+xml',
-+                                     'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
-+        # FOAF
-+        common_element('link', array('rel' => 'meta',
-+                                     'href' => common_local_url('foaf', array('nickname' =>
-+                                                                              $user->nickname)),
-+                                     'type' => 'application/rdf+xml',
-+                                     'title' => 'FOAF'));
-+        # for remote subscriptions etc.
-+        common_element('meta', array('http-equiv' => 'X-XRDS-Location',
-+                                     'content' => common_local_url('xrds', array('nickname' =>
-+                                                                               $user->nickname))));
-+        $profile = $user->getProfile();
-+        if ($profile->bio) {
-+            common_element('meta', array('name' => 'description',
-+                                         'content' => $profile->bio));
-+        }
-hunk ./actions/showstream.php 140
--		if ($user->emailmicroid && $user->email && $profile->profileurl) {
--			common_element('meta', array('name' => 'microid',
--										 'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($profile->profileurl))));
--		}
--		if ($user->jabbermicroid && $user->jabber && $profile->profileurl) {
--			common_element('meta', array('name' => 'microid',
--										 'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($profile->profileurl))));
--		}
-+        if ($user->emailmicroid && $user->email && $profile->profileurl) {
-+            common_element('meta', array('name' => 'microid',
-+                                         'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($profile->profileurl))));
-+        }
-+        if ($user->jabbermicroid && $user->jabber && $profile->profileurl) {
-+            common_element('meta', array('name' => 'microid',
-+                                         'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($profile->profileurl))));
-+        }
-hunk ./actions/showstream.php 149
--		# See https://wiki.mozilla.org/Microsummaries
-+        # See https://wiki.mozilla.org/Microsummaries
-hunk ./actions/showstream.php 151
--		common_element('link', array('rel' => 'microsummary',
--									 'href' => common_local_url('microsummary',
--																array('nickname' => $profile->nickname))));
--	}
-+        common_element('link', array('rel' => 'microsummary',
-+                                     'href' => common_local_url('microsummary',
-+                                                                array('nickname' => $profile->nickname))));
-+    }
-hunk ./actions/showstream.php 156
--	function no_such_user() {
--		$this->client_error(_('No such user.'), 404);
--	}
-+    function no_such_user() {
-+        $this->client_error(_('No such user.'), 404);
-+    }
-hunk ./actions/showstream.php 160
--	function show_profile($profile) {
-+    function show_profile($profile) {
-hunk ./actions/showstream.php 162
--		common_element_start('div', array('id' => 'profile', 'class' => 'vcard'));
-+        common_element_start('div', array('id' => 'profile', 'class' => 'vcard'));
-hunk ./actions/showstream.php 164
--		$this->show_personal($profile);
-+        $this->show_personal($profile);
-hunk ./actions/showstream.php 166
--		$this->show_last_notice($profile);
-+        $this->show_last_notice($profile);
-hunk ./actions/showstream.php 168
--		$cur = common_current_user();
-+        $cur = common_current_user();
-hunk ./actions/showstream.php 170
--		$this->show_subscriptions($profile);
-+        $this->show_subscriptions($profile);
-hunk ./actions/showstream.php 172
--		common_element_end('div');
--	}
-+        common_element_end('div');
-+    }
-hunk ./actions/showstream.php 175
--	function show_personal($profile) {
-+    function show_personal($profile) {
-hunk ./actions/showstream.php 177
--		$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
--		common_element_start('div', array('id' => 'profile_avatar'));
--		common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
--									'class' => 'avatar profile photo',
--									'width' => AVATAR_PROFILE_SIZE,
--									'height' => AVATAR_PROFILE_SIZE,
--									'alt' => $profile->nickname));
-+        $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-+        common_element_start('div', array('id' => 'profile_avatar'));
-+        common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
-+                                    'class' => 'avatar profile photo',
-+                                    'width' => AVATAR_PROFILE_SIZE,
-+                                    'height' => AVATAR_PROFILE_SIZE,
-+                                    'alt' => $profile->nickname));
-hunk ./actions/showstream.php 188
--		$cur = common_current_user();
--		if ($cur) {
--			if ($cur->id != $profile->id) {
--				if ($cur->isSubscribed($profile)) {
--					common_unsubscribe_form($profile);
--				} else {
--					common_subscribe_form($profile);
--				}
--			}
--		} else {
--			$this->show_remote_subscribe_link($profile);
--		}
-+        $cur = common_current_user();
-+        if ($cur) {
-+            if ($cur->id != $profile->id) {
-+                if ($cur->isSubscribed($profile)) {
-+                    common_unsubscribe_form($profile);
-+                } else {
-+                    common_subscribe_form($profile);
-+                }
-+            }
-+        } else {
-+            $this->show_remote_subscribe_link($profile);
-+        }
-hunk ./actions/showstream.php 202
--		$user = User::staticGet('id', $profile->id);
--		common_profile_new_message_nudge($cur, $user, $profile);
-+        $user = User::staticGet('id', $profile->id);
-+        common_profile_new_message_nudge($cur, $user, $profile);
-hunk ./actions/showstream.php 218
--		common_element_end('ul');
-+        common_element_end('ul');
-hunk ./actions/showstream.php 220
--		common_element_end('div');
-+        common_element_end('div');
-hunk ./actions/showstream.php 222
--		common_element_start('div', array('id' => 'profile_information'));
-+        common_element_start('div', array('id' => 'profile_information'));
-hunk ./actions/showstream.php 224
--		if ($profile->fullname) {
--			common_element('h1', array('class' => 'fn'), $profile->fullname . ' (' . $profile->nickname . ')');
--		} else {
--			common_element('h1', array('class' => 'fn nickname'), $profile->nickname);
--		}
-+        if ($profile->fullname) {
-+            common_element('h1', array('class' => 'fn'), $profile->fullname . ' (' . $profile->nickname . ')');
-+        } else {
-+            common_element('h1', array('class' => 'fn nickname'), $profile->nickname);
-+        }
-hunk ./actions/showstream.php 230
--		if ($profile->location) {
--			common_element('p', 'location', $profile->location);
--		}
--		if ($profile->bio) {
--			common_element('p', 'description note', $profile->bio);
--		}
--		if ($profile->homepage) {
--			common_element_start('p', 'website');
--			common_element('a', array('href' => $profile->homepage,
--									  'rel' => 'me', 'class' => 'url'),
--						   $profile->homepage);
--			common_element_end('p');
--		}
-+        if ($profile->location) {
-+            common_element('p', 'location', $profile->location);
-+        }
-+        if ($profile->bio) {
-+            common_element('p', 'description note', $profile->bio);
-+        }
-+        if ($profile->homepage) {
-+            common_element_start('p', 'website');
-+            common_element('a', array('href' => $profile->homepage,
-+                                      'rel' => 'me', 'class' => 'url'),
-+                           $profile->homepage);
-+            common_element_end('p');
-+        }
-hunk ./actions/showstream.php 244
--		$this->show_statistics($profile);
-+        $this->show_statistics($profile);
-hunk ./actions/showstream.php 246
--		common_element_end('div');
--	}
-+        common_element_end('div');
-+    }
-hunk ./actions/showstream.php 249
--	function show_remote_subscribe_link($profile) {
--		$url = common_local_url('remotesubscribe',
--		                        array('nickname' => $profile->nickname));
--		common_element('a', array('href' => $url,
--								  'id' => 'remotesubscribe'),
--					   _('Subscribe'));
--	}
-+    function show_remote_subscribe_link($profile) {
-+        $url = common_local_url('remotesubscribe',
-+                                array('nickname' => $profile->nickname));
-+        common_element('a', array('href' => $url,
-+                                  'id' => 'remotesubscribe'),
-+                       _('Subscribe'));
-+    }
-hunk ./actions/showstream.php 257
--	function show_unsubscribe_form($profile) {
--		common_element_start('form', array('id' => 'unsubscribe', 'method' => 'post',
--										   'action' => common_local_url('unsubscribe')));
--		common_hidden('token', common_session_token());
--		common_element('input', array('id' => 'unsubscribeto',
--									  'name' => 'unsubscribeto',
--									  'type' => 'hidden',
--									  'value' => $profile->nickname));
--		common_element('input', array('type' => 'submit',
--									  'class' => 'submit',
--									  'value' => _('Unsubscribe')));
--		common_element_end('form');
--	}
-+    function show_unsubscribe_form($profile) {
-+        common_element_start('form', array('id' => 'unsubscribe', 'method' => 'post',
-+                                           'action' => common_local_url('unsubscribe')));
-+        common_hidden('token', common_session_token());
-+        common_element('input', array('id' => 'unsubscribeto',
-+                                      'name' => 'unsubscribeto',
-+                                      'type' => 'hidden',
-+                                      'value' => $profile->nickname));
-+        common_element('input', array('type' => 'submit',
-+                                      'class' => 'submit',
-+                                      'value' => _('Unsubscribe')));
-+        common_element_end('form');
-+    }
-hunk ./actions/showstream.php 271
--	function show_subscriptions($profile) {
--		global $config;
-+    function show_subscriptions($profile) {
-+        global $config;
-hunk ./actions/showstream.php 274
--		$subs = DB_DataObject::factory('subscription');
--		$subs->subscriber = $profile->id;
--		$subs->whereAdd('subscribed != ' . $profile->id);
-+        $subs = DB_DataObject::factory('subscription');
-+        $subs->subscriber = $profile->id;
-+        $subs->whereAdd('subscribed != ' . $profile->id);
-hunk ./actions/showstream.php 278
--		$subs->orderBy('created DESC');
-+        $subs->orderBy('created DESC');
-hunk ./actions/showstream.php 280
--		# We ask for an extra one to know if we need to do another page
-+        # We ask for an extra one to know if we need to do another page
-hunk ./actions/showstream.php 282
--		$subs->limit(0, SUBSCRIPTIONS + 1);
-+        $subs->limit(0, SUBSCRIPTIONS + 1);
-hunk ./actions/showstream.php 284
--		$subs_count = $subs->find();
-+        $subs_count = $subs->find();
-hunk ./actions/showstream.php 286
--		common_element_start('div', array('id' => 'subscriptions'));
-+        common_element_start('div', array('id' => 'subscriptions'));
+-    var $notice = NULL;
+-    var $profile = NULL;
+-    var $avatar = NULL;
++    var $notice = null;
++    var $profile = null;
++    var $avatar = null;
+hunk ./actions/shownotice.php 76
+-                           array($this, 'show_header'), NULL,
++                           array($this, 'show_header'), null,
 hunk ./actions/showstream.php 288
--		common_element('h2', NULL, _('Subscriptions'));
-+        common_element('h2', NULL, _('Subscriptions'));
-hunk ./actions/showstream.php 290
--		if ($subs_count > 0) {
-+        if ($subs_count > 0) {
-hunk ./actions/showstream.php 292
--			common_element_start('ul', array('id' => 'subscriptions_avatars'));
-+            common_element_start('ul', array('id' => 'subscriptions_avatars'));
-hunk ./actions/showstream.php 294
--			for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
-+            for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
-hunk ./actions/showstream.php 296
--				if (!$subs->fetch()) {
--					common_debug('Weirdly, broke out of subscriptions loop early', __FILE__);
--					break;
--				}
-+                if (!$subs->fetch()) {
-+                    common_debug('Weirdly, broke out of subscriptions loop early', __FILE__);
-+                    break;
-+                }
-hunk ./actions/showstream.php 301
--				$other = Profile::staticGet($subs->subscribed);
-+                $other = Profile::staticGet($subs->subscribed);
-hunk ./actions/showstream.php 303
--				if (!$other) {
--					common_log_db_error($subs, 'SELECT', __FILE__);
--					continue;
--				}
-+                if (!$other) {
-+                    common_log_db_error($subs, 'SELECT', __FILE__);
-+                    continue;
-+                }
-hunk ./actions/showstream.php 308
--				common_element_start('li', 'vcard');
--				common_element_start('a', array('title' => ($other->fullname) ?
--												$other->fullname :
--												$other->nickname,
--												'href' => $other->profileurl,
--												'rel' => 'contact',
-- 												'class' => 'subscription fn url'));
--				$avatar = $other->getAvatar(AVATAR_MINI_SIZE);
--				common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) :  common_default_avatar(AVATAR_MINI_SIZE)),
--											'width' => AVATAR_MINI_SIZE,
--											'height' => AVATAR_MINI_SIZE,
--											'class' => 'avatar mini photo',
--											'alt' =>  ($other->fullname) ?
--											$other->fullname :
--											$other->nickname));
--				common_element_end('a');
--				common_element_end('li');
--			}
-+                common_element_start('li', 'vcard');
-+                common_element_start('a', array('title' => ($other->fullname) ?
-+                                                $other->fullname :
-+                                                $other->nickname,
-+                                                'href' => $other->profileurl,
-+                                                'rel' => 'contact',
-+                                                 'class' => 'subscription fn url'));
-+                $avatar = $other->getAvatar(AVATAR_MINI_SIZE);
-+                common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) :  common_default_avatar(AVATAR_MINI_SIZE)),
-+                                            'width' => AVATAR_MINI_SIZE,
-+                                            'height' => AVATAR_MINI_SIZE,
-+                                            'class' => 'avatar mini photo',
-+                                            'alt' =>  ($other->fullname) ?
-+                                            $other->fullname :
-+                                            $other->nickname));
-+                common_element_end('a');
-+                common_element_end('li');
-+            }
-hunk ./actions/showstream.php 327
--			common_element_end('ul');
--		}
-+            common_element_end('ul');
-+        }
-hunk ./actions/showstream.php 330
--		if ($subs_count > SUBSCRIPTIONS) {
--			common_element_start('p', array('id' => 'subscriptions_viewall'));
-+        if ($subs_count > SUBSCRIPTIONS) {
-+            common_element_start('p', array('id' => 'subscriptions_viewall'));
-hunk ./actions/showstream.php 333
--			common_element('a', array('href' => common_local_url('subscriptions',
--																 array('nickname' => $profile->nickname)),
--									  'class' => 'moresubscriptions'),
--						   _('All subscriptions'));
--			common_element_end('p');
--		}
-+            common_element('a', array('href' => common_local_url('subscriptions',
-+                                                                 array('nickname' => $profile->nickname)),
-+                                      'class' => 'moresubscriptions'),
-+                           _('All subscriptions'));
-+            common_element_end('p');
-+        }
-hunk ./actions/showstream.php 340
--		common_element_end('div');
--	}
-+        common_element_end('div');
-+    }
-hunk ./actions/showstream.php 343
--	function show_statistics($profile) {
-+    function show_statistics($profile) {
-hunk ./actions/showstream.php 345
--		// XXX: WORM cache this
--		$subs = DB_DataObject::factory('subscription');
--		$subs->subscriber = $profile->id;
--		$subs_count = (int) $subs->count() - 1;
-+        // XXX: WORM cache this
-+        $subs = DB_DataObject::factory('subscription');
-+        $subs->subscriber = $profile->id;
-+        $subs_count = (int) $subs->count() - 1;
-hunk ./actions/showstream.php 350
--		$subbed = DB_DataObject::factory('subscription');
--		$subbed->subscribed = $profile->id;
--		$subbed_count = (int) $subbed->count() - 1;
-+        $subbed = DB_DataObject::factory('subscription');
-+        $subbed->subscribed = $profile->id;
-+        $subbed_count = (int) $subbed->count() - 1;
-hunk ./actions/showstream.php 354
--		$notices = DB_DataObject::factory('notice');
--		$notices->profile_id = $profile->id;
--		$notice_count = (int) $notices->count();
-+        $notices = DB_DataObject::factory('notice');
-+        $notices->profile_id = $profile->id;
-+        $notice_count = (int) $notices->count();
-hunk ./actions/showstream.php 358
--		common_element_start('div', 'statistics');
--		common_element('h2', 'statistics', _('Statistics'));
-+        common_element_start('div', 'statistics');
-+        common_element('h2', 'statistics', _('Statistics'));
-hunk ./actions/showstream.php 361
--		# Other stats...?
--		common_element_start('dl', 'statistics');
--		common_element('dt', 'membersince', _('Member since'));
--		common_element('dd', 'membersince', date('j M Y',
--												 strtotime($profile->created)));
-+        # Other stats...?
-+        common_element_start('dl', 'statistics');
-+        common_element('dt', 'membersince', _('Member since'));
-+        common_element('dd', 'membersince', date('j M Y',
-+                                                 strtotime($profile->created)));
-hunk ./actions/showstream.php 367
--		common_element_start('dt', 'subscriptions');
--		common_element('a', array('href' => common_local_url('subscriptions',
--															 array('nickname' => $profile->nickname))),
--					   _('Subscriptions'));
--		common_element_end('dt');
--		common_element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0');
--		common_element_start('dt', 'subscribers');
--		common_element('a', array('href' => common_local_url('subscribers',
--															 array('nickname' => $profile->nickname))),
--					   _('Subscribers'));
--		common_element_end('dt');
--		common_element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
--		common_element('dt', 'notices', _('Notices'));
--		common_element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0');
--		# XXX: link these to something
--		common_element('dt', 'tags', _('Tags'));
--		common_element_start('dd', 'tags');
--		$tags = Profile_tag::getTags($profile->id, $profile->id);
-+        common_element_start('dt', 'subscriptions');
-+        common_element('a', array('href' => common_local_url('subscriptions',
-+                                                             array('nickname' => $profile->nickname))),
-+                       _('Subscriptions'));
-+        common_element_end('dt');
-+        common_element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0');
-+        common_element_start('dt', 'subscribers');
-+        common_element('a', array('href' => common_local_url('subscribers',
-+                                                             array('nickname' => $profile->nickname))),
-+                       _('Subscribers'));
-+        common_element_end('dt');
-+        common_element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
-+        common_element('dt', 'notices', _('Notices'));
-+        common_element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0');
-+        # XXX: link these to something
-+        common_element('dt', 'tags', _('Tags'));
-+        common_element_start('dd', 'tags');
-+        $tags = Profile_tag::getTags($profile->id, $profile->id);
-hunk ./actions/showstream.php 386
--		common_element_start('ul', 'tags xoxo');
--		foreach ($tags as $tag) {
--			common_element_start('li');
--			common_element('a', array('rel' => 'bookmark tag',
--									  'href' => common_local_url('peopletag',
--																 array('tag' => $tag))),
--						   $tag);
--			common_element_end('li');
--		}
--		common_element_end('ul');
--	    common_element_end('dd');
-+        common_element_start('ul', 'tags xoxo');
-+        foreach ($tags as $tag) {
-+            common_element_start('li');
-+            common_element('a', array('rel' => 'bookmark tag',
-+                                      'href' => common_local_url('peopletag',
-+                                                                 array('tag' => $tag))),
-+                           $tag);
-+            common_element_end('li');
-+        }
-+        common_element_end('ul');
-+        common_element_end('dd');
-hunk ./actions/showstream.php 398
--		common_element_end('dl');
-+        common_element_end('dl');
-hunk ./actions/showstream.php 400
--		common_element_end('div');
--	}
-+        common_element_end('div');
-+    }
-hunk ./actions/showstream.php 403
--	function show_notices($user) {
-+    function show_notices($user) {
-hunk ./actions/showstream.php 405
--		$page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-+        $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-hunk ./actions/showstream.php 407
--		$notice = $user->getNotices(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
-+        $notice = $user->getNotices(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
-hunk ./actions/showstream.php 412
--		common_pagination($page>1, $cnt>NOTICES_PER_PAGE, $page,
--						  'showstream', array('nickname' => $user->nickname));
--	}
-+        common_pagination($page>1, $cnt>NOTICES_PER_PAGE, $page,
-+                          'showstream', array('nickname' => $user->nickname));
-+    }
-hunk ./actions/showstream.php 416
--	function show_last_notice($profile) {
-+    function show_last_notice($profile) {
+-        common_element('h2', NULL, _('Subscriptions'));
++        common_element('h2', null, _('Subscriptions'));
 hunk ./actions/showstream.php 418
--		common_element('h2', NULL, _('Currently'));
-+        common_element('h2', NULL, _('Currently'));
-hunk ./actions/showstream.php 420
--		$notice = $profile->getCurrentNotice();
-+        $notice = $profile->getCurrentNotice();
-hunk ./actions/showstream.php 422
--		if ($notice) {
--			# FIXME: URL, image, video, audio
--			common_element_start('p', array('class' => 'notice_current'));
--			if ($notice->rendered) {
--				common_raw($notice->rendered);
--			} else {
--				# XXX: may be some uncooked notices in the DB,
--				# we cook them right now. This can probably disappear in future
--				# versions (>> 0.4.x)
--				common_raw(common_render_content($notice->content, $notice));
--			}
--			common_element_end('p');
--		}
--	}
-+        if ($notice) {
-+            # FIXME: URL, image, video, audio
-+            common_element_start('p', array('class' => 'notice_current'));
-+            if ($notice->rendered) {
-+                common_raw($notice->rendered);
-+            } else {
-+                # XXX: may be some uncooked notices in the DB,
-+                # we cook them right now. This can probably disappear in future
-+                # versions (>> 0.4.x)
-+                common_raw(common_render_content($notice->content, $notice));
-+            }
-+            common_element_end('p');
-+        }
-+    }
-hunk ./actions/smssettings.php 27
--	function get_instructions() {
--		return _('You can receive SMS messages through email from %%site.name%%.');
--	}
-+    function get_instructions() {
-+        return _('You can receive SMS messages through email from %%site.name%%.');
-+    }
+-        common_element('h2', NULL, _('Currently'));
++        common_element('h2', null, _('Currently'));
 hunk ./actions/smssettings.php 31
--	function show_form($msg=NULL, $success=false) {
--		$user = common_current_user();
--		$this->form_header(_('SMS Settings'), $msg, $success);
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'smssettings',
--										   'action' =>
--										   common_local_url('smssettings')));
--		common_hidden('token', common_session_token());
--		common_element('h2', NULL, _('Address'));
-+    function show_form($msg=NULL, $success=false) {
-+        $user = common_current_user();
-+        $this->form_header(_('SMS Settings'), $msg, $success);
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'smssettings',
-+                                           'action' =>
-+                                           common_local_url('smssettings')));
-+        common_hidden('token', common_session_token());
-+        common_element('h2', NULL, _('Address'));
-hunk ./actions/smssettings.php 41
--		if ($user->sms) {
--			common_element_start('p');
--			$carrier = $user->getCarrier();
--			common_element('span', 'address confirmed', $user->sms . ' (' . $carrier->name . ')');
--			common_element('span', 'input_instructions',
--			               _('Current confirmed SMS-enabled phone number.'));
--			common_hidden('sms', $user->sms);
--			common_hidden('carrier', $user->carrier);
--			common_element_end('p');
--			common_submit('remove', _('Remove'));
--		} else {
--			$confirm = $this->get_confirmation();
--			if ($confirm) {
--				$carrier = Sms_carrier::staticGet($confirm->address_extra);
--				common_element_start('p');
--				common_element('span', 'address unconfirmed', $confirm->address . ' (' . $carrier->name . ')');
--				common_element('span', 'input_instructions',
--							   _('Awaiting confirmation on this phone number.'));
--				common_hidden('sms', $confirm->address);
--				common_hidden('carrier', $confirm->address_extra);
--				common_element_end('p');
--				common_submit('cancel', _('Cancel'));
--				common_input('code', _('Confirmation code'), NULL,
--							 _('Enter the code you received on your phone.'));
--				common_submit('confirm', _('Confirm'));
--			} else {
--				common_input('sms', _('SMS Phone number'),
--							 ($this->arg('sms')) ? $this->arg('sms') : NULL,
--							 _('Phone number, no punctuation or spaces, with area code'));
--				$this->carrier_select();
--				common_submit('add', _('Add'));
--			}
--		}
-+        if ($user->sms) {
-+            common_element_start('p');
-+            $carrier = $user->getCarrier();
-+            common_element('span', 'address confirmed', $user->sms . ' (' . $carrier->name . ')');
-+            common_element('span', 'input_instructions',
-+                           _('Current confirmed SMS-enabled phone number.'));
-+            common_hidden('sms', $user->sms);
-+            common_hidden('carrier', $user->carrier);
-+            common_element_end('p');
-+            common_submit('remove', _('Remove'));
-+        } else {
-+            $confirm = $this->get_confirmation();
-+            if ($confirm) {
-+                $carrier = Sms_carrier::staticGet($confirm->address_extra);
-+                common_element_start('p');
-+                common_element('span', 'address unconfirmed', $confirm->address . ' (' . $carrier->name . ')');
-+                common_element('span', 'input_instructions',
-+                               _('Awaiting confirmation on this phone number.'));
-+                common_hidden('sms', $confirm->address);
-+                common_hidden('carrier', $confirm->address_extra);
-+                common_element_end('p');
-+                common_submit('cancel', _('Cancel'));
-+                common_input('code', _('Confirmation code'), NULL,
-+                             _('Enter the code you received on your phone.'));
-+                common_submit('confirm', _('Confirm'));
-+            } else {
-+                common_input('sms', _('SMS Phone number'),
-+                             ($this->arg('sms')) ? $this->arg('sms') : NULL,
-+                             _('Phone number, no punctuation or spaces, with area code'));
-+                $this->carrier_select();
-+                common_submit('add', _('Add'));
-+            }
-+        }
-hunk ./actions/smssettings.php 75
--		if ($user->sms) {
--			common_element('h2', NULL, _('Incoming email'));
--			
--			if ($user->incomingemail) {
--				common_element_start('p');
--				common_element('span', 'address', $user->incomingemail);
--				common_element('span', 'input_instructions',
--							   _('Send email to this address to post new notices.'));
--				common_element_end('p');
--				common_submit('removeincoming', _('Remove'));
--			}
--			
--			common_element_start('p');
--			common_element('span', 'input_instructions',
--						   _('Make a new email address for posting to; cancels the old one.'));
--			common_element_end('p');
--			common_submit('newincoming', _('New'));
--		}
--		
--		common_element('h2', NULL, _('Preferences'));
--		
--		common_checkbox('smsnotify',
--						_('Send me notices through SMS; I understand I may incur exorbitant charges from my carrier.'),
--						$user->smsnotify);
--			
--		common_submit('save', _('Save'));
--		
--		common_element_end('form');
--		common_show_footer();
--	}
-+        if ($user->sms) {
-+            common_element('h2', NULL, _('Incoming email'));
-+            
-+            if ($user->incomingemail) {
-+                common_element_start('p');
-+                common_element('span', 'address', $user->incomingemail);
-+                common_element('span', 'input_instructions',
-+                               _('Send email to this address to post new notices.'));
-+                common_element_end('p');
-+                common_submit('removeincoming', _('Remove'));
-+            }
-+            
-+            common_element_start('p');
-+            common_element('span', 'input_instructions',
-+                           _('Make a new email address for posting to; cancels the old one.'));
-+            common_element_end('p');
-+            common_submit('newincoming', _('New'));
-+        }
-+        
-+        common_element('h2', NULL, _('Preferences'));
-+        
-+        common_checkbox('smsnotify',
-+                        _('Send me notices through SMS; I understand I may incur exorbitant charges from my carrier.'),
-+                        $user->smsnotify);
-+            
-+        common_submit('save', _('Save'));
-+        
-+        common_element_end('form');
-+        common_show_footer();
-+    }
-hunk ./actions/smssettings.php 106
--	function get_confirmation() {
--		$user = common_current_user();
--		$confirm = new Confirm_address();
--		$confirm->user_id = $user->id;
--		$confirm->address_type = 'sms';
--		if ($confirm->find(TRUE)) {
--			return $confirm;
--		} else {
--			return NULL;
--		}
--	}
-+    function get_confirmation() {
-+        $user = common_current_user();
-+        $confirm = new Confirm_address();
-+        $confirm->user_id = $user->id;
-+        $confirm->address_type = 'sms';
-+        if ($confirm->find(TRUE)) {
-+            return $confirm;
-+        } else {
-+            return NULL;
-+        }
-+    }
-hunk ./actions/smssettings.php 118
--	function handle_post() {
-+    function handle_post() {
-hunk ./actions/smssettings.php 120
--		# CSRF protection
-+        # CSRF protection
-hunk ./actions/smssettings.php 122
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/smssettings.php 128
--		if ($this->arg('save')) {
--			$this->save_preferences();
--		} else if ($this->arg('add')) {
--			$this->add_address();
--		} else if ($this->arg('cancel')) {
--			$this->cancel_confirmation();
--		} else if ($this->arg('remove')) {
--			$this->remove_address();
--		} else if ($this->arg('removeincoming')) {
--			$this->remove_incoming();
--		} else if ($this->arg('newincoming')) {
--			$this->new_incoming();
--		} else if ($this->arg('confirm')) {
--			$this->confirm_code();
--		} else {
--			$this->show_form(_('Unexpected form submission.'));
--		}
--	}
-+        if ($this->arg('save')) {
-+            $this->save_preferences();
-+        } else if ($this->arg('add')) {
-+            $this->add_address();
-+        } else if ($this->arg('cancel')) {
-+            $this->cancel_confirmation();
-+        } else if ($this->arg('remove')) {
-+            $this->remove_address();
-+        } else if ($this->arg('removeincoming')) {
-+            $this->remove_incoming();
-+        } else if ($this->arg('newincoming')) {
-+            $this->new_incoming();
-+        } else if ($this->arg('confirm')) {
-+            $this->confirm_code();
-+        } else {
-+            $this->show_form(_('Unexpected form submission.'));
-+        }
-+    }
-hunk ./actions/smssettings.php 147
--	function save_preferences() {
-+    function save_preferences() {
-hunk ./actions/smssettings.php 149
--		$smsnotify = $this->boolean('smsnotify');
--		
--		$user = common_current_user();
-+        $smsnotify = $this->boolean('smsnotify');
-+        
-+        $user = common_current_user();
-hunk ./actions/smssettings.php 153
--		assert(!is_null($user)); # should already be checked
-+        assert(!is_null($user)); # should already be checked
-hunk ./actions/smssettings.php 155
--		$user->query('BEGIN');
-+        $user->query('BEGIN');
-hunk ./actions/smssettings.php 157
--		$original = clone($user);
-+        $original = clone($user);
-hunk ./actions/smssettings.php 159
--		$user->smsnotify = $smsnotify;
-+        $user->smsnotify = $smsnotify;
-hunk ./actions/smssettings.php 161
--		$result = $user->update($original);
-+        $result = $user->update($original);
-hunk ./actions/smssettings.php 163
--		if ($result === FALSE) {
--			common_log_db_error($user, 'UPDATE', __FILE__);
--			common_server_error(_('Couldn\'t update user.'));
--			return;
--		}
-+        if ($result === FALSE) {
-+            common_log_db_error($user, 'UPDATE', __FILE__);
-+            common_server_error(_('Couldn\'t update user.'));
-+            return;
-+        }
-hunk ./actions/smssettings.php 169
--		$user->query('COMMIT');
-+        $user->query('COMMIT');
-hunk ./actions/smssettings.php 171
--		$this->show_form(_('Preferences saved.'), true);
--	}
-+        $this->show_form(_('Preferences saved.'), true);
-+    }
-hunk ./actions/smssettings.php 174
--	function add_address() {
-+    function add_address() {
-hunk ./actions/smssettings.php 176
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/smssettings.php 178
--		$sms = $this->trimmed('sms');
--		$carrier_id = $this->trimmed('carrier');
--		
--		# Some validation
-+        $sms = $this->trimmed('sms');
-+        $carrier_id = $this->trimmed('carrier');
-+        
-+        # Some validation
-hunk ./actions/smssettings.php 183
--		if (!$sms) {
--			$this->show_form(_('No phone number.'));
--			return;
--		}
-+        if (!$sms) {
-+            $this->show_form(_('No phone number.'));
-+            return;
-+        }
-hunk ./actions/smssettings.php 188
--		if (!$carrier_id) {
--			$this->show_form(_('No carrier selected.'));
--			return;
--		}
--		
--		$sms = common_canonical_sms($sms);
--		
--		if ($user->sms == $sms) {
--		    $this->show_form(_('That is already your phone number.'));
--		    return;
--		} else if ($this->sms_exists($sms)) {
--		    $this->show_form(_('That phone number already belongs to another user.'));
--		    return;
--		}
-+        if (!$carrier_id) {
-+            $this->show_form(_('No carrier selected.'));
-+            return;
-+        }
-+        
-+        $sms = common_canonical_sms($sms);
-+        
-+        if ($user->sms == $sms) {
-+            $this->show_form(_('That is already your phone number.'));
-+            return;
-+        } else if ($this->sms_exists($sms)) {
-+            $this->show_form(_('That phone number already belongs to another user.'));
-+            return;
-+        }
-hunk ./actions/smssettings.php 203
--  		$confirm = new Confirm_address();
--   		$confirm->address = $sms;
--   		$confirm->address_extra = $carrier_id;
--   		$confirm->address_type = 'sms';
--   		$confirm->user_id = $user->id;
--   		$confirm->code = common_confirmation_code(40);
-+          $confirm = new Confirm_address();
-+           $confirm->address = $sms;
-+           $confirm->address_extra = $carrier_id;
-+           $confirm->address_type = 'sms';
-+           $confirm->user_id = $user->id;
-+           $confirm->code = common_confirmation_code(40);
-hunk ./actions/smssettings.php 210
--		$result = $confirm->insert();
-+        $result = $confirm->insert();
-hunk ./actions/smssettings.php 212
--		if ($result === FALSE) {
--			common_log_db_error($confirm, 'INSERT', __FILE__);
--			common_server_error(_('Couldn\'t insert confirmation code.'));
--			return;
--		}
-+        if ($result === FALSE) {
-+            common_log_db_error($confirm, 'INSERT', __FILE__);
-+            common_server_error(_('Couldn\'t insert confirmation code.'));
-+            return;
-+        }
-hunk ./actions/smssettings.php 218
--		$carrier = Sms_carrier::staticGet($carrier_id);
--		
--		mail_confirm_sms($confirm->code,
--						 $user->nickname,
--						 $carrier->toEmailAddress($sms));
-+        $carrier = Sms_carrier::staticGet($carrier_id);
-+        
-+        mail_confirm_sms($confirm->code,
-+                         $user->nickname,
-+                         $carrier->toEmailAddress($sms));
-hunk ./actions/smssettings.php 224
--		$msg = _('A confirmation code was sent to the phone number you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
-+        $msg = _('A confirmation code was sent to the phone number you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
-hunk ./actions/smssettings.php 226
--		$this->show_form($msg, TRUE);
--	}
-+        $this->show_form($msg, TRUE);
-+    }
-hunk ./actions/smssettings.php 229
--	function cancel_confirmation() {
--		
--		$sms = $this->trimmed('sms');
--		$carrier = $this->trimmed('carrier');
--		
--		$confirm = $this->get_confirmation();
--		
--		if (!$confirm) {
--			$this->show_form(_('No pending confirmation to cancel.'));
--			return;
--		}
--		if ($confirm->address != $sms) {
--			$this->show_form(_('That is the wrong confirmation number.'));
--			return;
--		}
-+    function cancel_confirmation() {
-+        
-+        $sms = $this->trimmed('sms');
-+        $carrier = $this->trimmed('carrier');
-+        
-+        $confirm = $this->get_confirmation();
-+        
-+        if (!$confirm) {
-+            $this->show_form(_('No pending confirmation to cancel.'));
-+            return;
-+        }
-+        if ($confirm->address != $sms) {
-+            $this->show_form(_('That is the wrong confirmation number.'));
-+            return;
-+        }
-hunk ./actions/smssettings.php 248
--			common_log_db_error($confirm, 'DELETE', __FILE__);
-+            common_log_db_error($confirm, 'DELETE', __FILE__);
-hunk ./actions/smssettings.php 254
--	}
-+    }
-hunk ./actions/smssettings.php 256
--	function remove_address() {
-+    function remove_address() {
-hunk ./actions/smssettings.php 258
--		$user = common_current_user();
--		$sms = $this->arg('sms');
--		$carrier = $this->arg('carrier');
--		
--		# Maybe an old tab open...?
-+        $user = common_current_user();
-+        $sms = $this->arg('sms');
-+        $carrier = $this->arg('carrier');
-+        
-+        # Maybe an old tab open...?
-hunk ./actions/smssettings.php 264
--		if ($user->sms != $sms) {
--		    $this->show_form(_('That is not your phone number.'));
--		    return;
--		}
-+        if ($user->sms != $sms) {
-+            $this->show_form(_('That is not your phone number.'));
-+            return;
-+        }
-hunk ./actions/smssettings.php 269
--		$user->query('BEGIN');
--		$original = clone($user);
--		$user->sms = NULL;
--		$user->carrier = NULL;		
--		$user->smsemail = NULL;		
--		$result = $user->updateKeys($original);
--		if (!$result) {
--			common_log_db_error($user, 'UPDATE', __FILE__);
--			common_server_error(_('Couldn\'t update user.'));
--			return;
--		}
--		$user->query('COMMIT');
-+        $user->query('BEGIN');
-+        $original = clone($user);
-+        $user->sms = NULL;
-+        $user->carrier = NULL;        
-+        $user->smsemail = NULL;        
-+        $result = $user->updateKeys($original);
-+        if (!$result) {
-+            common_log_db_error($user, 'UPDATE', __FILE__);
-+            common_server_error(_('Couldn\'t update user.'));
-+            return;
-+        }
-+        $user->query('COMMIT');
-hunk ./actions/smssettings.php 282
--		$this->show_form(_('The address was removed.'), TRUE);
--	}
--	
--	function sms_exists($sms) {
--		$user = common_current_user();
--		$other = User::staticGet('sms', $sms);
--		if (!$other) {
--			return false;
--		} else {
--			return $other->id != $user->id;
--		}
--	}
-+        $this->show_form(_('The address was removed.'), TRUE);
-+    }
-+    
-+    function sms_exists($sms) {
-+        $user = common_current_user();
-+        $other = User::staticGet('sms', $sms);
-+        if (!$other) {
-+            return false;
-+        } else {
-+            return $other->id != $user->id;
-+        }
-+    }
-hunk ./actions/smssettings.php 295
--	function carrier_select() {
--		$carrier = new Sms_carrier();
--		$cnt = $carrier->find();
-+    function carrier_select() {
-+        $carrier = new Sms_carrier();
-+        $cnt = $carrier->find();
-hunk ./actions/smssettings.php 299
--		common_element_start('p');
--		common_element('label', array('for' => 'carrier'));
--		common_element_start('select', array('name' => 'carrier',
--											 'id' => 'carrier'));
--		common_element('option', array('value' => 0),
--					   _('Select a carrier'));
--		while ($carrier->fetch()) {
--			common_element('option', array('value' => $carrier->id),
--						   $carrier->name);
--		}
--		common_element_end('select');
--		common_element_end('p');
--		common_element('span', 'input_instructions',
--					   sprintf(_('Mobile carrier for your phone. '.
--								 'If you know a carrier that accepts ' . 
--								 'SMS over email but isn\'t listed here, ' .
--								 'send email to let us know at %s.'),
--							   common_config('site', 'email')));
--	}
-+        common_element_start('p');
-+        common_element('label', array('for' => 'carrier'));
-+        common_element_start('select', array('name' => 'carrier',
-+                                             'id' => 'carrier'));
-+        common_element('option', array('value' => 0),
-+                       _('Select a carrier'));
-+        while ($carrier->fetch()) {
-+            common_element('option', array('value' => $carrier->id),
-+                           $carrier->name);
-+        }
-+        common_element_end('select');
-+        common_element_end('p');
-+        common_element('span', 'input_instructions',
-+                       sprintf(_('Mobile carrier for your phone. '.
-+                                 'If you know a carrier that accepts ' . 
-+                                 'SMS over email but isn\'t listed here, ' .
-+                                 'send email to let us know at %s.'),
-+                               common_config('site', 'email')));
-+    }
-hunk ./actions/smssettings.php 319
--	function confirm_code() {
--		
--		$code = $this->trimmed('code');
--		
--		if (!$code) {
--			$this->show_form(_('No code entered'));
--			return;
--		}
--		
--		common_redirect(common_local_url('confirmaddress', 
--										 array('code' => $code)));
--	}
-+    function confirm_code() {
-+        
-+        $code = $this->trimmed('code');
-+        
-+        if (!$code) {
-+            $this->show_form(_('No code entered'));
-+            return;
-+        }
-+        
-+        common_redirect(common_local_url('confirmaddress', 
-+                                         array('code' => $code)));
-+    }
-hunk ./actions/subedit.php 35
--		$token = $this->trimmed('token');
-+        $token = $this->trimmed('token');
-hunk ./actions/subedit.php 37
--		if (!$token || $token != common_session_token()) {
--			$this->client_error(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        if (!$token || $token != common_session_token()) {
-+            $this->client_error(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/subscribe.php 24
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/subscribe.php 27
--		if (!common_logged_in()) {
--			common_user_error(_('Not logged in.'));
--			return;
--		}
-+        if (!common_logged_in()) {
-+            common_user_error(_('Not logged in.'));
-+            return;
-+        }
-hunk ./actions/subscribe.php 32
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/subscribe.php 34
--		if ($_SERVER['REQUEST_METHOD'] != 'POST') {
--			common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
--			return;
--		}
-+        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-+            common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
-+            return;
-+        }
-hunk ./actions/subscribe.php 39
--		# CSRF protection
-+        # CSRF protection
-hunk ./actions/subscribe.php 41
--		$token = $this->trimmed('token');
-+        $token = $this->trimmed('token');
-hunk ./actions/subscribe.php 43
--		if (!$token || $token != common_session_token()) {
--			$this->client_error(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        if (!$token || $token != common_session_token()) {
-+            $this->client_error(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/subscribe.php 48
--		$other_id = $this->arg('subscribeto');
-+        $other_id = $this->arg('subscribeto');
-hunk ./actions/subscribe.php 53
--			$this->client_error(_('Not a local user.'));
--			return;
-+            $this->client_error(_('Not a local user.'));
-+            return;
-hunk ./actions/subscribe.php 57
--		$result = subs_subscribe_to($user, $other);
-+        $result = subs_subscribe_to($user, $other);
-hunk ./actions/subscribe.php 59
--		if($result != true) {
--			common_user_error($result);
--			return;
--		}
-+        if($result != true) {
-+            common_user_error($result);
-+            return;
-+        }
-hunk ./actions/subscribe.php 64
--		if ($this->boolean('ajax')) {
--			common_start_html('text/xml;charset=utf-8', true);
--			common_element_start('head');
--			common_element('title', null, _('Subscribed'));
--			common_element_end('head');
--			common_element_start('body');
--			common_unsubscribe_form($other->getProfile());
--			common_element_end('body');
--			common_element_end('html');
--		} else {
--		    common_redirect(common_local_url('subscriptions', array('nickname' =>
--																$user->nickname)));
-+        if ($this->boolean('ajax')) {
-+            common_start_html('text/xml;charset=utf-8', true);
-+            common_element_start('head');
-+            common_element('title', null, _('Subscribed'));
-+            common_element_end('head');
-+            common_element_start('body');
-+            common_unsubscribe_form($other->getProfile());
-+            common_element_end('body');
-+            common_element_end('html');
-+        } else {
-+            common_redirect(common_local_url('subscriptions', array('nickname' =>
-+                                                                $user->nickname)));
-hunk ./actions/subscribe.php 77
--	}
-+    }
-hunk ./actions/subscribers.php 26
--	function gallery_type() {
--		return _('Subscribers');
--	}
-+    function gallery_type() {
-+        return _('Subscribers');
-+    }
-hunk ./actions/subscribers.php 30
--	function get_instructions(&$profile) {
--		$user =& common_current_user();
--		if ($user && ($user->id == $profile->id)) {
--			return _('These are the people who listen to your notices.');
--		} else {
--			return sprintf(_('These are the people who listen to %s\'s notices.'), $profile->nickname);
--		}
--	}
-+    function get_instructions(&$profile) {
-+        $user =& common_current_user();
-+        if ($user && ($user->id == $profile->id)) {
-+            return _('These are the people who listen to your notices.');
-+        } else {
-+            return sprintf(_('These are the people who listen to %s\'s notices.'), $profile->nickname);
-+        }
-+    }
-hunk ./actions/subscribers.php 39
--	function fields() {
--		return array('subscriber', 'subscribed');
--	}
-+    function fields() {
-+        return array('subscriber', 'subscribed');
-+    }
-hunk ./actions/subscribers.php 43
--	function div_class() {
--		return 'subscribers';
--	}
-+    function div_class() {
-+        return 'subscribers';
-+    }
-hunk ./actions/subscribers.php 47
--	function get_other(&$subs) {
--		return $subs->subscriber;
--	}
-+    function get_other(&$subs) {
-+        return $subs->subscriber;
-+    }
-hunk ./actions/subscriptions.php 26
--	function gallery_type() {
--		return _('Subscriptions');
--	}
-+    function gallery_type() {
-+        return _('Subscriptions');
-+    }
-hunk ./actions/subscriptions.php 30
--	function get_instructions(&$profile) {
--		$user =& common_current_user();
--		if ($user && ($user->id == $profile->id)) {
--			return _('These are the people whose notices you listen to.');
--		} else {
--			return sprintf(_('These are the people whose notices %s listens to.'), $profile->nickname);
--		}
--	}
-+    function get_instructions(&$profile) {
-+        $user =& common_current_user();
-+        if ($user && ($user->id == $profile->id)) {
-+            return _('These are the people whose notices you listen to.');
-+        } else {
-+            return sprintf(_('These are the people whose notices %s listens to.'), $profile->nickname);
-+        }
-+    }
-hunk ./actions/subscriptions.php 39
--	function fields() {
--		return array('subscribed', 'subscriber');
--	}
-+    function fields() {
-+        return array('subscribed', 'subscriber');
-+    }
-hunk ./actions/subscriptions.php 43
--	function div_class() {
--		return 'subscriptions';
--	}
-+    function div_class() {
-+        return 'subscriptions';
-+    }
-hunk ./actions/subscriptions.php 47
--	function get_other(&$subs) {
--		return $subs->subscribed;
--	}
-+    function get_other(&$subs) {
-+        return $subs->subscribed;
-+    }
-hunk ./actions/subscriptions.php 60
--		$sub = Subscription::pkeyGet(array('subscriber' => $this->owner->id,
--										   'subscribed' => $profile->id));
-+        $sub = Subscription::pkeyGet(array('subscriber' => $this->owner->id,
-+                                           'subscribed' => $profile->id));
-hunk ./actions/sup.php 23
--	
--	function handle($args) {
--		
--		parent::handle($args);
--		
--		$seconds = $this->trimmed('seconds');
--		
--		if (!$seconds) {
--			$seconds = 15;
--		}
-+    
-+    function handle($args) {
-+        
-+        parent::handle($args);
-+        
-+        $seconds = $this->trimmed('seconds');
-+        
-+        if (!$seconds) {
-+            $seconds = 15;
-+        }
-hunk ./actions/sup.php 34
--		$updates = $this->get_updates($seconds);
--		
--		header('Content-Type: application/json; charset=utf-8');
--		
--		print json_encode(array('updated_time' => date('c'),
--								'since_time' => date('c', time() - $seconds),
--								'available_periods' => $this->available_periods(),
--								'period' => $seconds,
--								'updates' => $updates));
--	}
--	
--	function available_periods() {
--		static $periods = array(86400, 43200, 21600, 7200,
--								3600, 1800,	600, 300, 120,
--								60, 30, 15); 
--		$available = array();
--		foreach ($periods as $period) {
--			$available[$period] = common_local_url('sup',
--												   array('seconds' => $period));
--		}
--		
--		return $available;
--	}
--	
--	function get_updates($seconds) {
--		$notice = new Notice();
-+        $updates = $this->get_updates($seconds);
-+        
-+        header('Content-Type: application/json; charset=utf-8');
-+        
-+        print json_encode(array('updated_time' => date('c'),
-+                                'since_time' => date('c', time() - $seconds),
-+                                'available_periods' => $this->available_periods(),
-+                                'period' => $seconds,
-+                                'updates' => $updates));
-+    }
-+    
-+    function available_periods() {
-+        static $periods = array(86400, 43200, 21600, 7200,
-+                                3600, 1800,    600, 300, 120,
-+                                60, 30, 15); 
-+        $available = array();
-+        foreach ($periods as $period) {
-+            $available[$period] = common_local_url('sup',
-+                                                   array('seconds' => $period));
-+        }
-+        
-+        return $available;
-+    }
-+    
-+    function get_updates($seconds) {
-+        $notice = new Notice();
-hunk ./actions/sup.php 61
--		# XXX: cache this. Depends on how big this protocol becomes;
--		# Re-doing this query every 15 seconds isn't the end of the world.
-+        # XXX: cache this. Depends on how big this protocol becomes;
-+        # Re-doing this query every 15 seconds isn't the end of the world.
-hunk ./actions/sup.php 64
--		$notice->query('SELECT profile_id, max(id) AS max_id ' .
--					   'FROM notice ' .
--					   'WHERE created > (now() - ' . $seconds . ') ' .
--					   'GROUP BY profile_id');
--		
--		$updates = array();
--		
--		while ($notice->fetch()) {
--			$updates[] = array($notice->profile_id, $notice->max_id);
--		}
--		
--		return $updates;
--	}
--	
--	function is_readonly() {
--		return true;
--	}
-+        $notice->query('SELECT profile_id, max(id) AS max_id ' .
-+                       'FROM notice ' .
-+                       'WHERE created > (now() - ' . $seconds . ') ' .
-+                       'GROUP BY profile_id');
-+        
-+        $updates = array();
-+        
-+        while ($notice->fetch()) {
-+            $updates[] = array($notice->profile_id, $notice->max_id);
-+        }
-+        
-+        return $updates;
-+    }
-+    
-+    function is_readonly() {
-+        return true;
-+    }
-hunk ./actions/tag.php 27
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/tag.php 29
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/tag.php 31
--		# Looks like we're good; show the header
-+        # Looks like we're good; show the header
-hunk ./actions/tag.php 33
--		if (isset($args['tag']) && $args['tag']) {
--			$tag = $args['tag'];
--			common_show_header(sprintf(_("Notices tagged with %s"), $tag),
--							   array($this, 'show_header'), $tag,
--							   array($this, 'show_top'));
--			$this->show_notices($tag);
--		} else {
--			common_show_header(_("Tags"),
--							   array($this, 'show_header'), '',
--							   array($this, 'show_top'));
--			$this->show_tags();
--		}
-+        if (isset($args['tag']) && $args['tag']) {
-+            $tag = $args['tag'];
-+            common_show_header(sprintf(_("Notices tagged with %s"), $tag),
-+                               array($this, 'show_header'), $tag,
-+                               array($this, 'show_top'));
-+            $this->show_notices($tag);
-+        } else {
-+            common_show_header(_("Tags"),
-+                               array($this, 'show_header'), '',
-+                               array($this, 'show_top'));
-+            $this->show_tags();
-+        }
-hunk ./actions/tag.php 46
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/tag.php 49
--	function show_header($tag = false) {
--		if ($tag) {
--			common_element('link', array('rel' => 'alternate',
--										 'href' => common_local_url('tagrss', array('tag' => $tag)),
--										 'type' => 'application/rss+xml',
--										 'title' => sprintf(_('Feed for tag %s'), $tag)));
--		}
--	}
-+    function show_header($tag = false) {
-+        if ($tag) {
-+            common_element('link', array('rel' => 'alternate',
-+                                         'href' => common_local_url('tagrss', array('tag' => $tag)),
-+                                         'type' => 'application/rss+xml',
-+                                         'title' => sprintf(_('Feed for tag %s'), $tag)));
-+        }
-+    }
-hunk ./actions/tag.php 58
--	function get_instructions() {
--		return _('Showing most popular tags from the last week');
--	}
-+    function get_instructions() {
-+        return _('Showing most popular tags from the last week');
-+    }
-hunk ./actions/tag.php 62
--	function show_top($tag = false) {
--		if (!$tag) {
--			$instr = $this->get_instructions();
--			$output = common_markup_to_html($instr);
--			common_element_start('div', 'instructions');
--			common_raw($output);
--			common_element_end('div');
--			$this->public_views_menu();
--		}
--		else {
--			$this->show_feeds_list(array(0=>array('href'=>common_local_url('tagrss'),
--												  'type' => 'rss',
--												  'version' => 'RSS 1.0',
--												  'item' => 'tagrss')));
--		}
--	}
-+    function show_top($tag = false) {
-+        if (!$tag) {
-+            $instr = $this->get_instructions();
-+            $output = common_markup_to_html($instr);
-+            common_element_start('div', 'instructions');
-+            common_raw($output);
-+            common_element_end('div');
-+            $this->public_views_menu();
-+        }
-+        else {
-+            $this->show_feeds_list(array(0=>array('href'=>common_local_url('tagrss'),
-+                                                  'type' => 'rss',
-+                                                  'version' => 'RSS 1.0',
-+                                                  'item' => 'tagrss')));
-+        }
-+    }
-hunk ./actions/tag.php 79
--	function show_tags()
--	{
--		# This should probably be cached rather than recalculated
--		$tags = DB_DataObject::factory('Notice_tag');
-+    function show_tags()
-+    {
-+        # This should probably be cached rather than recalculated
-+        $tags = DB_DataObject::factory('Notice_tag');
-hunk ./actions/tag.php 84
--		#Need to clear the selection and then only re-add the field
--		#we are grouping by, otherwise it's not a valid 'group by'
--		#even though MySQL seems to let it slide...
--		$tags->selectAdd();
--		$tags->selectAdd('tag');
-+        #Need to clear the selection and then only re-add the field
-+        #we are grouping by, otherwise it's not a valid 'group by'
-+        #even though MySQL seems to let it slide...
-+        $tags->selectAdd();
-+        $tags->selectAdd('tag');
-hunk ./actions/tag.php 90
--		#Add the aggregated columns...
--		$tags->selectAdd('max(notice_id) as last_notice_id');
--		if(common_config('db','type')=='pgsql') {
--			$calc='sum(exp(-extract(epoch from (now()-created))/%s)) as weight';
--		} else {
--			$calc='sum(exp(-(now() - created)/%s)) as weight';
--		}
--		$tags->selectAdd(sprintf($calc, common_config('tag', 'dropoff')));
--		$tags->groupBy('tag');
--		$tags->orderBy('weight DESC');
-+        #Add the aggregated columns...
-+        $tags->selectAdd('max(notice_id) as last_notice_id');
-+        if(common_config('db','type')=='pgsql') {
-+            $calc='sum(exp(-extract(epoch from (now()-created))/%s)) as weight';
-+        } else {
-+            $calc='sum(exp(-(now() - created)/%s)) as weight';
-+        }
-+        $tags->selectAdd(sprintf($calc, common_config('tag', 'dropoff')));
-+        $tags->groupBy('tag');
-+        $tags->orderBy('weight DESC');
-hunk ./actions/tag.php 101
--		# $tags->whereAdd('created > "' . strftime('%Y-%m-%d %H:%M:%S', strtotime('-1 MONTH')) . '"');
-+        # $tags->whereAdd('created > "' . strftime('%Y-%m-%d %H:%M:%S', strtotime('-1 MONTH')) . '"');
-hunk ./actions/tag.php 103
--		$tags->limit(TAGS_PER_PAGE);
-+        $tags->limit(TAGS_PER_PAGE);
-hunk ./actions/tag.php 105
--		$cnt = $tags->find();
-+        $cnt = $tags->find();
-hunk ./actions/tag.php 107
--		if ($cnt > 0) {
--			common_element_start('p', 'tagcloud');
-+        if ($cnt > 0) {
-+            common_element_start('p', 'tagcloud');
-hunk ./actions/tag.php 110
--			$tw = array();
--			$sum = 0;
--			while ($tags->fetch()) {
--				$tw[$tags->tag] = $tags->weight;
--				$sum += $tags->weight;
--			}
-+            $tw = array();
-+            $sum = 0;
-+            while ($tags->fetch()) {
-+                $tw[$tags->tag] = $tags->weight;
-+                $sum += $tags->weight;
-+            }
-hunk ./actions/tag.php 117
--			ksort($tw);
-+            ksort($tw);
-hunk ./actions/tag.php 119
--			foreach ($tw as $tag => $weight) {
--				$this->show_tag($tag, $weight, $weight/$sum);
--			}
-+            foreach ($tw as $tag => $weight) {
-+                $this->show_tag($tag, $weight, $weight/$sum);
-+            }
-hunk ./actions/tag.php 123
--			common_element_end('p');
--		}
--	}
-+            common_element_end('p');
-+        }
-+    }
-hunk ./actions/tag.php 127
--	function show_tag($tag, $weight, $relative) {
-+    function show_tag($tag, $weight, $relative) {
-hunk ./actions/tag.php 129
--		# XXX: these should probably tune to the size of the site
--		if ($relative > 0.1) {
--			$cls =  'largest';
--		} else if ($relative > 0.05) {
--			$cls = 'verylarge';
--		} else if ($relative > 0.02) {
--			$cls = 'large';
--		} else if ($relative > 0.01) {
--			$cls = 'medium';
--		} else if ($relative > 0.005) {
--			$cls = 'small';
--		} else if ($relative > 0.002) {
--			$cls = 'verysmall';
--		} else {
--			$cls = 'smallest';
--		}
-+        # XXX: these should probably tune to the size of the site
-+        if ($relative > 0.1) {
-+            $cls =  'largest';
-+        } else if ($relative > 0.05) {
-+            $cls = 'verylarge';
-+        } else if ($relative > 0.02) {
-+            $cls = 'large';
-+        } else if ($relative > 0.01) {
-+            $cls = 'medium';
-+        } else if ($relative > 0.005) {
-+            $cls = 'small';
-+        } else if ($relative > 0.002) {
-+            $cls = 'verysmall';
-+        } else {
-+            $cls = 'smallest';
-+        }
-hunk ./actions/tag.php 146
--		common_element('a', array('class' => "$cls weight-$weight relative-$relative",
--								  'href' => common_local_url('tag', array('tag' => $tag))),
--					   $tag);
--		common_text(' ');
--	}
-+        common_element('a', array('class' => "$cls weight-$weight relative-$relative",
-+                                  'href' => common_local_url('tag', array('tag' => $tag))),
-+                       $tag);
-+        common_text(' ');
-+    }
-hunk ./actions/tag.php 152
--	function show_notices($tag) {
-+    function show_notices($tag) {
-hunk ./actions/tag.php 154
--		$cnt = 0;
-+        $cnt = 0;
-hunk ./actions/tag.php 156
--		$page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-+        $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-hunk ./actions/tag.php 158
--		$notice = Notice_tag::getStream($tag, (($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
-+        $notice = Notice_tag::getStream($tag, (($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
-hunk ./actions/tag.php 162
--		common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
--						  $page, 'tag', array('tag' => $tag));
--	}
-+        common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
-+                          $page, 'tag', array('tag' => $tag));
-+    }
-hunk ./actions/tagother.php 26
--	function handle($args) {
-+    function handle($args) {
-hunk ./actions/tagother.php 28
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/tagother.php 30
--		if (!common_logged_in()) {
--			$this->client_error(_('Not logged in'), 403);
--			return;
--		}
-+        if (!common_logged_in()) {
-+            $this->client_error(_('Not logged in'), 403);
-+            return;
-+        }
-hunk ./actions/tagother.php 35
--		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
--			$this->save_tags();
--		} else {
--			$id = $this->trimmed('id');
--			if (!$id) {
--				$this->client_error(_('No id argument.'));
--				return;
--			}
--			$profile = Profile::staticGet('id', $id);
--			if (!$profile) {
--				$this->client_error(_('No profile with that ID.'));
--				return;
--			}
--			$this->show_form($profile);
--		}
--	}
-+        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-+            $this->save_tags();
-+        } else {
-+            $id = $this->trimmed('id');
-+            if (!$id) {
-+                $this->client_error(_('No id argument.'));
-+                return;
-+            }
-+            $profile = Profile::staticGet('id', $id);
-+            if (!$profile) {
-+                $this->client_error(_('No profile with that ID.'));
-+                return;
-+            }
-+            $this->show_form($profile);
-+        }
-+    }
+-    function show_form($msg=NULL, $success=false) {
++    function show_form($msg=null, $success=false) {
+hunk ./actions/smssettings.php 39
+-        common_element('h2', NULL, _('Address'));
++        common_element('h2', null, _('Address'));
+hunk ./actions/smssettings.php 63
+-                common_input('code', _('Confirmation code'), NULL,
++                common_input('code', _('Confirmation code'), null,
+hunk ./actions/smssettings.php 68
+-                             ($this->arg('sms')) ? $this->arg('sms') : NULL,
++                             ($this->arg('sms')) ? $this->arg('sms') : null,
+hunk ./actions/smssettings.php 76
+-            common_element('h2', NULL, _('Incoming email'));
++            common_element('h2', null, _('Incoming email'));
+hunk ./actions/smssettings.php 94
+-        common_element('h2', NULL, _('Preferences'));
++        common_element('h2', null, _('Preferences'));
+hunk ./actions/smssettings.php 114
+-            return NULL;
++            return null;
+hunk ./actions/smssettings.php 271
+-        $user->sms = NULL;
+-        $user->carrier = NULL;        
+-        $user->smsemail = NULL;        
++        $user->sms = null;
++        $user->carrier = null;        
++        $user->smsemail = null;        
+hunk ./actions/subedit.php 24
+-    var $profile = NULL;
++    var $profile = null;
 hunk ./actions/tagother.php 52
--	function show_form($profile, $error=NULL) {
-+    function show_form($profile, $error=NULL) {
-hunk ./actions/tagother.php 54
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/tagother.php 56
--		common_show_header(_('Tag a person'),
--						   NULL, array($profile, $error), array($this, 'show_top'));
-+        common_show_header(_('Tag a person'),
-+                           NULL, array($profile, $error), array($this, 'show_top'));
-hunk ./actions/tagother.php 59
--		$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-+        $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-hunk ./actions/tagother.php 61
--		common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
--									'class' => 'avatar stream',
--									'width' => AVATAR_PROFILE_SIZE,
--									'height' => AVATAR_PROFILE_SIZE,
--									'alt' =>
--									($profile->fullname) ? $profile->fullname :
--									$profile->nickname));
-+        common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
-+                                    'class' => 'avatar stream',
-+                                    'width' => AVATAR_PROFILE_SIZE,
-+                                    'height' => AVATAR_PROFILE_SIZE,
-+                                    'alt' =>
-+                                    ($profile->fullname) ? $profile->fullname :
-+                                    $profile->nickname));
-hunk ./actions/tagother.php 69
--		common_element('a', array('href' => $profile->profileurl,
--								  'class' => 'external profile nickname'),
--					   $profile->nickname);
-+        common_element('a', array('href' => $profile->profileurl,
-+                                  'class' => 'external profile nickname'),
-+                       $profile->nickname);
-hunk ./actions/tagother.php 73
--		if ($profile->fullname) {
--			common_element_start('div', 'fullname');
--			if ($profile->homepage) {
--				common_element('a', array('href' => $profile->homepage),
--							   $profile->fullname);
--			} else {
--				common_text($profile->fullname);
--			}
--			common_element_end('div');
--		}
--		if ($profile->location) {
--			common_element('div', 'location', $profile->location);
--		}
--		if ($profile->bio) {
--			common_element('div', 'bio', $profile->bio);
--		}
-+        if ($profile->fullname) {
-+            common_element_start('div', 'fullname');
-+            if ($profile->homepage) {
-+                common_element('a', array('href' => $profile->homepage),
-+                               $profile->fullname);
-+            } else {
-+                common_text($profile->fullname);
-+            }
-+            common_element_end('div');
-+        }
-+        if ($profile->location) {
-+            common_element('div', 'location', $profile->location);
-+        }
-+        if ($profile->bio) {
-+            common_element('div', 'bio', $profile->bio);
-+        }
-hunk ./actions/tagother.php 90
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'tag_user',
--										   'name' => 'tagother',
--										   'action' => $this->self_url()));
--		common_hidden('token', common_session_token());
--		common_hidden('id', $profile->id);
--		common_input('tags', _('Tags'),
--					 ($this->arg('tags')) ? $this->arg('tags') : implode(' ', Profile_tag::getTags($user->id, $profile->id)),
--					 _('Tags for this user (letters, numbers, -, ., and _), comma- or space- separated'));
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'tag_user',
-+                                           'name' => 'tagother',
-+                                           'action' => $this->self_url()));
-+        common_hidden('token', common_session_token());
-+        common_hidden('id', $profile->id);
-+        common_input('tags', _('Tags'),
-+                     ($this->arg('tags')) ? $this->arg('tags') : implode(' ', Profile_tag::getTags($user->id, $profile->id)),
-+                     _('Tags for this user (letters, numbers, -, ., and _), comma- or space- separated'));
-hunk ./actions/tagother.php 100
--		common_submit('save', _('Save'));
--		common_element_end('form');
--		common_show_footer();
-+        common_submit('save', _('Save'));
-+        common_element_end('form');
-+        common_show_footer();
-hunk ./actions/tagother.php 104
--	}
-+    }
-hunk ./actions/tagother.php 106
--	function save_tags() {
-+    function save_tags() {
-hunk ./actions/tagother.php 108
--		$id = $this->trimmed('id');
--		$tagstring = $this->trimmed('tags');
--		$token = $this->trimmed('token');
-+        $id = $this->trimmed('id');
-+        $tagstring = $this->trimmed('tags');
-+        $token = $this->trimmed('token');
-hunk ./actions/tagother.php 112
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/tagother.php 117
--		$profile = Profile::staticGet('id', $id);
-+        $profile = Profile::staticGet('id', $id);
-hunk ./actions/tagother.php 119
--		if (!$profile) {
--			$this->client_error(_('No such profile.'));
--			return;
--		}
-+        if (!$profile) {
-+            $this->client_error(_('No such profile.'));
-+            return;
-+        }
-hunk ./actions/tagother.php 124
--		if (is_string($tagstring) && strlen($tagstring) > 0) {
-+        if (is_string($tagstring) && strlen($tagstring) > 0) {
-hunk ./actions/tagother.php 126
--			$tags = array_map('common_canonical_tag',
--							  preg_split('/[\s,]+/', $tagstring));
-+            $tags = array_map('common_canonical_tag',
-+                              preg_split('/[\s,]+/', $tagstring));
-hunk ./actions/tagother.php 129
--			foreach ($tags as $tag) {
--				if (!common_valid_profile_tag($tag)) {
--					$this->show_form($profile, sprintf(_('Invalid tag: "%s"'), $tag));
--					return;
--				}
--			}
--		} else {
--			$tags = array();
--		}
-+            foreach ($tags as $tag) {
-+                if (!common_valid_profile_tag($tag)) {
-+                    $this->show_form($profile, sprintf(_('Invalid tag: "%s"'), $tag));
-+                    return;
-+                }
-+            }
-+        } else {
-+            $tags = array();
-+        }
-hunk ./actions/tagother.php 139
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/tagother.php 141
--		if (!Subscription::pkeyGet(array('subscriber' => $user->id,
--										 'subscribed' => $profile->id)) &&
--			!Subscription::pkeyGet(array('subscriber' => $profile->id,
--										 'subscribed' => $user->id)))
--		{
--			$this->client_error(_('You can only tag people you are subscribed to or who are subscribed to you.'));
--			return;
--		}
-+        if (!Subscription::pkeyGet(array('subscriber' => $user->id,
-+                                         'subscribed' => $profile->id)) &&
-+            !Subscription::pkeyGet(array('subscriber' => $profile->id,
-+                                         'subscribed' => $user->id)))
-+        {
-+            $this->client_error(_('You can only tag people you are subscribed to or who are subscribed to you.'));
-+            return;
-+        }
-hunk ./actions/tagother.php 150
--		$result = Profile_tag::setTags($user->id, $profile->id, $tags);
-+        $result = Profile_tag::setTags($user->id, $profile->id, $tags);
-hunk ./actions/tagother.php 152
--		if (!$result) {
--			$this->client_error(_('Could not save tags.'));
--			return;
--		}
-+        if (!$result) {
-+            $this->client_error(_('Could not save tags.'));
-+            return;
-+        }
-hunk ./actions/tagother.php 157
--		$action = $user->isSubscribed($profile) ? 'subscriptions' : 'subscribers';
-+        $action = $user->isSubscribed($profile) ? 'subscriptions' : 'subscribers';
-hunk ./actions/tagother.php 159
--		if ($this->boolean('ajax')) {
--			common_start_html('text/xml');
--			common_element_start('head');
--			common_element('title', null, _('Tags'));
--			common_element_end('head');
--			common_element_start('body');
--			common_element_start('p', 'subtags');
--			foreach ($tags as $tag) {
--				common_element('a', array('href' => common_local_url($action,
--																	 array('nickname' => $user->nickname,
--																		   'tag' => $tag))),
--							   $tag);
--			}
--			common_element_end('p');
--			common_element_end('body');
--			common_element_end('html');
--		} else {
--			common_redirect(common_local_url($action, array('nickname' =>
--															$user->nickname)));
-+        if ($this->boolean('ajax')) {
-+            common_start_html('text/xml');
-+            common_element_start('head');
-+            common_element('title', null, _('Tags'));
-+            common_element_end('head');
-+            common_element_start('body');
-+            common_element_start('p', 'subtags');
-+            foreach ($tags as $tag) {
-+                common_element('a', array('href' => common_local_url($action,
-+                                                                     array('nickname' => $user->nickname,
-+                                                                           'tag' => $tag))),
-+                               $tag);
-+            }
-+            common_element_end('p');
-+            common_element_end('body');
-+            common_element_end('html');
-+        } else {
-+            common_redirect(common_local_url($action, array('nickname' =>
-+                                                            $user->nickname)));
-hunk ./actions/tagother.php 179
--	}
-+    }
+-    function show_form($profile, $error=NULL) {
++    function show_form($profile, $error=null) {
+hunk ./actions/tagother.php 57
+-                           NULL, array($profile, $error), array($this, 'show_top'));
++                           null, array($profile, $error), array($this, 'show_top'));
 hunk ./actions/tagother.php 181
--	function show_top($arr = NULL) {
--		list($profile, $error) = $arr;
--		if ($error) {
--			common_element('p', 'error', $error);
--		} else {
--			common_element_start('div', 'instructions');
--			common_element('p', NULL,
--						   _('Use this form to add tags to your subscribers or subscriptions.'));
--			common_element_end('div');
--		}
--	}
-+    function show_top($arr = NULL) {
-+        list($profile, $error) = $arr;
-+        if ($error) {
-+            common_element('p', 'error', $error);
-+        } else {
-+            common_element_start('div', 'instructions');
-+            common_element('p', NULL,
-+                           _('Use this form to add tags to your subscribers or subscriptions.'));
-+            common_element_end('div');
-+        }
-+    }
-hunk ./actions/tagrss.php 28
--	function init() {
--		$tag = $this->trimmed('tag');
--		$this->tag = Notice_tag::staticGet('tag', $tag);
-+    function init() {
-+        $tag = $this->trimmed('tag');
-+        $this->tag = Notice_tag::staticGet('tag', $tag);
-hunk ./actions/tagrss.php 32
--		if (!$this->tag) {
--			common_user_error(_('No such tag.'));
--			return false;
--		} else {
--			return true;
--		}
--	}
-+        if (!$this->tag) {
-+            common_user_error(_('No such tag.'));
-+            return false;
-+        } else {
-+            return true;
-+        }
-+    }
-hunk ./actions/tagrss.php 40
--	function get_notices($limit=0) {
--		$tag = $this->tag;
-+    function get_notices($limit=0) {
-+        $tag = $this->tag;
-hunk ./actions/tagrss.php 43
--		if (is_null($tag)) {
--			return NULL;
--		}
-+        if (is_null($tag)) {
-+            return NULL;
-+        }
-hunk ./actions/tagrss.php 47
--		$notice = Notice_tag::getStream($tag->tag, 0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
-+        $notice = Notice_tag::getStream($tag->tag, 0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
-hunk ./actions/tagrss.php 49
--		while ($notice->fetch()) {
--			$notices[] = clone($notice);
--		}
-+        while ($notice->fetch()) {
-+            $notices[] = clone($notice);
-+        }
-hunk ./actions/tagrss.php 53
--		return $notices;
--	}
-+        return $notices;
-+    }
-hunk ./actions/tagrss.php 56
--	function get_channel() {
--		$tag = $this->tag->tag;
-+    function get_channel() {
-+        $tag = $this->tag->tag;
-hunk ./actions/tagrss.php 59
--		$c = array('url' => common_local_url('tagrss', array('tag' => $tagname)),
--			   'title' => $tagname,
--			   'link' => common_local_url('tagrss', array('tag' => $tagname)),
--			   'description' => sprintf(_('Microblog tagged with %s'), $tagname));
--		return $c;
--	}
-+        $c = array('url' => common_local_url('tagrss', array('tag' => $tagname)),
-+               'title' => $tagname,
-+               'link' => common_local_url('tagrss', array('tag' => $tagname)),
-+               'description' => sprintf(_('Microblog tagged with %s'), $tagname));
-+        return $c;
-+    }
-hunk ./actions/twitapiaccount.php 26
--	function verify_credentials($args, $apidata) {
--		parent::handle($args);
-+    function verify_credentials($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapiaccount.php 29
--		if (!in_array($apidata['content-type'], array('xml', 'json'))) {
--			common_user_error(_('API method not found!'), $code = 404);
--			return;
--		}
-+        if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-+            common_user_error(_('API method not found!'), $code = 404);
-+            return;
-+        }
-hunk ./actions/twitapiaccount.php 34
--		$this->show_extended_profile($apidata['user'], $apidata);
--	}
-+        $this->show_extended_profile($apidata['user'], $apidata);
-+    }
-hunk ./actions/twitapiaccount.php 37
--	function end_session($args, $apidata) {
--		parent::handle($args);
--		common_server_error(_('API method under construction.'), $code=501);
--	}
-+    function end_session($args, $apidata) {
-+        parent::handle($args);
-+        common_server_error(_('API method under construction.'), $code=501);
-+    }
-hunk ./actions/twitapiaccount.php 42
--	function update_location($args, $apidata) {
--		parent::handle($args);
-+    function update_location($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapiaccount.php 45
--		if ($_SERVER['REQUEST_METHOD'] != 'POST') {
--			$this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
--			return;
--		}
-+        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-+            $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapiaccount.php 50
--		$location = trim($this->arg('location'));
-+        $location = trim($this->arg('location'));
-hunk ./actions/twitapiaccount.php 52
--		if (!is_null($location) && strlen($location) > 255) {
-+        if (!is_null($location) && strlen($location) > 255) {
-hunk ./actions/twitapiaccount.php 54
--			// XXX: But Twitter just truncates and runs with it. -- Zach
--			$this->client_error(_('That\'s too long. Max notice size is 255 chars.'), 406, $apidate['content-type']);
--			return;
--		}
-+            // XXX: But Twitter just truncates and runs with it. -- Zach
-+            $this->client_error(_('That\'s too long. Max notice size is 255 chars.'), 406, $apidate['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapiaccount.php 59
--		$user = $apidata['user'];
--		$profile = $user->getProfile();
-+        $user = $apidata['user'];
-+        $profile = $user->getProfile();
-hunk ./actions/twitapiaccount.php 62
--		if (!$profile) {
--			common_server_error(_('User has no profile.'));
--			return;
--		}
-+        if (!$profile) {
-+            common_server_error(_('User has no profile.'));
-+            return;
-+        }
-hunk ./actions/twitapiaccount.php 67
--		$orig_profile = clone($profile);
--		$profile->location = $location;
-+        $orig_profile = clone($profile);
-+        $profile->location = $location;
-hunk ./actions/twitapiaccount.php 70
--		$result = $profile->update($orig_profile);
-+        $result = $profile->update($orig_profile);
-hunk ./actions/twitapiaccount.php 72
--		if (!$result) {
--			common_log_db_error($profile, 'UPDATE', __FILE__);
--			common_server_error(_('Couldn\'t save profile.'));
--			return;
--		}
-+        if (!$result) {
-+            common_log_db_error($profile, 'UPDATE', __FILE__);
-+            common_server_error(_('Couldn\'t save profile.'));
-+            return;
-+        }
-hunk ./actions/twitapiaccount.php 78
--		common_broadcast_profile($profile);
--		$type = $apidata['content-type'];
-+        common_broadcast_profile($profile);
-+        $type = $apidata['content-type'];
-hunk ./actions/twitapiaccount.php 81
--		$this->init_document($type);
--		$this->show_profile($profile, $type);
--		$this->end_document($type);
--	}
-+        $this->init_document($type);
-+        $this->show_profile($profile, $type);
-+        $this->end_document($type);
-+    }
-hunk ./actions/twitapiaccount.php 87
--	function update_delivery_device($args, $apidata) {
--		parent::handle($args);
--		common_server_error(_('API method under construction.'), $code=501);
--	}
-+    function update_delivery_device($args, $apidata) {
-+        parent::handle($args);
-+        common_server_error(_('API method under construction.'), $code=501);
-+    }
-hunk ./actions/twitapiaccount.php 92
--	function rate_limit_status($args, $apidata) {
--		parent::handle($args);
--		common_server_error(_('API method under construction.'), $code=501);
--	}
-+    function rate_limit_status($args, $apidata) {
-+        parent::handle($args);
-+        common_server_error(_('API method under construction.'), $code=501);
-+    }
-hunk ./actions/twitapiblocks.php 26
--	function create($args, $apidata) {
-+    function create($args, $apidata) {
-hunk ./actions/twitapiblocks.php 28
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/twitapiblocks.php 30
--		$blockee = $this->get_user($apidata['api_arg'], $apidata);
-+        $blockee = $this->get_user($apidata['api_arg'], $apidata);
-hunk ./actions/twitapiblocks.php 33
--			$this->client_error('Not Found', 404, $apidata['content-type']);
--			return;
-+            $this->client_error('Not Found', 404, $apidata['content-type']);
-+            return;
-hunk ./actions/twitapiblocks.php 45
--			common_server_error(_('Block user failed.'));
-+            common_server_error(_('Block user failed.'));
-hunk ./actions/twitapiblocks.php 47
--	}
-+    }
-hunk ./actions/twitapiblocks.php 49
--	function destroy($args, $apidata) {
--		parent::handle($args);
--		$blockee = $this->get_user($apidata['api_arg'], $apidata);
-+    function destroy($args, $apidata) {
-+        parent::handle($args);
-+        $blockee = $this->get_user($apidata['api_arg'], $apidata);
-hunk ./actions/twitapiblocks.php 54
--			$this->client_error('Not Found', 404, $apidata['content-type']);
--			return;
-+            $this->client_error('Not Found', 404, $apidata['content-type']);
-+            return;
-hunk ./actions/twitapiblocks.php 66
--			common_server_error(_('Unblock user failed.'));
-+            common_server_error(_('Unblock user failed.'));
-hunk ./actions/twitapiblocks.php 68
--	}
-+    }
-hunk ./actions/twitapidirect_messages.php 26
--	function direct_messages($args, $apidata) {
--		parent::handle($args);
--		return $this->show_messages($args, $apidata, 'received');
--	}
-+    function direct_messages($args, $apidata) {
-+        parent::handle($args);
-+        return $this->show_messages($args, $apidata, 'received');
-+    }
-hunk ./actions/twitapidirect_messages.php 31
--	function sent($args, $apidata) {
--		parent::handle($args);
--		return $this->show_messages($args, $apidata, 'sent');
--	}
-+    function sent($args, $apidata) {
-+        parent::handle($args);
-+        return $this->show_messages($args, $apidata, 'sent');
-+    }
-hunk ./actions/twitapidirect_messages.php 36
--	function show_messages($args, $apidata, $type) {
-+    function show_messages($args, $apidata, $type) {
-hunk ./actions/twitapidirect_messages.php 38
--		$user = $apidata['user'];
-+        $user = $apidata['user'];
-hunk ./actions/twitapidirect_messages.php 40
--		$count = $this->arg('count');
--		$since = $this->arg('since');
--		$since_id = $this->arg('since_id');
--		$before_id = $this->arg('before_id');
-+        $count = $this->arg('count');
-+        $since = $this->arg('since');
-+        $since_id = $this->arg('since_id');
-+        $before_id = $this->arg('before_id');
-hunk ./actions/twitapidirect_messages.php 45
--		$page = $this->arg('page');
-+        $page = $this->arg('page');
-hunk ./actions/twitapidirect_messages.php 47
--		if (!$page) {
--			$page = 1;
--		}
-+        if (!$page) {
-+            $page = 1;
-+        }
-hunk ./actions/twitapidirect_messages.php 51
--		if (!$count) {
--			$count = 20;
--		}
-+        if (!$count) {
-+            $count = 20;
-+        }
-hunk ./actions/twitapidirect_messages.php 55
--		$message = new Message();
-+        $message = new Message();
-hunk ./actions/twitapidirect_messages.php 57
--		$title = null;
--		$subtitle = null;
--		$link = null;
--		$server = common_root_url();
-+        $title = null;
-+        $subtitle = null;
-+        $link = null;
-+        $server = common_root_url();
-hunk ./actions/twitapidirect_messages.php 62
--		if ($type == 'received') {
--			$message->to_profile = $user->id;
--			$title = sprintf(_("Direct messages to %s"), $user->nickname);
--			$subtitle = sprintf(_("All the direct messages sent to %s"), $user->nickname);
--			$link = $server . $user->nickname . '/inbox';
--		} else {
--			$message->from_profile = $user->id;
--			$title = _('Direct Messages You\'ve Sent');
--			$subtitle = sprintf(_("All the direct messages sent from %s"), $user->nickname);
--			$link = $server . $user->nickname . '/outbox';
--		}
-+        if ($type == 'received') {
-+            $message->to_profile = $user->id;
-+            $title = sprintf(_("Direct messages to %s"), $user->nickname);
-+            $subtitle = sprintf(_("All the direct messages sent to %s"), $user->nickname);
-+            $link = $server . $user->nickname . '/inbox';
-+        } else {
-+            $message->from_profile = $user->id;
-+            $title = _('Direct Messages You\'ve Sent');
-+            $subtitle = sprintf(_("All the direct messages sent from %s"), $user->nickname);
-+            $link = $server . $user->nickname . '/outbox';
-+        }
-hunk ./actions/twitapidirect_messages.php 74
--		if ($before_id) {
--			$message->whereAdd("id < $before_id");
--		}
-+        if ($before_id) {
-+            $message->whereAdd("id < $before_id");
-+        }
-hunk ./actions/twitapidirect_messages.php 78
--		if ($since_id) {
--			$message->whereAdd("id > $since_id");
--		}
-+        if ($since_id) {
-+            $message->whereAdd("id > $since_id");
-+        }
-hunk ./actions/twitapidirect_messages.php 82
--		$since = strtotime($this->arg('since'));
-+        $since = strtotime($this->arg('since'));
-hunk ./actions/twitapidirect_messages.php 84
--		if ($since) {
--			$d = date('Y-m-d H:i:s', $since);
--			$message->whereAdd("created > '$d'");
--		}
-+        if ($since) {
-+            $d = date('Y-m-d H:i:s', $since);
-+            $message->whereAdd("created > '$d'");
-+        }
-hunk ./actions/twitapidirect_messages.php 89
--		$message->orderBy('created DESC, id DESC');
--		$message->limit((($page-1)*20), $count);
--		$message->find();
-+        $message->orderBy('created DESC, id DESC');
-+        $message->limit((($page-1)*20), $count);
-+        $message->find();
-hunk ./actions/twitapidirect_messages.php 93
--		switch($apidata['content-type']) {
--		 case 'xml':
--			$this->show_xml_dmsgs($message);
--			break;
--		 case 'rss':
--			$this->show_rss_dmsgs($message, $title, $link, $subtitle);
--			break;
--		 case 'atom':
--			$this->show_atom_dmsgs($message, $title, $link, $subtitle);
--			break;
--		 case 'json':
--			$this->show_json_dmsgs($message);
--			break;
--		 default:
--			common_user_error(_('API method not found!'), $code = 404);
--		}
-+        switch($apidata['content-type']) {
-+         case 'xml':
-+            $this->show_xml_dmsgs($message);
-+            break;
-+         case 'rss':
-+            $this->show_rss_dmsgs($message, $title, $link, $subtitle);
-+            break;
-+         case 'atom':
-+            $this->show_atom_dmsgs($message, $title, $link, $subtitle);
-+            break;
-+         case 'json':
-+            $this->show_json_dmsgs($message);
-+            break;
-+         default:
-+            common_user_error(_('API method not found!'), $code = 404);
-+        }
-hunk ./actions/twitapidirect_messages.php 110
--	}
-+    }
-hunk ./actions/twitapidirect_messages.php 112
--	// had to change this from "new" to "create" to avoid PHP reserved word
--	function create($args, $apidata) {
--		parent::handle($args);
-+    // had to change this from "new" to "create" to avoid PHP reserved word
-+    function create($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapidirect_messages.php 116
--		if ($_SERVER['REQUEST_METHOD'] != 'POST') {
--			$this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
--			return;
--		}
-+        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-+            $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapidirect_messages.php 121
--		$user = $apidata['user'];
--		$source = $this->trimmed('source');	 // Not supported by Twitter.
-+        $user = $apidata['user'];
-+        $source = $this->trimmed('source');     // Not supported by Twitter.
-hunk ./actions/twitapidirect_messages.php 125
--		if (!$source || in_array($source, $reserved_sources)) {
--			$source = 'api';
--		}
-+        if (!$source || in_array($source, $reserved_sources)) {
-+            $source = 'api';
-+        }
-hunk ./actions/twitapidirect_messages.php 129
--		$content = $this->trimmed('text');
-+        $content = $this->trimmed('text');
-hunk ./actions/twitapidirect_messages.php 131
--		if (!$content) {
--			$this->client_error(_('No message text!'), $code = 406, $apidata['content-type']);
--		} else {
--			$content_shortened = common_shorten_links($content);
--			if (mb_strlen($content_shortened) > 140) {
--				$this->client_error(_('That\'s too long. Max message size is 140 chars.'),
--					$code = 406, $apidata['content-type']);
--				return;
--			}
--		}
-+        if (!$content) {
-+            $this->client_error(_('No message text!'), $code = 406, $apidata['content-type']);
-+        } else {
-+            $content_shortened = common_shorten_links($content);
-+            if (mb_strlen($content_shortened) > 140) {
-+                $this->client_error(_('That\'s too long. Max message size is 140 chars.'),
-+                    $code = 406, $apidata['content-type']);
-+                return;
-+            }
-+        }
-hunk ./actions/twitapidirect_messages.php 142
--		$other = $this->get_user($this->trimmed('user'));
-+        $other = $this->get_user($this->trimmed('user'));
-hunk ./actions/twitapidirect_messages.php 144
--		if (!$other) {
--			$this->client_error(_('Recipient user not found.'), $code = 403, $apidata['content-type']);
--			return;
--		} else if (!$user->mutuallySubscribed($other)) {
--			$this->client_error(_('Can\'t send direct messages to users who aren\'t your friend.'),
--				$code = 403, $apidata['content-type']);
--			return;
--		} else if ($user->id == $other->id) {
--			// Sending msgs to yourself is allowed by Twitter
--			$this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'),
--				$code = 403, $apidata['content-type']);
--			return;
--		}
-+        if (!$other) {
-+            $this->client_error(_('Recipient user not found.'), $code = 403, $apidata['content-type']);
-+            return;
-+        } else if (!$user->mutuallySubscribed($other)) {
-+            $this->client_error(_('Can\'t send direct messages to users who aren\'t your friend.'),
-+                $code = 403, $apidata['content-type']);
-+            return;
-+        } else if ($user->id == $other->id) {
-+            // Sending msgs to yourself is allowed by Twitter
-+            $this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'),
-+                $code = 403, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapidirect_messages.php 158
--		$message = Message::saveNew($user->id, $other->id,
--			html_entity_decode($content, ENT_NOQUOTES, 'UTF-8'), $source);
-+        $message = Message::saveNew($user->id, $other->id,
-+            html_entity_decode($content, ENT_NOQUOTES, 'UTF-8'), $source);
-hunk ./actions/twitapidirect_messages.php 161
--		if (is_string($message)) {
--			$this->server_error($message);
--			return;
--		}
-+        if (is_string($message)) {
-+            $this->server_error($message);
-+            return;
-+        }
-hunk ./actions/twitapidirect_messages.php 166
--		$this->notify($user, $other, $message);
-+        $this->notify($user, $other, $message);
-hunk ./actions/twitapidirect_messages.php 168
--		if ($apidata['content-type'] == 'xml') {
--			$this->show_single_xml_dmsg($message);
--		} elseif ($apidata['content-type'] == 'json') {
--			$this->show_single_json_dmsg($message);
--		}
-+        if ($apidata['content-type'] == 'xml') {
-+            $this->show_single_xml_dmsg($message);
-+        } elseif ($apidata['content-type'] == 'json') {
-+            $this->show_single_json_dmsg($message);
-+        }
-hunk ./actions/twitapidirect_messages.php 174
--	}
-+    }
-hunk ./actions/twitapidirect_messages.php 176
--	function destroy($args, $apidata) {
--		parent::handle($args);
--		common_server_error(_('API method under construction.'), $code=501);
--	}
-+    function destroy($args, $apidata) {
-+        parent::handle($args);
-+        common_server_error(_('API method under construction.'), $code=501);
-+    }
-hunk ./actions/twitapidirect_messages.php 181
--	function show_xml_dmsgs($message) {
-+    function show_xml_dmsgs($message) {
-hunk ./actions/twitapidirect_messages.php 183
--		$this->init_document('xml');
--		common_element_start('direct-messages', array('type' => 'array'));
-+        $this->init_document('xml');
-+        common_element_start('direct-messages', array('type' => 'array'));
-hunk ./actions/twitapidirect_messages.php 186
--		if (is_array($messages)) {
--			foreach ($message as $m) {
--				$twitter_dm = $this->twitter_dmsg_array($m);
--				$this->show_twitter_xml_dmsg($twitter_dm);
--			}
--		} else {
--			while ($message->fetch()) {
--				$twitter_dm = $this->twitter_dmsg_array($message);
--				$this->show_twitter_xml_dmsg($twitter_dm);
--			}
--		}
-+        if (is_array($messages)) {
-+            foreach ($message as $m) {
-+                $twitter_dm = $this->twitter_dmsg_array($m);
-+                $this->show_twitter_xml_dmsg($twitter_dm);
-+            }
-+        } else {
-+            while ($message->fetch()) {
-+                $twitter_dm = $this->twitter_dmsg_array($message);
-+                $this->show_twitter_xml_dmsg($twitter_dm);
-+            }
-+        }
-hunk ./actions/twitapidirect_messages.php 198
--		common_element_end('direct-messages');
--		$this->end_document('xml');
-+        common_element_end('direct-messages');
-+        $this->end_document('xml');
-hunk ./actions/twitapidirect_messages.php 201
--	}
-+    }
-hunk ./actions/twitapidirect_messages.php 203
--	function show_json_dmsgs($message) {
-+    function show_json_dmsgs($message) {
-hunk ./actions/twitapidirect_messages.php 205
--		$this->init_document('json');
-+        $this->init_document('json');
-hunk ./actions/twitapidirect_messages.php 207
--		$dmsgs = array();
-+        $dmsgs = array();
-hunk ./actions/twitapidirect_messages.php 209
--		if (is_array($message)) {
--			foreach ($message as $m) {
--				$twitter_dm = $this->twitter_dmsg_array($m);
--				array_push($dmsgs, $twitter_dm);
--			}
--		} else {
--			while ($message->fetch()) {
--				$twitter_dm = $this->twitter_dmsg_array($message);
--				array_push($dmsgs, $twitter_dm);
--			}
--		}
-+        if (is_array($message)) {
-+            foreach ($message as $m) {
-+                $twitter_dm = $this->twitter_dmsg_array($m);
-+                array_push($dmsgs, $twitter_dm);
-+            }
-+        } else {
-+            while ($message->fetch()) {
-+                $twitter_dm = $this->twitter_dmsg_array($message);
-+                array_push($dmsgs, $twitter_dm);
-+            }
-+        }
-hunk ./actions/twitapidirect_messages.php 221
--		$this->show_json_objects($dmsgs);
--		$this->end_document('json');
-+        $this->show_json_objects($dmsgs);
-+        $this->end_document('json');
-hunk ./actions/twitapidirect_messages.php 224
--	}
-+    }
-hunk ./actions/twitapidirect_messages.php 226
--	function show_rss_dmsgs($message, $title, $link, $subtitle) {
-+    function show_rss_dmsgs($message, $title, $link, $subtitle) {
-hunk ./actions/twitapidirect_messages.php 228
--		$this->init_document('rss');
-+        $this->init_document('rss');
-hunk ./actions/twitapidirect_messages.php 230
--		common_element_start('channel');
--		common_element('title', NULL, $title);
-+        common_element_start('channel');
-+        common_element('title', NULL, $title);
+-    function show_top($arr = NULL) {
++    function show_top($arr = null) {
+hunk ./actions/tagother.php 187
+-            common_element('p', NULL,
++            common_element('p', null,
+hunk ./actions/tagrss.php 44
+-            return NULL;
++            return null;
+hunk ./actions/twitapidirect_messages.php 231
+-        common_element('title', NULL, $title);
++        common_element('title', null, $title);
 hunk ./actions/twitapidirect_messages.php 233
--		common_element('link', NULL, $link);
--		common_element('description', NULL, $subtitle);
--		common_element('language', NULL, 'en-us');
--		common_element('ttl', NULL, '40');
-+        common_element('link', NULL, $link);
-+        common_element('description', NULL, $subtitle);
-+        common_element('language', NULL, 'en-us');
-+        common_element('ttl', NULL, '40');
-hunk ./actions/twitapidirect_messages.php 238
--		if (is_array($message)) {
--			foreach ($message as $m) {
--				$entry = $this->twitter_rss_dmsg_array($m);
--				$this->show_twitter_rss_item($entry);
--			}
--		} else {
--			while ($message->fetch()) {
--				$entry = $this->twitter_rss_dmsg_array($message);
--				$this->show_twitter_rss_item($entry);
--			}
--		}
-+        if (is_array($message)) {
-+            foreach ($message as $m) {
-+                $entry = $this->twitter_rss_dmsg_array($m);
-+                $this->show_twitter_rss_item($entry);
-+            }
-+        } else {
-+            while ($message->fetch()) {
-+                $entry = $this->twitter_rss_dmsg_array($message);
-+                $this->show_twitter_rss_item($entry);
-+            }
-+        }
-hunk ./actions/twitapidirect_messages.php 250
--		common_element_end('channel');
--		$this->end_twitter_rss();
-+        common_element_end('channel');
-+        $this->end_twitter_rss();
-hunk ./actions/twitapidirect_messages.php 253
--	}
-+    }
-hunk ./actions/twitapidirect_messages.php 255
--	function show_atom_dmsgs($message, $title, $link, $subtitle) {
-+    function show_atom_dmsgs($message, $title, $link, $subtitle) {
-hunk ./actions/twitapidirect_messages.php 257
--		$this->init_document('atom');
-+        $this->init_document('atom');
+-        common_element('link', NULL, $link);
+-        common_element('description', NULL, $subtitle);
+-        common_element('language', NULL, 'en-us');
+-        common_element('ttl', NULL, '40');
++        common_element('link', null, $link);
++        common_element('description', null, $subtitle);
++        common_element('language', null, 'en-us');
++        common_element('ttl', null, '40');
 hunk ./actions/twitapidirect_messages.php 259
--		common_element('title', NULL, $title);
--		$siteserver = common_config('site', 'server');
--		common_element('id', NULL, "tag:$siteserver,2008:DirectMessage");
--		common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
--		common_element('updated', NULL, common_date_iso8601(strftime('%c')));
--		common_element('subtitle', NULL, $subtitle);
-+        common_element('title', NULL, $title);
-+        $siteserver = common_config('site', 'server');
-+        common_element('id', NULL, "tag:$siteserver,2008:DirectMessage");
-+        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
-+        common_element('updated', NULL, common_date_iso8601(strftime('%c')));
-+        common_element('subtitle', NULL, $subtitle);
-hunk ./actions/twitapidirect_messages.php 266
--		if (is_array($message)) {
--			foreach ($message as $m) {
--				$entry = $this->twitter_rss_dmsg_array($m);
--				$this->show_twitter_atom_entry($entry);
--			}
--		} else {
--			while ($message->fetch()) {
--				$entry = $this->twitter_rss_dmsg_array($message);
--				$this->show_twitter_atom_entry($entry);
--			}
--		}
-+        if (is_array($message)) {
-+            foreach ($message as $m) {
-+                $entry = $this->twitter_rss_dmsg_array($m);
-+                $this->show_twitter_atom_entry($entry);
-+            }
-+        } else {
-+            while ($message->fetch()) {
-+                $entry = $this->twitter_rss_dmsg_array($message);
-+                $this->show_twitter_atom_entry($entry);
-+            }
-+        }
-hunk ./actions/twitapidirect_messages.php 278
--		$this->end_document('atom');
--	}
-+        $this->end_document('atom');
-+    }
-hunk ./actions/twitapidirect_messages.php 281
--	// swiped from MessageAction. Should it be place in util.php?
--	function notify($from, $to, $message) {
--		mail_notify_message($message, $from, $to);
--		# XXX: Jabber, SMS notifications... probably queued
--	}
-+    // swiped from MessageAction. Should it be place in util.php?
-+    function notify($from, $to, $message) {
-+        mail_notify_message($message, $from, $to);
-+        # XXX: Jabber, SMS notifications... probably queued
-+    }
-hunk ./actions/twitapifavorites.php 26
--	function favorites($args, $apidata) {
--		parent::handle($args);
-+    function favorites($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapifavorites.php 29
--		$this->auth_user = $apidata['user'];
--		$user = $this->get_user($apidata['api_arg'], $apidata);
-+        $this->auth_user = $apidata['user'];
-+        $user = $this->get_user($apidata['api_arg'], $apidata);
-hunk ./actions/twitapifavorites.php 32
--		if (!$user) {
--			$this->client_error('Not Found', 404, $apidata['content-type']);
--			return;
--		}
-+        if (!$user) {
-+            $this->client_error('Not Found', 404, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapifavorites.php 37
--		$profile = $user->getProfile();
-+        $profile = $user->getProfile();
-hunk ./actions/twitapifavorites.php 39
--		if (!$profile) {
--			common_server_error(_('User has no profile.'));
--			return;
--		}
-+        if (!$profile) {
-+            common_server_error(_('User has no profile.'));
-+            return;
-+        }
-hunk ./actions/twitapifavorites.php 44
--		$page = $this->arg('page');
-+        $page = $this->arg('page');
-hunk ./actions/twitapifavorites.php 46
--		if (!$page) {
--			$page = 1;
--		}
-+        if (!$page) {
-+            $page = 1;
-+        }
-hunk ./actions/twitapifavorites.php 50
--		if (!$count) {
--			$count = 20;
--		}
-+        if (!$count) {
-+            $count = 20;
-+        }
-hunk ./actions/twitapifavorites.php 54
--		$notice = $user->favoriteNotices((($page-1)*20), $count);
-+        $notice = $user->favoriteNotices((($page-1)*20), $count);
-hunk ./actions/twitapifavorites.php 56
--		if (!$notice) {
--			common_server_error(_('Could not retrieve favorite notices.'));
--			return;
--		}
-+        if (!$notice) {
-+            common_server_error(_('Could not retrieve favorite notices.'));
-+            return;
-+        }
-hunk ./actions/twitapifavorites.php 61
--		$sitename = common_config('site', 'name');
--		$siteserver = common_config('site', 'server');
-+        $sitename = common_config('site', 'name');
-+        $siteserver = common_config('site', 'server');
-hunk ./actions/twitapifavorites.php 64
--		$title = sprintf(_('%s / Favorites from %s'), $sitename, $user->nickname);
--		$id = "tag:$siteserver:favorites:".$user->id;
--		$link = common_local_url('favorites', array('nickname' => $user->nickname));
--		$subtitle = sprintf(_('%s updates favorited by %s / %s.'), $sitename, $profile->getBestName(), $user->nickname);
-+        $title = sprintf(_('%s / Favorites from %s'), $sitename, $user->nickname);
-+        $id = "tag:$siteserver:favorites:".$user->id;
-+        $link = common_local_url('favorites', array('nickname' => $user->nickname));
-+        $subtitle = sprintf(_('%s updates favorited by %s / %s.'), $sitename, $profile->getBestName(), $user->nickname);
-hunk ./actions/twitapifavorites.php 69
--		switch($apidata['content-type']) {
--		 case 'xml':
--			$this->show_xml_timeline($notice);
--			break;
--		 case 'rss':
--			$this->show_rss_timeline($notice, $title, $link, $subtitle);
--			break;
--		 case 'atom':
--			$this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
--			break;
--		 case 'json':
--			$this->show_json_timeline($notice);
--			break;
--		 default:
--			common_user_error(_('API method not found!'), $code = 404);
--		}
-+        switch($apidata['content-type']) {
-+         case 'xml':
-+            $this->show_xml_timeline($notice);
-+            break;
-+         case 'rss':
-+            $this->show_rss_timeline($notice, $title, $link, $subtitle);
-+            break;
-+         case 'atom':
-+            $this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
-+            break;
-+         case 'json':
-+            $this->show_json_timeline($notice);
-+            break;
-+         default:
-+            common_user_error(_('API method not found!'), $code = 404);
-+        }
-hunk ./actions/twitapifavorites.php 86
--	}
-+    }
-hunk ./actions/twitapifavorites.php 88
--	function create($args, $apidata) {
--		parent::handle($args);
-+    function create($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapifavorites.php 91
--		// Check for RESTfulness
--		if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
--			// XXX: Twitter just prints the err msg, no XML / JSON.
--			$this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
--			return;
--		}
-+        // Check for RESTfulness
-+        if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
-+            // XXX: Twitter just prints the err msg, no XML / JSON.
-+            $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapifavorites.php 98
--		if (!in_array($apidata['content-type'], array('xml', 'json'))) {
--			common_user_error(_('API method not found!'), $code = 404);
--			return;
--		}
-+        if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-+            common_user_error(_('API method not found!'), $code = 404);
-+            return;
-+        }
-hunk ./actions/twitapifavorites.php 103
--		$this->auth_user = $apidata['user'];
--		$user = $this->auth_user;
--		$notice_id = $apidata['api_arg'];
--		$notice = Notice::staticGet($notice_id);
-+        $this->auth_user = $apidata['user'];
-+        $user = $this->auth_user;
-+        $notice_id = $apidata['api_arg'];
-+        $notice = Notice::staticGet($notice_id);
-hunk ./actions/twitapifavorites.php 108
--		if (!$notice) {
--			$this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
--			return;
--		}
-+        if (!$notice) {
-+            $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapifavorites.php 113
--		// XXX: Twitter lets you fave things repeatedly via api.
--		if ($user->hasFave($notice)) {
--			$this->client_error(_('This notice is already a favorite!'), 403, $apidata['content-type']);
--			return;
--		}
-+        // XXX: Twitter lets you fave things repeatedly via api.
-+        if ($user->hasFave($notice)) {
-+            $this->client_error(_('This notice is already a favorite!'), 403, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapifavorites.php 119
--		$fave = Fave::addNew($user, $notice);
-+        $fave = Fave::addNew($user, $notice);
-hunk ./actions/twitapifavorites.php 121
--		if (!$fave) {
--			common_server_error(_('Could not create favorite.'));
--			return;
--		}
-+        if (!$fave) {
-+            common_server_error(_('Could not create favorite.'));
-+            return;
-+        }
-hunk ./actions/twitapifavorites.php 126
--		$this->notify($fave, $notice, $user);
--		$user->blowFavesCache();
-+        $this->notify($fave, $notice, $user);
-+        $user->blowFavesCache();
-hunk ./actions/twitapifavorites.php 129
--		if ($apidata['content-type'] == 'xml') {
--			$this->show_single_xml_status($notice);
--		} elseif ($apidata['content-type'] == 'json') {
--			$this->show_single_json_status($notice);
--		}
-+        if ($apidata['content-type'] == 'xml') {
-+            $this->show_single_xml_status($notice);
-+        } elseif ($apidata['content-type'] == 'json') {
-+            $this->show_single_json_status($notice);
-+        }
-hunk ./actions/twitapifavorites.php 135
--	}
-+    }
-hunk ./actions/twitapifavorites.php 137
--	function destroy($args, $apidata) {
--		parent::handle($args);
--		common_server_error(_('API method under construction.'), $code=501);
--	}
-+    function destroy($args, $apidata) {
-+        parent::handle($args);
-+        common_server_error(_('API method under construction.'), $code=501);
-+    }
-hunk ./actions/twitapifavorites.php 142
--	// XXX: these two funcs swiped from faves.  Maybe put in util.php, or some common base class?
-+    // XXX: these two funcs swiped from faves.  Maybe put in util.php, or some common base class?
-hunk ./actions/twitapifavorites.php 144
--	function notify($fave, $notice, $user) {
--	    $other = User::staticGet('id', $notice->profile_id);
--		if ($other && $other->id != $user->id) {
--			if ($other->email && $other->emailnotifyfav) {
--				$this->notify_mail($other, $user, $notice);
--			}
--			# XXX: notify by IM
--			# XXX: notify by SMS
--		}
--	}
-+    function notify($fave, $notice, $user) {
-+        $other = User::staticGet('id', $notice->profile_id);
-+        if ($other && $other->id != $user->id) {
-+            if ($other->email && $other->emailnotifyfav) {
-+                $this->notify_mail($other, $user, $notice);
-+            }
-+            # XXX: notify by IM
-+            # XXX: notify by SMS
-+        }
-+    }
-hunk ./actions/twitapifavorites.php 155
--	function notify_mail($other, $user, $notice) {
--		$profile = $user->getProfile();
--		$bestname = $profile->getBestName();
--		$subject = sprintf(_('%s added your notice as a favorite'), $bestname);
--		$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" .
--						  "%3\$s\n\n" .
--						  "You can see the list of %1\$s's favorites here:\n\n" .
--						  "%4\$s\n\n" .
--						  "Faithfully yours,\n" .
--						  "%5\$s\n"),
--						$bestname,
--						common_exact_date($notice->created),
--						common_local_url('shownotice', array('notice' => $notice->id)),
--						common_local_url('showfavorites', array('nickname' => $user->nickname)),
--						common_config('site', 'name'));
-+    function notify_mail($other, $user, $notice) {
-+        $profile = $user->getProfile();
-+        $bestname = $profile->getBestName();
-+        $subject = sprintf(_('%s added your notice as a favorite'), $bestname);
-+        $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" .
-+                          "%3\$s\n\n" .
-+                          "You can see the list of %1\$s's favorites here:\n\n" .
-+                          "%4\$s\n\n" .
-+                          "Faithfully yours,\n" .
-+                          "%5\$s\n"),
-+                        $bestname,
-+                        common_exact_date($notice->created),
-+                        common_local_url('shownotice', array('notice' => $notice->id)),
-+                        common_local_url('showfavorites', array('nickname' => $user->nickname)),
-+                        common_config('site', 'name'));
-hunk ./actions/twitapifavorites.php 172
--		mail_to_user($other, $subject, $body);
--	}
-+        mail_to_user($other, $subject, $body);
-+    }
-hunk ./actions/twitapifriendships.php 26
--	function create($args, $apidata) {
--		parent::handle($args);
-+    function create($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapifriendships.php 29
--		if ($_SERVER['REQUEST_METHOD'] != 'POST') {
--			$this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
--			return;
--		}
-+        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-+            $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapifriendships.php 34
--		$id = $apidata['api_arg'];
-+        $id = $apidata['api_arg'];
-hunk ./actions/twitapifriendships.php 36
--		$other = $this->get_user($id);
-+        $other = $this->get_user($id);
-hunk ./actions/twitapifriendships.php 38
--		if (!$other) {
--			$this->client_error(_('Could not follow user: User not found.'), 403, $apidata['content-type']);
--			return;
--		}
-+        if (!$other) {
-+            $this->client_error(_('Could not follow user: User not found.'), 403, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapifriendships.php 43
--		$user = $apidata['user'];
-+        $user = $apidata['user'];
-hunk ./actions/twitapifriendships.php 45
--		if ($user->isSubscribed($other)) {
--			$errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
--			$this->client_error($errmsg, 403, $apidata['content-type']);
--			return;
--		}
-+        if ($user->isSubscribed($other)) {
-+            $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
-+            $this->client_error($errmsg, 403, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapifriendships.php 51
--		$sub = new Subscription();
-+        $sub = new Subscription();
-hunk ./actions/twitapifriendships.php 53
--		$sub->query('BEGIN');
-+        $sub->query('BEGIN');
-hunk ./actions/twitapifriendships.php 55
--		$sub->subscriber = $user->id;
--		$sub->subscribed = $other->id;
--		$sub->created = DB_DataObject_Cast::dateTime(); # current time
-+        $sub->subscriber = $user->id;
-+        $sub->subscribed = $other->id;
-+        $sub->created = DB_DataObject_Cast::dateTime(); # current time
-hunk ./actions/twitapifriendships.php 59
--		$result = $sub->insert();
-+        $result = $sub->insert();
-hunk ./actions/twitapifriendships.php 61
--		if (!$result) {
--			$errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
--			$this->client_error($errmsg, 400, $apidata['content-type']);
--			return;
--		}
-+        if (!$result) {
-+            $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
-+            $this->client_error($errmsg, 400, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapifriendships.php 67
--		$sub->query('COMMIT');
-+        $sub->query('COMMIT');
-hunk ./actions/twitapifriendships.php 69
--		mail_subscribe_notify($other, $user);
-+        mail_subscribe_notify($other, $user);
-hunk ./actions/twitapifriendships.php 71
--		$type = $apidata['content-type'];
--		$this->init_document($type);
--		$this->show_profile($other, $type);
--		$this->end_document($type);
-+        $type = $apidata['content-type'];
-+        $this->init_document($type);
-+        $this->show_profile($other, $type);
-+        $this->end_document($type);
-hunk ./actions/twitapifriendships.php 76
--	}
-+    }
-hunk ./actions/twitapifriendships.php 78
--	function destroy($args, $apidata) {
--		parent::handle($args);
-+    function destroy($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapifriendships.php 81
--		if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
--			$this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
--			return;
--		}
-+        if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
-+            $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapifriendships.php 86
--		$id = $apidata['api_arg'];
-+        $id = $apidata['api_arg'];
-hunk ./actions/twitapifriendships.php 88
--		# We can't subscribe to a remote person, but we can unsub
-+        # We can't subscribe to a remote person, but we can unsub
-hunk ./actions/twitapifriendships.php 90
--		$other = $this->get_profile($id);
--		$user = $apidata['user'];
-+        $other = $this->get_profile($id);
-+        $user = $apidata['user'];
-hunk ./actions/twitapifriendships.php 93
--		$sub = new Subscription();
--		$sub->subscriber = $user->id;
--		$sub->subscribed = $other->id;
-+        $sub = new Subscription();
-+        $sub->subscriber = $user->id;
-+        $sub->subscribed = $other->id;
-hunk ./actions/twitapifriendships.php 97
--		if ($sub->find(TRUE)) {
--			$sub->query('BEGIN');
--			$sub->delete();
--			$sub->query('COMMIT');
--		} else {
--			$this->client_error(_('You are not friends with the specified user.'), 403, $apidata['content-type']);
--			return;
--		}
-+        if ($sub->find(TRUE)) {
-+            $sub->query('BEGIN');
-+            $sub->delete();
-+            $sub->query('COMMIT');
-+        } else {
-+            $this->client_error(_('You are not friends with the specified user.'), 403, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapifriendships.php 106
--		$type = $apidata['content-type'];
--		$this->init_document($type);
--		$this->show_profile($other, $type);
--		$this->end_document($type);
-+        $type = $apidata['content-type'];
-+        $this->init_document($type);
-+        $this->show_profile($other, $type);
-+        $this->end_document($type);
-hunk ./actions/twitapifriendships.php 111
--	}
-+    }
-hunk ./actions/twitapifriendships.php 113
--	function exists($args, $apidata) {
--		parent::handle($args);
-+    function exists($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapifriendships.php 116
--		if (!in_array($apidata['content-type'], array('xml', 'json'))) {
--			common_user_error(_('API method not found!'), $code = 404);
--			return;
--		}
-+        if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-+            common_user_error(_('API method not found!'), $code = 404);
-+            return;
-+        }
-hunk ./actions/twitapifriendships.php 121
--		$user_a_id = $this->trimmed('user_a');
--		$user_b_id = $this->trimmed('user_b');
-+        $user_a_id = $this->trimmed('user_a');
-+        $user_b_id = $this->trimmed('user_b');
-hunk ./actions/twitapifriendships.php 124
--		$user_a = $this->get_user($user_a_id);
--		$user_b = $this->get_user($user_b_id);
-+        $user_a = $this->get_user($user_a_id);
-+        $user_b = $this->get_user($user_b_id);
-hunk ./actions/twitapifriendships.php 127
--		if (!$user_a || !$user_b) {
--			$this->client_error(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']);
--			return;
--		}
-+        if (!$user_a || !$user_b) {
-+            $this->client_error(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapifriendships.php 132
--		if ($user_a->isSubscribed($user_b)) {
--			$result = 'true';
--		} else {
--			$result = 'false';
--		}
-+        if ($user_a->isSubscribed($user_b)) {
-+            $result = 'true';
-+        } else {
-+            $result = 'false';
-+        }
-hunk ./actions/twitapifriendships.php 138
--		switch ($apidata['content-type']) {
--		 case 'xml':
--			$this->init_document('xml');
--			common_element('friends', NULL, $result);
--			$this->end_document('xml');
--			break;
--		 case 'json':
--			$this->init_document('json');
--			print json_encode($result);
--			$this->end_document('json');
--			break;
--		 default:
--			break;
--		}
-+        switch ($apidata['content-type']) {
-+         case 'xml':
-+            $this->init_document('xml');
-+            common_element('friends', NULL, $result);
-+            $this->end_document('xml');
-+            break;
-+         case 'json':
-+            $this->init_document('json');
-+            print json_encode($result);
-+            $this->end_document('json');
-+            break;
-+         default:
-+            break;
-+        }
-hunk ./actions/twitapifriendships.php 153
--	}
-+    }
-hunk ./actions/twitapihelp.php 26
--	/* Returns the string "ok" in the requested format with a 200 OK HTTP status code.
--	 * URL:http://identi.ca/api/help/test.format
--	 * Formats: xml, json
--	 */
--	function test($args, $apidata) {
--		parent::handle($args);
-+    /* Returns the string "ok" in the requested format with a 200 OK HTTP status code.
-+     * URL:http://identi.ca/api/help/test.format
-+     * Formats: xml, json
-+     */
-+    function test($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapihelp.php 33
--		if ($apidata['content-type'] == 'xml') {
--			$this->init_document('xml');
--			common_element('ok', NULL, 'true');
--			$this->end_document('xml');
--		} elseif ($apidata['content-type'] == 'json') {
--			$this->init_document('json');
--			print '"ok"';
--			$this->end_document('json');
--		} else {
--			common_user_error(_('API method not found!'), $code=404);
--		}
-+        if ($apidata['content-type'] == 'xml') {
-+            $this->init_document('xml');
-+            common_element('ok', NULL, 'true');
-+            $this->end_document('xml');
-+        } elseif ($apidata['content-type'] == 'json') {
-+            $this->init_document('json');
-+            print '"ok"';
-+            $this->end_document('json');
-+        } else {
-+            common_user_error(_('API method not found!'), $code=404);
-+        }
-hunk ./actions/twitapihelp.php 45
--	}
-+    }
-hunk ./actions/twitapihelp.php 47
--	function downtime_schedule($args, $apidata) {
--		parent::handle($args);
--		common_server_error(_('API method under construction.'), $code=501);
--	}
-+    function downtime_schedule($args, $apidata) {
-+        parent::handle($args);
-+        common_server_error(_('API method under construction.'), $code=501);
-+    }
-hunk ./actions/twitapinotifications.php 27
--	function follow($args, $apidata) {
--		parent::handle($args);
--		common_server_error(_('API method under construction.'), $code=501);
--	}
-+    function follow($args, $apidata) {
-+        parent::handle($args);
-+        common_server_error(_('API method under construction.'), $code=501);
-+    }
-hunk ./actions/twitapinotifications.php 32
--	function leave($args, $apidata) {
--		parent::handle($args);
--		common_server_error(_('API method under construction.'), $code=501);
--	}
-+    function leave($args, $apidata) {
-+        parent::handle($args);
-+        common_server_error(_('API method under construction.'), $code=501);
-+    }
-hunk ./actions/twitapistatuses.php 26
--	function public_timeline($args, $apidata) {
--		parent::handle($args);
-+    function public_timeline($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapistatuses.php 29
--		$sitename = common_config('site', 'name');
--		$siteserver = common_config('site', 'server');
--		$title = sprintf(_("%s public timeline"), $sitename);
--		$id = "tag:$siteserver:Statuses";
--		$link = common_root_url();
--		$subtitle = sprintf(_("%s updates from everyone!"), $sitename);
-+        $sitename = common_config('site', 'name');
-+        $siteserver = common_config('site', 'server');
-+        $title = sprintf(_("%s public timeline"), $sitename);
-+        $id = "tag:$siteserver:Statuses";
-+        $link = common_root_url();
-+        $subtitle = sprintf(_("%s updates from everyone!"), $sitename);
-hunk ./actions/twitapistatuses.php 36
--		// Number of public statuses to return by default -- Twitter sends 20
--		$MAX_PUBSTATUSES = 20;
-+        // Number of public statuses to return by default -- Twitter sends 20
-+        $MAX_PUBSTATUSES = 20;
-hunk ./actions/twitapistatuses.php 39
--		// FIXME: To really live up to the spec we need to build a list
--		// of notices by users who have custom avatars, so fix this SQL -- Zach
-+        // FIXME: To really live up to the spec we need to build a list
-+        // of notices by users who have custom avatars, so fix this SQL -- Zach
-hunk ./actions/twitapistatuses.php 42
--		$page = $this->arg('page');
--		$since_id = $this->arg('since_id');
--		$before_id = $this->arg('before_id');
-+        $page = $this->arg('page');
-+        $since_id = $this->arg('since_id');
-+        $before_id = $this->arg('before_id');
-hunk ./actions/twitapistatuses.php 46
--		// NOTE: page, since_id, and before_id are extensions to Twitter API -- TB
--		if (!$page) {
--			$page = 1;
--		}
--		if (!$since_id) {
--			$since_id = 0;
--		}
--		if (!$before_id) {
--			$before_id = 0;
--		}
-+        // NOTE: page, since_id, and before_id are extensions to Twitter API -- TB
-+        if (!$page) {
-+            $page = 1;
-+        }
-+        if (!$since_id) {
-+            $since_id = 0;
-+        }
-+        if (!$before_id) {
-+            $before_id = 0;
-+        }
-hunk ./actions/twitapistatuses.php 57
--		$since = strtotime($this->arg('since'));
-+        $since = strtotime($this->arg('since'));
-hunk ./actions/twitapistatuses.php 59
--		$notice = Notice::publicStream((($page-1)*$MAX_PUBSTATUSES), $MAX_PUBSTATUSES, $since_id, $before_id, $since);
-+        $notice = Notice::publicStream((($page-1)*$MAX_PUBSTATUSES), $MAX_PUBSTATUSES, $since_id, $before_id, $since);
-hunk ./actions/twitapistatuses.php 61
--		if ($notice) {
-+        if ($notice) {
-hunk ./actions/twitapistatuses.php 63
--			switch($apidata['content-type']) {
--				case 'xml':
--					$this->show_xml_timeline($notice);
--					break;
--				case 'rss':
--					$this->show_rss_timeline($notice, $title, $link, $subtitle);
--					break;
--				case 'atom':
--					$this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
--					break;
--				case 'json':
--					$this->show_json_timeline($notice);
--					break;
--				default:
--					common_user_error(_('API method not found!'), $code = 404);
--					break;
--			}
-+            switch($apidata['content-type']) {
-+                case 'xml':
-+                    $this->show_xml_timeline($notice);
-+                    break;
-+                case 'rss':
-+                    $this->show_rss_timeline($notice, $title, $link, $subtitle);
-+                    break;
-+                case 'atom':
-+                    $this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
-+                    break;
-+                case 'json':
-+                    $this->show_json_timeline($notice);
-+                    break;
-+                default:
-+                    common_user_error(_('API method not found!'), $code = 404);
-+                    break;
-+            }
-hunk ./actions/twitapistatuses.php 81
--		} else {
--			common_server_error(_('Couldn\'t find any statuses.'), $code = 503);
--		}
-+        } else {
-+            common_server_error(_('Couldn\'t find any statuses.'), $code = 503);
-+        }
-hunk ./actions/twitapistatuses.php 85
--	}
-+    }
-hunk ./actions/twitapistatuses.php 87
--	function friends_timeline($args, $apidata) {
--		parent::handle($args);
-+    function friends_timeline($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapistatuses.php 90
--		$since = $this->arg('since');
--		$since_id = $this->arg('since_id');
--		$count = $this->arg('count');
--		$page = $this->arg('page');
--		$before_id = $this->arg('before_id');
-+        $since = $this->arg('since');
-+        $since_id = $this->arg('since_id');
-+        $count = $this->arg('count');
-+        $page = $this->arg('page');
-+        $before_id = $this->arg('before_id');
-hunk ./actions/twitapistatuses.php 96
--		if (!$page) {
--			$page = 1;
--		}
-+        if (!$page) {
-+            $page = 1;
-+        }
-hunk ./actions/twitapistatuses.php 100
--		if (!$count) {
--			$count = 20;
--		}
-+        if (!$count) {
-+            $count = 20;
-+        }
-hunk ./actions/twitapistatuses.php 104
--		if (!$since_id) {
--			$since_id = 0;
--		}
-+        if (!$since_id) {
-+            $since_id = 0;
-+        }
-hunk ./actions/twitapistatuses.php 108
--		// NOTE: before_id is an extension to Twitter API -- TB
--		if (!$before_id) {
--			$before_id = 0;
--		}
-+        // NOTE: before_id is an extension to Twitter API -- TB
-+        if (!$before_id) {
-+            $before_id = 0;
-+        }
-hunk ./actions/twitapistatuses.php 113
--		$since = strtotime($this->arg('since'));
-+        $since = strtotime($this->arg('since'));
+-        common_element('title', NULL, $title);
++        common_element('title', null, $title);
+hunk ./actions/twitapidirect_messages.php 261
+-        common_element('id', NULL, "tag:$siteserver,2008:DirectMessage");
+-        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
+-        common_element('updated', NULL, common_date_iso8601(strftime('%c')));
+-        common_element('subtitle', NULL, $subtitle);
++        common_element('id', null, "tag:$siteserver,2008:DirectMessage");
++        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
++        common_element('updated', null, common_date_iso8601(strftime('%c')));
++        common_element('subtitle', null, $subtitle);
+hunk ./actions/twitapifriendships.php 141
+-            common_element('friends', NULL, $result);
++            common_element('friends', null, $result);
+hunk ./actions/twitapihelp.php 35
+-            common_element('ok', NULL, 'true');
++            common_element('ok', null, 'true');
 hunk ./actions/twitapistatuses.php 115
--		$user = $this->get_user(NULL, $apidata);
--		$this->auth_user = $user;
-+        $user = $this->get_user(NULL, $apidata);
-+        $this->auth_user = $user;
-hunk ./actions/twitapistatuses.php 118
--		$profile = $user->getProfile();
-+        $profile = $user->getProfile();
-hunk ./actions/twitapistatuses.php 120
--		$sitename = common_config('site', 'name');
--		$siteserver = common_config('site', 'server');
-+        $sitename = common_config('site', 'name');
-+        $siteserver = common_config('site', 'server');
-hunk ./actions/twitapistatuses.php 123
--		$title = sprintf(_("%s and friends"), $user->nickname);
--		$id = "tag:$siteserver:friends:" . $user->id;
--		$link = common_local_url('all', array('nickname' => $user->nickname));
--		$subtitle = sprintf(_('Updates from %1$s and friends on %2$s!'), $user->nickname, $sitename);
-+        $title = sprintf(_("%s and friends"), $user->nickname);
-+        $id = "tag:$siteserver:friends:" . $user->id;
-+        $link = common_local_url('all', array('nickname' => $user->nickname));
-+        $subtitle = sprintf(_('Updates from %1$s and friends on %2$s!'), $user->nickname, $sitename);
-hunk ./actions/twitapistatuses.php 128
--		$notice = $user->noticesWithFriends(($page-1)*20, $count, $since_id, $before_id, $since);
-+        $notice = $user->noticesWithFriends(($page-1)*20, $count, $since_id, $before_id, $since);
-hunk ./actions/twitapistatuses.php 130
--		switch($apidata['content-type']) {
--		 case 'xml':
--			$this->show_xml_timeline($notice);
--			break;
--		 case 'rss':
--			$this->show_rss_timeline($notice, $title, $link, $subtitle);
--			break;
--		 case 'atom':
--			$this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
--			break;
--		 case 'json':
--			$this->show_json_timeline($notice);
--			break;
--		 default:
--			common_user_error(_('API method not found!'), $code = 404);
--		}
-+        switch($apidata['content-type']) {
-+         case 'xml':
-+            $this->show_xml_timeline($notice);
-+            break;
-+         case 'rss':
-+            $this->show_rss_timeline($notice, $title, $link, $subtitle);
-+            break;
-+         case 'atom':
-+            $this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
-+            break;
-+         case 'json':
-+            $this->show_json_timeline($notice);
-+            break;
-+         default:
-+            common_user_error(_('API method not found!'), $code = 404);
-+        }
-hunk ./actions/twitapistatuses.php 147
--	}
-+    }
-hunk ./actions/twitapistatuses.php 149
--	function user_timeline($args, $apidata) {
--		parent::handle($args);
-+    function user_timeline($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapistatuses.php 152
--		$this->auth_user = $apidata['user'];
--		$user = $this->get_user($apidata['api_arg'], $apidata);
-+        $this->auth_user = $apidata['user'];
-+        $user = $this->get_user($apidata['api_arg'], $apidata);
-hunk ./actions/twitapistatuses.php 155
--		if (!$user) {
--			$this->client_error('Not Found', 404, $apidata['content-type']);
--			return;
--		}
-+        if (!$user) {
-+            $this->client_error('Not Found', 404, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapistatuses.php 160
--		$profile = $user->getProfile();
-+        $profile = $user->getProfile();
-hunk ./actions/twitapistatuses.php 162
--		if (!$profile) {
--			common_server_error(_('User has no profile.'));
--			return;
--		}
-+        if (!$profile) {
-+            common_server_error(_('User has no profile.'));
-+            return;
-+        }
-hunk ./actions/twitapistatuses.php 167
--		$count = $this->arg('count');
--		$since = $this->arg('since');
--		$since_id = $this->arg('since_id');
--		$page = $this->arg('page');
--		$before_id = $this->arg('before_id');
-+        $count = $this->arg('count');
-+        $since = $this->arg('since');
-+        $since_id = $this->arg('since_id');
-+        $page = $this->arg('page');
-+        $before_id = $this->arg('before_id');
-hunk ./actions/twitapistatuses.php 173
--		if (!$page) {
--			$page = 1;
--		}
-+        if (!$page) {
-+            $page = 1;
-+        }
-hunk ./actions/twitapistatuses.php 177
--		if (!$count) {
--			$count = 20;
--		}
-+        if (!$count) {
-+            $count = 20;
-+        }
-hunk ./actions/twitapistatuses.php 181
--		if (!$since_id) {
--			$since_id = 0;
--		}
-+        if (!$since_id) {
-+            $since_id = 0;
-+        }
-hunk ./actions/twitapistatuses.php 185
--		// NOTE: before_id is an extensions to Twitter API -- TB
--		if (!$before_id) {
--			$before_id = 0;
--		}
-+        // NOTE: before_id is an extensions to Twitter API -- TB
-+        if (!$before_id) {
-+            $before_id = 0;
-+        }
-hunk ./actions/twitapistatuses.php 190
--		$since = strtotime($this->arg('since'));
-+        $since = strtotime($this->arg('since'));
-hunk ./actions/twitapistatuses.php 192
--		$sitename = common_config('site', 'name');
--		$siteserver = common_config('site', 'server');
-+        $sitename = common_config('site', 'name');
-+        $siteserver = common_config('site', 'server');
-hunk ./actions/twitapistatuses.php 195
--		$title = sprintf(_("%s timeline"), $user->nickname);
--		$id = "tag:$siteserver:user:".$user->id;
--		$link = common_local_url('showstream', array('nickname' => $user->nickname));
--		$subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
-+        $title = sprintf(_("%s timeline"), $user->nickname);
-+        $id = "tag:$siteserver:user:".$user->id;
-+        $link = common_local_url('showstream', array('nickname' => $user->nickname));
-+        $subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
-hunk ./actions/twitapistatuses.php 200
--		# FriendFeed's SUP protocol
--		# Also added RSS and Atom feeds
-+        # FriendFeed's SUP protocol
-+        # Also added RSS and Atom feeds
+-        $user = $this->get_user(NULL, $apidata);
++        $user = $this->get_user(null, $apidata);
 hunk ./actions/twitapistatuses.php 203
--		$suplink = common_local_url('sup', NULL, $user->id);
--		header('X-SUP-ID: '.$suplink);
-+        $suplink = common_local_url('sup', NULL, $user->id);
-+        header('X-SUP-ID: '.$suplink);
-hunk ./actions/twitapistatuses.php 206
--		# XXX: since
-+        # XXX: since
-hunk ./actions/twitapistatuses.php 208
--		$notice = $user->getNotices((($page-1)*20), $count, $since_id, $before_id, $since);
-+        $notice = $user->getNotices((($page-1)*20), $count, $since_id, $before_id, $since);
-hunk ./actions/twitapistatuses.php 210
--		switch($apidata['content-type']) {
--		 case 'xml':
--			$this->show_xml_timeline($notice);
--			break;
--		 case 'rss':
--			$this->show_rss_timeline($notice, $title, $link, $subtitle, $suplink);
--			break;
--		 case 'atom':
--			$this->show_atom_timeline($notice, $title, $id, $link, $subtitle, $suplink);
--			break;
--		 case 'json':
--			$this->show_json_timeline($notice);
--			break;
--		 default:
--			common_user_error(_('API method not found!'), $code = 404);
--		}
-+        switch($apidata['content-type']) {
-+         case 'xml':
-+            $this->show_xml_timeline($notice);
-+            break;
-+         case 'rss':
-+            $this->show_rss_timeline($notice, $title, $link, $subtitle, $suplink);
-+            break;
-+         case 'atom':
-+            $this->show_atom_timeline($notice, $title, $id, $link, $subtitle, $suplink);
-+            break;
-+         case 'json':
-+            $this->show_json_timeline($notice);
-+            break;
-+         default:
-+            common_user_error(_('API method not found!'), $code = 404);
-+        }
-hunk ./actions/twitapistatuses.php 227
--	}
-+    }
-hunk ./actions/twitapistatuses.php 229
--	function update($args, $apidata) {
-+    function update($args, $apidata) {
-hunk ./actions/twitapistatuses.php 231
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/twitapistatuses.php 233
--		if (!in_array($apidata['content-type'], array('xml', 'json'))) {
--			common_user_error(_('API method not found!'), $code = 404);
--			return;
--		}
-+        if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-+            common_user_error(_('API method not found!'), $code = 404);
-+            return;
-+        }
-hunk ./actions/twitapistatuses.php 238
--		if ($_SERVER['REQUEST_METHOD'] != 'POST') {
--			$this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
--			return;
--		}
-+        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-+            $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapistatuses.php 243
--		$this->auth_user = $apidata['user'];
--		$user = $this->auth_user;
--		$status = $this->trimmed('status');
--		$source = $this->trimmed('source');
--		$in_reply_to_status_id = intval($this->trimmed('in_reply_to_status_id'));
-+        $this->auth_user = $apidata['user'];
-+        $user = $this->auth_user;
-+        $status = $this->trimmed('status');
-+        $source = $this->trimmed('source');
-+        $in_reply_to_status_id = intval($this->trimmed('in_reply_to_status_id'));
-hunk ./actions/twitapistatuses.php 249
--		if (!$source || in_array($source, $reserved_sources)) {
--			$source = 'api';
--		}
-+        if (!$source || in_array($source, $reserved_sources)) {
-+            $source = 'api';
-+        }
-hunk ./actions/twitapistatuses.php 253
--		if (!$status) {
-+        if (!$status) {
-hunk ./actions/twitapistatuses.php 255
--			// XXX: Note: In this case, Twitter simply returns '200 OK'
--			// No error is given, but the status is not posted to the
--			// user's timeline.	 Seems bad.	 Shouldn't we throw an
--			// errror? -- Zach
--			return;
-+            // XXX: Note: In this case, Twitter simply returns '200 OK'
-+            // No error is given, but the status is not posted to the
-+            // user's timeline.     Seems bad.     Shouldn't we throw an
-+            // errror? -- Zach
-+            return;
-hunk ./actions/twitapistatuses.php 261
--		} else {
-+        } else {
-hunk ./actions/twitapistatuses.php 263
--			$status_shortened = common_shorten_links($status);
-+            $status_shortened = common_shorten_links($status);
-hunk ./actions/twitapistatuses.php 265
--			if (mb_strlen($status_shortened) > 140) {
-+            if (mb_strlen($status_shortened) > 140) {
-hunk ./actions/twitapistatuses.php 267
--				// XXX: Twitter truncates anything over 140, flags the status
--				// as "truncated." Sending this error may screw up some clients
--				// that assume Twitter will truncate for them.	Should we just
--				// truncate too? -- Zach
--				$this->client_error(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']);
--				return;
-+                // XXX: Twitter truncates anything over 140, flags the status
-+                // as "truncated." Sending this error may screw up some clients
-+                // that assume Twitter will truncate for them.    Should we just
-+                // truncate too? -- Zach
-+                $this->client_error(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']);
-+                return;
-hunk ./actions/twitapistatuses.php 274
--			}
--		}
-+            }
-+        }
-hunk ./actions/twitapistatuses.php 277
--		// Check for commands
--		$inter = new CommandInterpreter();
--		$cmd = $inter->handle_command($user, $status_shortened);
-+        // Check for commands
-+        $inter = new CommandInterpreter();
-+        $cmd = $inter->handle_command($user, $status_shortened);
-hunk ./actions/twitapistatuses.php 281
--		if ($cmd) {
-+        if ($cmd) {
-hunk ./actions/twitapistatuses.php 283
--			if ($this->supported($cmd)) {
--				$cmd->execute(new Channel());
--			}
-+            if ($this->supported($cmd)) {
-+                $cmd->execute(new Channel());
-+            }
-hunk ./actions/twitapistatuses.php 287
--			// cmd not supported?  Twitter just returns your latest status.
--			// And, it returns your last status whether the cmd was successful
--			// or not!
--			$n = $user->getCurrentNotice();
--			$apidata['api_arg'] = $n->id;
--		} else {
-+            // cmd not supported?  Twitter just returns your latest status.
-+            // And, it returns your last status whether the cmd was successful
-+            // or not!
-+            $n = $user->getCurrentNotice();
-+            $apidata['api_arg'] = $n->id;
-+        } else {
+-        $suplink = common_local_url('sup', NULL, $user->id);
++        $suplink = common_local_url('sup', null, $user->id);
 hunk ./actions/twitapistatuses.php 294
--			$reply_to = NULL;
-+            $reply_to = NULL;
-hunk ./actions/twitapistatuses.php 296
--			if ($in_reply_to_status_id) {
-+            if ($in_reply_to_status_id) {
-hunk ./actions/twitapistatuses.php 298
--				// check whether notice actually exists
--				$reply = Notice::staticGet($in_reply_to_status_id);
-+                // check whether notice actually exists
-+                $reply = Notice::staticGet($in_reply_to_status_id);
-hunk ./actions/twitapistatuses.php 301
--				if ($reply) {
--					$reply_to = $in_reply_to_status_id;
--				} else {
--					$this->client_error(_('Not found'), $code = 404, $apidata['content-type']);
--					return;
--				}
--			}
-+                if ($reply) {
-+                    $reply_to = $in_reply_to_status_id;
-+                } else {
-+                    $this->client_error(_('Not found'), $code = 404, $apidata['content-type']);
-+                    return;
-+                }
-+            }
-hunk ./actions/twitapistatuses.php 309
--			$notice = Notice::saveNew($user->id, html_entity_decode($status, ENT_NOQUOTES, 'UTF-8'),
--				$source, 1, $reply_to);
-+            $notice = Notice::saveNew($user->id, html_entity_decode($status, ENT_NOQUOTES, 'UTF-8'),
-+                $source, 1, $reply_to);
-hunk ./actions/twitapistatuses.php 312
--			if (is_string($notice)) {
--				$this->server_error($notice);
--				return;
--			}
-+            if (is_string($notice)) {
-+                $this->server_error($notice);
-+                return;
-+            }
-hunk ./actions/twitapistatuses.php 317
--			common_broadcast_notice($notice);
--			$apidata['api_arg'] = $notice->id;
--		}
-+            common_broadcast_notice($notice);
-+            $apidata['api_arg'] = $notice->id;
-+        }
-hunk ./actions/twitapistatuses.php 321
--		$this->show($args, $apidata);
--	}
-+        $this->show($args, $apidata);
-+    }
-hunk ./actions/twitapistatuses.php 324
--	function replies($args, $apidata) {
-+    function replies($args, $apidata) {
-hunk ./actions/twitapistatuses.php 326
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/twitapistatuses.php 328
--		$since = $this->arg('since');
--		$count = $this->arg('count');
--		$page = $this->arg('page');
--		$since_id = $this->arg('since_id');
--		$before_id = $this->arg('before_id');
-+        $since = $this->arg('since');
-+        $count = $this->arg('count');
-+        $page = $this->arg('page');
-+        $since_id = $this->arg('since_id');
-+        $before_id = $this->arg('before_id');
-hunk ./actions/twitapistatuses.php 334
--		$this->auth_user = $apidata['user'];
--		$user = $this->auth_user;
--		$profile = $user->getProfile();
-+        $this->auth_user = $apidata['user'];
-+        $user = $this->auth_user;
-+        $profile = $user->getProfile();
-hunk ./actions/twitapistatuses.php 338
--		$sitename = common_config('site', 'name');
--		$siteserver = common_config('site', 'server');
-+        $sitename = common_config('site', 'name');
-+        $siteserver = common_config('site', 'server');
-hunk ./actions/twitapistatuses.php 341
--		$title = sprintf(_('%1$s / Updates replying to %2$s'), $sitename, $user->nickname);
--		$id = "tag:$siteserver:replies:".$user->id;
--		$link = common_local_url('replies', array('nickname' => $user->nickname));
--		$subtitle = sprintf(_('%1$s updates that reply to updates from %2$s / %3$s.'), $sitename, $user->nickname, $profile->getBestName());
-+        $title = sprintf(_('%1$s / Updates replying to %2$s'), $sitename, $user->nickname);
-+        $id = "tag:$siteserver:replies:".$user->id;
-+        $link = common_local_url('replies', array('nickname' => $user->nickname));
-+        $subtitle = sprintf(_('%1$s updates that reply to updates from %2$s / %3$s.'), $sitename, $user->nickname, $profile->getBestName());
-hunk ./actions/twitapistatuses.php 346
--		if (!$page) {
--			$page = 1;
--		}
-+        if (!$page) {
-+            $page = 1;
-+        }
-hunk ./actions/twitapistatuses.php 350
--		if (!$count) {
--			$count = 20;
--		}
-+        if (!$count) {
-+            $count = 20;
-+        }
-hunk ./actions/twitapistatuses.php 354
--		if (!$since_id) {
--			$since_id = 0;
--		}
-+        if (!$since_id) {
-+            $since_id = 0;
-+        }
-hunk ./actions/twitapistatuses.php 358
--		// NOTE: before_id is an extension to Twitter API -- TB
--		if (!$before_id) {
--			$before_id = 0;
--		}
-+        // NOTE: before_id is an extension to Twitter API -- TB
-+        if (!$before_id) {
-+            $before_id = 0;
-+        }
-hunk ./actions/twitapistatuses.php 363
--		$since = strtotime($this->arg('since'));
-+        $since = strtotime($this->arg('since'));
-hunk ./actions/twitapistatuses.php 365
--		$notice = $user->getReplies((($page-1)*20), $count, $since_id, $before_id, $since);
--		$notices = array();
-+        $notice = $user->getReplies((($page-1)*20), $count, $since_id, $before_id, $since);
-+        $notices = array();
-hunk ./actions/twitapistatuses.php 368
--		while ($notice->fetch()) {
--			$notices[] = clone($notice);
--		}
-+        while ($notice->fetch()) {
-+            $notices[] = clone($notice);
-+        }
-hunk ./actions/twitapistatuses.php 372
--		switch($apidata['content-type']) {
--		 case 'xml':
--			$this->show_xml_timeline($notices);
--			break;
--		 case 'rss':
--			$this->show_rss_timeline($notices, $title, $link, $subtitle);
--			break;
--		 case 'atom':
--			$this->show_atom_timeline($notices, $title, $id, $link, $subtitle);
--			break;
--		 case 'json':
--			$this->show_json_timeline($notices);
--			break;
--		 default:
--			common_user_error(_('API method not found!'), $code = 404);
--		}
-+        switch($apidata['content-type']) {
-+         case 'xml':
-+            $this->show_xml_timeline($notices);
-+            break;
-+         case 'rss':
-+            $this->show_rss_timeline($notices, $title, $link, $subtitle);
-+            break;
-+         case 'atom':
-+            $this->show_atom_timeline($notices, $title, $id, $link, $subtitle);
-+            break;
-+         case 'json':
-+            $this->show_json_timeline($notices);
-+            break;
-+         default:
-+            common_user_error(_('API method not found!'), $code = 404);
-+        }
-hunk ./actions/twitapistatuses.php 389
--	}
-+    }
-hunk ./actions/twitapistatuses.php 391
--	function show($args, $apidata) {
--		parent::handle($args);
-+    function show($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapistatuses.php 394
--		if (!in_array($apidata['content-type'], array('xml', 'json'))) {
--			common_user_error(_('API method not found!'), $code = 404);
--			return;
--		}
-+        if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-+            common_user_error(_('API method not found!'), $code = 404);
-+            return;
-+        }
-hunk ./actions/twitapistatuses.php 399
--		$this->auth_user = $apidata['user'];
--		$notice_id = $apidata['api_arg'];
--		$notice = Notice::staticGet($notice_id);
-+        $this->auth_user = $apidata['user'];
-+        $notice_id = $apidata['api_arg'];
-+        $notice = Notice::staticGet($notice_id);
-hunk ./actions/twitapistatuses.php 403
--		if ($notice) {
--			if ($apidata['content-type'] == 'xml') {
--				$this->show_single_xml_status($notice);
--			} elseif ($apidata['content-type'] == 'json') {
--				$this->show_single_json_status($notice);
--			}
--		} else {
--			// XXX: Twitter just sets a 404 header and doens't bother to return an err msg
--			$this->client_error(_('No status with that ID found.'), 404, $apidata['content-type']);
--		}
-+        if ($notice) {
-+            if ($apidata['content-type'] == 'xml') {
-+                $this->show_single_xml_status($notice);
-+            } elseif ($apidata['content-type'] == 'json') {
-+                $this->show_single_json_status($notice);
-+            }
-+        } else {
-+            // XXX: Twitter just sets a 404 header and doens't bother to return an err msg
-+            $this->client_error(_('No status with that ID found.'), 404, $apidata['content-type']);
-+        }
-hunk ./actions/twitapistatuses.php 414
--	}
-+    }
-hunk ./actions/twitapistatuses.php 416
--	function destroy($args, $apidata) {
-+    function destroy($args, $apidata) {
-hunk ./actions/twitapistatuses.php 418
--		parent::handle($args);
-+        parent::handle($args);
-hunk ./actions/twitapistatuses.php 420
--		if (!in_array($apidata['content-type'], array('xml', 'json'))) {
--			common_user_error(_('API method not found!'), $code = 404);
--			return;
--		}
-+        if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-+            common_user_error(_('API method not found!'), $code = 404);
-+            return;
-+        }
-hunk ./actions/twitapistatuses.php 425
--		// Check for RESTfulness
--		if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
--			// XXX: Twitter just prints the err msg, no XML / JSON.
--			$this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
--			return;
--		}
-+        // Check for RESTfulness
-+        if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
-+            // XXX: Twitter just prints the err msg, no XML / JSON.
-+            $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapistatuses.php 432
--		$this->auth_user = $apidata['user'];
--		$user = $this->auth_user;
--		$notice_id = $apidata['api_arg'];
--		$notice = Notice::staticGet($notice_id);
-+        $this->auth_user = $apidata['user'];
-+        $user = $this->auth_user;
-+        $notice_id = $apidata['api_arg'];
-+        $notice = Notice::staticGet($notice_id);
-hunk ./actions/twitapistatuses.php 437
--		if (!$notice) {
--			$this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
--			return;
--		}
-+        if (!$notice) {
-+            $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapistatuses.php 442
--		if ($user->id == $notice->profile_id) {
--			$replies = new Reply;
--			$replies->get('notice_id', $notice_id);
--			common_dequeue_notice($notice);
--			$replies->delete();
--			$notice->delete();
-+        if ($user->id == $notice->profile_id) {
-+            $replies = new Reply;
-+            $replies->get('notice_id', $notice_id);
-+            common_dequeue_notice($notice);
-+            $replies->delete();
-+            $notice->delete();
-hunk ./actions/twitapistatuses.php 449
--			if ($apidata['content-type'] == 'xml') {
--				$this->show_single_xml_status($notice);
--			} elseif ($apidata['content-type'] == 'json') {
--				$this->show_single_json_status($notice);
--			}
--		} else {
--			$this->client_error(_('You may not delete another user\'s status.'), 403, $apidata['content-type']);
--		}
-+            if ($apidata['content-type'] == 'xml') {
-+                $this->show_single_xml_status($notice);
-+            } elseif ($apidata['content-type'] == 'json') {
-+                $this->show_single_json_status($notice);
-+            }
-+        } else {
-+            $this->client_error(_('You may not delete another user\'s status.'), 403, $apidata['content-type']);
-+        }
-hunk ./actions/twitapistatuses.php 458
--	}
-+    }
-hunk ./actions/twitapistatuses.php 460
--	function friends($args, $apidata) {
--		parent::handle($args);
--		return $this->subscriptions($apidata, 'subscribed', 'subscriber');
--	}
-+    function friends($args, $apidata) {
-+        parent::handle($args);
-+        return $this->subscriptions($apidata, 'subscribed', 'subscriber');
-+    }
-hunk ./actions/twitapistatuses.php 465
--	function followers($args, $apidata) {
--		parent::handle($args);
-+    function followers($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapistatuses.php 468
--		return $this->subscriptions($apidata, 'subscriber', 'subscribed');
--	}
-+        return $this->subscriptions($apidata, 'subscriber', 'subscribed');
-+    }
-hunk ./actions/twitapistatuses.php 471
--	function subscriptions($apidata, $other_attr, $user_attr) {
-+    function subscriptions($apidata, $other_attr, $user_attr) {
-hunk ./actions/twitapistatuses.php 473
--		# XXX: lite
-+        # XXX: lite
-hunk ./actions/twitapistatuses.php 475
--		$this->auth_user = $apidate['user'];
--		$user = $this->get_user($apidata['api_arg'], $apidata);
-+        $this->auth_user = $apidate['user'];
-+        $user = $this->get_user($apidata['api_arg'], $apidata);
-hunk ./actions/twitapistatuses.php 478
--		if (!$user) {
--			$this->client_error('Not Found', 404, $apidata['content-type']);
--			return;
--		}
-+        if (!$user) {
-+            $this->client_error('Not Found', 404, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapistatuses.php 483
--		$page = $this->trimmed('page');
-+        $page = $this->trimmed('page');
-hunk ./actions/twitapistatuses.php 485
--		if (!$page || !is_numeric($page)) {
--			$page = 1;
--		}
-+        if (!$page || !is_numeric($page)) {
-+            $page = 1;
-+        }
-hunk ./actions/twitapistatuses.php 489
--		$profile = $user->getProfile();
-+        $profile = $user->getProfile();
-hunk ./actions/twitapistatuses.php 491
--		if (!$profile) {
--			common_server_error(_('User has no profile.'));
--			return;
--		}
-+        if (!$profile) {
-+            common_server_error(_('User has no profile.'));
-+            return;
-+        }
-hunk ./actions/twitapistatuses.php 496
--		$sub = new Subscription();
--		$sub->$user_attr = $profile->id;
-+        $sub = new Subscription();
-+        $sub->$user_attr = $profile->id;
-hunk ./actions/twitapistatuses.php 499
--		$since = strtotime($this->trimmed('since'));
-+        $since = strtotime($this->trimmed('since'));
-hunk ./actions/twitapistatuses.php 501
--		if ($since) {
--			$d = date('Y-m-d H:i:s', $since);
--			$sub->whereAdd("created > '$d'");
--		}
-+        if ($since) {
-+            $d = date('Y-m-d H:i:s', $since);
-+            $sub->whereAdd("created > '$d'");
-+        }
-hunk ./actions/twitapistatuses.php 506
--		$sub->orderBy('created DESC');
--		$sub->limit(($page-1)*100, 100);
-+        $sub->orderBy('created DESC');
-+        $sub->limit(($page-1)*100, 100);
-hunk ./actions/twitapistatuses.php 509
--		$others = array();
-+        $others = array();
-hunk ./actions/twitapistatuses.php 511
--		if ($sub->find()) {
--			while ($sub->fetch()) {
--				$others[] = Profile::staticGet($sub->$other_attr);
--			}
--		} else {
--			// user has no followers
--		}
-+        if ($sub->find()) {
-+            while ($sub->fetch()) {
-+                $others[] = Profile::staticGet($sub->$other_attr);
-+            }
-+        } else {
-+            // user has no followers
-+        }
-hunk ./actions/twitapistatuses.php 519
--		$type = $apidata['content-type'];
-+        $type = $apidata['content-type'];
-hunk ./actions/twitapistatuses.php 521
--		$this->init_document($type);
--		$this->show_profiles($others, $type);
--		$this->end_document($type);
--	}
-+        $this->init_document($type);
-+        $this->show_profiles($others, $type);
-+        $this->end_document($type);
-+    }
-hunk ./actions/twitapistatuses.php 526
--	function show_profiles($profiles, $type) {
--		switch ($type) {
--		 case 'xml':
--			common_element_start('users', array('type' => 'array'));
--			foreach ($profiles as $profile) {
--				$this->show_profile($profile);
--			}
--			common_element_end('users');
--			break;
--		 case 'json':
--			$arrays = array();
--			foreach ($profiles as $profile) {
--				$arrays[] = $this->twitter_user_array($profile, true);
--			}
--			print json_encode($arrays);
--			break;
--		 default:
--			$this->client_error(_('unsupported file type'));
--		}
--	}
-+    function show_profiles($profiles, $type) {
-+        switch ($type) {
-+         case 'xml':
-+            common_element_start('users', array('type' => 'array'));
-+            foreach ($profiles as $profile) {
-+                $this->show_profile($profile);
-+            }
-+            common_element_end('users');
-+            break;
-+         case 'json':
-+            $arrays = array();
-+            foreach ($profiles as $profile) {
-+                $arrays[] = $this->twitter_user_array($profile, true);
-+            }
-+            print json_encode($arrays);
-+            break;
-+         default:
-+            $this->client_error(_('unsupported file type'));
-+        }
-+    }
-hunk ./actions/twitapistatuses.php 547
--	function featured($args, $apidata) {
--		parent::handle($args);
--		common_server_error(_('API method under construction.'), $code=501);
--	}
-+    function featured($args, $apidata) {
-+        parent::handle($args);
-+        common_server_error(_('API method under construction.'), $code=501);
-+    }
-hunk ./actions/twitapistatuses.php 552
--	function supported($cmd) {
-+    function supported($cmd) {
-hunk ./actions/twitapistatuses.php 554
--		$cmdlist = array('MessageCommand', 'SubCommand', 'UnsubCommand', 'FavCommand', 'OnCommand', 'OffCommand');
-+        $cmdlist = array('MessageCommand', 'SubCommand', 'UnsubCommand', 'FavCommand', 'OnCommand', 'OffCommand');
-hunk ./actions/twitapistatuses.php 556
--		if (in_array(get_class($cmd), $cmdlist)) {
--			return true;
--		}
-+        if (in_array(get_class($cmd), $cmdlist)) {
-+            return true;
-+        }
-hunk ./actions/twitapistatuses.php 560
--		return false;
--	}
-+        return false;
-+    }
-hunk ./actions/twitapiusers.php 13
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./actions/twitapiusers.php 17
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./actions/twitapiusers.php 26
--	function show($args, $apidata) {
--		parent::handle($args);
-+    function show($args, $apidata) {
-+        parent::handle($args);
-hunk ./actions/twitapiusers.php 29
--		if (!in_array($apidata['content-type'], array('xml', 'json'))) {
--			common_user_error(_('API method not found!'), $code = 404);
--			return;
--		}
-+        if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-+            common_user_error(_('API method not found!'), $code = 404);
-+            return;
-+        }
-hunk ./actions/twitapiusers.php 34
--		$user = null;
--		$email = $this->arg('email');
-+        $user = null;
-+        $email = $this->arg('email');
-hunk ./actions/twitapiusers.php 37
--		if ($email) {
--			$user = User::staticGet('email', $email);
--		} elseif (isset($apidata['api_arg'])) {
--			$user = $this->get_user($apidata['api_arg']);
--		}
-+        if ($email) {
-+            $user = User::staticGet('email', $email);
-+        } elseif (isset($apidata['api_arg'])) {
-+            $user = $this->get_user($apidata['api_arg']);
-+        }
-hunk ./actions/twitapiusers.php 43
--		if (!$user) {
--			// XXX: Twitter returns a random(?) user instead of throwing and err! -- Zach
--			$this->client_error(_('Not found.'), 404, $apidata['content-type']);
--			return;
--		}
-+        if (!$user) {
-+            // XXX: Twitter returns a random(?) user instead of throwing and err! -- Zach
-+            $this->client_error(_('Not found.'), 404, $apidata['content-type']);
-+            return;
-+        }
-hunk ./actions/twitapiusers.php 49
--		$this->show_extended_profile($user, $apidata);
--	}
-+        $this->show_extended_profile($user, $apidata);
-+    }
-hunk ./actions/twittersettings.php 28
--	function get_instructions() {
--		return _('Add your Twitter account to automatically send your notices to Twitter, ' .
--			'and subscribe to Twitter friends already here.');
--	}
-+    function get_instructions() {
-+        return _('Add your Twitter account to automatically send your notices to Twitter, ' .
-+            'and subscribe to Twitter friends already here.');
-+    }
+-            $reply_to = NULL;
++            $reply_to = null;
 hunk ./actions/twittersettings.php 33
--	function show_form($msg=NULL, $success=false) {
--		$user = common_current_user();
--		$profile = $user->getProfile();
--		$fuser = NULL;
--		$flink = Foreign_link::getByUserID($user->id, 1); // 1 == Twitter
-+    function show_form($msg=NULL, $success=false) {
-+        $user = common_current_user();
-+        $profile = $user->getProfile();
-+        $fuser = NULL;
-+        $flink = Foreign_link::getByUserID($user->id, 1); // 1 == Twitter
-hunk ./actions/twittersettings.php 39
--		if ($flink) {
--			$fuser = $flink->getForeignUser();
--		}
-+        if ($flink) {
-+            $fuser = $flink->getForeignUser();
-+        }
-hunk ./actions/twittersettings.php 43
--		$this->form_header(_('Twitter settings'), $msg, $success);
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'twittersettings',
--										   'action' =>
--										   common_local_url('twittersettings')));
--		common_hidden('token', common_session_token());
-+        $this->form_header(_('Twitter settings'), $msg, $success);
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'twittersettings',
-+                                           'action' =>
-+                                           common_local_url('twittersettings')));
-+        common_hidden('token', common_session_token());
+-    function show_form($msg=NULL, $success=false) {
++    function show_form($msg=null, $success=false) {
+hunk ./actions/twittersettings.php 36
+-        $fuser = NULL;
++        $fuser = null;
 hunk ./actions/twittersettings.php 50
--		common_element('h2', NULL, _('Twitter Account'));
-+        common_element('h2', NULL, _('Twitter Account'));
-hunk ./actions/twittersettings.php 52
--		if ($fuser) {
--			common_element_start('p');
-+        if ($fuser) {
-+            common_element_start('p');
-hunk ./actions/twittersettings.php 55
--			common_element('span', 'twitter_user', $fuser->nickname);
--			common_element('a', array('href' => $fuser->uri),  $fuser->uri);
--			common_element('span', 'input_instructions',
--			               _('Current verified Twitter account.'));
--			common_hidden('flink_foreign_id', $flink->foreign_id);
--			common_element_end('p');
--			common_submit('remove', _('Remove'));
--		} else {
--			common_input('twitter_username', _('Twitter user name'),
--						 ($this->arg('twitter_username')) ? $this->arg('twitter_username') : $profile->nickname,
--						 _('No spaces, please.')); // hey, it's what Twitter says
-+            common_element('span', 'twitter_user', $fuser->nickname);
-+            common_element('a', array('href' => $fuser->uri),  $fuser->uri);
-+            common_element('span', 'input_instructions',
-+                           _('Current verified Twitter account.'));
-+            common_hidden('flink_foreign_id', $flink->foreign_id);
-+            common_element_end('p');
-+            common_submit('remove', _('Remove'));
-+        } else {
-+            common_input('twitter_username', _('Twitter user name'),
-+                         ($this->arg('twitter_username')) ? $this->arg('twitter_username') : $profile->nickname,
-+                         _('No spaces, please.')); // hey, it's what Twitter says
-hunk ./actions/twittersettings.php 67
--			common_password('twitter_password', _('Twitter password'));
--		}
-+            common_password('twitter_password', _('Twitter password'));
-+        }
+-        common_element('h2', NULL, _('Twitter Account'));
++        common_element('h2', null, _('Twitter Account'));
 hunk ./actions/twittersettings.php 70
--		common_element('h2', NULL, _('Preferences'));
-+        common_element('h2', NULL, _('Preferences'));
-hunk ./actions/twittersettings.php 72
--		common_checkbox('noticesync', _('Automatically send my notices to Twitter.'),
--						($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
-+        common_checkbox('noticesync', _('Automatically send my notices to Twitter.'),
-+                        ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
-hunk ./actions/twittersettings.php 75
--		common_checkbox('replysync', _('Send local "@" replies to Twitter.'),
--						($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
-+        common_checkbox('replysync', _('Send local "@" replies to Twitter.'),
-+                        ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
-hunk ./actions/twittersettings.php 78
--		common_checkbox('friendsync', _('Subscribe to my Twitter friends here.'),
--						($flink) ? ($flink->friendsync & FOREIGN_FRIEND_RECV) : false);
-+        common_checkbox('friendsync', _('Subscribe to my Twitter friends here.'),
-+                        ($flink) ? ($flink->friendsync & FOREIGN_FRIEND_RECV) : false);
-hunk ./actions/twittersettings.php 81
--		if ($flink) {
--			common_submit('save', _('Save'));
--		} else {
--			common_submit('add', _('Add'));
--		}
-+        if ($flink) {
-+            common_submit('save', _('Save'));
-+        } else {
-+            common_submit('add', _('Add'));
-+        }
-hunk ./actions/twittersettings.php 87
--		$this->show_twitter_subscriptions();
-+        $this->show_twitter_subscriptions();
-hunk ./actions/twittersettings.php 89
--		common_element_end('form');
-+        common_element_end('form');
-hunk ./actions/twittersettings.php 91
--		common_show_footer();
--	}
-+        common_show_footer();
-+    }
-hunk ./actions/twittersettings.php 94
--	function subscribed_twitter_users() {
-+    function subscribed_twitter_users() {
-hunk ./actions/twittersettings.php 96
--		$current_user = common_current_user();
-+        $current_user = common_current_user();
-hunk ./actions/twittersettings.php 98
--		$qry = 'SELECT user.* ' .
--			'FROM subscription ' .
--			'JOIN user ON subscription.subscribed = user.id ' .
--			'JOIN foreign_link ON foreign_link.user_id = user.id ' .
--			'WHERE subscriber = %d ' .
--			'ORDER BY user.nickname';
-+        $qry = 'SELECT user.* ' .
-+            'FROM subscription ' .
-+            'JOIN user ON subscription.subscribed = user.id ' .
-+            'JOIN foreign_link ON foreign_link.user_id = user.id ' .
-+            'WHERE subscriber = %d ' .
-+            'ORDER BY user.nickname';
-hunk ./actions/twittersettings.php 105
--		$user = new User();
-+        $user = new User();
-hunk ./actions/twittersettings.php 107
--		$user->query(sprintf($qry, $current_user->id));
-+        $user->query(sprintf($qry, $current_user->id));
-hunk ./actions/twittersettings.php 109
--		$users = array();
-+        $users = array();
-hunk ./actions/twittersettings.php 111
--		while ($user->fetch()) {
-+        while ($user->fetch()) {
-hunk ./actions/twittersettings.php 113
--			// Don't include the user's own self-subscription
--			if ($user->id != $current_user->id) {
--				$users[] = clone($user);
--			}
--		}
-+            // Don't include the user's own self-subscription
-+            if ($user->id != $current_user->id) {
-+                $users[] = clone($user);
-+            }
-+        }
-hunk ./actions/twittersettings.php 119
--		return $users;
--	}
-+        return $users;
-+    }
-hunk ./actions/twittersettings.php 122
--	function show_twitter_subscriptions() {
-+    function show_twitter_subscriptions() {
-hunk ./actions/twittersettings.php 124
--		$friends = $this->subscribed_twitter_users();
--		$friends_count = count($friends);
-+        $friends = $this->subscribed_twitter_users();
-+        $friends_count = count($friends);
-hunk ./actions/twittersettings.php 127
--		if ($friends_count > 0) {
-+        if ($friends_count > 0) {
+-        common_element('h2', NULL, _('Preferences'));
++        common_element('h2', null, _('Preferences'));
 hunk ./actions/twittersettings.php 129
--			common_element('h3', NULL, _('Twitter Friends'));
--			common_element_start('div', array('id' => 'subscriptions'));
--			common_element_start('ul', array('id' => 'subscriptions_avatars'));
-+            common_element('h3', NULL, _('Twitter Friends'));
-+            common_element_start('div', array('id' => 'subscriptions'));
-+            common_element_start('ul', array('id' => 'subscriptions_avatars'));
-hunk ./actions/twittersettings.php 133
--			for ($i = 0; $i < min($friends_count, SUBSCRIPTIONS); $i++) {
-+            for ($i = 0; $i < min($friends_count, SUBSCRIPTIONS); $i++) {
-hunk ./actions/twittersettings.php 135
--				$other = Profile::staticGet($friends[$i]->id);
-+                $other = Profile::staticGet($friends[$i]->id);
-hunk ./actions/twittersettings.php 137
--				if (!$other) {
--					common_log_db_error($subs, 'SELECT', __FILE__);
--					continue;
--				}
-+                if (!$other) {
-+                    common_log_db_error($subs, 'SELECT', __FILE__);
-+                    continue;
-+                }
-hunk ./actions/twittersettings.php 142
--				common_element_start('li');
--				common_element_start('a', array('title' => ($other->fullname) ?
--												$other->fullname :
--												$other->nickname,
--												'href' => $other->profileurl,
--												'rel' => 'contact',
--												'class' => 'subscription'));
--				$avatar = $other->getAvatar(AVATAR_MINI_SIZE);
--				common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) :  common_default_avatar(AVATAR_MINI_SIZE)),
--											'width' => AVATAR_MINI_SIZE,
--											'height' => AVATAR_MINI_SIZE,
--											'class' => 'avatar mini',
--											'alt' =>  ($other->fullname) ?
--											$other->fullname :
--											$other->nickname));
--				common_element_end('a');
--				common_element_end('li');
-+                common_element_start('li');
-+                common_element_start('a', array('title' => ($other->fullname) ?
-+                                                $other->fullname :
-+                                                $other->nickname,
-+                                                'href' => $other->profileurl,
-+                                                'rel' => 'contact',
-+                                                'class' => 'subscription'));
-+                $avatar = $other->getAvatar(AVATAR_MINI_SIZE);
-+                common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) :  common_default_avatar(AVATAR_MINI_SIZE)),
-+                                            'width' => AVATAR_MINI_SIZE,
-+                                            'height' => AVATAR_MINI_SIZE,
-+                                            'class' => 'avatar mini',
-+                                            'alt' =>  ($other->fullname) ?
-+                                            $other->fullname :
-+                                            $other->nickname));
-+                common_element_end('a');
-+                common_element_end('li');
-hunk ./actions/twittersettings.php 160
--			}
-+            }
-hunk ./actions/twittersettings.php 162
--			common_element_end('ul');
--			common_element_end('div');
-+            common_element_end('ul');
-+            common_element_end('div');
-hunk ./actions/twittersettings.php 165
--		}
-+        }
-hunk ./actions/twittersettings.php 167
--		// XXX Figure out a way to show all Twitter friends... ?
-+        // XXX Figure out a way to show all Twitter friends... ?
-hunk ./actions/twittersettings.php 169
--		/*
--		if ($subs_count > SUBSCRIPTIONS) {
--			common_element_start('p', array('id' => 'subscriptions_viewall'));
-+        /*
-+        if ($subs_count > SUBSCRIPTIONS) {
-+            common_element_start('p', array('id' => 'subscriptions_viewall'));
-hunk ./actions/twittersettings.php 173
--			common_element('a', array('href' => common_local_url('subscriptions',
--																 array('nickname' => $profile->nickname)),
--									  'class' => 'moresubscriptions'),
--						   _('All subscriptions'));
--			common_element_end('p');
--		}
--		*/
-+            common_element('a', array('href' => common_local_url('subscriptions',
-+                                                                 array('nickname' => $profile->nickname)),
-+                                      'class' => 'moresubscriptions'),
-+                           _('All subscriptions'));
-+            common_element_end('p');
-+        }
-+        */
-hunk ./actions/twittersettings.php 181
--	}
-+    }
-hunk ./actions/twittersettings.php 183
--	function handle_post() {
-+    function handle_post() {
-hunk ./actions/twittersettings.php 185
--		# CSRF protection
--		$token = $this->trimmed('token');
--		if (!$token || $token != common_session_token()) {
--			$this->show_form(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        # CSRF protection
-+        $token = $this->trimmed('token');
-+        if (!$token || $token != common_session_token()) {
-+            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/twittersettings.php 192
--		if ($this->arg('save')) {
--			$this->save_preferences();
--		} else if ($this->arg('add')) {
--			$this->add_twitter_acct();
--		} else if ($this->arg('remove')) {
--			$this->remove_twitter_acct();
--		} else {
--			$this->show_form(_('Unexpected form submission.'));
--		}
--	}
-+        if ($this->arg('save')) {
-+            $this->save_preferences();
-+        } else if ($this->arg('add')) {
-+            $this->add_twitter_acct();
-+        } else if ($this->arg('remove')) {
-+            $this->remove_twitter_acct();
-+        } else {
-+            $this->show_form(_('Unexpected form submission.'));
-+        }
-+    }
-hunk ./actions/twittersettings.php 203
--	function add_twitter_acct() {
-+    function add_twitter_acct() {
-hunk ./actions/twittersettings.php 205
--		$screen_name = $this->trimmed('twitter_username');
--		$password = $this->trimmed('twitter_password');
--		$noticesync = $this->boolean('noticesync');
--		$replysync = $this->boolean('replysync');
--		$friendsync = $this->boolean('friendsync');
-+        $screen_name = $this->trimmed('twitter_username');
-+        $password = $this->trimmed('twitter_password');
-+        $noticesync = $this->boolean('noticesync');
-+        $replysync = $this->boolean('replysync');
-+        $friendsync = $this->boolean('friendsync');
-hunk ./actions/twittersettings.php 211
--		if (!Validate::string($screen_name,
--				array(	'min_length' => 1,
--						'max_length' => 15,
--			 			'format' => VALIDATE_NUM . VALIDATE_ALPHA . '_'))) {
--			$this->show_form(
--				_('Username must have only numbers, upper- and lowercase letters, and underscore (_). 15 chars max.'));
--			return;
--		}
-+        if (!Validate::string($screen_name,
-+                array(    'min_length' => 1,
-+                        'max_length' => 15,
-+                         'format' => VALIDATE_NUM . VALIDATE_ALPHA . '_'))) {
-+            $this->show_form(
-+                _('Username must have only numbers, upper- and lowercase letters, and underscore (_). 15 chars max.'));
-+            return;
-+        }
-hunk ./actions/twittersettings.php 220
--		if (!$this->verify_credentials($screen_name, $password)) {
--			$this->show_form(_('Could not verify your Twitter credentials!'));
--			return;
--		}
-+        if (!$this->verify_credentials($screen_name, $password)) {
-+            $this->show_form(_('Could not verify your Twitter credentials!'));
-+            return;
-+        }
-hunk ./actions/twittersettings.php 225
--		$twit_user = twitter_user_info($screen_name, $password);
-+        $twit_user = twitter_user_info($screen_name, $password);
-hunk ./actions/twittersettings.php 227
--		if (!$twit_user) {
--			$this->show_form(sprintf(_('Unable to retrieve account information for "%s" from Twitter.'),
--				$screen_name));
--			return;
--		}
-+        if (!$twit_user) {
-+            $this->show_form(sprintf(_('Unable to retrieve account information for "%s" from Twitter.'),
-+                $screen_name));
-+            return;
-+        }
-hunk ./actions/twittersettings.php 233
--		if (!save_twitter_user($twit_user->id, $screen_name)) {
--			$this->show_form(_('Unable to save your Twitter settings!'));
--			return;
--		}
-+        if (!save_twitter_user($twit_user->id, $screen_name)) {
-+            $this->show_form(_('Unable to save your Twitter settings!'));
-+            return;
-+        }
-hunk ./actions/twittersettings.php 238
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/twittersettings.php 240
--		$flink = DB_DataObject::factory('foreign_link');
--		$flink->user_id = $user->id;
--		$flink->foreign_id = $twit_user->id;
--		$flink->service = 1; // Twitter
--		$flink->credentials = $password;
--		$flink->created = common_sql_now();
-+        $flink = DB_DataObject::factory('foreign_link');
-+        $flink->user_id = $user->id;
-+        $flink->foreign_id = $twit_user->id;
-+        $flink->service = 1; // Twitter
-+        $flink->credentials = $password;
-+        $flink->created = common_sql_now();
-hunk ./actions/twittersettings.php 247
--		$this->set_flags($flink, $noticesync, $replysync, $friendsync);
-+        $this->set_flags($flink, $noticesync, $replysync, $friendsync);
-hunk ./actions/twittersettings.php 249
--		$flink_id = $flink->insert();
-+        $flink_id = $flink->insert();
-hunk ./actions/twittersettings.php 251
--		if (!$flink_id) {
--			common_log_db_error($flink, 'INSERT', __FILE__);
--			$this->show_form(_('Unable to save your Twitter settings!'));
--			return;
--		}
-+        if (!$flink_id) {
-+            common_log_db_error($flink, 'INSERT', __FILE__);
-+            $this->show_form(_('Unable to save your Twitter settings!'));
-+            return;
-+        }
-hunk ./actions/twittersettings.php 257
--		if ($friendsync) {
--			save_twitter_friends($user, $twit_user->id, $screen_name, $password);
--		}
-+        if ($friendsync) {
-+            save_twitter_friends($user, $twit_user->id, $screen_name, $password);
-+        }
-hunk ./actions/twittersettings.php 261
--		$this->show_form(_('Twitter settings saved.'), true);
--	}
-+        $this->show_form(_('Twitter settings saved.'), true);
-+    }
-hunk ./actions/twittersettings.php 264
--	function remove_twitter_acct() {
-+    function remove_twitter_acct() {
-hunk ./actions/twittersettings.php 266
--		$user = common_current_user();
--		$flink = Foreign_link::getByUserID($user->id, 1);
--		$flink_foreign_id = $this->arg('flink_foreign_id');
-+        $user = common_current_user();
-+        $flink = Foreign_link::getByUserID($user->id, 1);
-+        $flink_foreign_id = $this->arg('flink_foreign_id');
-hunk ./actions/twittersettings.php 270
--		# Maybe an old tab open...?
--		if ($flink->foreign_id != $flink_foreign_id) {
--		    $this->show_form(_('That is not your Twitter account.'));
--		    return;
--		}
-+        # Maybe an old tab open...?
-+        if ($flink->foreign_id != $flink_foreign_id) {
-+            $this->show_form(_('That is not your Twitter account.'));
-+            return;
-+        }
-hunk ./actions/twittersettings.php 276
--		$result = $flink->delete();
-+        $result = $flink->delete();
-hunk ./actions/twittersettings.php 278
--		if (!$result) {
--			common_log_db_error($flink, 'DELETE', __FILE__);
--			common_server_error(_('Couldn\'t remove Twitter user.'));
--			return;
--		}
-+        if (!$result) {
-+            common_log_db_error($flink, 'DELETE', __FILE__);
-+            common_server_error(_('Couldn\'t remove Twitter user.'));
-+            return;
-+        }
-hunk ./actions/twittersettings.php 284
--		$this->show_form(_('Twitter account removed.'), TRUE);
--	}
-+        $this->show_form(_('Twitter account removed.'), TRUE);
-+    }
-hunk ./actions/twittersettings.php 287
--	function save_preferences() {
-+    function save_preferences() {
-hunk ./actions/twittersettings.php 289
--		$noticesync = $this->boolean('noticesync');
--		$friendsync = $this->boolean('friendsync');
--		$replysync = $this->boolean('replysync');
-+        $noticesync = $this->boolean('noticesync');
-+        $friendsync = $this->boolean('friendsync');
-+        $replysync = $this->boolean('replysync');
-hunk ./actions/twittersettings.php 293
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/twittersettings.php 295
--		$flink = Foreign_link::getByUserID($user->id, 1);
-+        $flink = Foreign_link::getByUserID($user->id, 1);
-hunk ./actions/twittersettings.php 297
--		if (!$flink) {
--			common_log_db_error($flink, 'SELECT', __FILE__);
--			$this->show_form(_('Couldn\'t save Twitter preferences.'));
--			return;
--		}
-+        if (!$flink) {
-+            common_log_db_error($flink, 'SELECT', __FILE__);
-+            $this->show_form(_('Couldn\'t save Twitter preferences.'));
-+            return;
-+        }
-hunk ./actions/twittersettings.php 303
--		$twitter_id = $flink->foreign_id;
--		$password = $flink->credentials;
-+        $twitter_id = $flink->foreign_id;
-+        $password = $flink->credentials;
-hunk ./actions/twittersettings.php 306
--		$fuser = $flink->getForeignUser();
-+        $fuser = $flink->getForeignUser();
-hunk ./actions/twittersettings.php 308
--		if (!$fuser) {
--			common_log_db_error($fuser, 'SELECT', __FILE__);
--			$this->show_form(_('Couldn\'t save Twitter preferences.'));
--			return;
--		}
-+        if (!$fuser) {
-+            common_log_db_error($fuser, 'SELECT', __FILE__);
-+            $this->show_form(_('Couldn\'t save Twitter preferences.'));
-+            return;
-+        }
-hunk ./actions/twittersettings.php 314
--		$screen_name = $fuser->nickname;
-+        $screen_name = $fuser->nickname;
-hunk ./actions/twittersettings.php 316
--		$original = clone($flink);
--		$this->set_flags($flink, $noticesync, $replysync, $friendsync);
--		$result = $flink->update($original);
-+        $original = clone($flink);
-+        $this->set_flags($flink, $noticesync, $replysync, $friendsync);
-+        $result = $flink->update($original);
-hunk ./actions/twittersettings.php 320
--		if ($result === FALSE) {
--			common_log_db_error($flink, 'UPDATE', __FILE__);
--			$this->show_form(_('Couldn\'t save Twitter preferences.'));
--			return;
--		}
-+        if ($result === FALSE) {
-+            common_log_db_error($flink, 'UPDATE', __FILE__);
-+            $this->show_form(_('Couldn\'t save Twitter preferences.'));
-+            return;
-+        }
-hunk ./actions/twittersettings.php 326
--		if ($friendsync) {
--			save_twitter_friends($user, $flink->foreign_id, $screen_name, $password);
--		}
-+        if ($friendsync) {
-+            save_twitter_friends($user, $flink->foreign_id, $screen_name, $password);
-+        }
-hunk ./actions/twittersettings.php 330
--		$this->show_form(_('Twitter preferences saved.'));
--	}
-+        $this->show_form(_('Twitter preferences saved.'));
-+    }
-hunk ./actions/twittersettings.php 333
--	function verify_credentials($screen_name, $password) {
--		$uri = 'http://twitter.com/account/verify_credentials.json';
--		$data = get_twitter_data($uri, $screen_name, $password);
-+    function verify_credentials($screen_name, $password) {
-+        $uri = 'http://twitter.com/account/verify_credentials.json';
-+        $data = get_twitter_data($uri, $screen_name, $password);
-hunk ./actions/twittersettings.php 337
--		if (!$data) {
--			return false;
--		}
-+        if (!$data) {
-+            return false;
-+        }
-hunk ./actions/twittersettings.php 341
--		$user = json_decode($data);
-+        $user = json_decode($data);
-hunk ./actions/twittersettings.php 343
--		if (!$user) {
--			return false;
--		}
-+        if (!$user) {
-+            return false;
-+        }
-hunk ./actions/twittersettings.php 347
--	 	$twitter_id = $user->status->id;
-+         $twitter_id = $user->status->id;
-hunk ./actions/twittersettings.php 349
--		if ($twitter_id) {
--			return $twitter_id;
--		}
-+        if ($twitter_id) {
-+            return $twitter_id;
-+        }
-hunk ./actions/twittersettings.php 353
--		return false;
--	}
-+        return false;
-+    }
-hunk ./actions/twittersettings.php 356
--	function set_flags(&$flink, $noticesync, $replysync, $friendsync) {
--		if ($noticesync) {
--			$flink->noticesync |= FOREIGN_NOTICE_SEND;
--		} else {
--			$flink->noticesync &= ~FOREIGN_NOTICE_SEND;
--		}
-+    function set_flags(&$flink, $noticesync, $replysync, $friendsync) {
-+        if ($noticesync) {
-+            $flink->noticesync |= FOREIGN_NOTICE_SEND;
-+        } else {
-+            $flink->noticesync &= ~FOREIGN_NOTICE_SEND;
-+        }
-hunk ./actions/twittersettings.php 363
--		if ($replysync) {
--			$flink->noticesync |= FOREIGN_NOTICE_SEND_REPLY;
--		} else {
--			$flink->noticesync &= ~FOREIGN_NOTICE_SEND_REPLY;
--		}
-+        if ($replysync) {
-+            $flink->noticesync |= FOREIGN_NOTICE_SEND_REPLY;
-+        } else {
-+            $flink->noticesync &= ~FOREIGN_NOTICE_SEND_REPLY;
-+        }
-hunk ./actions/twittersettings.php 369
--		if ($friendsync) {
--			$flink->friendsync |= FOREIGN_FRIEND_RECV;
--		} else {
--			$flink->friendsync &= ~FOREIGN_FRIEND_RECV;
--		}
-+        if ($friendsync) {
-+            $flink->friendsync |= FOREIGN_FRIEND_RECV;
-+        } else {
-+            $flink->friendsync &= ~FOREIGN_FRIEND_RECV;
-+        }
-hunk ./actions/twittersettings.php 375
--		$flink->profilesync = 0;
--	}
-+        $flink->profilesync = 0;
-+    }
-hunk ./actions/unblock.php 35
--		$token = $this->trimmed('token');
-+        $token = $this->trimmed('token');
-hunk ./actions/unblock.php 37
--		if (!$token || $token != common_session_token()) {
--			$this->client_error(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        if (!$token || $token != common_session_token()) {
-+            $this->client_error(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/unsubscribe.php 22
--	function handle($args) {
--		parent::handle($args);
--		if (!common_logged_in()) {
--			common_user_error(_('Not logged in.'));
--			return;
--		}
-+    function handle($args) {
-+        parent::handle($args);
-+        if (!common_logged_in()) {
-+            common_user_error(_('Not logged in.'));
-+            return;
-+        }
-hunk ./actions/unsubscribe.php 29
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./actions/unsubscribe.php 31
--		if ($_SERVER['REQUEST_METHOD'] != 'POST') {
--			common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
--			return;
--		}
-+        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-+            common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
-+            return;
-+        }
-hunk ./actions/unsubscribe.php 36
--		# CSRF protection
-+        # CSRF protection
-hunk ./actions/unsubscribe.php 38
--		$token = $this->trimmed('token');
-+        $token = $this->trimmed('token');
-hunk ./actions/unsubscribe.php 40
--		if (!$token || $token != common_session_token()) {
--			$this->client_error(_('There was a problem with your session token. Try again, please.'));
--			return;
--		}
-+        if (!$token || $token != common_session_token()) {
-+            $this->client_error(_('There was a problem with your session token. Try again, please.'));
-+            return;
-+        }
-hunk ./actions/unsubscribe.php 45
--		$other_id = $this->arg('unsubscribeto');
-+        $other_id = $this->arg('unsubscribeto');
-hunk ./actions/unsubscribe.php 59
--		$result = subs_unsubscribe_to($user, $other);
-+        $result = subs_unsubscribe_to($user, $other);
-hunk ./actions/unsubscribe.php 61
--		if ($result != true) {
--			common_user_error($result);
--			return;
--		}
-+        if ($result != true) {
-+            common_user_error($result);
-+            return;
-+        }
-hunk ./actions/unsubscribe.php 66
--		if ($this->boolean('ajax')) {
--			common_start_html('text/xml;charset=utf-8', true);
--			common_element_start('head');
--			common_element('title', null, _('Unsubscribed'));
--			common_element_end('head');
--			common_element_start('body');
--			common_subscribe_form($other);
--			common_element_end('body');
--			common_element_end('html');
--		} else {
--    		common_redirect(common_local_url('subscriptions', array('nickname' =>
--	    															$user->nickname)));
-+        if ($this->boolean('ajax')) {
-+            common_start_html('text/xml;charset=utf-8', true);
-+            common_element_start('head');
-+            common_element('title', null, _('Unsubscribed'));
-+            common_element_end('head');
-+            common_element_start('body');
-+            common_subscribe_form($other);
-+            common_element_end('body');
-+            common_element_end('html');
-+        } else {
-+            common_redirect(common_local_url('subscriptions', array('nickname' =>
-+                                                                    $user->nickname)));
-hunk ./actions/unsubscribe.php 79
--	}
-+    }
-hunk ./actions/updateprofile.php 25
--	
--	function handle($args) {
--		parent::handle($args);
--		try {
--			common_remove_magic_from_request();
--			$req = OAuthRequest::from_request();
--			# Note: server-to-server function!
--			$server = omb_oauth_server();
--			list($consumer, $token) = $server->verify_request($req);
--			if ($this->update_profile($req, $consumer, $token)) {
--				print "omb_version=".OMB_VERSION_01;
--			}
--		} catch (OAuthException $e) {
--			$this->server_error($e->getMessage());
--			return;
--		}
--	}
-+    
-+    function handle($args) {
-+        parent::handle($args);
-+        try {
-+            common_remove_magic_from_request();
-+            $req = OAuthRequest::from_request();
-+            # Note: server-to-server function!
-+            $server = omb_oauth_server();
-+            list($consumer, $token) = $server->verify_request($req);
-+            if ($this->update_profile($req, $consumer, $token)) {
-+                print "omb_version=".OMB_VERSION_01;
-+            }
-+        } catch (OAuthException $e) {
-+            $this->server_error($e->getMessage());
-+            return;
-+        }
-+    }
-hunk ./actions/updateprofile.php 43
--	function update_profile($req, $consumer, $token) {
--		$version = $req->get_parameter('omb_version');
--		if ($version != OMB_VERSION_01) {
--			$this->client_error(_('Unsupported OMB version'), 400);
--			return false;
--		}
--		# First, check to see if listenee exists
--		$listenee =  $req->get_parameter('omb_listenee');
--		$remote = Remote_profile::staticGet('uri', $listenee);
--		if (!$remote) {
--			$this->client_error(_('Profile unknown'), 404);
--			return false;
--		}
--		# Second, check to see if they should be able to post updates!
--		# We see if there are any subscriptions to that remote user with
--		# the given token.
-+    function update_profile($req, $consumer, $token) {
-+        $version = $req->get_parameter('omb_version');
-+        if ($version != OMB_VERSION_01) {
-+            $this->client_error(_('Unsupported OMB version'), 400);
-+            return false;
-+        }
-+        # First, check to see if listenee exists
-+        $listenee =  $req->get_parameter('omb_listenee');
-+        $remote = Remote_profile::staticGet('uri', $listenee);
-+        if (!$remote) {
-+            $this->client_error(_('Profile unknown'), 404);
-+            return false;
-+        }
-+        # Second, check to see if they should be able to post updates!
-+        # We see if there are any subscriptions to that remote user with
-+        # the given token.
-hunk ./actions/updateprofile.php 60
--		$sub = new Subscription();
--		$sub->subscribed = $remote->id;
--		$sub->token = $token->key;
--		if (!$sub->find(true)) {
--			$this->client_error(_('You did not send us that profile'), 403);
--			return false;
--		}
-+        $sub = new Subscription();
-+        $sub->subscribed = $remote->id;
-+        $sub->token = $token->key;
-+        if (!$sub->find(true)) {
-+            $this->client_error(_('You did not send us that profile'), 403);
-+            return false;
-+        }
-hunk ./actions/updateprofile.php 68
--		$profile = Profile::staticGet('id', $remote->id);
--		if (!$profile) {
--			# This one is our fault
--			$this->server_error(_('Remote profile with no matching profile'), 500);
--			return false;
--		}
--		$nickname = $req->get_parameter('omb_listenee_nickname');
--		if ($nickname && !Validate::string($nickname, array('min_length' => 1,
--															'max_length' => 64,
--															'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
--			$this->client_error(_('Nickname must have only lowercase letters and numbers and no spaces.'));
--			return false;
--		}
--		$license = $req->get_parameter('omb_listenee_license');
--		if ($license && !common_valid_http_url($license)) {
--			$this->client_error(sprintf(_("Invalid license URL '%s'"), $license));
--			return false;
--		}
--		$profile_url = $req->get_parameter('omb_listenee_profile');
--		if ($profile_url && !common_valid_http_url($profile_url)) {
--			$this->client_error(sprintf(_("Invalid profile URL '%s'."), $profile_url));
--			return false;
--		}
--		# optional stuff
--		$fullname = $req->get_parameter('omb_listenee_fullname');
--		if ($fullname && strlen($fullname) > 255) {
--			$this->client_error(_("Full name is too long (max 255 chars)."));
--			return false;
--		}
--		$homepage = $req->get_parameter('omb_listenee_homepage');
--		if ($homepage && (!common_valid_http_url($homepage) || strlen($homepage) > 255)) {
--			$this->client_error(sprintf(_("Invalid homepage '%s'"), $homepage));
--			return false;
--		}
--		$bio = $req->get_parameter('omb_listenee_bio');
--		if ($bio && strlen($bio) > 140) {
--			$this->client_error(_("Bio is too long (max 140 chars)."));
--			return false;
--		}
--		$location = $req->get_parameter('omb_listenee_location');
--		if ($location && strlen($location) > 255) {
--			$this->client_error(_("Location is too long (max 255 chars)."));
--			return false;
--		}
--		$avatar = $req->get_parameter('omb_listenee_avatar');
--		if ($avatar) {
--			if (!common_valid_http_url($avatar) || strlen($avatar) > 255) {
--				$this->client_error(sprintf(_("Invalid avatar URL '%s'"), $avatar));
--				return false;
--			}
--			$size = @getimagesize($avatar);
--			if (!$size) {
--				$this->client_error(sprintf(_("Can't read avatar URL '%s'"), $avatar));
--				return false;
--			}
--			if ($size[0] != AVATAR_PROFILE_SIZE || $size[1] != AVATAR_PROFILE_SIZE) {
--				$this->client_error(sprintf(_("Wrong size image at '%s'"), $avatar));
--				return false;
--			}
--			if (!in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG,
--										  IMAGETYPE_PNG))) {
--				$this->client_error(sprintf(_("Wrong image type for '%s'"), $avatar));
--				return false;
--			}
--		}
-+        $profile = Profile::staticGet('id', $remote->id);
-+        if (!$profile) {
-+            # This one is our fault
-+            $this->server_error(_('Remote profile with no matching profile'), 500);
-+            return false;
-+        }
-+        $nickname = $req->get_parameter('omb_listenee_nickname');
-+        if ($nickname && !Validate::string($nickname, array('min_length' => 1,
-+                                                            'max_length' => 64,
-+                                                            'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
-+            $this->client_error(_('Nickname must have only lowercase letters and numbers and no spaces.'));
-+            return false;
-+        }
-+        $license = $req->get_parameter('omb_listenee_license');
-+        if ($license && !common_valid_http_url($license)) {
-+            $this->client_error(sprintf(_("Invalid license URL '%s'"), $license));
-+            return false;
-+        }
-+        $profile_url = $req->get_parameter('omb_listenee_profile');
-+        if ($profile_url && !common_valid_http_url($profile_url)) {
-+            $this->client_error(sprintf(_("Invalid profile URL '%s'."), $profile_url));
-+            return false;
-+        }
-+        # optional stuff
-+        $fullname = $req->get_parameter('omb_listenee_fullname');
-+        if ($fullname && strlen($fullname) > 255) {
-+            $this->client_error(_("Full name is too long (max 255 chars)."));
-+            return false;
-+        }
-+        $homepage = $req->get_parameter('omb_listenee_homepage');
-+        if ($homepage && (!common_valid_http_url($homepage) || strlen($homepage) > 255)) {
-+            $this->client_error(sprintf(_("Invalid homepage '%s'"), $homepage));
-+            return false;
-+        }
-+        $bio = $req->get_parameter('omb_listenee_bio');
-+        if ($bio && strlen($bio) > 140) {
-+            $this->client_error(_("Bio is too long (max 140 chars)."));
-+            return false;
-+        }
-+        $location = $req->get_parameter('omb_listenee_location');
-+        if ($location && strlen($location) > 255) {
-+            $this->client_error(_("Location is too long (max 255 chars)."));
-+            return false;
-+        }
-+        $avatar = $req->get_parameter('omb_listenee_avatar');
-+        if ($avatar) {
-+            if (!common_valid_http_url($avatar) || strlen($avatar) > 255) {
-+                $this->client_error(sprintf(_("Invalid avatar URL '%s'"), $avatar));
-+                return false;
-+            }
-+            $size = @getimagesize($avatar);
-+            if (!$size) {
-+                $this->client_error(sprintf(_("Can't read avatar URL '%s'"), $avatar));
-+                return false;
-+            }
-+            if ($size[0] != AVATAR_PROFILE_SIZE || $size[1] != AVATAR_PROFILE_SIZE) {
-+                $this->client_error(sprintf(_("Wrong size image at '%s'"), $avatar));
-+                return false;
-+            }
-+            if (!in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG,
-+                                          IMAGETYPE_PNG))) {
-+                $this->client_error(sprintf(_("Wrong image type for '%s'"), $avatar));
-+                return false;
-+            }
-+        }
-hunk ./actions/updateprofile.php 134
--		$orig_profile = clone($profile);
-+        $orig_profile = clone($profile);
-hunk ./actions/updateprofile.php 136
--		if ($nickname) {
--			$profile->nickname = $nickname;
--		}
--		if ($profile_url) {
--			$profile->profileurl = $profile_url;
--		}
--		if ($fullname) {
--			$profile->fullname = $fullname;
--		}
--		if ($homepage) {
--			$profile->homepage = $homepage;
--		}
--		if ($bio) {
--			$profile->bio = $bio;
--		}
--		if ($location) {
--			$profile->location = $location;
--		}
-+        if ($nickname) {
-+            $profile->nickname = $nickname;
-+        }
-+        if ($profile_url) {
-+            $profile->profileurl = $profile_url;
-+        }
-+        if ($fullname) {
-+            $profile->fullname = $fullname;
-+        }
-+        if ($homepage) {
-+            $profile->homepage = $homepage;
-+        }
-+        if ($bio) {
-+            $profile->bio = $bio;
-+        }
-+        if ($location) {
-+            $profile->location = $location;
-+        }
-hunk ./actions/updateprofile.php 155
--		if (!$profile->update($orig_profile)) {
--			$this->server_error(_('Could not save new profile info'), 500);
--			return false;
--		} else {
--			if ($avatar) {
--				$temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
--				copy($avatar, $temp_filename);
--				if (!$profile->setOriginal($temp_filename)) {
--					$this->server_error(_('Could not save avatar info'), 500);
--					return false;
--				}
--			}
--			header('HTTP/1.1 200 OK');
--			header('Content-type: text/plain');
--			print 'Updated profile';
--			print "\n";
--			return true;
--		}
--	}
-+        if (!$profile->update($orig_profile)) {
-+            $this->server_error(_('Could not save new profile info'), 500);
-+            return false;
-+        } else {
-+            if ($avatar) {
-+                $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
-+                copy($avatar, $temp_filename);
-+                if (!$profile->setOriginal($temp_filename)) {
-+                    $this->server_error(_('Could not save avatar info'), 500);
-+                    return false;
-+                }
-+            }
-+            header('HTTP/1.1 200 OK');
-+            header('Content-type: text/plain');
-+            print 'Updated profile';
-+            print "\n";
-+            return true;
-+        }
-+    }
-hunk ./actions/userauthorization.php 27
--	function handle($args) {
--		parent::handle($args);
-+    function handle($args) {
-+        parent::handle($args);
-hunk ./actions/userauthorization.php 30
--		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
--			# CSRF protection
--			$token = $this->trimmed('token');
--			if (!$token || $token != common_session_token()) {
--				$req = $this->get_stored_request();
--				$this->show_form(_('There was a problem with your session token. Try again, please.'), $req);
--				return;
--			}
--			# We've shown the form, now post user's choice
--			$this->send_authorization();
--		} else {
--			if (!common_logged_in()) {
--				# Go log in, and then come back
--				common_debug('saving URL for returnto', __FILE__);
--				common_set_returnto($_SERVER['REQUEST_URI']);
-+        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-+            # CSRF protection
-+            $token = $this->trimmed('token');
-+            if (!$token || $token != common_session_token()) {
-+                $req = $this->get_stored_request();
-+                $this->show_form(_('There was a problem with your session token. Try again, please.'), $req);
-+                return;
-+            }
-+            # We've shown the form, now post user's choice
-+            $this->send_authorization();
-+        } else {
-+            if (!common_logged_in()) {
-+                # Go log in, and then come back
-+                common_debug('saving URL for returnto', __FILE__);
-+                common_set_returnto($_SERVER['REQUEST_URI']);
-hunk ./actions/userauthorization.php 46
--				common_debug('redirecting to login', __FILE__);
--				common_redirect(common_local_url('login'));
--				return;
--			}
--			try {
--				# this must be a new request
--				common_debug('getting new request', __FILE__);
--				$req = $this->get_new_request();
--				if (!$req) {
--					$this->client_error(_('No request found!'));
--				}
--				common_debug('validating request', __FILE__);
--				# XXX: only validate new requests, since nonce is one-time use
--				$this->validate_request($req);
--				common_debug('showing form', __FILE__);
--				$this->store_request($req);
--				$this->show_form($req);
--			} catch (OAuthException $e) {
--				$this->clear_request();
--				$this->client_error($e->getMessage());
--				return;
--			}
-+                common_debug('redirecting to login', __FILE__);
-+                common_redirect(common_local_url('login'));
-+                return;
-+            }
-+            try {
-+                # this must be a new request
-+                common_debug('getting new request', __FILE__);
-+                $req = $this->get_new_request();
-+                if (!$req) {
-+                    $this->client_error(_('No request found!'));
-+                }
-+                common_debug('validating request', __FILE__);
-+                # XXX: only validate new requests, since nonce is one-time use
-+                $this->validate_request($req);
-+                common_debug('showing form', __FILE__);
-+                $this->store_request($req);
-+                $this->show_form($req);
-+            } catch (OAuthException $e) {
-+                $this->clear_request();
-+                $this->client_error($e->getMessage());
-+                return;
-+            }
-hunk ./actions/userauthorization.php 69
--		}
--	}
-+        }
-+    }
-hunk ./actions/userauthorization.php 72
--	function show_form($req) {
-+    function show_form($req) {
-hunk ./actions/userauthorization.php 74
--		$nickname = $req->get_parameter('omb_listenee_nickname');
--		$profile = $req->get_parameter('omb_listenee_profile');
--		$license = $req->get_parameter('omb_listenee_license');
--		$fullname = $req->get_parameter('omb_listenee_fullname');
--		$homepage = $req->get_parameter('omb_listenee_homepage');
--		$bio = $req->get_parameter('omb_listenee_bio');
--		$location = $req->get_parameter('omb_listenee_location');
--		$avatar = $req->get_parameter('omb_listenee_avatar');
-+        $nickname = $req->get_parameter('omb_listenee_nickname');
-+        $profile = $req->get_parameter('omb_listenee_profile');
-+        $license = $req->get_parameter('omb_listenee_license');
-+        $fullname = $req->get_parameter('omb_listenee_fullname');
-+        $homepage = $req->get_parameter('omb_listenee_homepage');
-+        $bio = $req->get_parameter('omb_listenee_bio');
-+        $location = $req->get_parameter('omb_listenee_location');
-+        $avatar = $req->get_parameter('omb_listenee_avatar');
-hunk ./actions/userauthorization.php 83
--		common_show_header(_('Authorize subscription'));
--		common_element('p', NULL, _('Please check these details to make sure '.
--									 'that you want to subscribe to this user\'s notices. '.
--									 'If you didn\'t just ask to subscribe to someone\'s notices, '.
--									 'click "Cancel".'));
--		common_element_start('div', 'profile');
--		if ($avatar) {
--			common_element('img', array('src' => $avatar,
--										'class' => 'avatar profile',
--										'width' => AVATAR_PROFILE_SIZE,
--										'height' => AVATAR_PROFILE_SIZE,
--										'alt' => $nickname));
--		}
--		common_element('a', array('href' => $profile,
--								  'class' => 'external profile nickname'),
--					   $nickname);
--		if ($fullname) {
--			common_element_start('div', 'fullname');
--			if ($homepage) {
--				common_element('a', array('href' => $homepage),
--							   $fullname);
--			} else {
--				common_text($fullname);
--			}
--			common_element_end('div');
--		}
--		if ($location) {
--			common_element('div', 'location', $location);
--		}
--		if ($bio) {
--			common_element('div', 'bio', $bio);
--		}
--		common_element_start('div', 'license');
--		common_element('a', array('href' => $license,
--								  'class' => 'license'),
--					   $license);
--		common_element_end('div');
--		common_element_end('div');
--		common_element_start('form', array('method' => 'post',
--										   'id' => 'userauthorization',
--										   'name' => 'userauthorization',
--										   'action' => common_local_url('userauthorization')));
--		common_hidden('token', common_session_token());
--		common_submit('accept', _('Accept'));
--		common_submit('reject', _('Reject'));
--		common_element_end('form');
--		common_show_footer();
--	}
-+        common_show_header(_('Authorize subscription'));
-+        common_element('p', NULL, _('Please check these details to make sure '.
-+                                     'that you want to subscribe to this user\'s notices. '.
-+                                     'If you didn\'t just ask to subscribe to someone\'s notices, '.
-+                                     'click "Cancel".'));
-+        common_element_start('div', 'profile');
-+        if ($avatar) {
-+            common_element('img', array('src' => $avatar,
-+                                        'class' => 'avatar profile',
-+                                        'width' => AVATAR_PROFILE_SIZE,
-+                                        'height' => AVATAR_PROFILE_SIZE,
-+                                        'alt' => $nickname));
-+        }
-+        common_element('a', array('href' => $profile,
-+                                  'class' => 'external profile nickname'),
-+                       $nickname);
-+        if ($fullname) {
-+            common_element_start('div', 'fullname');
-+            if ($homepage) {
-+                common_element('a', array('href' => $homepage),
-+                               $fullname);
-+            } else {
-+                common_text($fullname);
-+            }
-+            common_element_end('div');
-+        }
-+        if ($location) {
-+            common_element('div', 'location', $location);
-+        }
-+        if ($bio) {
-+            common_element('div', 'bio', $bio);
-+        }
-+        common_element_start('div', 'license');
-+        common_element('a', array('href' => $license,
-+                                  'class' => 'license'),
-+                       $license);
-+        common_element_end('div');
-+        common_element_end('div');
-+        common_element_start('form', array('method' => 'post',
-+                                           'id' => 'userauthorization',
-+                                           'name' => 'userauthorization',
-+                                           'action' => common_local_url('userauthorization')));
-+        common_hidden('token', common_session_token());
-+        common_submit('accept', _('Accept'));
-+        common_submit('reject', _('Reject'));
-+        common_element_end('form');
-+        common_show_footer();
-+    }
-hunk ./actions/userauthorization.php 132
--	function send_authorization() {
--		$req = $this->get_stored_request();
-+    function send_authorization() {
-+        $req = $this->get_stored_request();
-hunk ./actions/userauthorization.php 135
--		if (!$req) {
--			common_user_error(_('No authorization request!'));
--			return;
--		}
-+        if (!$req) {
-+            common_user_error(_('No authorization request!'));
-+            return;
-+        }
-hunk ./actions/userauthorization.php 140
--		$callback = $req->get_parameter('oauth_callback');
-+        $callback = $req->get_parameter('oauth_callback');
-hunk ./actions/userauthorization.php 142
--		if ($this->arg('accept')) {
--			if (!$this->authorize_token($req)) {
--				$this->client_error(_('Error authorizing token'));
--			}
--			if (!$this->save_remote_profile($req)) {
--				$this->client_error(_('Error saving remote profile'));
--			}
--			if (!$callback) {
--				$this->show_accept_message($req->get_parameter('oauth_token'));
--			} else {
--				$params = array();
--				$params['oauth_token'] = $req->get_parameter('oauth_token');
--				$params['omb_version'] = OMB_VERSION_01;
--				$user = User::staticGet('uri', $req->get_parameter('omb_listener'));
--				$profile = $user->getProfile();
--				if (!$profile) {
--					common_log_db_error($user, 'SELECT', __FILE__);
--					$this->server_error(_('User without matching profile'));
--					return;
--				}
--				$params['omb_listener_nickname'] = $user->nickname;
--				$params['omb_listener_profile'] = common_local_url('showstream',
--																   array('nickname' => $user->nickname));
--				if ($profile->fullname) {
--					$params['omb_listener_fullname'] = $profile->fullname;
--				}
--				if ($profile->homepage) {
--					$params['omb_listener_homepage'] = $profile->homepage;
--				}
--				if ($profile->bio) {
--					$params['omb_listener_bio'] = $profile->bio;
--				}
--				if ($profile->location) {
--					$params['omb_listener_location'] = $profile->location;
--				}
--				$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
--				if ($avatar) {
--					$params['omb_listener_avatar'] = $avatar->url;
--				}
--				$parts = array();
--				foreach ($params as $k => $v) {
--					$parts[] = $k . '=' . OAuthUtil::urlencodeRFC3986($v);
--				}
--				$query_string = implode('&', $parts);
--				$parsed = parse_url($callback);
--				$url = $callback . (($parsed['query']) ? '&' : '?') . $query_string;
--				common_redirect($url, 303);
--			}
--		} else {
--			if (!$callback) {
--				$this->show_reject_message();
--			} else {
--				# XXX: not 100% sure how to signal failure... just redirect without token?
--				common_redirect($callback, 303);
--			}
--		}
--	}
-+        if ($this->arg('accept')) {
-+            if (!$this->authorize_token($req)) {
-+                $this->client_error(_('Error authorizing token'));
-+            }
-+            if (!$this->save_remote_profile($req)) {
-+                $this->client_error(_('Error saving remote profile'));
-+            }
-+            if (!$callback) {
-+                $this->show_accept_message($req->get_parameter('oauth_token'));
-+            } else {
-+                $params = array();
-+                $params['oauth_token'] = $req->get_parameter('oauth_token');
-+                $params['omb_version'] = OMB_VERSION_01;
-+                $user = User::staticGet('uri', $req->get_parameter('omb_listener'));
-+                $profile = $user->getProfile();
-+                if (!$profile) {
-+                    common_log_db_error($user, 'SELECT', __FILE__);
-+                    $this->server_error(_('User without matching profile'));
-+                    return;
-+                }
-+                $params['omb_listener_nickname'] = $user->nickname;
-+                $params['omb_listener_profile'] = common_local_url('showstream',
-+                                                                   array('nickname' => $user->nickname));
-+                if ($profile->fullname) {
-+                    $params['omb_listener_fullname'] = $profile->fullname;
-+                }
-+                if ($profile->homepage) {
-+                    $params['omb_listener_homepage'] = $profile->homepage;
-+                }
-+                if ($profile->bio) {
-+                    $params['omb_listener_bio'] = $profile->bio;
-+                }
-+                if ($profile->location) {
-+                    $params['omb_listener_location'] = $profile->location;
-+                }
-+                $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-+                if ($avatar) {
-+                    $params['omb_listener_avatar'] = $avatar->url;
-+                }
-+                $parts = array();
-+                foreach ($params as $k => $v) {
-+                    $parts[] = $k . '=' . OAuthUtil::urlencodeRFC3986($v);
-+                }
-+                $query_string = implode('&', $parts);
-+                $parsed = parse_url($callback);
-+                $url = $callback . (($parsed['query']) ? '&' : '?') . $query_string;
-+                common_redirect($url, 303);
-+            }
-+        } else {
-+            if (!$callback) {
-+                $this->show_reject_message();
-+            } else {
-+                # XXX: not 100% sure how to signal failure... just redirect without token?
-+                common_redirect($callback, 303);
-+            }
-+        }
-+    }
-hunk ./actions/userauthorization.php 200
--	function authorize_token(&$req) {
--		$consumer_key = $req->get_parameter('oauth_consumer_key');
--		$token_field = $req->get_parameter('oauth_token');
--		common_debug('consumer key = "'.$consumer_key.'"', __FILE__);
--		common_debug('token field = "'.$token_field.'"', __FILE__);
--		$rt = new Token();
--		$rt->consumer_key = $consumer_key;
--		$rt->tok = $token_field;
--		$rt->type = 0;
--		$rt->state = 0;
--		common_debug('request token to look up: "'.print_r($rt,TRUE).'"');
--		if ($rt->find(true)) {
--			common_debug('found request token to authorize', __FILE__);
--			$orig_rt = clone($rt);
--			$rt->state = 1; # Authorized but not used
--			if ($rt->update($orig_rt)) {
--				common_debug('updated request token so it is authorized', __FILE__);
--				return true;
--			}
--		}
--		return FALSE;
--	}
-+    function authorize_token(&$req) {
-+        $consumer_key = $req->get_parameter('oauth_consumer_key');
-+        $token_field = $req->get_parameter('oauth_token');
-+        common_debug('consumer key = "'.$consumer_key.'"', __FILE__);
-+        common_debug('token field = "'.$token_field.'"', __FILE__);
-+        $rt = new Token();
-+        $rt->consumer_key = $consumer_key;
-+        $rt->tok = $token_field;
-+        $rt->type = 0;
-+        $rt->state = 0;
-+        common_debug('request token to look up: "'.print_r($rt,TRUE).'"');
-+        if ($rt->find(true)) {
-+            common_debug('found request token to authorize', __FILE__);
-+            $orig_rt = clone($rt);
-+            $rt->state = 1; # Authorized but not used
-+            if ($rt->update($orig_rt)) {
-+                common_debug('updated request token so it is authorized', __FILE__);
-+                return true;
-+            }
-+        }
-+        return FALSE;
-+    }
-hunk ./actions/userauthorization.php 223
--	# XXX: refactor with similar code in finishremotesubscribe.php
-+    # XXX: refactor with similar code in finishremotesubscribe.php
-hunk ./actions/userauthorization.php 225
--	function save_remote_profile(&$req) {
--		# FIXME: we should really do this when the consumer comes
--		# back for an access token. If they never do, we've got stuff in a
--		# weird state.
-+    function save_remote_profile(&$req) {
-+        # FIXME: we should really do this when the consumer comes
-+        # back for an access token. If they never do, we've got stuff in a
-+        # weird state.
-hunk ./actions/userauthorization.php 230
--		$nickname = $req->get_parameter('omb_listenee_nickname');
--		$fullname = $req->get_parameter('omb_listenee_fullname');
--		$profile_url = $req->get_parameter('omb_listenee_profile');
--		$homepage = $req->get_parameter('omb_listenee_homepage');
--		$bio = $req->get_parameter('omb_listenee_bio');
--		$location = $req->get_parameter('omb_listenee_location');
--		$avatar_url = $req->get_parameter('omb_listenee_avatar');
-+        $nickname = $req->get_parameter('omb_listenee_nickname');
-+        $fullname = $req->get_parameter('omb_listenee_fullname');
-+        $profile_url = $req->get_parameter('omb_listenee_profile');
-+        $homepage = $req->get_parameter('omb_listenee_homepage');
-+        $bio = $req->get_parameter('omb_listenee_bio');
-+        $location = $req->get_parameter('omb_listenee_location');
-+        $avatar_url = $req->get_parameter('omb_listenee_avatar');
-hunk ./actions/userauthorization.php 238
--		$listenee = $req->get_parameter('omb_listenee');
--		$remote = Remote_profile::staticGet('uri', $listenee);
-+        $listenee = $req->get_parameter('omb_listenee');
-+        $remote = Remote_profile::staticGet('uri', $listenee);
-hunk ./actions/userauthorization.php 241
--		if ($remote) {
--			$exists = true;
--			$profile = Profile::staticGet($remote->id);
--			$orig_remote = clone($remote);
--			$orig_profile = clone($profile);
--		} else {
--			$exists = false;
--			$remote = new Remote_profile();
--			$remote->uri = $listenee;
--			$profile = new Profile();
--		}
-+        if ($remote) {
-+            $exists = true;
-+            $profile = Profile::staticGet($remote->id);
-+            $orig_remote = clone($remote);
-+            $orig_profile = clone($profile);
-+        } else {
-+            $exists = false;
-+            $remote = new Remote_profile();
-+            $remote->uri = $listenee;
-+            $profile = new Profile();
-+        }
-hunk ./actions/userauthorization.php 253
--		$profile->nickname = $nickname;
--		$profile->profileurl = $profile_url;
-+        $profile->nickname = $nickname;
-+        $profile->profileurl = $profile_url;
-hunk ./actions/userauthorization.php 256
--		if ($fullname) {
--			$profile->fullname = $fullname;
--		}
--		if ($homepage) {
--			$profile->homepage = $homepage;
--		}
--		if ($bio) {
--			$profile->bio = $bio;
--		}
--		if ($location) {
--			$profile->location = $location;
--		}
-+        if ($fullname) {
-+            $profile->fullname = $fullname;
-+        }
-+        if ($homepage) {
-+            $profile->homepage = $homepage;
-+        }
-+        if ($bio) {
-+            $profile->bio = $bio;
-+        }
-+        if ($location) {
-+            $profile->location = $location;
-+        }
-hunk ./actions/userauthorization.php 269
--		if ($exists) {
--			$profile->update($orig_profile);
--		} else {
--			$profile->created = DB_DataObject_Cast::dateTime(); # current time
--			$id = $profile->insert();
--			if (!$id) {
--				return FALSE;
--			}
--			$remote->id = $id;
--		}
-+        if ($exists) {
-+            $profile->update($orig_profile);
-+        } else {
-+            $profile->created = DB_DataObject_Cast::dateTime(); # current time
-+            $id = $profile->insert();
-+            if (!$id) {
-+                return FALSE;
-+            }
-+            $remote->id = $id;
-+        }
-hunk ./actions/userauthorization.php 280
--		if ($exists) {
--			if (!$remote->update($orig_remote)) {
--				return FALSE;
--			}
--		} else {
--			$remote->created = DB_DataObject_Cast::dateTime(); # current time
--			if (!$remote->insert()) {
--				return FALSE;
--			}
--		}
-+        if ($exists) {
-+            if (!$remote->update($orig_remote)) {
-+                return FALSE;
-+            }
-+        } else {
-+            $remote->created = DB_DataObject_Cast::dateTime(); # current time
-+            if (!$remote->insert()) {
-+                return FALSE;
-+            }
-+        }
-hunk ./actions/userauthorization.php 291
--		if ($avatar_url) {
--			if (!$this->add_avatar($profile, $avatar_url)) {
--				return FALSE;
--			}
--		}
-+        if ($avatar_url) {
-+            if (!$this->add_avatar($profile, $avatar_url)) {
-+                return FALSE;
-+            }
-+        }
-hunk ./actions/userauthorization.php 297
--		$user = common_current_user();
--		$datastore = omb_oauth_datastore();
--		$consumer = $this->get_consumer($datastore, $req);
--		$token = $this->get_token($datastore, $req, $consumer);
-+        $user = common_current_user();
-+        $datastore = omb_oauth_datastore();
-+        $consumer = $this->get_consumer($datastore, $req);
-+        $token = $this->get_token($datastore, $req, $consumer);
-hunk ./actions/userauthorization.php 302
--		$sub = new Subscription();
--		$sub->subscriber = $user->id;
--		$sub->subscribed = $remote->id;
--		$sub->token = $token->key; # NOTE: request token, not valid for use!
--		$sub->created = DB_DataObject_Cast::dateTime(); # current time
-+        $sub = new Subscription();
-+        $sub->subscriber = $user->id;
-+        $sub->subscribed = $remote->id;
-+        $sub->token = $token->key; # NOTE: request token, not valid for use!
-+        $sub->created = DB_DataObject_Cast::dateTime(); # current time
-hunk ./actions/userauthorization.php 308
--		if (!$sub->insert()) {
--			return FALSE;
--		}
-+        if (!$sub->insert()) {
-+            return FALSE;
-+        }
-hunk ./actions/userauthorization.php 312
--		return TRUE;
--	}
-+        return TRUE;
-+    }
-hunk ./actions/userauthorization.php 315
--	function add_avatar($profile, $url) {
--		$temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
--		copy($url, $temp_filename);
--		return $profile->setOriginal($temp_filename);
--	}
-+    function add_avatar($profile, $url) {
-+        $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
-+        copy($url, $temp_filename);
-+        return $profile->setOriginal($temp_filename);
-+    }
-hunk ./actions/userauthorization.php 321
--	function show_accept_message($tok) {
--		common_show_header(_('Subscription authorized'));
--		common_element('p', NULL,
--					   _('The subscription has been authorized, but no '.
--						  'callback URL was passed. Check with the site\'s instructions for '.
--						  'details on how to authorize the subscription. Your subscription token is:'));
--		common_element('blockquote', 'token', $tok);
--		common_show_footer();
--	}
-+    function show_accept_message($tok) {
-+        common_show_header(_('Subscription authorized'));
-+        common_element('p', NULL,
-+                       _('The subscription has been authorized, but no '.
-+                          'callback URL was passed. Check with the site\'s instructions for '.
-+                          'details on how to authorize the subscription. Your subscription token is:'));
-+        common_element('blockquote', 'token', $tok);
-+        common_show_footer();
-+    }
-hunk ./actions/userauthorization.php 331
--	function show_reject_message($tok) {
--		common_show_header(_('Subscription rejected'));
--		common_element('p', NULL,
--					   _('The subscription has been rejected, but no '.
--						  'callback URL was passed. Check with the site\'s instructions for '.
--						  'details on how to fully reject the subscription.'));
--		common_show_footer();
--	}
-+    function show_reject_message($tok) {
-+        common_show_header(_('Subscription rejected'));
-+        common_element('p', NULL,
-+                       _('The subscription has been rejected, but no '.
-+                          'callback URL was passed. Check with the site\'s instructions for '.
-+                          'details on how to fully reject the subscription.'));
-+        common_show_footer();
-+    }
-hunk ./actions/userauthorization.php 340
--	function store_request($req) {
--		common_ensure_session();
--		$_SESSION['userauthorizationrequest'] = $req;
--	}
-+    function store_request($req) {
-+        common_ensure_session();
-+        $_SESSION['userauthorizationrequest'] = $req;
-+    }
-hunk ./actions/userauthorization.php 345
--	function clear_request() {
--		common_ensure_session();
--		unset($_SESSION['userauthorizationrequest']);
--	}
-+    function clear_request() {
-+        common_ensure_session();
-+        unset($_SESSION['userauthorizationrequest']);
-+    }
-hunk ./actions/userauthorization.php 350
--	function get_stored_request() {
--		common_ensure_session();
--		$req = $_SESSION['userauthorizationrequest'];
--		return $req;
--	}
-+    function get_stored_request() {
-+        common_ensure_session();
-+        $req = $_SESSION['userauthorizationrequest'];
-+        return $req;
-+    }
-hunk ./actions/userauthorization.php 356
--	function get_new_request() {
--		common_remove_magic_from_request();
--		$req = OAuthRequest::from_request();
--		return $req;
--	}
-+    function get_new_request() {
-+        common_remove_magic_from_request();
-+        $req = OAuthRequest::from_request();
-+        return $req;
-+    }
-hunk ./actions/userauthorization.php 362
--	# Throws an OAuthException if anything goes wrong
-+    # Throws an OAuthException if anything goes wrong
-hunk ./actions/userauthorization.php 364
--	function validate_request(&$req) {
--		# OAuth stuff -- have to copy from OAuth.php since they're
--		# all private methods, and there's no user-authentication method
--		common_debug('checking version', __FILE__);
--		$this->check_version($req);
--		common_debug('getting datastore', __FILE__);
--		$datastore = omb_oauth_datastore();
--		common_debug('getting consumer', __FILE__);
--		$consumer = $this->get_consumer($datastore, $req);
--		common_debug('getting token', __FILE__);
--		$token = $this->get_token($datastore, $req, $consumer);
--		common_debug('checking timestamp', __FILE__);
--		$this->check_timestamp($req);
--		common_debug('checking nonce', __FILE__);
--		$this->check_nonce($datastore, $req, $consumer, $token);
--		common_debug('checking signature', __FILE__);
--		$this->check_signature($req, $consumer, $token);
--		common_debug('validating omb stuff', __FILE__);
--		$this->validate_omb($req);
--		common_debug('done validating', __FILE__);
--		return true;
--	}
-+    function validate_request(&$req) {
-+        # OAuth stuff -- have to copy from OAuth.php since they're
-+        # all private methods, and there's no user-authentication method
-+        common_debug('checking version', __FILE__);
-+        $this->check_version($req);
-+        common_debug('getting datastore', __FILE__);
-+        $datastore = omb_oauth_datastore();
-+        common_debug('getting consumer', __FILE__);
-+        $consumer = $this->get_consumer($datastore, $req);
-+        common_debug('getting token', __FILE__);
-+        $token = $this->get_token($datastore, $req, $consumer);
-+        common_debug('checking timestamp', __FILE__);
-+        $this->check_timestamp($req);
-+        common_debug('checking nonce', __FILE__);
-+        $this->check_nonce($datastore, $req, $consumer, $token);
-+        common_debug('checking signature', __FILE__);
-+        $this->check_signature($req, $consumer, $token);
-+        common_debug('validating omb stuff', __FILE__);
-+        $this->validate_omb($req);
-+        common_debug('done validating', __FILE__);
-+        return true;
-+    }
-hunk ./actions/userauthorization.php 387
--	function validate_omb(&$req) {
--		foreach (array('omb_version', 'omb_listener', 'omb_listenee',
--					   'omb_listenee_profile', 'omb_listenee_nickname',
--					   'omb_listenee_license') as $param)
--		{
--			if (!$req->get_parameter($param)) {
--				throw new OAuthException("Required parameter '$param' not found");
--			}
--		}
--		# Now, OMB stuff
--		$version = $req->get_parameter('omb_version');
--		if ($version != OMB_VERSION_01) {
--			throw new OAuthException("OpenMicroBlogging version '$version' not supported");
--		}
--		$listener =	$req->get_parameter('omb_listener');
--		$user = User::staticGet('uri', $listener);
--		if (!$user) {
--			throw new OAuthException("Listener URI '$listener' not found here");
--		}
--		$cur = common_current_user();
--		if ($cur->id != $user->id) {
--			throw new OAuthException("Can't add for another user!");
--		}
--		$listenee = $req->get_parameter('omb_listenee');
--		if (!Validate::uri($listenee) &&
--			!common_valid_tag($listenee)) {
--			throw new OAuthException("Listenee URI '$listenee' not a recognizable URI");
--		}
--		if (strlen($listenee) > 255) {
--			throw new OAuthException("Listenee URI '$listenee' too long");
--		}
-+    function validate_omb(&$req) {
-+        foreach (array('omb_version', 'omb_listener', 'omb_listenee',
-+                       'omb_listenee_profile', 'omb_listenee_nickname',
-+                       'omb_listenee_license') as $param)
-+        {
-+            if (!$req->get_parameter($param)) {
-+                throw new OAuthException("Required parameter '$param' not found");
-+            }
-+        }
-+        # Now, OMB stuff
-+        $version = $req->get_parameter('omb_version');
-+        if ($version != OMB_VERSION_01) {
-+            throw new OAuthException("OpenMicroBlogging version '$version' not supported");
-+        }
-+        $listener =    $req->get_parameter('omb_listener');
-+        $user = User::staticGet('uri', $listener);
-+        if (!$user) {
-+            throw new OAuthException("Listener URI '$listener' not found here");
-+        }
-+        $cur = common_current_user();
-+        if ($cur->id != $user->id) {
-+            throw new OAuthException("Can't add for another user!");
-+        }
-+        $listenee = $req->get_parameter('omb_listenee');
-+        if (!Validate::uri($listenee) &&
-+            !common_valid_tag($listenee)) {
-+            throw new OAuthException("Listenee URI '$listenee' not a recognizable URI");
-+        }
-+        if (strlen($listenee) > 255) {
-+            throw new OAuthException("Listenee URI '$listenee' too long");
-+        }
-hunk ./actions/userauthorization.php 419
--		$other = User::staticGet('uri', $listenee);
--		if ($other) {
--			throw new OAuthException("Listenee URI '$listenee' is local user");
--		}
-+        $other = User::staticGet('uri', $listenee);
-+        if ($other) {
-+            throw new OAuthException("Listenee URI '$listenee' is local user");
-+        }
-hunk ./actions/userauthorization.php 424
--		$remote = Remote_profile::staticGet('uri', $listenee);
--		if ($remote) {
--			$sub = new Subscription();
--			$sub->subscriber = $user->id;
--			$sub->subscribed = $remote->id;
--			if ($sub->find(TRUE)) {
--				throw new OAuthException("Already subscribed to user!");
--			}
--		}
--		$nickname = $req->get_parameter('omb_listenee_nickname');
--		if (!Validate::string($nickname, array('min_length' => 1,
--											   'max_length' => 64,
--											   'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
--			throw new OAuthException('Nickname must have only letters and numbers and no spaces.');
--		}
--		$profile = $req->get_parameter('omb_listenee_profile');
--		if (!common_valid_http_url($profile)) {
--			throw new OAuthException("Invalid profile URL '$profile'.");
--		}
-+        $remote = Remote_profile::staticGet('uri', $listenee);
-+        if ($remote) {
-+            $sub = new Subscription();
-+            $sub->subscriber = $user->id;
-+            $sub->subscribed = $remote->id;
-+            if ($sub->find(TRUE)) {
-+                throw new OAuthException("Already subscribed to user!");
-+            }
-+        }
-+        $nickname = $req->get_parameter('omb_listenee_nickname');
-+        if (!Validate::string($nickname, array('min_length' => 1,
-+                                               'max_length' => 64,
-+                                               'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
-+            throw new OAuthException('Nickname must have only letters and numbers and no spaces.');
-+        }
-+        $profile = $req->get_parameter('omb_listenee_profile');
-+        if (!common_valid_http_url($profile)) {
-+            throw new OAuthException("Invalid profile URL '$profile'.");
-+        }
-hunk ./actions/userauthorization.php 444
--		if ($profile == common_local_url('showstream', array('nickname' => $nickname))) {
--			throw new OAuthException("Profile URL '$profile' is for a local user.");
--		}
-+        if ($profile == common_local_url('showstream', array('nickname' => $nickname))) {
-+            throw new OAuthException("Profile URL '$profile' is for a local user.");
-+        }
-hunk ./actions/userauthorization.php 448
--		$license = $req->get_parameter('omb_listenee_license');
--		if (!common_valid_http_url($license)) {
--			throw new OAuthException("Invalid license URL '$license'.");
--		}
--		$site_license = common_config('license', 'url');
--		if (!common_compatible_license($license, $site_license)) {
--			throw new OAuthException("Listenee stream license '$license' not compatible with site license '$site_license'.");
--		}
--		# optional stuff
--		$fullname = $req->get_parameter('omb_listenee_fullname');
--		if ($fullname && strlen($fullname) > 255) {
--			throw new OAuthException("Full name '$fullname' too long.");
--		}
--		$homepage = $req->get_parameter('omb_listenee_homepage');
--		if ($homepage && (!common_valid_http_url($homepage) || strlen($homepage) > 255)) {
--			throw new OAuthException("Invalid homepage '$homepage'");
--		}
--		$bio = $req->get_parameter('omb_listenee_bio');
--		if ($bio && strlen($bio) > 140) {
--			throw new OAuthException("Bio too long '$bio'");
--		}
--		$location = $req->get_parameter('omb_listenee_location');
--		if ($location && strlen($location) > 255) {
--			throw new OAuthException("Location too long '$location'");
--		}
--		$avatar = $req->get_parameter('omb_listenee_avatar');
--		if ($avatar) {
--			if (!common_valid_http_url($avatar) || strlen($avatar) > 255) {
--				throw new OAuthException("Invalid avatar URL '$avatar'");
--			}
--			$size = @getimagesize($avatar);
--			if (!$size) {
--				throw new OAuthException("Can't read avatar URL '$avatar'");
--			}
--			if ($size[0] != AVATAR_PROFILE_SIZE || $size[1] != AVATAR_PROFILE_SIZE) {
--				throw new OAuthException("Wrong size image at '$avatar'");
--			}
--			if (!in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG,
--										  IMAGETYPE_PNG))) {
--				throw new OAuthException("Wrong image type for '$avatar'");
--			}
--		}
--		$callback = $req->get_parameter('oauth_callback');
--		if ($callback && !common_valid_http_url($callback)) {
--			throw new OAuthException("Invalid callback URL '$callback'");
--		}
--		if ($callback && $callback == common_local_url('finishremotesubscribe')) {
--			throw new OAuthException("Callback URL '$callback' is for local site.");
--		}
--	}
-+        $license = $req->get_parameter('omb_listenee_license');
-+        if (!common_valid_http_url($license)) {
-+            throw new OAuthException("Invalid license URL '$license'.");
-+        }
-+        $site_license = common_config('license', 'url');
-+        if (!common_compatible_license($license, $site_license)) {
-+            throw new OAuthException("Listenee stream license '$license' not compatible with site license '$site_license'.");
-+        }
-+        # optional stuff
-+        $fullname = $req->get_parameter('omb_listenee_fullname');
-+        if ($fullname && strlen($fullname) > 255) {
-+            throw new OAuthException("Full name '$fullname' too long.");
-+        }
-+        $homepage = $req->get_parameter('omb_listenee_homepage');
-+        if ($homepage && (!common_valid_http_url($homepage) || strlen($homepage) > 255)) {
-+            throw new OAuthException("Invalid homepage '$homepage'");
-+        }
-+        $bio = $req->get_parameter('omb_listenee_bio');
-+        if ($bio && strlen($bio) > 140) {
-+            throw new OAuthException("Bio too long '$bio'");
-+        }
-+        $location = $req->get_parameter('omb_listenee_location');
-+        if ($location && strlen($location) > 255) {
-+            throw new OAuthException("Location too long '$location'");
-+        }
-+        $avatar = $req->get_parameter('omb_listenee_avatar');
-+        if ($avatar) {
-+            if (!common_valid_http_url($avatar) || strlen($avatar) > 255) {
-+                throw new OAuthException("Invalid avatar URL '$avatar'");
-+            }
-+            $size = @getimagesize($avatar);
-+            if (!$size) {
-+                throw new OAuthException("Can't read avatar URL '$avatar'");
-+            }
-+            if ($size[0] != AVATAR_PROFILE_SIZE || $size[1] != AVATAR_PROFILE_SIZE) {
-+                throw new OAuthException("Wrong size image at '$avatar'");
-+            }
-+            if (!in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG,
-+                                          IMAGETYPE_PNG))) {
-+                throw new OAuthException("Wrong image type for '$avatar'");
-+            }
-+        }
-+        $callback = $req->get_parameter('oauth_callback');
-+        if ($callback && !common_valid_http_url($callback)) {
-+            throw new OAuthException("Invalid callback URL '$callback'");
-+        }
-+        if ($callback && $callback == common_local_url('finishremotesubscribe')) {
-+            throw new OAuthException("Callback URL '$callback' is for local site.");
-+        }
-+    }
-hunk ./actions/userauthorization.php 499
--	# Snagged from OAuthServer
-+    # Snagged from OAuthServer
-hunk ./actions/userauthorization.php 501
--	function check_version(&$req) {
--		$version = $req->get_parameter("oauth_version");
--		if (!$version) {
--			$version = 1.0;
--		}
--		if ($version != 1.0) {
--			throw new OAuthException("OAuth version '$version' not supported");
--		}
--		return $version;
--	}
-+    function check_version(&$req) {
-+        $version = $req->get_parameter("oauth_version");
-+        if (!$version) {
-+            $version = 1.0;
-+        }
-+        if ($version != 1.0) {
-+            throw new OAuthException("OAuth version '$version' not supported");
-+        }
-+        return $version;
-+    }
-hunk ./actions/userauthorization.php 512
--	# Snagged from OAuthServer
-+    # Snagged from OAuthServer
-hunk ./actions/userauthorization.php 514
--	function get_consumer($datastore, $req) {
--		$consumer_key = @$req->get_parameter("oauth_consumer_key");
--		if (!$consumer_key) {
--			throw new OAuthException("Invalid consumer key");
--		}
-+    function get_consumer($datastore, $req) {
-+        $consumer_key = @$req->get_parameter("oauth_consumer_key");
-+        if (!$consumer_key) {
-+            throw new OAuthException("Invalid consumer key");
-+        }
-hunk ./actions/userauthorization.php 520
--		$consumer = $datastore->lookup_consumer($consumer_key);
--		if (!$consumer) {
--			throw new OAuthException("Invalid consumer");
--		}
--		return $consumer;
--	}
-+        $consumer = $datastore->lookup_consumer($consumer_key);
-+        if (!$consumer) {
-+            throw new OAuthException("Invalid consumer");
-+        }
-+        return $consumer;
-+    }
-hunk ./actions/userauthorization.php 527
--	# Mostly cadged from OAuthServer
-+    # Mostly cadged from OAuthServer
-hunk ./actions/userauthorization.php 529
--	function get_token($datastore, &$req, $consumer) {/*{{{*/
--		$token_field = @$req->get_parameter('oauth_token');
--		$token = $datastore->lookup_token($consumer, 'request', $token_field);
--		if (!$token) {
--			throw new OAuthException("Invalid $token_type token: $token_field");
--		}
--		return $token;
--	}
-+    function get_token($datastore, &$req, $consumer) {/*{{{*/
-+        $token_field = @$req->get_parameter('oauth_token');
-+        $token = $datastore->lookup_token($consumer, 'request', $token_field);
-+        if (!$token) {
-+            throw new OAuthException("Invalid $token_type token: $token_field");
-+        }
-+        return $token;
-+    }
-hunk ./actions/userauthorization.php 538
--	function check_timestamp(&$req) {
--		$timestamp = @$req->get_parameter('oauth_timestamp');
--		$now = time();
--		if ($now - $timestamp > TIMESTAMP_THRESHOLD) {
--			throw new OAuthException("Expired timestamp, yours $timestamp, ours $now");
--		}
--	}
-+    function check_timestamp(&$req) {
-+        $timestamp = @$req->get_parameter('oauth_timestamp');
-+        $now = time();
-+        if ($now - $timestamp > TIMESTAMP_THRESHOLD) {
-+            throw new OAuthException("Expired timestamp, yours $timestamp, ours $now");
-+        }
-+    }
-hunk ./actions/userauthorization.php 546
--	# NOTE: don't call twice on the same request; will fail!
--	function check_nonce(&$datastore, &$req, $consumer, $token) {
--		$timestamp = @$req->get_parameter('oauth_timestamp');
--		$nonce = @$req->get_parameter('oauth_nonce');
--		$found = $datastore->lookup_nonce($consumer, $token, $nonce, $timestamp);
--		if ($found) {
--			throw new OAuthException("Nonce already used");
--		}
--		return true;
--	}
-+    # NOTE: don't call twice on the same request; will fail!
-+    function check_nonce(&$datastore, &$req, $consumer, $token) {
-+        $timestamp = @$req->get_parameter('oauth_timestamp');
-+        $nonce = @$req->get_parameter('oauth_nonce');
-+        $found = $datastore->lookup_nonce($consumer, $token, $nonce, $timestamp);
-+        if ($found) {
-+            throw new OAuthException("Nonce already used");
-+        }
-+        return true;
-+    }
-hunk ./actions/userauthorization.php 557
--	function check_signature(&$req, $consumer, $token) {
--		$signature_method = $this->get_signature_method($req);
--		$signature = $req->get_parameter('oauth_signature');
--		$valid_sig = $signature_method->check_signature($req,
--														$consumer,
--														$token,
--														$signature);
--		if (!$valid_sig) {
--			throw new OAuthException("Invalid signature");
--		}
--	}
-+    function check_signature(&$req, $consumer, $token) {
-+        $signature_method = $this->get_signature_method($req);
-+        $signature = $req->get_parameter('oauth_signature');
-+        $valid_sig = $signature_method->check_signature($req,
-+                                                        $consumer,
-+                                                        $token,
-+                                                        $signature);
-+        if (!$valid_sig) {
-+            throw new OAuthException("Invalid signature");
-+        }
-+    }
-hunk ./actions/userauthorization.php 569
--	function get_signature_method(&$req) {
--		$signature_method = @$req->get_parameter("oauth_signature_method");
--		if (!$signature_method) {
--			$signature_method = "PLAINTEXT";
--		}
--		if ($signature_method != 'HMAC-SHA1') {
--			throw new OAuthException("Signature method '$signature_method' not supported.");
--		}
--		return omb_hmac_sha1();
--	}
-+    function get_signature_method(&$req) {
-+        $signature_method = @$req->get_parameter("oauth_signature_method");
-+        if (!$signature_method) {
-+            $signature_method = "PLAINTEXT";
-+        }
-+        if ($signature_method != 'HMAC-SHA1') {
-+            throw new OAuthException("Signature method '$signature_method' not supported.");
-+        }
-+        return omb_hmac_sha1();
-+    }
-hunk ./actions/userbyid.php 23
--	
--	function is_readonly() {				
--		return true;
--	}
--	
-+    
-+    function is_readonly() {                
-+        return true;
-+    }
-+    
-hunk ./actions/userbyid.php 32
--        	$this->client_error(_('No id.'));
--		}
--		$user =& User::staticGet($id);
--		if (!$user) {
--			$this->client_error(_('No such user.'));
-+            $this->client_error(_('No id.'));
-+        }
-+        $user =& User::staticGet($id);
-+        if (!$user) {
-+            $this->client_error(_('No such user.'));
-hunk ./actions/userbyid.php 42
--    	$type = common_negotiate_type(common_accept_to_prefs($httpaccept),
-+        $type = common_negotiate_type(common_accept_to_prefs($httpaccept),
-hunk ./actions/userbyid.php 44
--		$page = $type == 'application/rdf+xml' ? 'foaf' : 'showstream';
-+        $page = $type == 'application/rdf+xml' ? 'foaf' : 'showstream';
-hunk ./actions/userbyid.php 46
--		$url = common_local_url($page, array('nickname' => $user->nickname));
--		common_redirect($url, 303);
--	}
-+        $url = common_local_url($page, array('nickname' => $user->nickname));
-+        common_redirect($url, 303);
-+    }
+-            common_element('h3', NULL, _('Twitter Friends'));
++            common_element('h3', null, _('Twitter Friends'));
+hunk ./actions/unblock.php 24
+-    var $profile = NULL;
++    var $profile = null;
+hunk ./actions/userauthorization.php 84
+-        common_element('p', NULL, _('Please check these details to make sure '.
++        common_element('p', null, _('Please check these details to make sure '.
+hunk ./actions/userauthorization.php 323
+-        common_element('p', NULL,
++        common_element('p', null,
+hunk ./actions/userauthorization.php 333
+-        common_element('p', NULL,
++        common_element('p', null,
+hunk ./actions/userbyid.php 41
+-        $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : NULL;
++        $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
 hunk ./actions/userrss.php 28
--	var $user = NULL;
-+    var $user = NULL;
-hunk ./actions/userrss.php 30
--	function init() {
--		$nickname = $this->trimmed('nickname');
--		$this->user = User::staticGet('nickname', $nickname);
-+    function init() {
-+        $nickname = $this->trimmed('nickname');
-+        $this->user = User::staticGet('nickname', $nickname);
-hunk ./actions/userrss.php 34
--		if (!$this->user) {
--			common_user_error(_('No such user.'));
--			return false;
--		} else {
--			return true;
--		}
--	}
-+        if (!$this->user) {
-+            common_user_error(_('No such user.'));
-+            return false;
-+        } else {
-+            return true;
-+        }
-+    }
-hunk ./actions/userrss.php 42
--	function get_notices($limit=0) {
-+    function get_notices($limit=0) {
-hunk ./actions/userrss.php 44
--		$user = $this->user;
--		
--		if (is_null($user)) {
--			return NULL;
--		}
--		
--		$notice = $user->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
--		
--		while ($notice->fetch()) {
--			$notices[] = clone($notice);
--		}
-+        $user = $this->user;
-+        
-+        if (is_null($user)) {
-+            return NULL;
-+        }
-+        
-+        $notice = $user->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
-+        
-+        while ($notice->fetch()) {
-+            $notices[] = clone($notice);
-+        }
-hunk ./actions/userrss.php 56
--		return $notices;
--	}
-+        return $notices;
-+    }
-hunk ./actions/userrss.php 59
--	function get_channel() {
--		$user = $this->user;
--		$profile = $user->getProfile();
--		$c = array('url' => common_local_url('userrss',
--											 array('nickname' =>
--												   $user->nickname)),
--				   'title' => $user->nickname,
--				   'link' => $profile->profileurl,
--				   'description' => sprintf(_('Microblog by %s'), $user->nickname));
--		return $c;
--	}
-+    function get_channel() {
-+        $user = $this->user;
-+        $profile = $user->getProfile();
-+        $c = array('url' => common_local_url('userrss',
-+                                             array('nickname' =>
-+                                                   $user->nickname)),
-+                   'title' => $user->nickname,
-+                   'link' => $profile->profileurl,
-+                   'description' => sprintf(_('Microblog by %s'), $user->nickname));
-+        return $c;
-+    }
-hunk ./actions/userrss.php 71
--	function get_image() {
--		$user = $this->user;
--		$profile = $user->getProfile();
--		if (!$profile) {
--			common_log_db_error($user, 'SELECT', __FILE__);
--			$this->server_error(_('User without matching profile'));
--			return NULL;
--		}
--		$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
--		return ($avatar) ? $avatar->url : NULL;
--	}
-+    function get_image() {
-+        $user = $this->user;
-+        $profile = $user->getProfile();
-+        if (!$profile) {
-+            common_log_db_error($user, 'SELECT', __FILE__);
-+            $this->server_error(_('User without matching profile'));
-+            return NULL;
-+        }
-+        $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-+        return ($avatar) ? $avatar->url : NULL;
-+    }
-hunk ./actions/userrss.php 83
--	# override parent to add X-SUP-ID URL
--	
--	function init_rss($limit=0) {
--		$url = common_local_url('sup', NULL, $this->user->id);
--		header('X-SUP-ID: '.$url);
--		parent::init_rss($limit);
--	}
-+    # override parent to add X-SUP-ID URL
-+    
-+    function init_rss($limit=0) {
-+        $url = common_local_url('sup', NULL, $this->user->id);
-+        header('X-SUP-ID: '.$url);
-+        parent::init_rss($limit);
-+    }
-hunk ./actions/xrds.php 26
--	function is_readonly() {				
--		return true;
--	}
-+    function is_readonly() {                
-+        return true;
-+    }
-hunk ./actions/xrds.php 30
--	function handle($args) {
--		parent::handle($args);
--		$nickname = $this->trimmed('nickname');
--		$user = User::staticGet('nickname', $nickname);
--		if (!$user) {
--			common_user_error(_('No such user.'));
--			return;
--		}
--		$this->show_xrds($user);
--	}
-+    function handle($args) {
-+        parent::handle($args);
-+        $nickname = $this->trimmed('nickname');
-+        $user = User::staticGet('nickname', $nickname);
-+        if (!$user) {
-+            common_user_error(_('No such user.'));
-+            return;
-+        }
-+        $this->show_xrds($user);
-+    }
-hunk ./actions/xrds.php 41
--	function show_xrds($user) {
-+    function show_xrds($user) {
-hunk ./actions/xrds.php 43
--		header('Content-Type: application/xrds+xml');
-+        header('Content-Type: application/xrds+xml');
-hunk ./actions/xrds.php 45
--		common_start_xml();
--		common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
-+        common_start_xml();
-+        common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
-hunk ./actions/xrds.php 48
--		common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
--		                                  'xml:id' => 'oauth',
--										  'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
--										  'version' => '2.0'));
-+        common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
-+                                          'xml:id' => 'oauth',
-+                                          'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
-+                                          'version' => '2.0'));
+-    var $user = NULL;
++    var $user = null;
+hunk ./actions/userrss.php 47
+-            return NULL;
++            return null;
+hunk ./actions/userrss.php 77
+-            return NULL;
++            return null;
+hunk ./actions/userrss.php 80
+-        return ($avatar) ? $avatar->url : NULL;
++        return ($avatar) ? $avatar->url : null;
+hunk ./actions/userrss.php 86
+-        $url = common_local_url('sup', NULL, $this->user->id);
++        $url = common_local_url('sup', null, $this->user->id);
 hunk ./actions/xrds.php 53
--		common_element('Type', NULL, 'xri://$xrds*simple');
-+        common_element('Type', NULL, 'xri://$xrds*simple');
-hunk ./actions/xrds.php 55
--		$this->show_service(OAUTH_ENDPOINT_REQUEST,
--							common_local_url('requesttoken'),
--							array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
--							array(OAUTH_HMAC_SHA1),
--							$user->uri);
-+        $this->show_service(OAUTH_ENDPOINT_REQUEST,
-+                            common_local_url('requesttoken'),
-+                            array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
-+                            array(OAUTH_HMAC_SHA1),
-+                            $user->uri);
-hunk ./actions/xrds.php 61
--		$this->show_service(OAUTH_ENDPOINT_AUTHORIZE,
--							common_local_url('userauthorization'),
--							array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
--							array(OAUTH_HMAC_SHA1));
-+        $this->show_service(OAUTH_ENDPOINT_AUTHORIZE,
-+                            common_local_url('userauthorization'),
-+                            array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
-+                            array(OAUTH_HMAC_SHA1));
-hunk ./actions/xrds.php 66
--		$this->show_service(OAUTH_ENDPOINT_ACCESS,
--							common_local_url('accesstoken'),
--							array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
--							array(OAUTH_HMAC_SHA1));
-+        $this->show_service(OAUTH_ENDPOINT_ACCESS,
-+                            common_local_url('accesstoken'),
-+                            array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
-+                            array(OAUTH_HMAC_SHA1));
-hunk ./actions/xrds.php 71
--		$this->show_service(OAUTH_ENDPOINT_RESOURCE,
--							NULL,
--							array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
--							array(OAUTH_HMAC_SHA1));
-+        $this->show_service(OAUTH_ENDPOINT_RESOURCE,
-+                            NULL,
-+                            array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
-+                            array(OAUTH_HMAC_SHA1));
-hunk ./actions/xrds.php 76
--		common_element_end('XRD');
-+        common_element_end('XRD');
-hunk ./actions/xrds.php 78
--		# XXX: decide whether to include user's ID/nickname in postNotice URL
-+        # XXX: decide whether to include user's ID/nickname in postNotice URL
-hunk ./actions/xrds.php 80
--		common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
--		                                  'xml:id' => 'omb',
--										  'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
--										  'version' => '2.0'));
-+        common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
-+                                          'xml:id' => 'omb',
-+                                          'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
-+                                          'version' => '2.0'));
+-        common_element('Type', NULL, 'xri://$xrds*simple');
++        common_element('Type', null, 'xri://$xrds*simple');
+hunk ./actions/xrds.php 72
+-                            NULL,
++                            null,
 hunk ./actions/xrds.php 85
--		common_element('Type', NULL, 'xri://$xrds*simple');
-+        common_element('Type', NULL, 'xri://$xrds*simple');
-hunk ./actions/xrds.php 87
--		$this->show_service(OMB_ENDPOINT_POSTNOTICE,
--							common_local_url('postnotice'));
-+        $this->show_service(OMB_ENDPOINT_POSTNOTICE,
-+                            common_local_url('postnotice'));
-hunk ./actions/xrds.php 90
--		$this->show_service(OMB_ENDPOINT_UPDATEPROFILE,
--							common_local_url('updateprofile'));
-+        $this->show_service(OMB_ENDPOINT_UPDATEPROFILE,
-+                            common_local_url('updateprofile'));
-hunk ./actions/xrds.php 93
--		common_element_end('XRD');
-+        common_element_end('XRD');
-hunk ./actions/xrds.php 95
--		common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
--										  'version' => '2.0'));
-+        common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
-+                                          'version' => '2.0'));
+-        common_element('Type', NULL, 'xri://$xrds*simple');
++        common_element('Type', null, 'xri://$xrds*simple');
 hunk ./actions/xrds.php 98
--		common_element('Type', NULL, 'xri://$xrds*simple');
-+        common_element('Type', NULL, 'xri://$xrds*simple');
-hunk ./actions/xrds.php 100
--		$this->show_service(OAUTH_DISCOVERY,
--							'#oauth');
--		$this->show_service(OMB_NAMESPACE,
--							'#omb');
-+        $this->show_service(OAUTH_DISCOVERY,
-+                            '#oauth');
-+        $this->show_service(OMB_NAMESPACE,
-+                            '#omb');
-hunk ./actions/xrds.php 105
--		common_element_end('XRD');
-+        common_element_end('XRD');
-hunk ./actions/xrds.php 107
--		common_element_end('XRDS');
--		common_end_xml();
--	}
-+        common_element_end('XRDS');
-+        common_end_xml();
-+    }
+-        common_element('Type', NULL, 'xri://$xrds*simple');
++        common_element('Type', null, 'xri://$xrds*simple');
 hunk ./actions/xrds.php 111
--	function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
--		common_element_start('Service');
--		if ($uri) {
--			common_element('URI', NULL, $uri);
--		}
--		common_element('Type', NULL, $type);
--		if ($params) {
--			foreach ($params as $param) {
--				common_element('Type', NULL, $param);
--			}
--		}
--		if ($sigs) {
--			foreach ($sigs as $sig) {
--				common_element('Type', NULL, $sig);
--			}
--		}
--		if ($localId) {
--			common_element('LocalID', NULL, $localId);
--		}
--		common_element_end('Service');
--	}
-+    function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
-+        common_element_start('Service');
-+        if ($uri) {
-+            common_element('URI', NULL, $uri);
-+        }
-+        common_element('Type', NULL, $type);
-+        if ($params) {
-+            foreach ($params as $param) {
-+                common_element('Type', NULL, $param);
-+            }
-+        }
-+        if ($sigs) {
-+            foreach ($sigs as $sig) {
-+                common_element('Type', NULL, $sig);
-+            }
-+        }
-+        if ($localId) {
-+            common_element('LocalID', NULL, $localId);
-+        }
-+        common_element_end('Service');
-+    }
-hunk ./classes/Avatar.php 29
--	# We clean up the file, too
-+    # We clean up the file, too
-hunk ./classes/Avatar.php 31
--	function delete() {
--		$filename = $this->filename;
--		if (parent::delete()) {
--			@unlink(common_avatar_path($filename));
--		}
--	}
-+    function delete() {
-+        $filename = $this->filename;
-+        if (parent::delete()) {
-+            @unlink(common_avatar_path($filename));
-+        }
-+    }
-hunk ./classes/Avatar.php 38
--	# Create and save scaled version of this avatar
--	# XXX: maybe break into different methods
-+    # Create and save scaled version of this avatar
-+    # XXX: maybe break into different methods
-hunk ./classes/Avatar.php 41
--	function scale($size) {
-+    function scale($size) {
-hunk ./classes/Avatar.php 43
--		$image_s = imagecreatetruecolor($size, $size);
--		$image_a = $this->to_image();
--		$square = min($this->width, $this->height);
-+        $image_s = imagecreatetruecolor($size, $size);
-+        $image_a = $this->to_image();
-+        $square = min($this->width, $this->height);
-hunk ./classes/Avatar.php 49
--		imagecopyresampled($image_s, $image_a, 0, 0, 0, 0,
--						   $size, $size, $square, $square);
-+        imagecopyresampled($image_s, $image_a, 0, 0, 0, 0,
-+                           $size, $size, $square, $square);
-hunk ./classes/Avatar.php 52
--		$ext = ($this->mediattype == 'image/jpeg') ? ".jpeg" : ".png";
-+        $ext = ($this->mediattype == 'image/jpeg') ? ".jpeg" : ".png";
-hunk ./classes/Avatar.php 54
--		$filename = common_avatar_filename($this->profile_id, $ext, $size, common_timestamp());
-+        $filename = common_avatar_filename($this->profile_id, $ext, $size, common_timestamp());
-hunk ./classes/Avatar.php 56
--		if ($this->mediatype == 'image/jpeg') {
--			imagejpeg($image_s, common_avatar_path($filename));
--		} else {
--			imagepng($image_s, common_avatar_path($filename));
--		}
-+        if ($this->mediatype == 'image/jpeg') {
-+            imagejpeg($image_s, common_avatar_path($filename));
-+        } else {
-+            imagepng($image_s, common_avatar_path($filename));
-+        }
-hunk ./classes/Avatar.php 62
--		$scaled = DB_DataObject::factory('avatar');
--		$scaled->profile_id = $this->profile_id;
--		$scaled->width = $size;
--		$scaled->height = $size;
--		$scaled->original = false;
--		$scaled->mediatype = ($this->mediattype == 'image/jpeg') ? 'image/jpeg' : 'image/png';
--		$scaled->filename = $filename;
--		$scaled->url = common_avatar_url($filename);
--		$scaled->created = DB_DataObject_Cast::dateTime(); # current time
-+        $scaled = DB_DataObject::factory('avatar');
-+        $scaled->profile_id = $this->profile_id;
-+        $scaled->width = $size;
-+        $scaled->height = $size;
-+        $scaled->original = false;
-+        $scaled->mediatype = ($this->mediattype == 'image/jpeg') ? 'image/jpeg' : 'image/png';
-+        $scaled->filename = $filename;
-+        $scaled->url = common_avatar_url($filename);
-+        $scaled->created = DB_DataObject_Cast::dateTime(); # current time
-hunk ./classes/Avatar.php 72
--		if ($scaled->insert()) {
--			return $scaled;
--		} else {
--			return NULL;
--		}
--	}
-+        if ($scaled->insert()) {
-+            return $scaled;
-+        } else {
-+            return NULL;
-+        }
-+    }
-hunk ./classes/Avatar.php 79
--	function to_image() {
--		$filepath = common_avatar_path($this->filename);
--		if ($this->mediatype == 'image/gif') {
--			return imagecreatefromgif($filepath);
--		} else if ($this->mediatype == 'image/jpeg') {
--			return imagecreatefromjpeg($filepath);
--		} else if ($this->mediatype == 'image/png') {
--			return imagecreatefrompng($filepath);
--		} else {
--			return NULL;
--		}
--	}
--	
--	function &pkeyGet($kv) {
--		return Memcached_DataObject::pkeyGet('Avatar', $kv);
--	}
-+    function to_image() {
-+        $filepath = common_avatar_path($this->filename);
-+        if ($this->mediatype == 'image/gif') {
-+            return imagecreatefromgif($filepath);
-+        } else if ($this->mediatype == 'image/jpeg') {
-+            return imagecreatefromjpeg($filepath);
-+        } else if ($this->mediatype == 'image/png') {
-+            return imagecreatefrompng($filepath);
-+        } else {
-+            return NULL;
-+        }
-+    }
-+    
-+    function &pkeyGet($kv) {
-+        return Memcached_DataObject::pkeyGet('Avatar', $kv);
-+    }
-hunk ./classes/Channel.php 23
--	
--	function on($user) {
--		return false;
--	}
-+    
-+    function on($user) {
-+        return false;
-+    }
-hunk ./classes/Channel.php 28
--	function off($user) {
--		return false;
--	}
-+    function off($user) {
-+        return false;
-+    }
-hunk ./classes/Channel.php 32
--	function output($user, $text) {
--		return false;
--	}
--	
--	function error($user, $text) {
--		return false;
--	}
--	
--	function source() {
--		return NULL;
--	}
-+    function output($user, $text) {
-+        return false;
-+    }
-+    
-+    function error($user, $text) {
-+        return false;
-+    }
-+    
-+    function source() {
-+        return NULL;
-+    }
+-    function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
++    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
+hunk ./actions/xrds.php 114
+-            common_element('URI', NULL, $uri);
++            common_element('URI', null, $uri);
+hunk ./actions/xrds.php 116
+-        common_element('Type', NULL, $type);
++        common_element('Type', null, $type);
+hunk ./actions/xrds.php 119
+-                common_element('Type', NULL, $param);
++                common_element('Type', null, $param);
+hunk ./actions/xrds.php 124
+-                common_element('Type', NULL, $sig);
++                common_element('Type', null, $sig);
+hunk ./actions/xrds.php 128
+-            common_element('LocalID', NULL, $localId);
++            common_element('LocalID', null, $localId);
+hunk ./classes/Avatar.php 24
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
+hunk ./classes/Avatar.php 75
+-            return NULL;
++            return null;
+hunk ./classes/Avatar.php 88
+-            return NULL;
++            return null;
+hunk ./classes/Channel.php 41
+-        return NULL;
++        return null;
 hunk ./classes/Channel.php 47
--	var $conn = NULL;
--	
--	function source() {
--		return 'xmpp';
--	}
--	
--	function __construct($conn) {
--		$this->conn = $conn;
--	}
--	
--	function on($user) {
--		return $this->set_notify($user, 1);
--	}
--	
--	function off($user) {
--		return $this->set_notify($user, 0);
--	}
-+    var $conn = NULL;
-+    
-+    function source() {
-+        return 'xmpp';
-+    }
-+    
-+    function __construct($conn) {
-+        $this->conn = $conn;
-+    }
-+    
-+    function on($user) {
-+        return $this->set_notify($user, 1);
-+    }
-+    
-+    function off($user) {
-+        return $this->set_notify($user, 0);
-+    }
-hunk ./classes/Channel.php 65
--	function output($user, $text) {
--		$text = '['.common_config('site', 'name') . '] ' . $text;
--		jabber_send_message($user->jabber, $text);
--	}
--	
--	function error($user, $text) {
--		$text = '['.common_config('site', 'name') . '] ' . $text;
--		jabber_send_message($user->jabber, $text);
--	}
--	
--	function set_notify(&$user, $notify) {
--		$orig = clone($user);
--		$user->jabbernotify = $notify;
--		$result = $user->update($orig);
--		if (!$result) {
--			$last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
--			common_log(LOG_ERR,
--					   'Could not set notify flag to ' . $notify .
--					   ' for user ' . common_log_objstring($user) .
--					   ': ' . $last_error->message);
--			return false;
--		} else {
--			common_log(LOG_INFO,
--					   'User ' . $user->nickname . ' set notify flag to ' . $notify);
--			return true;
--		}
--	}
-+    function output($user, $text) {
-+        $text = '['.common_config('site', 'name') . '] ' . $text;
-+        jabber_send_message($user->jabber, $text);
-+    }
-+    
-+    function error($user, $text) {
-+        $text = '['.common_config('site', 'name') . '] ' . $text;
-+        jabber_send_message($user->jabber, $text);
-+    }
-+    
-+    function set_notify(&$user, $notify) {
-+        $orig = clone($user);
-+        $user->jabbernotify = $notify;
-+        $result = $user->update($orig);
-+        if (!$result) {
-+            $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
-+            common_log(LOG_ERR,
-+                       'Could not set notify flag to ' . $notify .
-+                       ' for user ' . common_log_objstring($user) .
-+                       ': ' . $last_error->message);
-+            return false;
-+        } else {
-+            common_log(LOG_INFO,
-+                       'User ' . $user->nickname . ' set notify flag to ' . $notify);
-+            return true;
-+        }
-+    }
-hunk ./classes/Channel.php 97
--	function source() {
--		return 'web';
--	}
--	
--	function on($user) {
--		return false;
--	}
--	
--	function off($user) {
--		return false;
--	}
-+    function source() {
-+        return 'web';
-+    }
-+    
-+    function on($user) {
-+        return false;
-+    }
-+    
-+    function off($user) {
-+        return false;
-+    }
-hunk ./classes/Channel.php 109
--	function output($user, $text) {
--		# XXX: buffer all output and send it at the end
--		# XXX: even better, redirect to appropriate page
--		#      depending on what command was run
--		common_show_header(_('Command results'));
--		common_element('p', NULL, $text);
--		common_show_footer();
--	}
--	
--	function error($user, $text) {
--		common_user_error($text);
--	}
-+    function output($user, $text) {
-+        # XXX: buffer all output and send it at the end
-+        # XXX: even better, redirect to appropriate page
-+        #      depending on what command was run
-+        common_show_header(_('Command results'));
-+        common_element('p', NULL, $text);
-+        common_show_footer();
-+    }
-+    
-+    function error($user, $text) {
-+        common_user_error($text);
-+    }
-hunk ./classes/Channel.php 126
--	function output($user, $text) {
--		common_start_html('text/xml;charset=utf-8', true);
--		common_element_start('head');
--		common_element('title', null, _('Command results'));
--		common_element_end('head');
--		common_element_start('body');
--		common_element('p', array('id' => 'command_result'), $text);
--		common_element_end('body');
--		common_element_end('html');
--	}
-+    function output($user, $text) {
-+        common_start_html('text/xml;charset=utf-8', true);
-+        common_element_start('head');
-+        common_element('title', null, _('Command results'));
-+        common_element_end('head');
-+        common_element_start('body');
-+        common_element('p', array('id' => 'command_result'), $text);
-+        common_element_end('body');
-+        common_element_end('html');
-+    }
-hunk ./classes/Channel.php 137
--	function error($user, $text) {
--		common_start_html('text/xml;charset=utf-8', true);
--		common_element_start('head');
--		common_element('title', null, _('Ajax Error'));
--		common_element_end('head');
--		common_element_start('body');
--		common_element('p', array('id' => 'error'), $text);
--		common_element_end('body');
--		common_element_end('html');
--	}
-+    function error($user, $text) {
-+        common_start_html('text/xml;charset=utf-8', true);
-+        common_element_start('head');
-+        common_element('title', null, _('Ajax Error'));
-+        common_element_end('head');
-+        common_element_start('body');
-+        common_element('p', array('id' => 'error'), $text);
-+        common_element_end('body');
-+        common_element_end('html');
-+    }
+-    var $conn = NULL;
++    var $conn = null;
+hunk ./classes/Channel.php 114
+-        common_element('p', NULL, $text);
++        common_element('p', null, $text);
 hunk ./classes/Channel.php 152
--	var $addr = NULL;
-+    var $addr = NULL;
-hunk ./classes/Channel.php 154
--	function source() {
--		return 'mail';
--	}
--	
--	function __construct($addr=NULL) {
--		$this->addr = $addr;
--	}
--	
--	function on($user) {
--		return $this->set_notify($user, 1);
--	}
--	
--	function off($user) {
--		return $this->set_notify($user, 0);
--	}
-+    function source() {
-+        return 'mail';
-+    }
-+    
-+    function __construct($addr=NULL) {
-+        $this->addr = $addr;
-+    }
-+    
-+    function on($user) {
-+        return $this->set_notify($user, 1);
-+    }
-+    
-+    function off($user) {
-+        return $this->set_notify($user, 0);
-+    }
-hunk ./classes/Channel.php 170
--	function output($user, $text) {
-+    function output($user, $text) {
-hunk ./classes/Channel.php 172
--		$headers['From'] = $user->incomingemail;
--		$headers['To'] = $this->addr;
--		
--		$headers['Subject'] = _('Command complete');
-+        $headers['From'] = $user->incomingemail;
-+        $headers['To'] = $this->addr;
-+        
-+        $headers['Subject'] = _('Command complete');
-hunk ./classes/Channel.php 177
--		return mail_send(array($this->addr), $headers, $text);
--	}
--	
--	function error($user, $text) {
--		
--		$headers['From'] = $user->incomingemail;
--		$headers['To'] = $this->addr;
--		
--		$headers['Subject'] = _('Command failed');
-+        return mail_send(array($this->addr), $headers, $text);
-+    }
-+    
-+    function error($user, $text) {
-+        
-+        $headers['From'] = $user->incomingemail;
-+        $headers['To'] = $this->addr;
-+        
-+        $headers['Subject'] = _('Command failed');
-hunk ./classes/Channel.php 187
--		return mail_send(array($this->addr), $headers, $text);
--	}
--	
--	function set_notify($user, $value) {
--		$orig = clone($user);
--		$user->smsnotify = $value;
--		$result = $user->update($orig);
--		if (!$result) {
--			common_log_db_error($user, 'UPDATE', __FILE__);
--			return false;
--		}
--		return true;
--	}
-+        return mail_send(array($this->addr), $headers, $text);
-+    }
-+    
-+    function set_notify($user, $value) {
-+        $orig = clone($user);
-+        $user->smsnotify = $value;
-+        $result = $user->update($orig);
-+        if (!$result) {
-+            common_log_db_error($user, 'UPDATE', __FILE__);
-+            return false;
-+        }
-+        return true;
-+    }
-hunk ./classes/Command.php 25
--	
--	var $user = NULL;
--	
--	function __construct($user=NULL) {
--		$this->user = $user;
--	}
--	
--	function execute($channel) {
--		return false;
--	}
-+    
-+    var $user = NULL;
-+    
-+    function __construct($user=NULL) {
-+        $this->user = $user;
-+    }
-+    
-+    function execute($channel) {
-+        return false;
-+    }
-hunk ./classes/Command.php 38
--	function execute($channel) {
--		$channel->error($this->user, _("Sorry, this command is not yet implemented."));
--	}
-+    function execute($channel) {
-+        $channel->error($this->user, _("Sorry, this command is not yet implemented."));
-+    }
+-    var $addr = NULL;
++    var $addr = null;
+hunk ./classes/Channel.php 158
+-    function __construct($addr=NULL) {
++    function __construct($addr=null) {
+hunk ./classes/Command.php 26
+-    var $user = NULL;
++    var $user = null;
+hunk ./classes/Command.php 28
+-    function __construct($user=NULL) {
++    function __construct($user=null) {
 hunk ./classes/Command.php 50
--	var $word = NULL;
--	function __construct($user, $word) {
--		parent::__construct($user);
--		$this->word = $word;
--	}
-+    var $word = NULL;
-+    function __construct($user, $word) {
-+        parent::__construct($user);
-+        $this->word = $word;
-+    }
+-    var $word = NULL;
++    var $word = null;
 hunk ./classes/Command.php 58
--	var $word = NULL;
--	function __construct($user, $word) {
--		parent::__construct($user);
--		$this->word = $word;
--	}
-+    var $word = NULL;
-+    function __construct($user, $word) {
-+        parent::__construct($user);
-+        $this->word = $word;
-+    }
+-    var $word = NULL;
++    var $word = null;
 hunk ./classes/Command.php 66
--	var $other = NULL;
--	function __construct($user, $other) {
--		parent::__construct($user);
--		$this->other = $other;
--	}
-+    var $other = NULL;
-+    function __construct($user, $other) {
-+        parent::__construct($user);
-+        $this->other = $other;
-+    }
+-    var $other = NULL;
++    var $other = null;
 hunk ./classes/Command.php 74
--	var $other = NULL;
--	function __construct($user, $other) {
--		parent::__construct($user);
--		$this->other = $other;
--	}
-+    var $other = NULL;
-+    function __construct($user, $other) {
-+        parent::__construct($user);
-+        $this->other = $other;
-+    }
-hunk ./classes/Command.php 82
--	function execute($channel) {
-+    function execute($channel) {
-hunk ./classes/Command.php 84
--		$subs = new Subscription();
--		$subs->subscriber = $this->user->id;
--		$subs_count = (int) $subs->count() - 1;
-+        $subs = new Subscription();
-+        $subs->subscriber = $this->user->id;
-+        $subs_count = (int) $subs->count() - 1;
-hunk ./classes/Command.php 88
--		$subbed = new Subscription();
--		$subbed->subscribed = $this->user->id;
--		$subbed_count = (int) $subbed->count() - 1;
-+        $subbed = new Subscription();
-+        $subbed->subscribed = $this->user->id;
-+        $subbed_count = (int) $subbed->count() - 1;
-hunk ./classes/Command.php 92
--		$notices = new Notice();
--		$notices->profile_id = $this->user->id;
--		$notice_count = (int) $notices->count();
--		
--		$channel->output($this->user, sprintf(_("Subscriptions: %1\$s\n".
--								   "Subscribers: %2\$s\n".
--								   "Notices: %3\$s"),
--								 $subs_count,
--								 $subbed_count,
--								 $notice_count));
--	}
-+        $notices = new Notice();
-+        $notices->profile_id = $this->user->id;
-+        $notice_count = (int) $notices->count();
-+        
-+        $channel->output($this->user, sprintf(_("Subscriptions: %1\$s\n".
-+                                   "Subscribers: %2\$s\n".
-+                                   "Notices: %3\$s"),
-+                                 $subs_count,
-+                                 $subbed_count,
-+                                 $notice_count));
-+    }
-hunk ./classes/Command.php 106
--	
--	var $other = NULL;
--	
--	function __construct($user, $other) {
--		parent::__construct($user);
--		$this->other = $other;
--	}
--	
--	function execute($channel) {
--		
--		$recipient = 
--		  common_relative_profile($this->user, common_canonical_nickname($this->other));
--		
--		if (!$recipient) {
--			$channel->error($this->user, _('No such user.'));
--			return;
--		}
--		$notice = $recipient->getCurrentNotice();
--		if (!$notice) {
--			$channel->error($this->user, _('User has no last notice'));
--			return;
--		}
--		
--		$fave = Fave::addNew($this->user, $notice);
-+    
-+    var $other = NULL;
-+    
-+    function __construct($user, $other) {
-+        parent::__construct($user);
-+        $this->other = $other;
-+    }
-+    
-+    function execute($channel) {
-+        
-+        $recipient = 
-+          common_relative_profile($this->user, common_canonical_nickname($this->other));
-+        
-+        if (!$recipient) {
-+            $channel->error($this->user, _('No such user.'));
-+            return;
-+        }
-+        $notice = $recipient->getCurrentNotice();
-+        if (!$notice) {
-+            $channel->error($this->user, _('User has no last notice'));
-+            return;
-+        }
-+        
-+        $fave = Fave::addNew($this->user, $notice);
-hunk ./classes/Command.php 131
--		if (!$fave) {
--			$channel->error($this->user, _('Could not create favorite.'));
--			return;
--		}
-+        if (!$fave) {
-+            $channel->error($this->user, _('Could not create favorite.'));
-+            return;
-+        }
-hunk ./classes/Command.php 136
--	    $other = User::staticGet('id', $recipient->id);
--		
--		if ($other && $other->id != $user->id) {
--			if ($other->email && $other->emailnotifyfav) {
--				mail_notify_fave($other, $this->user, $notice);
--			}
--		}
--		
--		$this->user->blowFavesCache();
--		
--		$channel->output($this->user, _('Notice marked as fave.'));
--	}
-+        $other = User::staticGet('id', $recipient->id);
-+        
-+        if ($other && $other->id != $user->id) {
-+            if ($other->email && $other->emailnotifyfav) {
-+                mail_notify_fave($other, $this->user, $notice);
-+            }
-+        }
-+        
-+        $this->user->blowFavesCache();
-+        
-+        $channel->output($this->user, _('Notice marked as fave.'));
-+    }
+-    var $other = NULL;
++    var $other = null;
+hunk ./classes/Command.php 107
+-    var $other = NULL;
++    var $other = null;
 hunk ./classes/Command.php 151
--	var $other = NULL;
--	function __construct($user, $other) {
--		parent::__construct($user);
--		$this->other = $other;
--	}
--	
--	function execute($channel) {
--		$recipient = 
--		  common_relative_profile($this->user, common_canonical_nickname($this->other));
--		
--		if (!$recipient) {
--			$channel->error($this->user, _('No such user.'));
--			return;
--		}
--		
--		$whois = sprintf(_("%1\$s (%2\$s)"), $recipient->nickname,
--						 $recipient->profileurl);
--		if ($recipient->fullname) {
--			$whois .= "\n" . sprintf(_('Fullname: %s'), $recipient->fullname);
--		}
--		if ($recipient->location) {
--			$whois .= "\n" . sprintf(_('Location: %s'), $recipient->location);
--		}
--		if ($recipient->homepage) {
--			$whois .= "\n" . sprintf(_('Homepage: %s'), $recipient->homepage);
--		}
--		if ($recipient->bio) {
--			$whois .= "\n" . sprintf(_('About: %s'), $recipient->bio);
--		}
--		$channel->output($this->user, $whois);
--	}
-+    var $other = NULL;
-+    function __construct($user, $other) {
-+        parent::__construct($user);
-+        $this->other = $other;
-+    }
-+    
-+    function execute($channel) {
-+        $recipient = 
-+          common_relative_profile($this->user, common_canonical_nickname($this->other));
-+        
-+        if (!$recipient) {
-+            $channel->error($this->user, _('No such user.'));
-+            return;
-+        }
-+        
-+        $whois = sprintf(_("%1\$s (%2\$s)"), $recipient->nickname,
-+                         $recipient->profileurl);
-+        if ($recipient->fullname) {
-+            $whois .= "\n" . sprintf(_('Fullname: %s'), $recipient->fullname);
-+        }
-+        if ($recipient->location) {
-+            $whois .= "\n" . sprintf(_('Location: %s'), $recipient->location);
-+        }
-+        if ($recipient->homepage) {
-+            $whois .= "\n" . sprintf(_('Homepage: %s'), $recipient->homepage);
-+        }
-+        if ($recipient->bio) {
-+            $whois .= "\n" . sprintf(_('About: %s'), $recipient->bio);
-+        }
-+        $channel->output($this->user, $whois);
-+    }
+-    var $other = NULL;
++    var $other = null;
 hunk ./classes/Command.php 185
--	var $other = NULL;
--	var $text = NULL;
--	function __construct($user, $other, $text) {
--		parent::__construct($user);
--		$this->other = $other;
--		$this->text = $text;
--	}
--	
--	function execute($channel) {
--		$other = User::staticGet('nickname', common_canonical_nickname($this->other));
--		$len = mb_strlen($this->text);
--		if ($len == 0) {
--			$channel->error($this->user, _('No content!'));
--			return;
--		} else if ($len > 140) {
--			$content = common_shorten_links($content);
--			if (mb_strlen($content) > 140) {
--				$channel->error($this->user, sprintf(_('Message too long - maximum is 140 characters, you sent %d'), $len));
--				return;
--			}
--		}
--		
--		if (!$other) {
--			$channel->error($this->user, _('No such user.'));
--			return;
--		} else if (!$this->user->mutuallySubscribed($other)) {
--			$channel->error($this->user, _('You can\'t send a message to this user.'));
--			return;
--		} else if ($this->user->id == $other->id) {
--			$channel->error($this->user, _('Don\'t send a message to yourself; just say it to yourself quietly instead.'));
--			return;
--		}
--		$message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source());
--		if ($message) {
--			$channel->output($this->user, sprintf(_('Direct message to %s sent'), $this->other));
--		} else {
--			$channel->error($this->user, _('Error sending direct message.'));
--		}
--	}
-+    var $other = NULL;
-+    var $text = NULL;
-+    function __construct($user, $other, $text) {
-+        parent::__construct($user);
-+        $this->other = $other;
-+        $this->text = $text;
-+    }
-+    
-+    function execute($channel) {
-+        $other = User::staticGet('nickname', common_canonical_nickname($this->other));
-+        $len = mb_strlen($this->text);
-+        if ($len == 0) {
-+            $channel->error($this->user, _('No content!'));
-+            return;
-+        } else if ($len > 140) {
-+            $content = common_shorten_links($content);
-+            if (mb_strlen($content) > 140) {
-+                $channel->error($this->user, sprintf(_('Message too long - maximum is 140 characters, you sent %d'), $len));
-+                return;
-+            }
-+        }
-+        
-+        if (!$other) {
-+            $channel->error($this->user, _('No such user.'));
-+            return;
-+        } else if (!$this->user->mutuallySubscribed($other)) {
-+            $channel->error($this->user, _('You can\'t send a message to this user.'));
-+            return;
-+        } else if ($this->user->id == $other->id) {
-+            $channel->error($this->user, _('Don\'t send a message to yourself; just say it to yourself quietly instead.'));
-+            return;
-+        }
-+        $message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source());
-+        if ($message) {
-+            $channel->output($this->user, sprintf(_('Direct message to %s sent'), $this->other));
-+        } else {
-+            $channel->error($this->user, _('Error sending direct message.'));
-+        }
-+    }
-hunk ./classes/Command.php 227
--	
--	var $other = NULL;
--	
--	function __construct($user, $other) {
--		parent::__construct($user);
--		$this->other = $other;
--	}
--	
--	function execute($channel) {
--		$target_nickname = common_canonical_nickname($this->other);
--		
--		$target =
--		  common_relative_profile($this->user, $target_nickname);
-+    
-+    var $other = NULL;
-+    
-+    function __construct($user, $other) {
-+        parent::__construct($user);
-+        $this->other = $other;
-+    }
-+    
-+    function execute($channel) {
-+        $target_nickname = common_canonical_nickname($this->other);
-+        
-+        $target =
-+          common_relative_profile($this->user, $target_nickname);
-hunk ./classes/Command.php 241
--		if (!$target) {
--			$channel->error($this->user, _('No such user.'));
--			return;
--		}
--		$notice = $target->getCurrentNotice();
--		if (!$notice) {
--			$channel->error($this->user, _('User has no last notice'));
--			return;
--		}
--		$notice_content = $notice->content;
--		
--		$channel->output($this->user, $target_nickname . ": " . $notice_content);
--	}
-+        if (!$target) {
-+            $channel->error($this->user, _('No such user.'));
-+            return;
-+        }
-+        $notice = $target->getCurrentNotice();
-+        if (!$notice) {
-+            $channel->error($this->user, _('User has no last notice'));
-+            return;
-+        }
-+        $notice_content = $notice->content;
-+        
-+        $channel->output($this->user, $target_nickname . ": " . $notice_content);
-+    }
-hunk ./classes/Command.php 257
--	
--	var $other = NULL;
--	
--	function __construct($user, $other) {
--		parent::__construct($user);
--		$this->other = $other;
--	}
--	
--	function execute($channel) {
--		
--		if (!$this->other) {
--			$channel->error($this->user, _('Specify the name of the user to subscribe to'));
--			return;
--		}
--		
--		$result = subs_subscribe_user($this->user, $this->other);
--		
--		if ($result == 'true') {
--			$channel->output($this->user, sprintf(_('Subscribed to %s'), $this->other));
--		} else {
--			$channel->error($this->user, $result);
--		}
--	}
-+    
-+    var $other = NULL;
-+    
-+    function __construct($user, $other) {
-+        parent::__construct($user);
-+        $this->other = $other;
-+    }
-+    
-+    function execute($channel) {
-+        
-+        if (!$this->other) {
-+            $channel->error($this->user, _('Specify the name of the user to subscribe to'));
-+            return;
-+        }
-+        
-+        $result = subs_subscribe_user($this->user, $this->other);
-+        
-+        if ($result == 'true') {
-+            $channel->output($this->user, sprintf(_('Subscribed to %s'), $this->other));
-+        } else {
-+            $channel->error($this->user, $result);
-+        }
-+    }
+-    var $other = NULL;
+-    var $text = NULL;
++    var $other = null;
++    var $text = null;
+hunk ./classes/Command.php 228
+-    var $other = NULL;
++    var $other = null;
+hunk ./classes/Command.php 258
+-    var $other = NULL;
++    var $other = null;
 hunk ./classes/Command.php 284
--	var $other = NULL;
--	
--	function __construct($user, $other) {
--		parent::__construct($user);
--		$this->other = $other;
--	}
-+    var $other = NULL;
-+    
-+    function __construct($user, $other) {
-+        parent::__construct($user);
-+        $this->other = $other;
-+    }
-hunk ./classes/Command.php 291
--	function execute($channel) {
--		if(!$this->other) {
--			$channel->error($this->user, _('Specify the name of the user to unsubscribe from'));
--			return;
--		}
--		
--		$result=subs_unsubscribe_user($this->user, $this->other);
--		
--		if ($result) {
--			$channel->output($this->user, sprintf(_('Unsubscribed from %s'), $this->other));
--		} else {
--			$channel->error($this->user, $result);
--		}
--	}
-+    function execute($channel) {
-+        if(!$this->other) {
-+            $channel->error($this->user, _('Specify the name of the user to unsubscribe from'));
-+            return;
-+        }
-+        
-+        $result=subs_unsubscribe_user($this->user, $this->other);
-+        
-+        if ($result) {
-+            $channel->output($this->user, sprintf(_('Unsubscribed from %s'), $this->other));
-+        } else {
-+            $channel->error($this->user, $result);
-+        }
-+    }
+-    var $other = NULL;
++    var $other = null;
 hunk ./classes/Command.php 308
--	var $other = NULL;
--	function __construct($user, $other=NULL) {
--		parent::__construct($user);
--		$this->other = $other;
--	}
--	function execute($channel) {
--		if ($other) {
--			$channel->error($this->user, _("Command not yet implemented."));
--		} else {
--			if ($channel->off($this->user)) {
--				$channel->output($this->user, _('Notification off.'));
--			} else {
--				$channel->error($this->user, _('Can\'t turn off notification.'));
--			}
--		}
--	}
-+    var $other = NULL;
-+    function __construct($user, $other=NULL) {
-+        parent::__construct($user);
-+        $this->other = $other;
-+    }
-+    function execute($channel) {
-+        if ($other) {
-+            $channel->error($this->user, _("Command not yet implemented."));
-+        } else {
-+            if ($channel->off($this->user)) {
-+                $channel->output($this->user, _('Notification off.'));
-+            } else {
-+                $channel->error($this->user, _('Can\'t turn off notification.'));
-+            }
-+        }
-+    }
+-    var $other = NULL;
+-    function __construct($user, $other=NULL) {
++    var $other = null;
++    function __construct($user, $other=null) {
 hunk ./classes/Command.php 327
--	var $other = NULL;
--	function __construct($user, $other=NULL) {
--		parent::__construct($user);
--		$this->other = $other;
--	}
--	
--	function execute($channel) {
--		if ($other) {
--			$channel->error($this->user, _("Command not yet implemented."));
--		} else {
--			if ($channel->on($this->user)) {
--				$channel->output($this->user, _('Notification on.'));
--			} else {
--				$channel->error($this->user, _('Can\'t turn on notification.'));
--			}
--		}
--	}
-+    var $other = NULL;
-+    function __construct($user, $other=NULL) {
-+        parent::__construct($user);
-+        $this->other = $other;
-+    }
-+    
-+    function execute($channel) {
-+        if ($other) {
-+            $channel->error($this->user, _("Command not yet implemented."));
-+        } else {
-+            if ($channel->on($this->user)) {
-+                $channel->output($this->user, _('Notification on.'));
-+            } else {
-+                $channel->error($this->user, _('Can\'t turn on notification.'));
-+            }
-+        }
-+    }
-hunk ./classes/Command.php 347
--	function execute($channel) {
--		$channel->output($this->user,
--						 _("Commands:\n".
--						   "on - turn on notifications\n".
--						   "off - turn off notifications\n".
--						   "help - show this help\n".
--						   "follow <nickname> - subscribe to user\n".
--						   "leave <nickname> - unsubscribe from user\n".
--						   "d <nickname> <text> - direct message to user\n".
--						   "get <nickname> - get last notice from user\n".
--						   "whois <nickname> - get profile info on user\n".
--						   "fav <nickname> - add user's last notice as a 'fave'\n".
--						   "stats - get your stats\n".
--						   "stop - same as 'off'\n".
--						   "quit - same as 'off'\n".
--						   "sub <nickname> - same as 'follow'\n".
--						   "unsub <nickname> - same as 'leave'\n".
--						   "last <nickname> - same as 'get'\n".
--						   "on <nickname> - not yet implemented.\n".
--						   "off <nickname> - not yet implemented.\n".						   
--						   "nudge <nickname> - not yet implemented.\n".
--						   "invite <phone number> - not yet implemented.\n".
--						   "track <word> - not yet implemented.\n".
--						   "untrack <word> - not yet implemented.\n".
--						   "track off - not yet implemented.\n".
--						   "untrack all - not yet implemented.\n".
--						   "tracks - not yet implemented.\n".
--						   "tracking - not yet implemented.\n"));
--	}
-+    function execute($channel) {
-+        $channel->output($this->user,
-+                         _("Commands:\n".
-+                           "on - turn on notifications\n".
-+                           "off - turn off notifications\n".
-+                           "help - show this help\n".
-+                           "follow <nickname> - subscribe to user\n".
-+                           "leave <nickname> - unsubscribe from user\n".
-+                           "d <nickname> <text> - direct message to user\n".
-+                           "get <nickname> - get last notice from user\n".
-+                           "whois <nickname> - get profile info on user\n".
-+                           "fav <nickname> - add user's last notice as a 'fave'\n".
-+                           "stats - get your stats\n".
-+                           "stop - same as 'off'\n".
-+                           "quit - same as 'off'\n".
-+                           "sub <nickname> - same as 'follow'\n".
-+                           "unsub <nickname> - same as 'leave'\n".
-+                           "last <nickname> - same as 'get'\n".
-+                           "on <nickname> - not yet implemented.\n".
-+                           "off <nickname> - not yet implemented.\n".                           
-+                           "nudge <nickname> - not yet implemented.\n".
-+                           "invite <phone number> - not yet implemented.\n".
-+                           "track <word> - not yet implemented.\n".
-+                           "untrack <word> - not yet implemented.\n".
-+                           "track off - not yet implemented.\n".
-+                           "untrack all - not yet implemented.\n".
-+                           "tracks - not yet implemented.\n".
-+                           "tracking - not yet implemented.\n"));
-+    }
-hunk ./classes/CommandInterpreter.php 25
--	
--	function handle_command($user, $text) {
--		# XXX: localise
-+    
-+    function handle_command($user, $text) {
-+        # XXX: localise
-hunk ./classes/CommandInterpreter.php 29
--		$text = preg_replace('/\s+/', ' ', trim($text));
--		list($cmd, $arg) = explode(' ', $text, 2);
-+        $text = preg_replace('/\s+/', ' ', trim($text));
-+        list($cmd, $arg) = explode(' ', $text, 2);
-hunk ./classes/CommandInterpreter.php 32
--		# We try to support all the same commands as Twitter, see
--		# http://getsatisfaction.com/twitter/topics/what_are_the_twitter_commands
--		# There are a few compatibility commands from earlier versions of 
--		# Laconica
--		
--		switch(strtolower($cmd)) {
--		 case 'help':
--			if ($arg) {
--				return NULL;
--			}
--			return new HelpCommand($user);
--		 case 'on':
--			if ($arg) {
--				list($other, $extra) = explode(' ', $arg, 2);
--				if ($extra) {
--					return NULL;
--				} else {
--					return new OnCommand($user, $other);
--				}
--			} else {
--				return new OnCommand($user);
--			}
--		 case 'off':
--			if ($arg) {
--				list($other, $extra) = explode(' ', $arg, 2);
--				if ($extra) {
--					return NULL;
--				} else {
--					return new OffCommand($user, $other);
--				}
--			} else {
--				return new OffCommand($user);
--			}
--		 case 'stop':
--		 case 'quit':
--			if ($arg) {
--				return NULL;
--			} else {
--				return new OffCommand($user);
--			}
--		 case 'follow':
--		 case 'sub':
--			if (!$arg) {
--				return NULL;
--			}
--			list($other, $extra) = explode(' ', $arg, 2);
--			if ($extra) {
--				return NULL;
--			} else {
--				return new SubCommand($user, $other);
--			}
--		 case 'leave':
--		 case 'unsub':
--			if (!$arg) {
--				return NULL;
--			}
--			list($other, $extra) = explode(' ', $arg, 2);
--			if ($extra) {
--				return NULL;
--			} else {
--				return new UnsubCommand($user, $other);
--			}
--		 case 'get':
--		 case 'last':
--			if (!$arg) {
--				return NULL;
--			}
--			list($other, $extra) = explode(' ', $arg, 2);
--			if ($extra) {
--				return NULL;
--			} else {
--				return new GetCommand($user, $other);
--			}
--		 case 'd':
--			if (!$arg) {
--				return NULL;
--			}
--			list($other, $extra) = explode(' ', $arg, 2);
--			if (!$extra) {
--				return NULL;
--			} else {
--				return new MessageCommand($user, $other, $extra);
--			}
--		 case 'whois':
--			if (!$arg) {
--				return NULL;
--			}
--			list($other, $extra) = explode(' ', $arg, 2);
--			if ($extra) {
--				return NULL;
--			} else {
--				return new WhoisCommand($user, $other);
--			}
--		 case 'fav':
--			if (!$arg) {
--				return NULL;
--			}
--			list($other, $extra) = explode(' ', $arg, 2);
--			if ($extra) {
--				return NULL;
--			} else {
--				return new FavCommand($user, $other);
--			}
--		 case 'nudge':
--			if (!$arg) {
--				return NULL;
--			}
--			list($other, $extra) = explode(' ', $arg, 2);
--			if ($extra) {
--				return NULL;
--			} else {
--				return new NudgeCommand($user, $other);
--			}
--		 case 'stats':
--			if ($arg) {
--				return NULL;
--			}
--			return new StatsCommand($user);
--		 case 'invite':
--			if (!$arg) {
--				return NULL;
--			}
--			list($other, $extra) = explode(' ', $arg, 2);
--			if ($extra) {
--				return NULL;
--			} else {
--				return new InviteCommand($user, $other);
--			}
--		 case 'track':
--			if (!$arg) {
--				return NULL;
--			}
--			list($word, $extra) = explode(' ', $arg, 2);
--			if ($extra) {
--				return NULL;
--			} else if ($word == 'off') {
--				return new TrackOffCommand($user);
--			} else {
--				return new TrackCommand($user, $word);
--			}
--		 case 'untrack':
--			if (!$arg) {
--				return NULL;
--			}
--			list($word, $extra) = explode(' ', $arg, 2);
--			if ($extra) {
--				return NULL;
--			} else if ($word == 'all') {
--				return new TrackOffCommand($user);
--			} else {
--				return new UntrackCommand($user, $word);
--			}
--		 case 'tracks':
--		 case 'tracking':
--			if ($arg) {
--				return NULL;
--			}
--			return new TrackingCommand($user);
--		 default:
--			return false;
--		}
--	}
-+        # We try to support all the same commands as Twitter, see
-+        # http://getsatisfaction.com/twitter/topics/what_are_the_twitter_commands
-+        # There are a few compatibility commands from earlier versions of 
-+        # Laconica
-+        
-+        switch(strtolower($cmd)) {
-+         case 'help':
-+            if ($arg) {
-+                return NULL;
-+            }
-+            return new HelpCommand($user);
-+         case 'on':
-+            if ($arg) {
-+                list($other, $extra) = explode(' ', $arg, 2);
-+                if ($extra) {
-+                    return NULL;
-+                } else {
-+                    return new OnCommand($user, $other);
-+                }
-+            } else {
-+                return new OnCommand($user);
-+            }
-+         case 'off':
-+            if ($arg) {
-+                list($other, $extra) = explode(' ', $arg, 2);
-+                if ($extra) {
-+                    return NULL;
-+                } else {
-+                    return new OffCommand($user, $other);
-+                }
-+            } else {
-+                return new OffCommand($user);
-+            }
-+         case 'stop':
-+         case 'quit':
-+            if ($arg) {
-+                return NULL;
-+            } else {
-+                return new OffCommand($user);
-+            }
-+         case 'follow':
-+         case 'sub':
-+            if (!$arg) {
-+                return NULL;
-+            }
-+            list($other, $extra) = explode(' ', $arg, 2);
-+            if ($extra) {
-+                return NULL;
-+            } else {
-+                return new SubCommand($user, $other);
-+            }
-+         case 'leave':
-+         case 'unsub':
-+            if (!$arg) {
-+                return NULL;
-+            }
-+            list($other, $extra) = explode(' ', $arg, 2);
-+            if ($extra) {
-+                return NULL;
-+            } else {
-+                return new UnsubCommand($user, $other);
-+            }
-+         case 'get':
-+         case 'last':
-+            if (!$arg) {
-+                return NULL;
-+            }
-+            list($other, $extra) = explode(' ', $arg, 2);
-+            if ($extra) {
-+                return NULL;
-+            } else {
-+                return new GetCommand($user, $other);
-+            }
-+         case 'd':
-+            if (!$arg) {
-+                return NULL;
-+            }
-+            list($other, $extra) = explode(' ', $arg, 2);
-+            if (!$extra) {
-+                return NULL;
-+            } else {
-+                return new MessageCommand($user, $other, $extra);
-+            }
-+         case 'whois':
-+            if (!$arg) {
-+                return NULL;
-+            }
-+            list($other, $extra) = explode(' ', $arg, 2);
-+            if ($extra) {
-+                return NULL;
-+            } else {
-+                return new WhoisCommand($user, $other);
-+            }
-+         case 'fav':
-+            if (!$arg) {
-+                return NULL;
-+            }
-+            list($other, $extra) = explode(' ', $arg, 2);
-+            if ($extra) {
-+                return NULL;
-+            } else {
-+                return new FavCommand($user, $other);
-+            }
-+         case 'nudge':
-+            if (!$arg) {
-+                return NULL;
-+            }
-+            list($other, $extra) = explode(' ', $arg, 2);
-+            if ($extra) {
-+                return NULL;
-+            } else {
-+                return new NudgeCommand($user, $other);
-+            }
-+         case 'stats':
-+            if ($arg) {
-+                return NULL;
-+            }
-+            return new StatsCommand($user);
-+         case 'invite':
-+            if (!$arg) {
-+                return NULL;
-+            }
-+            list($other, $extra) = explode(' ', $arg, 2);
-+            if ($extra) {
-+                return NULL;
-+            } else {
-+                return new InviteCommand($user, $other);
-+            }
-+         case 'track':
-+            if (!$arg) {
-+                return NULL;
-+            }
-+            list($word, $extra) = explode(' ', $arg, 2);
-+            if ($extra) {
-+                return NULL;
-+            } else if ($word == 'off') {
-+                return new TrackOffCommand($user);
-+            } else {
-+                return new TrackCommand($user, $word);
-+            }
-+         case 'untrack':
-+            if (!$arg) {
-+                return NULL;
-+            }
-+            list($word, $extra) = explode(' ', $arg, 2);
-+            if ($extra) {
-+                return NULL;
-+            } else if ($word == 'all') {
-+                return new TrackOffCommand($user);
-+            } else {
-+                return new UntrackCommand($user, $word);
-+            }
-+         case 'tracks':
-+         case 'tracking':
-+            if ($arg) {
-+                return NULL;
-+            }
-+            return new TrackingCommand($user);
-+         default:
-+            return false;
-+        }
-+    }
-hunk ./classes/Fave.php 23
--	static function addNew($user, $notice) {
--		$fave = new Fave();
--		$fave->user_id = $user->id;
--		$fave->notice_id = $notice->id;
--		if (!$fave->insert()) {
--			common_log_db_error($fave, 'INSERT', __FILE__);
--			return false;
--		}
--		return $fave;
--	}
--	
--	function &pkeyGet($kv) {
--		return Memcached_DataObject::pkeyGet('Fave', $kv);
--	}
-+    static function addNew($user, $notice) {
-+        $fave = new Fave();
-+        $fave->user_id = $user->id;
-+        $fave->notice_id = $notice->id;
-+        if (!$fave->insert()) {
-+            common_log_db_error($fave, 'INSERT', __FILE__);
-+            return false;
-+        }
-+        return $fave;
-+    }
-+    
-+    function &pkeyGet($kv) {
-+        return Memcached_DataObject::pkeyGet('Fave', $kv);
-+    }
-hunk ./classes/Foreign_link.php 29
--	// XXX:  This only returns a 1->1 single obj mapping.  Change?  Or make
--	// a getForeignUsers() that returns more than one? --Zach
--	static function getByUserID($user_id, $service) {
--		$flink = new Foreign_link();
--		$flink->service = $service;
--		$flink->user_id = $user_id;
--		$flink->limit(1);
-+    // XXX:  This only returns a 1->1 single obj mapping.  Change?  Or make
-+    // a getForeignUsers() that returns more than one? --Zach
-+    static function getByUserID($user_id, $service) {
-+        $flink = new Foreign_link();
-+        $flink->service = $service;
-+        $flink->user_id = $user_id;
-+        $flink->limit(1);
-hunk ./classes/Foreign_link.php 37
--		if ($flink->find(TRUE)) {
--			return $flink;
--		}
-+        if ($flink->find(TRUE)) {
-+            return $flink;
-+        }
+-    var $other = NULL;
+-    function __construct($user, $other=NULL) {
++    var $other = null;
++    function __construct($user, $other=null) {
+hunk ./classes/CommandInterpreter.php 40
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 47
+-                    return NULL;
++                    return null;
+hunk ./classes/CommandInterpreter.php 58
+-                    return NULL;
++                    return null;
+hunk ./classes/CommandInterpreter.php 68
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 75
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 79
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 86
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 90
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 97
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 101
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 107
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 111
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 117
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 121
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 127
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 131
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 137
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 141
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 147
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 152
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 156
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 162
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 166
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 174
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 178
+-                return NULL;
++                return null;
+hunk ./classes/CommandInterpreter.php 187
+-                return NULL;
++                return null;
+hunk ./classes/Confirm_address.php 23
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
+hunk ./classes/Consumer.php 19
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
+hunk ./classes/Fave.php 18
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Fave',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Fave',$k,$v); }
+hunk ./classes/Foreign_link.php 24
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
 hunk ./classes/Foreign_link.php 41
--		return NULL;		
--	}
--	
--	static function getByForeignID($foreign_id, $service) {
--		$flink = new Foreign_link();
--		$flink->service = $service;
--		$flink->foreign_id = $foreign_id;
--		$flink->limit(1);
-+        return NULL;        
-+    }
-+    
-+    static function getByForeignID($foreign_id, $service) {
-+        $flink = new Foreign_link();
-+        $flink->service = $service;
-+        $flink->foreign_id = $foreign_id;
-+        $flink->limit(1);
-hunk ./classes/Foreign_link.php 50
--		if ($flink->find(TRUE)) {
--			return $flink;
--		}
-+        if ($flink->find(TRUE)) {
-+            return $flink;
-+        }
+-        return NULL;        
++        return null;        
 hunk ./classes/Foreign_link.php 54
--		return NULL;		
--	}
--		
--	# Convenience methods
--	function getForeignUser() {		
--		$fuser = new Foreign_user();
--		$fuser->service = $this->service;
--		$fuser->id = $this->foreign_id;
--		
--		$fuser->limit(1);
--		
--		if ($fuser->find(TRUE)) {
--			return $fuser;
--		}
--		
--		return NULL;		
--	}
--	
--	function getUser() {
--		return User::staticGet($this->user_id);
--	}
--		
-+        return NULL;        
-+    }
-+        
-+    # Convenience methods
-+    function getForeignUser() {        
-+        $fuser = new Foreign_user();
-+        $fuser->service = $this->service;
-+        $fuser->id = $this->foreign_id;
-+        
-+        $fuser->limit(1);
-+        
-+        if ($fuser->find(TRUE)) {
-+            return $fuser;
-+        }
-+        
-+        return NULL;        
-+    }
-+    
-+    function getUser() {
-+        return User::staticGet($this->user_id);
-+    }
-+        
-hunk ./classes/Foreign_user.php 25
--	
--	// XXX:  This only returns a 1->1 single obj mapping.  Change?  Or make
--	// a getForeignUsers() that returns more than one? --Zach
--	static function getForeignUser($id, $service) {		
--		$fuser = new Foreign_user();
--		$fuser->whereAdd("service = $service");
--		$fuser->whereAdd("id = $id");
--		$fuser->limit(1);
--		
--		if ($fuser->find()) {
--			$fuser->fetch();
--			return $fuser;
--		}
--		
--		return NULL;		
--	}
--	
--	function updateKeys(&$orig) {
--		$parts = array();
--		foreach (array('id', 'service', 'uri', 'nickname') as $k) {
--			if (strcmp($this->$k, $orig->$k) != 0) {
--				$parts[] = $k . ' = ' . $this->_quote($this->$k);
--			}
--		}
--		if (count($parts) == 0) {
--			# No changes
--			return true;
--		}
--		$toupdate = implode(', ', $parts);
-+    
-+    // XXX:  This only returns a 1->1 single obj mapping.  Change?  Or make
-+    // a getForeignUsers() that returns more than one? --Zach
-+    static function getForeignUser($id, $service) {        
-+        $fuser = new Foreign_user();
-+        $fuser->whereAdd("service = $service");
-+        $fuser->whereAdd("id = $id");
-+        $fuser->limit(1);
-+        
-+        if ($fuser->find()) {
-+            $fuser->fetch();
-+            return $fuser;
-+        }
-+        
-+        return NULL;        
-+    }
-+    
-+    function updateKeys(&$orig) {
-+        $parts = array();
-+        foreach (array('id', 'service', 'uri', 'nickname') as $k) {
-+            if (strcmp($this->$k, $orig->$k) != 0) {
-+                $parts[] = $k . ' = ' . $this->_quote($this->$k);
-+            }
-+        }
-+        if (count($parts) == 0) {
-+            # No changes
-+            return true;
-+        }
-+        $toupdate = implode(', ', $parts);
-hunk ./classes/Foreign_user.php 55
--		$table = $this->tableName();
--		if(common_config('db','quote_identifiers')) {
--			$table = '"' . $table . '"';
--		}
--		$qry = 'UPDATE ' . $table . ' SET ' . $toupdate .
--		  ' WHERE id = ' . $this->id;
--		$orig->decache();
--		$result = $this->query($qry);
--		if ($result) {
--			$this->encache();
--		}
--		return $result;
--	}
-+        $table = $this->tableName();
-+        if(common_config('db','quote_identifiers')) {
-+            $table = '"' . $table . '"';
-+        }
-+        $qry = 'UPDATE ' . $table . ' SET ' . $toupdate .
-+          ' WHERE id = ' . $this->id;
-+        $orig->decache();
-+        $result = $this->query($qry);
-+        if ($result) {
-+            $this->encache();
-+        }
-+        return $result;
-+    }
-hunk ./classes/Foreign_user.php 69
--	
-+    
-hunk ./classes/Memcached_DataObject.php 27
--		if (is_null($v)) {
--			$v = $k;
--			# XXX: HACK!
--			$i = new $cls;
--			$keys = $i->keys();
--			$k = $keys[0];
--			unset($i);
--		}
--		$i = Memcached_DataObject::getcached($cls, $k, $v);
--		if ($i) {
--			return $i;
--		} else {
--			$i = DB_DataObject::staticGet($cls, $k, $v);
--			if ($i) {
--				$i->encache();
--			}
--			return $i;
--		}
--	}
-+        if (is_null($v)) {
-+            $v = $k;
-+            # XXX: HACK!
-+            $i = new $cls;
-+            $keys = $i->keys();
-+            $k = $keys[0];
-+            unset($i);
-+        }
-+        $i = Memcached_DataObject::getcached($cls, $k, $v);
-+        if ($i) {
-+            return $i;
-+        } else {
-+            $i = DB_DataObject::staticGet($cls, $k, $v);
-+            if ($i) {
-+                $i->encache();
-+            }
-+            return $i;
-+        }
-+    }
-hunk ./classes/Memcached_DataObject.php 47
--	function &pkeyGet($cls, $kv) {
--		$i = Memcached_DataObject::multicache($cls, $kv);
--		if ($i) {
--			return $i;
--		} else {
--			$i = new $cls();
--			foreach ($kv as $k => $v) {
--				$i->$k = $v;
--			}
--			if ($i->find(true)) {
--				$i->encache();
--			} else {
--				$i = NULL;
--			}
-+    function &pkeyGet($cls, $kv) {
-+        $i = Memcached_DataObject::multicache($cls, $kv);
-+        if ($i) {
-+            return $i;
-+        } else {
-+            $i = new $cls();
-+            foreach ($kv as $k => $v) {
-+                $i->$k = $v;
-+            }
-+            if ($i->find(true)) {
-+                $i->encache();
-+            } else {
-+                $i = NULL;
-+            }
-hunk ./classes/Memcached_DataObject.php 62
--		}
--	}
-+        }
-+    }
-hunk ./classes/Memcached_DataObject.php 65
--	function insert() {
--		$result = parent::insert();
--		return $result;
--	}
--	
--	function update($orig=NULL) {
--		if (is_object($orig) && $orig instanceof Memcached_DataObject) {
--			$orig->decache(); # might be different keys
--		}
--		$result = parent::update($orig);
--		if ($result) {
--			$this->encache();
--		}
--		return $result;
--	}
--	
--	function delete() {
--		$this->decache(); # while we still have the values!
--		return parent::delete();
--	}
--	
--	static function memcache() {
--		return common_memcache();
--	}
--	
--	static function cacheKey($cls, $k, $v) {
--		return common_cache_key(strtolower($cls).':'.$k.':'.$v);
--	}
--	
--	static function getcached($cls, $k, $v) {
--		$c = Memcached_DataObject::memcache();
--		if (!$c) {
--			return false;
--		} else {
--			return $c->get(Memcached_DataObject::cacheKey($cls, $k, $v));
--		}
--	}
-+    function insert() {
-+        $result = parent::insert();
-+        return $result;
-+    }
-+    
-+    function update($orig=NULL) {
-+        if (is_object($orig) && $orig instanceof Memcached_DataObject) {
-+            $orig->decache(); # might be different keys
-+        }
-+        $result = parent::update($orig);
-+        if ($result) {
-+            $this->encache();
-+        }
-+        return $result;
-+    }
-+    
-+    function delete() {
-+        $this->decache(); # while we still have the values!
-+        return parent::delete();
-+    }
-+    
-+    static function memcache() {
-+        return common_memcache();
-+    }
-+    
-+    static function cacheKey($cls, $k, $v) {
-+        return common_cache_key(strtolower($cls).':'.$k.':'.$v);
-+    }
-+    
-+    static function getcached($cls, $k, $v) {
-+        $c = Memcached_DataObject::memcache();
-+        if (!$c) {
-+            return false;
-+        } else {
-+            return $c->get(Memcached_DataObject::cacheKey($cls, $k, $v));
-+        }
-+    }
-hunk ./classes/Memcached_DataObject.php 103
--	function keyTypes() {
--		global $_DB_DATAOBJECT;
-+    function keyTypes() {
-+        global $_DB_DATAOBJECT;
-hunk ./classes/Memcached_DataObject.php 106
--			$this->databaseStructure();
-+            $this->databaseStructure();
-hunk ./classes/Memcached_DataObject.php 109
--		return $_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"];
--	}
--	
--	function encache() {
--		$c = $this->memcache();
--		if (!$c) {
--			return false;
--		} else {
--			$pkey = array();
--			$pval = array();			
--			$types = $this->keyTypes();
--			ksort($types);
--			foreach ($types as $key => $type) {
--				if ($type == 'K') {
--					$pkey[] = $key;
--					$pval[] = $this->$key;
--				} else {
--					$c->set($this->cacheKey($this->tableName(), $key, $this->$key), $this);
--				}
--			}
--			# XXX: should work for both compound and scalar pkeys
--			$pvals = implode(',', $pval);
--			$pkeys = implode(',', $pkey);
--			$c->set($this->cacheKey($this->tableName(), $pkeys, $pvals), $this);
--		}
--	}
--	
--	function decache() {
--		$c = $this->memcache();
--		if (!$c) {
--			return false;
--		} else {
--			$pkey = array();
--			$pval = array();			
--			$types = $this->keyTypes();
--			ksort($types);
--			foreach ($types as $key => $type) {
--				if ($type == 'K') {
--					$pkey[] = $key;
--					$pval[] = $this->$key;
--				} else {
--					$c->delete($this->cacheKey($this->tableName(), $key, $this->$key));
--				}
--			}
--			# should work for both compound and scalar pkeys
--			# XXX: comma works for now but may not be safe separator for future keys
--			$pvals = implode(',', $pval);
--			$pkeys = implode(',', $pkey);
--			$c->delete($this->cacheKey($this->tableName(), $pkeys, $pvals));
--		}
--	}
-+        return $_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"];
-+    }
-+    
-+    function encache() {
-+        $c = $this->memcache();
-+        if (!$c) {
-+            return false;
-+        } else {
-+            $pkey = array();
-+            $pval = array();            
-+            $types = $this->keyTypes();
-+            ksort($types);
-+            foreach ($types as $key => $type) {
-+                if ($type == 'K') {
-+                    $pkey[] = $key;
-+                    $pval[] = $this->$key;
-+                } else {
-+                    $c->set($this->cacheKey($this->tableName(), $key, $this->$key), $this);
-+                }
-+            }
-+            # XXX: should work for both compound and scalar pkeys
-+            $pvals = implode(',', $pval);
-+            $pkeys = implode(',', $pkey);
-+            $c->set($this->cacheKey($this->tableName(), $pkeys, $pvals), $this);
-+        }
-+    }
-+    
-+    function decache() {
-+        $c = $this->memcache();
-+        if (!$c) {
-+            return false;
-+        } else {
-+            $pkey = array();
-+            $pval = array();            
-+            $types = $this->keyTypes();
-+            ksort($types);
-+            foreach ($types as $key => $type) {
-+                if ($type == 'K') {
-+                    $pkey[] = $key;
-+                    $pval[] = $this->$key;
-+                } else {
-+                    $c->delete($this->cacheKey($this->tableName(), $key, $this->$key));
-+                }
-+            }
-+            # should work for both compound and scalar pkeys
-+            # XXX: comma works for now but may not be safe separator for future keys
-+            $pvals = implode(',', $pval);
-+            $pkeys = implode(',', $pkey);
-+            $c->delete($this->cacheKey($this->tableName(), $pkeys, $pvals));
-+        }
-+    }
-hunk ./classes/Memcached_DataObject.php 161
--	function multicache($cls, $kv) {
--		ksort($kv);
--		$c = Memcached_DataObject::memcache();
--		if (!$c) {
--			return false;
--		} else {
--			$pkeys = implode(',', array_keys($kv));
--			$pvals = implode(',', array_values($kv));
--			return $c->get(Memcached_DataObject::cacheKey($cls, $pkeys, $pvals));
--		}
--	}
-+    function multicache($cls, $kv) {
-+        ksort($kv);
-+        $c = Memcached_DataObject::memcache();
-+        if (!$c) {
-+            return false;
-+        } else {
-+            $pkeys = implode(',', array_keys($kv));
-+            $pvals = implode(',', array_values($kv));
-+            return $c->get(Memcached_DataObject::cacheKey($cls, $pkeys, $pvals));
-+        }
-+    }
-hunk ./classes/Message.php 29
--	
--	function getFrom() {
--		return Profile::staticGet('id', $this->from_profile);
--	}
--	
--	function getTo() {
--		return Profile::staticGet('id', $this->to_profile);
--	}
--	
--	static function saveNew($from, $to, $content, $source) {
--		
--		$msg = new Message();
--		
--		$msg->from_profile = $from;
--		$msg->to_profile = $to;
--		$msg->content = common_shorten_links($content);
--		$msg->rendered = common_render_text($content);
--		$msg->created = common_sql_now();
--		$msg->source = $source;
--		
--		$result = $msg->insert();
--		
--		if (!$result) {
--			common_log_db_error($msg, 'INSERT', __FILE__);
--			return _('Could not insert message.');
--		}
--		
--		$orig = clone($msg);
--		$msg->uri = common_local_url('showmessage', array('message' => $msg->id));
--		
--		$result = $msg->update($orig);
--		
--		if (!$result) {
--			common_log_db_error($msg, 'UPDATE', __FILE__);
--			return _('Could not update message with new URI.');
--		}
--		
--		return $msg;
--	}
-+    
-+    function getFrom() {
-+        return Profile::staticGet('id', $this->from_profile);
-+    }
-+    
-+    function getTo() {
-+        return Profile::staticGet('id', $this->to_profile);
-+    }
-+    
-+    static function saveNew($from, $to, $content, $source) {
-+        
-+        $msg = new Message();
-+        
-+        $msg->from_profile = $from;
-+        $msg->to_profile = $to;
-+        $msg->content = common_shorten_links($content);
-+        $msg->rendered = common_render_text($content);
-+        $msg->created = common_sql_now();
-+        $msg->source = $source;
-+        
-+        $result = $msg->insert();
-+        
-+        if (!$result) {
-+            common_log_db_error($msg, 'INSERT', __FILE__);
-+            return _('Could not insert message.');
-+        }
-+        
-+        $orig = clone($msg);
-+        $msg->uri = common_local_url('showmessage', array('message' => $msg->id));
-+        
-+        $result = $msg->update($orig);
-+        
-+        if (!$result) {
-+            common_log_db_error($msg, 'UPDATE', __FILE__);
-+            return _('Could not update message with new URI.');
-+        }
-+        
-+        return $msg;
-+    }
-hunk ./classes/Notice.php 13
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./classes/Notice.php 17
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./classes/Notice.php 34
--	###START_AUTOCODE
--	/* the code below is auto generated do not remove the above tag */
-+    ###START_AUTOCODE
-+    /* the code below is auto generated do not remove the above tag */
-hunk ./classes/Notice.php 37
--	public $__table = 'notice';							 // table name
--	public $id;								 // int(4)	primary_key not_null
--	public $profile_id;						 // int(4)	 not_null
--	public $uri;							 // varchar(255)  unique_key
--	public $content;						 // varchar(140)
--	public $rendered;						 // text()
--	public $url;							 // varchar(255)
--	public $created;						 // datetime()	 not_null
--	public $modified;						 // timestamp()	  not_null default_CURRENT_TIMESTAMP
--	public $reply_to;						 // int(4)
--	public $is_local;						 // tinyint(1)
--	public $source;							 // varchar(32)
-+    public $__table = 'notice';                             // table name
-+    public $id;                                 // int(4)    primary_key not_null
-+    public $profile_id;                         // int(4)     not_null
-+    public $uri;                             // varchar(255)  unique_key
-+    public $content;                         // varchar(140)
-+    public $rendered;                         // text()
-+    public $url;                             // varchar(255)
-+    public $created;                         // datetime()     not_null
-+    public $modified;                         // timestamp()      not_null default_CURRENT_TIMESTAMP
-+    public $reply_to;                         // int(4)
-+    public $is_local;                         // tinyint(1)
-+    public $source;                             // varchar(32)
-hunk ./classes/Notice.php 50
--	/* Static get */
--	function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
-+    /* Static get */
-+    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
-hunk ./classes/Notice.php 53
--	/* the code above is auto generated do not remove the tag below */
--	###END_AUTOCODE
-+    /* the code above is auto generated do not remove the tag below */
-+    ###END_AUTOCODE
-hunk ./classes/Notice.php 56
--	function getProfile() {
--		return Profile::staticGet('id', $this->profile_id);
--	}
-+    function getProfile() {
-+        return Profile::staticGet('id', $this->profile_id);
-+    }
-hunk ./classes/Notice.php 60
--	function delete() {
--		$this->blowCaches(true);
--		$this->blowFavesCache(true);
--		$this->blowInboxes();
--		return parent::delete();
--	}
-+    function delete() {
-+        $this->blowCaches(true);
-+        $this->blowFavesCache(true);
-+        $this->blowInboxes();
-+        return parent::delete();
-+    }
-hunk ./classes/Notice.php 67
--	function saveTags() {
--		/* extract all #hastags */
--		$count = preg_match_all('/(?:^|\s)#([A-Za-z0-9_\-\.]{1,64})/', strtolower($this->content), $match);
--		if (!$count) {
--			return true;
--		}
-+    function saveTags() {
-+        /* extract all #hastags */
-+        $count = preg_match_all('/(?:^|\s)#([A-Za-z0-9_\-\.]{1,64})/', strtolower($this->content), $match);
-+        if (!$count) {
-+            return true;
-+        }
-hunk ./classes/Notice.php 74
--		/* elide characters we don't want in the tag */
--		$match[1] = str_replace(array('-', '_', '.'), '', $match[1]);
-+        /* elide characters we don't want in the tag */
-+        $match[1] = str_replace(array('-', '_', '.'), '', $match[1]);
-hunk ./classes/Notice.php 77
--		/* Add them to the database */
--		foreach(array_unique($match[1]) as $hashtag) {
--			$tag = DB_DataObject::factory('Notice_tag');
--			$tag->notice_id = $this->id;
--			$tag->tag = $hashtag;
--			$tag->created = $this->created;
--			$id = $tag->insert();
--			if (!$id) {
--				$last_error = PEAR::getStaticProperty('DB_DataObject','lastError');
--				common_log(LOG_ERR, 'DB error inserting hashtag: ' . $last_error->message);
--				common_server_error(sprintf(_('DB error inserting hashtag: %s'), $last_error->message));
--				return;
--			}
--		}
--		return true;
--	}
-+        /* Add them to the database */
-+        foreach(array_unique($match[1]) as $hashtag) {
-+            $tag = DB_DataObject::factory('Notice_tag');
-+            $tag->notice_id = $this->id;
-+            $tag->tag = $hashtag;
-+            $tag->created = $this->created;
-+            $id = $tag->insert();
-+            if (!$id) {
-+                $last_error = PEAR::getStaticProperty('DB_DataObject','lastError');
-+                common_log(LOG_ERR, 'DB error inserting hashtag: ' . $last_error->message);
-+                common_server_error(sprintf(_('DB error inserting hashtag: %s'), $last_error->message));
-+                return;
-+            }
-+        }
-+        return true;
-+    }
+-        return NULL;        
++        return null;        
+hunk ./classes/Foreign_link.php 69
+-        return NULL;        
++        return null;        
+hunk ./classes/Foreign_service.php 20
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
+hunk ./classes/Foreign_subscription.php 19
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
+hunk ./classes/Foreign_user.php 21
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
+hunk ./classes/Foreign_user.php 39
+-        return NULL;        
++        return null;        
+hunk ./classes/Invitation.php 20
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
+hunk ./classes/Memcached_DataObject.php 26
+-    function &staticGet($cls, $k, $v=NULL) {
++    function &staticGet($cls, $k, $v=null) {
+hunk ./classes/Memcached_DataObject.php 59
+-                $i = NULL;
++                $i = null;
+hunk ./classes/Memcached_DataObject.php 70
+-    function update($orig=NULL) {
++    function update($orig=null) {
+hunk ./classes/Message.php 25
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Message',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Message',$k,$v); }
+hunk ./classes/Nonce.php 21
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
+hunk ./classes/Notice.php 51
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
 hunk ./classes/Notice.php 94
--	static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL, $uri=NULL) {
-+    static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL, $uri=NULL) {
-hunk ./classes/Notice.php 96
--		$profile = Profile::staticGet($profile_id);
-+        $profile = Profile::staticGet($profile_id);
-hunk ./classes/Notice.php 105
--			return _('Too many notices too fast; take a breather and post again in a few minutes.');
-+            return _('Too many notices too fast; take a breather and post again in a few minutes.');
-hunk ./classes/Notice.php 108
--		$banned = common_config('profile', 'banned');
-+        $banned = common_config('profile', 'banned');
-hunk ./classes/Notice.php 110
--		if ( in_array($profile_id, $banned) || in_array($profile->nickname, $banned)) {
--			common_log(LOG_WARNING, "Attempted post from banned user: $profile->nickname (user id = $profile_id).");
-+        if ( in_array($profile_id, $banned) || in_array($profile->nickname, $banned)) {
-+            common_log(LOG_WARNING, "Attempted post from banned user: $profile->nickname (user id = $profile_id).");
-hunk ./classes/Notice.php 113
--		}
-+        }
-hunk ./classes/Notice.php 115
--		$notice = new Notice();
--		$notice->profile_id = $profile_id;
-+        $notice = new Notice();
-+        $notice->profile_id = $profile_id;
-hunk ./classes/Notice.php 118
--		$blacklist = common_config('public', 'blacklist');
-+        $blacklist = common_config('public', 'blacklist');
-hunk ./classes/Notice.php 120
--		# Blacklisted are non-false, but not 1, either
-+        # Blacklisted are non-false, but not 1, either
-hunk ./classes/Notice.php 122
--		if ($blacklist && in_array($profile_id, $blacklist)) {
--			$notice->is_local = -1;
--		} else {
--			$notice->is_local = $is_local;
--		}
-+        if ($blacklist && in_array($profile_id, $blacklist)) {
-+            $notice->is_local = -1;
-+        } else {
-+            $notice->is_local = $is_local;
-+        }
-hunk ./classes/Notice.php 128
--		$notice->reply_to = $reply_to;
--		$notice->created = common_sql_now();
--		$notice->content = common_shorten_links($content);
--		$notice->rendered = common_render_content($notice->content, $notice);
--		$notice->source = $source;
--		$notice->uri = $uri;
-+        $notice->reply_to = $reply_to;
-+        $notice->created = common_sql_now();
-+        $notice->content = common_shorten_links($content);
-+        $notice->rendered = common_render_content($notice->content, $notice);
-+        $notice->source = $source;
-+        $notice->uri = $uri;
-hunk ./classes/Notice.php 135
--		$id = $notice->insert();
-+        $id = $notice->insert();
-hunk ./classes/Notice.php 137
--		if (!$id) {
--			common_log_db_error($notice, 'INSERT', __FILE__);
--			return _('Problem saving notice.');
--		}
-+        if (!$id) {
-+            common_log_db_error($notice, 'INSERT', __FILE__);
-+            return _('Problem saving notice.');
-+        }
-hunk ./classes/Notice.php 142
--		# Update the URI after the notice is in the database
--		if (!$uri) {
--			$orig = clone($notice);
--			$notice->uri = common_notice_uri($notice);
-+        # Update the URI after the notice is in the database
-+        if (!$uri) {
-+            $orig = clone($notice);
-+            $notice->uri = common_notice_uri($notice);
-hunk ./classes/Notice.php 147
--			if (!$notice->update($orig)) {
--				common_log_db_error($notice, 'UPDATE', __FILE__);
--				return _('Problem saving notice.');
--			}
--		}
-+            if (!$notice->update($orig)) {
-+                common_log_db_error($notice, 'UPDATE', __FILE__);
-+                return _('Problem saving notice.');
-+            }
-+        }
-hunk ./classes/Notice.php 153
--		# XXX: do we need to change this for remote users?
-+        # XXX: do we need to change this for remote users?
-hunk ./classes/Notice.php 155
--		common_save_replies($notice);
--		$notice->saveTags();
-+        common_save_replies($notice);
-+        $notice->saveTags();
-hunk ./classes/Notice.php 158
--		# Clear the cache for subscribed users, so they'll update at next request
--		# XXX: someone clever could prepend instead of clearing the cache
-+        # Clear the cache for subscribed users, so they'll update at next request
-+        # XXX: someone clever could prepend instead of clearing the cache
-hunk ./classes/Notice.php 161
--		if (common_config('memcached', 'enabled')) {
--			$notice->blowCaches();
--		}
-+        if (common_config('memcached', 'enabled')) {
-+            $notice->blowCaches();
-+        }
-hunk ./classes/Notice.php 165
--		$notice->addToInboxes();
--		return $notice;
--	}
-+        $notice->addToInboxes();
-+        return $notice;
-+    }
-hunk ./classes/Notice.php 187
--	function blowCaches($blowLast=false) {
--		$this->blowSubsCache($blowLast);
--		$this->blowNoticeCache($blowLast);
--		$this->blowRepliesCache($blowLast);
--		$this->blowPublicCache($blowLast);
--		$this->blowTagCache($blowLast);
--	}
-+    function blowCaches($blowLast=false) {
-+        $this->blowSubsCache($blowLast);
-+        $this->blowNoticeCache($blowLast);
-+        $this->blowRepliesCache($blowLast);
-+        $this->blowPublicCache($blowLast);
-+        $this->blowTagCache($blowLast);
-+    }
-hunk ./classes/Notice.php 195
--	function blowTagCache($blowLast=false) {
--		$cache = common_memcache();
--		if ($cache) {
--			$tag = new Notice_tag();
--			$tag->notice_id = $this->id;
--			if ($tag->find()) {
--				while ($tag->fetch()) {
--					$cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag));
--					if ($blowLast) {
--						$cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag . ';last'));
--					}
--				}
--			}
--			$tag->free();
--			unset($tag);
--		}
--	}
-+    function blowTagCache($blowLast=false) {
-+        $cache = common_memcache();
-+        if ($cache) {
-+            $tag = new Notice_tag();
-+            $tag->notice_id = $this->id;
-+            if ($tag->find()) {
-+                while ($tag->fetch()) {
-+                    $cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag));
-+                    if ($blowLast) {
-+                        $cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag . ';last'));
-+                    }
-+                }
-+            }
-+            $tag->free();
-+            unset($tag);
-+        }
-+    }
-hunk ./classes/Notice.php 213
--	function blowSubsCache($blowLast=false) {
--		$cache = common_memcache();
--		if ($cache) {
--			$user = new User();
-+    function blowSubsCache($blowLast=false) {
-+        $cache = common_memcache();
-+        if ($cache) {
-+            $user = new User();
-hunk ./classes/Notice.php 218
--			$user->query('SELECT id ' .
--						 'FROM user JOIN subscription ON user.id = subscription.subscriber ' .
--						 'WHERE subscription.subscribed = ' . $this->profile_id);
-+            $user->query('SELECT id ' .
-+                         'FROM user JOIN subscription ON user.id = subscription.subscriber ' .
-+                         'WHERE subscription.subscribed = ' . $this->profile_id);
-hunk ./classes/Notice.php 222
--			while ($user->fetch()) {
--				$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
--				if ($blowLast) {
--					$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id . ';last'));
--				}
--			}
--			$user->free();
--			unset($user);
--		}
--	}
-+            while ($user->fetch()) {
-+                $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
-+                if ($blowLast) {
-+                    $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id . ';last'));
-+                }
-+            }
-+            $user->free();
-+            unset($user);
-+        }
-+    }
-hunk ./classes/Notice.php 233
--	function blowNoticeCache($blowLast=false) {
--		if ($this->is_local) {
--			$cache = common_memcache();
--			if ($cache) {
--				$cache->delete(common_cache_key('profile:notices:'.$this->profile_id));
--				if ($blowLast) {
--					$cache->delete(common_cache_key('profile:notices:'.$this->profile_id.';last'));
--				}
--			}
--		}
--	}
-+    function blowNoticeCache($blowLast=false) {
-+        if ($this->is_local) {
-+            $cache = common_memcache();
-+            if ($cache) {
-+                $cache->delete(common_cache_key('profile:notices:'.$this->profile_id));
-+                if ($blowLast) {
-+                    $cache->delete(common_cache_key('profile:notices:'.$this->profile_id.';last'));
-+                }
-+            }
-+        }
-+    }
-hunk ./classes/Notice.php 245
--	function blowRepliesCache($blowLast=false) {
--		$cache = common_memcache();
--		if ($cache) {
--			$reply = new Reply();
--			$reply->notice_id = $this->id;
--			if ($reply->find()) {
--				while ($reply->fetch()) {
--					$cache->delete(common_cache_key('user:replies:'.$reply->profile_id));
--					if ($blowLast) {
--						$cache->delete(common_cache_key('user:replies:'.$reply->profile_id.';last'));
--					}
--				}
--			}
--			$reply->free();
--			unset($reply);
--		}
--	}
-+    function blowRepliesCache($blowLast=false) {
-+        $cache = common_memcache();
-+        if ($cache) {
-+            $reply = new Reply();
-+            $reply->notice_id = $this->id;
-+            if ($reply->find()) {
-+                while ($reply->fetch()) {
-+                    $cache->delete(common_cache_key('user:replies:'.$reply->profile_id));
-+                    if ($blowLast) {
-+                        $cache->delete(common_cache_key('user:replies:'.$reply->profile_id.';last'));
-+                    }
-+                }
-+            }
-+            $reply->free();
-+            unset($reply);
-+        }
-+    }
-hunk ./classes/Notice.php 263
--	function blowPublicCache($blowLast=false) {
--		if ($this->is_local == 1) {
--			$cache = common_memcache();
--			if ($cache) {
--				$cache->delete(common_cache_key('public'));
--				if ($blowLast) {
--					$cache->delete(common_cache_key('public').';last');
--				}
--			}
--		}
--	}
-+    function blowPublicCache($blowLast=false) {
-+        if ($this->is_local == 1) {
-+            $cache = common_memcache();
-+            if ($cache) {
-+                $cache->delete(common_cache_key('public'));
-+                if ($blowLast) {
-+                    $cache->delete(common_cache_key('public').';last');
-+                }
-+            }
-+        }
-+    }
-hunk ./classes/Notice.php 275
--	function blowFavesCache($blowLast=false) {
--		$cache = common_memcache();
--		if ($cache) {
--			$fave = new Fave();
--			$fave->notice_id = $this->id;
--			if ($fave->find()) {
--				while ($fave->fetch()) {
--					$cache->delete(common_cache_key('user:faves:'.$fave->user_id));
--					if ($blowLast) {
--						$cache->delete(common_cache_key('user:faves:'.$fave->user_id.';last'));
--					}
--				}
--			}
--			$fave->free();
--			unset($fave);
--		}
--	}
-+    function blowFavesCache($blowLast=false) {
-+        $cache = common_memcache();
-+        if ($cache) {
-+            $fave = new Fave();
-+            $fave->notice_id = $this->id;
-+            if ($fave->find()) {
-+                while ($fave->fetch()) {
-+                    $cache->delete(common_cache_key('user:faves:'.$fave->user_id));
-+                    if ($blowLast) {
-+                        $cache->delete(common_cache_key('user:faves:'.$fave->user_id.';last'));
-+                    }
-+                }
-+            }
-+            $fave->free();
-+            unset($fave);
-+        }
-+    }
-hunk ./classes/Notice.php 293
--	# XXX: too many args; we need to move to named params or even a separate
--	# class for notice streams
-+    # XXX: too many args; we need to move to named params or even a separate
-+    # class for notice streams
+-    static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL, $uri=NULL) {
++    static function saveNew($profile_id, $content, $source=null, $is_local=1, $reply_to=null, $uri=null) {
 hunk ./classes/Notice.php 296
--	static function getStream($qry, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $order=NULL, $since=NULL) {
-+    static function getStream($qry, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $order=NULL, $since=NULL) {
-hunk ./classes/Notice.php 298
--		if (common_config('memcached', 'enabled')) {
-+        if (common_config('memcached', 'enabled')) {
-hunk ./classes/Notice.php 300
--			# Skip the cache if this is a since, since_id or before_id qry
--			if ($since_id > 0 || $before_id > 0 || $since) {
--				return Notice::getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since);
--			} else {
--				return Notice::getCachedStream($qry, $cachekey, $offset, $limit, $order);
--			}
--		}
-+            # Skip the cache if this is a since, since_id or before_id qry
-+            if ($since_id > 0 || $before_id > 0 || $since) {
-+                return Notice::getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since);
-+            } else {
-+                return Notice::getCachedStream($qry, $cachekey, $offset, $limit, $order);
-+            }
-+        }
-hunk ./classes/Notice.php 308
--		return Notice::getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since);
--	}
-+        return Notice::getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since);
-+    }
-hunk ./classes/Notice.php 311
--	static function getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since) {
-+    static function getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since) {
-hunk ./classes/Notice.php 313
--		$needAnd = FALSE;
--		$needWhere = TRUE;
-+        $needAnd = FALSE;
-+        $needWhere = TRUE;
-hunk ./classes/Notice.php 316
--		if (preg_match('/\bWHERE\b/i', $qry)) {
--			$needWhere = FALSE;
--			$needAnd = TRUE;
--		}
-+        if (preg_match('/\bWHERE\b/i', $qry)) {
-+            $needWhere = FALSE;
-+            $needAnd = TRUE;
-+        }
-hunk ./classes/Notice.php 321
--		if ($since_id > 0) {
-+        if ($since_id > 0) {
-hunk ./classes/Notice.php 323
--			if ($needWhere) {
--				$qry .= ' WHERE ';
--				$needWhere = FALSE;
--			} else {
--				$qry .= ' AND ';
--			}
-+            if ($needWhere) {
-+                $qry .= ' WHERE ';
-+                $needWhere = FALSE;
-+            } else {
-+                $qry .= ' AND ';
-+            }
-hunk ./classes/Notice.php 330
--			$qry .= ' notice.id > ' . $since_id;
--		}
-+            $qry .= ' notice.id > ' . $since_id;
-+        }
-hunk ./classes/Notice.php 333
--		if ($before_id > 0) {
-+        if ($before_id > 0) {
-hunk ./classes/Notice.php 335
--			if ($needWhere) {
--				$qry .= ' WHERE ';
--				$needWhere = FALSE;
--			} else {
--				$qry .= ' AND ';
--			}
-+            if ($needWhere) {
-+                $qry .= ' WHERE ';
-+                $needWhere = FALSE;
-+            } else {
-+                $qry .= ' AND ';
-+            }
-hunk ./classes/Notice.php 342
--			$qry .= ' notice.id < ' . $before_id;
--		}
-+            $qry .= ' notice.id < ' . $before_id;
-+        }
-hunk ./classes/Notice.php 345
--		if ($since) {
-+        if ($since) {
-hunk ./classes/Notice.php 347
--			if ($needWhere) {
--				$qry .= ' WHERE ';
--				$needWhere = FALSE;
--			} else {
--				$qry .= ' AND ';
--			}
-+            if ($needWhere) {
-+                $qry .= ' WHERE ';
-+                $needWhere = FALSE;
-+            } else {
-+                $qry .= ' AND ';
-+            }
-hunk ./classes/Notice.php 354
--			$qry .= ' notice.created > \'' . date('Y-m-d H:i:s', $since) . '\'';
--		}
-+            $qry .= ' notice.created > \'' . date('Y-m-d H:i:s', $since) . '\'';
-+        }
-hunk ./classes/Notice.php 357
--		# Allow ORDER override
-+        # Allow ORDER override
-hunk ./classes/Notice.php 359
--		if ($order) {
--			$qry .= $order;
--		} else {
--			$qry .= ' ORDER BY notice.created DESC, notice.id DESC ';
--		}
-+        if ($order) {
-+            $qry .= $order;
-+        } else {
-+            $qry .= ' ORDER BY notice.created DESC, notice.id DESC ';
-+        }
-hunk ./classes/Notice.php 365
--		if (common_config('db','type') == 'pgsql') {
--			$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
--		} else {
--			$qry .= ' LIMIT ' . $offset . ', ' . $limit;
--		}
-+        if (common_config('db','type') == 'pgsql') {
-+            $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
-+        } else {
-+            $qry .= ' LIMIT ' . $offset . ', ' . $limit;
-+        }
-hunk ./classes/Notice.php 371
--		$notice = new Notice();
-+        $notice = new Notice();
-hunk ./classes/Notice.php 373
--		$notice->query($qry);
-+        $notice->query($qry);
-hunk ./classes/Notice.php 375
--		return $notice;
--	}
-+        return $notice;
-+    }
-hunk ./classes/Notice.php 378
--	# XXX: this is pretty long and should probably be broken up into
--	# some helper functions
-+    # XXX: this is pretty long and should probably be broken up into
-+    # some helper functions
-hunk ./classes/Notice.php 381
--	static function getCachedStream($qry, $cachekey, $offset, $limit, $order) {
-+    static function getCachedStream($qry, $cachekey, $offset, $limit, $order) {
-hunk ./classes/Notice.php 383
--		# If outside our cache window, just go to the DB
-+        # If outside our cache window, just go to the DB
-hunk ./classes/Notice.php 385
--		if ($offset + $limit > NOTICE_CACHE_WINDOW) {
--			return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
--		}
-+        if ($offset + $limit > NOTICE_CACHE_WINDOW) {
-+            return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
-+        }
-hunk ./classes/Notice.php 389
--		# Get the cache; if we can't, just go to the DB
-+        # Get the cache; if we can't, just go to the DB
-hunk ./classes/Notice.php 391
--		$cache = common_memcache();
-+        $cache = common_memcache();
-hunk ./classes/Notice.php 393
--		if (!$cache) {
--			return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
--		}
-+        if (!$cache) {
-+            return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
-+        }
-hunk ./classes/Notice.php 397
--		# Get the notices out of the cache
-+        # Get the notices out of the cache
-hunk ./classes/Notice.php 399
--		$notices = $cache->get(common_cache_key($cachekey));
-+        $notices = $cache->get(common_cache_key($cachekey));
-hunk ./classes/Notice.php 401
--		# On a cache hit, return a DB-object-like wrapper
-+        # On a cache hit, return a DB-object-like wrapper
-hunk ./classes/Notice.php 403
--		if ($notices !== FALSE) {
--			$wrapper = new NoticeWrapper(array_slice($notices, $offset, $limit));
--			return $wrapper;
--		}
-+        if ($notices !== FALSE) {
-+            $wrapper = new NoticeWrapper(array_slice($notices, $offset, $limit));
-+            return $wrapper;
-+        }
-hunk ./classes/Notice.php 408
--		# If the cache was invalidated because of new data being
--		# added, we can try and just get the new stuff. We keep an additional
--		# copy of the data at the key + ';last'
-+        # If the cache was invalidated because of new data being
-+        # added, we can try and just get the new stuff. We keep an additional
-+        # copy of the data at the key + ';last'
-hunk ./classes/Notice.php 412
--		# No cache hit. Try to get the *last* cached version
-+        # No cache hit. Try to get the *last* cached version
-hunk ./classes/Notice.php 414
--		$last_notices = $cache->get(common_cache_key($cachekey) . ';last');
-+        $last_notices = $cache->get(common_cache_key($cachekey) . ';last');
-hunk ./classes/Notice.php 416
--		if ($last_notices) {
-+        if ($last_notices) {
-hunk ./classes/Notice.php 418
--			# Reverse-chron order, so last ID is last.
-+            # Reverse-chron order, so last ID is last.
-hunk ./classes/Notice.php 420
--			$last_id = $last_notices[0]->id;
-+            $last_id = $last_notices[0]->id;
-hunk ./classes/Notice.php 422
--			# XXX: this assumes monotonically increasing IDs; a fair
--			# bet with our DB.
-+            # XXX: this assumes monotonically increasing IDs; a fair
-+            # bet with our DB.
-hunk ./classes/Notice.php 425
--			$new_notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW,
--												  $last_id, NULL, $order, NULL);
-+            $new_notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW,
-+                                                  $last_id, NULL, $order, NULL);
-hunk ./classes/Notice.php 428
--			if ($new_notice) {
--				$new_notices = array();
--				while ($new_notice->fetch()) {
--					$new_notices[] = clone($new_notice);
--				}
--				$new_notice->free();
--				$notices = array_slice(array_merge($new_notices, $last_notices),
--									   0, NOTICE_CACHE_WINDOW);
-+            if ($new_notice) {
-+                $new_notices = array();
-+                while ($new_notice->fetch()) {
-+                    $new_notices[] = clone($new_notice);
-+                }
-+                $new_notice->free();
-+                $notices = array_slice(array_merge($new_notices, $last_notices),
-+                                       0, NOTICE_CACHE_WINDOW);
-hunk ./classes/Notice.php 437
--				# Store the array in the cache for next time
-+                # Store the array in the cache for next time
-hunk ./classes/Notice.php 439
--				$result = $cache->set(common_cache_key($cachekey), $notices);
--				$result = $cache->set(common_cache_key($cachekey) . ';last', $notices);
-+                $result = $cache->set(common_cache_key($cachekey), $notices);
-+                $result = $cache->set(common_cache_key($cachekey) . ';last', $notices);
-hunk ./classes/Notice.php 442
--				# return a wrapper of the array for use now
-+                # return a wrapper of the array for use now
-hunk ./classes/Notice.php 444
--				return new NoticeWrapper(array_slice($notices, $offset, $limit));
--			}
--		}
-+                return new NoticeWrapper(array_slice($notices, $offset, $limit));
-+            }
-+        }
-hunk ./classes/Notice.php 448
--		# Otherwise, get the full cache window out of the DB
-+        # Otherwise, get the full cache window out of the DB
+-    static function getStream($qry, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $order=NULL, $since=NULL) {
++    static function getStream($qry, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $order=null, $since=null) {
+hunk ./classes/Notice.php 386
+-            return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
++            return Notice::getStreamDirect($qry, $offset, $limit, null, null, $order, null);
+hunk ./classes/Notice.php 394
+-            return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
++            return Notice::getStreamDirect($qry, $offset, $limit, null, null, $order, null);
+hunk ./classes/Notice.php 426
+-                                                  $last_id, NULL, $order, NULL);
++                                                  $last_id, null, $order, null);
 hunk ./classes/Notice.php 450
--		$notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW, NULL, NULL, $order, NULL);
-+        $notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW, NULL, NULL, $order, NULL);
-hunk ./classes/Notice.php 452
--		# If there are no hits, just return the value
-+        # If there are no hits, just return the value
-hunk ./classes/Notice.php 454
--		if (!$notice) {
--			return $notice;
--		}
-+        if (!$notice) {
-+            return $notice;
-+        }
-hunk ./classes/Notice.php 458
--		# Pack results into an array
-+        # Pack results into an array
-hunk ./classes/Notice.php 460
--		$notices = array();
-+        $notices = array();
-hunk ./classes/Notice.php 462
--		while ($notice->fetch()) {
--			$notices[] = clone($notice);
--		}
-+        while ($notice->fetch()) {
-+            $notices[] = clone($notice);
-+        }
-hunk ./classes/Notice.php 466
--		$notice->free();
-+        $notice->free();
-hunk ./classes/Notice.php 468
--		# Store the array in the cache for next time
-+        # Store the array in the cache for next time
-hunk ./classes/Notice.php 470
--		$result = $cache->set(common_cache_key($cachekey), $notices);
--		$result = $cache->set(common_cache_key($cachekey) . ';last', $notices);
-+        $result = $cache->set(common_cache_key($cachekey), $notices);
-+        $result = $cache->set(common_cache_key($cachekey) . ';last', $notices);
-hunk ./classes/Notice.php 473
--		# return a wrapper of the array for use now
-+        # return a wrapper of the array for use now
-hunk ./classes/Notice.php 475
--		$wrapper = new NoticeWrapper(array_slice($notices, $offset, $limit));
-+        $wrapper = new NoticeWrapper(array_slice($notices, $offset, $limit));
-hunk ./classes/Notice.php 477
--		return $wrapper;
--	}
-+        return $wrapper;
-+    }
+-        $notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW, NULL, NULL, $order, NULL);
++        $notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW, null, null, $order, null);
 hunk ./classes/Notice.php 480
--	function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=NULL) {
-+    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=NULL) {
-hunk ./classes/Notice.php 482
--		$parts = array();
-+        $parts = array();
-hunk ./classes/Notice.php 484
--		$qry = 'SELECT * FROM notice ';
-+        $qry = 'SELECT * FROM notice ';
-hunk ./classes/Notice.php 486
--		if (common_config('public', 'localonly')) {
--			$parts[] = 'is_local = 1';
--		} else {
--			# -1 == blacklisted
--			$parts[] = 'is_local != -1';
--		}
-+        if (common_config('public', 'localonly')) {
-+            $parts[] = 'is_local = 1';
-+        } else {
-+            # -1 == blacklisted
-+            $parts[] = 'is_local != -1';
-+        }
-hunk ./classes/Notice.php 493
--		if ($parts) {
--			$qry .= ' WHERE ' . implode(' AND ', $parts);
--		}
-+        if ($parts) {
-+            $qry .= ' WHERE ' . implode(' AND ', $parts);
-+        }
-hunk ./classes/Notice.php 497
--		return Notice::getStream($qry,
--								 'public',
--								 $offset, $limit, $since_id, $before_id, NULL, $since);
--	}
-+        return Notice::getStream($qry,
-+                                 'public',
-+                                 $offset, $limit, $since_id, $before_id, NULL, $since);
-+    }
-hunk ./classes/Notice.php 502
--	function addToInboxes() {
--		$enabled = common_config('inboxes', 'enabled');
-+    function addToInboxes() {
-+        $enabled = common_config('inboxes', 'enabled');
-hunk ./classes/Notice.php 505
--		if ($enabled === true || $enabled === 'transitional') {
--			$inbox = new Notice_inbox();
--			$qry = 'INSERT INTO notice_inbox (user_id, notice_id, created) ' .
--			  'SELECT user.id, ' . $this->id . ', "' . $this->created . '" ' .
--			  'FROM user JOIN subscription ON user.id = subscription.subscriber ' .
--			  'WHERE subscription.subscribed = ' . $this->profile_id . ' ' .
--			  'AND NOT EXISTS (SELECT user_id, notice_id ' .
--			  'FROM notice_inbox ' .
--			  'WHERE user_id = user.id ' .
--			  'AND notice_id = ' . $this->id . ' )';
--			if ($enabled === 'transitional') {
--				$qry .= ' AND user.inboxed = 1';
--			}
--			$inbox->query($qry);
--		}
--		return;
--	}
-+        if ($enabled === true || $enabled === 'transitional') {
-+            $inbox = new Notice_inbox();
-+            $qry = 'INSERT INTO notice_inbox (user_id, notice_id, created) ' .
-+              'SELECT user.id, ' . $this->id . ', "' . $this->created . '" ' .
-+              'FROM user JOIN subscription ON user.id = subscription.subscriber ' .
-+              'WHERE subscription.subscribed = ' . $this->profile_id . ' ' .
-+              'AND NOT EXISTS (SELECT user_id, notice_id ' .
-+              'FROM notice_inbox ' .
-+              'WHERE user_id = user.id ' .
-+              'AND notice_id = ' . $this->id . ' )';
-+            if ($enabled === 'transitional') {
-+                $qry .= ' AND user.inboxed = 1';
-+            }
-+            $inbox->query($qry);
-+        }
-+        return;
-+    }
-hunk ./classes/Notice.php 523
--	# Delete from inboxes if we're deleted.
-+    # Delete from inboxes if we're deleted.
-hunk ./classes/Notice.php 525
--	function blowInboxes() {
-+    function blowInboxes() {
-hunk ./classes/Notice.php 527
--		$enabled = common_config('inboxes', 'enabled');
-+        $enabled = common_config('inboxes', 'enabled');
-hunk ./classes/Notice.php 529
--		if ($enabled === true || $enabled === 'transitional') {
--			$inbox = new Notice_inbox();
--			$inbox->notice_id = $this->id;
--			$inbox->delete();
--		}
-+        if ($enabled === true || $enabled === 'transitional') {
-+            $inbox = new Notice_inbox();
-+            $inbox->notice_id = $this->id;
-+            $inbox->delete();
-+        }
-hunk ./classes/Notice.php 535
--		return;
--	}
-+        return;
-+    }
+-    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=NULL) {
++    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null) {
+hunk ./classes/Notice.php 499
+-                                 $offset, $limit, $since_id, $before_id, NULL, $since);
++                                 $offset, $limit, $since_id, $before_id, null, $since);
 hunk ./classes/NoticeWrapper.php 38
--	var $notices = NULL;
--	var $i = -1;
--	
--	function __construct($arr) {
--		$this->notices = $arr;
--	}
--	
--	function fetch() {
--		static $fields = array('id', 'profile_id', 'uri', 'content', 'rendered',
--							   'url', 'created', 'modified', 'reply_to', 'is_local', 'source');
--		$this->i++;
--		if ($this->i >= count($this->notices)) {
--			return false;
--		} else {
--			$n = $this->notices[$this->i];
--			foreach ($fields as $f) {
--				$this->$f = $n->$f;
--			}
--			return true;
--		}
--	}
-+    var $notices = NULL;
-+    var $i = -1;
-+    
-+    function __construct($arr) {
-+        $this->notices = $arr;
-+    }
-+    
-+    function fetch() {
-+        static $fields = array('id', 'profile_id', 'uri', 'content', 'rendered',
-+                               'url', 'created', 'modified', 'reply_to', 'is_local', 'source');
-+        $this->i++;
-+        if ($this->i >= count($this->notices)) {
-+            return false;
-+        } else {
-+            $n = $this->notices[$this->i];
-+            foreach ($fields as $f) {
-+                $this->$f = $n->$f;
-+            }
-+            return true;
-+        }
-+    }
-hunk ./classes/Notice_tag.php 37
--	
--	static function getStream($tag, $offset=0, $limit=20) {
--		$qry = 
--		  'SELECT notice.* ' .
--		  'FROM notice JOIN notice_tag ON notice.id = notice_tag.notice_id ' .
--		  'WHERE notice_tag.tag = "%s" ';
-+    
-+    static function getStream($tag, $offset=0, $limit=20) {
-+        $qry = 
-+          'SELECT notice.* ' .
-+          'FROM notice JOIN notice_tag ON notice.id = notice_tag.notice_id ' .
-+          'WHERE notice_tag.tag = "%s" ';
-hunk ./classes/Notice_tag.php 44
--		return Notice::getStream(sprintf($qry, $tag),
--								 'notice_tag:notice_stream:' . common_keyize($tag),
--								 $offset, $limit);
--	}
--	
--	function blowCache() {
--		$cache = common_memcache();
--		if ($cache) {
--			$cache->delete(common_cache_key('notice_tag:notice_stream:' . $this->tag));
--		}
--	}
-+        return Notice::getStream(sprintf($qry, $tag),
-+                                 'notice_tag:notice_stream:' . common_keyize($tag),
-+                                 $offset, $limit);
-+    }
-+    
-+    function blowCache() {
-+        $cache = common_memcache();
-+        if ($cache) {
-+            $cache->delete(common_cache_key('notice_tag:notice_stream:' . $this->tag));
-+        }
-+    }
+-    var $notices = NULL;
++    var $notices = null;
+hunk ./classes/Notice_inbox.php 36
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
+hunk ./classes/Notice_source.php 20
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
+hunk ./classes/Notice_tag.php 33
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
+hunk ./classes/Profile.php 44
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile',$k,$v); }
 hunk ./classes/Profile.php 49
--	function getAvatar($width, $height=NULL) {
--		if (is_null($height)) {
--			$height = $width;
--		}
--		return Avatar::pkeyGet(array('profile_id' => $this->id,
--									 'width' => $width,
--									 'height' => $height));
--	}
-+    function getAvatar($width, $height=NULL) {
-+        if (is_null($height)) {
-+            $height = $width;
-+        }
-+        return Avatar::pkeyGet(array('profile_id' => $this->id,
-+                                     'width' => $width,
-+                                     'height' => $height));
-+    }
-hunk ./classes/Profile.php 58
--	function getOriginalAvatar() {
--		$avatar = DB_DataObject::factory('avatar');
--		$avatar->profile_id = $this->id;
--		$avatar->original = true;
--		if ($avatar->find(true)) {
--			return $avatar;
--		} else {
--			return NULL;
--		}
--	}
-+    function getOriginalAvatar() {
-+        $avatar = DB_DataObject::factory('avatar');
-+        $avatar->profile_id = $this->id;
-+        $avatar->original = true;
-+        if ($avatar->find(true)) {
-+            return $avatar;
-+        } else {
-+            return NULL;
-+        }
-+    }
-hunk ./classes/Profile.php 69
--	function setOriginal($source) {
-+    function setOriginal($source) {
-hunk ./classes/Profile.php 71
--		$info = @getimagesize($source);
-+        $info = @getimagesize($source);
-hunk ./classes/Profile.php 73
--		if (!$info) {
--			return NULL;
--		}
-+        if (!$info) {
-+            return NULL;
-+        }
-hunk ./classes/Profile.php 77
--		$filename = common_avatar_filename($this->id,
--										   image_type_to_extension($info[2]),
--										   NULL, common_timestamp());
--		$filepath = common_avatar_path($filename);
-+        $filename = common_avatar_filename($this->id,
-+                                           image_type_to_extension($info[2]),
-+                                           NULL, common_timestamp());
-+        $filepath = common_avatar_path($filename);
-hunk ./classes/Profile.php 82
--		copy($source, $filepath);
-+        copy($source, $filepath);
-hunk ./classes/Profile.php 84
--		$avatar = new Avatar();
-+        $avatar = new Avatar();
-hunk ./classes/Profile.php 86
--		$avatar->profile_id = $this->id;
--		$avatar->width = $info[0];
--		$avatar->height = $info[1];
--		$avatar->mediatype = image_type_to_mime_type($info[2]);
--		$avatar->filename = $filename;
--		$avatar->original = true;
--		$avatar->url = common_avatar_url($filename);
--		$avatar->created = DB_DataObject_Cast::dateTime(); # current time
-+        $avatar->profile_id = $this->id;
-+        $avatar->width = $info[0];
-+        $avatar->height = $info[1];
-+        $avatar->mediatype = image_type_to_mime_type($info[2]);
-+        $avatar->filename = $filename;
-+        $avatar->original = true;
-+        $avatar->url = common_avatar_url($filename);
-+        $avatar->created = DB_DataObject_Cast::dateTime(); # current time
-hunk ./classes/Profile.php 95
--		# XXX: start a transaction here
-+        # XXX: start a transaction here
-hunk ./classes/Profile.php 97
--		if (!$this->delete_avatars()) {
--			@unlink($filepath);
--			return NULL;
--		}
-+        if (!$this->delete_avatars()) {
-+            @unlink($filepath);
-+            return NULL;
-+        }
-hunk ./classes/Profile.php 102
--		if (!$avatar->insert()) {
--			@unlink($filepath);
--			return NULL;
--		}
-+        if (!$avatar->insert()) {
-+            @unlink($filepath);
-+            return NULL;
-+        }
-hunk ./classes/Profile.php 107
--		foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
--			# We don't do a scaled one if original is our scaled size
--			if (!($avatar->width == $size && $avatar->height == $size)) {
--				$s = $avatar->scale($size);
--				if (!$s) {
--					return NULL;
--				}
--			}
--		}
-+        foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
-+            # We don't do a scaled one if original is our scaled size
-+            if (!($avatar->width == $size && $avatar->height == $size)) {
-+                $s = $avatar->scale($size);
-+                if (!$s) {
-+                    return NULL;
-+                }
-+            }
-+        }
-hunk ./classes/Profile.php 117
--		return $avatar;
--	}
-+        return $avatar;
-+    }
-hunk ./classes/Profile.php 120
--	function delete_avatars() {
--		$avatar = new Avatar();
--		$avatar->profile_id = $this->id;
--		$avatar->find();
--		while ($avatar->fetch()) {
--			$avatar->delete();
--		}
--		return true;
--	}
-+    function delete_avatars() {
-+        $avatar = new Avatar();
-+        $avatar->profile_id = $this->id;
-+        $avatar->find();
-+        while ($avatar->fetch()) {
-+            $avatar->delete();
-+        }
-+        return true;
-+    }
-hunk ./classes/Profile.php 130
--	function getBestName() {
--		return ($this->fullname) ? $this->fullname : $this->nickname;
--	}
-+    function getBestName() {
-+        return ($this->fullname) ? $this->fullname : $this->nickname;
-+    }
+-    function getAvatar($width, $height=NULL) {
++    function getAvatar($width, $height=null) {
+hunk ./classes/Profile.php 65
+-            return NULL;
++            return null;
+hunk ./classes/Profile.php 74
+-            return NULL;
++            return null;
+hunk ./classes/Profile.php 79
+-                                           NULL, common_timestamp());
++                                           null, common_timestamp());
+hunk ./classes/Profile.php 99
+-            return NULL;
++            return null;
+hunk ./classes/Profile.php 104
+-            return NULL;
++            return null;
+hunk ./classes/Profile.php 112
+-                    return NULL;
++                    return null;
 hunk ./classes/Profile.php 135
--	function getCurrentNotice($dt=NULL) {
--		$notice = new Notice();
--		$notice->profile_id = $this->id;
--		if ($dt) {
--			$notice->whereAdd('created < "' . $dt . '"');
--		}
--		$notice->orderBy('created DESC, notice.id DESC');
--		$notice->limit(1);
--		if ($notice->find(true)) {
--			return $notice;
--		}
--		return NULL;
--	}
-+    function getCurrentNotice($dt=NULL) {
-+        $notice = new Notice();
-+        $notice->profile_id = $this->id;
-+        if ($dt) {
-+            $notice->whereAdd('created < "' . $dt . '"');
-+        }
-+        $notice->orderBy('created DESC, notice.id DESC');
-+        $notice->limit(1);
-+        if ($notice->find(true)) {
-+            return $notice;
-+        }
-+        return NULL;
-+    }
-hunk ./classes/Profile.php 149
--	function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) {
--		$qry =
--		  'SELECT * ' .
--		  'FROM notice ' .
--		  'WHERE profile_id = %d ';
-+    function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) {
-+        $qry =
-+          'SELECT * ' .
-+          'FROM notice ' .
-+          'WHERE profile_id = %d ';
-hunk ./classes/Profile.php 155
--		return Notice::getStream(sprintf($qry, $this->id),
--								 'profile:notices:'.$this->id,
--								 $offset, $limit, $since_id, $before_id);
--	}
-+        return Notice::getStream(sprintf($qry, $this->id),
-+                                 'profile:notices:'.$this->id,
-+                                 $offset, $limit, $since_id, $before_id);
-+    }
-hunk ./classes/Profile_tag.php 24
--	static function getTags($tagger, $tagged) {
--		
--		$tags = array();
-+    static function getTags($tagger, $tagged) {
-+        
-+        $tags = array();
-hunk ./classes/Profile_tag.php 28
--		# XXX: store this in memcached
--		
--		$profile_tag = new Profile_tag();
--		$profile_tag->tagger = $tagger;
--		$profile_tag->tagged = $tagged;
--		
--		$profile_tag->find();
--		
--		while ($profile_tag->fetch()) {
--			$tags[] = $profile_tag->tag;
--		}
--		
--		$profile_tag->free();
--		
--		return $tags;
--	}
--	
--	static function setTags($tagger, $tagged, $newtags) {
--		
--		$oldtags = Profile_tag::getTags($tagger, $tagged);
--		
--		# Delete stuff that's old that not in new
--		
--		$to_delete = array_diff($oldtags, $newtags);
--		
--		# Insert stuff that's in new and not in old
--		
--		$to_insert = array_diff($newtags, $oldtags);
--		
--		$profile_tag = new Profile_tag();
--		
--		$profile_tag->tagger = $tagger;
--		$profile_tag->tagged = $tagged;
--		
--		$profile_tag->query('BEGIN');
--		
--		foreach ($to_delete as $deltag) {
--			$profile_tag->tag = $deltag;
--			$result = $profile_tag->delete();
--			if (!$result) {
--				common_log_db_error($profile_tag, 'DELETE', __FILE__);
--				return false;
--			}
--		}
--		
--		foreach ($to_insert as $instag) {
--			$profile_tag->tag = $instag;
--			$result = $profile_tag->insert();
--			if (!$result) {
--				common_log_db_error($profile_tag, 'INSERT', __FILE__);
--				return false;
--			}
--		}
--		
--		$profile_tag->query('COMMIT');
--		
--		return true;
--	}
--	
--	# Return profiles with a given tag
--	static function getTagged($tagger, $tag) {
--		$profile = new Profile();
--		$profile->query('SELECT profile.* ' .
--						'FROM profile JOIN profile_tag ' .
--						'ON profile.id = profile_tag.tagged ' .
--						'WHERE profile_tag.tagger = ' . $tagger . ' ' .
--						'AND profile_tag.tag = "' . $tag . '" ');
--		$tagged = array();
--		while ($profile->fetch()) {
--			$tagged[] = clone($profile);
--		}
--		return $tagged;
--	}
-+        # XXX: store this in memcached
-+        
-+        $profile_tag = new Profile_tag();
-+        $profile_tag->tagger = $tagger;
-+        $profile_tag->tagged = $tagged;
-+        
-+        $profile_tag->find();
-+        
-+        while ($profile_tag->fetch()) {
-+            $tags[] = $profile_tag->tag;
-+        }
-+        
-+        $profile_tag->free();
-+        
-+        return $tags;
-+    }
-+    
-+    static function setTags($tagger, $tagged, $newtags) {
-+        
-+        $oldtags = Profile_tag::getTags($tagger, $tagged);
-+        
-+        # Delete stuff that's old that not in new
-+        
-+        $to_delete = array_diff($oldtags, $newtags);
-+        
-+        # Insert stuff that's in new and not in old
-+        
-+        $to_insert = array_diff($newtags, $oldtags);
-+        
-+        $profile_tag = new Profile_tag();
-+        
-+        $profile_tag->tagger = $tagger;
-+        $profile_tag->tagged = $tagged;
-+        
-+        $profile_tag->query('BEGIN');
-+        
-+        foreach ($to_delete as $deltag) {
-+            $profile_tag->tag = $deltag;
-+            $result = $profile_tag->delete();
-+            if (!$result) {
-+                common_log_db_error($profile_tag, 'DELETE', __FILE__);
-+                return false;
-+            }
-+        }
-+        
-+        foreach ($to_insert as $instag) {
-+            $profile_tag->tag = $instag;
-+            $result = $profile_tag->insert();
-+            if (!$result) {
-+                common_log_db_error($profile_tag, 'INSERT', __FILE__);
-+                return false;
-+            }
-+        }
-+        
-+        $profile_tag->query('COMMIT');
-+        
-+        return true;
-+    }
-+    
-+    # Return profiles with a given tag
-+    static function getTagged($tagger, $tag) {
-+        $profile = new Profile();
-+        $profile->query('SELECT profile.* ' .
-+                        'FROM profile JOIN profile_tag ' .
-+                        'ON profile.id = profile_tag.tagged ' .
-+                        'WHERE profile_tag.tagger = ' . $tagger . ' ' .
-+                        'AND profile_tag.tag = "' . $tag . '" ');
-+        $tagged = array();
-+        while ($profile->fetch()) {
-+            $tagged[] = clone($profile);
-+        }
-+        return $tagged;
-+    }
-hunk ./classes/Queue_item.php 25
--	
--	static function top($transport) {
-+    
-+    static function top($transport) {
-hunk ./classes/Queue_item.php 28
--		$qi = new Queue_item();
--		$qi->transport = $transport;
--		$qi->orderBy('created');
--		$qi->whereAdd('claimed is NULL');
-+        $qi = new Queue_item();
-+        $qi->transport = $transport;
-+        $qi->orderBy('created');
-+        $qi->whereAdd('claimed is NULL');
-hunk ./classes/Queue_item.php 33
--		$qi->limit(1);
-+        $qi->limit(1);
-hunk ./classes/Queue_item.php 35
--		$cnt = $qi->find(TRUE);
-+        $cnt = $qi->find(TRUE);
-hunk ./classes/Queue_item.php 37
--		if ($cnt) {
--			# XXX: potential race condition
--			# can we force it to only update if claimed is still NULL
--			# (or old)?
--			common_log(LOG_INFO, 'claiming queue item = ' . $qi->notice_id . ' for transport ' . $transport);
--			$orig = clone($qi);
--			$qi->claimed = common_sql_now();
--			$result = $qi->update($orig);
--			if ($result) {
--				common_log(LOG_INFO, 'claim succeeded.');
--				return $qi;
--			} else {
--				common_log(LOG_INFO, 'claim failed.');
--			}
--		}
--		$qi = NULL;
--		return NULL;
--	}
-+        if ($cnt) {
-+            # XXX: potential race condition
-+            # can we force it to only update if claimed is still NULL
-+            # (or old)?
-+            common_log(LOG_INFO, 'claiming queue item = ' . $qi->notice_id . ' for transport ' . $transport);
-+            $orig = clone($qi);
-+            $qi->claimed = common_sql_now();
-+            $result = $qi->update($orig);
-+            if ($result) {
-+                common_log(LOG_INFO, 'claim succeeded.');
-+                return $qi;
-+            } else {
-+                common_log(LOG_INFO, 'claim failed.');
-+            }
-+        }
-+        $qi = NULL;
-+        return NULL;
-+    }
-hunk ./classes/Sms_carrier.php 24
--	
--	function toEmailAddress($sms) {
--		return sprintf($this->email_pattern, $sms);
--	}
-+    
-+    function toEmailAddress($sms) {
-+        return sprintf($this->email_pattern, $sms);
-+    }
-hunk ./classes/Subscription.php 47
--	
--	function &pkeyGet($kv) {
--		return Memcached_DataObject::pkeyGet('Subscription', $kv);
--	}
-+    
-+    function &pkeyGet($kv) {
-+        return Memcached_DataObject::pkeyGet('Subscription', $kv);
-+    }
-hunk ./classes/User.php 70
--	function getProfile() {
--		return Profile::staticGet('id', $this->id);
--	}
-+    function getProfile() {
-+        return Profile::staticGet('id', $this->id);
-+    }
-hunk ./classes/User.php 74
--	function isSubscribed($other) {
--		assert(!is_null($other));
--		# XXX: cache results of this query
--		$sub = Subscription::pkeyGet(array('subscriber' => $this->id,
--										   'subscribed' => $other->id));
--		return (is_null($sub)) ? false : true;
--	}
-+    function isSubscribed($other) {
-+        assert(!is_null($other));
-+        # XXX: cache results of this query
-+        $sub = Subscription::pkeyGet(array('subscriber' => $this->id,
-+                                           'subscribed' => $other->id));
-+        return (is_null($sub)) ? false : true;
-+    }
-hunk ./classes/User.php 82
--	# 'update' won't write key columns, so we have to do it ourselves.
-+    # 'update' won't write key columns, so we have to do it ourselves.
-hunk ./classes/User.php 84
--	function updateKeys(&$orig) {
--		$parts = array();
--		foreach (array('nickname', 'email', 'jabber', 'incomingemail', 'sms', 'carrier', 'smsemail', 'language', 'timezone') as $k) {
--			if (strcmp($this->$k, $orig->$k) != 0) {
--				$parts[] = $k . ' = ' . $this->_quote($this->$k);
--			}
--		}
--		if (count($parts) == 0) {
--			# No changes
--			return true;
--		}
--		$toupdate = implode(', ', $parts);
-+    function updateKeys(&$orig) {
-+        $parts = array();
-+        foreach (array('nickname', 'email', 'jabber', 'incomingemail', 'sms', 'carrier', 'smsemail', 'language', 'timezone') as $k) {
-+            if (strcmp($this->$k, $orig->$k) != 0) {
-+                $parts[] = $k . ' = ' . $this->_quote($this->$k);
-+            }
-+        }
-+        if (count($parts) == 0) {
-+            # No changes
-+            return true;
-+        }
-+        $toupdate = implode(', ', $parts);
-hunk ./classes/User.php 97
--		$table = $this->tableName();
--		if(common_config('db','quote_identifiers')) {
--			$table = '"' . $table . '"';
--		}
--		$qry = 'UPDATE ' . $table . ' SET ' . $toupdate .
--		  ' WHERE id = ' . $this->id;
--		$orig->decache();
--		$result = $this->query($qry);
--		if ($result) {
--			$this->encache();
--		}
--		return $result;
--	}
-+        $table = $this->tableName();
-+        if(common_config('db','quote_identifiers')) {
-+            $table = '"' . $table . '"';
-+        }
-+        $qry = 'UPDATE ' . $table . ' SET ' . $toupdate .
-+          ' WHERE id = ' . $this->id;
-+        $orig->decache();
-+        $result = $this->query($qry);
-+        if ($result) {
-+            $this->encache();
-+        }
-+        return $result;
-+    }
-hunk ./classes/User.php 111
--	function allowed_nickname($nickname) {
--		# XXX: should already be validated for size, content, etc.
--		static $blacklist = array('rss', 'xrds', 'doc', 'main',
--								  'settings', 'notice', 'user',
--								  'search', 'avatar', 'tag', 'tags',
--								  'api', 'message');
--		$merged = array_merge($blacklist, common_config('nickname', 'blacklist'));
--		return !in_array($nickname, $merged);
--	}
-+    function allowed_nickname($nickname) {
-+        # XXX: should already be validated for size, content, etc.
-+        static $blacklist = array('rss', 'xrds', 'doc', 'main',
-+                                  'settings', 'notice', 'user',
-+                                  'search', 'avatar', 'tag', 'tags',
-+                                  'api', 'message');
-+        $merged = array_merge($blacklist, common_config('nickname', 'blacklist'));
-+        return !in_array($nickname, $merged);
-+    }
+-    function getCurrentNotice($dt=NULL) {
++    function getCurrentNotice($dt=null) {
+hunk ./classes/Profile.php 146
+-        return NULL;
++        return null;
+hunk ./classes/Profile_block.php 39
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
+hunk ./classes/Profile_tag.php 19
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
+hunk ./classes/Queue_item.php 19
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
+hunk ./classes/Queue_item.php 31
+-        $qi->whereAdd('claimed is NULL');
++        $qi->whereAdd('claimed is null');
+hunk ./classes/Queue_item.php 39
+-            # can we force it to only update if claimed is still NULL
++            # can we force it to only update if claimed is still null
+hunk ./classes/Queue_item.php 52
+-        $qi = NULL;
+-        return NULL;
++        $qi = null;
++        return null;
+hunk ./classes/Remember_me.php 18
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
+hunk ./classes/Remote_profile.php 41
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
+hunk ./classes/Reply.php 19
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Reply',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Reply',$k,$v); }
+hunk ./classes/Sms_carrier.php 20
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
+hunk ./classes/Subscription.php 43
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
+hunk ./classes/Token.php 22
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Token',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Token',$k,$v); }
+hunk ./classes/User.php 65
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User',$k,$v); }
 hunk ./classes/User.php 121
--	function getCurrentNotice($dt=NULL) {
--		$profile = $this->getProfile();
--		if (!$profile) {
--			return NULL;
--		}
--		return $profile->getCurrentNotice($dt);
--	}
-+    function getCurrentNotice($dt=NULL) {
-+        $profile = $this->getProfile();
-+        if (!$profile) {
-+            return NULL;
-+        }
-+        return $profile->getCurrentNotice($dt);
-+    }
-hunk ./classes/User.php 129
--	function getCarrier() {
--		return Sms_carrier::staticGet('id', $this->carrier);
--	}
-+    function getCarrier() {
-+        return Sms_carrier::staticGet('id', $this->carrier);
-+    }
-hunk ./classes/User.php 133
--	function subscribeTo($other) {
--		$sub = new Subscription();
--		$sub->subscriber = $this->id;
--		$sub->subscribed = $other->id;
-+    function subscribeTo($other) {
-+        $sub = new Subscription();
-+        $sub->subscriber = $this->id;
-+        $sub->subscribed = $other->id;
-hunk ./classes/User.php 138
--		$sub->created = common_sql_now(); # current time
-+        $sub->created = common_sql_now(); # current time
-hunk ./classes/User.php 140
--		if (!$sub->insert()) {
--			return false;
--		}
-+        if (!$sub->insert()) {
-+            return false;
-+        }
-hunk ./classes/User.php 144
--		return true;
--	}
-+        return true;
-+    }
-hunk ./classes/User.php 161
--	static function register($fields) {
-+    static function register($fields) {
-hunk ./classes/User.php 163
--		# MAGICALLY put fields into current scope
-+        # MAGICALLY put fields into current scope
-hunk ./classes/User.php 165
--		extract($fields);
-+        extract($fields);
-hunk ./classes/User.php 167
--		$profile = new Profile();
-+        $profile = new Profile();
-hunk ./classes/User.php 169
--		$profile->query('BEGIN');
-+        $profile->query('BEGIN');
-hunk ./classes/User.php 171
--		$profile->nickname = $nickname;
--		$profile->profileurl = common_profile_url($nickname);
-+        $profile->nickname = $nickname;
-+        $profile->profileurl = common_profile_url($nickname);
-hunk ./classes/User.php 174
--		if ($fullname) {
--			$profile->fullname = $fullname;
--		}
--		if ($homepage) {
--			$profile->homepage = $homepage;
--		}
--		if ($bio) {
--			$profile->bio = $bio;
--		}
--		if ($location) {
--			$profile->location = $location;
--		}
-+        if ($fullname) {
-+            $profile->fullname = $fullname;
-+        }
-+        if ($homepage) {
-+            $profile->homepage = $homepage;
-+        }
-+        if ($bio) {
-+            $profile->bio = $bio;
-+        }
-+        if ($location) {
-+            $profile->location = $location;
-+        }
-hunk ./classes/User.php 187
--		$profile->created = common_sql_now();
-+        $profile->created = common_sql_now();
-hunk ./classes/User.php 189
--		$id = $profile->insert();
-+        $id = $profile->insert();
-hunk ./classes/User.php 191
--		if (!$id) {
--			common_log_db_error($profile, 'INSERT', __FILE__);
--		    return FALSE;
--		}
-+        if (!$id) {
-+            common_log_db_error($profile, 'INSERT', __FILE__);
-+            return FALSE;
-+        }
-hunk ./classes/User.php 196
--		$user = new User();
-+        $user = new User();
-hunk ./classes/User.php 198
--		$user->id = $id;
--		$user->nickname = $nickname;
-+        $user->id = $id;
-+        $user->nickname = $nickname;
-hunk ./classes/User.php 201
--		if ($password) { # may not have a password for OpenID users
--			$user->password = common_munge_password($password, $id);
--		}
-+        if ($password) { # may not have a password for OpenID users
-+            $user->password = common_munge_password($password, $id);
-+        }
-hunk ./classes/User.php 205
--		# Users who respond to invite email have proven their ownership of that address
-+        # Users who respond to invite email have proven their ownership of that address
-hunk ./classes/User.php 207
--		if ($code) {
--			$invite = Invitation::staticGet($code);
--			if ($invite && $invite->address && $invite->address_type == 'email' && $invite->address == $email) {
--				$user->email = $invite->address;
--			}
--		}
-+        if ($code) {
-+            $invite = Invitation::staticGet($code);
-+            if ($invite && $invite->address && $invite->address_type == 'email' && $invite->address == $email) {
-+                $user->email = $invite->address;
-+            }
-+        }
-hunk ./classes/User.php 214
--		$inboxes = common_config('inboxes', 'enabled');
-+        $inboxes = common_config('inboxes', 'enabled');
-hunk ./classes/User.php 216
--		if ($inboxes === true || $inboxes == 'transitional') {
--			$user->inboxed = 1;
--		}
-+        if ($inboxes === true || $inboxes == 'transitional') {
-+            $user->inboxed = 1;
-+        }
-hunk ./classes/User.php 220
--		$user->created = common_sql_now();
--		$user->uri = common_user_uri($user);
-+        $user->created = common_sql_now();
-+        $user->uri = common_user_uri($user);
-hunk ./classes/User.php 223
--		$result = $user->insert();
-+        $result = $user->insert();
-hunk ./classes/User.php 225
--		if (!$result) {
--			common_log_db_error($user, 'INSERT', __FILE__);
--			return FALSE;
--		}
-+        if (!$result) {
-+            common_log_db_error($user, 'INSERT', __FILE__);
-+            return FALSE;
-+        }
-hunk ./classes/User.php 230
--		# Everyone is subscribed to themself
-+        # Everyone is subscribed to themself
-hunk ./classes/User.php 232
--		$subscription = new Subscription();
--		$subscription->subscriber = $user->id;
--		$subscription->subscribed = $user->id;
--		$subscription->created = $user->created;
-+        $subscription = new Subscription();
-+        $subscription->subscriber = $user->id;
-+        $subscription->subscribed = $user->id;
-+        $subscription->created = $user->created;
-hunk ./classes/User.php 237
--		$result = $subscription->insert();
-+        $result = $subscription->insert();
-hunk ./classes/User.php 239
--		if (!$result) {
--			common_log_db_error($subscription, 'INSERT', __FILE__);
--			return FALSE;
--		}
-+        if (!$result) {
-+            common_log_db_error($subscription, 'INSERT', __FILE__);
-+            return FALSE;
-+        }
-hunk ./classes/User.php 244
--		if ($email && !$user->email) {
-+        if ($email && !$user->email) {
-hunk ./classes/User.php 246
--			$confirm = new Confirm_address();
--			$confirm->code = common_confirmation_code(128);
--			$confirm->user_id = $user->id;
--			$confirm->address = $email;
--			$confirm->address_type = 'email';
-+            $confirm = new Confirm_address();
-+            $confirm->code = common_confirmation_code(128);
-+            $confirm->user_id = $user->id;
-+            $confirm->address = $email;
-+            $confirm->address_type = 'email';
-hunk ./classes/User.php 252
--			$result = $confirm->insert();
--			if (!$result) {
--				common_log_db_error($confirm, 'INSERT', __FILE__);
--				return FALSE;
--			}
--		}
-+            $result = $confirm->insert();
-+            if (!$result) {
-+                common_log_db_error($confirm, 'INSERT', __FILE__);
-+                return FALSE;
-+            }
-+        }
-hunk ./classes/User.php 259
--		if ($code && $user->email) {
--			$user->emailChanged();
--		}
-+        if ($code && $user->email) {
-+            $user->emailChanged();
-+        }
-hunk ./classes/User.php 263
--		$profile->query('COMMIT');
-+        $profile->query('COMMIT');
-hunk ./classes/User.php 265
--		if ($email && !$user->email) {
--			mail_confirm_address($user, $confirm->code, $profile->nickname, $email);
--		}
-+        if ($email && !$user->email) {
-+            mail_confirm_address($user, $confirm->code, $profile->nickname, $email);
-+        }
-hunk ./classes/User.php 269
--		return $user;
--	}
-+        return $user;
-+    }
-hunk ./classes/User.php 272
--	# Things we do when the email changes
-+    # Things we do when the email changes
-hunk ./classes/User.php 274
--	function emailChanged() {
-+    function emailChanged() {
-hunk ./classes/User.php 276
--		$invites = new Invitation();
--		$invites->address = $this->email;
--		$invites->address_type = 'email';
-+        $invites = new Invitation();
-+        $invites->address = $this->email;
-+        $invites->address_type = 'email';
-hunk ./classes/User.php 280
--		if ($invites->find()) {
--			while ($invites->fetch()) {
--				$other = User::staticGet($invites->user_id);
--				subs_subscribe_to($other, $this);
--			}
--		}
--	}
-+        if ($invites->find()) {
-+            while ($invites->fetch()) {
-+                $other = User::staticGet($invites->user_id);
-+                subs_subscribe_to($other, $this);
-+            }
-+        }
-+    }
-hunk ./classes/User.php 288
--	function hasFave($notice) {
--		$cache = common_memcache();
-+    function hasFave($notice) {
-+        $cache = common_memcache();
-hunk ./classes/User.php 291
--		# XXX: Kind of a hack.
--		if ($cache) {
--			# This is the stream of favorite notices, in rev chron
--			# order. This forces it into cache.
--			$faves = $this->favoriteNotices(0, NOTICE_CACHE_WINDOW);
--			$cnt = 0;
--			while ($faves->fetch()) {
--				if ($faves->id < $notice->id) {
--					# If we passed it, it's not a fave
--					return false;
--				} else if ($faves->id == $notice->id) {
--					# If it matches a cached notice, then it's a fave
--					return true;
--				}
--				$cnt++;
--			}
--			# If we're not past the end of the cache window,
--			# then the cache has all available faves, so this one
--			# is not a fave.
--			if ($cnt < NOTICE_CACHE_WINDOW) {
--				return false;
--			}
--			# Otherwise, cache doesn't have all faves;
--			# fall through to the default
--		}
--		$fave = Fave::pkeyGet(array('user_id' => $this->id,
--									'notice_id' => $notice->id));
--		return ((is_null($fave)) ? false : true);
--	}
--	function mutuallySubscribed($other) {
--		return $this->isSubscribed($other) &&
--		  $other->isSubscribed($this);
--	}
-+        # XXX: Kind of a hack.
-+        if ($cache) {
-+            # This is the stream of favorite notices, in rev chron
-+            # order. This forces it into cache.
-+            $faves = $this->favoriteNotices(0, NOTICE_CACHE_WINDOW);
-+            $cnt = 0;
-+            while ($faves->fetch()) {
-+                if ($faves->id < $notice->id) {
-+                    # If we passed it, it's not a fave
-+                    return false;
-+                } else if ($faves->id == $notice->id) {
-+                    # If it matches a cached notice, then it's a fave
-+                    return true;
-+                }
-+                $cnt++;
-+            }
-+            # If we're not past the end of the cache window,
-+            # then the cache has all available faves, so this one
-+            # is not a fave.
-+            if ($cnt < NOTICE_CACHE_WINDOW) {
-+                return false;
-+            }
-+            # Otherwise, cache doesn't have all faves;
-+            # fall through to the default
-+        }
-+        $fave = Fave::pkeyGet(array('user_id' => $this->id,
-+                                    'notice_id' => $notice->id));
-+        return ((is_null($fave)) ? false : true);
-+    }
-+    function mutuallySubscribed($other) {
-+        return $this->isSubscribed($other) &&
-+          $other->isSubscribed($this);
-+    }
-hunk ./classes/User.php 327
--		# 3-way join; probably should get cached
--		$qry = 'SELECT user.* ' .
--		  'FROM subscription sub1 JOIN user ON sub1.subscribed = user.id ' .
--		  'JOIN subscription sub2 ON user.id = sub2.subscriber ' .
--		  'WHERE sub1.subscriber = %d and sub2.subscribed = %d ' .
--		  'ORDER BY user.nickname';
--		$user = new User();
--		$user->query(sprintf($qry, $this->id, $this->id));
-+        # 3-way join; probably should get cached
-+        $qry = 'SELECT user.* ' .
-+          'FROM subscription sub1 JOIN user ON sub1.subscribed = user.id ' .
-+          'JOIN subscription sub2 ON user.id = sub2.subscriber ' .
-+          'WHERE sub1.subscriber = %d and sub2.subscribed = %d ' .
-+          'ORDER BY user.nickname';
-+        $user = new User();
-+        $user->query(sprintf($qry, $this->id, $this->id));
-hunk ./classes/User.php 336
--		return $user;
--	}
-+        return $user;
-+    }
+-    function getCurrentNotice($dt=NULL) {
++    function getCurrentNotice($dt=null) {
+hunk ./classes/User.php 124
+-            return NULL;
++            return null;
 hunk ./classes/User.php 339
--	function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
--		$qry =
--		  'SELECT notice.* ' .
--		  'FROM notice JOIN reply ON notice.id = reply.notice_id ' .
--		  'WHERE reply.profile_id = %d ';
--		return Notice::getStream(sprintf($qry, $this->id),
--								 'user:replies:'.$this->id,
--								 $offset, $limit, $since_id, $before_id, NULL, $since);
--	}
-+    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
-+        $qry =
-+          'SELECT notice.* ' .
-+          'FROM notice JOIN reply ON notice.id = reply.notice_id ' .
-+          'WHERE reply.profile_id = %d ';
-+        return Notice::getStream(sprintf($qry, $this->id),
-+                                 'user:replies:'.$this->id,
-+                                 $offset, $limit, $since_id, $before_id, NULL, $since);
-+    }
-hunk ./classes/User.php 356
--	}
-+    }
-hunk ./classes/User.php 359
--		$qry =
--		  'SELECT notice.* ' .
--		  'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
--		  'WHERE fave.user_id = %d ';
--		return Notice::getStream(sprintf($qry, $this->id),
--								 'user:faves:'.$this->id,
--								 $offset, $limit);
--	}
-+        $qry =
-+          'SELECT notice.* ' .
-+          'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
-+          'WHERE fave.user_id = %d ';
-+        return Notice::getStream(sprintf($qry, $this->id),
-+                                 'user:faves:'.$this->id,
-+                                 $offset, $limit);
-+    }
-hunk ./classes/User.php 369
--		$enabled = common_config('inboxes', 'enabled');
-+        $enabled = common_config('inboxes', 'enabled');
-hunk ./classes/User.php 371
--		# Complicated code, depending on whether we support inboxes yet
--		# XXX: make this go away when inboxes become mandatory
-+        # Complicated code, depending on whether we support inboxes yet
-+        # XXX: make this go away when inboxes become mandatory
-hunk ./classes/User.php 374
--		if ($enabled === false ||
--			($enabled == 'transitional' && $this->inboxed == 0)) {
--			$qry =
--			  'SELECT notice.* ' .
--			  'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' .
--			  'WHERE subscription.subscriber = %d ';
--			$order = NULL;
--		} else if ($enabled === true ||
--			   ($enabled == 'transitional' && $this->inboxed == 1)) {
-+        if ($enabled === false ||
-+            ($enabled == 'transitional' && $this->inboxed == 0)) {
-+            $qry =
-+              'SELECT notice.* ' .
-+              'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' .
-+              'WHERE subscription.subscriber = %d ';
-+            $order = NULL;
-+        } else if ($enabled === true ||
-+               ($enabled == 'transitional' && $this->inboxed == 1)) {
-hunk ./classes/User.php 384
--			$qry =
--			  'SELECT notice.* ' .
--			  'FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id ' .
--			  'WHERE notice_inbox.user_id = %d ';
--			# NOTE: we override ORDER
--			$order = 'ORDER BY notice_inbox.created DESC, notice_inbox.notice_id DESC ';
--		}
--		return Notice::getStream(sprintf($qry, $this->id),
--								 'user:notices_with_friends:' . $this->id,
--								 $offset, $limit, $since_id, $before_id,
--								 $order, $since);
--	}
-+            $qry =
-+              'SELECT notice.* ' .
-+              'FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id ' .
-+              'WHERE notice_inbox.user_id = %d ';
-+            # NOTE: we override ORDER
-+            $order = 'ORDER BY notice_inbox.created DESC, notice_inbox.notice_id DESC ';
-+        }
-+        return Notice::getStream(sprintf($qry, $this->id),
-+                                 'user:notices_with_friends:' . $this->id,
-+                                 $offset, $limit, $since_id, $before_id,
-+                                 $order, $since);
-+    }
-hunk ./classes/User.php 398
--		$cache = common_memcache();
--		if ($cache) {
--			# Faves don't happen chronologically, so we need to blow
--			# ;last cache, too
--			$cache->delete(common_cache_key('user:faves:'.$this->id));
--			$cache->delete(common_cache_key('user:faves:'.$this->id).';last');
--		}
--	}
-+        $cache = common_memcache();
-+        if ($cache) {
-+            # Faves don't happen chronologically, so we need to blow
-+            # ;last cache, too
-+            $cache->delete(common_cache_key('user:faves:'.$this->id));
-+            $cache->delete(common_cache_key('user:faves:'.$this->id).';last');
-+        }
-+    }
-hunk ./classes/User.php 408
--		return Profile_tag::getTags($this->id, $this->id);
--	}
-+        return Profile_tag::getTags($this->id, $this->id);
-+    }
-hunk ./classes/User.php 412
--		return Profile_tag::setTags($this->id, $this->id, $newtags);
--	}
-+        return Profile_tag::setTags($this->id, $this->id, $newtags);
-+    }
-hunk ./classes/User.php 437
--		$sub = Subscription::pkeyGet(array('subscriber' => $other->id,
--										   'subscribed' => $this->id));
-+        $sub = Subscription::pkeyGet(array('subscriber' => $other->id,
-+                                           'subscribed' => $this->id));
-hunk ./lib/common.php 57
--		array('name' => 'Just another Laconica microblog',
--			  'server' => 'localhost',
--			  'theme' => 'default',
--			  'path' => '/',
--			  'logfile' => NULL,
--			  'fancy' => false,
--			  'locale_path' => INSTALLDIR.'/locale',
--			  'language' => 'en_US',
--			  'languages' => get_all_languages(),
--		      'email' =>
--		      array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : NULL,
--			  'broughtby' => NULL,
--			  'timezone' => 'UTC',
--			  'broughtbyurl' => NULL,
--			  'closed' => false,
--			  'inviteonly' => false,
-+        array('name' => 'Just another Laconica microblog',
-+              'server' => 'localhost',
-+              'theme' => 'default',
-+              'path' => '/',
-+              'logfile' => NULL,
-+              'fancy' => false,
-+              'locale_path' => INSTALLDIR.'/locale',
-+              'language' => 'en_US',
-+              'languages' => get_all_languages(),
-+              'email' =>
-+              array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : NULL,
-+              'broughtby' => NULL,
-+              'timezone' => 'UTC',
-+              'broughtbyurl' => NULL,
-+              'closed' => false,
-+              'inviteonly' => false,
-hunk ./lib/common.php 74
--		'syslog' =>
--		array('appname' => 'laconica', # for syslog
--			  'priority' => 'debug'), # XXX: currently ignored
--		'queue' =>
--		array('enabled' => false),
--		'license' =>
--		array('url' => 'http://creativecommons.org/licenses/by/3.0/',
--			  'title' => 'Creative Commons Attribution 3.0',
--			  'image' => 'http://i.creativecommons.org/l/by/3.0/88x31.png'),
--		'mail' =>
--		array('backend' => 'mail',
--			  'params' => NULL),
--		'nickname' =>
--		array('blacklist' => array(),
--			  'featured' => array()),
--		'profile' =>
--		array('banned' => array()),
--		'avatar' =>
--		array('server' => NULL),
--		'public' =>
--		array('localonly' => true,
--			  'blacklist' => array()),
--		'theme' =>
--		array('server' => NULL),
--		'throttle' =>
-+        'syslog' =>
-+        array('appname' => 'laconica', # for syslog
-+              'priority' => 'debug'), # XXX: currently ignored
-+        'queue' =>
-+        array('enabled' => false),
-+        'license' =>
-+        array('url' => 'http://creativecommons.org/licenses/by/3.0/',
-+              'title' => 'Creative Commons Attribution 3.0',
-+              'image' => 'http://i.creativecommons.org/l/by/3.0/88x31.png'),
-+        'mail' =>
-+        array('backend' => 'mail',
-+              'params' => NULL),
-+        'nickname' =>
-+        array('blacklist' => array(),
-+              'featured' => array()),
-+        'profile' =>
-+        array('banned' => array()),
-+        'avatar' =>
-+        array('server' => NULL),
-+        'public' =>
-+        array('localonly' => true,
-+              'blacklist' => array()),
-+        'theme' =>
-+        array('server' => NULL),
-+        'throttle' =>
-hunk ./lib/common.php 102
--		'xmpp' =>
--		array('enabled' => false,
--			  'server' => 'INVALID SERVER',
--			  'port' => 5222,
--			  'user' => 'update',
--			  'encryption' => true,
--			  'resource' => 'uniquename',
--			  'password' => 'blahblahblah',
--			  'host' => NULL, # only set if != server
--			  'debug' => false, # print extra debug info
--			  'public' => array()), # JIDs of users who want to receive the public stream
-+        'xmpp' =>
-+        array('enabled' => false,
-+              'server' => 'INVALID SERVER',
-+              'port' => 5222,
-+              'user' => 'update',
-+              'encryption' => true,
-+              'resource' => 'uniquename',
-+              'password' => 'blahblahblah',
-+              'host' => NULL, # only set if != server
-+              'debug' => false, # print extra debug info
-+              'public' => array()), # JIDs of users who want to receive the public stream
-hunk ./lib/common.php 117
--		'tag' =>
--		array('dropoff' => 864000.0),
--		'popular' =>
--		array('dropoff' => 864000.0),
--		'daemon' =>
--		array('piddir' => '/var/run',
--			  'user' => false,
--			  'group' => false),
--		'integration' =>
--		array('source' => 'Laconica'), # source attribute for Twitter
--		'memcached' =>
--		array('enabled' => false,
--			  'server' => 'localhost',
--			  'port' => 11211),
--		'inboxes' =>
--		array('enabled' => true), # on by default for new sites
--		);
-+        'tag' =>
-+        array('dropoff' => 864000.0),
-+        'popular' =>
-+        array('dropoff' => 864000.0),
-+        'daemon' =>
-+        array('piddir' => '/var/run',
-+              'user' => false,
-+              'group' => false),
-+        'integration' =>
-+        array('source' => 'Laconica'), # source attribute for Twitter
-+        'memcached' =>
-+        array('enabled' => false,
-+              'server' => 'localhost',
-+              'port' => 11211),
-+        'inboxes' =>
-+        array('enabled' => true), # on by default for new sites
-+        );
-hunk ./lib/common.php 139
--	    'schema_location' => INSTALLDIR . '/classes',
--		'class_location' => INSTALLDIR . '/classes',
--		'require_prefix' => 'classes/',
--		'class_prefix' => '',
--		'mirror' => NULL,
-+        'schema_location' => INSTALLDIR . '/classes',
-+        'class_location' => INSTALLDIR . '/classes',
-+        'require_prefix' => 'classes/',
-+        'class_prefix' => '',
-+        'mirror' => NULL,
-hunk ./lib/common.php 145
--		'quote_identifiers' => false,
--		'type' => 'mysql' );
-+        'quote_identifiers' => false,
-+        'type' => 'mysql' );
-hunk ./lib/common.php 149
--	/* Work internally in UTC */
--	date_default_timezone_set('UTC');
-+    /* Work internally in UTC */
-+    date_default_timezone_set('UTC');
-hunk ./lib/common.php 167
--	if ($class == 'OAuthRequest') {
--		require_once('OAuth.php');
--	} else if (file_exists(INSTALLDIR.'/classes/' . $class . '.php')) {
-+    if ($class == 'OAuthRequest') {
-+        require_once('OAuth.php');
-+    } else if (file_exists(INSTALLDIR.'/classes/' . $class . '.php')) {
-hunk ./lib/deleteaction.php 24
--	function handle($args) {
--		parent::handle($args);
--		$user = common_current_user();
--		$notice_id = $this->trimmed('notice');
--		$notice = Notice::staticGet($notice_id);
--		if (!$notice) {
--			common_user_error(_('No such notice.'));
--			exit;
--		}
-+    function handle($args) {
-+        parent::handle($args);
-+        $user = common_current_user();
-+        $notice_id = $this->trimmed('notice');
-+        $notice = Notice::staticGet($notice_id);
-+        if (!$notice) {
-+            common_user_error(_('No such notice.'));
-+            exit;
-+        }
-hunk ./lib/deleteaction.php 34
--		$profile = $notice->getProfile();
--		$user_profile = $user->getProfile();
-+        $profile = $notice->getProfile();
-+        $user_profile = $user->getProfile();
-hunk ./lib/deleteaction.php 37
--		if (!common_logged_in()) {
--			common_user_error(_('Not logged in.'));
--			exit;
--		} else if ($notice->profile_id != $user_profile->id) {
--			common_user_error(_('Can\'t delete this notice.'));
--			exit;
--		}
--	}
-+        if (!common_logged_in()) {
-+            common_user_error(_('Not logged in.'));
-+            exit;
-+        } else if ($notice->profile_id != $user_profile->id) {
-+            common_user_error(_('Can\'t delete this notice.'));
-+            exit;
-+        }
-+    }
+-    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
++    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
+hunk ./classes/User.php 346
+-                                 $offset, $limit, $since_id, $before_id, NULL, $since);
++                                 $offset, $limit, $since_id, $before_id, null, $since);
+hunk ./classes/User.php 349
+-        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
++        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
+hunk ./classes/User.php 352
+-            return NULL;
++            return null;
+hunk ./classes/User.php 368
+-        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
++        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
+hunk ./classes/User.php 380
+-            $order = NULL;
++            $order = null;
+hunk ./classes/User_openid.php 20
+-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
++    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
+hunk ./lib/common.php 61
+-              'logfile' => NULL,
++              'logfile' => null,
+hunk ./lib/common.php 67
+-              array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : NULL,
+-              'broughtby' => NULL,
++              array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : null,
++              'broughtby' => null,
+hunk ./lib/common.php 70
+-              'broughtbyurl' => NULL,
++              'broughtbyurl' => null,
+hunk ./lib/common.php 85
+-              'params' => NULL),
++              'params' => null),
+hunk ./lib/common.php 92
+-        array('server' => NULL),
++        array('server' => null),
+hunk ./lib/common.php 97
+-        array('server' => NULL),
++        array('server' => null),
+hunk ./lib/common.php 110
+-              'host' => NULL, # only set if != server
++              'host' => null, # only set if != server
+hunk ./lib/common.php 143
+-        'mirror' => NULL,
++        'mirror' => null,
 hunk ./lib/deleteaction.php 46
--	function show_top($arr=NULL) {
--		$instr = $this->get_instructions();
--		$output = common_markup_to_html($instr);
--		common_element_start('div', 'instructions');
--		common_raw($output);
--		common_element_end('div');
--	}
-+    function show_top($arr=NULL) {
-+        $instr = $this->get_instructions();
-+        $output = common_markup_to_html($instr);
-+        common_element_start('div', 'instructions');
-+        common_raw($output);
-+        common_element_end('div');
-+    }
-hunk ./lib/deleteaction.php 54
--	function get_title() {
--		return NULL;
--	}
-+    function get_title() {
-+        return NULL;
-+    }
-hunk ./lib/deleteaction.php 58
--	function show_header() {
--		return;
--	}
-+    function show_header() {
-+        return;
-+    }
-hunk ./lib/facebookaction.php 13
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./lib/facebookaction.php 17
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./lib/facebookaction.php 26
--	function handle($args) {
--		parent::handle($args);
--	}
-+    function handle($args) {
-+        parent::handle($args);
-+    }
-hunk ./lib/facebookaction.php 30
--	function get_facebook() {
--		$apikey = common_config('facebook', 'apikey');
--		$secret = common_config('facebook', 'secret');
--		return new Facebook($apikey, $secret);
--	}
-+    function get_facebook() {
-+        $apikey = common_config('facebook', 'apikey');
-+        $secret = common_config('facebook', 'secret');
-+        return new Facebook($apikey, $secret);
-+    }
-hunk ./lib/facebookaction.php 36
--	function update_profile_box($facebook, $fbuid, $user) {
-+    function update_profile_box($facebook, $fbuid, $user) {
-hunk ./lib/facebookaction.php 38
--		$notice = $user->getCurrentNotice();
-+        $notice = $user->getCurrentNotice();
-hunk ./lib/facebookaction.php 40
--		# Need to include inline CSS for styling the Profile box
-+        # Need to include inline CSS for styling the Profile box
-hunk ./lib/facebookaction.php 42
--		$style = '<style>
--		#notices {
--		clear: both;
--		margin: 0 auto;
--		padding: 0;
--		list-style-type: none;
--		width: 600px;
--		border-top: 1px solid #dec5b5;
--		}
--		#notices a:hover {
--		text-decoration: underline;
--		}
--		.notice_single {
--		clear: both;
--		display: block;
--		margin: 0;
--		padding: 5px 5px 5px 0;
--		min-height: 48px;
--		font-family: Georgia, "Times New Roman", Times, serif;
--		font-size: 13px;
--		line-height: 16px;
--		border-bottom: 1px solid #dec5b5;
--		background-color:#FCFFF5;
--		opacity:1;
--		}
--		.notice_single:hover {
--		background-color: #f7ebcc;
--		}
--		.notice_single p {
--		display: inline;
--		margin: 0;
--		padding: 0;
--		}
--		</style>';
-+        $style = '<style>
-+        #notices {
-+        clear: both;
-+        margin: 0 auto;
-+        padding: 0;
-+        list-style-type: none;
-+        width: 600px;
-+        border-top: 1px solid #dec5b5;
-+        }
-+        #notices a:hover {
-+        text-decoration: underline;
-+        }
-+        .notice_single {
-+        clear: both;
-+        display: block;
-+        margin: 0;
-+        padding: 5px 5px 5px 0;
-+        min-height: 48px;
-+        font-family: Georgia, "Times New Roman", Times, serif;
-+        font-size: 13px;
-+        line-height: 16px;
-+        border-bottom: 1px solid #dec5b5;
-+        background-color:#FCFFF5;
-+        opacity:1;
-+        }
-+        .notice_single:hover {
-+        background-color: #f7ebcc;
-+        }
-+        .notice_single p {
-+        display: inline;
-+        margin: 0;
-+        padding: 0;
-+        }
-+        </style>';
-hunk ./lib/facebookaction.php 77
--		$html = $this->render_notice($notice);
-+        $html = $this->render_notice($notice);
-hunk ./lib/facebookaction.php 79
--		$fbml = "<fb:wide>$content $html</fb:wide>";
--		$fbml .= "<fb:narrow>$content $html</fb:narrow>";
-+        $fbml = "<fb:wide>$content $html</fb:wide>";
-+        $fbml .= "<fb:narrow>$content $html</fb:narrow>";
-hunk ./lib/facebookaction.php 82
--		$fbml_main = "<fb:narrow>$content $html</fb:narrow>";
-+        $fbml_main = "<fb:narrow>$content $html</fb:narrow>";
+-    function show_top($arr=NULL) {
++    function show_top($arr=null) {
+hunk ./lib/deleteaction.php 55
+-        return NULL;
++        return null;
 hunk ./lib/facebookaction.php 84
--		$facebook->api_client->profile_setFBML(NULL, $fbuid, $fbml, NULL, NULL, $fbml_main);
--	}
-+        $facebook->api_client->profile_setFBML(NULL, $fbuid, $fbml, NULL, NULL, $fbml_main);
-+    }
-hunk ./lib/facebookaction.php 87
--	# Display methods
-+    # Display methods
-hunk ./lib/facebookaction.php 89
--	function show_header($selected ='Home') {
-+    function show_header($selected ='Home') {
-hunk ./lib/facebookaction.php 91
--		# Add a timestamp to the CSS file so Facebook cache wont ignore our changes
--		$ts = filemtime(theme_file('facebookapp.css'));
--		$cssurl = theme_path('facebookapp.css') . "?ts=$ts";
-+        # Add a timestamp to the CSS file so Facebook cache wont ignore our changes
-+        $ts = filemtime(theme_file('facebookapp.css'));
-+        $cssurl = theme_path('facebookapp.css') . "?ts=$ts";
-hunk ./lib/facebookaction.php 95
--	 	$header = '<link rel="stylesheet" type="text/css" href="'. $cssurl . '" />';
--	 	# $header .='<script src="" ></script>';
--	  	$header .= '<fb:dashboard/>';
-+         $header = '<link rel="stylesheet" type="text/css" href="'. $cssurl . '" />';
-+         # $header .='<script src="" ></script>';
-+          $header .= '<fb:dashboard/>';
-hunk ./lib/facebookaction.php 99
--	  	$header .=
--			'<fb:tabs>'
--			.'<fb:tab-item title="Home" href="index.php" selected="' . ($selected == 'Home') .'" />'
--			.'<fb:tab-item title="Invite Friends"  href="invite.php" selected="' . ($selected == 'Invite') . '" />'
--			.'<fb:tab-item title="Settings"	 href="settings.php" selected="' . ($selected == 'Settings') . '" />'
--			.'</fb:tabs>';
--	  	$header .= '<div id="main_body">';
-+          $header .=
-+            '<fb:tabs>'
-+            .'<fb:tab-item title="Home" href="index.php" selected="' . ($selected == 'Home') .'" />'
-+            .'<fb:tab-item title="Invite Friends"  href="invite.php" selected="' . ($selected == 'Invite') . '" />'
-+            .'<fb:tab-item title="Settings"     href="settings.php" selected="' . ($selected == 'Settings') . '" />'
-+            .'</fb:tabs>';
-+          $header .= '<div id="main_body">';
-hunk ./lib/facebookaction.php 107
--	  echo $header;
-+      echo $header;
-hunk ./lib/facebookaction.php 109
--	}
-+    }
-hunk ./lib/facebookaction.php 111
--	function show_footer() {
--	  $footer = '</div>';
--	  echo $footer;
--	}
-+    function show_footer() {
-+      $footer = '</div>';
-+      echo $footer;
-+    }
-hunk ./lib/facebookaction.php 116
--	function show_login_form() {
-+    function show_login_form() {
-hunk ./lib/facebookaction.php 118
--		$loginform =
--			' <h2>To add the Identi.ca application, you need to log into your Identi.ca account.</h2>'
--			.'<a href="http://identi.ca/">'
--			.'	<img src="http://theme.identi.ca/identica/logo.png" alt="Identi.ca" id="logo"/>'
--			.'</a>'
--			.'<h1 class="pagetitle">Login</h1>'
--			.'<div class="instructions">'
--			.'	<p>Login with your username and password. Don\'t have a username yet?'
--			.'	  <a href="http://identi.ca/main/register">Register</a> a new account.'
--			.'	</p>'
--			.'</div>'
--			.'<div id="content">'
--			.'	<form method="post" id="login">'
--			.'	  <p>'
--			.'		<label for="nickname">Nickname</label>'
--			.'		<input name="nickname" type="text" class="input_text" id="nickname"/>'
--			.'	  </p>'
--			.'	  <p>'
--			.'		  <label for="password">Password</label>'
--			.'		<input name="password" type="password" class="password" id="password"/>'
--			.'	  </p>'
--			.'	  <p>'
--			.'		<input type="submit" id="submit" name="submit" class="submit" value="Login"/>'
--			.'	  </p>'
--			.'	</form>'
--			.'	<p>'
--			.'	  <a href="http://identi.ca/main/recoverpassword">Lost or forgotten password?</a>'
--			.'	</p>'
--			.'</div';
-+        $loginform =
-+            ' <h2>To add the Identi.ca application, you need to log into your Identi.ca account.</h2>'
-+            .'<a href="http://identi.ca/">'
-+            .'    <img src="http://theme.identi.ca/identica/logo.png" alt="Identi.ca" id="logo"/>'
-+            .'</a>'
-+            .'<h1 class="pagetitle">Login</h1>'
-+            .'<div class="instructions">'
-+            .'    <p>Login with your username and password. Don\'t have a username yet?'
-+            .'      <a href="http://identi.ca/main/register">Register</a> a new account.'
-+            .'    </p>'
-+            .'</div>'
-+            .'<div id="content">'
-+            .'    <form method="post" id="login">'
-+            .'      <p>'
-+            .'        <label for="nickname">Nickname</label>'
-+            .'        <input name="nickname" type="text" class="input_text" id="nickname"/>'
-+            .'      </p>'
-+            .'      <p>'
-+            .'          <label for="password">Password</label>'
-+            .'        <input name="password" type="password" class="password" id="password"/>'
-+            .'      </p>'
-+            .'      <p>'
-+            .'        <input type="submit" id="submit" name="submit" class="submit" value="Login"/>'
-+            .'      </p>'
-+            .'    </form>'
-+            .'    <p>'
-+            .'      <a href="http://identi.ca/main/recoverpassword">Lost or forgotten password?</a>'
-+            .'    </p>'
-+            .'</div';
-hunk ./lib/facebookaction.php 148
--			echo $loginform;
--	}
-+            echo $loginform;
-+    }
-hunk ./lib/facebookaction.php 151
--	function render_notice($notice) {
-+    function render_notice($notice) {
-hunk ./lib/facebookaction.php 153
--		global $config;
-+        global $config;
-hunk ./lib/facebookaction.php 155
--		$profile = $notice->getProfile();
--		$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
-+        $profile = $notice->getProfile();
-+        $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
-hunk ./lib/facebookaction.php 158
--		$noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
-+        $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
-hunk ./lib/facebookaction.php 160
--		# XXX: we need to figure this out better. Is this right?
--		if (strcmp($notice->uri, $noticeurl) != 0 && preg_match('/^http/', $notice->uri)) {
--			$noticeurl = $notice->uri;
--		}
-+        # XXX: we need to figure this out better. Is this right?
-+        if (strcmp($notice->uri, $noticeurl) != 0 && preg_match('/^http/', $notice->uri)) {
-+            $noticeurl = $notice->uri;
-+        }
-hunk ./lib/facebookaction.php 165
--		$html =
--		'<li class="notice_single" id="' . $notice->id . '">'
--		.'<a href="' . $profile->profileurl . '">'
--		.'<img src="';
-+        $html =
-+        '<li class="notice_single" id="' . $notice->id . '">'
-+        .'<a href="' . $profile->profileurl . '">'
-+        .'<img src="';
-hunk ./lib/facebookaction.php 170
--		if ($avatar) {
--			$html .= common_avatar_display_url($avatar);
--		} else {
--			$html .= common_default_avatar(AVATAR_STREAM_SIZE);
--		}
-+        if ($avatar) {
-+            $html .= common_avatar_display_url($avatar);
-+        } else {
-+            $html .= common_default_avatar(AVATAR_STREAM_SIZE);
-+        }
-hunk ./lib/facebookaction.php 176
--		$html .=
--		'" class="avatar stream" width="'
--		. AVATAR_STREAM_SIZE . '" height="' . AVATAR_STREAM_SIZE .'"'
--		.' alt="';
-+        $html .=
-+        '" class="avatar stream" width="'
-+        . AVATAR_STREAM_SIZE . '" height="' . AVATAR_STREAM_SIZE .'"'
-+        .' alt="';
-hunk ./lib/facebookaction.php 181
--		if ($profile->fullname) {
--			$html .= $profile->fullname;
--		} else {
--			$html .= $profile->nickname;
--		}
-+        if ($profile->fullname) {
-+            $html .= $profile->fullname;
-+        } else {
-+            $html .= $profile->nickname;
-+        }
-hunk ./lib/facebookaction.php 187
--		$html .=
--		'"></a>'
--		.'<a href="' .	$profile->profileurl . '" class="nickname">' . $profile->nickname . '</a>'
--		.'<p class="content">' . $notice->rendered . '</p>'
--		.'<p class="time">'
--		.'<a class="permalink" href="' . $noticeurl . '" title="' . common_exact_date($notice->created) . '">' . common_date_string($notice->created) . '</a>';
-+        $html .=
-+        '"></a>'
-+        .'<a href="' .    $profile->profileurl . '" class="nickname">' . $profile->nickname . '</a>'
-+        .'<p class="content">' . $notice->rendered . '</p>'
-+        .'<p class="time">'
-+        .'<a class="permalink" href="' . $noticeurl . '" title="' . common_exact_date($notice->created) . '">' . common_date_string($notice->created) . '</a>';
-hunk ./lib/facebookaction.php 194
--		if ($notice->source) {
--			$html .= _(' from ');
--			$html .= $this->source_link($notice->source);
--		}
-+        if ($notice->source) {
-+            $html .= _(' from ');
-+            $html .= $this->source_link($notice->source);
-+        }
-hunk ./lib/facebookaction.php 199
--		if ($notice->reply_to) {
--			$replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
--			$html .=
--			' (<a class="inreplyto" href="' . $replyurl . '">' . _('in reply to...') . ')';
--		}
-+        if ($notice->reply_to) {
-+            $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
-+            $html .=
-+            ' (<a class="inreplyto" href="' . $replyurl . '">' . _('in reply to...') . ')';
-+        }
-hunk ./lib/facebookaction.php 205
--		$html .= '</p></li>';
-+        $html .= '</p></li>';
-hunk ./lib/facebookaction.php 207
--		return $html;
--	}
-+        return $html;
-+    }
-hunk ./lib/facebookaction.php 210
--	function source_link($source) {
--		$source_name = _($source);
-+    function source_link($source) {
-+        $source_name = _($source);
-hunk ./lib/facebookaction.php 213
--		$html = '<span class="noticesource">';
-+        $html = '<span class="noticesource">';
-hunk ./lib/facebookaction.php 215
--		switch ($source) {
--		 case 'web':
--		 case 'xmpp':
--		 case 'mail':
--		 case 'omb':
--		 case 'api':
--			$html .= $source_name;
--			break;
--		 default:
--			$ns = Notice_source::staticGet($source);
--			if ($ns) {
--				$html .= '<a href="' . $ns->url . '">' . $ns->name . '</a>';
--			} else {
--				$html .= $source_name;
--			}
--			break;
--		}
-+        switch ($source) {
-+         case 'web':
-+         case 'xmpp':
-+         case 'mail':
-+         case 'omb':
-+         case 'api':
-+            $html .= $source_name;
-+            break;
-+         default:
-+            $ns = Notice_source::staticGet($source);
-+            if ($ns) {
-+                $html .= '<a href="' . $ns->url . '">' . $ns->name . '</a>';
-+            } else {
-+                $html .= $source_name;
-+            }
-+            break;
-+        }
-hunk ./lib/facebookaction.php 233
--		$html .= '</span>';
-+        $html .= '</span>';
-hunk ./lib/facebookaction.php 235
--		return $html;
--	}
-+        return $html;
-+    }
+-        $facebook->api_client->profile_setFBML(NULL, $fbuid, $fbml, NULL, NULL, $fbml_main);
++        $facebook->api_client->profile_setFBML(null, $fbuid, $fbml, null, null, $fbml_main);
 hunk ./lib/facebookaction.php 238
--	function pagination($have_before, $have_after, $page, $fbaction, $args=NULL) {
-+    function pagination($have_before, $have_after, $page, $fbaction, $args=NULL) {
-hunk ./lib/facebookaction.php 240
--		$html = '';
-+        $html = '';
-hunk ./lib/facebookaction.php 242
--		if ($have_before || $have_after) {
--			$html = '<div id="pagination">';
--			$html .'<ul id="nav_pagination">';
--		}
-+        if ($have_before || $have_after) {
-+            $html = '<div id="pagination">';
-+            $html .'<ul id="nav_pagination">';
-+        }
-hunk ./lib/facebookaction.php 247
--		if ($have_before) {
--			$pargs = array('page' => $page-1);
--			$newargs = ($args) ? array_merge($args,$pargs) : $pargs;
--			$html .= '<li class="before">';
--			$html .'<a href="' . $this->pagination_url($fbaction, $newargs) . '">' . _('« After') . '</a>';
--			$html .'</li>';
--		}
-+        if ($have_before) {
-+            $pargs = array('page' => $page-1);
-+            $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
-+            $html .= '<li class="before">';
-+            $html .'<a href="' . $this->pagination_url($fbaction, $newargs) . '">' . _('« After') . '</a>';
-+            $html .'</li>';
-+        }
-hunk ./lib/facebookaction.php 255
--		if ($have_after) {
--			$pargs = array('page' => $page+1);
--			$newargs = ($args) ? array_merge($args,$pargs) : $pargs;
--			$html .= '<li class="after">';
--			$html .'<a href="' . $this->pagination_url($fbaction, $newargs) . '">' . _('Before »') . '</a>';
--			$html .'</li>';
--		}
-+        if ($have_after) {
-+            $pargs = array('page' => $page+1);
-+            $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
-+            $html .= '<li class="after">';
-+            $html .'<a href="' . $this->pagination_url($fbaction, $newargs) . '">' . _('Before »') . '</a>';
-+            $html .'</li>';
-+        }
-hunk ./lib/facebookaction.php 263
--		if ($have_before || $have_after) {
--			$html .= '<ul>';
--			$html .'<div>';
--		}
--	}
-+        if ($have_before || $have_after) {
-+            $html .= '<ul>';
-+            $html .'<div>';
-+        }
-+    }
+-    function pagination($have_before, $have_after, $page, $fbaction, $args=NULL) {
++    function pagination($have_before, $have_after, $page, $fbaction, $args=null) {
 hunk ./lib/facebookaction.php 269
--	function pagination_url($fbaction, $args=NULL) {
--		global $config;
-+    function pagination_url($fbaction, $args=NULL) {
-+        global $config;
-hunk ./lib/facebookaction.php 272
--		$extra = '';
-+        $extra = '';
-hunk ./lib/facebookaction.php 274
--		if ($args) {
--			foreach ($args as $key => $value) {
--				$extra .= "&${key}=${value}";
--			}
--		}
-+        if ($args) {
-+            foreach ($args as $key => $value) {
-+                $extra .= "&${key}=${value}";
-+            }
-+        }
-hunk ./lib/facebookaction.php 280
--		return "$fbaction?${extra}";
--	}
-+        return "$fbaction?${extra}";
-+    }
-hunk ./lib/oauthstore.php 26
--	# We keep a record of who's contacted us
-+    # We keep a record of who's contacted us
-hunk ./lib/oauthstore.php 28
--	function lookup_consumer($consumer_key) {
--		$con = Consumer::staticGet('consumer_key', $consumer_key);
--		if (!$con) {
--			$con = new Consumer();
--			$con->consumer_key = $consumer_key;
--			$con->seed = common_good_rand(16);
--			$con->created = DB_DataObject_Cast::dateTime();
--			if (!$con->insert()) {
--				return NULL;
--			}
--		}
--		return new OAuthConsumer($con->consumer_key, '');
--	}
-+    function lookup_consumer($consumer_key) {
-+        $con = Consumer::staticGet('consumer_key', $consumer_key);
-+        if (!$con) {
-+            $con = new Consumer();
-+            $con->consumer_key = $consumer_key;
-+            $con->seed = common_good_rand(16);
-+            $con->created = DB_DataObject_Cast::dateTime();
-+            if (!$con->insert()) {
-+                return NULL;
-+            }
-+        }
-+        return new OAuthConsumer($con->consumer_key, '');
-+    }
-hunk ./lib/oauthstore.php 42
--	function lookup_token($consumer, $token_type, $token_key) {
--		$t = new Token();
--		$t->consumer_key = $consumer->key;
--		$t->tok = $token_key;
--		$t->type = ($token_type == 'access') ? 1 : 0;
--		if ($t->find(true)) {
--			return new OAuthToken($t->tok, $t->secret);
--		} else {
--			return NULL;
--		}
--	}
-+    function lookup_token($consumer, $token_type, $token_key) {
-+        $t = new Token();
-+        $t->consumer_key = $consumer->key;
-+        $t->tok = $token_key;
-+        $t->type = ($token_type == 'access') ? 1 : 0;
-+        if ($t->find(true)) {
-+            return new OAuthToken($t->tok, $t->secret);
-+        } else {
-+            return NULL;
-+        }
-+    }
-hunk ./lib/oauthstore.php 54
--	function lookup_nonce($consumer, $token, $nonce, $timestamp) {
--		$n = new Nonce();
--		$n->consumer_key = $consumer->key;
--		$n->tok = $token->key;
--		$n->nonce = $nonce;
--		if ($n->find(TRUE)) {
--			return TRUE;
--		} else {
--			$n->timestamp = $timestamp;
--			$n->created = DB_DataObject_Cast::dateTime();
--			$n->insert();
--			return FALSE;
--		}
--	}
-+    function lookup_nonce($consumer, $token, $nonce, $timestamp) {
-+        $n = new Nonce();
-+        $n->consumer_key = $consumer->key;
-+        $n->tok = $token->key;
-+        $n->nonce = $nonce;
-+        if ($n->find(TRUE)) {
-+            return TRUE;
-+        } else {
-+            $n->timestamp = $timestamp;
-+            $n->created = DB_DataObject_Cast::dateTime();
-+            $n->insert();
-+            return FALSE;
-+        }
-+    }
-hunk ./lib/oauthstore.php 69
--	function new_request_token($consumer) {
--		$t = new Token();
--		$t->consumer_key = $consumer->key;
--		$t->tok = common_good_rand(16);
--		$t->secret = common_good_rand(16);
--		$t->type = 0; # request
--		$t->state = 0; # unauthorized
--		$t->created = DB_DataObject_Cast::dateTime();
--		if (!$t->insert()) {
--			return NULL;
--		} else {
--			return new OAuthToken($t->tok, $t->secret);
--		}
--	}
-+    function new_request_token($consumer) {
-+        $t = new Token();
-+        $t->consumer_key = $consumer->key;
-+        $t->tok = common_good_rand(16);
-+        $t->secret = common_good_rand(16);
-+        $t->type = 0; # request
-+        $t->state = 0; # unauthorized
-+        $t->created = DB_DataObject_Cast::dateTime();
-+        if (!$t->insert()) {
-+            return NULL;
-+        } else {
-+            return new OAuthToken($t->tok, $t->secret);
-+        }
-+    }
-hunk ./lib/oauthstore.php 84
--	# defined in OAuthDataStore, but not implemented anywhere
-+    # defined in OAuthDataStore, but not implemented anywhere
-hunk ./lib/oauthstore.php 86
--	function fetch_request_token($consumer) {
--		return $this->new_request_token($consumer);
--	}
-+    function fetch_request_token($consumer) {
-+        return $this->new_request_token($consumer);
-+    }
-hunk ./lib/oauthstore.php 90
--	function new_access_token($token, $consumer) {
--		common_debug('new_access_token("'.$token->key.'","'.$consumer->key.'")', __FILE__);
--		$rt = new Token();
--		$rt->consumer_key = $consumer->key;
--		$rt->tok = $token->key;
--		$rt->type = 0; # request
--		if ($rt->find(TRUE) && $rt->state == 1) { # authorized
--			common_debug('request token found.', __FILE__);
--			$at = new Token();
--			$at->consumer_key = $consumer->key;
--			$at->tok = common_good_rand(16);
--			$at->secret = common_good_rand(16);
--			$at->type = 1; # access
--			$at->created = DB_DataObject_Cast::dateTime();
--			if (!$at->insert()) {
--				$e = $at->_lastError;
--				common_debug('access token "'.$at->tok.'" not inserted: "'.$e->message.'"', __FILE__);
--				return NULL;
--			} else {
--				common_debug('access token "'.$at->tok.'" inserted', __FILE__);
--				# burn the old one
--				$orig_rt = clone($rt);
--				$rt->state = 2; # used
--				if (!$rt->update($orig_rt)) {
--					return NULL;
--				}
--				common_debug('request token "'.$rt->tok.'" updated', __FILE__);
--				# Update subscription
--				# XXX: mixing levels here
--				$sub = Subscription::staticGet('token', $rt->tok);
--				if (!$sub) {
--					return NULL;
--				}
--				common_debug('subscription for request token found', __FILE__);
--				$orig_sub = clone($sub);
--				$sub->token = $at->tok;
--				$sub->secret = $at->secret;
--				if (!$sub->update($orig_sub)) {
--					return NULL;
--				} else {
--					common_debug('subscription updated to use access token', __FILE__);
--					return new OAuthToken($at->tok, $at->secret);
--				}
--			}
--		} else {
--			return NULL;
--		}
--	}
-+    function new_access_token($token, $consumer) {
-+        common_debug('new_access_token("'.$token->key.'","'.$consumer->key.'")', __FILE__);
-+        $rt = new Token();
-+        $rt->consumer_key = $consumer->key;
-+        $rt->tok = $token->key;
-+        $rt->type = 0; # request
-+        if ($rt->find(TRUE) && $rt->state == 1) { # authorized
-+            common_debug('request token found.', __FILE__);
-+            $at = new Token();
-+            $at->consumer_key = $consumer->key;
-+            $at->tok = common_good_rand(16);
-+            $at->secret = common_good_rand(16);
-+            $at->type = 1; # access
-+            $at->created = DB_DataObject_Cast::dateTime();
-+            if (!$at->insert()) {
-+                $e = $at->_lastError;
-+                common_debug('access token "'.$at->tok.'" not inserted: "'.$e->message.'"', __FILE__);
-+                return NULL;
-+            } else {
-+                common_debug('access token "'.$at->tok.'" inserted', __FILE__);
-+                # burn the old one
-+                $orig_rt = clone($rt);
-+                $rt->state = 2; # used
-+                if (!$rt->update($orig_rt)) {
-+                    return NULL;
-+                }
-+                common_debug('request token "'.$rt->tok.'" updated', __FILE__);
-+                # Update subscription
-+                # XXX: mixing levels here
-+                $sub = Subscription::staticGet('token', $rt->tok);
-+                if (!$sub) {
-+                    return NULL;
-+                }
-+                common_debug('subscription for request token found', __FILE__);
-+                $orig_sub = clone($sub);
-+                $sub->token = $at->tok;
-+                $sub->secret = $at->secret;
-+                if (!$sub->update($orig_sub)) {
-+                    return NULL;
-+                } else {
-+                    common_debug('subscription updated to use access token', __FILE__);
-+                    return new OAuthToken($at->tok, $at->secret);
-+                }
-+            }
-+        } else {
-+            return NULL;
-+        }
-+    }
-hunk ./lib/oauthstore.php 139
--	# defined in OAuthDataStore, but not implemented anywhere
-+    # defined in OAuthDataStore, but not implemented anywhere
-hunk ./lib/oauthstore.php 141
--	function fetch_access_token($consumer) {
--		return $this->new_access_token($consumer);
--	}
-+    function fetch_access_token($consumer) {
-+        return $this->new_access_token($consumer);
-+    }
+-    function pagination_url($fbaction, $args=NULL) {
++    function pagination_url($fbaction, $args=null) {
+hunk ./lib/oauthstore.php 36
+-                return NULL;
++                return null;
+hunk ./lib/oauthstore.php 50
+-            return NULL;
++            return null;
+hunk ./lib/oauthstore.php 78
+-            return NULL;
++            return null;
+hunk ./lib/oauthstore.php 107
+-                return NULL;
++                return null;
+hunk ./lib/oauthstore.php 114
+-                    return NULL;
++                    return null;
+hunk ./lib/oauthstore.php 121
+-                    return NULL;
++                    return null;
+hunk ./lib/oauthstore.php 128
+-                    return NULL;
++                    return null;
+hunk ./lib/oauthstore.php 135
+-            return NULL;
++            return null;
 hunk ./lib/omb.php 47
--	static $con = NULL;
--	if (!$con) {
--		$con = new OAuthConsumer(common_root_url(), '');
--	}
--	return $con;
-+    static $con = NULL;
-+    if (!$con) {
-+        $con = new OAuthConsumer(common_root_url(), '');
-+    }
-+    return $con;
-hunk ./lib/omb.php 55
--	static $server = null;
--	if (!$server) {
--		$server = new OAuthServer(omb_oauth_datastore());
--		$server->add_signature_method(omb_hmac_sha1());
--	}
--	return $server;
-+    static $server = null;
-+    if (!$server) {
-+        $server = new OAuthServer(omb_oauth_datastore());
-+        $server->add_signature_method(omb_hmac_sha1());
-+    }
-+    return $server;
+-    static $con = NULL;
++    static $con = null;
 hunk ./lib/omb.php 64
--	static $store = NULL;
--	if (!$store) {
--		$store = new LaconicaOAuthDataStore();
--	}
--	return $store;
-+    static $store = NULL;
-+    if (!$store) {
-+        $store = new LaconicaOAuthDataStore();
-+    }
-+    return $store;
+-    static $store = NULL;
++    static $store = null;
 hunk ./lib/omb.php 72
--	static $hmac_method = NULL;
--	if (!$hmac_method) {
--		$hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
--	}
--	return $hmac_method;
-+    static $hmac_method = NULL;
-+    if (!$hmac_method) {
-+        $hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
-+    }
-+    return $hmac_method;
-hunk ./lib/omb.php 80
--	return $xrd->services(array(omb_service_filter($type)));
-+    return $xrd->services(array(omb_service_filter($type)));
-hunk ./lib/omb.php 84
--	return create_function('$s',
--						   'return omb_match_service($s, \''.$type.'\');');
-+    return create_function('$s',
-+                           'return omb_match_service($s, \''.$type.'\');');
-hunk ./lib/omb.php 89
--	return in_array($type, $service->getTypes());
-+    return in_array($type, $service->getTypes());
-hunk ./lib/omb.php 93
--	if (!$service) {
--		return NULL;
--	}
--	$uris = $service->getURIs();
--	if (!$uris) {
--		return NULL;
--	}
--	return $uris[0];
-+    if (!$service) {
-+        return NULL;
-+    }
-+    $uris = $service->getURIs();
-+    if (!$uris) {
-+        return NULL;
-+    }
-+    return $uris[0];
-hunk ./lib/omb.php 104
--	if (!$service) {
--		return NULL;
--	}
--	$els = $service->getElements('xrd:LocalID');
--	if (!$els) {
--		return NULL;
--	}
--	$el = $els[0];
--	return $service->parser->content($el);
-+    if (!$service) {
-+        return NULL;
-+    }
-+    $els = $service->getElements('xrd:LocalID');
-+    if (!$els) {
-+        return NULL;
-+    }
-+    $el = $els[0];
-+    return $service->parser->content($el);
-hunk ./lib/omb.php 117
--	# First, get remote users subscribed to this profile
--	$rp = new Remote_profile();
-+    # First, get remote users subscribed to this profile
-+    $rp = new Remote_profile();
-hunk ./lib/omb.php 120
--	$rp->query('SELECT postnoticeurl, token, secret ' .
--			   'FROM subscription JOIN remote_profile ' .
--			   'ON subscription.subscriber = remote_profile.id ' .
--			   'WHERE subscription.subscribed = ' . $notice->profile_id . ' ');
-+    $rp->query('SELECT postnoticeurl, token, secret ' .
-+               'FROM subscription JOIN remote_profile ' .
-+               'ON subscription.subscriber = remote_profile.id ' .
-+               'WHERE subscription.subscribed = ' . $notice->profile_id . ' ');
-hunk ./lib/omb.php 125
--	$posted = array();
-+    $posted = array();
-hunk ./lib/omb.php 127
--	while ($rp->fetch()) {
--		if (!$posted[$rp->postnoticeurl]) {
--			common_log(LOG_DEBUG, 'Posting to ' . $rp->postnoticeurl);
--			if (omb_post_notice_keys($notice, $rp->postnoticeurl, $rp->token, $rp->secret)) {
--				common_log(LOG_DEBUG, 'Finished to ' . $rp->postnoticeurl);
--				$posted[$rp->postnoticeurl] = TRUE;
--			} else {
--				common_log(LOG_DEBUG, 'Failed posting to ' . $rp->postnoticeurl);
--			}
--		}
--	}
-+    while ($rp->fetch()) {
-+        if (!$posted[$rp->postnoticeurl]) {
-+            common_log(LOG_DEBUG, 'Posting to ' . $rp->postnoticeurl);
-+            if (omb_post_notice_keys($notice, $rp->postnoticeurl, $rp->token, $rp->secret)) {
-+                common_log(LOG_DEBUG, 'Finished to ' . $rp->postnoticeurl);
-+                $posted[$rp->postnoticeurl] = TRUE;
-+            } else {
-+                common_log(LOG_DEBUG, 'Failed posting to ' . $rp->postnoticeurl);
-+            }
-+        }
-+    }
-hunk ./lib/omb.php 139
--	$rp->free();
--	unset($rp);
-+    $rp->free();
-+    unset($rp);
-hunk ./lib/omb.php 142
--	return true;
-+    return true;
-hunk ./lib/omb.php 146
--	return omb_post_notice_keys($notice, $remote_profile->postnoticeurl, $subscription->token, $subscription->secret);
-+    return omb_post_notice_keys($notice, $remote_profile->postnoticeurl, $subscription->token, $subscription->secret);
-hunk ./lib/omb.php 151
--	common_debug('Posting notice ' . $notice->id . ' to ' . $postnoticeurl, __FILE__);
-+    common_debug('Posting notice ' . $notice->id . ' to ' . $postnoticeurl, __FILE__);
-hunk ./lib/omb.php 153
--	$user = User::staticGet('id', $notice->profile_id);
-+    $user = User::staticGet('id', $notice->profile_id);
-hunk ./lib/omb.php 155
--	if (!$user) {
--		common_debug('Failed to get user for notice ' . $notice->id . ', profile = ' . $notice->profile_id, __FILE__);
--		return false;
--	}
-+    if (!$user) {
-+        common_debug('Failed to get user for notice ' . $notice->id . ', profile = ' . $notice->profile_id, __FILE__);
-+        return false;
-+    }
-hunk ./lib/omb.php 160
--	$con = omb_oauth_consumer();
-+    $con = omb_oauth_consumer();
-hunk ./lib/omb.php 162
--	$token = new OAuthToken($tk, $secret);
-+    $token = new OAuthToken($tk, $secret);
-hunk ./lib/omb.php 164
--	$url = $postnoticeurl;
--	$parsed = parse_url($url);
--	$params = array();
--	parse_str($parsed['query'], $params);
-+    $url = $postnoticeurl;
-+    $parsed = parse_url($url);
-+    $params = array();
-+    parse_str($parsed['query'], $params);
-hunk ./lib/omb.php 169
--	$req = OAuthRequest::from_consumer_and_token($con, $token,
--												 'POST', $url, $params);
-+    $req = OAuthRequest::from_consumer_and_token($con, $token,
-+                                                 'POST', $url, $params);
-hunk ./lib/omb.php 172
--	$req->set_parameter('omb_version', OMB_VERSION_01);
--	$req->set_parameter('omb_listenee', $user->uri);
--	$req->set_parameter('omb_notice', $notice->uri);
--	$req->set_parameter('omb_notice_content', $notice->content);
--	$req->set_parameter('omb_notice_url', common_local_url('shownotice',
--														   array('notice' =>
--																 $notice->id)));
--	$req->set_parameter('omb_notice_license', common_config('license', 'url'));
-+    $req->set_parameter('omb_version', OMB_VERSION_01);
-+    $req->set_parameter('omb_listenee', $user->uri);
-+    $req->set_parameter('omb_notice', $notice->uri);
-+    $req->set_parameter('omb_notice_content', $notice->content);
-+    $req->set_parameter('omb_notice_url', common_local_url('shownotice',
-+                                                           array('notice' =>
-+                                                                 $notice->id)));
-+    $req->set_parameter('omb_notice_license', common_config('license', 'url'));
-hunk ./lib/omb.php 181
--	$user->free();
--	unset($user);
-+    $user->free();
-+    unset($user);
-hunk ./lib/omb.php 184
--	$req->sign_request(omb_hmac_sha1(), $con, $token);
-+    $req->sign_request(omb_hmac_sha1(), $con, $token);
-hunk ./lib/omb.php 186
--	# We re-use this tool's fetcher, since it's pretty good
-+    # We re-use this tool's fetcher, since it's pretty good
-hunk ./lib/omb.php 188
--	$fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
-+    $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
-hunk ./lib/omb.php 190
--	if (!$fetcher) {
--		common_log(LOG_WARNING, 'Failed to initialize Yadis fetcher.', __FILE__);
--		return false;
--	}
-+    if (!$fetcher) {
-+        common_log(LOG_WARNING, 'Failed to initialize Yadis fetcher.', __FILE__);
-+        return false;
-+    }
-hunk ./lib/omb.php 195
--	$result = $fetcher->post($req->get_normalized_http_url(),
--							 $req->to_postdata(),
-+    $result = $fetcher->post($req->get_normalized_http_url(),
-+                             $req->to_postdata(),
-hunk ./lib/omb.php 199
--	common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__);
-+    common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__);
-hunk ./lib/omb.php 201
--	if ($result->status == 403) { # not authorized, don't send again
--		common_debug('403 result, deleting subscription', __FILE__);
--		# FIXME: figure out how to delete this
--		# $subscription->delete();
--		return false;
--	} else if ($result->status != 200) {
--		common_debug('Error status '.$result->status, __FILE__);
--		return false;
--	} else { # success!
--		parse_str($result->body, $return);
--		if ($return['omb_version'] == OMB_VERSION_01) {
--			return true;
--		} else {
--			return false;
--		}
--	}
-+    if ($result->status == 403) { # not authorized, don't send again
-+        common_debug('403 result, deleting subscription', __FILE__);
-+        # FIXME: figure out how to delete this
-+        # $subscription->delete();
-+        return false;
-+    } else if ($result->status != 200) {
-+        common_debug('Error status '.$result->status, __FILE__);
-+        return false;
-+    } else { # success!
-+        parse_str($result->body, $return);
-+        if ($return['omb_version'] == OMB_VERSION_01) {
-+            return true;
-+        } else {
-+            return false;
-+        }
-+    }
-hunk ./lib/omb.php 220
--	# First, get remote users subscribed to this profile
--	# XXX: use a join here rather than looping through results
--	$sub = new Subscription();
--	$sub->subscribed = $profile->id;
--	if ($sub->find()) {
--		$updated = array();
--		while ($sub->fetch()) {
--			$rp = Remote_profile::staticGet('id', $sub->subscriber);
--			if ($rp) {
--				if (!$updated[$rp->updateprofileurl]) {
--					if (omb_update_profile($profile, $rp, $sub)) {
--						$updated[$rp->updateprofileurl] = TRUE;
--					}
--				}
--			}
--		}
--	}
-+    # First, get remote users subscribed to this profile
-+    # XXX: use a join here rather than looping through results
-+    $sub = new Subscription();
-+    $sub->subscribed = $profile->id;
-+    if ($sub->find()) {
-+        $updated = array();
-+        while ($sub->fetch()) {
-+            $rp = Remote_profile::staticGet('id', $sub->subscriber);
-+            if ($rp) {
-+                if (!$updated[$rp->updateprofileurl]) {
-+                    if (omb_update_profile($profile, $rp, $sub)) {
-+                        $updated[$rp->updateprofileurl] = TRUE;
-+                    }
-+                }
-+            }
-+        }
-+    }
-hunk ./lib/omb.php 240
--	global $config; # for license URL
--	$user = User::staticGet($profile->id);
--	$con = omb_oauth_consumer();
--	$token = new OAuthToken($subscription->token, $subscription->secret);
--	$url = $remote_profile->updateprofileurl;
--	$parsed = parse_url($url);
--	$params = array();
--	parse_str($parsed['query'], $params);
--	$req = OAuthRequest::from_consumer_and_token($con, $token,
--												 "POST", $url, $params);
--	$req->set_parameter('omb_version', OMB_VERSION_01);
--	$req->set_parameter('omb_listenee', $user->uri);
--	$req->set_parameter('omb_listenee_profile', common_profile_url($profile->nickname));
--	$req->set_parameter('omb_listenee_nickname', $profile->nickname);
-+    global $config; # for license URL
-+    $user = User::staticGet($profile->id);
-+    $con = omb_oauth_consumer();
-+    $token = new OAuthToken($subscription->token, $subscription->secret);
-+    $url = $remote_profile->updateprofileurl;
-+    $parsed = parse_url($url);
-+    $params = array();
-+    parse_str($parsed['query'], $params);
-+    $req = OAuthRequest::from_consumer_and_token($con, $token,
-+                                                 "POST", $url, $params);
-+    $req->set_parameter('omb_version', OMB_VERSION_01);
-+    $req->set_parameter('omb_listenee', $user->uri);
-+    $req->set_parameter('omb_listenee_profile', common_profile_url($profile->nickname));
-+    $req->set_parameter('omb_listenee_nickname', $profile->nickname);
-hunk ./lib/omb.php 255
--	# We use blanks to force emptying any existing values in these optional fields
-+    # We use blanks to force emptying any existing values in these optional fields
-hunk ./lib/omb.php 257
--	$req->set_parameter('omb_listenee_fullname',
--						($profile->fullname) ? $profile->fullname : '');
--	$req->set_parameter('omb_listenee_homepage',
--						($profile->homepage) ? $profile->homepage : '');
--	$req->set_parameter('omb_listenee_bio',
--						($profile->bio) ? $profile->bio : '');
--	$req->set_parameter('omb_listenee_location',
--						($profile->location) ? $profile->location : '');
-+    $req->set_parameter('omb_listenee_fullname',
-+                        ($profile->fullname) ? $profile->fullname : '');
-+    $req->set_parameter('omb_listenee_homepage',
-+                        ($profile->homepage) ? $profile->homepage : '');
-+    $req->set_parameter('omb_listenee_bio',
-+                        ($profile->bio) ? $profile->bio : '');
-+    $req->set_parameter('omb_listenee_location',
-+                        ($profile->location) ? $profile->location : '');
-hunk ./lib/omb.php 266
--	$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
--	$req->set_parameter('omb_listenee_avatar',
--						($avatar) ? $avatar->url : '');
-+    $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-+    $req->set_parameter('omb_listenee_avatar',
-+                        ($avatar) ? $avatar->url : '');
-hunk ./lib/omb.php 270
--	$req->sign_request(omb_hmac_sha1(), $con, $token);
-+    $req->sign_request(omb_hmac_sha1(), $con, $token);
-hunk ./lib/omb.php 272
--	# We re-use this tool's fetcher, since it's pretty good
-+    # We re-use this tool's fetcher, since it's pretty good
-hunk ./lib/omb.php 274
--	$fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
-+    $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
-hunk ./lib/omb.php 276
--	common_debug('request URL = '.$req->get_normalized_http_url(), __FILE__);
--	common_debug('postdata = '.$req->to_postdata(), __FILE__);
--	$result = $fetcher->post($req->get_normalized_http_url(),
--							 $req->to_postdata(),
-+    common_debug('request URL = '.$req->get_normalized_http_url(), __FILE__);
-+    common_debug('postdata = '.$req->to_postdata(), __FILE__);
-+    $result = $fetcher->post($req->get_normalized_http_url(),
-+                             $req->to_postdata(),
-hunk ./lib/omb.php 282
--	common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__);
-+    common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__);
-hunk ./lib/omb.php 284
--	if ($result->status == 403) { # not authorized, don't send again
--		common_debug('403 result, deleting subscription', __FILE__);
--		$subscription->delete();
--		return false;
--	} else if ($result->status != 200) {
--		common_debug('Error status '.$result->status, __FILE__);
--		return false;
--	} else { # success!
--		parse_str($result->body, $return);
--		if ($return['omb_version'] == OMB_VERSION_01) {
--			return true;
--		} else {
--			return false;
--		}
--	}
-+    if ($result->status == 403) { # not authorized, don't send again
-+        common_debug('403 result, deleting subscription', __FILE__);
-+        $subscription->delete();
-+        return false;
-+    } else if ($result->status != 200) {
-+        common_debug('Error status '.$result->status, __FILE__);
-+        return false;
-+    } else { # success!
-+        parse_str($result->body, $return);
-+        if ($return['omb_version'] == OMB_VERSION_01) {
-+            return true;
-+        } else {
-+            return false;
-+        }
-+    }
-hunk ./lib/openid.php 36
--	if (!$store) {
--		# Can't be called statically
--		$user = new User();
--		$conn = $user->getDatabaseConnection();
--		$store = new Auth_OpenID_MySQLStore($conn);
--	}
--	return $store;
-+    if (!$store) {
-+        # Can't be called statically
-+        $user = new User();
-+        $conn = $user->getDatabaseConnection();
-+        $store = new Auth_OpenID_MySQLStore($conn);
-+    }
-+    return $store;
-hunk ./lib/openid.php 46
--	$store = oid_store();
--	$consumer = new Auth_OpenID_Consumer($store);
--	return $consumer;
-+    $store = oid_store();
-+    $consumer = new Auth_OpenID_Consumer($store);
-+    return $consumer;
-hunk ./lib/openid.php 52
--	oid_set_last('');
-+    oid_set_last('');
-hunk ./lib/openid.php 56
--	common_set_cookie(OPENID_COOKIE_KEY,
--			         $openid_url,
--			         time() + OPENID_COOKIE_EXPIRY);
-+    common_set_cookie(OPENID_COOKIE_KEY,
-+                     $openid_url,
-+                     time() + OPENID_COOKIE_EXPIRY);
-hunk ./lib/openid.php 62
--	$openid_url = $_COOKIE[OPENID_COOKIE_KEY];
--	if ($openid_url && strlen($openid_url) > 0) {
--		return $openid_url;
--	} else {
--		return NULL;
--	}
-+    $openid_url = $_COOKIE[OPENID_COOKIE_KEY];
-+    if ($openid_url && strlen($openid_url) > 0) {
-+        return $openid_url;
-+    } else {
-+        return NULL;
-+    }
-hunk ./lib/openid.php 72
--	$oid = new User_openid();
--	$oid->user_id = $id;
--	$oid->canonical = $canonical;
--	$oid->display = $display;
--	$oid->created = DB_DataObject_Cast::dateTime();
-+    $oid = new User_openid();
-+    $oid->user_id = $id;
-+    $oid->canonical = $canonical;
-+    $oid->display = $display;
-+    $oid->created = DB_DataObject_Cast::dateTime();
-hunk ./lib/openid.php 78
--	if (!$oid->insert()) {
--		$err = PEAR::getStaticProperty('DB_DataObject','lastError');
--		common_debug('DB error ' . $err->code . ': ' . $err->message, __FILE__);
--		return false;
--	}
-+    if (!$oid->insert()) {
-+        $err = PEAR::getStaticProperty('DB_DataObject','lastError');
-+        common_debug('DB error ' . $err->code . ': ' . $err->message, __FILE__);
-+        return false;
-+    }
-hunk ./lib/openid.php 84
--	return true;
-+    return true;
+-    static $hmac_method = NULL;
++    static $hmac_method = null;
+hunk ./lib/omb.php 94
+-        return NULL;
++        return null;
+hunk ./lib/omb.php 98
+-        return NULL;
++        return null;
+hunk ./lib/omb.php 105
+-        return NULL;
++        return null;
+hunk ./lib/omb.php 109
+-        return NULL;
++        return null;
+hunk ./lib/openid.php 35
+-    static $store = NULL;
++    static $store = null;
+hunk ./lib/openid.php 66
+-        return NULL;
++        return null;
 hunk ./lib/openid.php 88
--	$user = NULL;
--	$oid = User_openid::staticGet('canonical', $openid_url);
--	if ($oid) {
--		$user = User::staticGet('id', $oid->user_id);
--	}
--	return $user;
-+    $user = NULL;
-+    $oid = User_openid::staticGet('canonical', $openid_url);
-+    if ($oid) {
-+        $user = User::staticGet('id', $oid->user_id);
-+    }
-+    return $user;
-hunk ./lib/openid.php 97
--	if (!$backto) {
--		$action = $_REQUEST['action'];
--		$args = common_copy_args($_GET);
--		unset($args['action']);
--		$backto = common_local_url($action, $args);
--	}
--	common_debug('going back to "' . $backto . '"', __FILE__);
-+    if (!$backto) {
-+        $action = $_REQUEST['action'];
-+        $args = common_copy_args($_GET);
-+        unset($args['action']);
-+        $backto = common_local_url($action, $args);
-+    }
-+    common_debug('going back to "' . $backto . '"', __FILE__);
-hunk ./lib/openid.php 105
--	common_ensure_session();
-+    common_ensure_session();
-hunk ./lib/openid.php 107
--	$_SESSION['openid_immediate_backto'] = $backto;
--	common_debug('passed-in variable is "' . $backto . '"', __FILE__);
--	common_debug('session variable is "' . $_SESSION['openid_immediate_backto'] . '"', __FILE__);
-+    $_SESSION['openid_immediate_backto'] = $backto;
-+    common_debug('passed-in variable is "' . $backto . '"', __FILE__);
-+    common_debug('session variable is "' . $_SESSION['openid_immediate_backto'] . '"', __FILE__);
-hunk ./lib/openid.php 111
--	oid_authenticate($openid_url,
--					 'finishimmediate',
--					 true);
-+    oid_authenticate($openid_url,
-+                     'finishimmediate',
-+                     true);
-hunk ./lib/openid.php 118
--	$consumer = oid_consumer();
-+    $consumer = oid_consumer();
-hunk ./lib/openid.php 120
--	if (!$consumer) {
--		common_server_error(_('Cannot instantiate OpenID consumer object.'));
--		return false;
--	}
-+    if (!$consumer) {
-+        common_server_error(_('Cannot instantiate OpenID consumer object.'));
-+        return false;
-+    }
-hunk ./lib/openid.php 125
--	common_ensure_session();
-+    common_ensure_session();
-hunk ./lib/openid.php 127
--	$auth_request = $consumer->begin($openid_url);
-+    $auth_request = $consumer->begin($openid_url);
-hunk ./lib/openid.php 129
--	// Handle failure status return values.
--	if (!$auth_request) {
--		return _('Not a valid OpenID.');
--	} else if (Auth_OpenID::isFailure($auth_request)) {
--		return sprintf(_('OpenID failure: %s'), $auth_request->message);
--	}
-+    // Handle failure status return values.
-+    if (!$auth_request) {
-+        return _('Not a valid OpenID.');
-+    } else if (Auth_OpenID::isFailure($auth_request)) {
-+        return sprintf(_('OpenID failure: %s'), $auth_request->message);
-+    }
-hunk ./lib/openid.php 136
--	$sreg_request = Auth_OpenID_SRegRequest::build(// Required
--												   array(),
--												   // Optional
--												   array('nickname',
--														 'email',
--														 'fullname',
--														 'language',
--														 'timezone',
--														 'postcode',
--														 'country'));
-+    $sreg_request = Auth_OpenID_SRegRequest::build(// Required
-+                                                   array(),
-+                                                   // Optional
-+                                                   array('nickname',
-+                                                         'email',
-+                                                         'fullname',
-+                                                         'language',
-+                                                         'timezone',
-+                                                         'postcode',
-+                                                         'country'));
-hunk ./lib/openid.php 147
--	if ($sreg_request) {
--		$auth_request->addExtension($sreg_request);
--	}
-+    if ($sreg_request) {
-+        $auth_request->addExtension($sreg_request);
-+    }
-hunk ./lib/openid.php 151
--	$trust_root = common_local_url('public');
--	$process_url = common_local_url($returnto);
-+    $trust_root = common_local_url('public');
-+    $process_url = common_local_url($returnto);
-hunk ./lib/openid.php 154
--	if ($auth_request->shouldSendRedirect()) {
--		$redirect_url = $auth_request->redirectURL($trust_root,
--												   $process_url,
--												   $immediate);
--		if (!$redirect_url) {
--		} else if (Auth_OpenID::isFailure($redirect_url)) {
--			return sprintf(_('Could not redirect to server: %s'), $redirect_url->message);
--		} else {
--			common_redirect($redirect_url);
--		}
--	} else {
--		// Generate form markup and render it.
--		$form_id = 'openid_message';
--		$form_html = $auth_request->formMarkup($trust_root, $process_url,
--											   $immediate, array('id' => $form_id));
-+    if ($auth_request->shouldSendRedirect()) {
-+        $redirect_url = $auth_request->redirectURL($trust_root,
-+                                                   $process_url,
-+                                                   $immediate);
-+        if (!$redirect_url) {
-+        } else if (Auth_OpenID::isFailure($redirect_url)) {
-+            return sprintf(_('Could not redirect to server: %s'), $redirect_url->message);
-+        } else {
-+            common_redirect($redirect_url);
-+        }
-+    } else {
-+        // Generate form markup and render it.
-+        $form_id = 'openid_message';
-+        $form_html = $auth_request->formMarkup($trust_root, $process_url,
-+                                               $immediate, array('id' => $form_id));
-hunk ./lib/openid.php 170
--		# XXX: This is cheap, but things choke if we don't escape ampersands
--		# in the HTML attributes
-+        # XXX: This is cheap, but things choke if we don't escape ampersands
-+        # in the HTML attributes
-hunk ./lib/openid.php 173
--		$form_html = preg_replace('/&/', '&amp;', $form_html);
-+        $form_html = preg_replace('/&/', '&amp;', $form_html);
-hunk ./lib/openid.php 175
--		// Display an error if the form markup couldn't be generated;
--		// otherwise, render the HTML.
--		if (Auth_OpenID::isFailure($form_html)) {
--			$this->show_form(sprintf(_('Could not create OpenID form: %s'), $form_html->message));
--		} else {
--			common_show_header(_('OpenID Auto-Submit'), NULL, NULL, '_oid_print_instructions');
--			common_raw($form_html);
--			common_element('script', NULL,
--						   '$(document).ready(function() { ' .
--						   '    $("#'. $form_id .'").submit(); '.
--						   '});');
--			common_show_footer();
--		}
--	}
-+        // Display an error if the form markup couldn't be generated;
-+        // otherwise, render the HTML.
-+        if (Auth_OpenID::isFailure($form_html)) {
-+            $this->show_form(sprintf(_('Could not create OpenID form: %s'), $form_html->message));
-+        } else {
-+            common_show_header(_('OpenID Auto-Submit'), NULL, NULL, '_oid_print_instructions');
-+            common_raw($form_html);
-+            common_element('script', NULL,
-+                           '$(document).ready(function() { ' .
-+                           '    $("#'. $form_id .'").submit(); '.
-+                           '});');
-+            common_show_footer();
-+        }
-+    }
-hunk ./lib/openid.php 194
--	common_element('div', 'instructions',
--				   _('This form should automatically submit itself. '.
--					  'If not, click the submit button to go to your '.
--					  'OpenID provider.'));
-+    common_element('div', 'instructions',
-+                   _('This form should automatically submit itself. '.
-+                      'If not, click the submit button to go to your '.
-+                      'OpenID provider.'));
-hunk ./lib/openid.php 204
--	$profile = $user->getProfile();
-+    $profile = $user->getProfile();
-hunk ./lib/openid.php 206
--	$orig_profile = clone($profile);
-+    $orig_profile = clone($profile);
-hunk ./lib/openid.php 208
--	if ($sreg['fullname'] && strlen($sreg['fullname']) <= 255) {
--		$profile->fullname = $sreg['fullname'];
--	}
-+    if ($sreg['fullname'] && strlen($sreg['fullname']) <= 255) {
-+        $profile->fullname = $sreg['fullname'];
-+    }
-hunk ./lib/openid.php 212
--	if ($sreg['country']) {
--		if ($sreg['postcode']) {
--			# XXX: use postcode to get city and region
--			# XXX: also, store postcode somewhere -- it's valuable!
--			$profile->location = $sreg['postcode'] . ', ' . $sreg['country'];
--		} else {
--			$profile->location = $sreg['country'];
--		}
--	}
-+    if ($sreg['country']) {
-+        if ($sreg['postcode']) {
-+            # XXX: use postcode to get city and region
-+            # XXX: also, store postcode somewhere -- it's valuable!
-+            $profile->location = $sreg['postcode'] . ', ' . $sreg['country'];
-+        } else {
-+            $profile->location = $sreg['country'];
-+        }
-+    }
-hunk ./lib/openid.php 222
--	# XXX save language if it's passed
--	# XXX save timezone if it's passed
-+    # XXX save language if it's passed
-+    # XXX save timezone if it's passed
-hunk ./lib/openid.php 225
--	if (!$profile->update($orig_profile)) {
--		common_server_error(_('Error saving the profile.'));
--		return false;
--	}
-+    if (!$profile->update($orig_profile)) {
-+        common_server_error(_('Error saving the profile.'));
-+        return false;
-+    }
-hunk ./lib/openid.php 230
--	$orig_user = clone($user);
-+    $orig_user = clone($user);
-hunk ./lib/openid.php 232
--	if ($sreg['email'] && Validate::email($sreg['email'], true)) {
--		$user->email = $sreg['email'];
--	}
-+    if ($sreg['email'] && Validate::email($sreg['email'], true)) {
-+        $user->email = $sreg['email'];
-+    }
-hunk ./lib/openid.php 236
--	if (!$user->update($orig_user)) {
--		common_server_error(_('Error saving the user.'));
--		return false;
--	}
-+    if (!$user->update($orig_user)) {
-+        common_server_error(_('Error saving the user.'));
-+        return false;
-+    }
-hunk ./lib/openid.php 241
--	return true;
-+    return true;
-hunk ./lib/personal.php 23
--	
--	function is_readonly() {
--		return true;
--	}
--	
--	function handle($args) {
--		parent::handle($args);
--	    common_set_returnto($this->self_url());
--	}
-+    
-+    function is_readonly() {
-+        return true;
-+    }
-+    
-+    function handle($args) {
-+        parent::handle($args);
-+        common_set_returnto($this->self_url());
-+    }
-hunk ./lib/personal.php 33
--	function views_menu() {
-+    function views_menu() {
+-    $user = NULL;
++    $user = null;
+hunk ./lib/openid.php 96
+-function oid_check_immediate($openid_url, $backto=NULL) {
++function oid_check_immediate($openid_url, $backto=null) {
+hunk ./lib/openid.php 180
+-            common_show_header(_('OpenID Auto-Submit'), NULL, NULL, '_oid_print_instructions');
++            common_show_header(_('OpenID Auto-Submit'), null, null, '_oid_print_instructions');
+hunk ./lib/openid.php 182
+-            common_element('script', NULL,
++            common_element('script', null,
 hunk ./lib/personal.php 35
--		$user = NULL;
--		$action = $this->trimmed('action');
--		$nickname = $this->trimmed('nickname');
-+        $user = NULL;
-+        $action = $this->trimmed('action');
-+        $nickname = $this->trimmed('nickname');
-hunk ./lib/personal.php 39
--		if ($nickname) {
--			$user = User::staticGet('nickname', $nickname);
--			$user_profile = $user->getProfile();
--		} else {
--			$user_profile = false;
--		}
-+        if ($nickname) {
-+            $user = User::staticGet('nickname', $nickname);
-+            $user_profile = $user->getProfile();
-+        } else {
-+            $user_profile = false;
-+        }
-hunk ./lib/personal.php 46
--		common_element_start('ul', array('id' => 'nav_views'));
-+        common_element_start('ul', array('id' => 'nav_views'));
-hunk ./lib/personal.php 48
--		common_menu_item(common_local_url('all', array('nickname' =>
--													   $nickname)),
--						 _('Personal'),
--						 sprintf(_('%s and friends'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
--						 $action == 'all');
--		common_menu_item(common_local_url('replies', array('nickname' =>
--															  $nickname)),
--						 _('Replies'),
--						 sprintf(_('Replies to %s'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
--						 $action == 'replies');
--		common_menu_item(common_local_url('showstream', array('nickname' =>
--															  $nickname)),
--						 _('Profile'),
--						 ($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname,
--						 $action == 'showstream');
--		common_menu_item(common_local_url('showfavorites', array('nickname' =>
--															  $nickname)),
--						 _('Favorites'),
--						 sprintf(_('%s\'s favorite notices'), ($user_profile) ? $user_profile->getBestName() : _('User')),
--						 $action == 'showfavorites');
--		
--		$cur = common_current_user();
--		
--		if ($cur && $cur->id == $user->id) {
--			
--			common_menu_item(common_local_url('inbox', array('nickname' =>
--																	 $nickname)),
--							 _('Inbox'),
--							 _('Your incoming messages'),
--							 $action == 'inbox');
--			common_menu_item(common_local_url('outbox', array('nickname' =>
--																	 $nickname)),
--							 _('Outbox'),
--							 _('Your sent messages'),
--							 $action == 'outbox');
--		}
--		
--		common_element_end('ul');
--	}
-+        common_menu_item(common_local_url('all', array('nickname' =>
-+                                                       $nickname)),
-+                         _('Personal'),
-+                         sprintf(_('%s and friends'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
-+                         $action == 'all');
-+        common_menu_item(common_local_url('replies', array('nickname' =>
-+                                                              $nickname)),
-+                         _('Replies'),
-+                         sprintf(_('Replies to %s'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
-+                         $action == 'replies');
-+        common_menu_item(common_local_url('showstream', array('nickname' =>
-+                                                              $nickname)),
-+                         _('Profile'),
-+                         ($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname,
-+                         $action == 'showstream');
-+        common_menu_item(common_local_url('showfavorites', array('nickname' =>
-+                                                              $nickname)),
-+                         _('Favorites'),
-+                         sprintf(_('%s\'s favorite notices'), ($user_profile) ? $user_profile->getBestName() : _('User')),
-+                         $action == 'showfavorites');
-+        
-+        $cur = common_current_user();
-+        
-+        if ($cur && $cur->id == $user->id) {
-+            
-+            common_menu_item(common_local_url('inbox', array('nickname' =>
-+                                                                     $nickname)),
-+                             _('Inbox'),
-+                             _('Your incoming messages'),
-+                             $action == 'inbox');
-+            common_menu_item(common_local_url('outbox', array('nickname' =>
-+                                                                     $nickname)),
-+                             _('Outbox'),
-+                             _('Your sent messages'),
-+                             $action == 'outbox');
-+        }
-+        
-+        common_element_end('ul');
-+    }
-hunk ./lib/personal.php 88
--	function show_feeds_list($feeds) {
--		common_element_start('div', array('class' => 'feeds'));
--		common_element('p', null, 'Feeds:');
--		common_element_start('ul', array('class' => 'xoxo'));
-+    function show_feeds_list($feeds) {
-+        common_element_start('div', array('class' => 'feeds'));
-+        common_element('p', null, 'Feeds:');
-+        common_element_start('ul', array('class' => 'xoxo'));
-hunk ./lib/personal.php 93
--		foreach ($feeds as $key => $value) {
--			$this->common_feed_item($feeds[$key]);
--		}
--		common_element_end('ul');
--		common_element_end('div');
--	}
-+        foreach ($feeds as $key => $value) {
-+            $this->common_feed_item($feeds[$key]);
-+        }
-+        common_element_end('ul');
-+        common_element_end('div');
-+    }
-hunk ./lib/personal.php 100
--	function common_feed_item($feed) {
--		$nickname = $this->trimmed('nickname');
-+    function common_feed_item($feed) {
-+        $nickname = $this->trimmed('nickname');
-hunk ./lib/personal.php 103
--		switch($feed['item']) {
--			case 'notices': default:
--				$feed_classname = $feed['type'];
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = "$nickname's ".$feed['version']." notice feed";
--				$feed['textContent'] = "RSS";
--				break;
-+        switch($feed['item']) {
-+            case 'notices': default:
-+                $feed_classname = $feed['type'];
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = "$nickname's ".$feed['version']." notice feed";
-+                $feed['textContent'] = "RSS";
-+                break;
-hunk ./lib/personal.php 111
--			case 'allrss':
--				$feed_classname = $feed['type'];
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = $feed['version']." feed for $nickname and friends";
--				$feed['textContent'] = "RSS";
--				break;
-+            case 'allrss':
-+                $feed_classname = $feed['type'];
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = $feed['version']." feed for $nickname and friends";
-+                $feed['textContent'] = "RSS";
-+                break;
-hunk ./lib/personal.php 118
--			case 'repliesrss':
--				$feed_classname = $feed['type'];
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = $feed['version']." feed for replies to $nickname";
--				$feed['textContent'] = "RSS";
--				break;
-+            case 'repliesrss':
-+                $feed_classname = $feed['type'];
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = $feed['version']." feed for replies to $nickname";
-+                $feed['textContent'] = "RSS";
-+                break;
-hunk ./lib/personal.php 125
--			case 'publicrss':
--				$feed_classname = $feed['type'];
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = "Public timeline ".$feed['version']." feed";
--				$feed['textContent'] = "RSS";
--				break;
-+            case 'publicrss':
-+                $feed_classname = $feed['type'];
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = "Public timeline ".$feed['version']." feed";
-+                $feed['textContent'] = "RSS";
-+                break;
-hunk ./lib/personal.php 132
--			case 'publicatom':
--				$feed_classname = "atom";
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = "Public timeline ".$feed['version']." feed";
--				$feed['textContent'] = "Atom";
--				break;
-+            case 'publicatom':
-+                $feed_classname = "atom";
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = "Public timeline ".$feed['version']." feed";
-+                $feed['textContent'] = "Atom";
-+                break;
-hunk ./lib/personal.php 139
--			case 'tagrss':
--				$feed_classname = $feed['type'];
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = $feed['version']." feed for this tag";
--				$feed['textContent'] = "RSS";
--				break;
-+            case 'tagrss':
-+                $feed_classname = $feed['type'];
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = $feed['version']." feed for this tag";
-+                $feed['textContent'] = "RSS";
-+                break;
-hunk ./lib/personal.php 146
--			case 'favoritedrss':
--				$feed_classname = $feed['type'];
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = "Favorited ".$feed['version']." feed";
--				$feed['textContent'] = "RSS";
--				break;
-+            case 'favoritedrss':
-+                $feed_classname = $feed['type'];
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = "Favorited ".$feed['version']." feed";
-+                $feed['textContent'] = "RSS";
-+                break;
-hunk ./lib/personal.php 153
--			case 'foaf':
--				$feed_classname = "foaf";
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = "$nickname's FOAF file";
--				$feed['textContent'] = "FOAF";
--				break;
-+            case 'foaf':
-+                $feed_classname = "foaf";
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = "$nickname's FOAF file";
-+                $feed['textContent'] = "FOAF";
-+                break;
-hunk ./lib/personal.php 160
--			case 'favoritesrss':
--				$feed_classname = "favorites";
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = "Feed for favorites of $nickname";
--				$feed['textContent'] = "RSS";
--				break;
-+            case 'favoritesrss':
-+                $feed_classname = "favorites";
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = "Feed for favorites of $nickname";
-+                $feed['textContent'] = "RSS";
-+                break;
-hunk ./lib/personal.php 167
--			case 'usertimeline':
--				$feed_classname = "atom";
--				$feed_mimetype = "application/".$feed['type']."+xml";
--				$feed_title = "$nickname's ".$feed['version']." notice feed";
--				$feed['textContent'] = "Atom";
--				break;
--		}
--		common_element_start('li');
--		common_element('a', array('href' => $feed['href'],
--								  'class' => $feed_classname,
--								  'type' => $feed_mimetype,
--								  'title' => $feed_title),
--							$feed['textContent']);
--		common_element_end('li');
--	}
-+            case 'usertimeline':
-+                $feed_classname = "atom";
-+                $feed_mimetype = "application/".$feed['type']."+xml";
-+                $feed_title = "$nickname's ".$feed['version']." notice feed";
-+                $feed['textContent'] = "Atom";
-+                break;
-+        }
-+        common_element_start('li');
-+        common_element('a', array('href' => $feed['href'],
-+                                  'class' => $feed_classname,
-+                                  'type' => $feed_mimetype,
-+                                  'title' => $feed_title),
-+                            $feed['textContent']);
-+        common_element_end('li');
-+    }
-hunk ./lib/personal.php 183
--	
--	function source_link($source) {
--		$source_name = _($source);
--		switch ($source) {
--		 case 'web':
--		 case 'xmpp':
--		 case 'mail':
--		 case 'omb':
--		 case 'api':
--			common_element('span', 'noticesource', $source_name);
--			break;
--		 default:
--			$ns = Notice_source::staticGet($source);
--			if ($ns) {
--				common_element('a', array('href' => $ns->url),
--							   $ns->name);
--			} else {
--				common_element('span', 'noticesource', $source_name);
--			}
--			break;
--		}
--		return;
--	}
-+    
-+    function source_link($source) {
-+        $source_name = _($source);
-+        switch ($source) {
-+         case 'web':
-+         case 'xmpp':
-+         case 'mail':
-+         case 'omb':
-+         case 'api':
-+            common_element('span', 'noticesource', $source_name);
-+            break;
-+         default:
-+            $ns = Notice_source::staticGet($source);
-+            if ($ns) {
-+                common_element('a', array('href' => $ns->url),
-+                               $ns->name);
-+            } else {
-+                common_element('span', 'noticesource', $source_name);
-+            }
-+            break;
-+        }
-+        return;
-+    }
+-        $user = NULL;
++        $user = null;
 hunk ./lib/profilelist.php 27
--	var $profile = NULL;
--	var $owner = NULL;
--	var $action = NULL;
-+    var $profile = NULL;
-+    var $owner = NULL;
-+    var $action = NULL;
+-    var $profile = NULL;
+-    var $owner = NULL;
+-    var $action = NULL;
++    var $profile = null;
++    var $owner = null;
++    var $action = null;
 hunk ./lib/profilelist.php 31
--	function __construct($profile, $owner=NULL, $action=NULL) {
--		$this->profile = $profile;
--		$this->owner = $owner;
--		$this->action = $action;
--	}
-+    function __construct($profile, $owner=NULL, $action=NULL) {
-+        $this->profile = $profile;
-+        $this->owner = $owner;
-+        $this->action = $action;
-+    }
-hunk ./lib/profilelist.php 37
--	function show_list() {
-+    function show_list() {
-hunk ./lib/profilelist.php 39
--		common_element_start('ul', array('id' => 'profiles', 'class' => 'profile_list'));
-+        common_element_start('ul', array('id' => 'profiles', 'class' => 'profile_list'));
-hunk ./lib/profilelist.php 41
--		$cnt = 0;
-+        $cnt = 0;
-hunk ./lib/profilelist.php 43
--		while ($this->profile->fetch()) {
--			$cnt++;
--			if($cnt > PROFILES_PER_PAGE) {
--				break;
--			}
--			$this->show();
--		}
-+        while ($this->profile->fetch()) {
-+            $cnt++;
-+            if($cnt > PROFILES_PER_PAGE) {
-+                break;
-+            }
-+            $this->show();
-+        }
-hunk ./lib/profilelist.php 51
--		common_element_end('ul');
-+        common_element_end('ul');
-hunk ./lib/profilelist.php 53
--		return $cnt;
--	}
-+        return $cnt;
-+    }
-hunk ./lib/profilelist.php 56
--	function show() {
-+    function show() {
-hunk ./lib/profilelist.php 58
--		common_element_start('li', array('class' => 'profile_single',
--										 'id' => 'profile-' . $this->profile->id));
-+        common_element_start('li', array('class' => 'profile_single',
-+                                         'id' => 'profile-' . $this->profile->id));
-hunk ./lib/profilelist.php 61
--		$user = common_current_user();
-+        $user = common_current_user();
-hunk ./lib/profilelist.php 63
--		if ($user && $user->id != $this->profile->id) {
--			# XXX: special-case for user looking at own
--			# subscriptions page
--			if ($user->isSubscribed($this->profile)) {
--				common_unsubscribe_form($this->profile);
--			} else {
--				common_subscribe_form($this->profile);
--			}
--		}
-+        if ($user && $user->id != $this->profile->id) {
-+            # XXX: special-case for user looking at own
-+            # subscriptions page
-+            if ($user->isSubscribed($this->profile)) {
-+                common_unsubscribe_form($this->profile);
-+            } else {
-+                common_subscribe_form($this->profile);
-+            }
-+        }
-hunk ./lib/profilelist.php 73
--		$avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
--		common_element_start('a', array('href' => $this->profile->profileurl));
--		common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
--									'class' => 'avatar stream',
--									'width' => AVATAR_STREAM_SIZE,
--									'height' => AVATAR_STREAM_SIZE,
--									'alt' =>
--									($this->profile->fullname) ? $this->profile->fullname :
--									$this->profile->nickname));
--		common_element_end('a');
--		common_element_start('p');
--		common_element_start('a', array('href' => $this->profile->profileurl,
--										'class' => 'nickname'));
--		common_raw($this->highlight($this->profile->nickname));
--		common_element_end('a');
--		if ($this->profile->fullname) {
--			common_text(' | ');
--			common_element_start('span', 'fullname');
--			common_raw($this->highlight($this->profile->fullname));
--			common_element_end('span');
--		}
--		if ($this->profile->location) {
--			common_text(' | ');
--			common_element_start('span', 'location');
--			common_raw($this->highlight($this->profile->location));
--			common_element_end('span');
--		}
--		common_element_end('p');
--		if ($this->profile->homepage) {
--			common_element_start('p', 'website');
--			common_element_start('a', array('href' => $this->profile->homepage));
--			common_raw($this->highlight($this->profile->homepage));
--			common_element_end('a');
--			common_element_end('p');
--		}
--		if ($this->profile->bio) {
--			common_element_start('p', 'bio');
--			common_raw($this->highlight($this->profile->bio));
--			common_element_end('p');
--		}
-+        $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
-+        common_element_start('a', array('href' => $this->profile->profileurl));
-+        common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
-+                                    'class' => 'avatar stream',
-+                                    'width' => AVATAR_STREAM_SIZE,
-+                                    'height' => AVATAR_STREAM_SIZE,
-+                                    'alt' =>
-+                                    ($this->profile->fullname) ? $this->profile->fullname :
-+                                    $this->profile->nickname));
-+        common_element_end('a');
-+        common_element_start('p');
-+        common_element_start('a', array('href' => $this->profile->profileurl,
-+                                        'class' => 'nickname'));
-+        common_raw($this->highlight($this->profile->nickname));
-+        common_element_end('a');
-+        if ($this->profile->fullname) {
-+            common_text(' | ');
-+            common_element_start('span', 'fullname');
-+            common_raw($this->highlight($this->profile->fullname));
-+            common_element_end('span');
-+        }
-+        if ($this->profile->location) {
-+            common_text(' | ');
-+            common_element_start('span', 'location');
-+            common_raw($this->highlight($this->profile->location));
-+            common_element_end('span');
-+        }
-+        common_element_end('p');
-+        if ($this->profile->homepage) {
-+            common_element_start('p', 'website');
-+            common_element_start('a', array('href' => $this->profile->homepage));
-+            common_raw($this->highlight($this->profile->homepage));
-+            common_element_end('a');
-+            common_element_end('p');
-+        }
-+        if ($this->profile->bio) {
-+            common_element_start('p', 'bio');
-+            common_raw($this->highlight($this->profile->bio));
-+            common_element_end('p');
-+        }
-hunk ./lib/profilelist.php 114
--		# If we're on a list with an owner (subscriptions or subscribers)...
-+        # If we're on a list with an owner (subscriptions or subscribers)...
-hunk ./lib/profilelist.php 116
--		if ($this->owner) {
--			# Get tags
--			$tags = Profile_tag::getTags($this->owner->id, $this->profile->id);
-+        if ($this->owner) {
-+            # Get tags
-+            $tags = Profile_tag::getTags($this->owner->id, $this->profile->id);
-hunk ./lib/profilelist.php 120
--			common_element_start('div', 'tags_user');
--			common_element_start('dl');
--			common_element_start('dt');
--			if ($user->id == $this->owner->id) {
--				common_element('a', array('href' => common_local_url('tagother',
--																	 array('id' => $this->profile->id))),
--							   _('Tags'));
--			} else {
--				common_text(_('Tags'));
--			}
--			common_text(":");
--			common_element_end('dt');
--			common_element_start('dd');
--			if ($tags) {
--				common_element_start('ul', 'tags xoxo');
--				foreach ($tags as $tag) {
--					common_element_start('li');
--					common_element('a', array('rel' => 'tag',
--											  'href' => common_local_url($this->action,
--																		 array('nickname' => $this->owner->nickname,
--																			   'tag' => $tag))),
--								   $tag);
--					common_element_end('li');
--				}
--				common_element_end('ul');
--			} else {
--				common_text(_('(none)'));
--			}
--			common_element_end('dd');
--			common_element_end('dl');
--			common_element_end('div');
--		}
-+            common_element_start('div', 'tags_user');
-+            common_element_start('dl');
-+            common_element_start('dt');
-+            if ($user->id == $this->owner->id) {
-+                common_element('a', array('href' => common_local_url('tagother',
-+                                                                     array('id' => $this->profile->id))),
-+                               _('Tags'));
-+            } else {
-+                common_text(_('Tags'));
-+            }
-+            common_text(":");
-+            common_element_end('dt');
-+            common_element_start('dd');
-+            if ($tags) {
-+                common_element_start('ul', 'tags xoxo');
-+                foreach ($tags as $tag) {
-+                    common_element_start('li');
-+                    common_element('a', array('rel' => 'tag',
-+                                              'href' => common_local_url($this->action,
-+                                                                         array('nickname' => $this->owner->nickname,
-+                                                                               'tag' => $tag))),
-+                                   $tag);
-+                    common_element_end('li');
-+                }
-+                common_element_end('ul');
-+            } else {
-+                common_text(_('(none)'));
-+            }
-+            common_element_end('dd');
-+            common_element_end('dl');
-+            common_element_end('div');
-+        }
-hunk ./lib/profilelist.php 157
--		common_element_end('li');
--	}
-+        common_element_end('li');
-+    }
-hunk ./lib/profilelist.php 166
--	function highlight($text) {
--		return htmlspecialchars($text);
--	}
-+    function highlight($text) {
-+        return htmlspecialchars($text);
-+    }
-hunk ./lib/queuehandler.php 30
--	var $_id = 'generic';
-+    var $_id = 'generic';
+-    function __construct($profile, $owner=NULL, $action=NULL) {
++    function __construct($profile, $owner=null, $action=null) {
 hunk ./lib/queuehandler.php 32
--	function QueueHandler($id=NULL) {
--		if ($id) {
--			$this->set_id($id);
--		}
--	}
--	
--	function class_name() {
--		return ucfirst($this->transport()) . 'Handler';
--	}
-+    function QueueHandler($id=NULL) {
-+        if ($id) {
-+            $this->set_id($id);
-+        }
-+    }
-+    
-+    function class_name() {
-+        return ucfirst($this->transport()) . 'Handler';
-+    }
-hunk ./lib/queuehandler.php 42
--	function name() {
--		return strtolower($this->class_name().'.'.$this->get_id());
--	}
--	
--	function get_id() {
--		return $this->_id;
--	}
-+    function name() {
-+        return strtolower($this->class_name().'.'.$this->get_id());
-+    }
-+    
-+    function get_id() {
-+        return $this->_id;
-+    }
-hunk ./lib/queuehandler.php 50
--	function set_id($id) {
--		$this->_id = $id;
--	}
--	
--	function transport() {
--		return NULL;
--	}
--	
--	function start() {
--	}
--	
--	function finish() {
--	}
-+    function set_id($id) {
-+        $this->_id = $id;
-+    }
-+    
-+    function transport() {
-+        return NULL;
-+    }
-+    
-+    function start() {
-+    }
-+    
-+    function finish() {
-+    }
-hunk ./lib/queuehandler.php 64
--	function handle_notice($notice) {
--		return true;
--	}
--	
--	function run() {
--		if (!$this->start()) {
--			return false;
--		}
--		$this->log(LOG_INFO, 'checking for queued notices');
--		$transport = $this->transport();
--		do {
--			$qi = Queue_item::top($transport);
--			if ($qi) {
--				$this->log(LOG_INFO, 'Got item enqueued '.common_exact_date($qi->created));
--				$notice = Notice::staticGet($qi->notice_id);
--				if ($notice) {
--					$this->log(LOG_INFO, 'broadcasting notice ID = ' . $notice->id);
--					# XXX: what to do if broadcast fails?
--					$result = $this->handle_notice($notice);
--					if (!$result) {
--						$this->log(LOG_WARNING, 'Failed broadcast for notice ID = ' . $notice->id);
--						$orig = $qi;
--						$qi->claimed = NULL;
--						$qi->update($orig);
--						$this->log(LOG_WARNING, 'Abandoned claim for notice ID = ' . $notice->id);
--						continue;
--					}
--					$this->log(LOG_INFO, 'finished broadcasting notice ID = ' . $notice->id);
--					$notice->free();
--					unset($notice);
--					$notice = NULL;
--				} else {
--					$this->log(LOG_WARNING, 'queue item for notice that does not exist');
--				}
--				$qi->delete();
--				$qi->free();
--				unset($qi);
--				$this->idle(0);
--			} else {
--				$this->clear_old_claims();
--				$this->idle(5);
--			}	
--		} while (true);
--		if (!$this->finish()) {
--			return false;
--		}
--		return true;
--	}
-+    function handle_notice($notice) {
-+        return true;
-+    }
-+    
-+    function run() {
-+        if (!$this->start()) {
-+            return false;
-+        }
-+        $this->log(LOG_INFO, 'checking for queued notices');
-+        $transport = $this->transport();
-+        do {
-+            $qi = Queue_item::top($transport);
-+            if ($qi) {
-+                $this->log(LOG_INFO, 'Got item enqueued '.common_exact_date($qi->created));
-+                $notice = Notice::staticGet($qi->notice_id);
-+                if ($notice) {
-+                    $this->log(LOG_INFO, 'broadcasting notice ID = ' . $notice->id);
-+                    # XXX: what to do if broadcast fails?
-+                    $result = $this->handle_notice($notice);
-+                    if (!$result) {
-+                        $this->log(LOG_WARNING, 'Failed broadcast for notice ID = ' . $notice->id);
-+                        $orig = $qi;
-+                        $qi->claimed = NULL;
-+                        $qi->update($orig);
-+                        $this->log(LOG_WARNING, 'Abandoned claim for notice ID = ' . $notice->id);
-+                        continue;
-+                    }
-+                    $this->log(LOG_INFO, 'finished broadcasting notice ID = ' . $notice->id);
-+                    $notice->free();
-+                    unset($notice);
-+                    $notice = NULL;
-+                } else {
-+                    $this->log(LOG_WARNING, 'queue item for notice that does not exist');
-+                }
-+                $qi->delete();
-+                $qi->free();
-+                unset($qi);
-+                $this->idle(0);
-+            } else {
-+                $this->clear_old_claims();
-+                $this->idle(5);
-+            }    
-+        } while (true);
-+        if (!$this->finish()) {
-+            return false;
-+        }
-+        return true;
-+    }
-hunk ./lib/queuehandler.php 113
--	function idle($timeout=0) {
--		if ($timeout>0) {
--			sleep($timeout);
--		}
--	}
--	
--	function clear_old_claims() {
--		$qi = new Queue_item();
--		$qi->transport = $this->transport();
--		$qi->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
--		$qi->update(DB_DATAOBJECT_WHEREADD_ONLY);
--		$qi->free();
--		unset($qi);
--	}
--	
--	function log($level, $msg) {
--		common_log($level, $this->class_name() . ' ('. $this->get_id() .'): '.$msg);
--	}
-+    function idle($timeout=0) {
-+        if ($timeout>0) {
-+            sleep($timeout);
-+        }
-+    }
-+    
-+    function clear_old_claims() {
-+        $qi = new Queue_item();
-+        $qi->transport = $this->transport();
-+        $qi->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
-+        $qi->update(DB_DATAOBJECT_WHEREADD_ONLY);
-+        $qi->free();
-+        unset($qi);
-+    }
-+    
-+    function log($level, $msg) {
-+        common_log($level, $this->class_name() . ' ('. $this->get_id() .'): '.$msg);
-+    }
-hunk ./lib/queuehandler.php 132
--	
-+    
-hunk ./lib/rssaction.php 26
--	# This will contain the details of each feed item's author and be used to generate SIOC data.
--	var $creators = array();
-+    # This will contain the details of each feed item's author and be used to generate SIOC data.
-+    var $creators = array();
-hunk ./lib/rssaction.php 29
--	function is_readonly() {
--		return true;
--	}
-+    function is_readonly() {
-+        return true;
-+    }
-hunk ./lib/rssaction.php 33
--	function handle($args) {
--		parent::handle($args);
--		$limit = (int) $this->trimmed('limit');
--		if ($limit == 0) {
--			$limit = DEFAULT_RSS_LIMIT;
--		}
--		$this->show_rss($limit);
--	}
-+    function handle($args) {
-+        parent::handle($args);
-+        $limit = (int) $this->trimmed('limit');
-+        if ($limit == 0) {
-+            $limit = DEFAULT_RSS_LIMIT;
-+        }
-+        $this->show_rss($limit);
-+    }
-hunk ./lib/rssaction.php 42
--	function init() {
--		return true;
--	}
-+    function init() {
-+        return true;
-+    }
-hunk ./lib/rssaction.php 46
--	function get_notices() {
--		return array();
--	}
-+    function get_notices() {
-+        return array();
-+    }
-hunk ./lib/rssaction.php 50
--	function get_channel() {
--		return array('url' => '',
--					 'title' => '',
--					 'link' => '',
--					 'description' => '');
--	}
-+    function get_channel() {
-+        return array('url' => '',
-+                     'title' => '',
-+                     'link' => '',
-+                     'description' => '');
-+    }
-hunk ./lib/rssaction.php 57
--	function get_image() {
--		return NULL;
--	}
-+    function get_image() {
-+        return NULL;
-+    }
-hunk ./lib/rssaction.php 61
--	function show_rss($limit=0) {
-+    function show_rss($limit=0) {
-hunk ./lib/rssaction.php 63
--		if (!$this->init()) {
--			return;
--		}
-+        if (!$this->init()) {
-+            return;
-+        }
-hunk ./lib/rssaction.php 67
--		$notices = $this->get_notices($limit);
-+        $notices = $this->get_notices($limit);
-hunk ./lib/rssaction.php 69
--		$this->init_rss();
--		$this->show_channel($notices);
--		$this->show_image();
-+        $this->init_rss();
-+        $this->show_channel($notices);
-+        $this->show_image();
-hunk ./lib/rssaction.php 73
--		foreach ($notices as $n) {
--			$this->show_item($n);
--		}
-+        foreach ($notices as $n) {
-+            $this->show_item($n);
-+        }
-hunk ./lib/rssaction.php 77
--		$this->show_creators();
--		$this->end_rss();
--	}
-+        $this->show_creators();
-+        $this->end_rss();
-+    }
-hunk ./lib/rssaction.php 81
--	function show_channel($notices) {
-+    function show_channel($notices) {
-hunk ./lib/rssaction.php 83
--		$channel = $this->get_channel();
--		$image = $this->get_image();
-+        $channel = $this->get_channel();
-+        $image = $this->get_image();
-hunk ./lib/rssaction.php 86
--		common_element_start('channel', array('rdf:about' => $channel['url']));
--		common_element('title', NULL, $channel['title']);
--		common_element('link', NULL, $channel['link']);
--		common_element('description', NULL, $channel['description']);
--		common_element('cc:licence', array('rdf:resource' => common_config('license','url')));
-+        common_element_start('channel', array('rdf:about' => $channel['url']));
-+        common_element('title', NULL, $channel['title']);
-+        common_element('link', NULL, $channel['link']);
-+        common_element('description', NULL, $channel['description']);
-+        common_element('cc:licence', array('rdf:resource' => common_config('license','url')));
-hunk ./lib/rssaction.php 92
--		if ($image) {
--			common_element('image', array('rdf:resource' => $image));
--		}
-+        if ($image) {
-+            common_element('image', array('rdf:resource' => $image));
-+        }
-hunk ./lib/rssaction.php 96
--		common_element_start('items');
--		common_element_start('rdf:Seq');
-+        common_element_start('items');
-+        common_element_start('rdf:Seq');
-hunk ./lib/rssaction.php 99
--		foreach ($notices as $notice) {
--			common_element('sioct:MicroblogPost', array('rdf:resource' => $notice->uri));
--		}
-+        foreach ($notices as $notice) {
-+            common_element('sioct:MicroblogPost', array('rdf:resource' => $notice->uri));
-+        }
-hunk ./lib/rssaction.php 103
--		common_element_end('rdf:Seq');
--		common_element_end('items');
-+        common_element_end('rdf:Seq');
-+        common_element_end('items');
-hunk ./lib/rssaction.php 106
--		common_element_end('channel');
--	}
-+        common_element_end('channel');
-+    }
-hunk ./lib/rssaction.php 109
--	function show_image() {
--		$image = $this->get_image();
--		if ($image) {
--			$channel = $this->get_channel();
--			common_element_start('image', array('rdf:about' => $image));
--			common_element('title', NULL, $channel['title']);
--			common_element('link', NULL, $channel['link']);
--			common_element('url', NULL, $image);
--			common_element_end('image');
--		}
--	}
-+    function show_image() {
-+        $image = $this->get_image();
-+        if ($image) {
-+            $channel = $this->get_channel();
-+            common_element_start('image', array('rdf:about' => $image));
-+            common_element('title', NULL, $channel['title']);
-+            common_element('link', NULL, $channel['link']);
-+            common_element('url', NULL, $image);
-+            common_element_end('image');
-+        }
-+    }
-hunk ./lib/rssaction.php 121
--	function show_item($notice) {
--		$profile = Profile::staticGet($notice->profile_id);
--		$nurl = common_local_url('shownotice', array('notice' => $notice->id));
--		$creator_uri = common_profile_uri($profile);
--		common_element_start('item', array('rdf:about' => $notice->uri));
--		$title = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
--		common_element('title', NULL, $title);
--		common_element('link', NULL, $nurl);
--		common_element('description', NULL, $profile->nickname."'s status on ".common_exact_date($notice->created));
--		common_element('dc:date', NULL, common_date_w3dtf($notice->created));
--		common_element('dc:creator', NULL, ($profile->fullname) ? $profile->fullname : $profile->nickname);
--		common_element('sioc:has_creator', array('rdf:resource' => $creator_uri));
--		common_element('laconica:postIcon', array('rdf:resource' => common_profile_avatar_url($profile)));
--		common_element('cc:licence', array('rdf:resource' => common_config('license', 'url')));
--		common_element_end('item');
--		$this->creators[$creator_uri] = $profile;
--	}
-+    function show_item($notice) {
-+        $profile = Profile::staticGet($notice->profile_id);
-+        $nurl = common_local_url('shownotice', array('notice' => $notice->id));
-+        $creator_uri = common_profile_uri($profile);
-+        common_element_start('item', array('rdf:about' => $notice->uri));
-+        $title = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
-+        common_element('title', NULL, $title);
-+        common_element('link', NULL, $nurl);
-+        common_element('description', NULL, $profile->nickname."'s status on ".common_exact_date($notice->created));
-+        common_element('dc:date', NULL, common_date_w3dtf($notice->created));
-+        common_element('dc:creator', NULL, ($profile->fullname) ? $profile->fullname : $profile->nickname);
-+        common_element('sioc:has_creator', array('rdf:resource' => $creator_uri));
-+        common_element('laconica:postIcon', array('rdf:resource' => common_profile_avatar_url($profile)));
-+        common_element('cc:licence', array('rdf:resource' => common_config('license', 'url')));
-+        common_element_end('item');
-+        $this->creators[$creator_uri] = $profile;
-+    }
-hunk ./lib/rssaction.php 139
--	function show_creators() {
--		foreach ($this->creators as $uri => $profile) {
--			$id = $profile->id;
--			$nickname = $profile->nickname;
--			common_element_start('sioc:User', array('rdf:about' => $uri));
--			common_element('foaf:nick', NULL, $nickname);
--			if ($profile->fullname) {
--				common_element('foaf:name', NULL, $profile->fullname);
--			}
--			common_element('sioc:id', NULL, $id);
--			$avatar = common_profile_avatar_url($profile);
--			common_element('sioc:avatar', array('rdf:resource' => $avatar));
--			common_element_end('sioc:User');
--		}
--	}
-+    function show_creators() {
-+        foreach ($this->creators as $uri => $profile) {
-+            $id = $profile->id;
-+            $nickname = $profile->nickname;
-+            common_element_start('sioc:User', array('rdf:about' => $uri));
-+            common_element('foaf:nick', NULL, $nickname);
-+            if ($profile->fullname) {
-+                common_element('foaf:name', NULL, $profile->fullname);
-+            }
-+            common_element('sioc:id', NULL, $id);
-+            $avatar = common_profile_avatar_url($profile);
-+            common_element('sioc:avatar', array('rdf:resource' => $avatar));
-+            common_element_end('sioc:User');
-+        }
-+    }
-hunk ./lib/rssaction.php 155
--	function init_rss() {
--		$channel = $this->get_channel();
--		header('Content-Type: application/rdf+xml');
-+    function init_rss() {
-+        $channel = $this->get_channel();
-+        header('Content-Type: application/rdf+xml');
-hunk ./lib/rssaction.php 159
--		common_start_xml();
--		common_element_start('rdf:RDF', array('xmlns:rdf' =>
--											  'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
--											  'xmlns:dc' =>
--											  'http://purl.org/dc/elements/1.1/',
--											  'xmlns:cc' =>
--											  'http://web.resource.org/cc/',
-+        common_start_xml();
-+        common_element_start('rdf:RDF', array('xmlns:rdf' =>
-+                                              'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
-+                                              'xmlns:dc' =>
-+                                              'http://purl.org/dc/elements/1.1/',
-+                                              'xmlns:cc' =>
-+                                              'http://web.resource.org/cc/',
-hunk ./lib/rssaction.php 168
--											  'xmlns:foaf' =>
--											  'http://xmlns.com/foaf/0.1/',
--											  'xmlns:sioc' =>
--											  'http://rdfs.org/sioc/ns#',
--		                                      'xmlns:sioct' =>
--		                                      'http://rdfs.org/sioc/types#',
--		                                      'xmlns:laconica' =>
--		                                      'http://laconi.ca/ont/',
--											  'xmlns' => 'http://purl.org/rss/1.0/'));
--		common_element_start('sioc:Site', array('rdf:about' => common_root_url()));
--		common_element('sioc:name', NULL, common_config('site', 'name'));
--		common_element_start('sioc:container_of');
--		common_element('sioc:Container', array('rdf:about' =>
--		                                       $channel['url']));
--		common_element_end('sioc:container_of');
--		common_element_end('sioc:Site');
--	}
-+                                              'xmlns:foaf' =>
-+                                              'http://xmlns.com/foaf/0.1/',
-+                                              'xmlns:sioc' =>
-+                                              'http://rdfs.org/sioc/ns#',
-+                                              'xmlns:sioct' =>
-+                                              'http://rdfs.org/sioc/types#',
-+                                              'xmlns:laconica' =>
-+                                              'http://laconi.ca/ont/',
-+                                              'xmlns' => 'http://purl.org/rss/1.0/'));
-+        common_element_start('sioc:Site', array('rdf:about' => common_root_url()));
-+        common_element('sioc:name', NULL, common_config('site', 'name'));
-+        common_element_start('sioc:container_of');
-+        common_element('sioc:Container', array('rdf:about' =>
-+                                               $channel['url']));
-+        common_element_end('sioc:container_of');
-+        common_element_end('sioc:Site');
-+    }
-hunk ./lib/rssaction.php 186
--	function end_rss() {
--		common_element_end('rdf:RDF');
--	}
-+    function end_rss() {
-+        common_element_end('rdf:RDF');
-+    }
-hunk ./lib/search_engines.php 101
--						   'against (\''.addslashes($q).'\')');
-+                           'against (\''.addslashes($q).'\')');
-hunk ./lib/search_engines.php 104
--						   'against (\''.addslashes($q).'\')');
-+                           'against (\''.addslashes($q).'\')');
-hunk ./lib/searchaction.php 24
--	function is_readonly() {
--		return true;
--	}
-+    function is_readonly() {
-+        return true;
-+    }
-hunk ./lib/searchaction.php 28
--	function handle($args) {
--		parent::handle($args);
--		$this->show_form();
--	}
-+    function handle($args) {
-+        parent::handle($args);
-+        $this->show_form();
-+    }
+-    function QueueHandler($id=NULL) {
++    function QueueHandler($id=null) {
+hunk ./lib/queuehandler.php 55
+-        return NULL;
++        return null;
+hunk ./lib/queuehandler.php 86
+-                        $qi->claimed = NULL;
++                        $qi->claimed = null;
+hunk ./lib/queuehandler.php 94
+-                    $notice = NULL;
++                    $notice = null;
+hunk ./lib/rssaction.php 58
+-        return NULL;
++        return null;
+hunk ./lib/rssaction.php 87
+-        common_element('title', NULL, $channel['title']);
+-        common_element('link', NULL, $channel['link']);
+-        common_element('description', NULL, $channel['description']);
++        common_element('title', null, $channel['title']);
++        common_element('link', null, $channel['link']);
++        common_element('description', null, $channel['description']);
+hunk ./lib/rssaction.php 114
+-            common_element('title', NULL, $channel['title']);
+-            common_element('link', NULL, $channel['link']);
+-            common_element('url', NULL, $image);
++            common_element('title', null, $channel['title']);
++            common_element('link', null, $channel['link']);
++            common_element('url', null, $image);
+hunk ./lib/rssaction.php 127
+-        common_element('title', NULL, $title);
+-        common_element('link', NULL, $nurl);
+-        common_element('description', NULL, $profile->nickname."'s status on ".common_exact_date($notice->created));
+-        common_element('dc:date', NULL, common_date_w3dtf($notice->created));
+-        common_element('dc:creator', NULL, ($profile->fullname) ? $profile->fullname : $profile->nickname);
++        common_element('title', null, $title);
++        common_element('link', null, $nurl);
++        common_element('description', null, $profile->nickname."'s status on ".common_exact_date($notice->created));
++        common_element('dc:date', null, common_date_w3dtf($notice->created));
++        common_element('dc:creator', null, ($profile->fullname) ? $profile->fullname : $profile->nickname);
+hunk ./lib/rssaction.php 144
+-            common_element('foaf:nick', NULL, $nickname);
++            common_element('foaf:nick', null, $nickname);
+hunk ./lib/rssaction.php 146
+-                common_element('foaf:name', NULL, $profile->fullname);
++                common_element('foaf:name', null, $profile->fullname);
+hunk ./lib/rssaction.php 148
+-            common_element('sioc:id', NULL, $id);
++            common_element('sioc:id', null, $id);
+hunk ./lib/rssaction.php 178
+-        common_element('sioc:name', NULL, common_config('site', 'name'));
++        common_element('sioc:name', null, common_config('site', 'name'));
 hunk ./lib/searchaction.php 33
--	function show_top($arr=NULL) {
--		if ($arr) {
--			$error = $arr[1];
--		}
--		if ($error) {
--			common_element('p', 'error', $error);
--		} else {
--			$instr = $this->get_instructions();
--			$output = common_markup_to_html($instr);
--			common_element_start('div', 'instructions');
--			common_raw($output);
--			common_element_end('div');
--		}
--		$this->search_menu();
--	}
-+    function show_top($arr=NULL) {
-+        if ($arr) {
-+            $error = $arr[1];
-+        }
-+        if ($error) {
-+            common_element('p', 'error', $error);
-+        } else {
-+            $instr = $this->get_instructions();
-+            $output = common_markup_to_html($instr);
-+            common_element_start('div', 'instructions');
-+            common_raw($output);
-+            common_element_end('div');
-+        }
-+        $this->search_menu();
-+    }
-hunk ./lib/searchaction.php 49
--	function get_title() {
--		return NULL;
--	}
-+    function get_title() {
-+        return NULL;
-+    }
-hunk ./lib/searchaction.php 53
--	function show_header($arr) {
--		return;
--	}
-+    function show_header($arr) {
-+        return;
-+    }
+-    function show_top($arr=NULL) {
++    function show_top($arr=null) {
+hunk ./lib/searchaction.php 50
+-        return NULL;
++        return null;
 hunk ./lib/searchaction.php 57
--	function show_form($error=NULL) {
--		global $config;
-+    function show_form($error=NULL) {
-+        global $config;
-hunk ./lib/searchaction.php 60
--		$q = $this->trimmed('q');
--		$page = $this->trimmed('page', 1);
-+        $q = $this->trimmed('q');
-+        $page = $this->trimmed('page', 1);
-hunk ./lib/searchaction.php 63
--		common_show_header($this->get_title(), array($this, 'show_header'), array($q, $error),
--						   array($this, 'show_top'));
--		common_element_start('form', array('method' => 'get',
--										   'id' => 'login',
--										   'action' => common_local_url($this->trimmed('action'))));
--		common_element_start('p');
--		if (!isset($config['site']['fancy']) || !$config['site']['fancy']) {
--			common_element('input', array('name' => 'action',
--										  'type' => 'hidden',
--										  'value' => $this->trimmed('action')));
--		}
--		common_element('input', array('name' => 'q',
--									  'id' => 'q',
--									  'type' => 'text',
--									  'class' => 'input_text',
--									  'value' => ($q) ? $q : ''));
--		common_text(' ');
--		common_element('input', array('type' => 'submit',
--									  'id' => 'search',
--									  'name' => 'search',
--									  'class' => 'submit',
--									  'value' => _('Search')));
-+        common_show_header($this->get_title(), array($this, 'show_header'), array($q, $error),
-+                           array($this, 'show_top'));
-+        common_element_start('form', array('method' => 'get',
-+                                           'id' => 'login',
-+                                           'action' => common_local_url($this->trimmed('action'))));
-+        common_element_start('p');
-+        if (!isset($config['site']['fancy']) || !$config['site']['fancy']) {
-+            common_element('input', array('name' => 'action',
-+                                          'type' => 'hidden',
-+                                          'value' => $this->trimmed('action')));
-+        }
-+        common_element('input', array('name' => 'q',
-+                                      'id' => 'q',
-+                                      'type' => 'text',
-+                                      'class' => 'input_text',
-+                                      'value' => ($q) ? $q : ''));
-+        common_text(' ');
-+        common_element('input', array('type' => 'submit',
-+                                      'id' => 'search',
-+                                      'name' => 'search',
-+                                      'class' => 'submit',
-+                                      'value' => _('Search')));
-hunk ./lib/searchaction.php 86
--		common_element_end('p');
--		common_element_end('form');
--		if ($q) {
--			$this->show_results($q, $page);
--		}
--		common_show_footer();
--	}
-+        common_element_end('p');
-+        common_element_end('form');
-+        if ($q) {
-+            $this->show_results($q, $page);
-+        }
-+        common_show_footer();
-+    }
-hunk ./lib/searchaction.php 94
--	function search_menu() {
--		# action => array('prompt', 'title', $args)
--		$action = $this->trimmed('action');
--		$menu =
--		  array('peoplesearch' =>
--				array(
--					  _('People'),
--					  _('Find people on this site'),
--					  ($action != 'peoplesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL),
--				'noticesearch' =>
--				array( _('Text'),
--					   _('Find content of notices'),
--					   ($action != 'noticesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL)
--				);
--		$this->nav_menu($menu);
--	}
-+    function search_menu() {
-+        # action => array('prompt', 'title', $args)
-+        $action = $this->trimmed('action');
-+        $menu =
-+          array('peoplesearch' =>
-+                array(
-+                      _('People'),
-+                      _('Find people on this site'),
-+                      ($action != 'peoplesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL),
-+                'noticesearch' =>
-+                array( _('Text'),
-+                       _('Find content of notices'),
-+                       ($action != 'noticesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL)
-+                );
-+        $this->nav_menu($menu);
-+    }
-hunk ./lib/settingsaction.php 30
--        	# Cookie theft means that automatic logins can't
--        	# change important settings or see private info, and
--        	# _all_ our settings are important
-+            # Cookie theft means that automatic logins can't
-+            # change important settings or see private info, and
-+            # _all_ our settings are important
+-    function show_form($error=NULL) {
++    function show_form($error=null) {
+hunk ./lib/searchaction.php 102
+-                      ($action != 'peoplesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL),
++                      ($action != 'peoplesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : null),
+hunk ./lib/searchaction.php 106
+-                       ($action != 'noticesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL)
++                       ($action != 'noticesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : null)
+hunk ./lib/settingsaction.php 47
+-    function show_form($msg=NULL, $success=false) {
++    function show_form($msg=null, $success=false) {
 hunk ./lib/settingsaction.php 58
--	function form_header($title, $msg=NULL, $success=false) {
--		common_show_header($title,
--		                   NULL,
--		                   array($msg, $success),
--						   array($this, 'show_top'));
--	}
-+    function form_header($title, $msg=NULL, $success=false) {
-+        common_show_header($title,
-+                           NULL,
-+                           array($msg, $success),
-+                           array($this, 'show_top'));
-+    }
-hunk ./lib/settingsaction.php 65
--	function show_top($arr) {
--		$msg = $arr[0];
--		$success = $arr[1];
--		if ($msg) {
--			$this->message($msg, $success);
--		} else {
--			$inst = $this->get_instructions();
--			$output = common_markup_to_html($inst);
--			common_element_start('div', 'instructions');
--			common_raw($output);
--			common_element_end('div');
--		}
--		$this->settings_menu();
--	}
-+    function show_top($arr) {
-+        $msg = $arr[0];
-+        $success = $arr[1];
-+        if ($msg) {
-+            $this->message($msg, $success);
-+        } else {
-+            $inst = $this->get_instructions();
-+            $output = common_markup_to_html($inst);
-+            common_element_start('div', 'instructions');
-+            common_raw($output);
-+            common_element_end('div');
-+        }
-+        $this->settings_menu();
-+    }
-hunk ./lib/settingsaction.php 82
--		$menu =
--		  array('profilesettings' =>
--				array(_('Profile'),
--					  _('Change your profile settings')),
--				'emailsettings' =>
--				array(_('Email'),
--					  _('Change email handling')),
--				'openidsettings' =>
--				array(_('OpenID'),
--					  _('Add or remove OpenIDs')),
--				'smssettings' =>
--				array(_('SMS'),
--					  _('Updates by SMS')),
--				'imsettings' =>
--				array(_('IM'),
--					  _('Updates by instant messenger (IM)')),
--				'twittersettings' =>
--				array(_('Twitter'),
--					  _('Twitter integration options')),
--				'othersettings' =>
--				array(_('Other'),
--					  _('Other options')));
--		
-+        $menu =
-+          array('profilesettings' =>
-+                array(_('Profile'),
-+                      _('Change your profile settings')),
-+                'emailsettings' =>
-+                array(_('Email'),
-+                      _('Change email handling')),
-+                'openidsettings' =>
-+                array(_('OpenID'),
-+                      _('Add or remove OpenIDs')),
-+                'smssettings' =>
-+                array(_('SMS'),
-+                      _('Updates by SMS')),
-+                'imsettings' =>
-+                array(_('IM'),
-+                      _('Updates by instant messenger (IM)')),
-+                'twittersettings' =>
-+                array(_('Twitter'),
-+                      _('Twitter integration options')),
-+                'othersettings' =>
-+                array(_('Other'),
-+                      _('Other options')));
-+        
-hunk ./lib/settingsaction.php 108
--			if ($menuaction == 'imsettings' &&
--				!common_config('xmpp', 'enabled')) {
--				continue;
--			}
-+            if ($menuaction == 'imsettings' &&
-+                !common_config('xmpp', 'enabled')) {
-+                continue;
-+            }
-hunk ./lib/stream.php 13
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./lib/stream.php 17
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./lib/stream.php 27
--	function public_views_menu() {
-+    function public_views_menu() {
-hunk ./lib/stream.php 29
--		$action = $this->trimmed('action');
-+        $action = $this->trimmed('action');
-hunk ./lib/stream.php 31
--		common_element_start('ul', array('id' => 'nav_views'));
-+        common_element_start('ul', array('id' => 'nav_views'));
-hunk ./lib/stream.php 33
--		common_menu_item(common_local_url('public'), _('Public'),
--			_('Public timeline'), $action == 'public');
-+        common_menu_item(common_local_url('public'), _('Public'),
-+            _('Public timeline'), $action == 'public');
-hunk ./lib/stream.php 36
--		common_menu_item(common_local_url('tag'), _('Recent tags'),
--			_('Recent tags'), $action == 'tag');
-+        common_menu_item(common_local_url('tag'), _('Recent tags'),
-+            _('Recent tags'), $action == 'tag');
-hunk ./lib/stream.php 39
--		if (count(common_config('nickname', 'featured')) > 0) {
--			common_menu_item(common_local_url('featured'), _('Featured'),
--				_('Featured users'), $action == 'featured');
--		}
-+        if (count(common_config('nickname', 'featured')) > 0) {
-+            common_menu_item(common_local_url('featured'), _('Featured'),
-+                _('Featured users'), $action == 'featured');
-+        }
-hunk ./lib/stream.php 44
--		common_menu_item(common_local_url('favorited'), _('Popular'),
--			_("Popular notices"), $action == 'favorited');
-+        common_menu_item(common_local_url('favorited'), _('Popular'),
-+            _("Popular notices"), $action == 'favorited');
-hunk ./lib/stream.php 47
--		common_element_end('ul');
-+        common_element_end('ul');
-hunk ./lib/stream.php 49
--	}
-+    }
-hunk ./lib/subs.php 30
--	$other = User::staticGet('nickname', $other_nickname);
-+    $other = User::staticGet('nickname', $other_nickname);
-hunk ./lib/subs.php 32
--	if (!$other) {
--		return _('No such user.');
--	}
-+    if (!$other) {
-+        return _('No such user.');
-+    }
-hunk ./lib/subs.php 36
--	return subs_subscribe_to($user, $other);
-+    return subs_subscribe_to($user, $other);
-hunk ./lib/subs.php 46
--	if ($user->isSubscribed($other)) {
--		return _('Already subscribed!.');
--	}
-+    if ($user->isSubscribed($other)) {
-+        return _('Already subscribed!.');
-+    }
-hunk ./lib/subs.php 51
--		return _('User has blocked you.');
-+        return _('User has blocked you.');
-hunk ./lib/subs.php 54
--	if (!$user->subscribeTo($other)) {
--		return _('Could not subscribe.');
--		return;
--	}
-+    if (!$user->subscribeTo($other)) {
-+        return _('Could not subscribe.');
-+        return;
-+    }
-hunk ./lib/subs.php 61
--	if (common_config('memcached', 'enabled')) {
--		$cache = new Memcache();
--		if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
--			$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
--		}
--	}
-+    if (common_config('memcached', 'enabled')) {
-+        $cache = new Memcache();
-+        if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
-+            $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
-+        }
-+    }
-hunk ./lib/subs.php 68
--	if ($other->autosubscribe && !$other->isSubscribed($user) && !$user->hasBlocked($other)) {
--		if (!$other->subscribeTo($user)) {
--			return _('Could not subscribe other to you.');
--		}
--		if (common_config('memcached', 'enabled')) {
--			$cache = new Memcache();
--			if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
--				$cache->delete(common_cache_key('user:notices_with_friends:' . $other->id));
--			}
--		}
-+    if ($other->autosubscribe && !$other->isSubscribed($user) && !$user->hasBlocked($other)) {
-+        if (!$other->subscribeTo($user)) {
-+            return _('Could not subscribe other to you.');
-+        }
-+        if (common_config('memcached', 'enabled')) {
-+            $cache = new Memcache();
-+            if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
-+                $cache->delete(common_cache_key('user:notices_with_friends:' . $other->id));
-+            }
-+        }
-hunk ./lib/subs.php 79
--		subs_notify($user, $other);
--	}
-+        subs_notify($user, $other);
-+    }
-hunk ./lib/subs.php 82
--	return true;
-+    return true;
-hunk ./lib/subs.php 86
--	# XXX: add other notifications (Jabber, SMS) here
--	# XXX: queue this and handle it offline
--	# XXX: Whatever happens, do it in Twitter-like API, too
--	subs_notify_email($listenee, $listener);
-+    # XXX: add other notifications (Jabber, SMS) here
-+    # XXX: queue this and handle it offline
-+    # XXX: Whatever happens, do it in Twitter-like API, too
-+    subs_notify_email($listenee, $listener);
-hunk ./lib/subs.php 93
--	mail_subscribe_notify($listenee, $listener);
-+    mail_subscribe_notify($listenee, $listener);
-hunk ./lib/subs.php 102
--	$other = User::staticGet('nickname', $other_nickname);
-+    $other = User::staticGet('nickname', $other_nickname);
-hunk ./lib/subs.php 104
--	if (!$other) {
--		return _('No such user.');
--	}
-+    if (!$other) {
-+        return _('No such user.');
-+    }
-hunk ./lib/subs.php 108
--	return subs_unsubscribe_to($user, $other->getProfile());
-+    return subs_unsubscribe_to($user, $other->getProfile());
-hunk ./lib/subs.php 116
--	if (!$user->isSubscribed($other))
--		return _('Not subscribed!.');
-+    if (!$user->isSubscribed($other))
-+        return _('Not subscribed!.');
-hunk ./lib/subs.php 119
--	$sub = DB_DataObject::factory('subscription');
-+    $sub = DB_DataObject::factory('subscription');
-hunk ./lib/subs.php 121
--	$sub->subscriber = $user->id;
--	$sub->subscribed = $other->id;
-+    $sub->subscriber = $user->id;
-+    $sub->subscribed = $other->id;
-hunk ./lib/subs.php 124
--	$sub->find(true);
-+    $sub->find(true);
-hunk ./lib/subs.php 126
--	// note we checked for existence above
-+    // note we checked for existence above
-hunk ./lib/subs.php 128
--	if (!$sub->delete())
--		return _('Couldn\'t delete subscription.');
-+    if (!$sub->delete())
-+        return _('Couldn\'t delete subscription.');
-hunk ./lib/subs.php 131
--	if (common_config('memcached', 'enabled')) {
--		$cache = new Memcache();
--		if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
--			$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
--		}
--	}
-+    if (common_config('memcached', 'enabled')) {
-+        $cache = new Memcache();
-+        if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
-+            $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
-+        }
-+    }
-hunk ./lib/subs.php 138
--	return true;
-+    return true;
-hunk ./lib/theme.php 23
--	$theme = common_config('site', 'theme');
--	return INSTALLDIR.'/theme/'.$theme.'/'.$relative;
-+    $theme = common_config('site', 'theme');
-+    return INSTALLDIR.'/theme/'.$theme.'/'.$relative;
-hunk ./lib/theme.php 28
--	$theme = common_config('site', 'theme');
--	$server = common_config('theme', 'server');
--	if ($server) {
--		return 'http://'.$server.'/'.$theme.'/'.$relative;
--	} else {
--		return common_path('theme/'.$theme.'/'.$relative);
--	}
-+    $theme = common_config('site', 'theme');
-+    $server = common_config('theme', 'server');
-+    if ($server) {
-+        return 'http://'.$server.'/'.$theme.'/'.$relative;
-+    } else {
-+        return common_path('theme/'.$theme.'/'.$relative);
-+    }
-hunk ./lib/twitter.php 24
--	$options = array(
--			CURLOPT_USERPWD => sprintf("%s:%s", $screen_name, $password),
--			CURLOPT_RETURNTRANSFER	=> true,
--			CURLOPT_FAILONERROR		=> true,
--			CURLOPT_HEADER			=> false,
--			CURLOPT_FOLLOWLOCATION	=> true,
--			// CURLOPT_USERAGENT		=> "identi.ca",
--			CURLOPT_CONNECTTIMEOUT	=> 120,
--			CURLOPT_TIMEOUT			=> 120
--	);
-+    $options = array(
-+            CURLOPT_USERPWD => sprintf("%s:%s", $screen_name, $password),
-+            CURLOPT_RETURNTRANSFER    => true,
-+            CURLOPT_FAILONERROR        => true,
-+            CURLOPT_HEADER            => false,
-+            CURLOPT_FOLLOWLOCATION    => true,
-+            // CURLOPT_USERAGENT        => "identi.ca",
-+            CURLOPT_CONNECTTIMEOUT    => 120,
-+            CURLOPT_TIMEOUT            => 120
-+    );
-hunk ./lib/twitter.php 36
--	$ch = curl_init($uri);
-+    $ch = curl_init($uri);
-hunk ./lib/twitter.php 41
--	if ($errmsg) {
--		common_debug("Twitter bridge - cURL error: $errmsg - trying to load: $uri with user $twit_user.",
--			__FILE__);
--	}
-+    if ($errmsg) {
-+        common_debug("Twitter bridge - cURL error: $errmsg - trying to load: $uri with user $twit_user.",
-+            __FILE__);
-+    }
-hunk ./lib/twitter.php 46
--	curl_close($ch);
-+    curl_close($ch);
-hunk ./lib/twitter.php 48
--	return $data;
-+    return $data;
-hunk ./lib/twitter.php 53
--	$uri = "http://twitter.com/users/show/$screen_name.json";
--	$data = get_twitter_data($uri, $screen_name, $password);
-+    $uri = "http://twitter.com/users/show/$screen_name.json";
-+    $data = get_twitter_data($uri, $screen_name, $password);
-hunk ./lib/twitter.php 56
--	if (!$data) {
--		return false;
--	}
-+    if (!$data) {
-+        return false;
-+    }
-hunk ./lib/twitter.php 60
--	$twit_user = json_decode($data);
-+    $twit_user = json_decode($data);
-hunk ./lib/twitter.php 62
--	if (!$twit_user) {
--		return false;
--	}
-+    if (!$twit_user) {
-+        return false;
-+    }
-hunk ./lib/twitter.php 66
--	return $twit_user;
-+    return $twit_user;
-hunk ./lib/twitter.php 71
--	$original = clone($fuser);
--	$fuser->nickname = $screen_name;
--	$fuser->uri = 'http://twitter.com/' . $screen_name;
--	$result = $fuser->updateKeys($original);
-+    $original = clone($fuser);
-+    $fuser->nickname = $screen_name;
-+    $fuser->uri = 'http://twitter.com/' . $screen_name;
-+    $result = $fuser->updateKeys($original);
-hunk ./lib/twitter.php 76
--	if (!$result) {
--		common_log_db_error($fuser, 'UPDATE', __FILE__);
--		return false;
--	}
-+    if (!$result) {
-+        common_log_db_error($fuser, 'UPDATE', __FILE__);
-+        return false;
-+    }
-hunk ./lib/twitter.php 81
--	return true;
-+    return true;
-hunk ./lib/twitter.php 86
--	// Otherwise, create a new Twitter user
--	$fuser = DB_DataObject::factory('foreign_user');
-+    // Otherwise, create a new Twitter user
-+    $fuser = DB_DataObject::factory('foreign_user');
-hunk ./lib/twitter.php 89
--	$fuser->nickname = $screen_name;
--	$fuser->uri = 'http://twitter.com/' . $screen_name;
--	$fuser->id = $twitter_id;
--	$fuser->service = 1; // Twitter
--	$fuser->created = common_sql_now();
--	$result = $fuser->insert();
-+    $fuser->nickname = $screen_name;
-+    $fuser->uri = 'http://twitter.com/' . $screen_name;
-+    $fuser->id = $twitter_id;
-+    $fuser->service = 1; // Twitter
-+    $fuser->created = common_sql_now();
-+    $result = $fuser->insert();
-hunk ./lib/twitter.php 96
--	if (!$result) {
--		common_debug("Twitter bridge - failed to add new Twitter user: $twitter_id - $screen_name.");
--		common_log_db_error($fuser, 'INSERT', __FILE__);
--		return false;
--	}
-+    if (!$result) {
-+        common_debug("Twitter bridge - failed to add new Twitter user: $twitter_id - $screen_name.");
-+        common_log_db_error($fuser, 'INSERT', __FILE__);
-+        return false;
-+    }
-hunk ./lib/twitter.php 102
--	common_debug("Twitter bridge - Added new Twitter user: $screen_name ($twitter_id).");
-+    common_debug("Twitter bridge - Added new Twitter user: $screen_name ($twitter_id).");
-hunk ./lib/twitter.php 104
--	return true;
-+    return true;
-hunk ./lib/twitter.php 110
--	// Check to see whether the Twitter user is already in the system,
--	// and update its screen name and uri if so.
--	$fuser = Foreign_user::getForeignUser($twitter_id, 1);
-+    // Check to see whether the Twitter user is already in the system,
-+    // and update its screen name and uri if so.
-+    $fuser = Foreign_user::getForeignUser($twitter_id, 1);
-hunk ./lib/twitter.php 114
--	if ($fuser) {
-+    if ($fuser) {
-hunk ./lib/twitter.php 116
--		// Only update if Twitter screen name has changed
--		if ($fuser->nickname != $screen_name) {
-+        // Only update if Twitter screen name has changed
-+        if ($fuser->nickname != $screen_name) {
-hunk ./lib/twitter.php 119
--			common_debug('Twitter bridge - Updated nickname (and URI) for Twitter user ' .
--				"$fuser->id to $screen_name, was $fuser->nickname");
-+            common_debug('Twitter bridge - Updated nickname (and URI) for Twitter user ' .
-+                "$fuser->id to $screen_name, was $fuser->nickname");
-hunk ./lib/twitter.php 122
--			return update_twitter_user($fuser, $twitter_id, $screen_name);
--		}
-+            return update_twitter_user($fuser, $twitter_id, $screen_name);
-+        }
-hunk ./lib/twitter.php 125
--	} else {
--		return add_twitter_user($twitter_id, $screen_name);
--	}
-+    } else {
-+        return add_twitter_user($twitter_id, $screen_name);
-+    }
-hunk ./lib/twitter.php 129
--	return true;
-+    return true;
-hunk ./lib/twitter.php 134
--	$uri = "http://twitter.com/statuses/friends/$twitter_id.json?page=";
--	$twitter_user = twitter_user_info($screen_name, $password);
-+    $uri = "http://twitter.com/statuses/friends/$twitter_id.json?page=";
-+    $twitter_user = twitter_user_info($screen_name, $password);
-hunk ./lib/twitter.php 137
--	// Calculate how many pages to get...
--	$pages = ceil($twitter_user->friends_count / 100);
-+    // Calculate how many pages to get...
-+    $pages = ceil($twitter_user->friends_count / 100);
-hunk ./lib/twitter.php 140
--	if ($pages == 0) {
--		common_debug("Twitter bridge - Twitter user $screen_name has no friends! Lame.");
--	}
-+    if ($pages == 0) {
-+        common_debug("Twitter bridge - Twitter user $screen_name has no friends! Lame.");
-+    }
-hunk ./lib/twitter.php 144
--	$friends = array();
-+    $friends = array();
-hunk ./lib/twitter.php 146
--	for ($i = 1; $i <= $pages; $i++) {
-+    for ($i = 1; $i <= $pages; $i++) {
-hunk ./lib/twitter.php 148
--		$data = get_twitter_data($uri . $i, $screen_name, $password);
-+        $data = get_twitter_data($uri . $i, $screen_name, $password);
-hunk ./lib/twitter.php 150
--		if (!$data) {
--			return NULL;
--		}
-+        if (!$data) {
-+            return NULL;
-+        }
-hunk ./lib/twitter.php 154
--		$more_friends = json_decode($data);
-+        $more_friends = json_decode($data);
-hunk ./lib/twitter.php 156
--		if (!$more_friends) {
--			return NULL;
--		}
-+        if (!$more_friends) {
-+            return NULL;
-+        }
-hunk ./lib/twitter.php 160
-- 		$friends = array_merge($friends, $more_friends);
--	}
-+         $friends = array_merge($friends, $more_friends);
-+    }
-hunk ./lib/twitter.php 163
--	return $friends;
-+    return $friends;
-hunk ./lib/twitter.php 168
--	$friends = retreive_twitter_friends($twitter_id, $screen_name, $password);
-+    $friends = retreive_twitter_friends($twitter_id, $screen_name, $password);
-hunk ./lib/twitter.php 170
--	if (is_null($friends)) {
--		common_debug("Twitter bridge - Couldn't get friends data from Twitter.");
--		return false;
--	}
-+    if (is_null($friends)) {
-+        common_debug("Twitter bridge - Couldn't get friends data from Twitter.");
-+        return false;
-+    }
-hunk ./lib/twitter.php 177
--		$friend_name = $friend->screen_name;
--		$friend_id = $friend->id;
-+        $friend_name = $friend->screen_name;
-+        $friend_id = $friend->id;
-hunk ./lib/twitter.php 180
--		// Update or create the Foreign_user record
--		if (!save_twitter_user($friend_id, $friend_name)) {
--			return false;
--		}
-+        // Update or create the Foreign_user record
-+        if (!save_twitter_user($friend_id, $friend_name)) {
-+            return false;
-+        }
-hunk ./lib/twitter.php 185
--		// Check to see if there's a related local user
--		$flink = Foreign_link::getByForeignID($friend_id, 1);
-+        // Check to see if there's a related local user
-+        $flink = Foreign_link::getByForeignID($friend_id, 1);
-hunk ./lib/twitter.php 188
--		if ($flink) {
-+        if ($flink) {
-hunk ./lib/twitter.php 190
--			// Get associated user and subscribe her
--			$friend_user = User::staticGet('id', $flink->user_id);
--			subs_subscribe_to($user, $friend_user);
--			common_debug("Twitter bridge - subscribed $friend_user->nickname to $user->nickname.");
--		}
--	}
-+            // Get associated user and subscribe her
-+            $friend_user = User::staticGet('id', $flink->user_id);
-+            subs_subscribe_to($user, $friend_user);
-+            common_debug("Twitter bridge - subscribed $friend_user->nickname to $user->nickname.");
-+        }
-+    }
-hunk ./lib/twitter.php 197
--	return true;
-+    return true;
-hunk ./lib/twitterapi.php 24
--	var $auth_user;
-+    var $auth_user;
-hunk ./lib/twitterapi.php 26
--	function handle($args) {
--		parent::handle($args);
--	}
-+    function handle($args) {
-+        parent::handle($args);
-+    }
-hunk ./lib/twitterapi.php 30
--	function twitter_user_array($profile, $get_notice=false) {
-+    function twitter_user_array($profile, $get_notice=false) {
-hunk ./lib/twitterapi.php 32
--		$twitter_user = array();
-+        $twitter_user = array();
-hunk ./lib/twitterapi.php 34
--		$twitter_user['name'] = $profile->getBestName();
--		$twitter_user['followers_count'] = $this->count_subscriptions($profile);
--		$twitter_user['screen_name'] = $profile->nickname;
--		$twitter_user['description'] = ($profile->bio) ? $profile->bio : NULL;
--		$twitter_user['location'] = ($profile->location) ? $profile->location : NULL;
--		$twitter_user['id'] = intval($profile->id);
-+        $twitter_user['name'] = $profile->getBestName();
-+        $twitter_user['followers_count'] = $this->count_subscriptions($profile);
-+        $twitter_user['screen_name'] = $profile->nickname;
-+        $twitter_user['description'] = ($profile->bio) ? $profile->bio : NULL;
-+        $twitter_user['location'] = ($profile->location) ? $profile->location : NULL;
-+        $twitter_user['id'] = intval($profile->id);
-hunk ./lib/twitterapi.php 41
--		$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
-+        $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
-hunk ./lib/twitterapi.php 43
--		$twitter_user['profile_image_url'] = ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE);
--		$twitter_user['protected'] = 'false'; # not supported by Laconica yet
--		$twitter_user['url'] = ($profile->homepage) ? $profile->homepage : NULL;
-+        $twitter_user['profile_image_url'] = ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE);
-+        $twitter_user['protected'] = 'false'; # not supported by Laconica yet
-+        $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : NULL;
-hunk ./lib/twitterapi.php 47
--		if ($get_notice) {
--			$notice = $profile->getCurrentNotice();
--			if ($notice) {
--				# don't get user!
--				$twitter_user['status'] = $this->twitter_status_array($notice, false);
--			}
--		}
-+        if ($get_notice) {
-+            $notice = $profile->getCurrentNotice();
-+            if ($notice) {
-+                # don't get user!
-+                $twitter_user['status'] = $this->twitter_status_array($notice, false);
-+            }
-+        }
-hunk ./lib/twitterapi.php 55
--		return $twitter_user;
--	}
-+        return $twitter_user;
-+    }
-hunk ./lib/twitterapi.php 58
--	function twitter_status_array($notice, $include_user=true) {
-+    function twitter_status_array($notice, $include_user=true) {
-hunk ./lib/twitterapi.php 60
--		$profile = $notice->getProfile();
-+        $profile = $notice->getProfile();
-hunk ./lib/twitterapi.php 62
--		$twitter_status = array();
--		$twitter_status['text'] = $notice->content;
--		$twitter_status['truncated'] = 'false'; # Not possible on Laconica
--		$twitter_status['created_at'] = $this->date_twitter($notice->created);
--		$twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : NULL;
--		$twitter_status['source'] = $this->source_link($notice->source);
--		$twitter_status['id'] = intval($notice->id);
--		$twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : NULL;
-+        $twitter_status = array();
-+        $twitter_status['text'] = $notice->content;
-+        $twitter_status['truncated'] = 'false'; # Not possible on Laconica
-+        $twitter_status['created_at'] = $this->date_twitter($notice->created);
-+        $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : NULL;
-+        $twitter_status['source'] = $this->source_link($notice->source);
-+        $twitter_status['id'] = intval($notice->id);
-+        $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : NULL;
-hunk ./lib/twitterapi.php 71
--		if (isset($this->auth_user)) {
--			$twitter_status['favorited'] = ($this->auth_user->hasFave($notice)) ? 'true' : 'false';
--		} else {
--			$twitter_status['favorited'] = 'false';
--		}
-+        if (isset($this->auth_user)) {
-+            $twitter_status['favorited'] = ($this->auth_user->hasFave($notice)) ? 'true' : 'false';
-+        } else {
-+            $twitter_status['favorited'] = 'false';
-+        }
-hunk ./lib/twitterapi.php 77
--		if ($include_user) {
--			# Don't get notice (recursive!)
--			$twitter_user = $this->twitter_user_array($profile, false);
--			$twitter_status['user'] = $twitter_user;
--		}
-+        if ($include_user) {
-+            # Don't get notice (recursive!)
-+            $twitter_user = $this->twitter_user_array($profile, false);
-+            $twitter_status['user'] = $twitter_user;
-+        }
-hunk ./lib/twitterapi.php 83
--		return $twitter_status;
--	}
-+        return $twitter_status;
-+    }
-hunk ./lib/twitterapi.php 86
--	function twitter_rss_entry_array($notice) {
-+    function twitter_rss_entry_array($notice) {
-hunk ./lib/twitterapi.php 88
--		$profile = $notice->getProfile();
-+        $profile = $notice->getProfile();
-hunk ./lib/twitterapi.php 90
--		$server = common_config('site', 'server');
--		$entry = array();
-+        $server = common_config('site', 'server');
-+        $entry = array();
-hunk ./lib/twitterapi.php 95
--		$entry['content'] = common_xml_safe_str(trim($notice->rendered));
--		$entry['title'] = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
--		$entry['link'] = common_local_url('shownotice', array('notice' => $notice->id));
--		$entry['published'] = common_date_iso8601($notice->created);
--		$entry['id'] = "tag:$server,2008:$entry[link]";
--		$entry['updated'] = $entry['published'];
-+        $entry['content'] = common_xml_safe_str(trim($notice->rendered));
-+        $entry['title'] = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
-+        $entry['link'] = common_local_url('shownotice', array('notice' => $notice->id));
-+        $entry['published'] = common_date_iso8601($notice->created);
-+        $entry['id'] = "tag:$server,2008:$entry[link]";
-+        $entry['updated'] = $entry['published'];
-hunk ./lib/twitterapi.php 102
--		# RSS Item specific
--		$entry['description'] = $entry['content'];
--		$entry['pubDate'] = common_date_rfc2822($notice->created);
--		$entry['guid'] = $entry['link'];
-+        # RSS Item specific
-+        $entry['description'] = $entry['content'];
-+        $entry['pubDate'] = common_date_rfc2822($notice->created);
-+        $entry['guid'] = $entry['link'];
-hunk ./lib/twitterapi.php 107
--		return $entry;
--	}
-+        return $entry;
-+    }
-hunk ./lib/twitterapi.php 110
--	function twitter_rss_dmsg_array($message) {
-+    function twitter_rss_dmsg_array($message) {
-hunk ./lib/twitterapi.php 112
--		$server = common_config('site', 'server');
--		$entry = array();
-+        $server = common_config('site', 'server');
-+        $entry = array();
-hunk ./lib/twitterapi.php 115
--		$entry['title'] = sprintf('Message from %s to %s',
--			$message->getFrom()->nickname, $message->getTo()->nickname);
-+        $entry['title'] = sprintf('Message from %s to %s',
-+            $message->getFrom()->nickname, $message->getTo()->nickname);
-hunk ./lib/twitterapi.php 118
--		$entry['content'] = common_xml_safe_str(trim($message->content));
--		$entry['link'] = common_local_url('showmessage', array('message' => $message->id));
--		$entry['published'] = common_date_iso8601($message->created);
--		$entry['id'] = "tag:$server,2008:$entry[link]";
--		$entry['updated'] = $entry['published'];
-+        $entry['content'] = common_xml_safe_str(trim($message->content));
-+        $entry['link'] = common_local_url('showmessage', array('message' => $message->id));
-+        $entry['published'] = common_date_iso8601($message->created);
-+        $entry['id'] = "tag:$server,2008:$entry[link]";
-+        $entry['updated'] = $entry['published'];
-hunk ./lib/twitterapi.php 124
--		# RSS Item specific
--		$entry['description'] = $entry['content'];
--		$entry['pubDate'] = common_date_rfc2822($message->created);
--		$entry['guid'] = $entry['link'];
-+        # RSS Item specific
-+        $entry['description'] = $entry['content'];
-+        $entry['pubDate'] = common_date_rfc2822($message->created);
-+        $entry['guid'] = $entry['link'];
-hunk ./lib/twitterapi.php 129
--		return $entry;
--	}
-+        return $entry;
-+    }
-hunk ./lib/twitterapi.php 132
--	function twitter_dmsg_array($message) {
-+    function twitter_dmsg_array($message) {
-hunk ./lib/twitterapi.php 134
--		$twitter_dm = array();
-+        $twitter_dm = array();
-hunk ./lib/twitterapi.php 136
--		$from_profile = $message->getFrom();
--		$to_profile = $message->getTo();
-+        $from_profile = $message->getFrom();
-+        $to_profile = $message->getTo();
-hunk ./lib/twitterapi.php 139
--		$twitter_dm['id'] = $message->id;
--		$twitter_dm['sender_id'] = $message->from_profile;
--		$twitter_dm['text'] = trim($message->content);
--		$twitter_dm['recipient_id'] = $message->to_profile;
--		$twitter_dm['created_at'] = $this->date_twitter($message->created);
--		$twitter_dm['sender_screen_name'] = $from_profile->nickname;
--		$twitter_dm['recipient_screen_name'] = $to_profile->nickname;
--		$twitter_dm['sender'] = $this->twitter_user_array($from_profile, false);
--		$twitter_dm['recipient'] = $this->twitter_user_array($to_profile, false);
-+        $twitter_dm['id'] = $message->id;
-+        $twitter_dm['sender_id'] = $message->from_profile;
-+        $twitter_dm['text'] = trim($message->content);
-+        $twitter_dm['recipient_id'] = $message->to_profile;
-+        $twitter_dm['created_at'] = $this->date_twitter($message->created);
-+        $twitter_dm['sender_screen_name'] = $from_profile->nickname;
-+        $twitter_dm['recipient_screen_name'] = $to_profile->nickname;
-+        $twitter_dm['sender'] = $this->twitter_user_array($from_profile, false);
-+        $twitter_dm['recipient'] = $this->twitter_user_array($to_profile, false);
-hunk ./lib/twitterapi.php 149
--		return $twitter_dm;
--	}
-+        return $twitter_dm;
-+    }
-hunk ./lib/twitterapi.php 152
--	function show_twitter_xml_status($twitter_status) {
--		common_element_start('status');
--		foreach($twitter_status as $element => $value) {
--			switch ($element) {
--			case 'user':
--				$this->show_twitter_xml_user($twitter_status['user']);
--				break;
--			case 'text':
--				common_element($element, NULL, common_xml_safe_str($value));
--				break;
--			default:
--				common_element($element, NULL, $value);
--			}
--		}
--		common_element_end('status');
--	}
-+    function show_twitter_xml_status($twitter_status) {
-+        common_element_start('status');
-+        foreach($twitter_status as $element => $value) {
-+            switch ($element) {
-+            case 'user':
-+                $this->show_twitter_xml_user($twitter_status['user']);
-+                break;
-+            case 'text':
-+                common_element($element, NULL, common_xml_safe_str($value));
-+                break;
-+            default:
-+                common_element($element, NULL, $value);
-+            }
-+        }
-+        common_element_end('status');
-+    }
-hunk ./lib/twitterapi.php 169
--	function show_twitter_xml_user($twitter_user, $role='user') {
--		common_element_start($role);
--		foreach($twitter_user as $element => $value) {
--			if ($element == 'status') {
--				$this->show_twitter_xml_status($twitter_user['status']);
--			} else {
--				common_element($element, NULL, $value);
--			}
--		}
--		common_element_end($role);
--	}
-+    function show_twitter_xml_user($twitter_user, $role='user') {
-+        common_element_start($role);
-+        foreach($twitter_user as $element => $value) {
-+            if ($element == 'status') {
-+                $this->show_twitter_xml_status($twitter_user['status']);
-+            } else {
-+                common_element($element, NULL, $value);
-+            }
-+        }
-+        common_element_end($role);
-+    }
-hunk ./lib/twitterapi.php 181
--	function show_twitter_rss_item($entry) {
--		common_element_start('item');
--		common_element('title', NULL, $entry['title']);
--		common_element('description', NULL, $entry['description']);
--		common_element('pubDate', NULL, $entry['pubDate']);
--		common_element('guid', NULL, $entry['guid']);
--		common_element('link', NULL, $entry['link']);
--		common_element_end('item');
--	}
-+    function show_twitter_rss_item($entry) {
-+        common_element_start('item');
-+        common_element('title', NULL, $entry['title']);
-+        common_element('description', NULL, $entry['description']);
-+        common_element('pubDate', NULL, $entry['pubDate']);
-+        common_element('guid', NULL, $entry['guid']);
-+        common_element('link', NULL, $entry['link']);
-+        common_element_end('item');
-+    }
-hunk ./lib/twitterapi.php 191
--	function show_twitter_atom_entry($entry) {
--	    common_element_start('entry');
--		common_element('title', NULL, $entry['title']);
--		common_element('content', array('type' => 'html'), $entry['content']);
--		common_element('id', NULL, $entry['id']);
--		common_element('published', NULL, $entry['published']);
--		common_element('updated', NULL, $entry['updated']);
--		common_element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), NULL);
--		common_element_end('entry');
--	}
-+    function show_twitter_atom_entry($entry) {
-+        common_element_start('entry');
-+        common_element('title', NULL, $entry['title']);
-+        common_element('content', array('type' => 'html'), $entry['content']);
-+        common_element('id', NULL, $entry['id']);
-+        common_element('published', NULL, $entry['published']);
-+        common_element('updated', NULL, $entry['updated']);
-+        common_element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), NULL);
-+        common_element_end('entry');
-+    }
-hunk ./lib/twitterapi.php 202
--	function show_json_objects($objects) {
--		print(json_encode($objects));
--	}
-+    function show_json_objects($objects) {
-+        print(json_encode($objects));
-+    }
-hunk ./lib/twitterapi.php 206
--	function show_single_xml_status($notice) {
--		$this->init_document('xml');
--		$twitter_status = $this->twitter_status_array($notice);
--		$this->show_twitter_xml_status($twitter_status);
--		$this->end_document('xml');
--	}
-+    function show_single_xml_status($notice) {
-+        $this->init_document('xml');
-+        $twitter_status = $this->twitter_status_array($notice);
-+        $this->show_twitter_xml_status($twitter_status);
-+        $this->end_document('xml');
-+    }
-hunk ./lib/twitterapi.php 213
--	function show_single_json_status($notice) {
--		$this->init_document('json');
--		$status = $this->twitter_status_array($notice);
--		$this->show_json_objects($status);
--		$this->end_document('json');
--	}
-+    function show_single_json_status($notice) {
-+        $this->init_document('json');
-+        $status = $this->twitter_status_array($notice);
-+        $this->show_json_objects($status);
-+        $this->end_document('json');
-+    }
-hunk ./lib/twitterapi.php 220
--	function show_single_xml_dmsg($message) {
--		$this->init_document('xml');
--		$dmsg = $this->twitter_dmsg_array($message);
--		$this->show_twitter_xml_dmsg($dmsg);
--		$this->end_document('xml');
--	}
-+    function show_single_xml_dmsg($message) {
-+        $this->init_document('xml');
-+        $dmsg = $this->twitter_dmsg_array($message);
-+        $this->show_twitter_xml_dmsg($dmsg);
-+        $this->end_document('xml');
-+    }
-hunk ./lib/twitterapi.php 227
--	function show_single_json_dmsg($message) {
--		$this->init_document('json');
--		$dmsg = $this->twitter_dmsg_array($message);
--		$this->show_json_objects($dmsg);
--		$this->end_document('json');
--	}
-+    function show_single_json_dmsg($message) {
-+        $this->init_document('json');
-+        $dmsg = $this->twitter_dmsg_array($message);
-+        $this->show_json_objects($dmsg);
-+        $this->end_document('json');
-+    }
-hunk ./lib/twitterapi.php 234
--	function show_twitter_xml_dmsg($twitter_dm) {
--		common_element_start('direct_message');
--		foreach($twitter_dm as $element => $value) {
--			switch ($element) {
--			case 'sender':
--			case 'recipient':
--				$this->show_twitter_xml_user($value, $element);
--				break;
--			case 'text':
--				common_element($element, NULL, common_xml_safe_str($value));
--				break;
--			default:
--				common_element($element, NULL, $value);
--			}
--		}
--		common_element_end('direct_message');
--	}
-+    function show_twitter_xml_dmsg($twitter_dm) {
-+        common_element_start('direct_message');
-+        foreach($twitter_dm as $element => $value) {
-+            switch ($element) {
-+            case 'sender':
-+            case 'recipient':
-+                $this->show_twitter_xml_user($value, $element);
-+                break;
-+            case 'text':
-+                common_element($element, NULL, common_xml_safe_str($value));
-+                break;
-+            default:
-+                common_element($element, NULL, $value);
-+            }
-+        }
-+        common_element_end('direct_message');
-+    }
-hunk ./lib/twitterapi.php 252
--	function show_xml_timeline($notice) {
-+    function show_xml_timeline($notice) {
-hunk ./lib/twitterapi.php 254
--		$this->init_document('xml');
--		common_element_start('statuses', array('type' => 'array'));
-+        $this->init_document('xml');
-+        common_element_start('statuses', array('type' => 'array'));
-hunk ./lib/twitterapi.php 257
--		if (is_array($notice)) {
--			foreach ($notice as $n) {
--				$twitter_status = $this->twitter_status_array($n);
--				$this->show_twitter_xml_status($twitter_status);
--			}
--		} else {
--			while ($notice->fetch()) {
--				$twitter_status = $this->twitter_status_array($notice);
--				$this->show_twitter_xml_status($twitter_status);
--			}
--		}
-+        if (is_array($notice)) {
-+            foreach ($notice as $n) {
-+                $twitter_status = $this->twitter_status_array($n);
-+                $this->show_twitter_xml_status($twitter_status);
-+            }
-+        } else {
-+            while ($notice->fetch()) {
-+                $twitter_status = $this->twitter_status_array($notice);
-+                $this->show_twitter_xml_status($twitter_status);
-+            }
-+        }
-hunk ./lib/twitterapi.php 269
--		common_element_end('statuses');
--		$this->end_document('xml');
--	}
-+        common_element_end('statuses');
-+        $this->end_document('xml');
-+    }
+-    function form_header($title, $msg=NULL, $success=false) {
++    function form_header($title, $msg=null, $success=false) {
+hunk ./lib/settingsaction.php 60
+-                           NULL,
++                           null,
+hunk ./lib/twitter.php 151
+-            return NULL;
++            return null;
+hunk ./lib/twitter.php 157
+-            return NULL;
++            return null;
+hunk ./lib/twitterapi.php 37
+-        $twitter_user['description'] = ($profile->bio) ? $profile->bio : NULL;
+-        $twitter_user['location'] = ($profile->location) ? $profile->location : NULL;
++        $twitter_user['description'] = ($profile->bio) ? $profile->bio : null;
++        $twitter_user['location'] = ($profile->location) ? $profile->location : null;
+hunk ./lib/twitterapi.php 45
+-        $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : NULL;
++        $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : null;
+hunk ./lib/twitterapi.php 66
+-        $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : NULL;
++        $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : null;
+hunk ./lib/twitterapi.php 69
+-        $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : NULL;
++        $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : null;
+hunk ./lib/twitterapi.php 160
+-                common_element($element, NULL, common_xml_safe_str($value));
++                common_element($element, null, common_xml_safe_str($value));
+hunk ./lib/twitterapi.php 163
+-                common_element($element, NULL, $value);
++                common_element($element, null, $value);
+hunk ./lib/twitterapi.php 175
+-                common_element($element, NULL, $value);
++                common_element($element, null, $value);
+hunk ./lib/twitterapi.php 183
+-        common_element('title', NULL, $entry['title']);
+-        common_element('description', NULL, $entry['description']);
+-        common_element('pubDate', NULL, $entry['pubDate']);
+-        common_element('guid', NULL, $entry['guid']);
+-        common_element('link', NULL, $entry['link']);
++        common_element('title', null, $entry['title']);
++        common_element('description', null, $entry['description']);
++        common_element('pubDate', null, $entry['pubDate']);
++        common_element('guid', null, $entry['guid']);
++        common_element('link', null, $entry['link']);
+hunk ./lib/twitterapi.php 193
+-        common_element('title', NULL, $entry['title']);
++        common_element('title', null, $entry['title']);
+hunk ./lib/twitterapi.php 195
+-        common_element('id', NULL, $entry['id']);
+-        common_element('published', NULL, $entry['published']);
+-        common_element('updated', NULL, $entry['updated']);
+-        common_element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), NULL);
++        common_element('id', null, $entry['id']);
++        common_element('published', null, $entry['published']);
++        common_element('updated', null, $entry['updated']);
++        common_element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), null);
+hunk ./lib/twitterapi.php 243
+-                common_element($element, NULL, common_xml_safe_str($value));
++                common_element($element, null, common_xml_safe_str($value));
+hunk ./lib/twitterapi.php 246
+-                common_element($element, NULL, $value);
++                common_element($element, null, $value);
 hunk ./lib/twitterapi.php 273
--	function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=NULL) {
-+    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=NULL) {
-hunk ./lib/twitterapi.php 275
--		$this->init_document('rss');
-+        $this->init_document('rss');
-hunk ./lib/twitterapi.php 277
--		common_element_start('channel');
--		common_element('title', NULL, $title);
--		common_element('link', NULL, $link);
--		if (!is_null($suplink)) {
--			# For FriendFeed's SUP protocol
--			common_element('link', array('xmlns' => 'http://www.w3.org/2005/Atom',
--										 'rel' => 'http://api.friendfeed.com/2008/03#sup',
--										 'href' => $suplink,
--										 'type' => 'application/json'));
--		}
--		common_element('description', NULL, $subtitle);
--		common_element('language', NULL, 'en-us');
--		common_element('ttl', NULL, '40');
-+        common_element_start('channel');
-+        common_element('title', NULL, $title);
-+        common_element('link', NULL, $link);
-+        if (!is_null($suplink)) {
-+            # For FriendFeed's SUP protocol
-+            common_element('link', array('xmlns' => 'http://www.w3.org/2005/Atom',
-+                                         'rel' => 'http://api.friendfeed.com/2008/03#sup',
-+                                         'href' => $suplink,
-+                                         'type' => 'application/json'));
-+        }
-+        common_element('description', NULL, $subtitle);
-+        common_element('language', NULL, 'en-us');
-+        common_element('ttl', NULL, '40');
-hunk ./lib/twitterapi.php 291
--		if (is_array($notice)) {
--			foreach ($notice as $n) {
--				$entry = $this->twitter_rss_entry_array($n);
--				$this->show_twitter_rss_item($entry);
--			}
--		} else {
--			while ($notice->fetch()) {
--				$entry = $this->twitter_rss_entry_array($notice);
--				$this->show_twitter_rss_item($entry);
--			}
--		}
-+        if (is_array($notice)) {
-+            foreach ($notice as $n) {
-+                $entry = $this->twitter_rss_entry_array($n);
-+                $this->show_twitter_rss_item($entry);
-+            }
-+        } else {
-+            while ($notice->fetch()) {
-+                $entry = $this->twitter_rss_entry_array($notice);
-+                $this->show_twitter_rss_item($entry);
-+            }
-+        }
-hunk ./lib/twitterapi.php 303
--		common_element_end('channel');
--		$this->end_twitter_rss();
--	}
-+        common_element_end('channel');
-+        $this->end_twitter_rss();
-+    }
+-    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=NULL) {
++    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null) {
+hunk ./lib/twitterapi.php 278
+-        common_element('title', NULL, $title);
+-        common_element('link', NULL, $link);
++        common_element('title', null, $title);
++        common_element('link', null, $link);
+hunk ./lib/twitterapi.php 287
+-        common_element('description', NULL, $subtitle);
+-        common_element('language', NULL, 'en-us');
+-        common_element('ttl', NULL, '40');
++        common_element('description', null, $subtitle);
++        common_element('language', null, 'en-us');
++        common_element('ttl', null, '40');
 hunk ./lib/twitterapi.php 307
--	function show_atom_timeline($notice, $title, $id, $link, $subtitle=NULL, $suplink=NULL) {
-+    function show_atom_timeline($notice, $title, $id, $link, $subtitle=NULL, $suplink=NULL) {
-hunk ./lib/twitterapi.php 309
--		$this->init_document('atom');
-+        $this->init_document('atom');
+-    function show_atom_timeline($notice, $title, $id, $link, $subtitle=NULL, $suplink=NULL) {
++    function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null) {
 hunk ./lib/twitterapi.php 311
--		common_element('title', NULL, $title);
--		common_element('id', NULL, $id);
--		common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
--		if (!is_null($suplink)) {
--			# For FriendFeed's SUP protocol
--			common_element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup',
--										 'href' => $suplink,
--										 'type' => 'application/json'));
--		}
--		common_element('subtitle', NULL, $subtitle);
-+        common_element('title', NULL, $title);
-+        common_element('id', NULL, $id);
-+        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
-+        if (!is_null($suplink)) {
-+            # For FriendFeed's SUP protocol
-+            common_element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup',
-+                                         'href' => $suplink,
-+                                         'type' => 'application/json'));
-+        }
-+        common_element('subtitle', NULL, $subtitle);
-hunk ./lib/twitterapi.php 322
--		if (is_array($notice)) {
--			foreach ($notice as $n) {
--				$entry = $this->twitter_rss_entry_array($n);
--				$this->show_twitter_atom_entry($entry);
--			}
--		} else {
--			while ($notice->fetch()) {
--				$entry = $this->twitter_rss_entry_array($notice);
--				$this->show_twitter_atom_entry($entry);
--			}
--		}
-+        if (is_array($notice)) {
-+            foreach ($notice as $n) {
-+                $entry = $this->twitter_rss_entry_array($n);
-+                $this->show_twitter_atom_entry($entry);
-+            }
-+        } else {
-+            while ($notice->fetch()) {
-+                $entry = $this->twitter_rss_entry_array($notice);
-+                $this->show_twitter_atom_entry($entry);
-+            }
-+        }
-hunk ./lib/twitterapi.php 334
--		$this->end_document('atom');
-+        $this->end_document('atom');
-hunk ./lib/twitterapi.php 336
--	}
-+    }
-hunk ./lib/twitterapi.php 338
--	function show_json_timeline($notice) {
-+    function show_json_timeline($notice) {
-hunk ./lib/twitterapi.php 340
--		$this->init_document('json');
-+        $this->init_document('json');
-hunk ./lib/twitterapi.php 342
--		$statuses = array();
-+        $statuses = array();
-hunk ./lib/twitterapi.php 344
--		if (is_array($notice)) {
--			foreach ($notice as $n) {
--				$twitter_status = $this->twitter_status_array($n);
--				array_push($statuses, $twitter_status);
--			}
--		} else {
--			while ($notice->fetch()) {
--				$twitter_status = $this->twitter_status_array($notice);
--				array_push($statuses, $twitter_status);
--			}
--		}
-+        if (is_array($notice)) {
-+            foreach ($notice as $n) {
-+                $twitter_status = $this->twitter_status_array($n);
-+                array_push($statuses, $twitter_status);
-+            }
-+        } else {
-+            while ($notice->fetch()) {
-+                $twitter_status = $this->twitter_status_array($notice);
-+                array_push($statuses, $twitter_status);
-+            }
-+        }
-hunk ./lib/twitterapi.php 356
--		$this->show_json_objects($statuses);
-+        $this->show_json_objects($statuses);
-hunk ./lib/twitterapi.php 358
--		$this->end_document('json');
--	}
-+        $this->end_document('json');
-+    }
-hunk ./lib/twitterapi.php 361
--	// Anyone know what date format this is?
--	// Twitter's dates look like this: "Mon Jul 14 23:52:38 +0000 2008" -- Zach
--	function date_twitter($dt) {
--		$t = strtotime($dt);
--		return date("D M d G:i:s O Y", $t);
--	}
-+    // Anyone know what date format this is?
-+    // Twitter's dates look like this: "Mon Jul 14 23:52:38 +0000 2008" -- Zach
-+    function date_twitter($dt) {
-+        $t = strtotime($dt);
-+        return date("D M d G:i:s O Y", $t);
-+    }
-hunk ./lib/twitterapi.php 368
--	function replier_by_reply($reply_id) {
--		$notice = Notice::staticGet($reply_id);
--		if ($notice) {
--			$profile = $notice->getProfile();
--			if ($profile) {
--				return intval($profile->id);
--			} else {
--				common_debug('Can\'t find a profile for notice: ' . $notice->id, __FILE__);
--			}
--		} else {
--			common_debug("Can't get notice: $reply_id", __FILE__);
--		}
--		return NULL;
--	}
-+    function replier_by_reply($reply_id) {
-+        $notice = Notice::staticGet($reply_id);
-+        if ($notice) {
-+            $profile = $notice->getProfile();
-+            if ($profile) {
-+                return intval($profile->id);
-+            } else {
-+                common_debug('Can\'t find a profile for notice: ' . $notice->id, __FILE__);
-+            }
-+        } else {
-+            common_debug("Can't get notice: $reply_id", __FILE__);
-+        }
-+        return NULL;
-+    }
-hunk ./lib/twitterapi.php 383
--	// XXX: Candidate for a general utility method somewhere?
--	function count_subscriptions($profile) {
-+    // XXX: Candidate for a general utility method somewhere?
-+    function count_subscriptions($profile) {
-hunk ./lib/twitterapi.php 386
--		$count = 0;
--		$sub = new Subscription();
--		$sub->subscribed = $profile->id;
-+        $count = 0;
-+        $sub = new Subscription();
-+        $sub->subscribed = $profile->id;
-hunk ./lib/twitterapi.php 390
--		$count = $sub->find();
-+        $count = $sub->find();
-hunk ./lib/twitterapi.php 392
--		if ($count > 0) {
--			return $count - 1;
--		} else {
--			return 0;
--		}
--	}
-+        if ($count > 0) {
-+            return $count - 1;
-+        } else {
-+            return 0;
-+        }
-+    }
-hunk ./lib/twitterapi.php 399
--	function init_document($type='xml') {
--		switch ($type) {
--		 case 'xml':
--			header('Content-Type: application/xml; charset=utf-8');
--			common_start_xml();
--			break;
--		 case 'json':
--			header('Content-Type: application/json; charset=utf-8');
-+    function init_document($type='xml') {
-+        switch ($type) {
-+         case 'xml':
-+            header('Content-Type: application/xml; charset=utf-8');
-+            common_start_xml();
-+            break;
-+         case 'json':
-+            header('Content-Type: application/json; charset=utf-8');
-hunk ./lib/twitterapi.php 408
--			// Check for JSONP callback
--			$callback = $this->arg('callback');
--			if ($callback) {
--				print $callback . '(';
--			}
--			break;
--		 case 'rss':
--			header("Content-Type: application/rss+xml; charset=utf-8");
--			$this->init_twitter_rss();
--			break;
--		 case 'atom':
--			header('Content-Type: application/atom+xml; charset=utf-8');
--			$this->init_twitter_atom();
--			break;
--		 default:
--			$this->client_error(_('Not a supported data format.'));
--			break;
--		}
-+            // Check for JSONP callback
-+            $callback = $this->arg('callback');
-+            if ($callback) {
-+                print $callback . '(';
-+            }
-+            break;
-+         case 'rss':
-+            header("Content-Type: application/rss+xml; charset=utf-8");
-+            $this->init_twitter_rss();
-+            break;
-+         case 'atom':
-+            header('Content-Type: application/atom+xml; charset=utf-8');
-+            $this->init_twitter_atom();
-+            break;
-+         default:
-+            $this->client_error(_('Not a supported data format.'));
-+            break;
-+        }
-hunk ./lib/twitterapi.php 427
--		return;
--	}
-+        return;
-+    }
-hunk ./lib/twitterapi.php 430
--	function end_document($type='xml') {
--		switch ($type) {
--		 case 'xml':
--			common_end_xml();
--			break;
--		 case 'json':
-+    function end_document($type='xml') {
-+        switch ($type) {
-+         case 'xml':
-+            common_end_xml();
-+            break;
-+         case 'json':
-hunk ./lib/twitterapi.php 437
--			// Check for JSONP callback
--			$callback = $this->arg('callback');
--			if ($callback) {
--				print ')';
--			}
--			break;
--		 case 'rss':
--			$this->end_twitter_rss();
--			break;
--		 case 'atom':
--			$this->end_twitter_rss();
--			break;
--		 default:
--			$this->client_error(_('Not a supported data format.'));
--			break;
--		}
--		return;
--	}
-+            // Check for JSONP callback
-+            $callback = $this->arg('callback');
-+            if ($callback) {
-+                print ')';
-+            }
-+            break;
-+         case 'rss':
-+            $this->end_twitter_rss();
-+            break;
-+         case 'atom':
-+            $this->end_twitter_rss();
-+            break;
-+         default:
-+            $this->client_error(_('Not a supported data format.'));
-+            break;
-+        }
-+        return;
-+    }
-hunk ./lib/twitterapi.php 456
--	function client_error($msg, $code = 400, $content_type = 'json') {
-+    function client_error($msg, $code = 400, $content_type = 'json') {
-hunk ./lib/twitterapi.php 458
--		static $status = array(400 => 'Bad Request',
--							   401 => 'Unauthorized',
--							   402 => 'Payment Required',
--							   403 => 'Forbidden',
--							   404 => 'Not Found',
--							   405 => 'Method Not Allowed',
--							   406 => 'Not Acceptable',
--							   407 => 'Proxy Authentication Required',
--							   408 => 'Request Timeout',
--							   409 => 'Conflict',
--							   410 => 'Gone',
--							   411 => 'Length Required',
--							   412 => 'Precondition Failed',
--							   413 => 'Request Entity Too Large',
--							   414 => 'Request-URI Too Long',
--							   415 => 'Unsupported Media Type',
--							   416 => 'Requested Range Not Satisfiable',
--							   417 => 'Expectation Failed');
-+        static $status = array(400 => 'Bad Request',
-+                               401 => 'Unauthorized',
-+                               402 => 'Payment Required',
-+                               403 => 'Forbidden',
-+                               404 => 'Not Found',
-+                               405 => 'Method Not Allowed',
-+                               406 => 'Not Acceptable',
-+                               407 => 'Proxy Authentication Required',
-+                               408 => 'Request Timeout',
-+                               409 => 'Conflict',
-+                               410 => 'Gone',
-+                               411 => 'Length Required',
-+                               412 => 'Precondition Failed',
-+                               413 => 'Request Entity Too Large',
-+                               414 => 'Request-URI Too Long',
-+                               415 => 'Unsupported Media Type',
-+                               416 => 'Requested Range Not Satisfiable',
-+                               417 => 'Expectation Failed');
-hunk ./lib/twitterapi.php 477
--		$action = $this->trimmed('action');
-+        $action = $this->trimmed('action');
-hunk ./lib/twitterapi.php 479
--		common_debug("User error '$code' on '$action': $msg", __FILE__);
-+        common_debug("User error '$code' on '$action': $msg", __FILE__);
-hunk ./lib/twitterapi.php 481
--		if (!array_key_exists($code, $status)) {
--			$code = 400;
--		}
-+        if (!array_key_exists($code, $status)) {
-+            $code = 400;
-+        }
-hunk ./lib/twitterapi.php 485
--		$status_string = $status[$code];
--		header('HTTP/1.1 '.$code.' '.$status_string);
-+        $status_string = $status[$code];
-+        header('HTTP/1.1 '.$code.' '.$status_string);
-hunk ./lib/twitterapi.php 488
--		if ($content_type == 'xml') {
--			$this->init_document('xml');
--			common_element_start('hash');
--			common_element('error', NULL, $msg);
--			common_element('request', NULL, $_SERVER['REQUEST_URI']);
--			common_element_end('hash');
--			$this->end_document('xml');
--		} else {
--			$this->init_document('json');
--			$error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);
--			print(json_encode($error_array));
--			$this->end_document('json');
--		}
-+        if ($content_type == 'xml') {
-+            $this->init_document('xml');
-+            common_element_start('hash');
-+            common_element('error', NULL, $msg);
-+            common_element('request', NULL, $_SERVER['REQUEST_URI']);
-+            common_element_end('hash');
-+            $this->end_document('xml');
-+        } else {
-+            $this->init_document('json');
-+            $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);
-+            print(json_encode($error_array));
-+            $this->end_document('json');
-+        }
-hunk ./lib/twitterapi.php 502
--	}
-+    }
-hunk ./lib/twitterapi.php 504
--	function init_twitter_rss() {
--		common_start_xml();
--		common_element_start('rss', array('version' => '2.0'));
--	}
-+    function init_twitter_rss() {
-+        common_start_xml();
-+        common_element_start('rss', array('version' => '2.0'));
-+    }
-hunk ./lib/twitterapi.php 509
--	function end_twitter_rss() {
--		common_element_end('rss');
--		common_end_xml();
--	}
-+    function end_twitter_rss() {
-+        common_element_end('rss');
-+        common_end_xml();
-+    }
-hunk ./lib/twitterapi.php 514
--	function init_twitter_atom() {
--		common_start_xml();
--		common_element_start('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', 'xml:lang' => 'en-US'));
--	}
-+    function init_twitter_atom() {
-+        common_start_xml();
-+        common_element_start('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', 'xml:lang' => 'en-US'));
-+    }
-hunk ./lib/twitterapi.php 519
--	function end_twitter_atom() {
--		common_end_xml();
--		common_element_end('feed');
--	}
-+    function end_twitter_atom() {
-+        common_end_xml();
-+        common_element_end('feed');
-+    }
+-        common_element('title', NULL, $title);
+-        common_element('id', NULL, $id);
+-        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
++        common_element('title', null, $title);
++        common_element('id', null, $id);
++        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
+hunk ./lib/twitterapi.php 320
+-        common_element('subtitle', NULL, $subtitle);
++        common_element('subtitle', null, $subtitle);
+hunk ./lib/twitterapi.php 380
+-        return NULL;
++        return null;
+hunk ./lib/twitterapi.php 491
+-            common_element('error', NULL, $msg);
+-            common_element('request', NULL, $_SERVER['REQUEST_URI']);
++            common_element('error', null, $msg);
++            common_element('request', null, $_SERVER['REQUEST_URI']);
 hunk ./lib/twitterapi.php 524
--	function show_profile($profile, $content_type='xml', $notice=NULL) {
--		$profile_array = $this->twitter_user_array($profile, true);
--		switch ($content_type) {
--		 case 'xml':
--			$this->show_twitter_xml_user($profile_array);
--			break;
--		 case 'json':
--			$this->show_json_objects($profile_array);
--			break;
--		 default:
--			$this->client_error(_('Not a supported data format.'));
--			return;
--		}
--		return;
--	}
-+    function show_profile($profile, $content_type='xml', $notice=NULL) {
-+        $profile_array = $this->twitter_user_array($profile, true);
-+        switch ($content_type) {
-+         case 'xml':
-+            $this->show_twitter_xml_user($profile_array);
-+            break;
-+         case 'json':
-+            $this->show_json_objects($profile_array);
-+            break;
-+         default:
-+            $this->client_error(_('Not a supported data format.'));
-+            return;
-+        }
-+        return;
-+    }
+-    function show_profile($profile, $content_type='xml', $notice=NULL) {
++    function show_profile($profile, $content_type='xml', $notice=null) {
 hunk ./lib/twitterapi.php 540
--	function get_user($id, $apidata=NULL) {
--		if (!$id) {
--			return $apidata['user'];
--		} else if (is_numeric($id)) {
--			return User::staticGet($id);
--		} else {
--			$nickname = common_canonical_nickname($id);
--			return User::staticGet('nickname', $nickname);
--		}
--	}
-+    function get_user($id, $apidata=NULL) {
-+        if (!$id) {
-+            return $apidata['user'];
-+        } else if (is_numeric($id)) {
-+            return User::staticGet($id);
-+        } else {
-+            $nickname = common_canonical_nickname($id);
-+            return User::staticGet('nickname', $nickname);
-+        }
-+    }
-hunk ./lib/twitterapi.php 551
--	function get_profile($id) {
--		if (is_numeric($id)) {
--			return Profile::staticGet($id);
--		} else {
--			$user = User::staticGet('nickname', $id);
--			if ($user) {
--				return $user->getProfile();
--			} else {
--				return NULL;
--			}
--		}
--	}
-+    function get_profile($id) {
-+        if (is_numeric($id)) {
-+            return Profile::staticGet($id);
-+        } else {
-+            $user = User::staticGet('nickname', $id);
-+            if ($user) {
-+                return $user->getProfile();
-+            } else {
-+                return NULL;
-+            }
-+        }
-+    }
-hunk ./lib/twitterapi.php 564
--	function source_link($source) {
--		$source_name = _($source);
--		switch ($source) {
--		 case 'web':
--		 case 'xmpp':
--		 case 'mail':
--		 case 'omb':
--		 case 'api':
--			break;
--		 default:
--			$ns = Notice_source::staticGet($source);
--			if ($ns) {
--				$source_name = '<a href="' . $ns->url . '">' . $ns->name . '</a>';
--			}
--			break;
--		}
--		return $source_name;
--	}
-+    function source_link($source) {
-+        $source_name = _($source);
-+        switch ($source) {
-+         case 'web':
-+         case 'xmpp':
-+         case 'mail':
-+         case 'omb':
-+         case 'api':
-+            break;
-+         default:
-+            $ns = Notice_source::staticGet($source);
-+            if ($ns) {
-+                $source_name = '<a href="' . $ns->url . '">' . $ns->name . '</a>';
-+            }
-+            break;
-+        }
-+        return $source_name;
-+    }
-hunk ./lib/twitterapi.php 583
--	function show_extended_profile($user, $apidata) {
-+    function show_extended_profile($user, $apidata) {
-hunk ./lib/twitterapi.php 585
--		$this->auth_user = $apidata['user'];
-+        $this->auth_user = $apidata['user'];
-hunk ./lib/twitterapi.php 587
--		$profile = $user->getProfile();
-+        $profile = $user->getProfile();
-hunk ./lib/twitterapi.php 589
--		if (!$profile) {
--			common_server_error(_('User has no profile.'));
--			return;
--		}
-+        if (!$profile) {
-+            common_server_error(_('User has no profile.'));
-+            return;
-+        }
-hunk ./lib/twitterapi.php 594
--		$twitter_user = $this->twitter_user_array($profile, true);
-+        $twitter_user = $this->twitter_user_array($profile, true);
-hunk ./lib/twitterapi.php 596
--		// Add in extended user fields offered up by this method
--		$twitter_user['created_at'] = $this->date_twitter($profile->created);
-+        // Add in extended user fields offered up by this method
-+        $twitter_user['created_at'] = $this->date_twitter($profile->created);
-hunk ./lib/twitterapi.php 599
--		$subbed = DB_DataObject::factory('subscription');
--		$subbed->subscriber = $profile->id;
--		$subbed_count = (int) $subbed->count() - 1;
-+        $subbed = DB_DataObject::factory('subscription');
-+        $subbed->subscriber = $profile->id;
-+        $subbed_count = (int) $subbed->count() - 1;
-hunk ./lib/twitterapi.php 603
--		$notices = DB_DataObject::factory('notice');
--		$notices->profile_id = $profile->id;
--		$notice_count = (int) $notices->count();
-+        $notices = DB_DataObject::factory('notice');
-+        $notices->profile_id = $profile->id;
-+        $notice_count = (int) $notices->count();
-hunk ./lib/twitterapi.php 607
--		$twitter_user['friends_count'] = (is_int($subbed_count)) ? $subbed_count : 0;
--		$twitter_user['statuses_count'] = (is_int($notice_count)) ? $notice_count : 0;
-+        $twitter_user['friends_count'] = (is_int($subbed_count)) ? $subbed_count : 0;
-+        $twitter_user['statuses_count'] = (is_int($notice_count)) ? $notice_count : 0;
-hunk ./lib/twitterapi.php 610
--		// Other fields Twitter sends...
--		$twitter_user['profile_background_color'] = '';
--		$twitter_user['profile_text_color'] = '';
--		$twitter_user['profile_link_color'] = '';
--		$twitter_user['profile_sidebar_fill_color'] = '';
-+        // Other fields Twitter sends...
-+        $twitter_user['profile_background_color'] = '';
-+        $twitter_user['profile_text_color'] = '';
-+        $twitter_user['profile_link_color'] = '';
-+        $twitter_user['profile_sidebar_fill_color'] = '';
-hunk ./lib/twitterapi.php 616
--		$faves = DB_DataObject::factory('fave');
--		$faves->user_id = $user->id;
--		$faves_count = (int) $faves->count();
--		$twitter_user['favourites_count'] = $faves_count;
-+        $faves = DB_DataObject::factory('fave');
-+        $faves->user_id = $user->id;
-+        $faves_count = (int) $faves->count();
-+        $twitter_user['favourites_count'] = $faves_count;
-hunk ./lib/twitterapi.php 621
--		$timezone = 'UTC';
-+        $timezone = 'UTC';
-hunk ./lib/twitterapi.php 623
--		if ($user->timezone) {
--			$timezone = $user->timezone;
--		}
-+        if ($user->timezone) {
-+            $timezone = $user->timezone;
-+        }
-hunk ./lib/twitterapi.php 627
--		$t = new DateTime;
--		$t->setTimezone(new DateTimeZone($timezone));
--		$twitter_user['utc_offset'] = $t->format('Z');
--		$twitter_user['time_zone'] = $timezone;
-+        $t = new DateTime;
-+        $t->setTimezone(new DateTimeZone($timezone));
-+        $twitter_user['utc_offset'] = $t->format('Z');
-+        $twitter_user['time_zone'] = $timezone;
-hunk ./lib/twitterapi.php 632
--		$following = 'false';
-+        $following = 'false';
-hunk ./lib/twitterapi.php 634
--		if (isset($this->auth_user)) {
--			if ($this->auth_user->isSubscribed($profile)) {
--				$following = 'true';
--			}
-+        if (isset($this->auth_user)) {
-+            if ($this->auth_user->isSubscribed($profile)) {
-+                $following = 'true';
-+            }
-hunk ./lib/twitterapi.php 639
--			// Not implemented yet
--			$twitter_user['notifications'] = 'false';
--		}
-+            // Not implemented yet
-+            $twitter_user['notifications'] = 'false';
-+        }
-hunk ./lib/twitterapi.php 643
--		$twitter_user['following'] = $following;
-+        $twitter_user['following'] = $following;
-hunk ./lib/twitterapi.php 645
--		if ($apidata['content-type'] == 'xml') {
--			$this->init_document('xml');
--			$this->show_twitter_xml_user($twitter_user);
--			$this->end_document('xml');
--		} elseif ($apidata['content-type'] == 'json') {
--			$this->init_document('json');
--			$this->show_json_objects($twitter_user);
--			$this->end_document('json');
--		}
-+        if ($apidata['content-type'] == 'xml') {
-+            $this->init_document('xml');
-+            $this->show_twitter_xml_user($twitter_user);
-+            $this->end_document('xml');
-+        } elseif ($apidata['content-type'] == 'json') {
-+            $this->init_document('json');
-+            $this->show_json_objects($twitter_user);
-+            $this->end_document('json');
-+        }
-hunk ./lib/twitterapi.php 655
--	}
-+    }
-hunk ./lib/xmppqueuehandler.php 32
--	
--	function start() {
--		# Low priority; we don't want to receive messages
--		$this->log(LOG_INFO, "INITIALIZE");
--		$this->conn = jabber_connect($this->_id);
--		if ($this->conn) {
--			$this->conn->addEventHandler('message', 'forward_message', $this);
--			$this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
--			$this->conn->setReconnectTimeout(600);
--			jabber_send_presence("Send me a message to post a notice", 'available', NULL, 'available', -1);
--		}
--		return !is_null($this->conn);
--	}
--	
--	function handle_reconnect(&$pl) {
--		$this->conn->processUntil('session_start');
--		$this->conn->presence(NULL, 'available', NULL, 'available', -1);
--	}
-+    
-+    function start() {
-+        # Low priority; we don't want to receive messages
-+        $this->log(LOG_INFO, "INITIALIZE");
-+        $this->conn = jabber_connect($this->_id);
-+        if ($this->conn) {
-+            $this->conn->addEventHandler('message', 'forward_message', $this);
-+            $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
-+            $this->conn->setReconnectTimeout(600);
-+            jabber_send_presence("Send me a message to post a notice", 'available', NULL, 'available', -1);
-+        }
-+        return !is_null($this->conn);
-+    }
-+    
-+    function handle_reconnect(&$pl) {
-+        $this->conn->processUntil('session_start');
-+        $this->conn->presence(NULL, 'available', NULL, 'available', -1);
-+    }
-hunk ./lib/xmppqueuehandler.php 51
--	function idle($timeout=0) {
--		# Process the queue for as long as needed
--		try {
--			if ($this->conn) {
--				$this->conn->processTime($timeout);
--			}
--		} catch (XMPPHP_Exception $e) {
--			$this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
--			die($e->getMessage());
--		}
--	}
--	
--	function forward_message(&$pl) {
--		if ($pl['type'] != 'chat') {
--		    $this->log(LOG_DEBUG, 'Ignoring message of type ' . $pl['type'] . ' from ' . $pl['from']);
--			return;
--		}
--		$listener = $this->listener();
--		if (strtolower($listener) == strtolower($pl['from'])) {
--			$this->log(LOG_WARNING, 'Ignoring loop message.');
--			return;
--		}
--		$this->log(LOG_INFO, 'Forwarding message from ' . $pl['from'] . ' to ' . $listener);
--		$this->conn->message($this->listener(), $pl['body'], 'chat', NULL, $this->ofrom($pl['from']));
--	}
-+    function idle($timeout=0) {
-+        # Process the queue for as long as needed
-+        try {
-+            if ($this->conn) {
-+                $this->conn->processTime($timeout);
-+            }
-+        } catch (XMPPHP_Exception $e) {
-+            $this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
-+            die($e->getMessage());
-+        }
-+    }
-+    
-+    function forward_message(&$pl) {
-+        if ($pl['type'] != 'chat') {
-+            $this->log(LOG_DEBUG, 'Ignoring message of type ' . $pl['type'] . ' from ' . $pl['from']);
-+            return;
-+        }
-+        $listener = $this->listener();
-+        if (strtolower($listener) == strtolower($pl['from'])) {
-+            $this->log(LOG_WARNING, 'Ignoring loop message.');
-+            return;
-+        }
-+        $this->log(LOG_INFO, 'Forwarding message from ' . $pl['from'] . ' to ' . $listener);
-+        $this->conn->message($this->listener(), $pl['body'], 'chat', NULL, $this->ofrom($pl['from']));
-+    }
-hunk ./lib/xmppqueuehandler.php 77
--	function ofrom($from) {
--		$address = "<addresses xmlns='http://jabber.org/protocol/address'>\n";
--		$address .= "<address type='ofrom' jid='$from' />\n";
--		$address .= "</addresses>\n";
--		return $address;
--	}
-+    function ofrom($from) {
-+        $address = "<addresses xmlns='http://jabber.org/protocol/address'>\n";
-+        $address .= "<address type='ofrom' jid='$from' />\n";
-+        $address .= "</addresses>\n";
-+        return $address;
-+    }
-hunk ./lib/xmppqueuehandler.php 84
--	function listener() {
--		if (common_config('xmpp', 'listener')) {
--			return common_config('xmpp', 'listener');
--		} else {
--			return jabber_daemon_address() . '/' . common_config('xmpp','resource') . '-listener';
--		}
--	}
-+    function listener() {
-+        if (common_config('xmpp', 'listener')) {
-+            return common_config('xmpp', 'listener');
-+        } else {
-+            return jabber_daemon_address() . '/' . common_config('xmpp','resource') . '-listener';
-+        }
-+    }
-hunk ./scripts/enjitqueuehandler.php 23
--	print "This script must be run from the command line\n";
--	exit();
-+    print "This script must be run from the command line\n";
-+    exit();
-hunk ./scripts/enjitqueuehandler.php 37
--	
--	function transport() {
--		return 'enjit';
--	}
-+    
-+    function transport() {
-+        return 'enjit';
-+    }
-hunk ./scripts/enjitqueuehandler.php 42
--	function start() {
-+    function start() {
-hunk ./scripts/enjitqueuehandler.php 45
--		return true;
--	}
-+        return true;
-+    }
-hunk ./scripts/enjitqueuehandler.php 48
--	function handle_notice($notice) {
-+    function handle_notice($notice) {
-hunk ./scripts/enjitqueuehandler.php 50
--		$profile = Profile::staticGet($notice->profile_id);
-+        $profile = Profile::staticGet($notice->profile_id);
-hunk ./scripts/enjitqueuehandler.php 63
--		$noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
--		$msg = $profile->nickname . ': ' . $notice->content;
-+        $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
-+        $msg = $profile->nickname . ': ' . $notice->content;
-hunk ./scripts/enjitqueuehandler.php 66
--		$atom  = "<entry xmlns='http://www.w3.org/2005/Atom'>\n";
--		$atom .= "<apisource>".common_config('enjit','source')."</apisource>\n";
--		$atom .= "<source>\n";
--		$atom .= "<title>" . $profile->nickname . " - " . common_config('site', 'name') . "</title>\n";
--		$atom .= "<link href='" . $profile->profileurl . "'/>\n";
--		$atom .= "<link rel='self' type='application/rss+xml' href='" . common_local_url('userrss', array('nickname' => $profile->nickname)) . "'/>\n";
--		$atom .= "<author><name>" . $profile->nickname . "</name></author>\n";
--		$atom .= "<icon>" . common_profile_avatar_url($profile, AVATAR_PROFILE_SIZE) . "</icon>\n";
--		$atom .= "</source>\n";
--		$atom .= "<title>" . htmlspecialchars($msg) . "</title>\n";
--		$atom .= "<summary>" . htmlspecialchars($msg) . "</summary>\n";
--		$atom .= "<link rel='alternate' href='" . $noticeurl . "' />\n";
--		$atom .= "<id>". $notice->uri . "</id>\n";
--		$atom .= "<published>".common_date_w3dtf($notice->created)."</published>\n";
--		$atom .= "<updated>".common_date_w3dtf($notice->modified)."</updated>\n";
--		$atom .= "</entry>\n";
-+        $atom  = "<entry xmlns='http://www.w3.org/2005/Atom'>\n";
-+        $atom .= "<apisource>".common_config('enjit','source')."</apisource>\n";
-+        $atom .= "<source>\n";
-+        $atom .= "<title>" . $profile->nickname . " - " . common_config('site', 'name') . "</title>\n";
-+        $atom .= "<link href='" . $profile->profileurl . "'/>\n";
-+        $atom .= "<link rel='self' type='application/rss+xml' href='" . common_local_url('userrss', array('nickname' => $profile->nickname)) . "'/>\n";
-+        $atom .= "<author><name>" . $profile->nickname . "</name></author>\n";
-+        $atom .= "<icon>" . common_profile_avatar_url($profile, AVATAR_PROFILE_SIZE) . "</icon>\n";
-+        $atom .= "</source>\n";
-+        $atom .= "<title>" . htmlspecialchars($msg) . "</title>\n";
-+        $atom .= "<summary>" . htmlspecialchars($msg) . "</summary>\n";
-+        $atom .= "<link rel='alternate' href='" . $noticeurl . "' />\n";
-+        $atom .= "<id>". $notice->uri . "</id>\n";
-+        $atom .= "<published>".common_date_w3dtf($notice->created)."</published>\n";
-+        $atom .= "<updated>".common_date_w3dtf($notice->modified)."</updated>\n";
-+        $atom .= "</entry>\n";
-hunk ./scripts/enjitqueuehandler.php 89
--		$ch   = curl_init();
-+        $ch   = curl_init();
-hunk ./scripts/enjitqueuehandler.php 91
--		curl_setopt($ch, CURLOPT_URL, $url);
-+        curl_setopt($ch, CURLOPT_URL, $url);
-hunk ./scripts/enjitqueuehandler.php 94
--		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
--		curl_setopt($ch, CURLOPT_POST, 1) ;
--		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
-+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-+        curl_setopt($ch, CURLOPT_POST, 1) ;
-+        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
-hunk ./scripts/enjitqueuehandler.php 100
--		# curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
--		# curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
-+        # curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
-+        # curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
-hunk ./scripts/enjitqueuehandler.php 104
--		$result = curl_exec($ch);
-+        $result = curl_exec($ch);
-hunk ./scripts/enjitqueuehandler.php 106
--		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE );
-+        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE );
-hunk ./scripts/enjitqueuehandler.php 110
--		curl_close($ch);
-+        curl_close($ch);
-hunk ./scripts/enjitqueuehandler.php 113
--	}
--	
-+    }
-+    
-hunk ./scripts/enjitqueuehandler.php 125
--	$handler->handle_queue();
-+    $handler->handle_queue();
-hunk ./scripts/fixup_hashtags.php 40
--	$original = clone($notice);
--	$notice->rendered = common_render_content($notice->content, $notice);
--	$result = $notice->update($original);
--	if (!$result) {
--		common_log_db_error($notice, 'UPDATE', __FILE__);
--	}
-+    $original = clone($notice);
-+    $notice->rendered = common_render_content($notice->content, $notice);
-+    $result = $notice->update($original);
-+    if (!$result) {
-+        common_log_db_error($notice, 'UPDATE', __FILE__);
-+    }
-hunk ./scripts/fixup_inboxes.php 44
--	$user->whereAdd('id >= ' . $start_at);
-+    $user->whereAdd('id >= ' . $start_at);
-hunk ./scripts/fixup_inboxes.php 52
--	$user->query('BEGIN');
--	$inbox = new Notice_inbox();
--	$result = $inbox->query('INSERT LOW_PRIORITY INTO notice_inbox (user_id, notice_id, created) ' .
--							'SELECT ' . $user->id . ', notice.id, notice.created ' .
--							'FROM subscription JOIN notice ON subscription.subscribed = notice.profile_id ' .
--							'WHERE subscription.subscriber = ' . $user->id . ' ' .
--							'AND notice.created >= subscription.created ' . 
--							'AND NOT EXISTS (SELECT user_id, notice_id ' .
--							'FROM notice_inbox ' .
--							'WHERE user_id = ' . $user->id . ' ' . 
--							'AND notice_id = notice.id)');
--	if (is_null($result) || $result === false) {
--		common_log_db_error($inbox, 'INSERT', __FILE__);
--		continue;
--	}
--	$orig = clone($user);
--	$user->inboxed = 1;
--	$result = $user->update($orig);
--	if (!$result) {
--		common_log_db_error($user, 'UPDATE', __FILE__);
--		continue;
--	}
--	$user->query('COMMIT');
--	$inbox->free();
--	unset($inbox);
--	if ($cache) {
--		$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
--	}
-+    $user->query('BEGIN');
-+    $inbox = new Notice_inbox();
-+    $result = $inbox->query('INSERT LOW_PRIORITY INTO notice_inbox (user_id, notice_id, created) ' .
-+                            'SELECT ' . $user->id . ', notice.id, notice.created ' .
-+                            'FROM subscription JOIN notice ON subscription.subscribed = notice.profile_id ' .
-+                            'WHERE subscription.subscriber = ' . $user->id . ' ' .
-+                            'AND notice.created >= subscription.created ' . 
-+                            'AND NOT EXISTS (SELECT user_id, notice_id ' .
-+                            'FROM notice_inbox ' .
-+                            'WHERE user_id = ' . $user->id . ' ' . 
-+                            'AND notice_id = notice.id)');
-+    if (is_null($result) || $result === false) {
-+        common_log_db_error($inbox, 'INSERT', __FILE__);
-+        continue;
-+    }
-+    $orig = clone($user);
-+    $user->inboxed = 1;
-+    $result = $user->update($orig);
-+    if (!$result) {
-+        common_log_db_error($user, 'UPDATE', __FILE__);
-+        continue;
-+    }
-+    $user->query('COMMIT');
-+    $inbox->free();
-+    unset($inbox);
-+    if ($cache) {
-+        $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
-+    }
-hunk ./scripts/fixup_notices_rendered.php 23
--	print "This script must be run from the command line\n";
--	exit();
-+    print "This script must be run from the command line\n";
-+    exit();
-hunk ./scripts/fixup_notices_rendered.php 38
--	$notice->whereAdd('id >= ' . $start_at);
-+    $notice->whereAdd('id >= ' . $start_at);
-hunk ./scripts/fixup_notices_rendered.php 43
--	common_log(LOG_INFO, 'Pre-rendering notice #' . $notice->id);
--	$original = clone($notice);
--	$notice->rendered = common_render_content($notice->content, $notice);
--	$result = $notice->update($original);
--	if (!$result) {
--		common_log_db_error($notice, 'UPDATE', __FILE__);
--	}
-+    common_log(LOG_INFO, 'Pre-rendering notice #' . $notice->id);
-+    $original = clone($notice);
-+    $notice->rendered = common_render_content($notice->content, $notice);
-+    $result = $notice->update($original);
-+    if (!$result) {
-+        common_log_db_error($notice, 'UPDATE', __FILE__);
-+    }
-hunk ./scripts/getpiddir.php 23
--	print "This script must be run from the command line\n";
--	exit();
-+    print "This script must be run from the command line\n";
-+    exit();
-hunk ./scripts/inbox_users.php 45
--	
--	$user = User::staticGet('id', $id);
-+    
-+    $user = User::staticGet('id', $id);
-hunk ./scripts/inbox_users.php 48
--	if (!$user) {
--		common_log(LOG_WARNING, 'No such user: ' . $id);
--		continue;
--	}
--	
--	if ($user->inboxed) {
--		common_log(LOG_WARNING, 'Already inboxed: ' . $id);
--		continue;
--	}
--	
-+    if (!$user) {
-+        common_log(LOG_WARNING, 'No such user: ' . $id);
-+        continue;
-+    }
-+    
-+    if ($user->inboxed) {
-+        common_log(LOG_WARNING, 'Already inboxed: ' . $id);
-+        continue;
-+    }
-+    
-hunk ./scripts/inbox_users.php 59
--	
--	$user->query('BEGIN');
--	
--	$old_inbox = new Notice_inbox();
--	$old_inbox->user_id = $user->id;
--	
--	$result = $old_inbox->delete();
--	
--	if (is_null($result) || $result === false) {
--		common_log_db_error($old_inbox, 'DELETE', __FILE__);
--		continue;
--	}
-+    
-+    $user->query('BEGIN');
-+    
-+    $old_inbox = new Notice_inbox();
-+    $old_inbox->user_id = $user->id;
-+    
-+    $result = $old_inbox->delete();
-+    
-+    if (is_null($result) || $result === false) {
-+        common_log_db_error($old_inbox, 'DELETE', __FILE__);
-+        continue;
-+    }
-hunk ./scripts/inbox_users.php 72
--	$old_inbox->free();
--	
--	$inbox = new Notice_inbox();
--	
--	$result = $inbox->query('INSERT INTO notice_inbox (user_id, notice_id, created) ' .
--							'SELECT ' . $user->id . ', notice.id, notice.created ' .
--							'FROM subscription JOIN notice ON subscription.subscribed = notice.profile_id ' .
--							'WHERE subscription.subscriber = ' . $user->id . ' ' .
--							'AND notice.created >= subscription.created ' .
--							'AND now() - notice.created < ' . (7 * 24 * 3600) . ' ' .
--							'AND NOT EXISTS (SELECT user_id, notice_id ' .
--							'FROM notice_inbox ' .
--							'WHERE user_id = ' . $user->id . ' ' . 
--							'AND notice_id = notice.id)');
--	
--	if (is_null($result) || $result === false) {
--		common_log_db_error($inbox, 'INSERT', __FILE__);
--		continue;
--	}
--	
--	$orig = clone($user);
--	$user->inboxed = 1;
--	$result = $user->update($orig);
--	
--	if (!$result) {
--		common_log_db_error($user, 'UPDATE', __FILE__);
--		continue;
--	}
--	
--	$user->query('COMMIT');
--	
--	$inbox->free();
--	unset($inbox);
--	
--	if ($cache) {
--		$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
--	}
-+    $old_inbox->free();
-+    
-+    $inbox = new Notice_inbox();
-+    
-+    $result = $inbox->query('INSERT INTO notice_inbox (user_id, notice_id, created) ' .
-+                            'SELECT ' . $user->id . ', notice.id, notice.created ' .
-+                            'FROM subscription JOIN notice ON subscription.subscribed = notice.profile_id ' .
-+                            'WHERE subscription.subscriber = ' . $user->id . ' ' .
-+                            'AND notice.created >= subscription.created ' .
-+                            'AND now() - notice.created < ' . (7 * 24 * 3600) . ' ' .
-+                            'AND NOT EXISTS (SELECT user_id, notice_id ' .
-+                            'FROM notice_inbox ' .
-+                            'WHERE user_id = ' . $user->id . ' ' . 
-+                            'AND notice_id = notice.id)');
-+    
-+    if (is_null($result) || $result === false) {
-+        common_log_db_error($inbox, 'INSERT', __FILE__);
-+        continue;
-+    }
-+    
-+    $orig = clone($user);
-+    $user->inboxed = 1;
-+    $result = $user->update($orig);
-+    
-+    if (!$result) {
-+        common_log_db_error($user, 'UPDATE', __FILE__);
-+        continue;
-+    }
-+    
-+    $user->query('COMMIT');
-+    
-+    $inbox->free();
-+    unset($inbox);
-+    
-+    if ($cache) {
-+        $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
-+    }
-hunk ./scripts/jabberqueuehandler.php 23
--	print "This script must be run from the command line\n";
--	exit();
-+    print "This script must be run from the command line\n";
-+    exit();
+-    function get_user($id, $apidata=NULL) {
++    function get_user($id, $apidata=null) {
+hunk ./lib/twitterapi.php 559
+-                return NULL;
++                return null;
+hunk ./lib/xmppqueuehandler.php 41
+-            jabber_send_presence("Send me a message to post a notice", 'available', NULL, 'available', -1);
++            jabber_send_presence("Send me a message to post a notice", 'available', null, 'available', -1);
+hunk ./lib/xmppqueuehandler.php 48
+-        $this->conn->presence(NULL, 'available', NULL, 'available', -1);
++        $this->conn->presence(null, 'available', null, 'available', -1);
+hunk ./lib/xmppqueuehandler.php 74
+-        $this->conn->message($this->listener(), $pl['body'], 'chat', NULL, $this->ofrom($pl['from']));
++        $this->conn->message($this->listener(), $pl['body'], 'chat', null, $this->ofrom($pl['from']));
+hunk ./scripts/enjitqueuehandler.php 120
+-$id = ($argc > 1) ? $argv[1] : NULL;
++$id = ($argc > 1) ? $argv[1] : null;
+hunk ./scripts/fixup_inboxes.php 37
+-$start_at = ($argc > 1) ? $argv[1] : NULL;
++$start_at = ($argc > 1) ? $argv[1] : null;
+hunk ./scripts/fixup_notices_rendered.php 34
+-$start_at = ($argc > 1) ? $argv[1] : NULL;
++$start_at = ($argc > 1) ? $argv[1] : null;
 hunk ./scripts/jabberqueuehandler.php 38
--	var $conn = NULL;
-+    var $conn = NULL;
-hunk ./scripts/jabberqueuehandler.php 40
--	function transport() {
--		return 'jabber';
--	}
-+    function transport() {
-+        return 'jabber';
-+    }
-hunk ./scripts/jabberqueuehandler.php 44
--	function handle_notice($notice) {
--		try {
--			return jabber_broadcast_notice($notice);
--		} catch (XMPPHP_Exception $e) {
--			$this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
--			exit(1);
--		}
--	}
-+    function handle_notice($notice) {
-+        try {
-+            return jabber_broadcast_notice($notice);
-+        } catch (XMPPHP_Exception $e) {
-+            $this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
-+            exit(1);
-+        }
-+    }
-hunk ./scripts/maildaemon.php 23
--	print "This script must be run from the command line\n";
--	exit();
-+    print "This script must be run from the command line\n";
-+    exit();
-hunk ./scripts/maildaemon.php 39
--	function __construct() {
--	}
-+    function __construct() {
-+    }
-hunk ./scripts/maildaemon.php 42
--	function handle_message($fname='php://stdin') {
--		list($from, $to, $msg) = $this->parse_message($fname);
--		if (!$from || !$to || !$msg) {
--			$this->error(NULL, _('Could not parse message.'));
--		}
--		common_log(LOG_INFO, "Mail from $from to $to: " .substr($msg, 0, 20));
--		$user = $this->user_from($from);
--		if (!$user) {
--			$this->error($from, _('Not a registered user.'));
--			return false;
--		}
--		if (!$this->user_match_to($user, $to)) {
--			$this->error($from, _('Sorry, that is not your incoming email address.'));
--			return false;
--		}
--		if (!$user->emailpost) {
--			$this->error($from, _('Sorry, no incoming email allowed.'));
--			return false;
--		}
--		$response = $this->handle_command($user, $from, $msg);
--		if ($response) {
--			return true;
--		}
--		$msg = $this->cleanup_msg($msg);
--		$this->add_notice($user, $msg);
--	}
-+    function handle_message($fname='php://stdin') {
-+        list($from, $to, $msg) = $this->parse_message($fname);
-+        if (!$from || !$to || !$msg) {
-+            $this->error(NULL, _('Could not parse message.'));
-+        }
-+        common_log(LOG_INFO, "Mail from $from to $to: " .substr($msg, 0, 20));
-+        $user = $this->user_from($from);
-+        if (!$user) {
-+            $this->error($from, _('Not a registered user.'));
-+            return false;
-+        }
-+        if (!$this->user_match_to($user, $to)) {
-+            $this->error($from, _('Sorry, that is not your incoming email address.'));
-+            return false;
-+        }
-+        if (!$user->emailpost) {
-+            $this->error($from, _('Sorry, no incoming email allowed.'));
-+            return false;
-+        }
-+        $response = $this->handle_command($user, $from, $msg);
-+        if ($response) {
-+            return true;
-+        }
-+        $msg = $this->cleanup_msg($msg);
-+        $this->add_notice($user, $msg);
-+    }
-hunk ./scripts/maildaemon.php 69
--	function error($from, $msg) {
--		file_put_contents("php://stderr", $msg . "\n");
--		exit(1);
--	}
-+    function error($from, $msg) {
-+        file_put_contents("php://stderr", $msg . "\n");
-+        exit(1);
-+    }
-hunk ./scripts/maildaemon.php 74
--	function user_from($from_hdr) {
--		$froms = mailparse_rfc822_parse_addresses($from_hdr);
--		if (!$froms) {
--			return NULL;
--		}
--		$from = $froms[0];
--		$addr = common_canonical_email($from['address']);
--		$user = User::staticGet('email', $addr);
--		if (!$user) {
--			$user = User::staticGet('smsemail', $addr);
--		}
--		return $user;
--	}
-+    function user_from($from_hdr) {
-+        $froms = mailparse_rfc822_parse_addresses($from_hdr);
-+        if (!$froms) {
-+            return NULL;
-+        }
-+        $from = $froms[0];
-+        $addr = common_canonical_email($from['address']);
-+        $user = User::staticGet('email', $addr);
-+        if (!$user) {
-+            $user = User::staticGet('smsemail', $addr);
-+        }
-+        return $user;
-+    }
-hunk ./scripts/maildaemon.php 88
--	function user_match_to($user, $to_hdr) {
--		$incoming = $user->incomingemail;
--		$tos = mailparse_rfc822_parse_addresses($to_hdr);
--		foreach ($tos as $to) {
--			if (strcasecmp($incoming, $to['address']) == 0) {
--				return true;
--			}
--		}
--		return false;
--	}
-+    function user_match_to($user, $to_hdr) {
-+        $incoming = $user->incomingemail;
-+        $tos = mailparse_rfc822_parse_addresses($to_hdr);
-+        foreach ($tos as $to) {
-+            if (strcasecmp($incoming, $to['address']) == 0) {
-+                return true;
-+            }
-+        }
-+        return false;
-+    }
-hunk ./scripts/maildaemon.php 99
--	function handle_command($user, $from, $msg) {
--		$inter = new CommandInterpreter();
--		$cmd = $inter->handle_command($user, $msg);
--		if ($cmd) {
--			$cmd->execute(new MailChannel($from));
--			return true;
--		}
--		return false;
--	}
-+    function handle_command($user, $from, $msg) {
-+        $inter = new CommandInterpreter();
-+        $cmd = $inter->handle_command($user, $msg);
-+        if ($cmd) {
-+            $cmd->execute(new MailChannel($from));
-+            return true;
-+        }
-+        return false;
-+    }
-hunk ./scripts/maildaemon.php 109
--	function respond($from, $to, $response) {
-+    function respond($from, $to, $response) {
-hunk ./scripts/maildaemon.php 111
--		$headers['From'] = $to;
--		$headers['To'] = $from;
--		$headers['Subject'] = "Command complete";
-+        $headers['From'] = $to;
-+        $headers['To'] = $from;
-+        $headers['Subject'] = "Command complete";
-hunk ./scripts/maildaemon.php 115
--		return mail_send(array($from), $headers, $response);
--	}
-+        return mail_send(array($from), $headers, $response);
-+    }
-hunk ./scripts/maildaemon.php 118
--	function log($level, $msg) {
--		common_log($level, 'MailDaemon: '.$msg);
--	}
-+    function log($level, $msg) {
-+        common_log($level, 'MailDaemon: '.$msg);
-+    }
-hunk ./scripts/maildaemon.php 122
--	function add_notice($user, $msg) {
-+    function add_notice($user, $msg) {
-hunk ./scripts/maildaemon.php 126
--		$notice = Notice::saveNew($user->id, $msg, 'mail');
--		if (is_string($notice)) {
--			$this->log(LOG_ERR, $notice);
--			return;
--		}
--		common_broadcast_notice($notice);
--		$this->log(LOG_INFO,
--				   'Added notice ' . $notice->id . ' from user ' . $user->nickname);
--	}
-+        $notice = Notice::saveNew($user->id, $msg, 'mail');
-+        if (is_string($notice)) {
-+            $this->log(LOG_ERR, $notice);
-+            return;
-+        }
-+        common_broadcast_notice($notice);
-+        $this->log(LOG_INFO,
-+                   'Added notice ' . $notice->id . ' from user ' . $user->nickname);
-+    }
-hunk ./scripts/maildaemon.php 136
--	function parse_message($fname) {
--		$contents = file_get_contents($fname);
--		$parsed = Mail_mimeDecode::decode(array('input' => $contents,
--												'include_bodies' => true,
--												'decode_headers' => true,
--												'decode_bodies' => true));
--		if (!$parsed) {
--			return NULL;
--		}
-+    function parse_message($fname) {
-+        $contents = file_get_contents($fname);
-+        $parsed = Mail_mimeDecode::decode(array('input' => $contents,
-+                                                'include_bodies' => true,
-+                                                'decode_headers' => true,
-+                                                'decode_bodies' => true));
-+        if (!$parsed) {
-+            return NULL;
-+        }
-hunk ./scripts/maildaemon.php 146
--		$from = $parsed->headers['from'];
-+        $from = $parsed->headers['from'];
-hunk ./scripts/maildaemon.php 148
--		$to = $parsed->headers['to'];
-+        $to = $parsed->headers['to'];
-hunk ./scripts/maildaemon.php 150
--		$type = $parsed->ctype_primary . '/' . $parsed->ctype_secondary;
-+        $type = $parsed->ctype_primary . '/' . $parsed->ctype_secondary;
-hunk ./scripts/maildaemon.php 152
--		if ($parsed->ctype_primary == 'multipart') {
--			foreach ($parsed->parts as $part) {
--				if ($part->ctype_primary == 'text' &&
--					$part->ctype_secondary == 'plain') {
--					$msg = $part->body;
--					break;
--				}
--			}
--		} else if ($type == 'text/plain') {
--			$msg = $parsed->body;
--		} else {
--			$this->unsupported_type($type);
--		}
-+        if ($parsed->ctype_primary == 'multipart') {
-+            foreach ($parsed->parts as $part) {
-+                if ($part->ctype_primary == 'text' &&
-+                    $part->ctype_secondary == 'plain') {
-+                    $msg = $part->body;
-+                    break;
-+                }
-+            }
-+        } else if ($type == 'text/plain') {
-+            $msg = $parsed->body;
-+        } else {
-+            $this->unsupported_type($type);
-+        }
-hunk ./scripts/maildaemon.php 166
--		return array($from, $to, $msg);
--	}
-+        return array($from, $to, $msg);
-+    }
-hunk ./scripts/maildaemon.php 169
--	function unsupported_type($type) {
--		$this->error(NULL, "Unsupported message type: " . $type);
--	}
-+    function unsupported_type($type) {
-+        $this->error(NULL, "Unsupported message type: " . $type);
-+    }
-hunk ./scripts/maildaemon.php 173
--	function cleanup_msg($msg) {
--		$lines = explode("\n", $msg);
-+    function cleanup_msg($msg) {
-+        $lines = explode("\n", $msg);
-hunk ./scripts/maildaemon.php 176
--		$output = '';
-+        $output = '';
-hunk ./scripts/maildaemon.php 178
--		foreach ($lines as $line) {
--			// skip quotes
--			if (preg_match('/^\s*>.*$/', $line)) {
--				continue;
--			}
--			// skip start of quote
--			if (preg_match('/^\s*On.*wrote:\s*$/', $line)) {
--				continue;
--			}
--			// probably interesting to someone, not us
--			if (preg_match('/^\s*Sent via/', $line)) {
--				continue;
--			}
--			// skip everything after a sig
--			if (preg_match('/^\s*--+\s*$/', $line) ||
--				preg_match('/^\s*__+\s*$/', $line))
--			{
--				break;
--			}
--			// skip everything after Outlook quote
--			if (preg_match('/^\s*-+\s*Original Message\s*-+\s*$/', $line)) {
--				break;
--			}
--			// skip everything after weird forward
--			if (preg_match('/^\s*Begin\s+forward/', $line)) {
--				break;
--			}
-+        foreach ($lines as $line) {
-+            // skip quotes
-+            if (preg_match('/^\s*>.*$/', $line)) {
-+                continue;
-+            }
-+            // skip start of quote
-+            if (preg_match('/^\s*On.*wrote:\s*$/', $line)) {
-+                continue;
-+            }
-+            // probably interesting to someone, not us
-+            if (preg_match('/^\s*Sent via/', $line)) {
-+                continue;
-+            }
-+            // skip everything after a sig
-+            if (preg_match('/^\s*--+\s*$/', $line) ||
-+                preg_match('/^\s*__+\s*$/', $line))
-+            {
-+                break;
-+            }
-+            // skip everything after Outlook quote
-+            if (preg_match('/^\s*-+\s*Original Message\s*-+\s*$/', $line)) {
-+                break;
-+            }
-+            // skip everything after weird forward
-+            if (preg_match('/^\s*Begin\s+forward/', $line)) {
-+                break;
-+            }
-hunk ./scripts/maildaemon.php 206
--			$output .= ' ' . $line;
--		}
-+            $output .= ' ' . $line;
-+        }
-hunk ./scripts/maildaemon.php 209
--		preg_replace('/\s+/', ' ', $output);
--		return trim($output);
--	}
-+        preg_replace('/\s+/', ' ', $output);
-+        return trim($output);
-+    }
-hunk ./scripts/ombqueuehandler.php 23
--	print "This script must be run from the command line\n";
--	exit();
-+    print "This script must be run from the command line\n";
-+    exit();
-hunk ./scripts/ombqueuehandler.php 37
--	
--	function transport() {
--		return 'omb';
--	}
--	
--	function start() {
--		$this->log(LOG_INFO, "INITIALIZE");
--		return true;
--	}
-+    
-+    function transport() {
-+        return 'omb';
-+    }
-+    
-+    function start() {
-+        $this->log(LOG_INFO, "INITIALIZE");
-+        return true;
-+    }
-hunk ./scripts/ombqueuehandler.php 47
--	function handle_notice($notice) {
--		if ($this->is_remote($notice)) {
--			$this->log(LOG_DEBUG, 'Ignoring remote notice ' . $notice->id);
--			return true;
--		} else {
--			return omb_broadcast_remote_subscribers($notice);
--		}
--	}
--	
--	function finish() {
--	}
-+    function handle_notice($notice) {
-+        if ($this->is_remote($notice)) {
-+            $this->log(LOG_DEBUG, 'Ignoring remote notice ' . $notice->id);
-+            return true;
-+        } else {
-+            return omb_broadcast_remote_subscribers($notice);
-+        }
-+    }
-+    
-+    function finish() {
-+    }
-hunk ./scripts/ombqueuehandler.php 59
--	function is_remote($notice) {
--		$user = User::staticGet($notice->profile_id);
--		return is_null($user);
--	}
-+    function is_remote($notice) {
-+        $user = User::staticGet($notice->profile_id);
-+        return is_null($user);
-+    }
-hunk ./scripts/publicqueuehandler.php 23
--	print "This script must be run from the command line\n";
--	exit();
-+    print "This script must be run from the command line\n";
-+    exit();
-hunk ./scripts/publicqueuehandler.php 37
--	
--	function transport() {
--		return 'public';
--	}
--	
--	function handle_notice($notice) {
--		try {
--			return jabber_public_notice($notice);
--		} catch (XMPPHP_Exception $e) {
--			$this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
--			die($e->getMessage());
--		}
--	}
-+    
-+    function transport() {
-+        return 'public';
-+    }
-+    
-+    function handle_notice($notice) {
-+        try {
-+            return jabber_public_notice($notice);
-+        } catch (XMPPHP_Exception $e) {
-+            $this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
-+            die($e->getMessage());
-+        }
-+    }
-hunk ./scripts/sitemap.php 22
--	global $output_paths;
--	$output_dir = $output_paths['output_dir'];
--	$output_url = $output_paths['output_url'];
-+    global $output_paths;
-+    $output_dir = $output_paths['output_dir'];
-+    $output_url = $output_paths['output_url'];
-hunk ./scripts/sitemap.php 26
--	foreach (glob("$output_dir*.xml") as $file_name) {
-+    foreach (glob("$output_dir*.xml") as $file_name) {
-hunk ./scripts/sitemap.php 28
--		# Just the file name please.
--		$file_name = preg_replace("|$output_dir|", '', $file_name);
-+        # Just the file name please.
-+        $file_name = preg_replace("|$output_dir|", '', $file_name);
-hunk ./scripts/sitemap.php 31
--		$index_urls .= sitemap(
--						   array(
--								 'url' => $output_url . $file_name,
--								 'changefreq' => 'daily'
--								 )
--						   );
--	}
-+        $index_urls .= sitemap(
-+                           array(
-+                                 'url' => $output_url . $file_name,
-+                                 'changefreq' => 'daily'
-+                                 )
-+                           );
-+    }
-hunk ./scripts/sitemap.php 39
--	write_file($output_paths['index_file'], sitemapindex($index_urls));
-+    write_file($output_paths['index_file'], sitemapindex($index_urls));
-hunk ./scripts/sitemap.php 44
--	global $output_paths;
-+    global $output_paths;
-hunk ./scripts/sitemap.php 46
--	$standard_map_urls .= url(
--							  array(
--									'url' => common_local_url('public'),
--									'changefreq' => 'daily',
--									'priority' => '1',
--									)
--							  );
-+    $standard_map_urls .= url(
-+                              array(
-+                                    'url' => common_local_url('public'),
-+                                    'changefreq' => 'daily',
-+                                    'priority' => '1',
-+                                    )
-+                              );
-hunk ./scripts/sitemap.php 54
--	$standard_map_urls .= url(
--							  array(
--									'url' => common_local_url('publicrss'),
--									'changefreq' => 'daily',
--									'priority' => '0.3',
--									)
--							  );
-+    $standard_map_urls .= url(
-+                              array(
-+                                    'url' => common_local_url('publicrss'),
-+                                    'changefreq' => 'daily',
-+                                    'priority' => '0.3',
-+                                    )
-+                              );
-hunk ./scripts/sitemap.php 62
--	$docs = array('about', 'faq', 'contact', 'im', 'openid', 'openmublog', 'privacy', 'source');
-+    $docs = array('about', 'faq', 'contact', 'im', 'openid', 'openmublog', 'privacy', 'source');
-hunk ./scripts/sitemap.php 64
--	foreach($docs as $title) {
--		$standard_map_urls .= url(
--								  array(
--										'url' => common_local_url('doc', array('title' => $title)),
--										'changefreq' => 'monthly',
--										'priority'   => '0.2',
--										)
--								  );
--	}
-+    foreach($docs as $title) {
-+        $standard_map_urls .= url(
-+                                  array(
-+                                        'url' => common_local_url('doc', array('title' => $title)),
-+                                        'changefreq' => 'monthly',
-+                                        'priority'   => '0.2',
-+                                        )
-+                                  );
-+    }
-hunk ./scripts/sitemap.php 74
--	$urlset_path = $output_paths['output_dir'] . 'standard.xml';
-+    $urlset_path = $output_paths['output_dir'] . 'standard.xml';
-hunk ./scripts/sitemap.php 76
--	write_file($urlset_path, urlset($standard_map_urls));
-+    write_file($urlset_path, urlset($standard_map_urls));
-hunk ./scripts/sitemap.php 81
--	global $output_paths;
-+    global $output_paths;
-hunk ./scripts/sitemap.php 83
--	$notices = DB_DataObject::factory('notice');
-+    $notices = DB_DataObject::factory('notice');
-hunk ./scripts/sitemap.php 85
--	$notices->query('SELECT id, uri, url, modified FROM notice where is_local = 1');
-+    $notices->query('SELECT id, uri, url, modified FROM notice where is_local = 1');
-hunk ./scripts/sitemap.php 87
--	$notice_count = 0;
--	$map_count = 1;
-+    $notice_count = 0;
-+    $map_count = 1;
-hunk ./scripts/sitemap.php 90
--	while ($notices->fetch()) {
-+    while ($notices->fetch()) {
-hunk ./scripts/sitemap.php 92
--		# Maximum 50,000 URLs per sitemap file.
--		if ($notice_count == 50000) {
--			$notice_count = 0;
--			$map_count++;
--		}
-+        # Maximum 50,000 URLs per sitemap file.
-+        if ($notice_count == 50000) {
-+            $notice_count = 0;
-+            $map_count++;
-+        }
-hunk ./scripts/sitemap.php 98
--		# remote notices have an URL
--		
--		if (!$notices->url && $notices->uri) {
--			$notice = array(
--						'url'        => ($notices->uri) ? $notices->uri : common_local_url('shownotice', array('notice' => $notices->id)),
--						'lastmod'    => common_date_w3dtf($notices->modified),
--						'changefreq' => 'never',
--						'priority'   => '1',
--						);
-+        # remote notices have an URL
-+        
-+        if (!$notices->url && $notices->uri) {
-+            $notice = array(
-+                        'url'        => ($notices->uri) ? $notices->uri : common_local_url('shownotice', array('notice' => $notices->id)),
-+                        'lastmod'    => common_date_w3dtf($notices->modified),
-+                        'changefreq' => 'never',
-+                        'priority'   => '1',
-+                        );
-hunk ./scripts/sitemap.php 108
--			$notice_list[$map_count] .= url($notice);
--			$notice_count++;
--		}
--	}
-+            $notice_list[$map_count] .= url($notice);
-+            $notice_count++;
-+        }
-+    }
-hunk ./scripts/sitemap.php 113
--	# Make full sitemaps from the lists and save them.
--	array_to_map($notice_list, 'notice');
-+    # Make full sitemaps from the lists and save them.
-+    array_to_map($notice_list, 'notice');
-hunk ./scripts/sitemap.php 119
--	global $output_paths;
-+    global $output_paths;
-hunk ./scripts/sitemap.php 121
--	$users = DB_DataObject::factory('user');
-+    $users = DB_DataObject::factory('user');
-hunk ./scripts/sitemap.php 123
--	$users->query('SELECT id, nickname FROM user');
-+    $users->query('SELECT id, nickname FROM user');
-hunk ./scripts/sitemap.php 125
--	$user_count = 0;
--	$map_count = 1;
-+    $user_count = 0;
-+    $map_count = 1;
-hunk ./scripts/sitemap.php 128
--	while ($users->fetch()) {
-+    while ($users->fetch()) {
-hunk ./scripts/sitemap.php 130
--		# Maximum 50,000 URLs per sitemap file.
--		if ($user_count == 50000) {
--			$user_count = 0;
--			$map_count++;
--		}
-+        # Maximum 50,000 URLs per sitemap file.
-+        if ($user_count == 50000) {
-+            $user_count = 0;
-+            $map_count++;
-+        }
-hunk ./scripts/sitemap.php 136
--		$user_args = array('nickname' => $users->nickname);
-+        $user_args = array('nickname' => $users->nickname);
-hunk ./scripts/sitemap.php 138
--		# Define parameters for generating <url></url> elements.
--		$user = array(
--					  'url'        => common_local_url('showstream', $user_args),
--					  'changefreq' => 'daily',
--					  'priority'   => '1',
--					  );
-+        # Define parameters for generating <url></url> elements.
-+        $user = array(
-+                      'url'        => common_local_url('showstream', $user_args),
-+                      'changefreq' => 'daily',
-+                      'priority'   => '1',
-+                      );
-hunk ./scripts/sitemap.php 145
--		$user_rss = array(
--						  'url'        => common_local_url('userrss', $user_args),
--						  'changefreq' => 'daily',
--						  'priority'   => '0.3',
--						  );
-+        $user_rss = array(
-+                          'url'        => common_local_url('userrss', $user_args),
-+                          'changefreq' => 'daily',
-+                          'priority'   => '0.3',
-+                          );
-hunk ./scripts/sitemap.php 151
--		$all = array(
--					 'url'        => common_local_url('all', $user_args),
--					 'changefreq' => 'daily',
--					 'priority'   => '1',
--					 );
-+        $all = array(
-+                     'url'        => common_local_url('all', $user_args),
-+                     'changefreq' => 'daily',
-+                     'priority'   => '1',
-+                     );
-hunk ./scripts/sitemap.php 157
--		$all_rss = array(
--						 'url'        => common_local_url('allrss', $user_args),
--						 'changefreq' => 'daily',
--						 'priority'   => '0.3',
--						 );
-+        $all_rss = array(
-+                         'url'        => common_local_url('allrss', $user_args),
-+                         'changefreq' => 'daily',
-+                         'priority'   => '0.3',
-+                         );
-hunk ./scripts/sitemap.php 163
--		$replies = array(
--						 'url'        => common_local_url('replies', $user_args),
--						 'changefreq' => 'daily',
--						 'priority'   => '1',
--						 );
-+        $replies = array(
-+                         'url'        => common_local_url('replies', $user_args),
-+                         'changefreq' => 'daily',
-+                         'priority'   => '1',
-+                         );
-hunk ./scripts/sitemap.php 169
--		$replies_rss = array(
--							 'url'        => common_local_url('repliesrss', $user_args),
--							 'changefreq' => 'daily',
--							 'priority'   => '0.3',
--							 );
-+        $replies_rss = array(
-+                             'url'        => common_local_url('repliesrss', $user_args),
-+                             'changefreq' => 'daily',
-+                             'priority'   => '0.3',
-+                             );
-hunk ./scripts/sitemap.php 175
--		$foaf = array(
--					  'url'        => common_local_url('foaf', $user_args),
--					  'changefreq' => 'weekly',
--					  'priority'   => '0.5',
--					  );
-+        $foaf = array(
-+                      'url'        => common_local_url('foaf', $user_args),
-+                      'changefreq' => 'weekly',
-+                      'priority'   => '0.5',
-+                      );
-hunk ./scripts/sitemap.php 181
--		# Construct a <url></url> element for each user facet and add it
--		# to our existing list of those.
--		$user_list[$map_count]        .= url($user);
--		$user_rss_list[$map_count]    .= url($user_rss);
--		$all_list[$map_count]         .= url($all);
--		$all_rss_list[$map_count]     .= url($all_rss);
--		$replies_list[$map_count]     .= url($replies);
--		$replies_rss_list[$map_count] .= url($replies_rss);
--		$foaf_list[$map_count]        .= url($foaf);
-+        # Construct a <url></url> element for each user facet and add it
-+        # to our existing list of those.
-+        $user_list[$map_count]        .= url($user);
-+        $user_rss_list[$map_count]    .= url($user_rss);
-+        $all_list[$map_count]         .= url($all);
-+        $all_rss_list[$map_count]     .= url($all_rss);
-+        $replies_list[$map_count]     .= url($replies);
-+        $replies_rss_list[$map_count] .= url($replies_rss);
-+        $foaf_list[$map_count]        .= url($foaf);
-hunk ./scripts/sitemap.php 191
--		$user_count++;
--	}
-+        $user_count++;
-+    }
-hunk ./scripts/sitemap.php 194
--	# Make full sitemaps from the lists and save them.
--	# Possible factoring: put all the lists into a master array, thus allowing
--	# calling with single argument (i.e., array_to_map('user')).
--	array_to_map($user_list, 'user');
--	array_to_map($user_rss_list, 'user_rss');
--	array_to_map($all_list, 'all');
--	array_to_map($all_rss_list, 'all_rss');
--	array_to_map($replies_list, 'replies');
--	array_to_map($replies_rss_list, 'replies_rss');
--	array_to_map($foaf_list, 'foaf');
-+    # Make full sitemaps from the lists and save them.
-+    # Possible factoring: put all the lists into a master array, thus allowing
-+    # calling with single argument (i.e., array_to_map('user')).
-+    array_to_map($user_list, 'user');
-+    array_to_map($user_rss_list, 'user_rss');
-+    array_to_map($all_list, 'all');
-+    array_to_map($all_rss_list, 'all_rss');
-+    array_to_map($replies_list, 'replies');
-+    array_to_map($replies_rss_list, 'replies_rss');
-+    array_to_map($foaf_list, 'foaf');
-hunk ./scripts/sitemap.php 212
--	$url        = preg_replace('/&/', '&amp;', $url_args['url']); # escape ampersands for XML
--	$lastmod    = $url_args['lastmod'];
--	$changefreq = $url_args['changefreq'];
--	$priority   = $url_args['priority'];
-+    $url        = preg_replace('/&/', '&amp;', $url_args['url']); # escape ampersands for XML
-+    $lastmod    = $url_args['lastmod'];
-+    $changefreq = $url_args['changefreq'];
-+    $priority   = $url_args['priority'];
-hunk ./scripts/sitemap.php 217
--	if (is_null($url)) {
--		error("url() arguments require 'url' value.");
--	}
-+    if (is_null($url)) {
-+        error("url() arguments require 'url' value.");
-+    }
-hunk ./scripts/sitemap.php 221
--	$url_out = "\t<url>\n";
--	$url_out .= "\t\t<loc>$url</loc>\n";
-+    $url_out = "\t<url>\n";
-+    $url_out .= "\t\t<loc>$url</loc>\n";
-hunk ./scripts/sitemap.php 224
--	if ($changefreq) {
--		$url_out .= "\t\t<changefreq>$changefreq</changefreq>\n";
--	}
-+    if ($changefreq) {
-+        $url_out .= "\t\t<changefreq>$changefreq</changefreq>\n";
-+    }
-hunk ./scripts/sitemap.php 228
--	if ($lastmod) {
--		$url_out .= "\t\t<lastmod>$lastmod</lastmod>\n";
--	}
-+    if ($lastmod) {
-+        $url_out .= "\t\t<lastmod>$lastmod</lastmod>\n";
-+    }
-hunk ./scripts/sitemap.php 232
--	if ($priority) {
--		$url_out .= "\t\t<priority>$priority</priority>\n";
--	}
-+    if ($priority) {
-+        $url_out .= "\t\t<priority>$priority</priority>\n";
-+    }
-hunk ./scripts/sitemap.php 236
--	$url_out .= "\t</url>\n";
-+    $url_out .= "\t</url>\n";
-hunk ./scripts/sitemap.php 238
--	return $url_out;
-+    return $url_out;
-hunk ./scripts/sitemap.php 242
--	$url        = preg_replace('/&/', '&amp;', $sitemap_args['url']); # escape ampersands for XML
--	$lastmod    = $sitemap_args['lastmod'];
-+    $url        = preg_replace('/&/', '&amp;', $sitemap_args['url']); # escape ampersands for XML
-+    $lastmod    = $sitemap_args['lastmod'];
-hunk ./scripts/sitemap.php 245
--	if (is_null($url)) {
--		error("url() arguments require 'url' value.");
--	}
-+    if (is_null($url)) {
-+        error("url() arguments require 'url' value.");
-+    }
-hunk ./scripts/sitemap.php 249
--	$sitemap_out = "\t<sitemap>\n";
--	$sitemap_out .= "\t\t<loc>$url</loc>\n";
-+    $sitemap_out = "\t<sitemap>\n";
-+    $sitemap_out .= "\t\t<loc>$url</loc>\n";
-hunk ./scripts/sitemap.php 252
--	if ($lastmod) {
--		$sitemap_out .= "\t\t<lastmod>$lastmod</lastmod>\n";
--	}
-+    if ($lastmod) {
-+        $sitemap_out .= "\t\t<lastmod>$lastmod</lastmod>\n";
-+    }
-hunk ./scripts/sitemap.php 256
--	$sitemap_out .= "\t</sitemap>\n";
-+    $sitemap_out .= "\t</sitemap>\n";
-hunk ./scripts/sitemap.php 258
--	return $sitemap_out;
-+    return $sitemap_out;
-hunk ./scripts/sitemap.php 263
--	$urlset = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
--	  '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" .
--	  $urlset_text .
--	  '</urlset>';
-+    $urlset = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
-+      '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" .
-+      $urlset_text .
-+      '</urlset>';
-hunk ./scripts/sitemap.php 268
--	return $urlset;
-+    return $urlset;
-hunk ./scripts/sitemap.php 273
--	$sitemapindex = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
--	  '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" .
--	  $sitemapindex_text .
--	  '</sitemapindex>';
-+    $sitemapindex = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
-+      '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" .
-+      $sitemapindex_text .
-+      '</sitemapindex>';
-hunk ./scripts/sitemap.php 278
--	return $sitemapindex;
-+    return $sitemapindex;
-hunk ./scripts/sitemap.php 283
--	global $output_paths;
-+    global $output_paths;
-hunk ./scripts/sitemap.php 285
--	if ($url_list) {
--		# $map_urls is a long string containing concatenated <url></url> elements.
--		while (list($map_idx, $map_urls) = each($url_list)) {
--			$urlset_path = $output_paths['output_dir'] . "$filename_prefix-$map_idx.xml";
--			
--			write_file($urlset_path, urlset($map_urls));
--		}
--	}
-+    if ($url_list) {
-+        # $map_urls is a long string containing concatenated <url></url> elements.
-+        while (list($map_idx, $map_urls) = each($url_list)) {
-+            $urlset_path = $output_paths['output_dir'] . "$filename_prefix-$map_idx.xml";
-+            
-+            write_file($urlset_path, urlset($map_urls));
-+        }
-+    }
-hunk ./scripts/sitemap.php 301
--	$args = getopt('f:d:u:');
-+    $args = getopt('f:d:u:');
-hunk ./scripts/sitemap.php 303
--	if (is_null($args[f]) && is_null($args[d]) && is_null($args[u])) {
--		error('Mandatory arguments: -f <index file path> -d <output directory path> -u <URL of sitemaps directory>');
--	}
-+    if (is_null($args[f]) && is_null($args[d]) && is_null($args[u])) {
-+        error('Mandatory arguments: -f <index file path> -d <output directory path> -u <URL of sitemaps directory>');
-+    }
-hunk ./scripts/sitemap.php 307
--	if (is_null($args[f])) {
--		error('You must specify an index file name with the -f option.');
--	}
-+    if (is_null($args[f])) {
-+        error('You must specify an index file name with the -f option.');
-+    }
-hunk ./scripts/sitemap.php 311
--	if (is_null($args[d])) {
--		error('You must specify a directory for the output file with the -d option.');
--	}
-+    if (is_null($args[d])) {
-+        error('You must specify a directory for the output file with the -d option.');
-+    }
-hunk ./scripts/sitemap.php 315
--	if (is_null($args[u])) {
--		error('You must specify a URL for the directory where the sitemaps will be kept with the -u option.');
--	}
-+    if (is_null($args[u])) {
-+        error('You must specify a URL for the directory where the sitemaps will be kept with the -u option.');
-+    }
-hunk ./scripts/sitemap.php 319
--	$index_file = $args[f];
--	$output_dir = $args[d];
--	$output_url = $args[u];
-+    $index_file = $args[f];
-+    $output_dir = $args[d];
-+    $output_url = $args[u];
-hunk ./scripts/sitemap.php 323
--	if (file_exists($output_dir)) {
--		if (is_writable($output_dir) === FALSE) {
--			error("$output_dir is not writable.");
--		}
--	}	 else {
--		error("output directory $output_dir does not exist.");
--	}
-+    if (file_exists($output_dir)) {
-+        if (is_writable($output_dir) === FALSE) {
-+            error("$output_dir is not writable.");
-+        }
-+    }     else {
-+        error("output directory $output_dir does not exist.");
-+    }
-hunk ./scripts/sitemap.php 331
--	$paths = array(
--				   'index_file' => $index_file,
--				   'output_dir' => trailing_slash($output_dir),
--				   'output_url' => trailing_slash($output_url),
--				   );
-+    $paths = array(
-+                   'index_file' => $index_file,
-+                   'output_dir' => trailing_slash($output_dir),
-+                   'output_url' => trailing_slash($output_url),
-+                   );
-hunk ./scripts/sitemap.php 337
--	return $paths;
-+    return $paths;
-hunk ./scripts/sitemap.php 342
--	if (preg_match('/\/$/', $path) == 0) {
--		$path .= '/';
--	}
-+    if (preg_match('/\/$/', $path) == 0) {
-+        $path .= '/';
-+    }
-hunk ./scripts/sitemap.php 346
--	return $path;
-+    return $path;
-hunk ./scripts/sitemap.php 351
--	if (is_null($path)) {
--		error('No path specified for writing to.');
--	}	 elseif (is_null($data)) {
--		error('No data specified for writing.');
--	}
-+    if (is_null($path)) {
-+        error('No path specified for writing to.');
-+    }     elseif (is_null($data)) {
-+        error('No data specified for writing.');
-+    }
-hunk ./scripts/sitemap.php 357
--	if (($fh_out = fopen($path,'w')) === FALSE) {
--		error("couldn't open $path for writing.");
--	}
-+    if (($fh_out = fopen($path,'w')) === FALSE) {
-+        error("couldn't open $path for writing.");
-+    }
-hunk ./scripts/sitemap.php 361
--	if (fwrite($fh_out, $data) === FALSE) {
--		error("couldn't write to $path.");
--	}
-+    if (fwrite($fh_out, $data) === FALSE) {
-+        error("couldn't write to $path.");
-+    }
-hunk ./scripts/sitemap.php 368
--	if (is_null($error_msg)) {
--		$error_msg = 'error() was called without any explanation!';
--	}
-+    if (is_null($error_msg)) {
-+        $error_msg = 'error() was called without any explanation!';
-+    }
-hunk ./scripts/sitemap.php 372
--	echo "Error: $error_msg\n";
--	exit(1);
-+    echo "Error: $error_msg\n";
-+    exit(1);
-hunk ./scripts/smsqueuehandler.php 23
--	print "This script must be run from the command line\n";
--	exit();
-+    print "This script must be run from the command line\n";
-+    exit();
-hunk ./scripts/smsqueuehandler.php 37
--	
--	function transport() {
--		return 'sms';
--	}
-+    
-+    function transport() {
-+        return 'sms';
-+    }
-hunk ./scripts/smsqueuehandler.php 42
--	function start() {
--		$this->log(LOG_INFO, "INITIALIZE");
--		return true;
--	}
-+    function start() {
-+        $this->log(LOG_INFO, "INITIALIZE");
-+        return true;
-+    }
-hunk ./scripts/smsqueuehandler.php 47
--	function handle_notice($notice) {
--		return mail_broadcast_notice_sms($notice);
--	}
--	
--	function finish() {
--	}
-+    function handle_notice($notice) {
-+        return mail_broadcast_notice_sms($notice);
-+    }
-+    
-+    function finish() {
-+    }
-hunk ./scripts/synctwitterfriends.php 14
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
-hunk ./scripts/synctwitterfriends.php 18
-- * along with this program.	 If not, see <http://www.gnu.org/licenses/>.
-+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
-hunk ./scripts/synctwitterfriends.php 23
--	print "This script must be run from the command line\n";
--	exit();
-+    print "This script must be run from the command line\n";
-+    exit();
-hunk ./scripts/synctwitterfriends.php 38
--	if (($flink->friendsync & FOREIGN_FRIEND_RECV) == FOREIGN_FRIEND_RECV) {
-+    if (($flink->friendsync & FOREIGN_FRIEND_RECV) == FOREIGN_FRIEND_RECV) {
-hunk ./scripts/synctwitterfriends.php 40
--		$user = User::staticGet($flink->user_id);
-+        $user = User::staticGet($flink->user_id);
-hunk ./scripts/synctwitterfriends.php 42
--		print "Updating Twitter friends for user $user->nickname ($user->id)\n";
-+        print "Updating Twitter friends for user $user->nickname ($user->id)\n";
-hunk ./scripts/synctwitterfriends.php 44
--		$fuser = $flink->getForeignUser();
-+        $fuser = $flink->getForeignUser();
-hunk ./scripts/synctwitterfriends.php 46
--		$result = save_twitter_friends($user, $fuser->id, $fuser->nickname, $flink->credentials);
-+        $result = save_twitter_friends($user, $fuser->id, $fuser->nickname, $flink->credentials);
-hunk ./scripts/synctwitterfriends.php 48
--		if ($result == false) {
--			print "Problems updating Twitter friends! Check the log.\n";
--			exit(1);
--		}
--	}
-+        if ($result == false) {
-+            print "Problems updating Twitter friends! Check the log.\n";
-+            exit(1);
-+        }
-+    }
-hunk ./scripts/update_translations.php 8
--	'da_DK' => 'http://laconi.ca/translate/download.php?file_id=23',
--	'nl_NL' => 'http://laconi.ca/translate/download.php?file_id=39',
--	'en_NZ' => 'http://laconi.ca/translate/download.php?file_id=15',
--	'eo'    => 'http://laconi.ca/translate/download.php?file_id=10',
--	'fr_FR' => 'http://laconi.ca/translate/download.php?file_id=19',
--	'de_DE' => 'http://laconi.ca/translate/download.php?file_id=18',
--	'it_IT' => 'http://laconi.ca/translate/download.php?file_id=21',
--	'ko'    => 'http://laconi.ca/translate/download.php?file_id=33',
--	'no_NB' => 'http://laconi.ca/translate/download.php?file_id=31',
--	'pt'    => 'http://laconi.ca/translate/download.php?file_id=8',
--	'pt_BR' => 'http://laconi.ca/translate/download.php?file_id=72',
--	'ru_RU' => 'http://laconi.ca/translate/download.php?file_id=26',
--	'es'    => 'http://laconi.ca/translate/download.php?file_id=9',
--	'tr_TR' => 'http://laconi.ca/translate/download.php?file_id=37',
--	'uk_UA' => 'http://laconi.ca/translate/download.php?file_id=44',
--	'he_IL' => 'http://laconi.ca/translate/download.php?file_id=71',
--	'mk_MK' => 'http://laconi.ca/translate/download.php?file_id=67',
--	'ja_JP' => 'http://laconi.ca/translate/download.php?file_id=43',
--	'cs_CZ' => 'http://laconi.ca/translate/download.php?file_id=63',
--	'ca_ES' => 'http://laconi.ca/translate/download.php?file_id=49',
--	'pl_PL' => 'http://laconi.ca/translate/download.php?file_id=51',
--	'sv_SE' => 'http://laconi.ca/translate/download.php?file_id=55'
-+    'da_DK' => 'http://laconi.ca/translate/download.php?file_id=23',
-+    'nl_NL' => 'http://laconi.ca/translate/download.php?file_id=39',
-+    'en_NZ' => 'http://laconi.ca/translate/download.php?file_id=15',
-+    'eo'    => 'http://laconi.ca/translate/download.php?file_id=10',
-+    'fr_FR' => 'http://laconi.ca/translate/download.php?file_id=19',
-+    'de_DE' => 'http://laconi.ca/translate/download.php?file_id=18',
-+    'it_IT' => 'http://laconi.ca/translate/download.php?file_id=21',
-+    'ko'    => 'http://laconi.ca/translate/download.php?file_id=33',
-+    'no_NB' => 'http://laconi.ca/translate/download.php?file_id=31',
-+    'pt'    => 'http://laconi.ca/translate/download.php?file_id=8',
-+    'pt_BR' => 'http://laconi.ca/translate/download.php?file_id=72',
-+    'ru_RU' => 'http://laconi.ca/translate/download.php?file_id=26',
-+    'es'    => 'http://laconi.ca/translate/download.php?file_id=9',
-+    'tr_TR' => 'http://laconi.ca/translate/download.php?file_id=37',
-+    'uk_UA' => 'http://laconi.ca/translate/download.php?file_id=44',
-+    'he_IL' => 'http://laconi.ca/translate/download.php?file_id=71',
-+    'mk_MK' => 'http://laconi.ca/translate/download.php?file_id=67',
-+    'ja_JP' => 'http://laconi.ca/translate/download.php?file_id=43',
-+    'cs_CZ' => 'http://laconi.ca/translate/download.php?file_id=63',
-+    'ca_ES' => 'http://laconi.ca/translate/download.php?file_id=49',
-+    'pl_PL' => 'http://laconi.ca/translate/download.php?file_id=51',
-+    'sv_SE' => 'http://laconi.ca/translate/download.php?file_id=55'
-hunk ./scripts/update_translations.php 35
--	$lcdir='locale/'.$code;
--	$msgdir=$lcdir.'/LC_MESSAGES';
--	$pofile=$msgdir.'/laconica.po';
--	$mofile=$msgdir.'/laconica.mo';
-+    $lcdir='locale/'.$code;
-+    $msgdir=$lcdir.'/LC_MESSAGES';
-+    $pofile=$msgdir.'/laconica.po';
-+    $mofile=$msgdir.'/laconica.mo';
-hunk ./scripts/update_translations.php 40
--	/* Check for an existing */
--	if (!is_dir($msgdir)) {
--		mkdir($lcdir);
--		mkdir($msgdir);
--		$existingSHA1 = '';
--	} else {
--		$existingSHA1 = file_exists($pofile) ? sha1_file($pofile) : '';
--	}
-+    /* Check for an existing */
-+    if (!is_dir($msgdir)) {
-+        mkdir($lcdir);
-+        mkdir($msgdir);
-+        $existingSHA1 = '';
-+    } else {
-+        $existingSHA1 = file_exists($pofile) ? sha1_file($pofile) : '';
-+    }
-hunk ./scripts/update_translations.php 49
--	/* Get the remote one */
--	$newFile = file_get_contents($file);
-+    /* Get the remote one */
-+    $newFile = file_get_contents($file);
-hunk ./scripts/update_translations.php 52
--	// Update if the local .po file is different to the one downloaded, or
--	// if the .mo file is not present.
--	if(sha1($newFile)!=$existingSHA1 || !file_exists($mofile)) {
--		echo "Updating ".$code."\n";
--		file_put_contents($pofile, $newFile);
--		$prevdir = getcwd();
--		chdir($msgdir);
--		system('msgmerge -U laconica.po ../../laconica.pot');
--		system('msgfmt -f -o laconica.mo laconica.po');
--		chdir($prevdir);
--	} else {
--		echo "Unchanged - ".$code."\n";
--	}
-+    // Update if the local .po file is different to the one downloaded, or
-+    // if the .mo file is not present.
-+    if(sha1($newFile)!=$existingSHA1 || !file_exists($mofile)) {
-+        echo "Updating ".$code."\n";
-+        file_put_contents($pofile, $newFile);
-+        $prevdir = getcwd();
-+        chdir($msgdir);
-+        system('msgmerge -U laconica.po ../../laconica.pot');
-+        system('msgfmt -f -o laconica.mo laconica.po');
-+        chdir($prevdir);
-+    } else {
-+        echo "Unchanged - ".$code."\n";
-+    }
-hunk ./scripts/xmppconfirmhandler.php 23
--	print "This script must be run from the command line\n";
--	exit();
-+    print "This script must be run from the command line\n";
-+    exit();
-hunk ./scripts/xmppconfirmhandler.php 40
--	var $_id = 'confirm';
--	
--	function class_name() {
--		return 'XmppConfirmHandler';
--	}
--	
--	function run() {
--		if (!$this->start()) {
--			return false;
--		}
--		$this->log(LOG_INFO, 'checking for queued confirmations');
--		do {
--			$confirm = $this->next_confirm();
--			if ($confirm) {
--				$this->log(LOG_INFO, 'Sending confirmation for ' . $confirm->address);
--				$user = User::staticGet($confirm->user_id);
--				if (!$user) {
--					$this->log(LOG_WARNING, 'Confirmation for unknown user ' . $confirm->user_id);
--					continue;
--				}
--				$success = jabber_confirm_address($confirm->code,
--												  $user->nickname,
--												  $confirm->address);
--				if (!$success) {
--					$this->log(LOG_ERR, 'Confirmation failed for ' . $confirm->address);
--					# Just let the claim age out; hopefully things work then
--					continue;
--				} else {
--					$this->log(LOG_INFO, 'Confirmation sent for ' . $confirm->address);
--					# Mark confirmation sent; need a dupe so we don't have the WHERE clause
--					$dupe = Confirm_address::staticGet('code', $confirm->code);
--					if (!$dupe) {
--						common_log(LOG_WARNING, 'Could not refetch confirm', __FILE__);
--						continue;
--					}
--					$orig = clone($dupe);
--					$dupe->sent = $dupe->claimed;
--					$result = $dupe->update($orig);
--					if (!$result) {
--						common_log_db_error($dupe, 'UPDATE', __FILE__);
--						# Just let the claim age out; hopefully things work then
--						continue;
--					}
--					$dupe->free();
--					unset($dupe);
--				}
--				$user->free();
--				unset($user);
--				$confirm->free();
--				unset($confirm);
--				$this->idle(0);
--			} else {
--#				$this->clear_old_confirm_claims();
--				$this->idle(10);
--			}
--		} while (true);
--		if (!$this->finish()) {
--			return false;
--		}
--		return true;
--	}
-+    var $_id = 'confirm';
-+    
-+    function class_name() {
-+        return 'XmppConfirmHandler';
-+    }
-+    
-+    function run() {
-+        if (!$this->start()) {
-+            return false;
-+        }
-+        $this->log(LOG_INFO, 'checking for queued confirmations');
-+        do {
-+            $confirm = $this->next_confirm();
-+            if ($confirm) {
-+                $this->log(LOG_INFO, 'Sending confirmation for ' . $confirm->address);
-+                $user = User::staticGet($confirm->user_id);
-+                if (!$user) {
-+                    $this->log(LOG_WARNING, 'Confirmation for unknown user ' . $confirm->user_id);
-+                    continue;
-+                }
-+                $success = jabber_confirm_address($confirm->code,
-+                                                  $user->nickname,
-+                                                  $confirm->address);
-+                if (!$success) {
-+                    $this->log(LOG_ERR, 'Confirmation failed for ' . $confirm->address);
-+                    # Just let the claim age out; hopefully things work then
-+                    continue;
-+                } else {
-+                    $this->log(LOG_INFO, 'Confirmation sent for ' . $confirm->address);
-+                    # Mark confirmation sent; need a dupe so we don't have the WHERE clause
-+                    $dupe = Confirm_address::staticGet('code', $confirm->code);
-+                    if (!$dupe) {
-+                        common_log(LOG_WARNING, 'Could not refetch confirm', __FILE__);
-+                        continue;
-+                    }
-+                    $orig = clone($dupe);
-+                    $dupe->sent = $dupe->claimed;
-+                    $result = $dupe->update($orig);
-+                    if (!$result) {
-+                        common_log_db_error($dupe, 'UPDATE', __FILE__);
-+                        # Just let the claim age out; hopefully things work then
-+                        continue;
-+                    }
-+                    $dupe->free();
-+                    unset($dupe);
-+                }
-+                $user->free();
-+                unset($user);
-+                $confirm->free();
-+                unset($confirm);
-+                $this->idle(0);
-+            } else {
-+#                $this->clear_old_confirm_claims();
-+                $this->idle(10);
-+            }
-+        } while (true);
-+        if (!$this->finish()) {
-+            return false;
-+        }
-+        return true;
-+    }
-hunk ./scripts/xmppconfirmhandler.php 102
--	function next_confirm() {
--		$confirm = new Confirm_address();
--		$confirm->whereAdd('claimed IS NULL');
--		$confirm->whereAdd('sent IS NULL');
--		# XXX: eventually we could do other confirmations in the queue, too
--		$confirm->address_type = 'jabber';
--		$confirm->orderBy('modified DESC');
--		$confirm->limit(1);
--		if ($confirm->find(TRUE)) {
--			$this->log(LOG_INFO, 'Claiming confirmation for ' . $confirm->address);
--		        # working around some weird DB_DataObject behaviour
--			$confirm->whereAdd(''); # clears where stuff
--			$original = clone($confirm);
--			$confirm->claimed = common_sql_now();
--			$result = $confirm->update($original);
--			if ($result) {
--				$this->log(LOG_INFO, 'Succeeded in claim! '. $result);
--				return $confirm;
--			} else {
--				$this->log(LOG_INFO, 'Failed in claim!');
--				return false;
--			}
--		}
--		return NULL;
--	}
-+    function next_confirm() {
-+        $confirm = new Confirm_address();
-+        $confirm->whereAdd('claimed IS NULL');
-+        $confirm->whereAdd('sent IS NULL');
-+        # XXX: eventually we could do other confirmations in the queue, too
-+        $confirm->address_type = 'jabber';
-+        $confirm->orderBy('modified DESC');
-+        $confirm->limit(1);
-+        if ($confirm->find(TRUE)) {
-+            $this->log(LOG_INFO, 'Claiming confirmation for ' . $confirm->address);
-+                # working around some weird DB_DataObject behaviour
-+            $confirm->whereAdd(''); # clears where stuff
-+            $original = clone($confirm);
-+            $confirm->claimed = common_sql_now();
-+            $result = $confirm->update($original);
-+            if ($result) {
-+                $this->log(LOG_INFO, 'Succeeded in claim! '. $result);
-+                return $confirm;
-+            } else {
-+                $this->log(LOG_INFO, 'Failed in claim!');
-+                return false;
-+            }
-+        }
-+        return NULL;
-+    }
-hunk ./scripts/xmppconfirmhandler.php 128
--	function clear_old_confirm_claims() {
--		$confirm = new Confirm();
--		$confirm->claimed = NULL;
--		$confirm->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
--		$confirm->update(DB_DATAOBJECT_WHEREADD_ONLY);
--		$confirm->free();
--		unset($confirm);
--	}
-+    function clear_old_confirm_claims() {
-+        $confirm = new Confirm();
-+        $confirm->claimed = NULL;
-+        $confirm->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
-+        $confirm->update(DB_DATAOBJECT_WHEREADD_ONLY);
-+        $confirm->free();
-+        unset($confirm);
-+    }
-hunk ./scripts/xmppdaemon.php 23
--	print "This script must be run from the command line\n";
--	exit();
-+    print "This script must be run from the command line\n";
-+    exit();
+-    var $conn = NULL;
++    var $conn = null;
+hunk ./scripts/maildaemon.php 45
+-            $this->error(NULL, _('Could not parse message.'));
++            $this->error(null, _('Could not parse message.'));
+hunk ./scripts/maildaemon.php 77
+-            return NULL;
++            return null;
+hunk ./scripts/maildaemon.php 143
+-            return NULL;
++            return null;
+hunk ./scripts/maildaemon.php 170
+-        $this->error(NULL, "Unsupported message type: " . $type);
++        $this->error(null, "Unsupported message type: " . $type);
+hunk ./scripts/ombqueuehandler.php 70
+-$id = ($argc > 1) ? $argv[1] : NULL;
++$id = ($argc > 1) ? $argv[1] : null;
+hunk ./scripts/smsqueuehandler.php 60
+-$id = ($argc > 1) ? $argv[1] : NULL;
++$id = ($argc > 1) ? $argv[1] : null;
+hunk ./scripts/xmppconfirmhandler.php 104
+-        $confirm->whereAdd('claimed IS NULL');
+-        $confirm->whereAdd('sent IS NULL');
++        $confirm->whereAdd('claimed IS null');
++        $confirm->whereAdd('sent IS null');
+hunk ./scripts/xmppconfirmhandler.php 125
+-        return NULL;
++        return null;
+hunk ./scripts/xmppconfirmhandler.php 130
+-        $confirm->claimed = NULL;
++        $confirm->claimed = null;
 hunk ./scripts/xmppdaemon.php 42
--	function XMPPDaemon($resource=NULL) {
--		static $attrs = array('server', 'port', 'user', 'password', 'host');
-+    function XMPPDaemon($resource=NULL) {
-+        static $attrs = array('server', 'port', 'user', 'password', 'host');
-hunk ./scripts/xmppdaemon.php 45
--		foreach ($attrs as $attr)
--		{
--			$this->$attr = common_config('xmpp', $attr);
--		}
-+        foreach ($attrs as $attr)
-+        {
-+            $this->$attr = common_config('xmpp', $attr);
-+        }
-hunk ./scripts/xmppdaemon.php 50
--		if ($resource) {
--			$this->resource = $resource;
--		} else {
--			$this->resource = common_config('xmpp', 'resource') . 'daemon';
--		}
-+        if ($resource) {
-+            $this->resource = $resource;
-+        } else {
-+            $this->resource = common_config('xmpp', 'resource') . 'daemon';
-+        }
-hunk ./scripts/xmppdaemon.php 56
--		$this->log(LOG_INFO, "INITIALIZE XMPPDaemon {$this->user}@{$this->server}/{$this->resource}");
--	}
-+        $this->log(LOG_INFO, "INITIALIZE XMPPDaemon {$this->user}@{$this->server}/{$this->resource}");
-+    }
-hunk ./scripts/xmppdaemon.php 59
--	function connect() {
-+    function connect() {
-hunk ./scripts/xmppdaemon.php 61
--		$connect_to = ($this->host) ? $this->host : $this->server;
-+        $connect_to = ($this->host) ? $this->host : $this->server;
-hunk ./scripts/xmppdaemon.php 63
--		$this->log(LOG_INFO, "Connecting to $connect_to on port $this->port");
-+        $this->log(LOG_INFO, "Connecting to $connect_to on port $this->port");
-hunk ./scripts/xmppdaemon.php 65
--		$this->conn = jabber_connect($this->resource);
-+        $this->conn = jabber_connect($this->resource);
-hunk ./scripts/xmppdaemon.php 67
--		if (!$this->conn) {
--			return false;
--		}
-+        if (!$this->conn) {
-+            return false;
-+        }
-hunk ./scripts/xmppdaemon.php 71
--		$this->conn->setReconnectTimeout(600);
-+        $this->conn->setReconnectTimeout(600);
-hunk ./scripts/xmppdaemon.php 73
--		jabber_send_presence("Send me a message to post a notice", 'available',
--							 NULL, 'available', 100);
--		return !$this->conn->isDisconnected();
--	}
-+        jabber_send_presence("Send me a message to post a notice", 'available',
-+                             NULL, 'available', 100);
-+        return !$this->conn->isDisconnected();
-+    }
-hunk ./scripts/xmppdaemon.php 78
--	function name() {
--		return strtolower('xmppdaemon.'.$this->resource);
--	}
-+    function name() {
-+        return strtolower('xmppdaemon.'.$this->resource);
-+    }
-hunk ./scripts/xmppdaemon.php 82
--	function run() {
--		if ($this->connect()) {
-+    function run() {
-+        if ($this->connect()) {
-hunk ./scripts/xmppdaemon.php 85
--			$this->conn->addEventHandler('message', 'handle_message', $this);
--			$this->conn->addEventHandler('presence', 'handle_presence', $this);
--			$this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
-+            $this->conn->addEventHandler('message', 'handle_message', $this);
-+            $this->conn->addEventHandler('presence', 'handle_presence', $this);
-+            $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
-hunk ./scripts/xmppdaemon.php 89
--			$this->conn->process();
--		}
--	}
-+            $this->conn->process();
-+        }
-+    }
-hunk ./scripts/xmppdaemon.php 93
--	function handle_reconnect(&$pl) {
--		$this->conn->processUntil('session_start');
--		$this->conn->presence('Send me a message to post a notice', 'available', NULL, 'available', 100);
--	}
-+    function handle_reconnect(&$pl) {
-+        $this->conn->processUntil('session_start');
-+        $this->conn->presence('Send me a message to post a notice', 'available', NULL, 'available', 100);
-+    }
-hunk ./scripts/xmppdaemon.php 98
--	function get_user($from) {
--		$user = User::staticGet('jabber', jabber_normalize_jid($from));
--		return $user;
--	}
-+    function get_user($from) {
-+        $user = User::staticGet('jabber', jabber_normalize_jid($from));
-+        return $user;
-+    }
-hunk ./scripts/xmppdaemon.php 103
--	function handle_message(&$pl) {
--		if ($pl['type'] != 'chat') {
--			return;
--		}
--		if (mb_strlen($pl['body']) == 0) {
--			return;
--		}
-+    function handle_message(&$pl) {
-+        if ($pl['type'] != 'chat') {
-+            return;
-+        }
-+        if (mb_strlen($pl['body']) == 0) {
-+            return;
-+        }
-hunk ./scripts/xmppdaemon.php 111
--		$from = jabber_normalize_jid($pl['from']);
-+        $from = jabber_normalize_jid($pl['from']);
-hunk ./scripts/xmppdaemon.php 113
--		# Forwarded from another daemon (probably a broadcaster) for
--		# us to handle
-+        # Forwarded from another daemon (probably a broadcaster) for
-+        # us to handle
-hunk ./scripts/xmppdaemon.php 116
--		if ($this->is_self($from)) {
--			$from = $this->get_ofrom($pl);
--			if (is_null($from) || $this->is_self($from)) {
--				return;
--			}
--		}
-+        if ($this->is_self($from)) {
-+            $from = $this->get_ofrom($pl);
-+            if (is_null($from) || $this->is_self($from)) {
-+                return;
-+            }
-+        }
-hunk ./scripts/xmppdaemon.php 123
--		$user = $this->get_user($from);
-+        $user = $this->get_user($from);
-hunk ./scripts/xmppdaemon.php 125
--		if (!$user) {
--			$this->from_site($from, 'Unknown user; go to ' .
--							 common_local_url('imsettings') .
--							 ' to add your address to your account');
--			$this->log(LOG_WARNING, 'Message from unknown user ' . $from);
--			return;
--		}
--		if ($this->handle_command($user, $pl['body'])) {
--			return;
--		} else if ($this->is_autoreply($pl['body'])) {
--			$this->log(LOG_INFO, 'Ignoring auto reply from ' . $from);
--			return;
--		} else if ($this->is_otr($pl['body'])) {
--			$this->log(LOG_INFO, 'Ignoring OTR from ' . $from);
--			return;
--		} else if ($this->is_direct($pl['body'])) {
--			preg_match_all('/d[\ ]*([a-z0-9]{1,64})/', $pl['body'], $to);
-+        if (!$user) {
-+            $this->from_site($from, 'Unknown user; go to ' .
-+                             common_local_url('imsettings') .
-+                             ' to add your address to your account');
-+            $this->log(LOG_WARNING, 'Message from unknown user ' . $from);
-+            return;
-+        }
-+        if ($this->handle_command($user, $pl['body'])) {
-+            return;
-+        } else if ($this->is_autoreply($pl['body'])) {
-+            $this->log(LOG_INFO, 'Ignoring auto reply from ' . $from);
-+            return;
-+        } else if ($this->is_otr($pl['body'])) {
-+            $this->log(LOG_INFO, 'Ignoring OTR from ' . $from);
-+            return;
-+        } else if ($this->is_direct($pl['body'])) {
-+            preg_match_all('/d[\ ]*([a-z0-9]{1,64})/', $pl['body'], $to);
-hunk ./scripts/xmppdaemon.php 143
--			$to = preg_replace('/^d([\ ])*/', '', $to[0][0]);
--			$body = preg_replace('/d[\ ]*('. $to .')[\ ]*/', '', $pl['body']);
--			$this->add_direct($user, $body, $to, $from);
--		} else {
--			$len = mb_strlen($pl['body']);
--			if($len > 140) {
--				$this->from_site($from, 'Message too long - maximum is 140 characters, you sent ' . $len);
--				return;
--			}
--			$this->add_notice($user, $pl);
--		}
-+            $to = preg_replace('/^d([\ ])*/', '', $to[0][0]);
-+            $body = preg_replace('/d[\ ]*('. $to .')[\ ]*/', '', $pl['body']);
-+            $this->add_direct($user, $body, $to, $from);
-+        } else {
-+            $len = mb_strlen($pl['body']);
-+            if($len > 140) {
-+                $this->from_site($from, 'Message too long - maximum is 140 characters, you sent ' . $len);
-+                return;
-+            }
-+            $this->add_notice($user, $pl);
-+        }
-hunk ./scripts/xmppdaemon.php 155
--		$user->free();
--		unset($user);
--	}
-+        $user->free();
-+        unset($user);
-+    }
-hunk ./scripts/xmppdaemon.php 159
--	function is_self($from) {
--		return preg_match('/^'.strtolower(jabber_daemon_address()).'/', strtolower($from));
--	}
-+    function is_self($from) {
-+        return preg_match('/^'.strtolower(jabber_daemon_address()).'/', strtolower($from));
-+    }
-hunk ./scripts/xmppdaemon.php 163
--	function get_ofrom($pl) {
--		$xml = $pl['xml'];
--		$addresses = $xml->sub('addresses');
--		if (!$addresses) {
--			$this->log(LOG_WARNING, 'Forwarded message without addresses');
--			return NULL;
--		}
--		$address = $addresses->sub('address');
--		if (!$address) {
--			$this->log(LOG_WARNING, 'Forwarded message without address');
--			return NULL;
--		}
--		if (!array_key_exists('type', $address->attrs)) {
--			$this->log(LOG_WARNING, 'No type for forwarded message');
--			return NULL;
--		}
--		$type = $address->attrs['type'];
--		if ($type != 'ofrom') {
--			$this->log(LOG_WARNING, 'Type of forwarded message is not ofrom');
--			return NULL;
--		}
--		if (!array_key_exists('jid', $address->attrs)) {
--			$this->log(LOG_WARNING, 'No jid for forwarded message');
--			return NULL;
--		}
--		$jid = $address->attrs['jid'];
--		if (!$jid) {
--			$this->log(LOG_WARNING, 'Could not get jid from address');
--			return NULL;
--		}
--		$this->log(LOG_DEBUG, 'Got message forwarded from jid ' . $jid);
--		return $jid;
--	}
-+    function get_ofrom($pl) {
-+        $xml = $pl['xml'];
-+        $addresses = $xml->sub('addresses');
-+        if (!$addresses) {
-+            $this->log(LOG_WARNING, 'Forwarded message without addresses');
-+            return NULL;
-+        }
-+        $address = $addresses->sub('address');
-+        if (!$address) {
-+            $this->log(LOG_WARNING, 'Forwarded message without address');
-+            return NULL;
-+        }
-+        if (!array_key_exists('type', $address->attrs)) {
-+            $this->log(LOG_WARNING, 'No type for forwarded message');
-+            return NULL;
-+        }
-+        $type = $address->attrs['type'];
-+        if ($type != 'ofrom') {
-+            $this->log(LOG_WARNING, 'Type of forwarded message is not ofrom');
-+            return NULL;
-+        }
-+        if (!array_key_exists('jid', $address->attrs)) {
-+            $this->log(LOG_WARNING, 'No jid for forwarded message');
-+            return NULL;
-+        }
-+        $jid = $address->attrs['jid'];
-+        if (!$jid) {
-+            $this->log(LOG_WARNING, 'Could not get jid from address');
-+            return NULL;
-+        }
-+        $this->log(LOG_DEBUG, 'Got message forwarded from jid ' . $jid);
-+        return $jid;
-+    }
-hunk ./scripts/xmppdaemon.php 197
--	function is_autoreply($txt) {
--		if (preg_match('/[\[\(]?[Aa]uto[-\s]?[Rr]e(ply|sponse)[\]\)]/', $txt)) {
--			return true;
--		} else {
--			return false;
--		}
--	}
-+    function is_autoreply($txt) {
-+        if (preg_match('/[\[\(]?[Aa]uto[-\s]?[Rr]e(ply|sponse)[\]\)]/', $txt)) {
-+            return true;
-+        } else {
-+            return false;
-+        }
-+    }
-hunk ./scripts/xmppdaemon.php 205
--	function is_otr($txt) {
--		if (preg_match('/^\?OTR/', $txt)) {
--			return true;
--		} else {
--			return false;
--		}
--	}
-+    function is_otr($txt) {
-+        if (preg_match('/^\?OTR/', $txt)) {
-+            return true;
-+        } else {
-+            return false;
-+        }
-+    }
-hunk ./scripts/xmppdaemon.php 213
--	function is_direct($txt) {
--		if (strtolower(substr($txt, 0, 2))=='d ') {
--			return true;
--		} else {
--			return false;
--		}
--	}
-+    function is_direct($txt) {
-+        if (strtolower(substr($txt, 0, 2))=='d ') {
-+            return true;
-+        } else {
-+            return false;
-+        }
-+    }
-hunk ./scripts/xmppdaemon.php 221
--	function from_site($address, $msg) {
--		$text = '['.common_config('site', 'name') . '] ' . $msg;
--		jabber_send_message($address, $text);
--	}
-+    function from_site($address, $msg) {
-+        $text = '['.common_config('site', 'name') . '] ' . $msg;
-+        jabber_send_message($address, $text);
-+    }
-hunk ./scripts/xmppdaemon.php 226
--	function handle_command($user, $body) {
--		$inter = new CommandInterpreter();
--		$cmd = $inter->handle_command($user, $body);
--		if ($cmd) {
--			$chan = new XMPPChannel($this->conn);
--			$cmd->execute($chan);
--			return true;
--		} else {
--			return false;
--		}
--	}
-+    function handle_command($user, $body) {
-+        $inter = new CommandInterpreter();
-+        $cmd = $inter->handle_command($user, $body);
-+        if ($cmd) {
-+            $chan = new XMPPChannel($this->conn);
-+            $cmd->execute($chan);
-+            return true;
-+        } else {
-+            return false;
-+        }
-+    }
-hunk ./scripts/xmppdaemon.php 238
--	function add_notice(&$user, &$pl) {
-+    function add_notice(&$user, &$pl) {
-hunk ./scripts/xmppdaemon.php 248
--		$notice = Notice::saveNew($user->id, $content, 'xmpp');
--		if (is_string($notice)) {
--			$this->log(LOG_ERR, $notice);
--			return;
--		}
--		common_broadcast_notice($notice);
--		$this->log(LOG_INFO,
--				   'Added notice ' . $notice->id . ' from user ' . $user->nickname);
--		$notice->free();
--		unset($notice);
--	}
-+        $notice = Notice::saveNew($user->id, $content, 'xmpp');
-+        if (is_string($notice)) {
-+            $this->log(LOG_ERR, $notice);
-+            return;
-+        }
-+        common_broadcast_notice($notice);
-+        $this->log(LOG_INFO,
-+                   'Added notice ' . $notice->id . ' from user ' . $user->nickname);
-+        $notice->free();
-+        unset($notice);
-+    }
-hunk ./scripts/xmppdaemon.php 260
--	function handle_presence(&$pl) {
--		$from = jabber_normalize_jid($pl['from']);
--		switch ($pl['type']) {
--		 case 'subscribe':
--			# We let anyone subscribe
--			$this->subscribed($from);
--			$this->log(LOG_INFO,
--					   'Accepted subscription from ' . $from);
--			break;
--		 case 'subscribed':
--		 case 'unsubscribed':
--		 case 'unsubscribe':
--			$this->log(LOG_INFO,
--					   'Ignoring  "' . $pl['type'] . '" from ' . $from);
--			break;
--		 default:
--			if (!$pl['type']) {
--				$user = User::staticGet('jabber', $from);
--				if (!$user) {
--					$this->log(LOG_WARNING, 'Presence from unknown user ' . $from);
--					return;
--				}
--				if ($user->updatefrompresence) {
--					$this->log(LOG_INFO, 'Updating ' . $user->nickname .
--							   ' status from presence.');
--					$this->add_notice($user, $pl);
--				}
--				$user->free();
--				unset($user);
--			}
--			break;
--		}
--	}
-+    function handle_presence(&$pl) {
-+        $from = jabber_normalize_jid($pl['from']);
-+        switch ($pl['type']) {
-+         case 'subscribe':
-+            # We let anyone subscribe
-+            $this->subscribed($from);
-+            $this->log(LOG_INFO,
-+                       'Accepted subscription from ' . $from);
-+            break;
-+         case 'subscribed':
-+         case 'unsubscribed':
-+         case 'unsubscribe':
-+            $this->log(LOG_INFO,
-+                       'Ignoring  "' . $pl['type'] . '" from ' . $from);
-+            break;
-+         default:
-+            if (!$pl['type']) {
-+                $user = User::staticGet('jabber', $from);
-+                if (!$user) {
-+                    $this->log(LOG_WARNING, 'Presence from unknown user ' . $from);
-+                    return;
-+                }
-+                if ($user->updatefrompresence) {
-+                    $this->log(LOG_INFO, 'Updating ' . $user->nickname .
-+                               ' status from presence.');
-+                    $this->add_notice($user, $pl);
-+                }
-+                $user->free();
-+                unset($user);
-+            }
-+            break;
-+        }
-+    }
-hunk ./scripts/xmppdaemon.php 294
--	function log($level, $msg) {
--		common_log($level, 'XMPPDaemon('.$this->resource.'): '.$msg);
--	}
-+    function log($level, $msg) {
-+        common_log($level, 'XMPPDaemon('.$this->resource.'): '.$msg);
-+    }
-hunk ./scripts/xmppdaemon.php 298
--	function subscribed($to) {
--		jabber_special_presence('subscribed', $to);
--	}
-+    function subscribed($to) {
-+        jabber_special_presence('subscribed', $to);
-+    }
+-    function XMPPDaemon($resource=NULL) {
++    function XMPPDaemon($resource=null) {
+hunk ./scripts/xmppdaemon.php 74
+-                             NULL, 'available', 100);
++                             null, 'available', 100);
+hunk ./scripts/xmppdaemon.php 95
+-        $this->conn->presence('Send me a message to post a notice', 'available', NULL, 'available', 100);
++        $this->conn->presence('Send me a message to post a notice', 'available', null, 'available', 100);
+hunk ./scripts/xmppdaemon.php 168
+-            return NULL;
++            return null;
+hunk ./scripts/xmppdaemon.php 173
+-            return NULL;
++            return null;
+hunk ./scripts/xmppdaemon.php 177
+-            return NULL;
++            return null;
+hunk ./scripts/xmppdaemon.php 182
+-            return NULL;
++            return null;
+hunk ./scripts/xmppdaemon.php 186
+-            return NULL;
++            return null;
+hunk ./scripts/xmppdaemon.php 191
+-            return NULL;
++            return null;
diff --git a/actions/allrss.php b/actions/allrss.php
index d28fcea49..851cd0ad5 100644
--- a/actions/allrss.php
+++ b/actions/allrss.php
@@ -25,7 +25,7 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class AllrssAction extends Rss10Action {
 
-    var $user = NULL;
+    var $user = null;
 
     function init() {
         $nickname = $this->trimmed('nickname');
@@ -69,9 +69,9 @@ class AllrssAction extends Rss10Action {
         $user = $this->user;
         $profile = $user->getProfile();
         if (!$profile) {
-            return NULL;
+            return null;
         }
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-        return ($avatar) ? $avatar->url : NULL;
+        return ($avatar) ? $avatar->url : null;
     }
 }
\ No newline at end of file
diff --git a/actions/api.php b/actions/api.php
index e03961e21..e7646a7bb 100644
--- a/actions/api.php
+++ b/actions/api.php
@@ -152,8 +152,8 @@ class ApiAction extends Action {
             header('Content-Type: application/xml; charset=utf-8');
             common_start_xml();
             common_element_start('hash');
-            common_element('error', NULL, $msg);
-            common_element('request', NULL, $_SERVER['REQUEST_URI']);
+            common_element('error', null, $msg);
+            common_element('request', null, $_SERVER['REQUEST_URI']);
             common_element_end('hash');
             common_end_xml();
         } else if ($this->content_type == 'json')  {
diff --git a/actions/block.php b/actions/block.php
index 20ba81edb..cfcd29848 100644
--- a/actions/block.php
+++ b/actions/block.php
@@ -21,7 +21,7 @@ if (!defined('LACONICA')) { exit(1); }
 
 class BlockAction extends Action {
 
-    var $profile = NULL;
+    var $profile = null;
 
     function prepare($args) {
 
@@ -77,7 +77,7 @@ class BlockAction extends Action {
 
         common_show_header(_('Block user'));
 
-        common_element('p', NULL,
+        common_element('p', null,
                        _('Are you sure you want to block this user? '.
                          'Afterwards, they will be unsubscribed from you, '.
                          'unable to subscribe to you in the future, and '.
diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php
index 9d97c8205..562b70fe9 100644
--- a/actions/confirmaddress.php
+++ b/actions/confirmaddress.php
@@ -88,7 +88,7 @@ class ConfirmaddressAction extends Action {
         $cur->query('COMMIT');
 
         common_show_header(_('Confirm Address'));
-        common_element('p', NULL,
+        common_element('p', null,
                        sprintf(_('The address "%s" has been confirmed for your account.'), $cur->$type));
         common_show_footer();
     }
diff --git a/actions/deletenotice.php b/actions/deletenotice.php
index ba348c5fa..0777918d2 100644
--- a/actions/deletenotice.php
+++ b/actions/deletenotice.php
@@ -41,7 +41,7 @@ class DeletenoticeAction extends DeleteAction {
         return _('Delete notice');
     }
 
-    function show_form($error=NULL) {
+    function show_form($error=null) {
         $user = common_current_user();
 
         common_show_header($this->get_title(), array($this, 'show_header'), $error,
@@ -91,7 +91,7 @@ class DeletenoticeAction extends DeleteAction {
             $notice->delete();
         } else {
             if ($url) {
-                common_set_returnto(NULL);
+                common_set_returnto(null);
             } else {
                 $url = common_local_url('public');
             }
diff --git a/actions/deleteprofile.php b/actions/deleteprofile.php
index 29797bc76..503b3666d 100644
--- a/actions/deleteprofile.php
+++ b/actions/deleteprofile.php
@@ -36,9 +36,9 @@ class DeleteprofileAction extends Action {
         return _('Export and delete your user information.');
     }
 
-    function form_header($title, $msg=NULL, $success=false) {
+    function form_header($title, $msg=null, $success=false) {
         common_show_header($title,
-                           NULL,
+                           null,
                            array($msg, $success),
                            array($this, 'show_top'));
     }
@@ -84,9 +84,9 @@ class DeleteprofileAction extends Action {
         common_element_end('li');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $this->form_header(_('Delete my account'), $msg, $success);
-        common_element('h2', NULL, _('Delete my account confirmation'));
+        common_element('h2', null, _('Delete my account confirmation'));
         $this->show_confirm_delete_form();
         common_show_footer();
     }
@@ -213,7 +213,7 @@ class DeleteprofileAction extends Action {
         $n_users_deleted = $user->delete();
 
         // logout and redirect to public
-        common_set_user(NULL);
+        common_set_user(null);
         common_real_login(false); # not logged in
         common_forgetme(); # don't log back in!
         common_redirect(common_local_url('public'));
diff --git a/actions/emailsettings.php b/actions/emailsettings.php
index b77817c8e..06b3ef29f 100644
--- a/actions/emailsettings.php
+++ b/actions/emailsettings.php
@@ -27,7 +27,7 @@ class EmailsettingsAction extends SettingsAction {
         return _('Manage how you get email from %%site.name%%.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $user = common_current_user();
         $this->form_header(_('Email Settings'), $msg, $success);
         common_element_start('form', array('method' => 'post',
@@ -36,7 +36,7 @@ class EmailsettingsAction extends SettingsAction {
                                            common_local_url('emailsettings')));
         common_hidden('token', common_session_token());
 
-        common_element('h2', NULL, _('Address'));
+        common_element('h2', null, _('Address'));
 
         if ($user->email) {
             common_element_start('p');
@@ -58,14 +58,14 @@ class EmailsettingsAction extends SettingsAction {
                 common_submit('cancel', _('Cancel'));
             } else {
                 common_input('email', _('Email Address'),
-                             ($this->arg('email')) ? $this->arg('email') : NULL,
+                             ($this->arg('email')) ? $this->arg('email') : null,
                              _('Email address, like "UserName@example.org"'));
                 common_submit('add', _('Add'));
             }
         }
 
         if ($user->email) {
-            common_element('h2', NULL, _('Incoming email'));
+            common_element('h2', null, _('Incoming email'));
             
             if ($user->incomingemail) {
                 common_element_start('p');
@@ -83,7 +83,7 @@ class EmailsettingsAction extends SettingsAction {
             common_submit('newincoming', _('New'));
         }
         
-        common_element('h2', NULL, _('Preferences'));
+        common_element('h2', null, _('Preferences'));
 
         common_checkbox('emailnotifysub',
                         _('Send me notices of new subscriptions through email.'),
@@ -118,7 +118,7 @@ class EmailsettingsAction extends SettingsAction {
         if ($confirm->find(TRUE)) {
             return $confirm;
         } else {
-            return NULL;
+            return null;
         }
     }
 
@@ -273,7 +273,7 @@ class EmailsettingsAction extends SettingsAction {
 
         $user->query('BEGIN');
         $original = clone($user);
-        $user->email = NULL;
+        $user->email = null;
         $result = $user->updateKeys($original);
         if (!$result) {
             common_log_db_error($user, 'UPDATE', __FILE__);
@@ -294,7 +294,7 @@ class EmailsettingsAction extends SettingsAction {
         }
         
         $orig = clone($user);
-        $user->incomingemail = NULL;
+        $user->incomingemail = null;
 
         if (!$user->updateKeys($orig)) {
             common_log_db_error($user, 'UPDATE', __FILE__);
diff --git a/actions/favorited.php b/actions/favorited.php
index 6a465df96..e69630d50 100644
--- a/actions/favorited.php
+++ b/actions/favorited.php
@@ -29,7 +29,7 @@ class FavoritedAction extends StreamAction {
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
         common_show_header(_('Popular notices'),
-                           array($this, 'show_header'), NULL,
+                           array($this, 'show_header'), null,
                            array($this, 'show_top'));
 
         $this->show_notices($page);
diff --git a/actions/favoritesrss.php b/actions/favoritesrss.php
index 642d4f880..7071812d7 100644
--- a/actions/favoritesrss.php
+++ b/actions/favoritesrss.php
@@ -25,7 +25,7 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class FavoritesrssAction extends Rss10Action {
 
-    var $user = NULL;
+    var $user = null;
     
     function init() {
         $nickname = $this->trimmed('nickname');
@@ -68,6 +68,6 @@ class FavoritesrssAction extends Rss10Action {
     }
 
     function get_image() {
-        return NULL;
+        return null;
     }
 }
\ No newline at end of file
diff --git a/actions/featured.php b/actions/featured.php
index 2ff4f7745..f478a4017 100644
--- a/actions/featured.php
+++ b/actions/featured.php
@@ -30,7 +30,7 @@ class FeaturedAction extends StreamAction {
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
         common_show_header(_('Featured users'),
-                           array($this, 'show_header'), NULL,
+                           array($this, 'show_header'), null,
                            array($this, 'show_top'));
 
         $this->show_notices($page);
diff --git a/actions/finishaddopenid.php b/actions/finishaddopenid.php
index 07024e091..7607688de 100644
--- a/actions/finishaddopenid.php
+++ b/actions/finishaddopenid.php
@@ -97,7 +97,7 @@ class FinishaddopenidAction extends Action {
 
     function message($msg) {
         common_show_header(_('OpenID Login'));
-        common_element('p', NULL, $msg);
+        common_element('p', null, $msg);
         common_show_footer();
     }
 }
diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php
index a2a778f31..ae5b136a2 100644
--- a/actions/finishopenidlogin.php
+++ b/actions/finishopenidlogin.php
@@ -52,7 +52,7 @@ class FinishopenidloginAction extends Action {
         }
     }
 
-    function show_top($error=NULL) {
+    function show_top($error=null) {
         if ($error) {
             common_element('div', array('class' => 'error'), $error);
         } else {
@@ -62,17 +62,17 @@ class FinishopenidloginAction extends Action {
         }
     }
 
-    function show_form($error=NULL, $username=NULL) {
-        common_show_header(_('OpenID Account Setup'), NULL, $error,
+    function show_form($error=null, $username=null) {
+        common_show_header(_('OpenID Account Setup'), null, $error,
                            array($this, 'show_top'));
 
         common_element_start('form', array('method' => 'post',
                                            'id' => 'account_connect',
                                            'action' => common_local_url('finishopenidlogin')));
         common_hidden('token', common_session_token());
-        common_element('h2', NULL,
+        common_element('h2', null,
                        _('Create new account'));
-        common_element('p', NULL,
+        common_element('p', null,
                        _('Create a new user with this nickname.'));
         common_input('newname', _('New nickname'),
                      ($username) ? $username : '',
@@ -88,9 +88,9 @@ class FinishopenidloginAction extends Action {
         common_text(_(' except this private data: password, email address, IM address, phone number.'));
         common_element_end('p');
         common_submit('create', _('Create'));
-        common_element('h2', NULL,
+        common_element('h2', null,
                        _('Connect existing account'));
-        common_element('p', NULL,
+        common_element('p', null,
                        _('If you already have an account, login with your username and password to connect it to your OpenID.'));
         common_input('nickname', _('Existing nickname'));
         common_password('password', _('Password'));
@@ -141,14 +141,14 @@ class FinishopenidloginAction extends Action {
                 $this->go_home($user->nickname);
             } else {
                 $this->save_values($display, $canonical, $sreg);
-                $this->show_form(NULL, $this->best_new_nickname($display, $sreg));
+                $this->show_form(null, $this->best_new_nickname($display, $sreg));
             }
         }
     }
 
     function message($msg) {
         common_show_header(_('OpenID Login'));
-        common_element('p', NULL, $msg);
+        common_element('p', null, $msg);
         common_show_footer();
     }
 
@@ -290,7 +290,7 @@ class FinishopenidloginAction extends Action {
         $url = common_get_returnto();
         if ($url) {
             # We don't have to return to it again
-            common_set_returnto(NULL);
+            common_set_returnto(null);
         } else {
             $url = common_local_url('all',
                                     array('nickname' =>
@@ -329,7 +329,7 @@ class FinishopenidloginAction extends Action {
 
         # XXX: others?
 
-        return NULL;
+        return null;
     }
 
     function is_new_nickname($str) {
@@ -369,7 +369,7 @@ class FinishopenidloginAction extends Action {
 
         foreach ($bad as $badpart) {
             if (array_key_exists($badpart, $parts)) {
-                return NULL;
+                return null;
             }
         }
 
@@ -403,14 +403,14 @@ class FinishopenidloginAction extends Action {
             }
         }
 
-        return NULL;
+        return null;
     }
 
     function xri_to_nickname($xri) {
         $base = $this->xri_base($xri);
 
         if (!$base) {
-            return NULL;
+            return null;
         } else {
             # =evan.prodromou
             # or @gratis*evan.prodromou
diff --git a/actions/finishremotesubscribe.php b/actions/finishremotesubscribe.php
index c3387cf02..edd4ae541 100644
--- a/actions/finishremotesubscribe.php
+++ b/actions/finishremotesubscribe.php
@@ -278,7 +278,7 @@ class FinishremotesubscribeAction extends Action {
         common_debug('got result: "'.print_r($result,TRUE).'"', __FILE__);
 
         if ($result->status != 200) {
-            return NULL;
+            return null;
         }
 
         parse_str($result->body, $return);
diff --git a/actions/foaf.php b/actions/foaf.php
index 310ba2c19..218e20f5f 100644
--- a/actions/foaf.php
+++ b/actions/foaf.php
@@ -66,21 +66,21 @@ class FoafAction extends Action {
         # XXX: might not be a person
         common_element_start('Person', array('rdf:about' =>
                                              $user->uri));
-        common_element('mbox_sha1sum', NULL, sha1('mailto:' . $user->email));
+        common_element('mbox_sha1sum', null, sha1('mailto:' . $user->email));
         if ($profile->fullname) {
-            common_element('name', NULL, $profile->fullname);
+            common_element('name', null, $profile->fullname);
         }
         if ($profile->homepage) {
             common_element('homepage', array('rdf:resource' => $profile->homepage));
         }
         if ($profile->bio) {
-            common_element('rdfs:comment', NULL, $profile->bio);
+            common_element('rdfs:comment', null, $profile->bio);
         }
         # XXX: more structured location data
         if ($profile->location) {
             common_element_start('based_near');
             common_element_start('geo:SpatialThing');
-            common_element('name', NULL, $profile->location);
+            common_element('name', null, $profile->location);
             common_element_end('geo:SpatialThing');
             common_element_end('based_near');
         }
@@ -156,7 +156,7 @@ class FoafAction extends Action {
         common_element_end('Person');
 
         foreach ($person as $uri => $p) {
-            $foaf_url = NULL;
+            $foaf_url = null;
             if ($p[1] instanceof User) {
                 $foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname));
             }
@@ -166,7 +166,7 @@ class FoafAction extends Action {
                 common_element('knows', array('rdf:resource' => $user->uri));
             }
             $this->show_microblogging_account($profile, ($p[1] instanceof User) ?
-                                              common_root_url() : NULL);
+                                              common_root_url() : null);
             if ($foaf_url) {
                 common_element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
             }
@@ -186,7 +186,7 @@ class FoafAction extends Action {
         common_element_end('PersonalProfileDocument');
     }
 
-    function show_microblogging_account($profile, $service=NULL) {
+    function show_microblogging_account($profile, $service=null) {
         # Their account
         common_element_start('holdsAccount');
         common_element_start('OnlineAccount');
@@ -194,7 +194,7 @@ class FoafAction extends Action {
             common_element('accountServiceHomepage', array('rdf:resource' =>
                                                            $service));
         }
-        common_element('accountName', NULL, $profile->nickname);
+        common_element('accountName', null, $profile->nickname);
         common_element('homepage', array('rdf:resource' => $profile->profileurl));
         common_element_end('OnlineAccount');
         common_element_end('holdsAccount');
diff --git a/actions/imsettings.php b/actions/imsettings.php
index d0c47f7fd..8f546f8e7 100644
--- a/actions/imsettings.php
+++ b/actions/imsettings.php
@@ -28,7 +28,7 @@ class ImsettingsAction extends SettingsAction {
         return _('You can send and receive notices through Jabber/GTalk [instant messages](%%doc.im%%). Configure your address and settings below.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $user = common_current_user();
         $this->form_header(_('IM Settings'), $msg, $success);
         common_element_start('form', array('method' => 'post',
@@ -37,7 +37,7 @@ class ImsettingsAction extends SettingsAction {
                                            common_local_url('imsettings')));
         common_hidden('token', common_session_token());
 
-        common_element('h2', NULL, _('Address'));
+        common_element('h2', null, _('Address'));
 
         if ($user->jabber) {
             common_element_start('p');
@@ -59,13 +59,13 @@ class ImsettingsAction extends SettingsAction {
                 common_submit('cancel', _('Cancel'));
             } else {
                 common_input('jabber', _('IM Address'),
-                             ($this->arg('jabber')) ? $this->arg('jabber') : NULL,
+                             ($this->arg('jabber')) ? $this->arg('jabber') : null,
                          sprintf(_('Jabber or GTalk address, like "UserName@example.org". First, make sure to add %s to your buddy list in your IM client or on GTalk.'), jabber_daemon_address()));
                 common_submit('add', _('Add'));
             }
         }
 
-        common_element('h2', NULL, _('Preferences'));
+        common_element('h2', null, _('Preferences'));
 
         common_checkbox('jabbernotify',
                         _('Send me notices through Jabber/GTalk.'),
@@ -93,7 +93,7 @@ class ImsettingsAction extends SettingsAction {
         if ($confirm->find(TRUE)) {
             return $confirm;
         } else {
-            return NULL;
+            return null;
         }
     }
 
@@ -244,7 +244,7 @@ class ImsettingsAction extends SettingsAction {
 
         $user->query('BEGIN');
         $original = clone($user);
-        $user->jabber = NULL;
+        $user->jabber = null;
         $result = $user->updateKeys($original);
         if (!$result) {
             common_log_db_error($user, 'UPDATE', __FILE__);
diff --git a/actions/invite.php b/actions/invite.php
index e5cc6ad01..feef94d0f 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -85,49 +85,49 @@ class InviteAction extends Action {
 
         common_show_header(_('Invitation(s) sent'));
         if ($already) {
-            common_element('p', NULL, _('You are already subscribed to these users:'));
+            common_element('p', null, _('You are already subscribed to these users:'));
             common_element_start('ul');
             foreach ($already as $other) {
-                common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
+                common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
             }
             common_element_end('ul');
         }
         if ($subbed) {
-            common_element('p', NULL, _('These people are already users and you were automatically subscribed to them:'));
+            common_element('p', null, _('These people are already users and you were automatically subscribed to them:'));
             common_element_start('ul');
             foreach ($subbed as $other) {
-                common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
+                common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
             }
             common_element_end('ul');
         }
         if ($sent) {
-            common_element('p', NULL, _('Invitation(s) sent to the following people:'));
+            common_element('p', null, _('Invitation(s) sent to the following people:'));
             common_element_start('ul');
             foreach ($sent as $other) {
-                common_element('li', NULL, $other);
+                common_element('li', null, $other);
             }
             common_element_end('ul');
-            common_element('p', NULL, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
+            common_element('p', null, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
         }
         common_show_footer();
     }
 
-    function show_top($error=NULL) {
+    function show_top($error=null) {
         if ($error) {
             common_element('p', 'error', $error);
         } else {
             common_element_start('div', 'instructions');
-            common_element('p', NULL,
+            common_element('p', null,
                            _('Use this form to invite your friends and colleagues to use this service.'));
             common_element_end('div');
         }
     }
 
-    function show_form($error=NULL) {
+    function show_form($error=null) {
 
         global $config;
 
-        common_show_header(_('Invite new users'), NULL, $error, array($this, 'show_top'));
+        common_show_header(_('Invite new users'), null, $error, array($this, 'show_top'));
 
         common_element_start('form', array('method' => 'post',
                                            'id' => 'invite',
diff --git a/actions/login.php b/actions/login.php
index 5e4d45149..f3509519e 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -63,7 +63,7 @@ class LoginAction extends Action {
             $url = common_get_returnto();
             if ($url) {
                 # We don't have to return to it again
-                common_set_returnto(NULL);
+                common_set_returnto(null);
             } else {
                 $url = common_local_url('all',
                                         array('nickname' =>
@@ -91,7 +91,7 @@ class LoginAction extends Action {
         $url = common_get_returnto();
         if ($url) {
             # We don't have to return to it again
-            common_set_returnto(NULL);
+            common_set_returnto(null);
         } else {
             $url = common_local_url('all',
                                     array('nickname' =>
@@ -100,8 +100,8 @@ class LoginAction extends Action {
         common_redirect($url);
     }
 
-    function show_form($error=NULL) {
-        common_show_header(_('Login'), NULL, $error, array($this, 'show_top'));
+    function show_form($error=null) {
+        common_show_header(_('Login'), null, $error, array($this, 'show_top'));
         common_element_start('form', array('method' => 'post',
                                            'id' => 'login',
                                            'action' => common_local_url('login')));
@@ -138,7 +138,7 @@ class LoginAction extends Action {
         }
     }
 
-    function show_top($error=NULL) {
+    function show_top($error=null) {
         if ($error) {
             common_element('p', 'error', $error);
         } else {
diff --git a/actions/logout.php b/actions/logout.php
index 5f7b9d502..4c59e47ad 100644
--- a/actions/logout.php
+++ b/actions/logout.php
@@ -32,7 +32,7 @@ class LogoutAction extends Action {
         if (!common_logged_in()) {
             common_user_error(_('Not logged in.'));
         } else {
-            common_set_user(NULL);
+            common_set_user(null);
             common_real_login(false); # not logged in
             common_forgetme(); # don't log back in!
             common_redirect(common_local_url('public'));
diff --git a/actions/newmessage.php b/actions/newmessage.php
index 121fc4246..eb582c2a5 100644
--- a/actions/newmessage.php
+++ b/actions/newmessage.php
@@ -98,7 +98,7 @@ class NewmessageAction extends Action {
         common_message_form($content, $user, $to);
     }
 
-    function show_form($msg=NULL) {
+    function show_form($msg=null) {
         
         $content = $this->trimmed('content');
         $user = common_current_user();
@@ -117,7 +117,7 @@ class NewmessageAction extends Action {
             return;
         }
         
-        common_show_header(_('New message'), NULL,
+        common_show_header(_('New message'), null,
                            array($content, $user, $other),
                            array($this, 'show_top'));
         
diff --git a/actions/newnotice.php b/actions/newnotice.php
index 7c3ad8815..98556c36b 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -78,7 +78,7 @@ class NewnoticeAction extends Action {
 
         $replyto = $this->trimmed('inreplyto');
 
-        $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? NULL : $replyto);
+        $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? null : $replyto);
 
         if (is_string($notice)) {
             $this->show_form($notice);
@@ -121,11 +121,11 @@ class NewnoticeAction extends Action {
         common_element_end('html');
     }
 
-    function show_top($content=NULL) {
-        common_notice_form(NULL, $content);
+    function show_top($content=null) {
+        common_notice_form(null, $content);
     }
 
-    function show_form($msg=NULL) {
+    function show_form($msg=null) {
         if ($msg && $this->boolean('ajax')) {
             $this->ajax_error_msg($msg);
             return;
@@ -138,7 +138,7 @@ class NewnoticeAction extends Action {
                 $content = '@' . $profile->nickname . ' ';
             }
         }
-        common_show_header(_('New notice'), NULL, $content,
+        common_show_header(_('New notice'), null, $content,
                            array($this, 'show_top'));
         if ($msg) {
             common_element('p', array('id' => 'error'), $msg);
diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php
index a7df62ca0..d61234df8 100644
--- a/actions/noticesearchrss.php
+++ b/actions/noticesearchrss.php
@@ -65,6 +65,6 @@ class NoticesearchrssAction extends Rss10Action {
     }
 
     function get_image() {
-        return NULL;
+        return null;
     }
 }
diff --git a/actions/openidlogin.php b/actions/openidlogin.php
index 6192dfc34..1bf37f28f 100644
--- a/actions/openidlogin.php
+++ b/actions/openidlogin.php
@@ -52,7 +52,7 @@ class OpenidloginAction extends Action {
             }
         } else {
             $openid_url = oid_get_last();
-            $this->show_form(NULL, $openid_url);
+            $this->show_form(null, $openid_url);
         }
     }
 
@@ -60,7 +60,7 @@ class OpenidloginAction extends Action {
         return _('Login with an [OpenID](%%doc.openid%%) account.');
     }
 
-    function show_top($error=NULL) {
+    function show_top($error=null) {
         if ($error) {
             common_element('div', array('class' => 'error'), $error);
         } else {
@@ -72,8 +72,8 @@ class OpenidloginAction extends Action {
         }
     }
 
-    function show_form($error=NULL, $openid_url) {
-        common_show_header(_('OpenID Login'), NULL, $error, array($this, 'show_top'));
+    function show_form($error=null, $openid_url) {
+        common_show_header(_('OpenID Login'), null, $error, array($this, 'show_top'));
         $formaction = common_local_url('openidlogin');
         common_element_start('form', array('method' => 'post',
                                            'id' => 'openidlogin',
diff --git a/actions/openidsettings.php b/actions/openidsettings.php
index dd575bb73..9c0eda6f0 100644
--- a/actions/openidsettings.php
+++ b/actions/openidsettings.php
@@ -30,7 +30,7 @@ class OpenidsettingsAction extends SettingsAction {
                   ' Manage your associated OpenIDs from here.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
 
         $user = common_current_user();
 
@@ -41,8 +41,8 @@ class OpenidsettingsAction extends SettingsAction {
                                            'action' =>
                                            common_local_url('openidsettings')));
         common_hidden('token', common_session_token());
-        common_element('h2', NULL, _('Add OpenID'));
-        common_element('p', NULL,
+        common_element('h2', null, _('Add OpenID'));
+        common_element('p', null,
                        _('If you want to add an OpenID to your account, ' .
                           'enter it in the box below and click "Add".'));
         common_element_start('p');
@@ -66,11 +66,11 @@ class OpenidsettingsAction extends SettingsAction {
 
         if ($cnt > 0) {
 
-            common_element('h2', NULL, _('Remove OpenID'));
+            common_element('h2', null, _('Remove OpenID'));
 
             if ($cnt == 1 && !$user->password) {
 
-                common_element('p', NULL,
+                common_element('p', null,
                                _('Removing your only OpenID would make it impossible to log in! ' .
                                   'If you need to remove it, add another OpenID first.'));
 
@@ -83,7 +83,7 @@ class OpenidsettingsAction extends SettingsAction {
 
             } else {
 
-                common_element('p', NULL,
+                common_element('p', null,
                                _('You can remove an OpenID from your account '.
                                   'by clicking the button marked "Remove".'));
                 $idx = 0;
diff --git a/actions/opensearch.php b/actions/opensearch.php
index 707e929fb..dcde160a4 100644
--- a/actions/opensearch.php
+++ b/actions/opensearch.php
@@ -42,16 +42,16 @@ class OpensearchAction extends Action {
         common_element_start('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
 
         $short_name =  common_config('site', 'name').' '.$short_name;
-        common_element('ShortName', NULL, $short_name);
-        common_element('Contact', NULL, common_config('site', 'email'));
+        common_element('ShortName', null, $short_name);
+        common_element('Contact', null, common_config('site', 'email'));
         common_element('Url', array('type' => 'text/html', 'method' => 'get',
                        'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
         common_element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
         common_element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
-        common_element('AdultContent', NULL, 'false');
-        common_element('Language', NULL, common_language());
-        common_element('OutputEncoding', NULL, 'UTF-8');
-        common_element('InputEncoding', NULL, 'UTF-8');
+        common_element('AdultContent', null, 'false');
+        common_element('Language', null, common_language());
+        common_element('OutputEncoding', null, 'UTF-8');
+        common_element('InputEncoding', null, 'UTF-8');
 
         common_element_end('OpenSearchDescription');
         common_end_xml();
diff --git a/actions/othersettings.php b/actions/othersettings.php
index 9b824cea2..1da6577cb 100644
--- a/actions/othersettings.php
+++ b/actions/othersettings.php
@@ -27,12 +27,12 @@ class OthersettingsAction extends SettingsAction {
         return _('Manage various other options.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $user = common_current_user();
 
         $this->form_header(_('Other Settings'), $msg, $success);
 
-        common_element('h2', NULL, _('URL Auto-shortening'));
+        common_element('h2', null, _('URL Auto-shortening'));
         common_element_start('form', array('method' => 'post',
                                            'id' => 'othersettings',
                                            'action' =>
@@ -57,7 +57,7 @@ class OthersettingsAction extends SettingsAction {
 
         common_element_end('form');
 
-//        common_element('h2', NULL, _('Delete my account'));
+//        common_element('h2', null, _('Delete my account'));
 //        $this->show_delete_form();
 
         common_show_footer();
diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php
index f89de53f7..a52ac317f 100644
--- a/actions/peoplesearch.php
+++ b/actions/peoplesearch.php
@@ -68,8 +68,8 @@ class PeoplesearchAction extends SearchAction {
 
 class PeopleSearchResults extends ProfileList {
 
-    var $terms = NULL;
-    var $pattern = NULL;
+    var $terms = null;
+    var $pattern = null;
     
     function __construct($profile, $terms) {
         parent::__construct($profile);
diff --git a/actions/peopletag.php b/actions/peopletag.php
index f03a3c8af..0327ecbc2 100644
--- a/actions/peopletag.php
+++ b/actions/peopletag.php
@@ -43,7 +43,7 @@ class PeopletagAction extends Action {
         # Looks like we're good; show the header
 
         common_show_header(sprintf(_('Users self-tagged with %s - page %d'), $tag, $page),
-                           NULL, $tag, array($this, 'show_top'));
+                           null, $tag, array($this, 'show_top'));
 
         $this->show_people($tag, $page);
 
@@ -94,7 +94,7 @@ class PeopletagAction extends Action {
     }
 
     function get_title() {
-        return NULL;
+        return null;
     }
 
     function show_header($arr) {
diff --git a/actions/profilesettings.php b/actions/profilesettings.php
index 3d92161ab..0fa1288dc 100644
--- a/actions/profilesettings.php
+++ b/actions/profilesettings.php
@@ -28,14 +28,14 @@ class ProfilesettingsAction extends SettingsAction {
                   'so people know more about you.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $this->form_header(_('Profile settings'), $msg, $success);
         $this->show_settings_form();
-        common_element('h2', NULL, _('Avatar'));
+        common_element('h2', null, _('Avatar'));
         $this->show_avatar_form();
-        common_element('h2', NULL, _('Change password'));
+        common_element('h2', null, _('Change password'));
         $this->show_password_form();
-//        common_element('h2', NULL, _('Delete my account'));
+//        common_element('h2', null, _('Delete my account'));
 //        $this->show_delete_form();
         common_show_footer();
     }
diff --git a/actions/public.php b/actions/public.php
index 422e4bc98..60238e54d 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -31,7 +31,7 @@ class PublicAction extends StreamAction {
         header('X-XRDS-Location: '. common_local_url('publicxrds'));
 
         common_show_header(_('Public timeline'),
-                           array($this, 'show_header'), NULL,
+                           array($this, 'show_header'), null,
                            array($this, 'show_top'));
 
         # XXX: Public sidebar here?
diff --git a/actions/publicrss.php b/actions/publicrss.php
index fa86de1d9..764f0fae2 100644
--- a/actions/publicrss.php
+++ b/actions/publicrss.php
@@ -52,6 +52,6 @@ class PublicrssAction extends Rss10Action {
     }
 
     function get_image() {
-        return NULL;
+        return null;
     }
 }
\ No newline at end of file
diff --git a/actions/publicxrds.php b/actions/publicxrds.php
index ffd65c8c9..5e3349185 100644
--- a/actions/publicxrds.php
+++ b/actions/publicxrds.php
@@ -42,7 +42,7 @@ class PublicxrdsAction extends Action {
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
 
-        common_element('Type', NULL, 'xri://$xrds*simple');
+        common_element('Type', null, 'xri://$xrds*simple');
 
         foreach (array('finishopenidlogin', 'finishaddopenid', 'finishimmediate') as $finish) {
             $this->show_service(Auth_OpenID_RP_RETURN_TO_URL_TYPE,
@@ -55,24 +55,24 @@ class PublicxrdsAction extends Action {
         common_end_xml();
     }
 
-    function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
+    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
         common_element_start('Service');
         if ($uri) {
-            common_element('URI', NULL, $uri);
+            common_element('URI', null, $uri);
         }
-        common_element('Type', NULL, $type);
+        common_element('Type', null, $type);
         if ($params) {
             foreach ($params as $param) {
-                common_element('Type', NULL, $param);
+                common_element('Type', null, $param);
             }
         }
         if ($sigs) {
             foreach ($sigs as $sig) {
-                common_element('Type', NULL, $sig);
+                common_element('Type', null, $sig);
             }
         }
         if ($localId) {
-            common_element('LocalID', NULL, $localId);
+            common_element('LocalID', null, $localId);
         }
         common_element_end('Service');
     }
diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php
index 1263fee9b..068d582fa 100644
--- a/actions/recoverpassword.php
+++ b/actions/recoverpassword.php
@@ -132,12 +132,12 @@ class RecoverpasswordAction extends Action {
         unset($_SESSION['tempuser']);
     }
 
-    function show_top($msg=NULL) {
+    function show_top($msg=null) {
         if ($msg) {
             common_element('div', 'error', $msg);
         } else {
             common_element_start('div', 'instructions');
-            common_element('p', NULL, 
+            common_element('p', null, 
                            _('If you\'ve forgotten or lost your' .
                               ' password, you can get a new one sent to' .
                               ' the email address you have stored ' .
@@ -146,7 +146,7 @@ class RecoverpasswordAction extends Action {
         }
     }
 
-    function show_password_top($msg=NULL) {
+    function show_password_top($msg=null) {
         if ($msg) {
             common_element('div', 'error', $msg);
         } else {
@@ -156,9 +156,9 @@ class RecoverpasswordAction extends Action {
         }
     }
 
-    function show_form($msg=NULL) {
+    function show_form($msg=null) {
 
-        common_show_header(_('Recover password'), NULL,
+        common_show_header(_('Recover password'), null,
         $msg, array($this, 'show_top'));
 
         common_element_start('form', array('method' => 'post',
@@ -173,9 +173,9 @@ class RecoverpasswordAction extends Action {
         common_show_footer();
     }
 
-    function show_password_form($msg=NULL) {
+    function show_password_form($msg=null) {
 
-        common_show_header(_('Reset password'), NULL,
+        common_show_header(_('Reset password'), null,
         $msg, array($this, 'show_password_top'));
 
         common_element_start('form', array('method' => 'post',
@@ -224,7 +224,7 @@ class RecoverpasswordAction extends Action {
             $confirm_email = Confirm_address::staticGet('user_id', $user->id);
             if ($confirm_email && $confirm_email->address_type != 'email') {
                 # Skip non-email confirmations
-                $confirm_email = NULL;
+                $confirm_email = null;
             }
         }
 
@@ -267,7 +267,7 @@ class RecoverpasswordAction extends Action {
         mail_to_user($user, _('Password recovery requested'), $body, $confirm->address);
 
         common_show_header(_('Password recovery requested'));
-        common_element('p', NULL,
+        common_element('p', null,
                        _('Instructions for recovering your password ' .
                           'have been sent to the email address registered to your ' .
                           'account.'));
@@ -324,7 +324,7 @@ class RecoverpasswordAction extends Action {
         common_real_login(true);
 
         common_show_header(_('Password saved.'));
-        common_element('p', NULL, _('New password successfully saved. ' .
+        common_element('p', null, _('New password successfully saved. ' .
                                      'You are now logged in.'));
         common_show_footer();
     }
diff --git a/actions/register.php b/actions/register.php
index 011aa3f09..f3eaf6122 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -149,7 +149,7 @@ class RegisterAction extends Action {
         return ($user !== false);
     }
 
-    function show_top($error=NULL) {
+    function show_top($error=null) {
         if ($error) {
             common_element('p', 'error', $error);
         } else {
@@ -164,7 +164,7 @@ class RegisterAction extends Action {
         }
     }
 
-    function show_form($error=NULL) {
+    function show_form($error=null) {
         global $config;
 
         $code = $this->trimmed('code');
@@ -178,7 +178,7 @@ class RegisterAction extends Action {
             return;
         }
 
-        common_show_header(_('Register'), NULL, $error, array($this, 'show_top'));
+        common_show_header(_('Register'), null, $error, array($this, 'show_top'));
         common_element_start('form', array('method' => 'post',
                                            'id' => 'login',
                                            'action' => common_local_url('register')));
diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php
index 14e8cb068..be2cb1025 100644
--- a/actions/remotesubscribe.php
+++ b/actions/remotesubscribe.php
@@ -55,7 +55,7 @@ class RemotesubscribeAction extends Action {
                   ' enter your profile URL below.');
     }
 
-    function show_top($err=NULL) {
+    function show_top($err=null) {
         if ($err) {
             common_element('div', 'error', $err);
         } else {
@@ -67,10 +67,10 @@ class RemotesubscribeAction extends Action {
         }
     }
 
-    function show_form($err=NULL) {
+    function show_form($err=null) {
         $nickname = $this->trimmed('nickname');
         $profile = $this->trimmed('profile_url');
-        common_show_header(_('Remote subscribe'), NULL, $err,
+        common_show_header(_('Remote subscribe'), null, $err,
                            array($this, 'show_top'));
         # id = remotesubscribe conflicts with the
         # button on profile page
@@ -153,7 +153,7 @@ class RemotesubscribeAction extends Action {
     }
 
     function get_user() {
-        $user = NULL;
+        $user = null;
         $nickname = $this->trimmed('nickname');
         if ($nickname) {
             $user = User::staticGet('nickname', $nickname);
@@ -173,7 +173,7 @@ class RemotesubscribeAction extends Action {
         $oauth_services = omb_get_services($xrds, OAUTH_DISCOVERY);
 
         if (!$oauth_services) {
-            return NULL;
+            return null;
         }
 
         $oauth_service = $oauth_services[0];
@@ -181,17 +181,17 @@ class RemotesubscribeAction extends Action {
         $oauth_xrd = $this->getXRD($oauth_service, $xrds);
 
         if (!$oauth_xrd) {
-            return NULL;
+            return null;
         }
 
         if (!$this->addServices($oauth_xrd, $oauth_endpoints, $omb)) {
-            return NULL;
+            return null;
         }
 
         $omb_services = omb_get_services($xrds, OMB_NAMESPACE);
 
         if (!$omb_services) {
-            return NULL;
+            return null;
         }
 
         $omb_service = $omb_services[0];
@@ -199,23 +199,23 @@ class RemotesubscribeAction extends Action {
         $omb_xrd = $this->getXRD($omb_service, $xrds);
 
         if (!$omb_xrd) {
-            return NULL;
+            return null;
         }
 
         if (!$this->addServices($omb_xrd, $omb_endpoints, $omb)) {
-            return NULL;
+            return null;
         }
 
         # XXX: check that we got all the services we needed
 
         foreach (array_merge($omb_endpoints, $oauth_endpoints) as $type) {
             if (!array_key_exists($type, $omb) || !$omb[$type]) {
-                return NULL;
+                return null;
             }
         }
 
         if (!omb_local_id($omb[OAUTH_ENDPOINT_REQUEST])) {
-            return NULL;
+            return null;
         }
 
         return $omb;
@@ -225,7 +225,7 @@ class RemotesubscribeAction extends Action {
         $uri = omb_service_uri($main_service);
         if (strpos($uri, "#") !== 0) {
             # FIXME: more rigorous handling of external service definitions
-            return NULL;
+            return null;
         }
         $id = substr($uri, 1);
         $nodes = $main_xrds->allXrdNodes;
@@ -239,7 +239,7 @@ class RemotesubscribeAction extends Action {
                 return new Auth_Yadis_XRDS($parser, $bogus_nodes);
             }
         }
-        return NULL;
+        return null;
     }
 
     function addServices($xrd, $types, &$omb) {
@@ -267,12 +267,12 @@ class RemotesubscribeAction extends Action {
         $params = array();
         parse_str($parsed['query'], $params);
 
-        $req = OAuthRequest::from_consumer_and_token($con, NULL, "POST", $url, $params);
+        $req = OAuthRequest::from_consumer_and_token($con, null, "POST", $url, $params);
 
         $listener = omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]);
 
         if (!$listener) {
-            return NULL;
+            return null;
         }
 
         $req->set_parameter('omb_listener', $listener);
@@ -280,7 +280,7 @@ class RemotesubscribeAction extends Action {
 
         # XXX: test to see if endpoint accepts this signature method
 
-        $req->sign_request(omb_hmac_sha1(), $con, NULL);
+        $req->sign_request(omb_hmac_sha1(), $con, null);
 
         # We re-use this tool's fetcher, since it's pretty good
 
@@ -291,7 +291,7 @@ class RemotesubscribeAction extends Action {
                                  array('User-Agent' => 'Laconica/' . LACONICA_VERSION));
 
         if ($result->status != 200) {
-            return NULL;
+            return null;
         }
 
         parse_str($result->body, $return);
diff --git a/actions/repliesrss.php b/actions/repliesrss.php
index 3689ea1f8..9652ae9ea 100644
--- a/actions/repliesrss.php
+++ b/actions/repliesrss.php
@@ -25,7 +25,7 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class RepliesrssAction extends Rss10Action {
 
-    var $user = NULL;
+    var $user = null;
 
     function init() {
         $nickname = $this->trimmed('nickname');
@@ -71,9 +71,9 @@ class RepliesrssAction extends Rss10Action {
         $user = $this->user;
         $profile = $user->getProfile();
         if (!$profile) {
-            return NULL;
+            return null;
         }
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-        return ($avatar) ? $avatar->url : NULL;
+        return ($avatar) ? $avatar->url : null;
     }
 }
\ No newline at end of file
diff --git a/actions/showmessage.php b/actions/showmessage.php
index f35f3eede..a5e03c72d 100644
--- a/actions/showmessage.php
+++ b/actions/showmessage.php
@@ -53,7 +53,7 @@ class ShowmessageAction extends MailboxAction {
     function get_title($user, $page) {
         $message = $this->get_message();
         if (!$message) {
-            return NULL;
+            return null;
         }
         
         if ($user->id == $message->from_profile) {
@@ -85,7 +85,7 @@ class ShowmessageAction extends MailboxAction {
             return $message->getFrom();
         } else {
             # This shouldn't happen
-            return NULL;
+            return null;
         }
     }
     
diff --git a/actions/shownotice.php b/actions/shownotice.php
index 74d197ed1..04af61a6f 100644
--- a/actions/shownotice.php
+++ b/actions/shownotice.php
@@ -23,9 +23,9 @@ require_once(INSTALLDIR.'/lib/stream.php');
 
 class ShownoticeAction extends StreamAction {
 
-    var $notice = NULL;
-    var $profile = NULL;
-    var $avatar = NULL;
+    var $notice = null;
+    var $profile = null;
+    var $avatar = null;
 
     function prepare($args) {
 
@@ -73,7 +73,7 @@ class ShownoticeAction extends StreamAction {
         common_show_header(sprintf(_('%1$s\'s status on %2$s'),
                                    $this->profile->nickname,
                                    common_exact_date($this->notice->created)),
-                           array($this, 'show_header'), NULL,
+                           array($this, 'show_header'), null,
                            array($this, 'show_top'));
 
         common_element_start('ul', array('id' => 'notices'));
diff --git a/actions/showstream.php b/actions/showstream.php
index f8525348d..485c2e3d1 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -285,7 +285,7 @@ class ShowstreamAction extends StreamAction {
 
         common_element_start('div', array('id' => 'subscriptions'));
 
-        common_element('h2', NULL, _('Subscriptions'));
+        common_element('h2', null, _('Subscriptions'));
 
         if ($subs_count > 0) {
 
@@ -415,7 +415,7 @@ class ShowstreamAction extends StreamAction {
 
     function show_last_notice($profile) {
 
-        common_element('h2', NULL, _('Currently'));
+        common_element('h2', null, _('Currently'));
 
         $notice = $profile->getCurrentNotice();
 
diff --git a/actions/smssettings.php b/actions/smssettings.php
index 506801e97..71ab39514 100644
--- a/actions/smssettings.php
+++ b/actions/smssettings.php
@@ -28,7 +28,7 @@ class SmssettingsAction extends EmailsettingsAction {
         return _('You can receive SMS messages through email from %%site.name%%.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $user = common_current_user();
         $this->form_header(_('SMS Settings'), $msg, $success);
         common_element_start('form', array('method' => 'post',
@@ -36,7 +36,7 @@ class SmssettingsAction extends EmailsettingsAction {
                                            'action' =>
                                            common_local_url('smssettings')));
         common_hidden('token', common_session_token());
-        common_element('h2', NULL, _('Address'));
+        common_element('h2', null, _('Address'));
 
         if ($user->sms) {
             common_element_start('p');
@@ -60,12 +60,12 @@ class SmssettingsAction extends EmailsettingsAction {
                 common_hidden('carrier', $confirm->address_extra);
                 common_element_end('p');
                 common_submit('cancel', _('Cancel'));
-                common_input('code', _('Confirmation code'), NULL,
+                common_input('code', _('Confirmation code'), null,
                              _('Enter the code you received on your phone.'));
                 common_submit('confirm', _('Confirm'));
             } else {
                 common_input('sms', _('SMS Phone number'),
-                             ($this->arg('sms')) ? $this->arg('sms') : NULL,
+                             ($this->arg('sms')) ? $this->arg('sms') : null,
                              _('Phone number, no punctuation or spaces, with area code'));
                 $this->carrier_select();
                 common_submit('add', _('Add'));
@@ -73,7 +73,7 @@ class SmssettingsAction extends EmailsettingsAction {
         }
 
         if ($user->sms) {
-            common_element('h2', NULL, _('Incoming email'));
+            common_element('h2', null, _('Incoming email'));
             
             if ($user->incomingemail) {
                 common_element_start('p');
@@ -91,7 +91,7 @@ class SmssettingsAction extends EmailsettingsAction {
             common_submit('newincoming', _('New'));
         }
         
-        common_element('h2', NULL, _('Preferences'));
+        common_element('h2', null, _('Preferences'));
         
         common_checkbox('smsnotify',
                         _('Send me notices through SMS; I understand I may incur exorbitant charges from my carrier.'),
@@ -111,7 +111,7 @@ class SmssettingsAction extends EmailsettingsAction {
         if ($confirm->find(TRUE)) {
             return $confirm;
         } else {
-            return NULL;
+            return null;
         }
     }
 
@@ -268,9 +268,9 @@ class SmssettingsAction extends EmailsettingsAction {
 
         $user->query('BEGIN');
         $original = clone($user);
-        $user->sms = NULL;
-        $user->carrier = NULL;        
-        $user->smsemail = NULL;        
+        $user->sms = null;
+        $user->carrier = null;        
+        $user->smsemail = null;        
         $result = $user->updateKeys($original);
         if (!$result) {
             common_log_db_error($user, 'UPDATE', __FILE__);
diff --git a/actions/subedit.php b/actions/subedit.php
index 1d095ab9a..db935eb28 100644
--- a/actions/subedit.php
+++ b/actions/subedit.php
@@ -21,7 +21,7 @@ if (!defined('LACONICA')) { exit(1); }
 
 class SubeditAction extends Action {
 
-    var $profile = NULL;
+    var $profile = null;
 
     function prepare($args) {
 
diff --git a/actions/tagother.php b/actions/tagother.php
index 832671ae7..4691fef07 100644
--- a/actions/tagother.php
+++ b/actions/tagother.php
@@ -49,12 +49,12 @@ class TagotherAction extends Action {
         }
     }
 
-    function show_form($profile, $error=NULL) {
+    function show_form($profile, $error=null) {
 
         $user = common_current_user();
 
         common_show_header(_('Tag a person'),
-                           NULL, array($profile, $error), array($this, 'show_top'));
+                           null, array($profile, $error), array($this, 'show_top'));
 
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
 
@@ -178,13 +178,13 @@ class TagotherAction extends Action {
         }
     }
 
-    function show_top($arr = NULL) {
+    function show_top($arr = null) {
         list($profile, $error) = $arr;
         if ($error) {
             common_element('p', 'error', $error);
         } else {
             common_element_start('div', 'instructions');
-            common_element('p', NULL,
+            common_element('p', null,
                            _('Use this form to add tags to your subscribers or subscriptions.'));
             common_element_end('div');
         }
diff --git a/actions/tagrss.php b/actions/tagrss.php
index 45639fec4..6199a285d 100644
--- a/actions/tagrss.php
+++ b/actions/tagrss.php
@@ -41,7 +41,7 @@ class TagrssAction extends Rss10Action {
         $tag = $this->tag;
 
         if (is_null($tag)) {
-            return NULL;
+            return null;
         }
 
         $notice = Notice_tag::getStream($tag->tag, 0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
diff --git a/actions/twitapidirect_messages.php b/actions/twitapidirect_messages.php
index 2e3b50173..7adb4eadd 100644
--- a/actions/twitapidirect_messages.php
+++ b/actions/twitapidirect_messages.php
@@ -228,12 +228,12 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
         $this->init_document('rss');
 
         common_element_start('channel');
-        common_element('title', NULL, $title);
+        common_element('title', null, $title);
 
-        common_element('link', NULL, $link);
-        common_element('description', NULL, $subtitle);
-        common_element('language', NULL, 'en-us');
-        common_element('ttl', NULL, '40');
+        common_element('link', null, $link);
+        common_element('description', null, $subtitle);
+        common_element('language', null, 'en-us');
+        common_element('ttl', null, '40');
 
         if (is_array($message)) {
             foreach ($message as $m) {
@@ -256,12 +256,12 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
 
         $this->init_document('atom');
 
-        common_element('title', NULL, $title);
+        common_element('title', null, $title);
         $siteserver = common_config('site', 'server');
-        common_element('id', NULL, "tag:$siteserver,2008:DirectMessage");
-        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
-        common_element('updated', NULL, common_date_iso8601(strftime('%c')));
-        common_element('subtitle', NULL, $subtitle);
+        common_element('id', null, "tag:$siteserver,2008:DirectMessage");
+        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
+        common_element('updated', null, common_date_iso8601(strftime('%c')));
+        common_element('subtitle', null, $subtitle);
 
         if (is_array($message)) {
             foreach ($message as $m) {
diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php
index d352b933b..a52f0fe4d 100644
--- a/actions/twitapifriendships.php
+++ b/actions/twitapifriendships.php
@@ -138,7 +138,7 @@ class TwitapifriendshipsAction extends TwitterapiAction {
         switch ($apidata['content-type']) {
          case 'xml':
             $this->init_document('xml');
-            common_element('friends', NULL, $result);
+            common_element('friends', null, $result);
             $this->end_document('xml');
             break;
          case 'json':
diff --git a/actions/twitapihelp.php b/actions/twitapihelp.php
index d268b7c82..f0e9adfdb 100644
--- a/actions/twitapihelp.php
+++ b/actions/twitapihelp.php
@@ -32,7 +32,7 @@ class TwitapihelpAction extends TwitterapiAction {
 
         if ($apidata['content-type'] == 'xml') {
             $this->init_document('xml');
-            common_element('ok', NULL, 'true');
+            common_element('ok', null, 'true');
             $this->end_document('xml');
         } elseif ($apidata['content-type'] == 'json') {
             $this->init_document('json');
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index c33643a3c..ffa94b309 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -112,7 +112,7 @@ class TwitapistatusesAction extends TwitterapiAction {
 
         $since = strtotime($this->arg('since'));
 
-        $user = $this->get_user(NULL, $apidata);
+        $user = $this->get_user(null, $apidata);
         $this->auth_user = $user;
 
         $profile = $user->getProfile();
@@ -200,7 +200,7 @@ class TwitapistatusesAction extends TwitterapiAction {
         # FriendFeed's SUP protocol
         # Also added RSS and Atom feeds
 
-        $suplink = common_local_url('sup', NULL, $user->id);
+        $suplink = common_local_url('sup', null, $user->id);
         header('X-SUP-ID: '.$suplink);
 
         # XXX: since
@@ -291,7 +291,7 @@ class TwitapistatusesAction extends TwitterapiAction {
             $apidata['api_arg'] = $n->id;
         } else {
 
-            $reply_to = NULL;
+            $reply_to = null;
 
             if ($in_reply_to_status_id) {
 
diff --git a/actions/twittersettings.php b/actions/twittersettings.php
index e300e699a..8cbd39fbd 100644
--- a/actions/twittersettings.php
+++ b/actions/twittersettings.php
@@ -30,10 +30,10 @@ class TwittersettingsAction extends SettingsAction {
             'and subscribe to Twitter friends already here.');
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         $user = common_current_user();
         $profile = $user->getProfile();
-        $fuser = NULL;
+        $fuser = null;
         $flink = Foreign_link::getByUserID($user->id, 1); // 1 == Twitter
 
         if ($flink) {
@@ -47,7 +47,7 @@ class TwittersettingsAction extends SettingsAction {
                                            common_local_url('twittersettings')));
         common_hidden('token', common_session_token());
 
-        common_element('h2', NULL, _('Twitter Account'));
+        common_element('h2', null, _('Twitter Account'));
 
         if ($fuser) {
             common_element_start('p');
@@ -67,7 +67,7 @@ class TwittersettingsAction extends SettingsAction {
             common_password('twitter_password', _('Twitter password'));
         }
 
-        common_element('h2', NULL, _('Preferences'));
+        common_element('h2', null, _('Preferences'));
 
         common_checkbox('noticesync', _('Automatically send my notices to Twitter.'),
                         ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
@@ -126,7 +126,7 @@ class TwittersettingsAction extends SettingsAction {
 
         if ($friends_count > 0) {
 
-            common_element('h3', NULL, _('Twitter Friends'));
+            common_element('h3', null, _('Twitter Friends'));
             common_element_start('div', array('id' => 'subscriptions'));
             common_element_start('ul', array('id' => 'subscriptions_avatars'));
 
diff --git a/actions/unblock.php b/actions/unblock.php
index 6a86c2bf0..51ec0ae57 100644
--- a/actions/unblock.php
+++ b/actions/unblock.php
@@ -21,7 +21,7 @@ if (!defined('LACONICA')) { exit(1); }
 
 class UnblockAction extends Action {
 
-    var $profile = NULL;
+    var $profile = null;
 
     function prepare($args) {
 
diff --git a/actions/userauthorization.php b/actions/userauthorization.php
index 97809f197..58ec36fc8 100644
--- a/actions/userauthorization.php
+++ b/actions/userauthorization.php
@@ -81,7 +81,7 @@ class UserauthorizationAction extends Action {
         $avatar = $req->get_parameter('omb_listenee_avatar');
 
         common_show_header(_('Authorize subscription'));
-        common_element('p', NULL, _('Please check these details to make sure '.
+        common_element('p', null, _('Please check these details to make sure '.
                                      'that you want to subscribe to this user\'s notices. '.
                                      'If you didn\'t just ask to subscribe to someone\'s notices, '.
                                      'click "Cancel".'));
@@ -320,7 +320,7 @@ class UserauthorizationAction extends Action {
 
     function show_accept_message($tok) {
         common_show_header(_('Subscription authorized'));
-        common_element('p', NULL,
+        common_element('p', null,
                        _('The subscription has been authorized, but no '.
                           'callback URL was passed. Check with the site\'s instructions for '.
                           'details on how to authorize the subscription. Your subscription token is:'));
@@ -330,7 +330,7 @@ class UserauthorizationAction extends Action {
 
     function show_reject_message($tok) {
         common_show_header(_('Subscription rejected'));
-        common_element('p', NULL,
+        common_element('p', null,
                        _('The subscription has been rejected, but no '.
                           'callback URL was passed. Check with the site\'s instructions for '.
                           'details on how to fully reject the subscription.'));
diff --git a/actions/userbyid.php b/actions/userbyid.php
index 4eab8758c..3fa92e9ce 100644
--- a/actions/userbyid.php
+++ b/actions/userbyid.php
@@ -38,7 +38,7 @@ class UserbyidAction extends Action {
 
         // support redirecting to FOAF rdf/xml if the agent prefers it
         $page_prefs = 'application/rdf+xml,text/html,application/xhtml+xml,application/xml;q=0.3,text/xml;q=0.2';
-        $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : NULL;
+        $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
         $type = common_negotiate_type(common_accept_to_prefs($httpaccept),
                                       common_accept_to_prefs($page_prefs));
         $page = $type == 'application/rdf+xml' ? 'foaf' : 'showstream';
diff --git a/actions/userrss.php b/actions/userrss.php
index b5cb5a40a..6089718ae 100644
--- a/actions/userrss.php
+++ b/actions/userrss.php
@@ -25,7 +25,7 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class UserrssAction extends Rss10Action {
 
-    var $user = NULL;
+    var $user = null;
 
     function init() {
         $nickname = $this->trimmed('nickname');
@@ -44,7 +44,7 @@ class UserrssAction extends Rss10Action {
         $user = $this->user;
         
         if (is_null($user)) {
-            return NULL;
+            return null;
         }
         
         $notice = $user->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
@@ -74,16 +74,16 @@ class UserrssAction extends Rss10Action {
         if (!$profile) {
             common_log_db_error($user, 'SELECT', __FILE__);
             $this->server_error(_('User without matching profile'));
-            return NULL;
+            return null;
         }
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-        return ($avatar) ? $avatar->url : NULL;
+        return ($avatar) ? $avatar->url : null;
     }
 
     # override parent to add X-SUP-ID URL
     
     function init_rss($limit=0) {
-        $url = common_local_url('sup', NULL, $this->user->id);
+        $url = common_local_url('sup', null, $this->user->id);
         header('X-SUP-ID: '.$url);
         parent::init_rss($limit);
     }
diff --git a/actions/xrds.php b/actions/xrds.php
index 9788c87aa..54baf64be 100644
--- a/actions/xrds.php
+++ b/actions/xrds.php
@@ -50,7 +50,7 @@ class XrdsAction extends Action {
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
 
-        common_element('Type', NULL, 'xri://$xrds*simple');
+        common_element('Type', null, 'xri://$xrds*simple');
 
         $this->show_service(OAUTH_ENDPOINT_REQUEST,
                             common_local_url('requesttoken'),
@@ -69,7 +69,7 @@ class XrdsAction extends Action {
                             array(OAUTH_HMAC_SHA1));
 
         $this->show_service(OAUTH_ENDPOINT_RESOURCE,
-                            NULL,
+                            null,
                             array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
                             array(OAUTH_HMAC_SHA1));
 
@@ -82,7 +82,7 @@ class XrdsAction extends Action {
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
 
-        common_element('Type', NULL, 'xri://$xrds*simple');
+        common_element('Type', null, 'xri://$xrds*simple');
 
         $this->show_service(OMB_ENDPOINT_POSTNOTICE,
                             common_local_url('postnotice'));
@@ -95,7 +95,7 @@ class XrdsAction extends Action {
         common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
                                           'version' => '2.0'));
 
-        common_element('Type', NULL, 'xri://$xrds*simple');
+        common_element('Type', null, 'xri://$xrds*simple');
 
         $this->show_service(OAUTH_DISCOVERY,
                             '#oauth');
@@ -108,24 +108,24 @@ class XrdsAction extends Action {
         common_end_xml();
     }
 
-    function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
+    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
         common_element_start('Service');
         if ($uri) {
-            common_element('URI', NULL, $uri);
+            common_element('URI', null, $uri);
         }
-        common_element('Type', NULL, $type);
+        common_element('Type', null, $type);
         if ($params) {
             foreach ($params as $param) {
-                common_element('Type', NULL, $param);
+                common_element('Type', null, $param);
             }
         }
         if ($sigs) {
             foreach ($sigs as $sig) {
-                common_element('Type', NULL, $sig);
+                common_element('Type', null, $sig);
             }
         }
         if ($localId) {
-            common_element('LocalID', NULL, $localId);
+            common_element('LocalID', null, $localId);
         }
         common_element_end('Service');
     }
diff --git a/classes/Avatar.php b/classes/Avatar.php
index e63668a33..bde983d79 100644
--- a/classes/Avatar.php
+++ b/classes/Avatar.php
@@ -21,7 +21,7 @@ class Avatar extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -72,7 +72,7 @@ class Avatar extends Memcached_DataObject
         if ($scaled->insert()) {
             return $scaled;
         } else {
-            return NULL;
+            return null;
         }
     }
 
@@ -85,7 +85,7 @@ class Avatar extends Memcached_DataObject
         } else if ($this->mediatype == 'image/png') {
             return imagecreatefrompng($filepath);
         } else {
-            return NULL;
+            return null;
         }
     }
     
diff --git a/classes/Channel.php b/classes/Channel.php
index 384fe8bb1..ea3530406 100644
--- a/classes/Channel.php
+++ b/classes/Channel.php
@@ -38,13 +38,13 @@ class Channel {
     }
     
     function source() {
-        return NULL;
+        return null;
     }
 }
 
 class XMPPChannel extends Channel {
 
-    var $conn = NULL;
+    var $conn = null;
     
     function source() {
         return 'xmpp';
@@ -111,7 +111,7 @@ class WebChannel extends Channel {
         # XXX: even better, redirect to appropriate page
         #      depending on what command was run
         common_show_header(_('Command results'));
-        common_element('p', NULL, $text);
+        common_element('p', null, $text);
         common_show_footer();
     }
     
@@ -149,13 +149,13 @@ class AjaxWebChannel extends WebChannel {
 
 class MailChannel extends Channel {
 
-    var $addr = NULL;
+    var $addr = null;
 
     function source() {
         return 'mail';
     }
     
-    function __construct($addr=NULL) {
+    function __construct($addr=null) {
         $this->addr = $addr;
     }
     
diff --git a/classes/Command.php b/classes/Command.php
index ff44b9d1e..b146005a7 100644
--- a/classes/Command.php
+++ b/classes/Command.php
@@ -23,9 +23,9 @@ require_once(INSTALLDIR.'/classes/Channel.php');
 
 class Command {
     
-    var $user = NULL;
+    var $user = null;
     
-    function __construct($user=NULL) {
+    function __construct($user=null) {
         $this->user = $user;
     }
     
@@ -47,7 +47,7 @@ class TrackOffCommand extends UnimplementedCommand {
 }
 
 class TrackCommand extends UnimplementedCommand {
-    var $word = NULL;
+    var $word = null;
     function __construct($user, $word) {
         parent::__construct($user);
         $this->word = $word;
@@ -55,7 +55,7 @@ class TrackCommand extends UnimplementedCommand {
 }
 
 class UntrackCommand extends UnimplementedCommand {
-    var $word = NULL;
+    var $word = null;
     function __construct($user, $word) {
         parent::__construct($user);
         $this->word = $word;
@@ -63,7 +63,7 @@ class UntrackCommand extends UnimplementedCommand {
 }
 
 class NudgeCommand extends UnimplementedCommand {
-    var $other = NULL;
+    var $other = null;
     function __construct($user, $other) {
         parent::__construct($user);
         $this->other = $other;
@@ -71,7 +71,7 @@ class NudgeCommand extends UnimplementedCommand {
 }
 
 class InviteCommand extends UnimplementedCommand {
-    var $other = NULL;
+    var $other = null;
     function __construct($user, $other) {
         parent::__construct($user);
         $this->other = $other;
@@ -104,7 +104,7 @@ class StatsCommand extends Command {
 
 class FavCommand extends Command {
     
-    var $other = NULL;
+    var $other = null;
     
     function __construct($user, $other) {
         parent::__construct($user);
@@ -148,7 +148,7 @@ class FavCommand extends Command {
 }
 
 class WhoisCommand extends Command {
-    var $other = NULL;
+    var $other = null;
     function __construct($user, $other) {
         parent::__construct($user);
         $this->other = $other;
@@ -182,8 +182,8 @@ class WhoisCommand extends Command {
 }
 
 class MessageCommand extends Command {
-    var $other = NULL;
-    var $text = NULL;
+    var $other = null;
+    var $text = null;
     function __construct($user, $other, $text) {
         parent::__construct($user);
         $this->other = $other;
@@ -225,7 +225,7 @@ class MessageCommand extends Command {
 
 class GetCommand extends Command {
     
-    var $other = NULL;
+    var $other = null;
     
     function __construct($user, $other) {
         parent::__construct($user);
@@ -255,7 +255,7 @@ class GetCommand extends Command {
 
 class SubCommand extends Command {
     
-    var $other = NULL;
+    var $other = null;
     
     function __construct($user, $other) {
         parent::__construct($user);
@@ -281,7 +281,7 @@ class SubCommand extends Command {
 
 class UnsubCommand extends Command {
 
-    var $other = NULL;
+    var $other = null;
     
     function __construct($user, $other) {
         parent::__construct($user);
@@ -305,8 +305,8 @@ class UnsubCommand extends Command {
 }
 
 class OffCommand extends Command {
-    var $other = NULL;
-    function __construct($user, $other=NULL) {
+    var $other = null;
+    function __construct($user, $other=null) {
         parent::__construct($user);
         $this->other = $other;
     }
@@ -324,8 +324,8 @@ class OffCommand extends Command {
 }
 
 class OnCommand extends Command {
-    var $other = NULL;
-    function __construct($user, $other=NULL) {
+    var $other = null;
+    function __construct($user, $other=null) {
         parent::__construct($user);
         $this->other = $other;
     }
diff --git a/classes/CommandInterpreter.php b/classes/CommandInterpreter.php
index 8192fb1a9..db02ce541 100644
--- a/classes/CommandInterpreter.php
+++ b/classes/CommandInterpreter.php
@@ -37,14 +37,14 @@ class CommandInterpreter {
         switch(strtolower($cmd)) {
          case 'help':
             if ($arg) {
-                return NULL;
+                return null;
             }
             return new HelpCommand($user);
          case 'on':
             if ($arg) {
                 list($other, $extra) = explode(' ', $arg, 2);
                 if ($extra) {
-                    return NULL;
+                    return null;
                 } else {
                     return new OnCommand($user, $other);
                 }
@@ -55,7 +55,7 @@ class CommandInterpreter {
             if ($arg) {
                 list($other, $extra) = explode(' ', $arg, 2);
                 if ($extra) {
-                    return NULL;
+                    return null;
                 } else {
                     return new OffCommand($user, $other);
                 }
@@ -65,105 +65,105 @@ class CommandInterpreter {
          case 'stop':
          case 'quit':
             if ($arg) {
-                return NULL;
+                return null;
             } else {
                 return new OffCommand($user);
             }
          case 'follow':
          case 'sub':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new SubCommand($user, $other);
             }
          case 'leave':
          case 'unsub':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new UnsubCommand($user, $other);
             }
          case 'get':
          case 'last':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new GetCommand($user, $other);
             }
          case 'd':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if (!$extra) {
-                return NULL;
+                return null;
             } else {
                 return new MessageCommand($user, $other, $extra);
             }
          case 'whois':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new WhoisCommand($user, $other);
             }
          case 'fav':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new FavCommand($user, $other);
             }
          case 'nudge':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new NudgeCommand($user, $other);
             }
          case 'stats':
             if ($arg) {
-                return NULL;
+                return null;
             }
             return new StatsCommand($user);
          case 'invite':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($other, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else {
                 return new InviteCommand($user, $other);
             }
          case 'track':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($word, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else if ($word == 'off') {
                 return new TrackOffCommand($user);
             } else {
@@ -171,11 +171,11 @@ class CommandInterpreter {
             }
          case 'untrack':
             if (!$arg) {
-                return NULL;
+                return null;
             }
             list($word, $extra) = explode(' ', $arg, 2);
             if ($extra) {
-                return NULL;
+                return null;
             } else if ($word == 'all') {
                 return new TrackOffCommand($user);
             } else {
@@ -184,7 +184,7 @@ class CommandInterpreter {
          case 'tracks':
          case 'tracking':
             if ($arg) {
-                return NULL;
+                return null;
             }
             return new TrackingCommand($user);
          default:
diff --git a/classes/Confirm_address.php b/classes/Confirm_address.php
index 10661ff5c..71f2d0c72 100644
--- a/classes/Confirm_address.php
+++ b/classes/Confirm_address.php
@@ -20,7 +20,7 @@ class Confirm_address extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Consumer.php b/classes/Consumer.php
index d18e6feeb..c598312aa 100644
--- a/classes/Consumer.php
+++ b/classes/Consumer.php
@@ -16,7 +16,7 @@ class Consumer extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Fave.php b/classes/Fave.php
index b70a8a897..5d938d149 100644
--- a/classes/Fave.php
+++ b/classes/Fave.php
@@ -15,7 +15,7 @@ class Fave extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Fave',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Fave',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Foreign_link.php b/classes/Foreign_link.php
index 7ce0df833..41a95e641 100644
--- a/classes/Foreign_link.php
+++ b/classes/Foreign_link.php
@@ -21,7 +21,7 @@ class Foreign_link extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -38,7 +38,7 @@ class Foreign_link extends Memcached_DataObject
             return $flink;
         }
 
-        return NULL;        
+        return null;        
     }
     
     static function getByForeignID($foreign_id, $service) {
@@ -51,7 +51,7 @@ class Foreign_link extends Memcached_DataObject
             return $flink;
         }
 
-        return NULL;        
+        return null;        
     }
         
     # Convenience methods
@@ -66,7 +66,7 @@ class Foreign_link extends Memcached_DataObject
             return $fuser;
         }
         
-        return NULL;        
+        return null;        
     }
     
     function getUser() {
diff --git a/classes/Foreign_service.php b/classes/Foreign_service.php
index 18ef83d69..128411b71 100644
--- a/classes/Foreign_service.php
+++ b/classes/Foreign_service.php
@@ -17,7 +17,7 @@ class Foreign_service extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Foreign_subscription.php b/classes/Foreign_subscription.php
index 315064067..d8e8569fb 100644
--- a/classes/Foreign_subscription.php
+++ b/classes/Foreign_subscription.php
@@ -16,7 +16,7 @@ class Foreign_subscription extends Memcached_DataObject
     public $created;                         // datetime()   not_null
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Foreign_user.php b/classes/Foreign_user.php
index 396680128..f8a980884 100644
--- a/classes/Foreign_user.php
+++ b/classes/Foreign_user.php
@@ -18,7 +18,7 @@ class Foreign_user extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -36,7 +36,7 @@ class Foreign_user extends Memcached_DataObject
             return $fuser;
         }
         
-        return NULL;        
+        return null;        
     }
     
     function updateKeys(&$orig) {
diff --git a/classes/Invitation.php b/classes/Invitation.php
index 1477391b0..ff6456445 100644
--- a/classes/Invitation.php
+++ b/classes/Invitation.php
@@ -17,7 +17,7 @@ class Invitation extends Memcached_DataObject
     public $created;                         // datetime()   not_null
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php
index 7699e1b38..1d12730c9 100644
--- a/classes/Memcached_DataObject.php
+++ b/classes/Memcached_DataObject.php
@@ -23,7 +23,7 @@ require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
 
 class Memcached_DataObject extends DB_DataObject 
 {
-    function &staticGet($cls, $k, $v=NULL) {
+    function &staticGet($cls, $k, $v=null) {
         if (is_null($v)) {
             $v = $k;
             # XXX: HACK!
@@ -56,7 +56,7 @@ class Memcached_DataObject extends DB_DataObject
             if ($i->find(true)) {
                 $i->encache();
             } else {
-                $i = NULL;
+                $i = null;
             }
             return $i;
         }
@@ -67,7 +67,7 @@ class Memcached_DataObject extends DB_DataObject
         return $result;
     }
     
-    function update($orig=NULL) {
+    function update($orig=null) {
         if (is_object($orig) && $orig instanceof Memcached_DataObject) {
             $orig->decache(); # might be different keys
         }
diff --git a/classes/Message.php b/classes/Message.php
index dc527fcb1..e04fbb3c0 100644
--- a/classes/Message.php
+++ b/classes/Message.php
@@ -22,7 +22,7 @@ class Message extends Memcached_DataObject
     public $source;                          // varchar(32)  
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Message',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Message',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Nonce.php b/classes/Nonce.php
index 89d673c53..54d20de9c 100644
--- a/classes/Nonce.php
+++ b/classes/Nonce.php
@@ -18,7 +18,7 @@ class Nonce extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Notice.php b/classes/Notice.php
index 35e03e342..e6152812c 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -48,7 +48,7 @@ class Notice extends Memcached_DataObject
     public $source;                             // varchar(32)
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -91,7 +91,7 @@ class Notice extends Memcached_DataObject
         return true;
     }
 
-    static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL, $uri=NULL) {
+    static function saveNew($profile_id, $content, $source=null, $is_local=1, $reply_to=null, $uri=null) {
 
         $profile = Profile::staticGet($profile_id);
 
@@ -293,7 +293,7 @@ class Notice extends Memcached_DataObject
     # XXX: too many args; we need to move to named params or even a separate
     # class for notice streams
 
-    static function getStream($qry, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $order=NULL, $since=NULL) {
+    static function getStream($qry, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $order=null, $since=null) {
 
         if (common_config('memcached', 'enabled')) {
 
@@ -383,7 +383,7 @@ class Notice extends Memcached_DataObject
         # If outside our cache window, just go to the DB
 
         if ($offset + $limit > NOTICE_CACHE_WINDOW) {
-            return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
+            return Notice::getStreamDirect($qry, $offset, $limit, null, null, $order, null);
         }
 
         # Get the cache; if we can't, just go to the DB
@@ -391,7 +391,7 @@ class Notice extends Memcached_DataObject
         $cache = common_memcache();
 
         if (!$cache) {
-            return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
+            return Notice::getStreamDirect($qry, $offset, $limit, null, null, $order, null);
         }
 
         # Get the notices out of the cache
@@ -423,7 +423,7 @@ class Notice extends Memcached_DataObject
             # bet with our DB.
 
             $new_notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW,
-                                                  $last_id, NULL, $order, NULL);
+                                                  $last_id, null, $order, null);
 
             if ($new_notice) {
                 $new_notices = array();
@@ -447,7 +447,7 @@ class Notice extends Memcached_DataObject
 
         # Otherwise, get the full cache window out of the DB
 
-        $notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW, NULL, NULL, $order, NULL);
+        $notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW, null, null, $order, null);
 
         # If there are no hits, just return the value
 
@@ -477,7 +477,7 @@ class Notice extends Memcached_DataObject
         return $wrapper;
     }
 
-    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=NULL) {
+    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null) {
 
         $parts = array();
 
@@ -496,7 +496,7 @@ class Notice extends Memcached_DataObject
 
         return Notice::getStream($qry,
                                  'public',
-                                 $offset, $limit, $since_id, $before_id, NULL, $since);
+                                 $offset, $limit, $since_id, $before_id, null, $since);
     }
 
     function addToInboxes() {
diff --git a/classes/NoticeWrapper.php b/classes/NoticeWrapper.php
index edecb3092..19ae37c1b 100644
--- a/classes/NoticeWrapper.php
+++ b/classes/NoticeWrapper.php
@@ -35,7 +35,7 @@ class NoticeWrapper extends Notice {
     public $is_local;                        // tinyint(1)  
     public $source;                          // varchar(32)  
 
-    var $notices = NULL;
+    var $notices = null;
     var $i = -1;
     
     function __construct($arr) {
diff --git a/classes/Notice_inbox.php b/classes/Notice_inbox.php
index cc482bd19..922ba2660 100644
--- a/classes/Notice_inbox.php
+++ b/classes/Notice_inbox.php
@@ -33,7 +33,7 @@ class Notice_inbox extends Memcached_DataObject
     public $source;                          // tinyint(1)   default_1
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Notice_source.php b/classes/Notice_source.php
index e0a41b927..a12397b0b 100644
--- a/classes/Notice_source.php
+++ b/classes/Notice_source.php
@@ -17,7 +17,7 @@ class Notice_source extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Notice_tag.php b/classes/Notice_tag.php
index 84c4a1020..8c3911f76 100644
--- a/classes/Notice_tag.php
+++ b/classes/Notice_tag.php
@@ -30,7 +30,7 @@ class Notice_tag extends Memcached_DataObject
     public $created;                         // datetime()   not_null
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Profile.php b/classes/Profile.php
index 1f4508bf1..b95cbf993 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -41,12 +41,12 @@ class Profile extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function getAvatar($width, $height=NULL) {
+    function getAvatar($width, $height=null) {
         if (is_null($height)) {
             $height = $width;
         }
@@ -62,7 +62,7 @@ class Profile extends Memcached_DataObject
         if ($avatar->find(true)) {
             return $avatar;
         } else {
-            return NULL;
+            return null;
         }
     }
 
@@ -71,12 +71,12 @@ class Profile extends Memcached_DataObject
         $info = @getimagesize($source);
 
         if (!$info) {
-            return NULL;
+            return null;
         }
 
         $filename = common_avatar_filename($this->id,
                                            image_type_to_extension($info[2]),
-                                           NULL, common_timestamp());
+                                           null, common_timestamp());
         $filepath = common_avatar_path($filename);
 
         copy($source, $filepath);
@@ -96,12 +96,12 @@ class Profile extends Memcached_DataObject
 
         if (!$this->delete_avatars()) {
             @unlink($filepath);
-            return NULL;
+            return null;
         }
 
         if (!$avatar->insert()) {
             @unlink($filepath);
-            return NULL;
+            return null;
         }
 
         foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
@@ -109,7 +109,7 @@ class Profile extends Memcached_DataObject
             if (!($avatar->width == $size && $avatar->height == $size)) {
                 $s = $avatar->scale($size);
                 if (!$s) {
-                    return NULL;
+                    return null;
                 }
             }
         }
@@ -132,7 +132,7 @@ class Profile extends Memcached_DataObject
     }
 
     # Get latest notice on or before date; default now
-    function getCurrentNotice($dt=NULL) {
+    function getCurrentNotice($dt=null) {
         $notice = new Notice();
         $notice->profile_id = $this->id;
         if ($dt) {
@@ -143,7 +143,7 @@ class Profile extends Memcached_DataObject
         if ($notice->find(true)) {
             return $notice;
         }
-        return NULL;
+        return null;
     }
 
     function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) {
diff --git a/classes/Profile_block.php b/classes/Profile_block.php
index 6ea26a3bc..41d6701eb 100644
--- a/classes/Profile_block.php
+++ b/classes/Profile_block.php
@@ -36,7 +36,7 @@ class Profile_block extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Profile_tag.php b/classes/Profile_tag.php
index 2daabf867..5c508c84f 100644
--- a/classes/Profile_tag.php
+++ b/classes/Profile_tag.php
@@ -16,7 +16,7 @@ class Profile_tag extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Queue_item.php b/classes/Queue_item.php
index e54b4976b..f2fc0be03 100644
--- a/classes/Queue_item.php
+++ b/classes/Queue_item.php
@@ -16,7 +16,7 @@ class Queue_item extends Memcached_DataObject
     public $claimed;                         // datetime()  
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -28,7 +28,7 @@ class Queue_item extends Memcached_DataObject
         $qi = new Queue_item();
         $qi->transport = $transport;
         $qi->orderBy('created');
-        $qi->whereAdd('claimed is NULL');
+        $qi->whereAdd('claimed is null');
 
         $qi->limit(1);
 
@@ -36,7 +36,7 @@ class Queue_item extends Memcached_DataObject
 
         if ($cnt) {
             # XXX: potential race condition
-            # can we force it to only update if claimed is still NULL
+            # can we force it to only update if claimed is still null
             # (or old)?
             common_log(LOG_INFO, 'claiming queue item = ' . $qi->notice_id . ' for transport ' . $transport);
             $orig = clone($qi);
@@ -49,7 +49,7 @@ class Queue_item extends Memcached_DataObject
                 common_log(LOG_INFO, 'claim failed.');
             }
         }
-        $qi = NULL;
-        return NULL;
+        $qi = null;
+        return null;
     }
 }
diff --git a/classes/Remember_me.php b/classes/Remember_me.php
index 5bbd6cf17..9d3f9378f 100644
--- a/classes/Remember_me.php
+++ b/classes/Remember_me.php
@@ -15,7 +15,7 @@ class Remember_me extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Remote_profile.php b/classes/Remote_profile.php
index c961dcca2..66b0f3a5c 100644
--- a/classes/Remote_profile.php
+++ b/classes/Remote_profile.php
@@ -38,7 +38,7 @@ class Remote_profile extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Reply.php b/classes/Reply.php
index d71ce3afb..10d6ced5b 100644
--- a/classes/Reply.php
+++ b/classes/Reply.php
@@ -16,7 +16,7 @@ class Reply extends Memcached_DataObject
     public $replied_id;                      // int(4)  
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Reply',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Reply',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Sms_carrier.php b/classes/Sms_carrier.php
index f6e0791f9..b4a9d8655 100644
--- a/classes/Sms_carrier.php
+++ b/classes/Sms_carrier.php
@@ -17,7 +17,7 @@ class Sms_carrier extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Subscription.php b/classes/Subscription.php
index a3b5e4b90..d70f99550 100644
--- a/classes/Subscription.php
+++ b/classes/Subscription.php
@@ -40,7 +40,7 @@ class Subscription extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Token.php b/classes/Token.php
index d180ecebe..3c88444c8 100644
--- a/classes/Token.php
+++ b/classes/Token.php
@@ -19,7 +19,7 @@ class Token extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Token',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Token',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/User.php b/classes/User.php
index c2c6ad57f..29e6a86e9 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -62,7 +62,7 @@ class User extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -118,10 +118,10 @@ class User extends Memcached_DataObject
         return !in_array($nickname, $merged);
     }
 
-    function getCurrentNotice($dt=NULL) {
+    function getCurrentNotice($dt=null) {
         $profile = $this->getProfile();
         if (!$profile) {
-            return NULL;
+            return null;
         }
         return $profile->getCurrentNotice($dt);
     }
@@ -336,20 +336,20 @@ class User extends Memcached_DataObject
         return $user;
     }
 
-    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
+    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
         $qry =
           'SELECT notice.* ' .
           'FROM notice JOIN reply ON notice.id = reply.notice_id ' .
           'WHERE reply.profile_id = %d ';
         return Notice::getStream(sprintf($qry, $this->id),
                                  'user:replies:'.$this->id,
-                                 $offset, $limit, $since_id, $before_id, NULL, $since);
+                                 $offset, $limit, $since_id, $before_id, null, $since);
     }
 
-        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
+        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
         $profile = $this->getProfile();
         if (!$profile) {
-            return NULL;
+            return null;
         } else {
             return $profile->getNotices($offset, $limit, $since_id, $before_id);
         }
@@ -365,7 +365,7 @@ class User extends Memcached_DataObject
                                  $offset, $limit);
     }
 
-        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
+        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
         $enabled = common_config('inboxes', 'enabled');
 
         # Complicated code, depending on whether we support inboxes yet
@@ -377,7 +377,7 @@ class User extends Memcached_DataObject
               'SELECT notice.* ' .
               'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' .
               'WHERE subscription.subscriber = %d ';
-            $order = NULL;
+            $order = null;
         } else if ($enabled === true ||
                ($enabled == 'transitional' && $this->inboxed == 1)) {
 
diff --git a/classes/User_openid.php b/classes/User_openid.php
index ad68f7402..7dc476dc4 100644
--- a/classes/User_openid.php
+++ b/classes/User_openid.php
@@ -17,7 +17,7 @@ class User_openid extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/lib/common.php b/lib/common.php
index 95ba64d0f..3e162f781 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -58,16 +58,16 @@ $config =
               'server' => 'localhost',
               'theme' => 'default',
               'path' => '/',
-              'logfile' => NULL,
+              'logfile' => null,
               'fancy' => false,
               'locale_path' => INSTALLDIR.'/locale',
               'language' => 'en_US',
               'languages' => get_all_languages(),
               'email' =>
-              array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : NULL,
-              'broughtby' => NULL,
+              array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : null,
+              'broughtby' => null,
               'timezone' => 'UTC',
-              'broughtbyurl' => NULL,
+              'broughtbyurl' => null,
               'closed' => false,
               'inviteonly' => false,
               'private' => false),
@@ -82,19 +82,19 @@ $config =
               'image' => 'http://i.creativecommons.org/l/by/3.0/88x31.png'),
         'mail' =>
         array('backend' => 'mail',
-              'params' => NULL),
+              'params' => null),
         'nickname' =>
         array('blacklist' => array(),
               'featured' => array()),
         'profile' =>
         array('banned' => array()),
         'avatar' =>
-        array('server' => NULL),
+        array('server' => null),
         'public' =>
         array('localonly' => true,
               'blacklist' => array()),
         'theme' =>
-        array('server' => NULL),
+        array('server' => null),
         'throttle' =>
         array('enabled' => false, // whether to throttle edits; false by default
               'count' => 20, // number of allowed messages in timespan
@@ -107,7 +107,7 @@ $config =
               'encryption' => true,
               'resource' => 'uniquename',
               'password' => 'blahblahblah',
-              'host' => NULL, # only set if != server
+              'host' => null, # only set if != server
               'debug' => false, # print extra debug info
               'public' => array()), # JIDs of users who want to receive the public stream
         'sphinx' =>
@@ -140,7 +140,7 @@ $config['db'] =
         'class_location' => INSTALLDIR . '/classes',
         'require_prefix' => 'classes/',
         'class_prefix' => '',
-        'mirror' => NULL,
+        'mirror' => null,
         'db_driver' => 'DB', # XXX: JanRain libs only work with DB
         'quote_identifiers' => false,
         'type' => 'mysql' );
diff --git a/lib/deleteaction.php b/lib/deleteaction.php
index 335070cc4..a7de6b8fb 100644
--- a/lib/deleteaction.php
+++ b/lib/deleteaction.php
@@ -43,7 +43,7 @@ class DeleteAction extends Action {
         }
     }
 
-    function show_top($arr=NULL) {
+    function show_top($arr=null) {
         $instr = $this->get_instructions();
         $output = common_markup_to_html($instr);
         common_element_start('div', 'instructions');
@@ -52,7 +52,7 @@ class DeleteAction extends Action {
     }
 
     function get_title() {
-        return NULL;
+        return null;
     }
 
     function show_header() {
diff --git a/lib/facebookaction.php b/lib/facebookaction.php
index 67595861f..731460f12 100644
--- a/lib/facebookaction.php
+++ b/lib/facebookaction.php
@@ -81,7 +81,7 @@ class FacebookAction extends Action {
 
         $fbml_main = "<fb:narrow>$content $html</fb:narrow>";
 
-        $facebook->api_client->profile_setFBML(NULL, $fbuid, $fbml, NULL, NULL, $fbml_main);
+        $facebook->api_client->profile_setFBML(null, $fbuid, $fbml, null, null, $fbml_main);
     }
 
     # Display methods
@@ -235,7 +235,7 @@ class FacebookAction extends Action {
         return $html;
     }
 
-    function pagination($have_before, $have_after, $page, $fbaction, $args=NULL) {
+    function pagination($have_before, $have_after, $page, $fbaction, $args=null) {
 
         $html = '';
 
@@ -266,7 +266,7 @@ class FacebookAction extends Action {
         }
     }
 
-    function pagination_url($fbaction, $args=NULL) {
+    function pagination_url($fbaction, $args=null) {
         global $config;
 
         $extra = '';
diff --git a/lib/oauthstore.php b/lib/oauthstore.php
index aa705be30..421b618b7 100644
--- a/lib/oauthstore.php
+++ b/lib/oauthstore.php
@@ -33,7 +33,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
             $con->seed = common_good_rand(16);
             $con->created = DB_DataObject_Cast::dateTime();
             if (!$con->insert()) {
-                return NULL;
+                return null;
             }
         }
         return new OAuthConsumer($con->consumer_key, '');
@@ -47,7 +47,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         if ($t->find(true)) {
             return new OAuthToken($t->tok, $t->secret);
         } else {
-            return NULL;
+            return null;
         }
     }
 
@@ -75,7 +75,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         $t->state = 0; # unauthorized
         $t->created = DB_DataObject_Cast::dateTime();
         if (!$t->insert()) {
-            return NULL;
+            return null;
         } else {
             return new OAuthToken($t->tok, $t->secret);
         }
@@ -104,35 +104,35 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
             if (!$at->insert()) {
                 $e = $at->_lastError;
                 common_debug('access token "'.$at->tok.'" not inserted: "'.$e->message.'"', __FILE__);
-                return NULL;
+                return null;
             } else {
                 common_debug('access token "'.$at->tok.'" inserted', __FILE__);
                 # burn the old one
                 $orig_rt = clone($rt);
                 $rt->state = 2; # used
                 if (!$rt->update($orig_rt)) {
-                    return NULL;
+                    return null;
                 }
                 common_debug('request token "'.$rt->tok.'" updated', __FILE__);
                 # Update subscription
                 # XXX: mixing levels here
                 $sub = Subscription::staticGet('token', $rt->tok);
                 if (!$sub) {
-                    return NULL;
+                    return null;
                 }
                 common_debug('subscription for request token found', __FILE__);
                 $orig_sub = clone($sub);
                 $sub->token = $at->tok;
                 $sub->secret = $at->secret;
                 if (!$sub->update($orig_sub)) {
-                    return NULL;
+                    return null;
                 } else {
                     common_debug('subscription updated to use access token', __FILE__);
                     return new OAuthToken($at->tok, $at->secret);
                 }
             }
         } else {
-            return NULL;
+            return null;
         }
     }
 
diff --git a/lib/omb.php b/lib/omb.php
index 94ccc2ecd..8199b0679 100644
--- a/lib/omb.php
+++ b/lib/omb.php
@@ -44,7 +44,7 @@ define('OAUTH_POST_BODY', OAUTH_NAMESPACE.'parameters/post-body');
 define('OAUTH_HMAC_SHA1', OAUTH_NAMESPACE.'signature/HMAC-SHA1');
 
 function omb_oauth_consumer() {
-    static $con = NULL;
+    static $con = null;
     if (!$con) {
         $con = new OAuthConsumer(common_root_url(), '');
     }
@@ -61,7 +61,7 @@ function omb_oauth_server() {
 }
 
 function omb_oauth_datastore() {
-    static $store = NULL;
+    static $store = null;
     if (!$store) {
         $store = new LaconicaOAuthDataStore();
     }
@@ -69,7 +69,7 @@ function omb_oauth_datastore() {
 }
 
 function omb_hmac_sha1() {
-    static $hmac_method = NULL;
+    static $hmac_method = null;
     if (!$hmac_method) {
         $hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
     }
@@ -91,22 +91,22 @@ function omb_match_service($service, $type) {
 
 function omb_service_uri($service) {
     if (!$service) {
-        return NULL;
+        return null;
     }
     $uris = $service->getURIs();
     if (!$uris) {
-        return NULL;
+        return null;
     }
     return $uris[0];
 }
 
 function omb_local_id($service) {
     if (!$service) {
-        return NULL;
+        return null;
     }
     $els = $service->getElements('xrd:LocalID');
     if (!$els) {
-        return NULL;
+        return null;
     }
     $el = $els[0];
     return $service->parser->content($el);
diff --git a/lib/openid.php b/lib/openid.php
index ebc5ed168..3ca359fa1 100644
--- a/lib/openid.php
+++ b/lib/openid.php
@@ -32,7 +32,7 @@ define('OPENID_COOKIE_EXPIRY', round(365.25 * 24 * 60 * 60));
 define('OPENID_COOKIE_KEY', 'lastusedopenid');
 
 function oid_store() {
-    static $store = NULL;
+    static $store = null;
     if (!$store) {
         # Can't be called statically
         $user = new User();
@@ -63,7 +63,7 @@ function oid_get_last() {
     if ($openid_url && strlen($openid_url) > 0) {
         return $openid_url;
     } else {
-        return NULL;
+        return null;
     }
 }
 
@@ -85,7 +85,7 @@ function oid_link_user($id, $canonical, $display) {
 }
 
 function oid_get_user($openid_url) {
-    $user = NULL;
+    $user = null;
     $oid = User_openid::staticGet('canonical', $openid_url);
     if ($oid) {
         $user = User::staticGet('id', $oid->user_id);
@@ -93,7 +93,7 @@ function oid_get_user($openid_url) {
     return $user;
 }
 
-function oid_check_immediate($openid_url, $backto=NULL) {
+function oid_check_immediate($openid_url, $backto=null) {
     if (!$backto) {
         $action = $_REQUEST['action'];
         $args = common_copy_args($_GET);
@@ -177,9 +177,9 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) {
         if (Auth_OpenID::isFailure($form_html)) {
             $this->show_form(sprintf(_('Could not create OpenID form: %s'), $form_html->message));
         } else {
-            common_show_header(_('OpenID Auto-Submit'), NULL, NULL, '_oid_print_instructions');
+            common_show_header(_('OpenID Auto-Submit'), null, null, '_oid_print_instructions');
             common_raw($form_html);
-            common_element('script', NULL,
+            common_element('script', null,
                            '$(document).ready(function() { ' .
                            '    $("#'. $form_id .'").submit(); '.
                            '});');
diff --git a/lib/personal.php b/lib/personal.php
index 1928349a3..7ff9305f1 100644
--- a/lib/personal.php
+++ b/lib/personal.php
@@ -32,7 +32,7 @@ class PersonalAction extends Action {
 
     function views_menu() {
 
-        $user = NULL;
+        $user = null;
         $action = $this->trimmed('action');
         $nickname = $this->trimmed('nickname');
 
diff --git a/lib/profilelist.php b/lib/profilelist.php
index e32c5c254..9929c8647 100644
--- a/lib/profilelist.php
+++ b/lib/profilelist.php
@@ -24,11 +24,11 @@ define('PROFILES_PER_PAGE', 20);
 
 class ProfileList {
 
-    var $profile = NULL;
-    var $owner = NULL;
-    var $action = NULL;
+    var $profile = null;
+    var $owner = null;
+    var $action = null;
 
-    function __construct($profile, $owner=NULL, $action=NULL) {
+    function __construct($profile, $owner=null, $action=null) {
         $this->profile = $profile;
         $this->owner = $owner;
         $this->action = $action;
diff --git a/lib/queuehandler.php b/lib/queuehandler.php
index 5e3905f59..ecf58f69f 100644
--- a/lib/queuehandler.php
+++ b/lib/queuehandler.php
@@ -29,7 +29,7 @@ class QueueHandler extends Daemon {
 
     var $_id = 'generic';
 
-    function QueueHandler($id=NULL) {
+    function QueueHandler($id=null) {
         if ($id) {
             $this->set_id($id);
         }
@@ -52,7 +52,7 @@ class QueueHandler extends Daemon {
     }
     
     function transport() {
-        return NULL;
+        return null;
     }
     
     function start() {
@@ -83,7 +83,7 @@ class QueueHandler extends Daemon {
                     if (!$result) {
                         $this->log(LOG_WARNING, 'Failed broadcast for notice ID = ' . $notice->id);
                         $orig = $qi;
-                        $qi->claimed = NULL;
+                        $qi->claimed = null;
                         $qi->update($orig);
                         $this->log(LOG_WARNING, 'Abandoned claim for notice ID = ' . $notice->id);
                         continue;
@@ -91,7 +91,7 @@ class QueueHandler extends Daemon {
                     $this->log(LOG_INFO, 'finished broadcasting notice ID = ' . $notice->id);
                     $notice->free();
                     unset($notice);
-                    $notice = NULL;
+                    $notice = null;
                 } else {
                     $this->log(LOG_WARNING, 'queue item for notice that does not exist');
                 }
diff --git a/lib/rssaction.php b/lib/rssaction.php
index b64796888..a21ce3a97 100644
--- a/lib/rssaction.php
+++ b/lib/rssaction.php
@@ -55,7 +55,7 @@ class Rss10Action extends Action {
     }
 
     function get_image() {
-        return NULL;
+        return null;
     }
 
     function show_rss($limit=0) {
@@ -84,9 +84,9 @@ class Rss10Action extends Action {
         $image = $this->get_image();
 
         common_element_start('channel', array('rdf:about' => $channel['url']));
-        common_element('title', NULL, $channel['title']);
-        common_element('link', NULL, $channel['link']);
-        common_element('description', NULL, $channel['description']);
+        common_element('title', null, $channel['title']);
+        common_element('link', null, $channel['link']);
+        common_element('description', null, $channel['description']);
         common_element('cc:licence', array('rdf:resource' => common_config('license','url')));
 
         if ($image) {
@@ -111,9 +111,9 @@ class Rss10Action extends Action {
         if ($image) {
             $channel = $this->get_channel();
             common_element_start('image', array('rdf:about' => $image));
-            common_element('title', NULL, $channel['title']);
-            common_element('link', NULL, $channel['link']);
-            common_element('url', NULL, $image);
+            common_element('title', null, $channel['title']);
+            common_element('link', null, $channel['link']);
+            common_element('url', null, $image);
             common_element_end('image');
         }
     }
@@ -124,11 +124,11 @@ class Rss10Action extends Action {
         $creator_uri = common_profile_uri($profile);
         common_element_start('item', array('rdf:about' => $notice->uri));
         $title = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
-        common_element('title', NULL, $title);
-        common_element('link', NULL, $nurl);
-        common_element('description', NULL, $profile->nickname."'s status on ".common_exact_date($notice->created));
-        common_element('dc:date', NULL, common_date_w3dtf($notice->created));
-        common_element('dc:creator', NULL, ($profile->fullname) ? $profile->fullname : $profile->nickname);
+        common_element('title', null, $title);
+        common_element('link', null, $nurl);
+        common_element('description', null, $profile->nickname."'s status on ".common_exact_date($notice->created));
+        common_element('dc:date', null, common_date_w3dtf($notice->created));
+        common_element('dc:creator', null, ($profile->fullname) ? $profile->fullname : $profile->nickname);
         common_element('sioc:has_creator', array('rdf:resource' => $creator_uri));
         common_element('laconica:postIcon', array('rdf:resource' => common_profile_avatar_url($profile)));
         common_element('cc:licence', array('rdf:resource' => common_config('license', 'url')));
@@ -141,11 +141,11 @@ class Rss10Action extends Action {
             $id = $profile->id;
             $nickname = $profile->nickname;
             common_element_start('sioc:User', array('rdf:about' => $uri));
-            common_element('foaf:nick', NULL, $nickname);
+            common_element('foaf:nick', null, $nickname);
             if ($profile->fullname) {
-                common_element('foaf:name', NULL, $profile->fullname);
+                common_element('foaf:name', null, $profile->fullname);
             }
-            common_element('sioc:id', NULL, $id);
+            common_element('sioc:id', null, $id);
             $avatar = common_profile_avatar_url($profile);
             common_element('sioc:avatar', array('rdf:resource' => $avatar));
             common_element_end('sioc:User');
@@ -175,7 +175,7 @@ class Rss10Action extends Action {
                                               'http://laconi.ca/ont/',
                                               'xmlns' => 'http://purl.org/rss/1.0/'));
         common_element_start('sioc:Site', array('rdf:about' => common_root_url()));
-        common_element('sioc:name', NULL, common_config('site', 'name'));
+        common_element('sioc:name', null, common_config('site', 'name'));
         common_element_start('sioc:container_of');
         common_element('sioc:Container', array('rdf:about' =>
                                                $channel['url']));
diff --git a/lib/searchaction.php b/lib/searchaction.php
index 8634bd99c..3eec91832 100644
--- a/lib/searchaction.php
+++ b/lib/searchaction.php
@@ -30,7 +30,7 @@ class SearchAction extends Action {
         $this->show_form();
     }
 
-    function show_top($arr=NULL) {
+    function show_top($arr=null) {
         if ($arr) {
             $error = $arr[1];
         }
@@ -47,14 +47,14 @@ class SearchAction extends Action {
     }
 
     function get_title() {
-        return NULL;
+        return null;
     }
 
     function show_header($arr) {
         return;
     }
 
-    function show_form($error=NULL) {
+    function show_form($error=null) {
         global $config;
 
         $q = $this->trimmed('q');
@@ -99,11 +99,11 @@ class SearchAction extends Action {
                 array(
                       _('People'),
                       _('Find people on this site'),
-                      ($action != 'peoplesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL),
+                      ($action != 'peoplesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : null),
                 'noticesearch' =>
                 array( _('Text'),
                        _('Find content of notices'),
-                       ($action != 'noticesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL)
+                       ($action != 'noticesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : null)
                 );
         $this->nav_menu($menu);
     }
diff --git a/lib/settingsaction.php b/lib/settingsaction.php
index 3021eb192..208d2a1b6 100644
--- a/lib/settingsaction.php
+++ b/lib/settingsaction.php
@@ -44,7 +44,7 @@ class SettingsAction extends Action {
         return false;
     }
 
-    function show_form($msg=NULL, $success=false) {
+    function show_form($msg=null, $success=false) {
         return false;
     }
 
@@ -55,9 +55,9 @@ class SettingsAction extends Action {
         }
     }
 
-    function form_header($title, $msg=NULL, $success=false) {
+    function form_header($title, $msg=null, $success=false) {
         common_show_header($title,
-                           NULL,
+                           null,
                            array($msg, $success),
                            array($this, 'show_top'));
     }
diff --git a/lib/twitter.php b/lib/twitter.php
index c1d2de0ea..1212875ea 100644
--- a/lib/twitter.php
+++ b/lib/twitter.php
@@ -148,13 +148,13 @@ function retreive_twitter_friends($twitter_id, $screen_name, $password) {
         $data = get_twitter_data($uri . $i, $screen_name, $password);
 
         if (!$data) {
-            return NULL;
+            return null;
         }
 
         $more_friends = json_decode($data);
 
         if (!$more_friends) {
-            return NULL;
+            return null;
         }
 
          $friends = array_merge($friends, $more_friends);
diff --git a/lib/twitterapi.php b/lib/twitterapi.php
index 3122caf12..ed86c77c4 100644
--- a/lib/twitterapi.php
+++ b/lib/twitterapi.php
@@ -34,15 +34,15 @@ class TwitterapiAction extends Action {
         $twitter_user['name'] = $profile->getBestName();
         $twitter_user['followers_count'] = $this->count_subscriptions($profile);
         $twitter_user['screen_name'] = $profile->nickname;
-        $twitter_user['description'] = ($profile->bio) ? $profile->bio : NULL;
-        $twitter_user['location'] = ($profile->location) ? $profile->location : NULL;
+        $twitter_user['description'] = ($profile->bio) ? $profile->bio : null;
+        $twitter_user['location'] = ($profile->location) ? $profile->location : null;
         $twitter_user['id'] = intval($profile->id);
 
         $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
 
         $twitter_user['profile_image_url'] = ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE);
         $twitter_user['protected'] = 'false'; # not supported by Laconica yet
-        $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : NULL;
+        $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : null;
 
         if ($get_notice) {
             $notice = $profile->getCurrentNotice();
@@ -63,10 +63,10 @@ class TwitterapiAction extends Action {
         $twitter_status['text'] = $notice->content;
         $twitter_status['truncated'] = 'false'; # Not possible on Laconica
         $twitter_status['created_at'] = $this->date_twitter($notice->created);
-        $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : NULL;
+        $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : null;
         $twitter_status['source'] = $this->source_link($notice->source);
         $twitter_status['id'] = intval($notice->id);
-        $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : NULL;
+        $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : null;
 
         if (isset($this->auth_user)) {
             $twitter_status['favorited'] = ($this->auth_user->hasFave($notice)) ? 'true' : 'false';
@@ -157,10 +157,10 @@ class TwitterapiAction extends Action {
                 $this->show_twitter_xml_user($twitter_status['user']);
                 break;
             case 'text':
-                common_element($element, NULL, common_xml_safe_str($value));
+                common_element($element, null, common_xml_safe_str($value));
                 break;
             default:
-                common_element($element, NULL, $value);
+                common_element($element, null, $value);
             }
         }
         common_element_end('status');
@@ -172,7 +172,7 @@ class TwitterapiAction extends Action {
             if ($element == 'status') {
                 $this->show_twitter_xml_status($twitter_user['status']);
             } else {
-                common_element($element, NULL, $value);
+                common_element($element, null, $value);
             }
         }
         common_element_end($role);
@@ -180,22 +180,22 @@ class TwitterapiAction extends Action {
 
     function show_twitter_rss_item($entry) {
         common_element_start('item');
-        common_element('title', NULL, $entry['title']);
-        common_element('description', NULL, $entry['description']);
-        common_element('pubDate', NULL, $entry['pubDate']);
-        common_element('guid', NULL, $entry['guid']);
-        common_element('link', NULL, $entry['link']);
+        common_element('title', null, $entry['title']);
+        common_element('description', null, $entry['description']);
+        common_element('pubDate', null, $entry['pubDate']);
+        common_element('guid', null, $entry['guid']);
+        common_element('link', null, $entry['link']);
         common_element_end('item');
     }
 
     function show_twitter_atom_entry($entry) {
         common_element_start('entry');
-        common_element('title', NULL, $entry['title']);
+        common_element('title', null, $entry['title']);
         common_element('content', array('type' => 'html'), $entry['content']);
-        common_element('id', NULL, $entry['id']);
-        common_element('published', NULL, $entry['published']);
-        common_element('updated', NULL, $entry['updated']);
-        common_element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), NULL);
+        common_element('id', null, $entry['id']);
+        common_element('published', null, $entry['published']);
+        common_element('updated', null, $entry['updated']);
+        common_element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), null);
         common_element_end('entry');
     }
 
@@ -240,10 +240,10 @@ class TwitterapiAction extends Action {
                 $this->show_twitter_xml_user($value, $element);
                 break;
             case 'text':
-                common_element($element, NULL, common_xml_safe_str($value));
+                common_element($element, null, common_xml_safe_str($value));
                 break;
             default:
-                common_element($element, NULL, $value);
+                common_element($element, null, $value);
             }
         }
         common_element_end('direct_message');
@@ -270,13 +270,13 @@ class TwitterapiAction extends Action {
         $this->end_document('xml');
     }
 
-    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=NULL) {
+    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null) {
 
         $this->init_document('rss');
 
         common_element_start('channel');
-        common_element('title', NULL, $title);
-        common_element('link', NULL, $link);
+        common_element('title', null, $title);
+        common_element('link', null, $link);
         if (!is_null($suplink)) {
             # For FriendFeed's SUP protocol
             common_element('link', array('xmlns' => 'http://www.w3.org/2005/Atom',
@@ -284,9 +284,9 @@ class TwitterapiAction extends Action {
                                          'href' => $suplink,
                                          'type' => 'application/json'));
         }
-        common_element('description', NULL, $subtitle);
-        common_element('language', NULL, 'en-us');
-        common_element('ttl', NULL, '40');
+        common_element('description', null, $subtitle);
+        common_element('language', null, 'en-us');
+        common_element('ttl', null, '40');
 
         if (is_array($notice)) {
             foreach ($notice as $n) {
@@ -304,20 +304,20 @@ class TwitterapiAction extends Action {
         $this->end_twitter_rss();
     }
 
-    function show_atom_timeline($notice, $title, $id, $link, $subtitle=NULL, $suplink=NULL) {
+    function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null) {
 
         $this->init_document('atom');
 
-        common_element('title', NULL, $title);
-        common_element('id', NULL, $id);
-        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
+        common_element('title', null, $title);
+        common_element('id', null, $id);
+        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
         if (!is_null($suplink)) {
             # For FriendFeed's SUP protocol
             common_element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup',
                                          'href' => $suplink,
                                          'type' => 'application/json'));
         }
-        common_element('subtitle', NULL, $subtitle);
+        common_element('subtitle', null, $subtitle);
 
         if (is_array($notice)) {
             foreach ($notice as $n) {
@@ -377,7 +377,7 @@ class TwitterapiAction extends Action {
         } else {
             common_debug("Can't get notice: $reply_id", __FILE__);
         }
-        return NULL;
+        return null;
     }
 
     // XXX: Candidate for a general utility method somewhere?
@@ -488,8 +488,8 @@ class TwitterapiAction extends Action {
         if ($content_type == 'xml') {
             $this->init_document('xml');
             common_element_start('hash');
-            common_element('error', NULL, $msg);
-            common_element('request', NULL, $_SERVER['REQUEST_URI']);
+            common_element('error', null, $msg);
+            common_element('request', null, $_SERVER['REQUEST_URI']);
             common_element_end('hash');
             $this->end_document('xml');
         } else {
@@ -521,7 +521,7 @@ class TwitterapiAction extends Action {
         common_element_end('feed');
     }
 
-    function show_profile($profile, $content_type='xml', $notice=NULL) {
+    function show_profile($profile, $content_type='xml', $notice=null) {
         $profile_array = $this->twitter_user_array($profile, true);
         switch ($content_type) {
          case 'xml':
@@ -537,7 +537,7 @@ class TwitterapiAction extends Action {
         return;
     }
 
-    function get_user($id, $apidata=NULL) {
+    function get_user($id, $apidata=null) {
         if (!$id) {
             return $apidata['user'];
         } else if (is_numeric($id)) {
@@ -556,7 +556,7 @@ class TwitterapiAction extends Action {
             if ($user) {
                 return $user->getProfile();
             } else {
-                return NULL;
+                return null;
             }
         }
     }
diff --git a/lib/xmppqueuehandler.php b/lib/xmppqueuehandler.php
index 33b987291..10c754a5b 100644
--- a/lib/xmppqueuehandler.php
+++ b/lib/xmppqueuehandler.php
@@ -38,14 +38,14 @@ class XmppQueueHandler extends QueueHandler {
             $this->conn->addEventHandler('message', 'forward_message', $this);
             $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
             $this->conn->setReconnectTimeout(600);
-            jabber_send_presence("Send me a message to post a notice", 'available', NULL, 'available', -1);
+            jabber_send_presence("Send me a message to post a notice", 'available', null, 'available', -1);
         }
         return !is_null($this->conn);
     }
     
     function handle_reconnect(&$pl) {
         $this->conn->processUntil('session_start');
-        $this->conn->presence(NULL, 'available', NULL, 'available', -1);
+        $this->conn->presence(null, 'available', null, 'available', -1);
     }
 
     function idle($timeout=0) {
@@ -71,7 +71,7 @@ class XmppQueueHandler extends QueueHandler {
             return;
         }
         $this->log(LOG_INFO, 'Forwarding message from ' . $pl['from'] . ' to ' . $listener);
-        $this->conn->message($this->listener(), $pl['body'], 'chat', NULL, $this->ofrom($pl['from']));
+        $this->conn->message($this->listener(), $pl['body'], 'chat', null, $this->ofrom($pl['from']));
     }
 
     function ofrom($from) {
diff --git a/scripts/enjitqueuehandler.php b/scripts/enjitqueuehandler.php
index cfb253753..1c033603f 100755
--- a/scripts/enjitqueuehandler.php
+++ b/scripts/enjitqueuehandler.php
@@ -117,7 +117,7 @@ class EnjitQueueHandler extends QueueHandler {
 
 mb_internal_encoding('UTF-8');
 
-$id = ($argc > 1) ? $argv[1] : NULL;
+$id = ($argc > 1) ? $argv[1] : null;
 
 $handler = new EnjitQueueHandler($id);
 
diff --git a/scripts/fixup_inboxes.php b/scripts/fixup_inboxes.php
index e631a80ed..a5c8a0a5a 100755
--- a/scripts/fixup_inboxes.php
+++ b/scripts/fixup_inboxes.php
@@ -34,7 +34,7 @@ define('LACONICA', true);
 
 require_once(INSTALLDIR . '/lib/common.php');
 
-$start_at = ($argc > 1) ? $argv[1] : NULL;
+$start_at = ($argc > 1) ? $argv[1] : null;
 
 common_log(LOG_INFO, 'Updating user inboxes.');
 
diff --git a/scripts/fixup_notices_rendered.php b/scripts/fixup_notices_rendered.php
index 1fa9f394e..c27185546 100755
--- a/scripts/fixup_notices_rendered.php
+++ b/scripts/fixup_notices_rendered.php
@@ -31,7 +31,7 @@ require_once(INSTALLDIR . '/lib/common.php');
 
 common_log(LOG_INFO, 'Starting to render old notices.');
 
-$start_at = ($argc > 1) ? $argv[1] : NULL;
+$start_at = ($argc > 1) ? $argv[1] : null;
 
 $notice = new Notice();
 if ($start_at) {
diff --git a/scripts/jabberqueuehandler.php b/scripts/jabberqueuehandler.php
index 8e33cfaf0..271aab22b 100755
--- a/scripts/jabberqueuehandler.php
+++ b/scripts/jabberqueuehandler.php
@@ -35,7 +35,7 @@ set_error_handler('common_error_handler');
 
 class JabberQueueHandler extends XmppQueueHandler {
 
-    var $conn = NULL;
+    var $conn = null;
 
     function transport() {
         return 'jabber';
diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php
index 6d8507514..886e72ba7 100755
--- a/scripts/maildaemon.php
+++ b/scripts/maildaemon.php
@@ -42,7 +42,7 @@ class MailerDaemon {
     function handle_message($fname='php://stdin') {
         list($from, $to, $msg) = $this->parse_message($fname);
         if (!$from || !$to || !$msg) {
-            $this->error(NULL, _('Could not parse message.'));
+            $this->error(null, _('Could not parse message.'));
         }
         common_log(LOG_INFO, "Mail from $from to $to: " .substr($msg, 0, 20));
         $user = $this->user_from($from);
@@ -74,7 +74,7 @@ class MailerDaemon {
     function user_from($from_hdr) {
         $froms = mailparse_rfc822_parse_addresses($from_hdr);
         if (!$froms) {
-            return NULL;
+            return null;
         }
         $from = $froms[0];
         $addr = common_canonical_email($from['address']);
@@ -140,7 +140,7 @@ class MailerDaemon {
                                                 'decode_headers' => true,
                                                 'decode_bodies' => true));
         if (!$parsed) {
-            return NULL;
+            return null;
         }
 
         $from = $parsed->headers['from'];
@@ -167,7 +167,7 @@ class MailerDaemon {
     }
 
     function unsupported_type($type) {
-        $this->error(NULL, "Unsupported message type: " . $type);
+        $this->error(null, "Unsupported message type: " . $type);
     }
 
     function cleanup_msg($msg) {
diff --git a/scripts/ombqueuehandler.php b/scripts/ombqueuehandler.php
index 31ae20f00..43c0980b6 100755
--- a/scripts/ombqueuehandler.php
+++ b/scripts/ombqueuehandler.php
@@ -67,7 +67,7 @@ ini_set("max_input_time", "0");
 set_time_limit(0);
 mb_internal_encoding('UTF-8');
 
-$id = ($argc > 1) ? $argv[1] : NULL;
+$id = ($argc > 1) ? $argv[1] : null;
 
 $handler = new OmbQueueHandler($id);
 
diff --git a/scripts/smsqueuehandler.php b/scripts/smsqueuehandler.php
index f17429d96..f8b2e9d53 100755
--- a/scripts/smsqueuehandler.php
+++ b/scripts/smsqueuehandler.php
@@ -57,7 +57,7 @@ ini_set("max_input_time", "0");
 set_time_limit(0);
 mb_internal_encoding('UTF-8');
 
-$id = ($argc > 1) ? $argv[1] : NULL;
+$id = ($argc > 1) ? $argv[1] : null;
 
 $handler = new SmsQueueHandler($id);
 
diff --git a/scripts/xmppconfirmhandler.php b/scripts/xmppconfirmhandler.php
index 454616ca0..9e177b3fa 100755
--- a/scripts/xmppconfirmhandler.php
+++ b/scripts/xmppconfirmhandler.php
@@ -101,8 +101,8 @@ class XmppConfirmHandler extends XmppQueueHandler {
 
     function next_confirm() {
         $confirm = new Confirm_address();
-        $confirm->whereAdd('claimed IS NULL');
-        $confirm->whereAdd('sent IS NULL');
+        $confirm->whereAdd('claimed IS null');
+        $confirm->whereAdd('sent IS null');
         # XXX: eventually we could do other confirmations in the queue, too
         $confirm->address_type = 'jabber';
         $confirm->orderBy('modified DESC');
@@ -122,12 +122,12 @@ class XmppConfirmHandler extends XmppQueueHandler {
                 return false;
             }
         }
-        return NULL;
+        return null;
     }
 
     function clear_old_confirm_claims() {
         $confirm = new Confirm();
-        $confirm->claimed = NULL;
+        $confirm->claimed = null;
         $confirm->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
         $confirm->update(DB_DATAOBJECT_WHEREADD_ONLY);
         $confirm->free();
diff --git a/scripts/xmppdaemon.php b/scripts/xmppdaemon.php
index cd27a2c14..ead842928 100755
--- a/scripts/xmppdaemon.php
+++ b/scripts/xmppdaemon.php
@@ -39,7 +39,7 @@ set_error_handler('common_error_handler');
 
 class XMPPDaemon extends Daemon {
 
-    function XMPPDaemon($resource=NULL) {
+    function XMPPDaemon($resource=null) {
         static $attrs = array('server', 'port', 'user', 'password', 'host');
 
         foreach ($attrs as $attr)
@@ -71,7 +71,7 @@ class XMPPDaemon extends Daemon {
         $this->conn->setReconnectTimeout(600);
 
         jabber_send_presence("Send me a message to post a notice", 'available',
-                             NULL, 'available', 100);
+                             null, 'available', 100);
         return !$this->conn->isDisconnected();
     }
 
@@ -92,7 +92,7 @@ class XMPPDaemon extends Daemon {
 
     function handle_reconnect(&$pl) {
         $this->conn->processUntil('session_start');
-        $this->conn->presence('Send me a message to post a notice', 'available', NULL, 'available', 100);
+        $this->conn->presence('Send me a message to post a notice', 'available', null, 'available', 100);
     }
 
     function get_user($from) {
@@ -165,30 +165,30 @@ class XMPPDaemon extends Daemon {
         $addresses = $xml->sub('addresses');
         if (!$addresses) {
             $this->log(LOG_WARNING, 'Forwarded message without addresses');
-            return NULL;
+            return null;
         }
         $address = $addresses->sub('address');
         if (!$address) {
             $this->log(LOG_WARNING, 'Forwarded message without address');
-            return NULL;
+            return null;
         }
         if (!array_key_exists('type', $address->attrs)) {
             $this->log(LOG_WARNING, 'No type for forwarded message');
-            return NULL;
+            return null;
         }
         $type = $address->attrs['type'];
         if ($type != 'ofrom') {
             $this->log(LOG_WARNING, 'Type of forwarded message is not ofrom');
-            return NULL;
+            return null;
         }
         if (!array_key_exists('jid', $address->attrs)) {
             $this->log(LOG_WARNING, 'No jid for forwarded message');
-            return NULL;
+            return null;
         }
         $jid = $address->attrs['jid'];
         if (!$jid) {
             $this->log(LOG_WARNING, 'Could not get jid from address');
-            return NULL;
+            return null;
         }
         $this->log(LOG_DEBUG, 'Got message forwarded from jid ' . $jid);
         return $jid;
-- 
cgit v1.2.3-54-g00ecf


From 04ef1ba8eee7a9e2a565d7b4b747ef607665d562 Mon Sep 17 00:00:00 2001
From: Evan Prodromou <evan@prodromou.name>
Date: Tue, 23 Dec 2008 14:33:23 -0500
Subject: change function headers to K&R style

Another huge change, for PEAR code standards compliance. Function
headers have to be in K&R style (opening brace on its own line),
instead of having the opening brace on the same line as the function
and parameters. So, a little perl magic found all the function
definitions and move the opening brace to the next line (properly
indented... usually).

darcs-hash:20081223193323-84dde-a28e36ecc66672c783c2842d12fc11043c13ab28.gz
---
 _darcs/inventory                                   |   11 +
 ...dde-a28e36ecc66672c783c2842d12fc11043c13ab28.gz |  Bin 0 -> 13382 bytes
 _darcs/pristine/actions/accesstoken.php            |    3 +-
 _darcs/pristine/actions/all.php                    |   12 +-
 _darcs/pristine/actions/allrss.php                 |   12 +-
 _darcs/pristine/actions/api.php                    |   15 +-
 _darcs/pristine/actions/avatarbynickname.php       |    3 +-
 _darcs/pristine/actions/block.php                  |   12 +-
 _darcs/pristine/actions/confirmaddress.php         |    3 +-
 _darcs/pristine/actions/deletenotice.php           |   15 +-
 _darcs/pristine/actions/deleteprofile.php          |   33 +-
 _darcs/pristine/actions/disfavor.php               |    3 +-
 _darcs/pristine/actions/doc.php                    |    3 +-
 _darcs/pristine/actions/emailsettings.php          |   33 +-
 _darcs/pristine/actions/facebookhome.php           |   12 +-
 _darcs/pristine/actions/facebookinvite.php         |    6 +-
 _darcs/pristine/actions/facebookremove.php         |    3 +-
 _darcs/pristine/actions/facebooksettings.php       |    6 +-
 _darcs/pristine/actions/favor.php                  |    6 +-
 _darcs/pristine/actions/favorited.php              |   15 +-
 _darcs/pristine/actions/favoritesrss.php           |   12 +-
 _darcs/pristine/actions/featured.php               |   15 +-
 _darcs/pristine/actions/finishaddopenid.php        |    9 +-
 _darcs/pristine/actions/finishimmediate.php        |    6 +-
 _darcs/pristine/actions/finishopenidlogin.php      |   51 +-
 _darcs/pristine/actions/finishremotesubscribe.php  |    9 +-
 _darcs/pristine/actions/foaf.php                   |   12 +-
 _darcs/pristine/actions/imsettings.php             |   27 +-
 _darcs/pristine/actions/invite.php                 |   18 +-
 _darcs/pristine/actions/login.php                  |   18 +-
 _darcs/pristine/actions/logout.php                 |    6 +-
 _darcs/pristine/actions/microsummary.php           |    3 +-
 _darcs/pristine/actions/newmessage.php             |   15 +-
 _darcs/pristine/actions/newnotice.php              |   18 +-
 _darcs/pristine/actions/noticesearch.php           |   18 +-
 _darcs/pristine/actions/noticesearchrss.php        |   12 +-
 _darcs/pristine/actions/nudge.php                  |    6 +-
 _darcs/pristine/actions/openidlogin.php            |   12 +-
 _darcs/pristine/actions/openidsettings.php         |   12 +-
 _darcs/pristine/actions/opensearch.php             |    3 +-
 _darcs/pristine/actions/othersettings.php          |   18 +-
 _darcs/pristine/actions/peoplesearch.php           |   15 +-
 _darcs/pristine/actions/peopletag.php              |   15 +-
 _darcs/pristine/actions/postnotice.php             |    6 +-
 _darcs/pristine/actions/profilesettings.php        |   30 +-
 _darcs/pristine/actions/public.php                 |   15 +-
 _darcs/pristine/actions/publicrss.php              |   12 +-
 _darcs/pristine/actions/publicxrds.php             |    9 +-
 _darcs/pristine/actions/recoverpassword.php        |   33 +-
 _darcs/pristine/actions/register.php               |   21 +-
 _darcs/pristine/actions/remotesubscribe.php        |   36 +-
 _darcs/pristine/actions/replies.php                |   15 +-
 _darcs/pristine/actions/repliesrss.php             |   12 +-
 _darcs/pristine/actions/requesttoken.php           |    6 +-
 _darcs/pristine/actions/showfavorites.php          |   12 +-
 _darcs/pristine/actions/showmessage.php            |   21 +-
 _darcs/pristine/actions/shownotice.php             |   21 +-
 _darcs/pristine/actions/showstream.php             |   42 +-
 _darcs/pristine/actions/smssettings.php            |   33 +-
 _darcs/pristine/actions/subedit.php                |    6 +-
 _darcs/pristine/actions/subscribe.php              |    3 +-
 _darcs/pristine/actions/subscribers.php            |   21 +-
 _darcs/pristine/actions/subscriptions.php          |   21 +-
 _darcs/pristine/actions/sup.php                    |   12 +-
 _darcs/pristine/actions/tag.php                    |   18 +-
 _darcs/pristine/actions/tagother.php               |   12 +-
 _darcs/pristine/actions/tagrss.php                 |    9 +-
 _darcs/pristine/actions/twitapiaccount.php         |   15 +-
 _darcs/pristine/actions/twitapiblocks.php          |    6 +-
 _darcs/pristine/actions/twitapidirect_messages.php |   30 +-
 _darcs/pristine/actions/twitapifavorites.php       |   15 +-
 _darcs/pristine/actions/twitapifriendships.php     |    9 +-
 _darcs/pristine/actions/twitapihelp.php            |    6 +-
 _darcs/pristine/actions/twitapinotifications.php   |    6 +-
 _darcs/pristine/actions/twitapistatuses.php        |   39 +-
 _darcs/pristine/actions/twitapiusers.php           |    3 +-
 _darcs/pristine/actions/twittersettings.php        |   30 +-
 _darcs/pristine/actions/unblock.php                |    9 +-
 _darcs/pristine/actions/unsubscribe.php            |    3 +-
 _darcs/pristine/actions/updateprofile.php          |    6 +-
 _darcs/pristine/actions/userauthorization.php      |   63 +-
 _darcs/pristine/actions/userbyid.php               |    6 +-
 _darcs/pristine/actions/userrss.php                |   15 +-
 _darcs/pristine/actions/xrds.php                   |   12 +-
 _darcs/pristine/classes/Avatar.php                 |   15 +-
 _darcs/pristine/classes/Channel.php                |   78 +-
 _darcs/pristine/classes/Command.php                |   75 +-
 _darcs/pristine/classes/CommandInterpreter.php     |    3 +-
 _darcs/pristine/classes/Confirm_address.php        |    6 +-
 _darcs/pristine/classes/Consumer.php               |    3 +-
 _darcs/pristine/classes/Fave.php                   |    6 +-
 _darcs/pristine/classes/Foreign_link.php           |    9 +-
 _darcs/pristine/classes/Foreign_service.php        |    3 +-
 _darcs/pristine/classes/Foreign_subscription.php   |    3 +-
 _darcs/pristine/classes/Foreign_user.php           |    6 +-
 _darcs/pristine/classes/Invitation.php             |    3 +-
 _darcs/pristine/classes/Memcached_DataObject.php   |   30 +-
 _darcs/pristine/classes/Message.php                |    9 +-
 _darcs/pristine/classes/Nonce.php                  |    3 +-
 _darcs/pristine/classes/Notice.php                 |   42 +-
 _darcs/pristine/classes/NoticeWrapper.php          |    6 +-
 _darcs/pristine/classes/Notice_inbox.php           |    3 +-
 _darcs/pristine/classes/Notice_source.php          |    3 +-
 _darcs/pristine/classes/Notice_tag.php             |    6 +-
 _darcs/pristine/classes/Profile.php                |   24 +-
 _darcs/pristine/classes/Profile_block.php          |    6 +-
 _darcs/pristine/classes/Profile_tag.php            |    3 +-
 _darcs/pristine/classes/Queue_item.php             |    6 +-
 _darcs/pristine/classes/Remember_me.php            |    6 +-
 _darcs/pristine/classes/Remote_profile.php         |    3 +-
 _darcs/pristine/classes/Reply.php                  |    3 +-
 _darcs/pristine/classes/Sms_carrier.php            |    6 +-
 _darcs/pristine/classes/Subscription.php           |    6 +-
 _darcs/pristine/classes/Token.php                  |    3 +-
 _darcs/pristine/classes/User.php                   |   66 +-
 _darcs/pristine/classes/User_openid.php            |    3 +-
 _darcs/pristine/lib/Shorturl_api.php               |   15 +-
 _darcs/pristine/lib/common.php                     |    3 +-
 _darcs/pristine/lib/deleteaction.php               |   12 +-
 _darcs/pristine/lib/facebookaction.php             |   30 +-
 _darcs/pristine/lib/oauthstore.php                 |   21 +-
 _darcs/pristine/lib/omb.php                        |   42 +-
 _darcs/pristine/lib/openid.php                     |   33 +-
 _darcs/pristine/lib/personal.php                   |   18 +-
 _darcs/pristine/lib/profilelist.php                |   15 +-
 _darcs/pristine/lib/queuehandler.php               |   39 +-
 _darcs/pristine/lib/rssaction.php                  |   39 +-
 _darcs/pristine/lib/search_engines.php             |   33 +-
 _darcs/pristine/lib/searchaction.php               |   21 +-
 _darcs/pristine/lib/settingsaction.php             |   21 +-
 _darcs/pristine/lib/stream.php                     |    6 +-
 _darcs/pristine/lib/subs.php                       |   18 +-
 _darcs/pristine/lib/theme.php                      |    6 +-
 _darcs/pristine/lib/twitter.php                    |   21 +-
 _darcs/pristine/lib/twitterapi.php                 |  105 +-
 _darcs/pristine/lib/util.php                       |  372 +-
 _darcs/pristine/lib/xmppqueuehandler.php           |   18 +-
 _darcs/pristine/scripts/enjitqueuehandler.php      |    9 +-
 _darcs/pristine/scripts/jabberqueuehandler.php     |    6 +-
 _darcs/pristine/scripts/maildaemon.php             |   36 +-
 _darcs/pristine/scripts/ombqueuehandler.php        |   15 +-
 _darcs/pristine/scripts/publicqueuehandler.php     |    6 +-
 _darcs/pristine/scripts/sitemap.php                |   39 +-
 _darcs/pristine/scripts/smsqueuehandler.php        |   12 +-
 _darcs/pristine/scripts/xmppconfirmhandler.php     |   12 +-
 _darcs/pristine/scripts/xmppdaemon.php             |   54 +-
 _darcs/tentative_pristine                          | 4908 +++++++++++++++-----
 actions/accesstoken.php                            |    3 +-
 actions/all.php                                    |   12 +-
 actions/allrss.php                                 |   12 +-
 actions/api.php                                    |   15 +-
 actions/avatarbynickname.php                       |    3 +-
 actions/block.php                                  |   12 +-
 actions/confirmaddress.php                         |    3 +-
 actions/deletenotice.php                           |   15 +-
 actions/deleteprofile.php                          |   33 +-
 actions/disfavor.php                               |    3 +-
 actions/doc.php                                    |    3 +-
 actions/emailsettings.php                          |   33 +-
 actions/facebookhome.php                           |   12 +-
 actions/facebookinvite.php                         |    6 +-
 actions/facebookremove.php                         |    3 +-
 actions/facebooksettings.php                       |    6 +-
 actions/favor.php                                  |    6 +-
 actions/favorited.php                              |   15 +-
 actions/favoritesrss.php                           |   12 +-
 actions/featured.php                               |   15 +-
 actions/finishaddopenid.php                        |    9 +-
 actions/finishimmediate.php                        |    6 +-
 actions/finishopenidlogin.php                      |   51 +-
 actions/finishremotesubscribe.php                  |    9 +-
 actions/foaf.php                                   |   12 +-
 actions/imsettings.php                             |   27 +-
 actions/invite.php                                 |   18 +-
 actions/login.php                                  |   18 +-
 actions/logout.php                                 |    6 +-
 actions/microsummary.php                           |    3 +-
 actions/newmessage.php                             |   15 +-
 actions/newnotice.php                              |   18 +-
 actions/noticesearch.php                           |   18 +-
 actions/noticesearchrss.php                        |   12 +-
 actions/nudge.php                                  |    6 +-
 actions/openidlogin.php                            |   12 +-
 actions/openidsettings.php                         |   12 +-
 actions/opensearch.php                             |    3 +-
 actions/othersettings.php                          |   18 +-
 actions/peoplesearch.php                           |   15 +-
 actions/peopletag.php                              |   15 +-
 actions/postnotice.php                             |    6 +-
 actions/profilesettings.php                        |   30 +-
 actions/public.php                                 |   15 +-
 actions/publicrss.php                              |   12 +-
 actions/publicxrds.php                             |    9 +-
 actions/recoverpassword.php                        |   33 +-
 actions/register.php                               |   21 +-
 actions/remotesubscribe.php                        |   36 +-
 actions/replies.php                                |   15 +-
 actions/repliesrss.php                             |   12 +-
 actions/requesttoken.php                           |    6 +-
 actions/showfavorites.php                          |   12 +-
 actions/showmessage.php                            |   21 +-
 actions/shownotice.php                             |   21 +-
 actions/showstream.php                             |   42 +-
 actions/smssettings.php                            |   33 +-
 actions/subedit.php                                |    6 +-
 actions/subscribe.php                              |    3 +-
 actions/subscribers.php                            |   21 +-
 actions/subscriptions.php                          |   21 +-
 actions/sup.php                                    |   12 +-
 actions/tag.php                                    |   18 +-
 actions/tagother.php                               |   12 +-
 actions/tagrss.php                                 |    9 +-
 actions/twitapiaccount.php                         |   15 +-
 actions/twitapiblocks.php                          |    6 +-
 actions/twitapidirect_messages.php                 |   30 +-
 actions/twitapifavorites.php                       |   15 +-
 actions/twitapifriendships.php                     |    9 +-
 actions/twitapihelp.php                            |    6 +-
 actions/twitapinotifications.php                   |    6 +-
 actions/twitapistatuses.php                        |   39 +-
 actions/twitapiusers.php                           |    3 +-
 actions/twittersettings.php                        |   30 +-
 actions/unblock.php                                |    9 +-
 actions/unsubscribe.php                            |    3 +-
 actions/updateprofile.php                          |    6 +-
 actions/userauthorization.php                      |   63 +-
 actions/userbyid.php                               |    6 +-
 actions/userrss.php                                |   15 +-
 actions/xrds.php                                   |   12 +-
 classes/Avatar.php                                 |   15 +-
 classes/Channel.php                                |   78 +-
 classes/Command.php                                |   75 +-
 classes/CommandInterpreter.php                     |    3 +-
 classes/Confirm_address.php                        |    6 +-
 classes/Consumer.php                               |    3 +-
 classes/Fave.php                                   |    6 +-
 classes/Foreign_link.php                           |    9 +-
 classes/Foreign_service.php                        |    3 +-
 classes/Foreign_subscription.php                   |    3 +-
 classes/Foreign_user.php                           |    6 +-
 classes/Invitation.php                             |    3 +-
 classes/Memcached_DataObject.php                   |   30 +-
 classes/Message.php                                |    9 +-
 classes/Nonce.php                                  |    3 +-
 classes/Notice.php                                 |   42 +-
 classes/NoticeWrapper.php                          |    6 +-
 classes/Notice_inbox.php                           |    3 +-
 classes/Notice_source.php                          |    3 +-
 classes/Notice_tag.php                             |    6 +-
 classes/Profile.php                                |   24 +-
 classes/Profile_block.php                          |    6 +-
 classes/Profile_tag.php                            |    3 +-
 classes/Queue_item.php                             |    6 +-
 classes/Remember_me.php                            |    6 +-
 classes/Remote_profile.php                         |    3 +-
 classes/Reply.php                                  |    3 +-
 classes/Sms_carrier.php                            |    6 +-
 classes/Subscription.php                           |    6 +-
 classes/Token.php                                  |    3 +-
 classes/User.php                                   |   66 +-
 classes/User_openid.php                            |    3 +-
 lib/Shorturl_api.php                               |   15 +-
 lib/common.php                                     |    3 +-
 lib/deleteaction.php                               |   12 +-
 lib/facebookaction.php                             |   30 +-
 lib/oauthstore.php                                 |   21 +-
 lib/omb.php                                        |   42 +-
 lib/openid.php                                     |   33 +-
 lib/personal.php                                   |   18 +-
 lib/profilelist.php                                |   15 +-
 lib/queuehandler.php                               |   39 +-
 lib/rssaction.php                                  |   39 +-
 lib/search_engines.php                             |   33 +-
 lib/searchaction.php                               |   21 +-
 lib/settingsaction.php                             |   21 +-
 lib/stream.php                                     |    6 +-
 lib/subs.php                                       |   18 +-
 lib/theme.php                                      |    6 +-
 lib/twitter.php                                    |   21 +-
 lib/twitterapi.php                                 |  105 +-
 lib/util.php                                       |  372 +-
 lib/xmppqueuehandler.php                           |   18 +-
 scripts/enjitqueuehandler.php                      |    9 +-
 scripts/jabberqueuehandler.php                     |    6 +-
 scripts/maildaemon.php                             |   36 +-
 scripts/ombqueuehandler.php                        |   15 +-
 scripts/publicqueuehandler.php                     |    6 +-
 scripts/sitemap.php                                |   39 +-
 scripts/smsqueuehandler.php                        |   12 +-
 scripts/xmppconfirmhandler.php                     |   12 +-
 scripts/xmppdaemon.php                             |   54 +-
 291 files changed, 7292 insertions(+), 3123 deletions(-)
 create mode 100644 _darcs/patches/20081223193323-84dde-a28e36ecc66672c783c2842d12fc11043c13ab28.gz

(limited to 'actions/twitapihelp.php')

diff --git a/_darcs/inventory b/_darcs/inventory
index 3137b8080..844cdd799 100644
--- a/_darcs/inventory
+++ b/_darcs/inventory
@@ -67,4 +67,15 @@ Evan Prodromou <evan@prodromou.name>**20081223192129
  keyword 'NULL' with its lowercase version. This is another PEAR code
  standards change.
  
+] 
+[change function headers to K&R style
+Evan Prodromou <evan@prodromou.name>**20081223193323
+ 
+ Another huge change, for PEAR code standards compliance. Function
+ headers have to be in K&R style (opening brace on its own line),
+ instead of having the opening brace on the same line as the function
+ and parameters. So, a little perl magic found all the function
+ definitions and move the opening brace to the next line (properly
+ indented... usually).
+ 
 ] 
\ No newline at end of file
diff --git a/_darcs/patches/20081223193323-84dde-a28e36ecc66672c783c2842d12fc11043c13ab28.gz b/_darcs/patches/20081223193323-84dde-a28e36ecc66672c783c2842d12fc11043c13ab28.gz
new file mode 100644
index 000000000..5319bc087
Binary files /dev/null and b/_darcs/patches/20081223193323-84dde-a28e36ecc66672c783c2842d12fc11043c13ab28.gz differ
diff --git a/_darcs/pristine/actions/accesstoken.php b/_darcs/pristine/actions/accesstoken.php
index a468c33a6..738ec071f 100644
--- a/_darcs/pristine/actions/accesstoken.php
+++ b/_darcs/pristine/actions/accesstoken.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/omb.php');
 
 class AccesstokenAction extends Action {
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         try {
             common_debug('getting request from env variables', __FILE__);
diff --git a/_darcs/pristine/actions/all.php b/_darcs/pristine/actions/all.php
index 066ee77bf..028a3679a 100644
--- a/_darcs/pristine/actions/all.php
+++ b/_darcs/pristine/actions/all.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/actions/showstream.php');
 
 class AllAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -53,7 +54,8 @@ class AllAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_header($user) {
+    function show_header($user)
+    {
         common_element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('allrss', array('nickname' =>
                                                                                $user->nickname)),
@@ -61,7 +63,8 @@ class AllAction extends StreamAction {
                                      'title' => sprintf(_('Feed for friends of %s'), $user->nickname)));
     }
 
-    function show_top($user) {
+    function show_top($user)
+    {
         $cur = common_current_user();
 
         if ($cur && $cur->id == $user->id) {
@@ -76,7 +79,8 @@ class AllAction extends StreamAction {
                                               'item' => 'allrss')));
     }
 
-    function show_notices($user) {
+    function show_notices($user)
+    {
 
         $page = $this->trimmed('page');
         if (!$page) {
diff --git a/_darcs/pristine/actions/allrss.php b/_darcs/pristine/actions/allrss.php
index 851cd0ad5..9c20cd416 100644
--- a/_darcs/pristine/actions/allrss.php
+++ b/_darcs/pristine/actions/allrss.php
@@ -27,7 +27,8 @@ class AllrssAction extends Rss10Action {
 
     var $user = null;
 
-    function init() {
+    function init()
+    {
         $nickname = $this->trimmed('nickname');
         $this->user = User::staticGet('nickname', $nickname);
 
@@ -39,7 +40,8 @@ class AllrssAction extends Rss10Action {
         }
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
 
         $user = $this->user;
         
@@ -52,7 +54,8 @@ class AllrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         $user = $this->user;
         $c = array('url' => common_local_url('allrss',
                                              array('nickname' =>
@@ -65,7 +68,8 @@ class AllrssAction extends Rss10Action {
         return $c;
     }
 
-    function get_image() {
+    function get_image()
+    {
         $user = $this->user;
         $profile = $user->getProfile();
         if (!$profile) {
diff --git a/_darcs/pristine/actions/api.php b/_darcs/pristine/actions/api.php
index e7646a7bb..8ccd86f0b 100644
--- a/_darcs/pristine/actions/api.php
+++ b/_darcs/pristine/actions/api.php
@@ -27,7 +27,8 @@ class ApiAction extends Action {
     var $api_method;
     var $api_action;
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $this->api_action = $this->arg('apiaction');
@@ -79,7 +80,8 @@ class ApiAction extends Action {
         }
     }
 
-    function process_command() {
+    function process_command()
+    {
         $action = "twitapi$this->api_action";
         $actionfile = INSTALLDIR."/actions/$action.php";
 
@@ -108,7 +110,8 @@ class ApiAction extends Action {
     }
 
     # Whitelist of API methods that don't need authentication
-    function requires_auth() {
+    function requires_auth()
+    {
         static $noauth = array( 'statuses/public_timeline',
                                 'statuses/show',
                                 'users/show',
@@ -144,7 +147,8 @@ class ApiAction extends Action {
         }
     }
 
-    function show_basic_auth_error() {
+    function show_basic_auth_error()
+    {
         header('HTTP/1.1 401 Unauthorized');
         $msg = 'Could not authenticate you.';
 
@@ -166,7 +170,8 @@ class ApiAction extends Action {
         }
     }
 
-    function is_readonly() {
+    function is_readonly()
+    {
         # NOTE: before handle(), can't use $this->arg
         $apiaction = $_REQUEST['apiaction'];
         $method = $_REQUEST['method'];
diff --git a/_darcs/pristine/actions/avatarbynickname.php b/_darcs/pristine/actions/avatarbynickname.php
index 2ca861a66..4aeb4112a 100644
--- a/_darcs/pristine/actions/avatarbynickname.php
+++ b/_darcs/pristine/actions/avatarbynickname.php
@@ -20,7 +20,8 @@
 if (!defined('LACONICA')) { exit(1); }
 
 class AvatarbynicknameAction extends Action {
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $nickname = $this->trimmed('nickname');
         if (!$nickname) {
diff --git a/_darcs/pristine/actions/block.php b/_darcs/pristine/actions/block.php
index cfcd29848..702adcffa 100644
--- a/_darcs/pristine/actions/block.php
+++ b/_darcs/pristine/actions/block.php
@@ -23,7 +23,8 @@ class BlockAction extends Action {
 
     var $profile = null;
 
-    function prepare($args) {
+    function prepare($args)
+    {
 
         parent::prepare($args);
 
@@ -56,7 +57,8 @@ class BlockAction extends Action {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             if ($this->arg('block')) {
@@ -71,7 +73,8 @@ class BlockAction extends Action {
         }
     }
 
-    function are_you_sure_form() {
+    function are_you_sure_form()
+    {
 
         $id = $this->profile->id;
 
@@ -109,7 +112,8 @@ class BlockAction extends Action {
         common_show_footer();
     }
 
-    function block_profile() {
+    function block_profile()
+    {
 
         $cur = common_current_user();
 
diff --git a/_darcs/pristine/actions/confirmaddress.php b/_darcs/pristine/actions/confirmaddress.php
index 562b70fe9..d926864a6 100644
--- a/_darcs/pristine/actions/confirmaddress.php
+++ b/_darcs/pristine/actions/confirmaddress.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class ConfirmaddressAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (!common_logged_in()) {
             common_set_returnto($this->self_url());
diff --git a/_darcs/pristine/actions/deletenotice.php b/_darcs/pristine/actions/deletenotice.php
index 0777918d2..4f00db617 100644
--- a/_darcs/pristine/actions/deletenotice.php
+++ b/_darcs/pristine/actions/deletenotice.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/deleteaction.php');
 
 class DeletenoticeAction extends DeleteAction {
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         # XXX: Ajax!
 
@@ -33,15 +34,18 @@ class DeletenoticeAction extends DeleteAction {
         }
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('You are about to permanently delete a notice.  Once this is done, it cannot be undone.');
     }
 
-    function get_title() {
+    function get_title()
+    {
         return _('Delete notice');
     }
 
-    function show_form($error=null) {
+    function show_form($error=null)
+    {
         $user = common_current_user();
 
         common_show_header($this->get_title(), array($this, 'show_header'), $error,
@@ -67,7 +71,8 @@ class DeletenoticeAction extends DeleteAction {
         common_show_footer();
     }
 
-    function delete_notice() {
+    function delete_notice()
+    {
         # CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
diff --git a/_darcs/pristine/actions/deleteprofile.php b/_darcs/pristine/actions/deleteprofile.php
index 503b3666d..b1c346cb2 100644
--- a/_darcs/pristine/actions/deleteprofile.php
+++ b/_darcs/pristine/actions/deleteprofile.php
@@ -20,7 +20,8 @@
 if (!defined('LACONICA')) { exit(1); }
 
 class DeleteprofileAction extends Action {
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $this->server_error(_('Code not yet ready.'));
         return;
@@ -32,18 +33,21 @@ class DeleteprofileAction extends Action {
         }
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Export and delete your user information.');
     }
 
-    function form_header($title, $msg=null, $success=false) {
+    function form_header($title, $msg=null, $success=false)
+    {
         common_show_header($title,
                            null,
                            array($msg, $success),
                            array($this, 'show_top'));
     }
 
-    function show_feeds_list($feeds) {
+    function show_feeds_list($feeds)
+    {
         common_element_start('div', array('class' => 'feedsdel'));
         common_element('p', null, 'Feeds:');
         common_element_start('ul', array('class' => 'xoxo'));
@@ -56,7 +60,8 @@ class DeleteprofileAction extends Action {
     }
 
     //TODO move to common.php (and retrace its origin)
-    function common_feed_item($feed) {
+    function common_feed_item($feed)
+    {
         $user = common_current_user();
         $nickname = $user->nickname;
 
@@ -84,14 +89,16 @@ class DeleteprofileAction extends Action {
         common_element_end('li');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $this->form_header(_('Delete my account'), $msg, $success);
         common_element('h2', null, _('Delete my account confirmation'));
         $this->show_confirm_delete_form();
         common_show_footer();
     }
 
-    function show_confirm_delete_form() {
+    function show_confirm_delete_form()
+    {
         $user = common_current_user();
         $notices = DB_DataObject::factory('notice');
         $notices->profile_id = $user->id;
@@ -120,7 +127,8 @@ class DeleteprofileAction extends Action {
         common_element_end('form');
     }
 
-    function handle_post() {
+    function handle_post()
+    {
         # CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
@@ -134,7 +142,8 @@ class DeleteprofileAction extends Action {
         $this->show_form();
     }
 
-    function delete_account() {
+    function delete_account()
+    {
         $user = common_current_user();
         assert(!is_null($user)); # should already be checked
 
@@ -219,7 +228,8 @@ class DeleteprofileAction extends Action {
         common_redirect(common_local_url('public'));
     }
 
-    function show_top($arr) {
+    function show_top($arr)
+    {
         $msg = $arr[0];
         $success = $arr[1];
         if ($msg) {
@@ -234,7 +244,8 @@ class DeleteprofileAction extends Action {
         $this->settings_menu();
     }
 
-    function settings_menu() {
+    function settings_menu()
+    {
         # action => array('prompt', 'title')
         $menu =
           array('profilesettings' =>
diff --git a/_darcs/pristine/actions/disfavor.php b/_darcs/pristine/actions/disfavor.php
index e47e68a8c..f0b528453 100644
--- a/_darcs/pristine/actions/disfavor.php
+++ b/_darcs/pristine/actions/disfavor.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class DisfavorAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
diff --git a/_darcs/pristine/actions/doc.php b/_darcs/pristine/actions/doc.php
index 0cf665d68..441ac19a7 100644
--- a/_darcs/pristine/actions/doc.php
+++ b/_darcs/pristine/actions/doc.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class DocAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $title = $this->trimmed('title');
         $filename = INSTALLDIR.'/doc/'.$title;
diff --git a/_darcs/pristine/actions/emailsettings.php b/_darcs/pristine/actions/emailsettings.php
index 06b3ef29f..3dcf7716f 100644
--- a/_darcs/pristine/actions/emailsettings.php
+++ b/_darcs/pristine/actions/emailsettings.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
 
 class EmailsettingsAction extends SettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Manage how you get email from %%site.name%%.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $user = common_current_user();
         $this->form_header(_('Email Settings'), $msg, $success);
         common_element_start('form', array('method' => 'post',
@@ -110,7 +112,8 @@ class EmailsettingsAction extends SettingsAction {
         common_show_footer();
     }
 
-    function get_confirmation() {
+    function get_confirmation()
+    {
         $user = common_current_user();
         $confirm = new Confirm_address();
         $confirm->user_id = $user->id;
@@ -122,7 +125,8 @@ class EmailsettingsAction extends SettingsAction {
         }
     }
 
-    function handle_post() {
+    function handle_post()
+    {
 
         # CSRF protection
         $token = $this->trimmed('token');
@@ -148,7 +152,8 @@ class EmailsettingsAction extends SettingsAction {
         }
     }
 
-    function save_preferences() {
+    function save_preferences()
+    {
 
         $emailnotifysub = $this->boolean('emailnotifysub');
         $emailnotifyfav = $this->boolean('emailnotifyfav');
@@ -185,7 +190,8 @@ class EmailsettingsAction extends SettingsAction {
         $this->show_form(_('Preferences saved.'), true);
     }
 
-    function add_address() {
+    function add_address()
+    {
 
         $user = common_current_user();
 
@@ -236,7 +242,8 @@ class EmailsettingsAction extends SettingsAction {
         $this->show_form($msg, TRUE);
     }
 
-    function cancel_confirmation() {
+    function cancel_confirmation()
+    {
         $email = $this->arg('email');
         $confirm = $this->get_confirmation();
         if (!$confirm) {
@@ -259,7 +266,8 @@ class EmailsettingsAction extends SettingsAction {
         $this->show_form(_('Confirmation cancelled.'), TRUE);
     }
 
-    function remove_address() {
+    function remove_address()
+    {
 
         $user = common_current_user();
         $email = $this->arg('email');
@@ -285,7 +293,8 @@ class EmailsettingsAction extends SettingsAction {
         $this->show_form(_('The address was removed.'), TRUE);
     }
 
-    function remove_incoming() {
+    function remove_incoming()
+    {
         $user = common_current_user();
         
         if (!$user->incomingemail) {
@@ -304,7 +313,8 @@ class EmailsettingsAction extends SettingsAction {
         $this->show_form(_('Incoming email address removed.'), TRUE);
     }
 
-    function new_incoming() {
+    function new_incoming()
+    {
         $user = common_current_user();
         
         $orig = clone($user);
@@ -318,7 +328,8 @@ class EmailsettingsAction extends SettingsAction {
         $this->show_form(_('New incoming email address added.'), TRUE);
     }
     
-    function email_exists($email) {
+    function email_exists($email)
+    {
         $user = common_current_user();
         $other = User::staticGet('email', $email);
         if (!$other) {
diff --git a/_darcs/pristine/actions/facebookhome.php b/_darcs/pristine/actions/facebookhome.php
index c964f451a..006f35eca 100644
--- a/_darcs/pristine/actions/facebookhome.php
+++ b/_darcs/pristine/actions/facebookhome.php
@@ -23,13 +23,15 @@ require_once(INSTALLDIR.'/lib/facebookaction.php');
 
 class FacebookhomeAction extends FacebookAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $this->login();
     }
 
-    function login() {
+    function login()
+    {
 
         $user = null;
 
@@ -89,7 +91,8 @@ class FacebookhomeAction extends FacebookAction {
 
     }
 
-    function show_home($facebook, $fbuid, $user) {
+    function show_home($facebook, $fbuid, $user)
+    {
 
         $this->show_header('Home');
 
@@ -99,7 +102,8 @@ class FacebookhomeAction extends FacebookAction {
         $this->show_footer();
     }
 
-    function show_notices($user) {
+    function show_notices($user)
+    {
 
         $page = $this->trimmed('page');
         if (!$page) {
diff --git a/_darcs/pristine/actions/facebookinvite.php b/_darcs/pristine/actions/facebookinvite.php
index 3a85a7c5c..fc226e65a 100644
--- a/_darcs/pristine/actions/facebookinvite.php
+++ b/_darcs/pristine/actions/facebookinvite.php
@@ -23,13 +23,15 @@ require_once(INSTALLDIR.'/lib/facebookaction.php');
 
 class FacebookinviteAction extends FacebookAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $this->display();
     }
 
-    function display() {
+    function display()
+    {
 
         $facebook = $this->get_facebook();
 
diff --git a/_darcs/pristine/actions/facebookremove.php b/_darcs/pristine/actions/facebookremove.php
index 1215f6622..79dc32e49 100644
--- a/_darcs/pristine/actions/facebookremove.php
+++ b/_darcs/pristine/actions/facebookremove.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/facebookaction.php');
 
 class FacebookremoveAction extends FacebookAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $secret = common_config('facebook', 'secret');
diff --git a/_darcs/pristine/actions/facebooksettings.php b/_darcs/pristine/actions/facebooksettings.php
index a5ad9d07a..03ad57813 100644
--- a/_darcs/pristine/actions/facebooksettings.php
+++ b/_darcs/pristine/actions/facebooksettings.php
@@ -23,13 +23,15 @@ require_once(INSTALLDIR.'/lib/facebookaction.php');
 
 class FacebooksettingsAction extends FacebookAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $this->display();
     }
 
-    function display() {
+    function display()
+    {
 
         $facebook = $this->get_facebook();
 
diff --git a/_darcs/pristine/actions/favor.php b/_darcs/pristine/actions/favor.php
index c0b0324b5..3ec4af0b5 100644
--- a/_darcs/pristine/actions/favor.php
+++ b/_darcs/pristine/actions/favor.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/mail.php');
 
 class FavorAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if (!common_logged_in()) {
@@ -80,7 +81,8 @@ class FavorAction extends Action {
         }
     }
 
-    function notify($fave, $notice, $user) {
+    function notify($fave, $notice, $user)
+    {
         $other = User::staticGet('id', $notice->profile_id);
         if ($other && $other->id != $user->id) {
             if ($other->email && $other->emailnotifyfav) {
diff --git a/_darcs/pristine/actions/favorited.php b/_darcs/pristine/actions/favorited.php
index e69630d50..d479e1b3e 100644
--- a/_darcs/pristine/actions/favorited.php
+++ b/_darcs/pristine/actions/favorited.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/stream.php');
 
 class FavoritedAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -37,7 +38,8 @@ class FavoritedAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_top() {
+    function show_top()
+    {
         $instr = $this->get_instructions();
         $output = common_markup_to_html($instr);
         common_element_start('div', 'instructions');
@@ -46,15 +48,18 @@ class FavoritedAction extends StreamAction {
         $this->public_views_menu();
     }
 
-    function show_header() {
+    function show_header()
+    {
         return;
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Showing recently popular notices');
     }
 
-    function show_notices($page) {
+    function show_notices($page)
+    {
 
         $qry = 'SELECT notice.*, sum(exp(-(now() - fave.modified) / %s)) as weight ' .
                 'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
diff --git a/_darcs/pristine/actions/favoritesrss.php b/_darcs/pristine/actions/favoritesrss.php
index 7071812d7..aa8a3c6f4 100644
--- a/_darcs/pristine/actions/favoritesrss.php
+++ b/_darcs/pristine/actions/favoritesrss.php
@@ -27,7 +27,8 @@ class FavoritesrssAction extends Rss10Action {
 
     var $user = null;
     
-    function init() {
+    function init()
+    {
         $nickname = $this->trimmed('nickname');
         $this->user = User::staticGet('nickname', $nickname);
 
@@ -39,7 +40,8 @@ class FavoritesrssAction extends Rss10Action {
         }
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
 
         $user = $this->user;
 
@@ -54,7 +56,8 @@ class FavoritesrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         $user = $this->user;
         $c = array('url' => common_local_url('favoritesrss',
                                              array('nickname' =>
@@ -67,7 +70,8 @@ class FavoritesrssAction extends Rss10Action {
         return $c;
     }
 
-    function get_image() {
+    function get_image()
+    {
         return null;
     }
 }
\ No newline at end of file
diff --git a/_darcs/pristine/actions/featured.php b/_darcs/pristine/actions/featured.php
index f478a4017..1763adeab 100644
--- a/_darcs/pristine/actions/featured.php
+++ b/_darcs/pristine/actions/featured.php
@@ -24,7 +24,8 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
 
 class FeaturedAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -38,7 +39,8 @@ class FeaturedAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_top() {
+    function show_top()
+    {
         $instr = $this->get_instructions();
         $output = common_markup_to_html($instr);
         common_element_start('div', 'instructions');
@@ -47,14 +49,17 @@ class FeaturedAction extends StreamAction {
         $this->public_views_menu();
     }
 
-    function show_header() {
+    function show_header()
+    {
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Featured users');
     }
 
-    function show_notices($page) {
+    function show_notices($page)
+    {
 
         // XXX: Note I'm doing it this two-stage way because a raw query
         // with a JOIN was *not* working. --Zach
diff --git a/_darcs/pristine/actions/finishaddopenid.php b/_darcs/pristine/actions/finishaddopenid.php
index 7607688de..d8409b6e9 100644
--- a/_darcs/pristine/actions/finishaddopenid.php
+++ b/_darcs/pristine/actions/finishaddopenid.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class FinishaddopenidAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (!common_logged_in()) {
             common_user_error(_('Not logged in.'));
@@ -32,7 +33,8 @@ class FinishaddopenidAction extends Action {
         }
     }
     
-    function try_login() {
+    function try_login()
+    {
 
         $consumer =& oid_consumer();
 
@@ -95,7 +97,8 @@ class FinishaddopenidAction extends Action {
         }
     }
 
-    function message($msg) {
+    function message($msg)
+    {
         common_show_header(_('OpenID Login'));
         common_element('p', null, $msg);
         common_show_footer();
diff --git a/_darcs/pristine/actions/finishimmediate.php b/_darcs/pristine/actions/finishimmediate.php
index ea711f5c5..c4a1c1af9 100644
--- a/_darcs/pristine/actions/finishimmediate.php
+++ b/_darcs/pristine/actions/finishimmediate.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class FinishimmediateAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $consumer = oid_consumer();
@@ -53,7 +54,8 @@ class FinishimmediateAction extends Action {
         return;
     }
 
-    function go_backto() {
+    function go_backto()
+    {
         common_ensure_session();
         $backto = $_SESSION['openid_immediate_backto'];
         if (!$backto) {
diff --git a/_darcs/pristine/actions/finishopenidlogin.php b/_darcs/pristine/actions/finishopenidlogin.php
index ae5b136a2..eb52d73b1 100644
--- a/_darcs/pristine/actions/finishopenidlogin.php
+++ b/_darcs/pristine/actions/finishopenidlogin.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class FinishopenidloginAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (common_logged_in()) {
             common_user_error(_('Already logged in.'));
@@ -52,7 +53,8 @@ class FinishopenidloginAction extends Action {
         }
     }
 
-    function show_top($error=null) {
+    function show_top($error=null)
+    {
         if ($error) {
             common_element('div', array('class' => 'error'), $error);
         } else {
@@ -62,7 +64,8 @@ class FinishopenidloginAction extends Action {
         }
     }
 
-    function show_form($error=null, $username=null) {
+    function show_form($error=null, $username=null)
+    {
         common_show_header(_('OpenID Account Setup'), null, $error,
                            array($this, 'show_top'));
 
@@ -99,7 +102,8 @@ class FinishopenidloginAction extends Action {
         common_show_footer();
     }
 
-    function try_login() {
+    function try_login()
+    {
 
         $consumer = oid_consumer();
 
@@ -146,26 +150,30 @@ class FinishopenidloginAction extends Action {
         }
     }
 
-    function message($msg) {
+    function message($msg)
+    {
         common_show_header(_('OpenID Login'));
         common_element('p', null, $msg);
         common_show_footer();
     }
 
-    function save_values($display, $canonical, $sreg) {
+    function save_values($display, $canonical, $sreg)
+    {
         common_ensure_session();
         $_SESSION['openid_display'] = $display;
         $_SESSION['openid_canonical'] = $canonical;
         $_SESSION['openid_sreg'] = $sreg;
     }
 
-    function get_saved_values() {
+    function get_saved_values()
+    {
         return array($_SESSION['openid_display'],
                      $_SESSION['openid_canonical'],
                      $_SESSION['openid_sreg']);
     }
 
-    function create_new_user() {
+    function create_new_user()
+    {
 
         # FIXME: save invite code before redirect, and check here
 
@@ -247,7 +255,8 @@ class FinishopenidloginAction extends Action {
         common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)));
     }
 
-    function connect_user() {
+    function connect_user()
+    {
 
         $nickname = $this->trimmed('nickname');
         $password = $this->trimmed('password');
@@ -286,7 +295,8 @@ class FinishopenidloginAction extends Action {
         $this->go_home($user->nickname);
     }
 
-    function go_home($nickname) {
+    function go_home($nickname)
+    {
         $url = common_get_returnto();
         if ($url) {
             # We don't have to return to it again
@@ -299,7 +309,8 @@ class FinishopenidloginAction extends Action {
         common_redirect($url);
     }
 
-    function best_new_nickname($display, $sreg) {
+    function best_new_nickname($display, $sreg)
+    {
 
         # Try the passed-in nickname
 
@@ -332,7 +343,8 @@ class FinishopenidloginAction extends Action {
         return null;
     }
 
-    function is_new_nickname($str) {
+    function is_new_nickname($str)
+    {
         if (!Validate::string($str, array('min_length' => 1,
                                           'max_length' => 64,
                                           'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
@@ -347,7 +359,8 @@ class FinishopenidloginAction extends Action {
         return true;
     }
 
-    function openid_to_nickname($openid) {
+    function openid_to_nickname($openid)
+    {
         if (Auth_Yadis_identifierScheme($openid) == 'XRI') {
             return $this->xri_to_nickname($openid);
         } else {
@@ -360,7 +373,8 @@ class FinishopenidloginAction extends Action {
     # 2. One element in path, like http://profile.typekey.com/EvanProdromou/
     #    or http://getopenid.com/evanprodromou
 
-    function url_to_nickname($openid) {
+    function url_to_nickname($openid)
+    {
         static $bad = array('query', 'user', 'password', 'port', 'fragment');
 
         $parts = parse_url($openid);
@@ -406,7 +420,8 @@ class FinishopenidloginAction extends Action {
         return null;
     }
 
-    function xri_to_nickname($xri) {
+    function xri_to_nickname($xri)
+    {
         $base = $this->xri_base($xri);
 
         if (!$base) {
@@ -419,7 +434,8 @@ class FinishopenidloginAction extends Action {
         }
     }
 
-    function xri_base($xri) {
+    function xri_base($xri)
+    {
         if (substr($xri, 0, 6) == 'xri://') {
             return substr($xri, 6);
         } else {
@@ -429,7 +445,8 @@ class FinishopenidloginAction extends Action {
 
     # Given a string, try to make it work as a nickname
 
-    function nicknamize($str) {
+    function nicknamize($str)
+    {
         $str = preg_replace('/\W/', '', $str);
         return strtolower($str);
     }
diff --git a/_darcs/pristine/actions/finishremotesubscribe.php b/_darcs/pristine/actions/finishremotesubscribe.php
index edd4ae541..38a56c962 100644
--- a/_darcs/pristine/actions/finishremotesubscribe.php
+++ b/_darcs/pristine/actions/finishremotesubscribe.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/omb.php');
 
 class FinishremotesubscribeAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -231,13 +232,15 @@ class FinishremotesubscribeAction extends Action {
                                                              $user->nickname)));
     }
 
-    function add_avatar($profile, $url) {
+    function add_avatar($profile, $url)
+    {
         $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
         copy($url, $temp_filename);
         return $profile->setOriginal($temp_filename);
     }
 
-    function access_token($omb) {
+    function access_token($omb)
+    {
 
         common_debug('starting request for access token', __FILE__);
 
diff --git a/_darcs/pristine/actions/foaf.php b/_darcs/pristine/actions/foaf.php
index 218e20f5f..893e2a861 100644
--- a/_darcs/pristine/actions/foaf.php
+++ b/_darcs/pristine/actions/foaf.php
@@ -25,11 +25,13 @@ define('BOTH', 0);
 
 class FoafAction extends Action {
 
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $nickname = $this->trimmed('nickname');
@@ -179,14 +181,16 @@ class FoafAction extends Action {
         common_element_end('rdf:RDF');
     }
 
-    function show_ppd($foaf_url, $person_uri) {
+    function show_ppd($foaf_url, $person_uri)
+    {
         common_element_start('PersonalProfileDocument', array('rdf:about' => $foaf_url));
         common_element('maker', array('rdf:resource' => $person_uri));
         common_element('primaryTopic', array('rdf:resource' => $person_uri));
         common_element_end('PersonalProfileDocument');
     }
 
-    function show_microblogging_account($profile, $service=null) {
+    function show_microblogging_account($profile, $service=null)
+    {
         # Their account
         common_element_start('holdsAccount');
         common_element_start('OnlineAccount');
diff --git a/_darcs/pristine/actions/imsettings.php b/_darcs/pristine/actions/imsettings.php
index 8f546f8e7..cccd5db49 100644
--- a/_darcs/pristine/actions/imsettings.php
+++ b/_darcs/pristine/actions/imsettings.php
@@ -24,11 +24,13 @@ require_once(INSTALLDIR.'/lib/jabber.php');
 
 class ImsettingsAction extends SettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('You can send and receive notices through Jabber/GTalk [instant messages](%%doc.im%%). Configure your address and settings below.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $user = common_current_user();
         $this->form_header(_('IM Settings'), $msg, $success);
         common_element_start('form', array('method' => 'post',
@@ -85,7 +87,8 @@ class ImsettingsAction extends SettingsAction {
         common_show_footer();
     }
 
-    function get_confirmation() {
+    function get_confirmation()
+    {
         $user = common_current_user();
         $confirm = new Confirm_address();
         $confirm->user_id = $user->id;
@@ -97,7 +100,8 @@ class ImsettingsAction extends SettingsAction {
         }
     }
 
-    function handle_post() {
+    function handle_post()
+    {
 
         # CSRF protection
         $token = $this->trimmed('token');
@@ -119,7 +123,8 @@ class ImsettingsAction extends SettingsAction {
         }
     }
 
-    function save_preferences() {
+    function save_preferences()
+    {
 
         $jabbernotify = $this->boolean('jabbernotify');
         $updatefrompresence = $this->boolean('updatefrompresence');
@@ -152,7 +157,8 @@ class ImsettingsAction extends SettingsAction {
         $this->show_form(_('Preferences saved.'), true);
     }
 
-    function add_address() {
+    function add_address()
+    {
 
         $user = common_current_user();
 
@@ -207,7 +213,8 @@ class ImsettingsAction extends SettingsAction {
         $this->show_form($msg, TRUE);
     }
 
-    function cancel_confirmation() {
+    function cancel_confirmation()
+    {
         $jabber = $this->arg('jabber');
         $confirm = $this->get_confirmation();
         if (!$confirm) {
@@ -230,7 +237,8 @@ class ImsettingsAction extends SettingsAction {
         $this->show_form(_('Confirmation cancelled.'), TRUE);
     }
 
-    function remove_address() {
+    function remove_address()
+    {
 
         $user = common_current_user();
         $jabber = $this->arg('jabber');
@@ -258,7 +266,8 @@ class ImsettingsAction extends SettingsAction {
         $this->show_form(_('The address was removed.'), TRUE);
     }
 
-    function jabber_exists($jabber) {
+    function jabber_exists($jabber)
+    {
         $user = common_current_user();
         $other = User::staticGet('jabber', $jabber);
         if (!$other) {
diff --git a/_darcs/pristine/actions/invite.php b/_darcs/pristine/actions/invite.php
index feef94d0f..b0fc79958 100644
--- a/_darcs/pristine/actions/invite.php
+++ b/_darcs/pristine/actions/invite.php
@@ -21,11 +21,13 @@ if (!defined('LACONICA')) { exit(1); }
 
 class InviteAction extends Action {
 
-    function is_readonly() {
+    function is_readonly()
+    {
         return false;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (!common_logged_in()) {
             $this->client_error(sprintf(_('You must be logged in to invite other users to use %s'),
@@ -38,7 +40,8 @@ class InviteAction extends Action {
         }
     }
 
-    function send_invitations() {
+    function send_invitations()
+    {
 
         # CSRF protection
         $token = $this->trimmed('token');
@@ -112,7 +115,8 @@ class InviteAction extends Action {
         common_show_footer();
     }
 
-    function show_top($error=null) {
+    function show_top($error=null)
+    {
         if ($error) {
             common_element('p', 'error', $error);
         } else {
@@ -123,7 +127,8 @@ class InviteAction extends Action {
         }
     }
 
-    function show_form($error=null) {
+    function show_form($error=null)
+    {
 
         global $config;
 
@@ -149,7 +154,8 @@ class InviteAction extends Action {
         common_show_footer();
     }
 
-    function send_invitation($email, $user, $personal) {
+    function send_invitation($email, $user, $personal)
+    {
 
         $profile = $user->getProfile();
         $bestname = $profile->getBestName();
diff --git a/_darcs/pristine/actions/login.php b/_darcs/pristine/actions/login.php
index f3509519e..6ad07b610 100644
--- a/_darcs/pristine/actions/login.php
+++ b/_darcs/pristine/actions/login.php
@@ -21,11 +21,13 @@ if (!defined('LACONICA')) { exit(1); }
 
 class LoginAction extends Action {
 
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (common_is_real_login()) {
             common_user_error(_('Already logged in.'));
@@ -36,7 +38,8 @@ class LoginAction extends Action {
         }
     }
 
-    function check_login() {
+    function check_login()
+    {
         # XXX: login throttle
 
         # CSRF protection - token set in common_notice_form()
@@ -100,7 +103,8 @@ class LoginAction extends Action {
         common_redirect($url);
     }
 
-    function show_form($error=null) {
+    function show_form($error=null)
+    {
         common_show_header(_('Login'), null, $error, array($this, 'show_top'));
         common_element_start('form', array('method' => 'post',
                                            'id' => 'login',
@@ -120,7 +124,8 @@ class LoginAction extends Action {
         common_show_footer();
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         if (common_logged_in() &&
             !common_is_real_login() &&
             common_get_returnto())
@@ -138,7 +143,8 @@ class LoginAction extends Action {
         }
     }
 
-    function show_top($error=null) {
+    function show_top($error=null)
+    {
         if ($error) {
             common_element('p', 'error', $error);
         } else {
diff --git a/_darcs/pristine/actions/logout.php b/_darcs/pristine/actions/logout.php
index 4c59e47ad..effb5abbe 100644
--- a/_darcs/pristine/actions/logout.php
+++ b/_darcs/pristine/actions/logout.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class LogoutAction extends Action {
     
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
     
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (!common_logged_in()) {
             common_user_error(_('Not logged in.'));
diff --git a/_darcs/pristine/actions/microsummary.php b/_darcs/pristine/actions/microsummary.php
index ced4b0d1e..a19a26dcf 100644
--- a/_darcs/pristine/actions/microsummary.php
+++ b/_darcs/pristine/actions/microsummary.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class MicrosummaryAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
diff --git a/_darcs/pristine/actions/newmessage.php b/_darcs/pristine/actions/newmessage.php
index eb582c2a5..0a537ad2d 100644
--- a/_darcs/pristine/actions/newmessage.php
+++ b/_darcs/pristine/actions/newmessage.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class NewmessageAction extends Action {
     
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if (!common_logged_in()) {
@@ -33,7 +34,8 @@ class NewmessageAction extends Action {
         }
     }
 
-    function save_new_message() {
+    function save_new_message()
+    {
         $user = common_current_user();
         assert($user); # XXX: maybe an error instead...
 
@@ -89,7 +91,8 @@ class NewmessageAction extends Action {
         common_redirect($url, 303);
     }
 
-    function show_top($params) {
+    function show_top($params)
+    {
 
         list($content, $user, $to) = $params;
         
@@ -98,7 +101,8 @@ class NewmessageAction extends Action {
         common_message_form($content, $user, $to);
     }
 
-    function show_form($msg=null) {
+    function show_form($msg=null)
+    {
         
         $content = $this->trimmed('content');
         $user = common_current_user();
@@ -128,7 +132,8 @@ class NewmessageAction extends Action {
         common_show_footer();
     }
     
-    function notify($from, $to, $message) {
+    function notify($from, $to, $message)
+    {
         mail_notify_message($message, $from, $to);
         # XXX: Jabber, SMS notifications... probably queued
     }
diff --git a/_darcs/pristine/actions/newnotice.php b/_darcs/pristine/actions/newnotice.php
index 98556c36b..1f6117c1e 100644
--- a/_darcs/pristine/actions/newnotice.php
+++ b/_darcs/pristine/actions/newnotice.php
@@ -23,7 +23,8 @@ require_once INSTALLDIR . '/lib/noticelist.php';
 
 class NewnoticeAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if (!common_logged_in()) {
@@ -43,7 +44,8 @@ class NewnoticeAction extends Action {
         }
     }
 
-    function save_new_notice() {
+    function save_new_notice()
+    {
 
         $user = common_current_user();
         assert($user); # XXX: maybe an error instead...
@@ -110,7 +112,8 @@ class NewnoticeAction extends Action {
         }
     }
 
-    function ajax_error_msg($msg) {
+    function ajax_error_msg($msg)
+    {
         common_start_html('text/xml;charset=utf-8', true);
         common_element_start('head');
         common_element('title', null, _('Ajax Error'));
@@ -121,11 +124,13 @@ class NewnoticeAction extends Action {
         common_element_end('html');
     }
 
-    function show_top($content=null) {
+    function show_top($content=null)
+    {
         common_notice_form(null, $content);
     }
 
-    function show_form($msg=null) {
+    function show_form($msg=null)
+    {
         if ($msg && $this->boolean('ajax')) {
             $this->ajax_error_msg($msg);
             return;
@@ -146,7 +151,8 @@ class NewnoticeAction extends Action {
         common_show_footer();
     }
 
-    function show_notice($notice) {
+    function show_notice($notice)
+    {
         $nli = new NoticeListItem($notice);
         $nli->show();
     }
diff --git a/_darcs/pristine/actions/noticesearch.php b/_darcs/pristine/actions/noticesearch.php
index 53d78e199..782c8fe98 100644
--- a/_darcs/pristine/actions/noticesearch.php
+++ b/_darcs/pristine/actions/noticesearch.php
@@ -25,15 +25,18 @@ require_once(INSTALLDIR.'/lib/searchaction.php');
 
 class NoticesearchAction extends SearchAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Search for notices on %%site.name%% by their contents. Separate search terms by spaces; they must be 3 characters or more.');
     }
 
-    function get_title() {
+    function get_title()
+    {
         return _('Text search');
     }
 
-    function show_results($q, $page) {
+    function show_results($q, $page)
+    {
 
         $notice = new Notice();
 
@@ -72,7 +75,8 @@ class NoticesearchAction extends SearchAction {
                           $page, 'noticesearch', array('q' => $q));
     }
 
-    function show_header($arr) {
+    function show_header($arr)
+    {
         if ($arr) {
             $q = $arr[0];
         }
@@ -87,7 +91,8 @@ class NoticesearchAction extends SearchAction {
 
     # XXX: refactor and combine with StreamAction::show_notice()
 
-    function show_notice($notice, $terms) {
+    function show_notice($notice, $terms)
+    {
         $profile = $notice->getProfile();
         if (!$profile) {
             common_log_db_error($notice, 'SELECT', __FILE__);
@@ -149,7 +154,8 @@ class NoticesearchAction extends SearchAction {
         common_element_end('li');
     }
 
-    function highlight($text, $terms) {
+    function highlight($text, $terms)
+    {
         /* Highligh serach terms */
         $pattern = '/('.implode('|',array_map('htmlspecialchars', $terms)).')/i';
         $result = preg_replace($pattern, '<strong>\\1</strong>', $text);
diff --git a/_darcs/pristine/actions/noticesearchrss.php b/_darcs/pristine/actions/noticesearchrss.php
index d61234df8..c41d34873 100644
--- a/_darcs/pristine/actions/noticesearchrss.php
+++ b/_darcs/pristine/actions/noticesearchrss.php
@@ -25,11 +25,13 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class NoticesearchrssAction extends Rss10Action {
 
-    function init() {
+    function init()
+    {
         return true;
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
 
         $q = $this->trimmed('q');
         $notices = array();
@@ -54,7 +56,8 @@ class NoticesearchrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         global $config;
         $q = $this->trimmed('q');
         $c = array('url' => common_local_url('noticesearchrss', array('q' => $q)),
@@ -64,7 +67,8 @@ class NoticesearchrssAction extends Rss10Action {
         return $c;
     }
 
-    function get_image() {
+    function get_image()
+    {
         return null;
     }
 }
diff --git a/_darcs/pristine/actions/nudge.php b/_darcs/pristine/actions/nudge.php
index 6f3b4c95c..e0268e9d0 100644
--- a/_darcs/pristine/actions/nudge.php
+++ b/_darcs/pristine/actions/nudge.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/mail.php');
 
 class NudgeAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if (!common_logged_in()) {
@@ -71,7 +72,8 @@ class NudgeAction extends Action {
         }
     }
 
-    function notify($user, $other) {
+    function notify($user, $other)
+    {
         if ($other->id != $user->id) {
             if ($other->email && $other->emailnotifynudge) {
                 mail_notify_nudge($user, $other);
diff --git a/_darcs/pristine/actions/openidlogin.php b/_darcs/pristine/actions/openidlogin.php
index 1bf37f28f..b8681215e 100644
--- a/_darcs/pristine/actions/openidlogin.php
+++ b/_darcs/pristine/actions/openidlogin.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class OpenidloginAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (common_logged_in()) {
             common_user_error(_('Already logged in.'));
@@ -56,11 +57,13 @@ class OpenidloginAction extends Action {
         }
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Login with an [OpenID](%%doc.openid%%) account.');
     }
 
-    function show_top($error=null) {
+    function show_top($error=null)
+    {
         if ($error) {
             common_element('div', array('class' => 'error'), $error);
         } else {
@@ -72,7 +75,8 @@ class OpenidloginAction extends Action {
         }
     }
 
-    function show_form($error=null, $openid_url) {
+    function show_form($error=null, $openid_url)
+    {
         common_show_header(_('OpenID Login'), null, $error, array($this, 'show_top'));
         $formaction = common_local_url('openidlogin');
         common_element_start('form', array('method' => 'post',
diff --git a/_darcs/pristine/actions/openidsettings.php b/_darcs/pristine/actions/openidsettings.php
index 9c0eda6f0..ce4143d41 100644
--- a/_darcs/pristine/actions/openidsettings.php
+++ b/_darcs/pristine/actions/openidsettings.php
@@ -24,13 +24,15 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class OpenidsettingsAction extends SettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('[OpenID](%%doc.openid%%) lets you log into many sites ' .
                   ' with the same user account. '.
                   ' Manage your associated OpenIDs from here.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
 
         $user = common_current_user();
 
@@ -116,7 +118,8 @@ class OpenidsettingsAction extends SettingsAction {
         common_show_footer();
     }
 
-    function handle_post() {
+    function handle_post()
+    {
         # CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
@@ -136,7 +139,8 @@ class OpenidsettingsAction extends SettingsAction {
         }
     }
 
-    function remove_openid() {
+    function remove_openid()
+    {
 
         $openid_url = $this->trimmed('openid_url');
         $oid = User_openid::staticGet('canonical', $openid_url);
diff --git a/_darcs/pristine/actions/opensearch.php b/_darcs/pristine/actions/opensearch.php
index dcde160a4..f9c6f4c57 100644
--- a/_darcs/pristine/actions/opensearch.php
+++ b/_darcs/pristine/actions/opensearch.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class OpensearchAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
diff --git a/_darcs/pristine/actions/othersettings.php b/_darcs/pristine/actions/othersettings.php
index 1da6577cb..0c1418387 100644
--- a/_darcs/pristine/actions/othersettings.php
+++ b/_darcs/pristine/actions/othersettings.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
 
 class OthersettingsAction extends SettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Manage various other options.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $user = common_current_user();
 
         $this->form_header(_('Other Settings'), $msg, $success);
@@ -63,7 +65,8 @@ class OthersettingsAction extends SettingsAction {
         common_show_footer();
     }
 
-    function show_feeds_list($feeds) {
+    function show_feeds_list($feeds)
+    {
         common_element_start('div', array('class' => 'feedsdel'));
         common_element('p', null, 'Feeds:');
         common_element_start('ul', array('class' => 'xoxo'));
@@ -76,7 +79,8 @@ class OthersettingsAction extends SettingsAction {
     }
 
     //TODO move to common.php (and retrace its origin)
-    function common_feed_item($feed) {
+    function common_feed_item($feed)
+    {
         $user = common_current_user();
         $nickname = $user->nickname;
 
@@ -131,7 +135,8 @@ class OthersettingsAction extends SettingsAction {
 //        common_element_end('form');
 //    }
 
-    function handle_post() {
+    function handle_post()
+    {
 
         # CSRF protection
         $token = $this->trimmed('token');
@@ -147,7 +152,8 @@ class OthersettingsAction extends SettingsAction {
         }
     }
 
-    function save_preferences() {
+    function save_preferences()
+    {
 
         $urlshorteningservice = $this->trimmed('urlshorteningservice');
 
diff --git a/_darcs/pristine/actions/peoplesearch.php b/_darcs/pristine/actions/peoplesearch.php
index a52ac317f..6d3f6a73f 100644
--- a/_darcs/pristine/actions/peoplesearch.php
+++ b/_darcs/pristine/actions/peoplesearch.php
@@ -24,16 +24,19 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
 
 class PeoplesearchAction extends SearchAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Search for people on %%site.name%% by their name, location, or interests. ' .
                   'Separate the terms by spaces; they must be 3 characters or more.');
     }
 
-    function get_title() {
+    function get_title()
+    {
         return _('People search');
     }
 
-    function show_results($q, $page) {
+    function show_results($q, $page)
+    {
 
         $profile = new Profile();
 
@@ -71,14 +74,16 @@ class PeopleSearchResults extends ProfileList {
     var $terms = null;
     var $pattern = null;
     
-    function __construct($profile, $terms) {
+    function __construct($profile, $terms)
+    {
         parent::__construct($profile);
         $this->terms = array_map('preg_quote', 
                                  array_map('htmlspecialchars', $terms));
         $this->pattern = '/('.implode('|',$terms).')/i';
     }
     
-    function highlight($text) {
+    function highlight($text)
+    {
         return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
     }
 }
diff --git a/_darcs/pristine/actions/peopletag.php b/_darcs/pristine/actions/peopletag.php
index 0327ecbc2..c7e463026 100644
--- a/_darcs/pristine/actions/peopletag.php
+++ b/_darcs/pristine/actions/peopletag.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
 
 class PeopletagAction extends Action {
     
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -50,7 +51,8 @@ class PeopletagAction extends Action {
         common_show_footer();
     }
 
-    function show_people($tag, $page) {
+    function show_people($tag, $page)
+    {
         
         $profile = new Profile();
 
@@ -83,7 +85,8 @@ class PeopletagAction extends Action {
                           array('tag' => $tag));
     }
     
-    function show_top($tag) {
+    function show_top($tag)
+    {
         $instr = sprintf(_('These are users who have tagged themselves "%s" ' .
                            'to show a common interest, characteristic, hobby or job.'), $tag);
         common_element_start('div', 'instructions');
@@ -93,11 +96,13 @@ class PeopletagAction extends Action {
         common_element_end('div');
     }
 
-    function get_title() {
+    function get_title()
+    {
         return null;
     }
 
-    function show_header($arr) {
+    function show_header($arr)
+    {
         return;
     }
 }
diff --git a/_darcs/pristine/actions/postnotice.php b/_darcs/pristine/actions/postnotice.php
index 66e4dc806..8b0781dfd 100644
--- a/_darcs/pristine/actions/postnotice.php
+++ b/_darcs/pristine/actions/postnotice.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/omb.php');
 
 class PostnoticeAction extends Action {
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         try {
             common_remove_magic_from_request();
@@ -39,7 +40,8 @@ class PostnoticeAction extends Action {
         }
     }
 
-    function save_notice(&$req, &$consumer, &$token) {
+    function save_notice(&$req, &$consumer, &$token)
+    {
         $version = $req->get_parameter('omb_version');
         if ($version != OMB_VERSION_01) {
             common_user_error(_('Unsupported OMB version'), 400);
diff --git a/_darcs/pristine/actions/profilesettings.php b/_darcs/pristine/actions/profilesettings.php
index 0fa1288dc..7f7ee17a5 100644
--- a/_darcs/pristine/actions/profilesettings.php
+++ b/_darcs/pristine/actions/profilesettings.php
@@ -23,12 +23,14 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
 
 class ProfilesettingsAction extends SettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('You can update your personal profile info here '.
                   'so people know more about you.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $this->form_header(_('Profile settings'), $msg, $success);
         $this->show_settings_form();
         common_element('h2', null, _('Avatar'));
@@ -40,7 +42,8 @@ class ProfilesettingsAction extends SettingsAction {
         common_show_footer();
     }
 
-    function handle_post() {
+    function handle_post()
+    {
 
         # CSRF protection
 
@@ -60,7 +63,8 @@ class ProfilesettingsAction extends SettingsAction {
 
     }
 
-    function show_settings_form() {
+    function show_settings_form()
+    {
 
         $user = common_current_user();
         $profile = $user->getProfile();
@@ -110,7 +114,8 @@ class ProfilesettingsAction extends SettingsAction {
 
     }
 
-    function show_avatar_form() {
+    function show_avatar_form()
+    {
 
         $user = common_current_user();
         $profile = $user->getProfile();
@@ -168,7 +173,8 @@ class ProfilesettingsAction extends SettingsAction {
 
     }
 
-    function show_password_form() {
+    function show_password_form()
+    {
 
         $user = common_current_user();
         common_element_start('form', array('method' => 'POST',
@@ -190,7 +196,8 @@ class ProfilesettingsAction extends SettingsAction {
         common_element_end('form');
     }
 
-    function save_profile() {
+    function save_profile()
+    {
         $nickname = $this->trimmed('nickname');
         $fullname = $this->trimmed('fullname');
         $homepage = $this->trimmed('homepage');
@@ -337,7 +344,8 @@ class ProfilesettingsAction extends SettingsAction {
     }
 
 
-    function upload_avatar() {
+    function upload_avatar()
+    {
         switch ($_FILES['avatarfile']['error']) {
          case UPLOAD_ERR_OK: # success, jump out
             break;
@@ -384,7 +392,8 @@ class ProfilesettingsAction extends SettingsAction {
         @unlink($_FILES['avatarfile']['tmp_name']);
     }
 
-    function nickname_exists($nickname) {
+    function nickname_exists($nickname)
+    {
         $user = common_current_user();
         $other = User::staticGet('nickname', $nickname);
         if (!$other) {
@@ -394,7 +403,8 @@ class ProfilesettingsAction extends SettingsAction {
         }
     }
 
-    function change_password() {
+    function change_password()
+    {
 
         $user = common_current_user();
         assert(!is_null($user)); # should already be checked
diff --git a/_darcs/pristine/actions/public.php b/_darcs/pristine/actions/public.php
index 60238e54d..62be3da99 100644
--- a/_darcs/pristine/actions/public.php
+++ b/_darcs/pristine/actions/public.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/stream.php');
 
 class PublicAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -41,7 +42,8 @@ class PublicAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_top() {
+    function show_top()
+    {
         if (common_logged_in()) {
             common_notice_form('public');
         } else {
@@ -64,13 +66,15 @@ class PublicAction extends StreamAction {
                                               'item' => 'publicatom')));
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
                  'based on the Free Software [Laconica](http://laconi.ca/) tool. ' .
                  '[Join now](%%action.register%%) to share notices about yourself with friends, family, and colleagues! ([Read more](%%doc.help%%))');
     }
 
-    function show_header() {
+    function show_header()
+    {
         common_element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('publicrss'),
                                      'type' => 'application/rss+xml',
@@ -80,7 +84,8 @@ class PublicAction extends StreamAction {
                                      'content' => common_local_url('publicxrds')));
     }
 
-    function show_notices($page) {
+    function show_notices($page)
+    {
 
         $cnt = 0;
         $notice = Notice::publicStream(($page-1)*NOTICES_PER_PAGE,
diff --git a/_darcs/pristine/actions/publicrss.php b/_darcs/pristine/actions/publicrss.php
index 764f0fae2..8e554122e 100644
--- a/_darcs/pristine/actions/publicrss.php
+++ b/_darcs/pristine/actions/publicrss.php
@@ -25,11 +25,13 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class PublicrssAction extends Rss10Action {
 
-    function init() {
+    function init()
+    {
         return true;
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
         
         $notices = array();
         
@@ -42,7 +44,8 @@ class PublicrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         global $config;
         $c = array('url' => common_local_url('publicrss'),
                    'title' => sprintf(_('%s Public Stream'), $config['site']['name']),
@@ -51,7 +54,8 @@ class PublicrssAction extends Rss10Action {
         return $c;
     }
 
-    function get_image() {
+    function get_image()
+    {
         return null;
     }
 }
\ No newline at end of file
diff --git a/_darcs/pristine/actions/publicxrds.php b/_darcs/pristine/actions/publicxrds.php
index 5e3349185..63c80d81e 100644
--- a/_darcs/pristine/actions/publicxrds.php
+++ b/_darcs/pristine/actions/publicxrds.php
@@ -25,11 +25,13 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class PublicxrdsAction extends Action {
 
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -55,7 +57,8 @@ class PublicxrdsAction extends Action {
         common_end_xml();
     }
 
-    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
+    function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
+    {
         common_element_start('Service');
         if ($uri) {
             common_element('URI', null, $uri);
diff --git a/_darcs/pristine/actions/recoverpassword.php b/_darcs/pristine/actions/recoverpassword.php
index 068d582fa..a482d4711 100644
--- a/_darcs/pristine/actions/recoverpassword.php
+++ b/_darcs/pristine/actions/recoverpassword.php
@@ -25,7 +25,8 @@ define(MAX_RECOVERY_TIME, 24 * 60 * 60);
 
 class RecoverpasswordAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (common_logged_in()) {
             $this->client_error(_('You are already logged in!'));
@@ -47,7 +48,8 @@ class RecoverpasswordAction extends Action {
         }
     }
 
-    function check_code() {
+    function check_code()
+    {
 
         $code = $this->trimmed('code');
         $confirm = Confirm_address::staticGet('code', $code);
@@ -113,12 +115,14 @@ class RecoverpasswordAction extends Action {
         $this->show_password_form();
     }
 
-    function set_temp_user(&$user) {
+    function set_temp_user(&$user)
+    {
         common_ensure_session();
         $_SESSION['tempuser'] = $user->id;
     }
 
-    function get_temp_user() {
+    function get_temp_user()
+    {
         common_ensure_session();
         $user_id = $_SESSION['tempuser'];
         if ($user_id) {
@@ -127,12 +131,14 @@ class RecoverpasswordAction extends Action {
         return $user;
     }
 
-    function clear_temp_user() {
+    function clear_temp_user()
+    {
         common_ensure_session();
         unset($_SESSION['tempuser']);
     }
 
-    function show_top($msg=null) {
+    function show_top($msg=null)
+    {
         if ($msg) {
             common_element('div', 'error', $msg);
         } else {
@@ -146,7 +152,8 @@ class RecoverpasswordAction extends Action {
         }
     }
 
-    function show_password_top($msg=null) {
+    function show_password_top($msg=null)
+    {
         if ($msg) {
             common_element('div', 'error', $msg);
         } else {
@@ -156,7 +163,8 @@ class RecoverpasswordAction extends Action {
         }
     }
 
-    function show_form($msg=null) {
+    function show_form($msg=null)
+    {
 
         common_show_header(_('Recover password'), null,
         $msg, array($this, 'show_top'));
@@ -173,7 +181,8 @@ class RecoverpasswordAction extends Action {
         common_show_footer();
     }
 
-    function show_password_form($msg=null) {
+    function show_password_form($msg=null)
+    {
 
         common_show_header(_('Reset password'), null,
         $msg, array($this, 'show_password_top'));
@@ -191,7 +200,8 @@ class RecoverpasswordAction extends Action {
         common_show_footer();
     }
 
-    function recover_password() {
+    function recover_password()
+    {
         $nore = $this->trimmed('nicknameoremail');
         if (!$nore) {
             $this->show_form(_('Enter a nickname or email address.'));
@@ -274,7 +284,8 @@ class RecoverpasswordAction extends Action {
         common_show_footer();
     }
 
-    function reset_password() {
+    function reset_password()
+    {
 
         # CSRF protection
         $token = $this->trimmed('token');
diff --git a/_darcs/pristine/actions/register.php b/_darcs/pristine/actions/register.php
index f3eaf6122..444e67e35 100644
--- a/_darcs/pristine/actions/register.php
+++ b/_darcs/pristine/actions/register.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class RegisterAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if (common_config('site', 'closed')) {
@@ -35,7 +36,8 @@ class RegisterAction extends Action {
         }
     }
 
-    function try_register() {
+    function try_register()
+    {
 
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
@@ -133,14 +135,16 @@ class RegisterAction extends Action {
 
     # checks if *CANONICAL* nickname exists
 
-    function nickname_exists($nickname) {
+    function nickname_exists($nickname)
+    {
         $user = User::staticGet('nickname', $nickname);
         return ($user !== false);
     }
 
     # checks if *CANONICAL* email exists
 
-    function email_exists($email) {
+    function email_exists($email)
+    {
         $email = common_canonical_email($email);
         if (!$email || strlen($email) == 0) {
             return false;
@@ -149,7 +153,8 @@ class RegisterAction extends Action {
         return ($user !== false);
     }
 
-    function show_top($error=null) {
+    function show_top($error=null)
+    {
         if ($error) {
             common_element('p', 'error', $error);
         } else {
@@ -164,7 +169,8 @@ class RegisterAction extends Action {
         }
     }
 
-    function show_form($error=null) {
+    function show_form($error=null)
+    {
         global $config;
 
         $code = $this->trimmed('code');
@@ -236,7 +242,8 @@ class RegisterAction extends Action {
         common_show_footer();
     }
 
-    function show_success() {
+    function show_success()
+    {
         $nickname = $this->arg('nickname');
         common_show_header(_('Registration successful'));
         common_element_start('div', 'success');
diff --git a/_darcs/pristine/actions/remotesubscribe.php b/_darcs/pristine/actions/remotesubscribe.php
index be2cb1025..02c026849 100644
--- a/_darcs/pristine/actions/remotesubscribe.php
+++ b/_darcs/pristine/actions/remotesubscribe.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/omb.php');
 
 class RemotesubscribeAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -47,7 +48,8 @@ class RemotesubscribeAction extends Action {
         }
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('To subscribe, you can [login](%%action.login%%),' .
                   ' or [register](%%action.register%%) a new ' .
                   ' account. If you already have an account ' .
@@ -55,7 +57,8 @@ class RemotesubscribeAction extends Action {
                   ' enter your profile URL below.');
     }
 
-    function show_top($err=null) {
+    function show_top($err=null)
+    {
         if ($err) {
             common_element('div', 'error', $err);
         } else {
@@ -67,7 +70,8 @@ class RemotesubscribeAction extends Action {
         }
     }
 
-    function show_form($err=null) {
+    function show_form($err=null)
+    {
         $nickname = $this->trimmed('nickname');
         $profile = $this->trimmed('profile_url');
         common_show_header(_('Remote subscribe'), null, $err,
@@ -86,7 +90,8 @@ class RemotesubscribeAction extends Action {
         common_show_footer();
     }
 
-    function remote_subscription() {
+    function remote_subscription()
+    {
         $user = $this->get_user();
 
         if (!$user) {
@@ -152,7 +157,8 @@ class RemotesubscribeAction extends Action {
         $this->request_authorization($user, $omb, $token, $secret);
     }
 
-    function get_user() {
+    function get_user()
+    {
         $user = null;
         $nickname = $this->trimmed('nickname');
         if ($nickname) {
@@ -161,7 +167,8 @@ class RemotesubscribeAction extends Action {
         return $user;
     }
 
-    function getOmb($xrds) {
+    function getOmb($xrds)
+    {
 
         static $omb_endpoints = array(OMB_ENDPOINT_UPDATEPROFILE, OMB_ENDPOINT_POSTNOTICE);
         static $oauth_endpoints = array(OAUTH_ENDPOINT_REQUEST, OAUTH_ENDPOINT_AUTHORIZE,
@@ -221,7 +228,8 @@ class RemotesubscribeAction extends Action {
         return $omb;
     }
 
-    function getXRD($main_service, $main_xrds) {
+    function getXRD($main_service, $main_xrds)
+    {
         $uri = omb_service_uri($main_service);
         if (strpos($uri, "#") !== 0) {
             # FIXME: more rigorous handling of external service definitions
@@ -242,7 +250,8 @@ class RemotesubscribeAction extends Action {
         return null;
     }
 
-    function addServices($xrd, $types, &$omb) {
+    function addServices($xrd, $types, &$omb)
+    {
         foreach ($types as $type) {
             $matches = omb_get_services($xrd, $type);
             if ($matches) {
@@ -255,7 +264,8 @@ class RemotesubscribeAction extends Action {
         return true;
     }
 
-    function request_token($omb) {
+    function request_token($omb)
+    {
         $con = omb_oauth_consumer();
 
         $url = omb_service_uri($omb[OAUTH_ENDPOINT_REQUEST]);
@@ -299,7 +309,8 @@ class RemotesubscribeAction extends Action {
         return array($return['oauth_token'], $return['oauth_token_secret']);
     }
 
-    function request_authorization($user, $omb, $token, $secret) {
+    function request_authorization($user, $omb, $token, $secret)
+    {
         global $config; # for license URL
 
         $con = omb_oauth_consumer();
@@ -380,7 +391,8 @@ class RemotesubscribeAction extends Action {
         return;
     }
 
-    function make_nonce() {
+    function make_nonce()
+    {
         return common_good_rand(16);
     }
 }
diff --git a/_darcs/pristine/actions/replies.php b/_darcs/pristine/actions/replies.php
index be80fae79..da2f27f31 100644
--- a/_darcs/pristine/actions/replies.php
+++ b/_darcs/pristine/actions/replies.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/actions/showstream.php');
 
 class RepliesAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -53,11 +54,13 @@ class RepliesAction extends StreamAction {
         common_show_footer();
     }
 
-    function no_such_user() {
+    function no_such_user()
+    {
         common_user_error(_('No such user.'));
     }
 
-    function show_header($user) {
+    function show_header($user)
+    {
         common_element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('repliesrss', array('nickname' =>
                                                                                     $user->nickname)),
@@ -65,7 +68,8 @@ class RepliesAction extends StreamAction {
                                      'title' => sprintf(_('Feed for replies to %s'), $user->nickname)));
     }
 
-    function show_top($user) {
+    function show_top($user)
+    {
         $cur = common_current_user();
 
         if ($cur && $cur->id == $user->id) {
@@ -80,7 +84,8 @@ class RepliesAction extends StreamAction {
                                               'item' => 'repliesrss')));
     }
 
-    function show_replies($user) {
+    function show_replies($user)
+    {
 
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
diff --git a/_darcs/pristine/actions/repliesrss.php b/_darcs/pristine/actions/repliesrss.php
index 9652ae9ea..19ab0866a 100644
--- a/_darcs/pristine/actions/repliesrss.php
+++ b/_darcs/pristine/actions/repliesrss.php
@@ -27,7 +27,8 @@ class RepliesrssAction extends Rss10Action {
 
     var $user = null;
 
-    function init() {
+    function init()
+    {
         $nickname = $this->trimmed('nickname');
         $this->user = User::staticGet('nickname', $nickname);
 
@@ -39,7 +40,8 @@ class RepliesrssAction extends Rss10Action {
         }
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
 
         $user = $this->user;
 
@@ -54,7 +56,8 @@ class RepliesrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         $user = $this->user;
         $c = array('url' => common_local_url('repliesrss',
                                              array('nickname' =>
@@ -67,7 +70,8 @@ class RepliesrssAction extends Rss10Action {
         return $c;
     }
 
-    function get_image() {
+    function get_image()
+    {
         $user = $this->user;
         $profile = $user->getProfile();
         if (!$profile) {
diff --git a/_darcs/pristine/actions/requesttoken.php b/_darcs/pristine/actions/requesttoken.php
index 4950d93c0..091846756 100644
--- a/_darcs/pristine/actions/requesttoken.php
+++ b/_darcs/pristine/actions/requesttoken.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/omb.php');
 
 class RequesttokenAction extends Action {
     
-    function is_readonly() {
+    function is_readonly()
+    {
         return false;
     }
     
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         try {
             common_remove_magic_from_request();
diff --git a/_darcs/pristine/actions/showfavorites.php b/_darcs/pristine/actions/showfavorites.php
index 2fd1e586d..8131cac67 100644
--- a/_darcs/pristine/actions/showfavorites.php
+++ b/_darcs/pristine/actions/showfavorites.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/actions/showstream.php');
 
 class ShowfavoritesAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -53,7 +54,8 @@ class ShowfavoritesAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_header($user) {
+    function show_header($user)
+    {
         common_element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('favoritesrss', array('nickname' =>
                                                                                       $user->nickname)),
@@ -61,7 +63,8 @@ class ShowfavoritesAction extends StreamAction {
                                      'title' => sprintf(_('Feed for favorites of %s'), $user->nickname)));
     }
 
-    function show_top($user) {
+    function show_top($user)
+    {
         $cur = common_current_user();
 
         if ($cur && $cur->id == $user->id) {
@@ -75,7 +78,8 @@ class ShowfavoritesAction extends StreamAction {
         $this->views_menu();
     }
 
-    function show_notices($user) {
+    function show_notices($user)
+    {
 
         $page = $this->trimmed('page');
         if (!$page) {
diff --git a/_darcs/pristine/actions/showmessage.php b/_darcs/pristine/actions/showmessage.php
index a5e03c72d..b706fe2fa 100644
--- a/_darcs/pristine/actions/showmessage.php
+++ b/_darcs/pristine/actions/showmessage.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/mailbox.php');
 
 class ShowmessageAction extends MailboxAction {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         Action::handle($args);
 
@@ -44,13 +45,15 @@ class ShowmessageAction extends MailboxAction {
         }
     }
     
-    function get_message() {
+    function get_message()
+    {
         $id = $this->trimmed('message');
         $message = Message::staticGet('id', $id);
         return $message;
     }
     
-    function get_title($user, $page) {
+    function get_title($user, $page)
+    {
         $message = $this->get_message();
         if (!$message) {
             return null;
@@ -70,14 +73,16 @@ class ShowmessageAction extends MailboxAction {
         return $title;
     }
 
-    function get_messages($user, $page) {
+    function get_messages($user, $page)
+    {
         $message = new Message();
         $message->id = $this->trimmed('message');
         $message->find();
         return $message;
     }
     
-    function get_message_profile($message) {
+    function get_message_profile($message)
+    {
         $user = common_current_user();
         if ($user->id == $message->from_profile) {
             return $message->getTo();
@@ -89,11 +94,13 @@ class ShowmessageAction extends MailboxAction {
         }
     }
     
-    function get_instructions() {
+    function get_instructions()
+    {
         return '';
     }
     
-    function views_menu() {
+    function views_menu()
+    {
         return;
     }
 }
diff --git a/_darcs/pristine/actions/shownotice.php b/_darcs/pristine/actions/shownotice.php
index 04af61a6f..abdaa72ca 100644
--- a/_darcs/pristine/actions/shownotice.php
+++ b/_darcs/pristine/actions/shownotice.php
@@ -27,7 +27,8 @@ class ShownoticeAction extends StreamAction {
     var $profile = null;
     var $avatar = null;
 
-    function prepare($args) {
+    function prepare($args)
+    {
 
         parent::prepare($args);
 
@@ -51,13 +52,15 @@ class ShownoticeAction extends StreamAction {
         return true;
     }
 
-    function last_modified() {
+    function last_modified()
+    {
         return max(strtotime($this->notice->created),
                    strtotime($this->profile->modified),
                    ($this->avatar) ? strtotime($this->avatar->modified) : 0);
     }
 
-    function etag() {
+    function etag()
+    {
         return 'W/"' . implode(':', array($this->arg('action'),
                                           common_language(),
                                           $this->notice->id,
@@ -66,7 +69,8 @@ class ShownoticeAction extends StreamAction {
                                           ($this->avatar) ? strtotime($this->avatar->modified) : 0)) . '"';
     }
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -84,7 +88,8 @@ class ShownoticeAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_header() {
+    function show_header()
+    {
 
         $user = User::staticGet($this->profile->id);
 
@@ -103,14 +108,16 @@ class ShownoticeAction extends StreamAction {
         }
     }
 
-    function show_top() {
+    function show_top()
+    {
         $cur = common_current_user();
         if ($cur && $cur->id == $this->profile->id) {
             common_notice_form();
         }
     }
 
-    function no_such_notice() {
+    function no_such_notice()
+    {
         common_user_error(_('No such notice.'));
     }
 }
diff --git a/_darcs/pristine/actions/showstream.php b/_darcs/pristine/actions/showstream.php
index 485c2e3d1..c31bce87a 100644
--- a/_darcs/pristine/actions/showstream.php
+++ b/_darcs/pristine/actions/showstream.php
@@ -26,7 +26,8 @@ define('SUBSCRIPTIONS', 80);
 
 class ShowstreamAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -76,7 +77,8 @@ class ShowstreamAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_top($user) {
+    function show_top($user)
+    {
         $cur = common_current_user();
 
         if ($cur && $cur->id == $user->id) {
@@ -100,7 +102,8 @@ class ShowstreamAction extends StreamAction {
                                               'item' => 'foaf')));
     }
 
-    function show_header($user) {
+    function show_header($user)
+    {
         # Feeds
         common_element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('api',
@@ -153,11 +156,13 @@ class ShowstreamAction extends StreamAction {
                                                                 array('nickname' => $profile->nickname))));
     }
 
-    function no_such_user() {
+    function no_such_user()
+    {
         $this->client_error(_('No such user.'), 404);
     }
 
-    function show_profile($profile) {
+    function show_profile($profile)
+    {
 
         common_element_start('div', array('id' => 'profile', 'class' => 'vcard'));
 
@@ -172,7 +177,8 @@ class ShowstreamAction extends StreamAction {
         common_element_end('div');
     }
 
-    function show_personal($profile) {
+    function show_personal($profile)
+    {
 
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
         common_element_start('div', array('id' => 'profile_avatar'));
@@ -246,7 +252,8 @@ class ShowstreamAction extends StreamAction {
         common_element_end('div');
     }
 
-    function show_remote_subscribe_link($profile) {
+    function show_remote_subscribe_link($profile)
+    {
         $url = common_local_url('remotesubscribe',
                                 array('nickname' => $profile->nickname));
         common_element('a', array('href' => $url,
@@ -254,7 +261,8 @@ class ShowstreamAction extends StreamAction {
                        _('Subscribe'));
     }
 
-    function show_unsubscribe_form($profile) {
+    function show_unsubscribe_form($profile)
+    {
         common_element_start('form', array('id' => 'unsubscribe', 'method' => 'post',
                                            'action' => common_local_url('unsubscribe')));
         common_hidden('token', common_session_token());
@@ -268,7 +276,8 @@ class ShowstreamAction extends StreamAction {
         common_element_end('form');
     }
 
-    function show_subscriptions($profile) {
+    function show_subscriptions($profile)
+    {
         global $config;
 
         $subs = DB_DataObject::factory('subscription');
@@ -340,7 +349,8 @@ class ShowstreamAction extends StreamAction {
         common_element_end('div');
     }
 
-    function show_statistics($profile) {
+    function show_statistics($profile)
+    {
 
         // XXX: WORM cache this
         $subs = DB_DataObject::factory('subscription');
@@ -400,7 +410,8 @@ class ShowstreamAction extends StreamAction {
         common_element_end('div');
     }
 
-    function show_notices($user) {
+    function show_notices($user)
+    {
 
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
@@ -413,7 +424,8 @@ class ShowstreamAction extends StreamAction {
                           'showstream', array('nickname' => $user->nickname));
     }
 
-    function show_last_notice($profile) {
+    function show_last_notice($profile)
+    {
 
         common_element('h2', null, _('Currently'));
 
@@ -438,13 +450,15 @@ class ShowstreamAction extends StreamAction {
 # We don't show the author for a profile, since we already know who it is!
 
 class ProfileNoticeList extends NoticeList {
-    function newListItem($notice) {
+    function newListItem($notice)
+    {
         return new ProfileNoticeListItem($notice);
     }
 }
 
 class ProfileNoticeListItem extends NoticeListItem {
-    function showAuthor() {
+    function showAuthor()
+    {
         return;
     }
 }
diff --git a/_darcs/pristine/actions/smssettings.php b/_darcs/pristine/actions/smssettings.php
index 71ab39514..470a042ed 100644
--- a/_darcs/pristine/actions/smssettings.php
+++ b/_darcs/pristine/actions/smssettings.php
@@ -24,11 +24,13 @@ require_once(INSTALLDIR.'/actions/emailsettings.php');
 
 class SmssettingsAction extends EmailsettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('You can receive SMS messages through email from %%site.name%%.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $user = common_current_user();
         $this->form_header(_('SMS Settings'), $msg, $success);
         common_element_start('form', array('method' => 'post',
@@ -103,7 +105,8 @@ class SmssettingsAction extends EmailsettingsAction {
         common_show_footer();
     }
 
-    function get_confirmation() {
+    function get_confirmation()
+    {
         $user = common_current_user();
         $confirm = new Confirm_address();
         $confirm->user_id = $user->id;
@@ -115,7 +118,8 @@ class SmssettingsAction extends EmailsettingsAction {
         }
     }
 
-    function handle_post() {
+    function handle_post()
+    {
 
         # CSRF protection
 
@@ -144,7 +148,8 @@ class SmssettingsAction extends EmailsettingsAction {
         }
     }
 
-    function save_preferences() {
+    function save_preferences()
+    {
 
         $smsnotify = $this->boolean('smsnotify');
         
@@ -171,7 +176,8 @@ class SmssettingsAction extends EmailsettingsAction {
         $this->show_form(_('Preferences saved.'), true);
     }
 
-    function add_address() {
+    function add_address()
+    {
 
         $user = common_current_user();
 
@@ -226,7 +232,8 @@ class SmssettingsAction extends EmailsettingsAction {
         $this->show_form($msg, TRUE);
     }
 
-    function cancel_confirmation() {
+    function cancel_confirmation()
+    {
         
         $sms = $this->trimmed('sms');
         $carrier = $this->trimmed('carrier');
@@ -253,7 +260,8 @@ class SmssettingsAction extends EmailsettingsAction {
         $this->show_form(_('Confirmation cancelled.'), TRUE);
     }
 
-    function remove_address() {
+    function remove_address()
+    {
 
         $user = common_current_user();
         $sms = $this->arg('sms');
@@ -282,7 +290,8 @@ class SmssettingsAction extends EmailsettingsAction {
         $this->show_form(_('The address was removed.'), TRUE);
     }
     
-    function sms_exists($sms) {
+    function sms_exists($sms)
+    {
         $user = common_current_user();
         $other = User::staticGet('sms', $sms);
         if (!$other) {
@@ -292,7 +301,8 @@ class SmssettingsAction extends EmailsettingsAction {
         }
     }
 
-    function carrier_select() {
+    function carrier_select()
+    {
         $carrier = new Sms_carrier();
         $cnt = $carrier->find();
 
@@ -316,7 +326,8 @@ class SmssettingsAction extends EmailsettingsAction {
                                common_config('site', 'email')));
     }
 
-    function confirm_code() {
+    function confirm_code()
+    {
         
         $code = $this->trimmed('code');
         
diff --git a/_darcs/pristine/actions/subedit.php b/_darcs/pristine/actions/subedit.php
index db935eb28..874102857 100644
--- a/_darcs/pristine/actions/subedit.php
+++ b/_darcs/pristine/actions/subedit.php
@@ -23,7 +23,8 @@ class SubeditAction extends Action {
 
     var $profile = null;
 
-    function prepare($args) {
+    function prepare($args)
+    {
 
         parent::prepare($args);
 
@@ -56,7 +57,8 @@ class SubeditAction extends Action {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $cur = common_current_user();
diff --git a/_darcs/pristine/actions/subscribe.php b/_darcs/pristine/actions/subscribe.php
index c94c4d7eb..93884f081 100644
--- a/_darcs/pristine/actions/subscribe.php
+++ b/_darcs/pristine/actions/subscribe.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class SubscribeAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if (!common_logged_in()) {
diff --git a/_darcs/pristine/actions/subscribers.php b/_darcs/pristine/actions/subscribers.php
index b9ca92af3..8c7805f51 100644
--- a/_darcs/pristine/actions/subscribers.php
+++ b/_darcs/pristine/actions/subscribers.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/gallery.php');
 
 class SubscribersAction extends GalleryAction {
 
-    function gallery_type() {
+    function gallery_type()
+    {
         return _('Subscribers');
     }
 
-    function get_instructions(&$profile) {
+    function get_instructions(&$profile)
+    {
         $user =& common_current_user();
         if ($user && ($user->id == $profile->id)) {
             return _('These are the people who listen to your notices.');
@@ -36,25 +38,30 @@ class SubscribersAction extends GalleryAction {
         }
     }
 
-    function fields() {
+    function fields()
+    {
         return array('subscriber', 'subscribed');
     }
 
-    function div_class() {
+    function div_class()
+    {
         return 'subscribers';
     }
 
-    function get_other(&$subs) {
+    function get_other(&$subs)
+    {
         return $subs->subscriber;
     }
 
-    function profile_list_class() {
+    function profile_list_class()
+    {
         return 'SubscribersList';
     }
 }
 
 class SubscribersList extends ProfileList {
-    function show_owner_controls($profile) {
+    function show_owner_controls($profile)
+    {
         common_block_form($profile, array('action' => 'subscribers',
                                           'nickname' => $this->owner->nickname));
     }
diff --git a/_darcs/pristine/actions/subscriptions.php b/_darcs/pristine/actions/subscriptions.php
index c24f23a07..ad4a3f9e5 100644
--- a/_darcs/pristine/actions/subscriptions.php
+++ b/_darcs/pristine/actions/subscriptions.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/gallery.php');
 
 class SubscriptionsAction extends GalleryAction {
 
-    function gallery_type() {
+    function gallery_type()
+    {
         return _('Subscriptions');
     }
 
-    function get_instructions(&$profile) {
+    function get_instructions(&$profile)
+    {
         $user =& common_current_user();
         if ($user && ($user->id == $profile->id)) {
             return _('These are the people whose notices you listen to.');
@@ -36,26 +38,31 @@ class SubscriptionsAction extends GalleryAction {
         }
     }
 
-    function fields() {
+    function fields()
+    {
         return array('subscribed', 'subscriber');
     }
 
-    function div_class() {
+    function div_class()
+    {
         return 'subscriptions';
     }
 
-    function get_other(&$subs) {
+    function get_other(&$subs)
+    {
         return $subs->subscribed;
     }
 
-    function profile_list_class() {
+    function profile_list_class()
+    {
         return 'SubscriptionsList';
     }
 }
 
 class SubscriptionsList extends ProfileList {
 
-    function show_owner_controls($profile) {
+    function show_owner_controls($profile)
+    {
 
         $sub = Subscription::pkeyGet(array('subscriber' => $this->owner->id,
                                            'subscribed' => $profile->id));
diff --git a/_darcs/pristine/actions/sup.php b/_darcs/pristine/actions/sup.php
index 3c9cbea2c..2a139b322 100644
--- a/_darcs/pristine/actions/sup.php
+++ b/_darcs/pristine/actions/sup.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class SupAction extends Action {
     
-    function handle($args) {
+    function handle($args)
+    {
         
         parent::handle($args);
         
@@ -42,7 +43,8 @@ class SupAction extends Action {
                                 'updates' => $updates));
     }
     
-    function available_periods() {
+    function available_periods()
+    {
         static $periods = array(86400, 43200, 21600, 7200,
                                 3600, 1800,    600, 300, 120,
                                 60, 30, 15); 
@@ -55,7 +57,8 @@ class SupAction extends Action {
         return $available;
     }
     
-    function get_updates($seconds) {
+    function get_updates($seconds)
+    {
         $notice = new Notice();
 
         # XXX: cache this. Depends on how big this protocol becomes;
@@ -75,7 +78,8 @@ class SupAction extends Action {
         return $updates;
     }
     
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
 }
diff --git a/_darcs/pristine/actions/tag.php b/_darcs/pristine/actions/tag.php
index 1325b85a5..d7b35d613 100644
--- a/_darcs/pristine/actions/tag.php
+++ b/_darcs/pristine/actions/tag.php
@@ -24,7 +24,8 @@ define('TAGS_PER_PAGE', 100);
 
 class TagAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -46,7 +47,8 @@ class TagAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_header($tag = false) {
+    function show_header($tag = false)
+    {
         if ($tag) {
             common_element('link', array('rel' => 'alternate',
                                          'href' => common_local_url('tagrss', array('tag' => $tag)),
@@ -55,11 +57,13 @@ class TagAction extends StreamAction {
         }
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Showing most popular tags from the last week');
     }
 
-    function show_top($tag = false) {
+    function show_top($tag = false)
+    {
         if (!$tag) {
             $instr = $this->get_instructions();
             $output = common_markup_to_html($instr);
@@ -124,7 +128,8 @@ class TagAction extends StreamAction {
         }
     }
 
-    function show_tag($tag, $weight, $relative) {
+    function show_tag($tag, $weight, $relative)
+    {
 
         # XXX: these should probably tune to the size of the site
         if ($relative > 0.1) {
@@ -149,7 +154,8 @@ class TagAction extends StreamAction {
         common_text(' ');
     }
 
-    function show_notices($tag) {
+    function show_notices($tag)
+    {
 
         $cnt = 0;
 
diff --git a/_darcs/pristine/actions/tagother.php b/_darcs/pristine/actions/tagother.php
index 4691fef07..ed17ac531 100644
--- a/_darcs/pristine/actions/tagother.php
+++ b/_darcs/pristine/actions/tagother.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
 
 class TagotherAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -49,7 +50,8 @@ class TagotherAction extends Action {
         }
     }
 
-    function show_form($profile, $error=null) {
+    function show_form($profile, $error=null)
+    {
 
         $user = common_current_user();
 
@@ -103,7 +105,8 @@ class TagotherAction extends Action {
 
     }
 
-    function save_tags() {
+    function save_tags()
+    {
 
         $id = $this->trimmed('id');
         $tagstring = $this->trimmed('tags');
@@ -178,7 +181,8 @@ class TagotherAction extends Action {
         }
     }
 
-    function show_top($arr = null) {
+    function show_top($arr = null)
+    {
         list($profile, $error) = $arr;
         if ($error) {
             common_element('p', 'error', $error);
diff --git a/_darcs/pristine/actions/tagrss.php b/_darcs/pristine/actions/tagrss.php
index 6199a285d..bb4edf473 100644
--- a/_darcs/pristine/actions/tagrss.php
+++ b/_darcs/pristine/actions/tagrss.php
@@ -25,7 +25,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class TagrssAction extends Rss10Action {
 
-    function init() {
+    function init()
+    {
         $tag = $this->trimmed('tag');
         $this->tag = Notice_tag::staticGet('tag', $tag);
 
@@ -37,7 +38,8 @@ class TagrssAction extends Rss10Action {
         }
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
         $tag = $this->tag;
 
         if (is_null($tag)) {
@@ -53,7 +55,8 @@ class TagrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         $tag = $this->tag->tag;
 
         $c = array('url' => common_local_url('tagrss', array('tag' => $tagname)),
diff --git a/_darcs/pristine/actions/twitapiaccount.php b/_darcs/pristine/actions/twitapiaccount.php
index b1caa3481..d5e9143c2 100644
--- a/_darcs/pristine/actions/twitapiaccount.php
+++ b/_darcs/pristine/actions/twitapiaccount.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapiaccountAction extends TwitterapiAction {
 
-    function verify_credentials($args, $apidata) {
+    function verify_credentials($args, $apidata)
+    {
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
@@ -34,12 +35,14 @@ class TwitapiaccountAction extends TwitterapiAction {
         $this->show_extended_profile($apidata['user'], $apidata);
     }
 
-    function end_session($args, $apidata) {
+    function end_session($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
 
-    function update_location($args, $apidata) {
+    function update_location($args, $apidata)
+    {
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
@@ -84,12 +87,14 @@ class TwitapiaccountAction extends TwitterapiAction {
     }
 
 
-    function update_delivery_device($args, $apidata) {
+    function update_delivery_device($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
 
-    function rate_limit_status($args, $apidata) {
+    function rate_limit_status($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
diff --git a/_darcs/pristine/actions/twitapiblocks.php b/_darcs/pristine/actions/twitapiblocks.php
index 16b2e76bc..2170141f1 100644
--- a/_darcs/pristine/actions/twitapiblocks.php
+++ b/_darcs/pristine/actions/twitapiblocks.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapiblocksAction extends TwitterapiAction {
 
-    function create($args, $apidata) {
+    function create($args, $apidata)
+    {
 
         parent::handle($args);
 
@@ -46,7 +47,8 @@ class TwitapiblocksAction extends TwitterapiAction {
         }
     }
 
-    function destroy($args, $apidata) {
+    function destroy($args, $apidata)
+    {
         parent::handle($args);
         $blockee = $this->get_user($apidata['api_arg'], $apidata);
 
diff --git a/_darcs/pristine/actions/twitapidirect_messages.php b/_darcs/pristine/actions/twitapidirect_messages.php
index 7adb4eadd..e9f7aa0bf 100644
--- a/_darcs/pristine/actions/twitapidirect_messages.php
+++ b/_darcs/pristine/actions/twitapidirect_messages.php
@@ -23,17 +23,20 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class Twitapidirect_messagesAction extends TwitterapiAction {
 
-    function direct_messages($args, $apidata) {
+    function direct_messages($args, $apidata)
+    {
         parent::handle($args);
         return $this->show_messages($args, $apidata, 'received');
     }
 
-    function sent($args, $apidata) {
+    function sent($args, $apidata)
+    {
         parent::handle($args);
         return $this->show_messages($args, $apidata, 'sent');
     }
 
-    function show_messages($args, $apidata, $type) {
+    function show_messages($args, $apidata, $type)
+    {
 
         $user = $apidata['user'];
 
@@ -110,7 +113,8 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
     }
 
     // had to change this from "new" to "create" to avoid PHP reserved word
-    function create($args, $apidata) {
+    function create($args, $apidata)
+    {
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
@@ -173,12 +177,14 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
 
     }
 
-    function destroy($args, $apidata) {
+    function destroy($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
 
-    function show_xml_dmsgs($message) {
+    function show_xml_dmsgs($message)
+    {
 
         $this->init_document('xml');
         common_element_start('direct-messages', array('type' => 'array'));
@@ -200,7 +206,8 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
 
     }
 
-    function show_json_dmsgs($message) {
+    function show_json_dmsgs($message)
+    {
 
         $this->init_document('json');
 
@@ -223,7 +230,8 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
 
     }
 
-    function show_rss_dmsgs($message, $title, $link, $subtitle) {
+    function show_rss_dmsgs($message, $title, $link, $subtitle)
+    {
 
         $this->init_document('rss');
 
@@ -252,7 +260,8 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
 
     }
 
-    function show_atom_dmsgs($message, $title, $link, $subtitle) {
+    function show_atom_dmsgs($message, $title, $link, $subtitle)
+    {
 
         $this->init_document('atom');
 
@@ -279,7 +288,8 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
     }
 
     // swiped from MessageAction. Should it be place in util.php?
-    function notify($from, $to, $message) {
+    function notify($from, $to, $message)
+    {
         mail_notify_message($message, $from, $to);
         # XXX: Jabber, SMS notifications... probably queued
     }
diff --git a/_darcs/pristine/actions/twitapifavorites.php b/_darcs/pristine/actions/twitapifavorites.php
index ad8c5f18b..e7a43f770 100644
--- a/_darcs/pristine/actions/twitapifavorites.php
+++ b/_darcs/pristine/actions/twitapifavorites.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapifavoritesAction extends TwitterapiAction {
 
-    function favorites($args, $apidata) {
+    function favorites($args, $apidata)
+    {
         parent::handle($args);
 
         $this->auth_user = $apidata['user'];
@@ -85,7 +86,8 @@ class TwitapifavoritesAction extends TwitterapiAction {
 
     }
 
-    function create($args, $apidata) {
+    function create($args, $apidata)
+    {
         parent::handle($args);
 
         // Check for RESTfulness
@@ -134,14 +136,16 @@ class TwitapifavoritesAction extends TwitterapiAction {
 
     }
 
-    function destroy($args, $apidata) {
+    function destroy($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
 
     // XXX: these two funcs swiped from faves.  Maybe put in util.php, or some common base class?
 
-    function notify($fave, $notice, $user) {
+    function notify($fave, $notice, $user)
+    {
         $other = User::staticGet('id', $notice->profile_id);
         if ($other && $other->id != $user->id) {
             if ($other->email && $other->emailnotifyfav) {
@@ -152,7 +156,8 @@ class TwitapifavoritesAction extends TwitterapiAction {
         }
     }
 
-    function notify_mail($other, $user, $notice) {
+    function notify_mail($other, $user, $notice)
+    {
         $profile = $user->getProfile();
         $bestname = $profile->getBestName();
         $subject = sprintf(_('%s added your notice as a favorite'), $bestname);
diff --git a/_darcs/pristine/actions/twitapifriendships.php b/_darcs/pristine/actions/twitapifriendships.php
index a52f0fe4d..a59cb543c 100644
--- a/_darcs/pristine/actions/twitapifriendships.php
+++ b/_darcs/pristine/actions/twitapifriendships.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapifriendshipsAction extends TwitterapiAction {
 
-    function create($args, $apidata) {
+    function create($args, $apidata)
+    {
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
@@ -75,7 +76,8 @@ class TwitapifriendshipsAction extends TwitterapiAction {
 
     }
 
-    function destroy($args, $apidata) {
+    function destroy($args, $apidata)
+    {
         parent::handle($args);
 
         if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
@@ -110,7 +112,8 @@ class TwitapifriendshipsAction extends TwitterapiAction {
 
     }
 
-    function exists($args, $apidata) {
+    function exists($args, $apidata)
+    {
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
diff --git a/_darcs/pristine/actions/twitapihelp.php b/_darcs/pristine/actions/twitapihelp.php
index f0e9adfdb..27262f089 100644
--- a/_darcs/pristine/actions/twitapihelp.php
+++ b/_darcs/pristine/actions/twitapihelp.php
@@ -27,7 +27,8 @@ class TwitapihelpAction extends TwitterapiAction {
      * URL:http://identi.ca/api/help/test.format
      * Formats: xml, json
      */
-    function test($args, $apidata) {
+    function test($args, $apidata)
+    {
         parent::handle($args);
 
         if ($apidata['content-type'] == 'xml') {
@@ -44,7 +45,8 @@ class TwitapihelpAction extends TwitterapiAction {
 
     }
 
-    function downtime_schedule($args, $apidata) {
+    function downtime_schedule($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
diff --git a/_darcs/pristine/actions/twitapinotifications.php b/_darcs/pristine/actions/twitapinotifications.php
index 26f66d7e5..e24d3829c 100644
--- a/_darcs/pristine/actions/twitapinotifications.php
+++ b/_darcs/pristine/actions/twitapinotifications.php
@@ -24,12 +24,14 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 # This naming convention looks real sick
 class TwitapinotificationsAction extends TwitterapiAction {
 
-    function follow($args, $apidata) {
+    function follow($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
 
-    function leave($args, $apidata) {
+    function leave($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
diff --git a/_darcs/pristine/actions/twitapistatuses.php b/_darcs/pristine/actions/twitapistatuses.php
index ffa94b309..f280184c0 100644
--- a/_darcs/pristine/actions/twitapistatuses.php
+++ b/_darcs/pristine/actions/twitapistatuses.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapistatusesAction extends TwitterapiAction {
 
-    function public_timeline($args, $apidata) {
+    function public_timeline($args, $apidata)
+    {
         parent::handle($args);
 
         $sitename = common_config('site', 'name');
@@ -84,7 +85,8 @@ class TwitapistatusesAction extends TwitterapiAction {
 
     }
 
-    function friends_timeline($args, $apidata) {
+    function friends_timeline($args, $apidata)
+    {
         parent::handle($args);
 
         $since = $this->arg('since');
@@ -146,7 +148,8 @@ class TwitapistatusesAction extends TwitterapiAction {
 
     }
 
-    function user_timeline($args, $apidata) {
+    function user_timeline($args, $apidata)
+    {
         parent::handle($args);
 
         $this->auth_user = $apidata['user'];
@@ -226,7 +229,8 @@ class TwitapistatusesAction extends TwitterapiAction {
 
     }
 
-    function update($args, $apidata) {
+    function update($args, $apidata)
+    {
 
         parent::handle($args);
 
@@ -321,7 +325,8 @@ class TwitapistatusesAction extends TwitterapiAction {
         $this->show($args, $apidata);
     }
 
-    function replies($args, $apidata) {
+    function replies($args, $apidata)
+    {
 
         parent::handle($args);
 
@@ -388,7 +393,8 @@ class TwitapistatusesAction extends TwitterapiAction {
 
     }
 
-    function show($args, $apidata) {
+    function show($args, $apidata)
+    {
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
@@ -413,7 +419,8 @@ class TwitapistatusesAction extends TwitterapiAction {
 
     }
 
-    function destroy($args, $apidata) {
+    function destroy($args, $apidata)
+    {
 
         parent::handle($args);
 
@@ -457,18 +464,21 @@ class TwitapistatusesAction extends TwitterapiAction {
 
     }
 
-    function friends($args, $apidata) {
+    function friends($args, $apidata)
+    {
         parent::handle($args);
         return $this->subscriptions($apidata, 'subscribed', 'subscriber');
     }
 
-    function followers($args, $apidata) {
+    function followers($args, $apidata)
+    {
         parent::handle($args);
 
         return $this->subscriptions($apidata, 'subscriber', 'subscribed');
     }
 
-    function subscriptions($apidata, $other_attr, $user_attr) {
+    function subscriptions($apidata, $other_attr, $user_attr)
+    {
 
         # XXX: lite
 
@@ -523,7 +533,8 @@ class TwitapistatusesAction extends TwitterapiAction {
         $this->end_document($type);
     }
 
-    function show_profiles($profiles, $type) {
+    function show_profiles($profiles, $type)
+    {
         switch ($type) {
          case 'xml':
             common_element_start('users', array('type' => 'array'));
@@ -544,12 +555,14 @@ class TwitapistatusesAction extends TwitterapiAction {
         }
     }
 
-    function featured($args, $apidata) {
+    function featured($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
 
-    function supported($cmd) {
+    function supported($cmd)
+    {
 
         $cmdlist = array('MessageCommand', 'SubCommand', 'UnsubCommand', 'FavCommand', 'OnCommand', 'OffCommand');
 
diff --git a/_darcs/pristine/actions/twitapiusers.php b/_darcs/pristine/actions/twitapiusers.php
index 43f6969f4..4644e6be6 100644
--- a/_darcs/pristine/actions/twitapiusers.php
+++ b/_darcs/pristine/actions/twitapiusers.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapiusersAction extends TwitterapiAction {
 
-    function show($args, $apidata) {
+    function show($args, $apidata)
+    {
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
diff --git a/_darcs/pristine/actions/twittersettings.php b/_darcs/pristine/actions/twittersettings.php
index 8cbd39fbd..437bdd363 100644
--- a/_darcs/pristine/actions/twittersettings.php
+++ b/_darcs/pristine/actions/twittersettings.php
@@ -25,12 +25,14 @@ define('SUBSCRIPTIONS', 80);
 
 class TwittersettingsAction extends SettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Add your Twitter account to automatically send your notices to Twitter, ' .
             'and subscribe to Twitter friends already here.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $user = common_current_user();
         $profile = $user->getProfile();
         $fuser = null;
@@ -91,7 +93,8 @@ class TwittersettingsAction extends SettingsAction {
         common_show_footer();
     }
 
-    function subscribed_twitter_users() {
+    function subscribed_twitter_users()
+    {
 
         $current_user = common_current_user();
 
@@ -119,7 +122,8 @@ class TwittersettingsAction extends SettingsAction {
         return $users;
     }
 
-    function show_twitter_subscriptions() {
+    function show_twitter_subscriptions()
+    {
 
         $friends = $this->subscribed_twitter_users();
         $friends_count = count($friends);
@@ -180,7 +184,8 @@ class TwittersettingsAction extends SettingsAction {
 
     }
 
-    function handle_post() {
+    function handle_post()
+    {
 
         # CSRF protection
         $token = $this->trimmed('token');
@@ -200,7 +205,8 @@ class TwittersettingsAction extends SettingsAction {
         }
     }
 
-    function add_twitter_acct() {
+    function add_twitter_acct()
+    {
 
         $screen_name = $this->trimmed('twitter_username');
         $password = $this->trimmed('twitter_password');
@@ -261,7 +267,8 @@ class TwittersettingsAction extends SettingsAction {
         $this->show_form(_('Twitter settings saved.'), true);
     }
 
-    function remove_twitter_acct() {
+    function remove_twitter_acct()
+    {
 
         $user = common_current_user();
         $flink = Foreign_link::getByUserID($user->id, 1);
@@ -284,7 +291,8 @@ class TwittersettingsAction extends SettingsAction {
         $this->show_form(_('Twitter account removed.'), TRUE);
     }
 
-    function save_preferences() {
+    function save_preferences()
+    {
 
         $noticesync = $this->boolean('noticesync');
         $friendsync = $this->boolean('friendsync');
@@ -330,7 +338,8 @@ class TwittersettingsAction extends SettingsAction {
         $this->show_form(_('Twitter preferences saved.'));
     }
 
-    function verify_credentials($screen_name, $password) {
+    function verify_credentials($screen_name, $password)
+    {
         $uri = 'http://twitter.com/account/verify_credentials.json';
         $data = get_twitter_data($uri, $screen_name, $password);
 
@@ -353,7 +362,8 @@ class TwittersettingsAction extends SettingsAction {
         return false;
     }
 
-    function set_flags(&$flink, $noticesync, $replysync, $friendsync) {
+    function set_flags(&$flink, $noticesync, $replysync, $friendsync)
+    {
         if ($noticesync) {
             $flink->noticesync |= FOREIGN_NOTICE_SEND;
         } else {
diff --git a/_darcs/pristine/actions/unblock.php b/_darcs/pristine/actions/unblock.php
index 51ec0ae57..66ce0c879 100644
--- a/_darcs/pristine/actions/unblock.php
+++ b/_darcs/pristine/actions/unblock.php
@@ -23,7 +23,8 @@ class UnblockAction extends Action {
 
     var $profile = null;
 
-    function prepare($args) {
+    function prepare($args)
+    {
 
         parent::prepare($args);
 
@@ -56,14 +57,16 @@ class UnblockAction extends Action {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $this->unblock_profile();
         }
     }
 
-    function unblock_profile() {
+    function unblock_profile()
+    {
 
         $cur = common_current_user();
 
diff --git a/_darcs/pristine/actions/unsubscribe.php b/_darcs/pristine/actions/unsubscribe.php
index 38fcc21de..e4e04aaa0 100644
--- a/_darcs/pristine/actions/unsubscribe.php
+++ b/_darcs/pristine/actions/unsubscribe.php
@@ -19,7 +19,8 @@
 
 class UnsubscribeAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (!common_logged_in()) {
             common_user_error(_('Not logged in.'));
diff --git a/_darcs/pristine/actions/updateprofile.php b/_darcs/pristine/actions/updateprofile.php
index 4b4bb53a1..2cfff1b51 100644
--- a/_darcs/pristine/actions/updateprofile.php
+++ b/_darcs/pristine/actions/updateprofile.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/omb.php');
 
 class UpdateprofileAction extends Action {
     
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         try {
             common_remove_magic_from_request();
@@ -40,7 +41,8 @@ class UpdateprofileAction extends Action {
         }
     }
 
-    function update_profile($req, $consumer, $token) {
+    function update_profile($req, $consumer, $token)
+    {
         $version = $req->get_parameter('omb_version');
         if ($version != OMB_VERSION_01) {
             $this->client_error(_('Unsupported OMB version'), 400);
diff --git a/_darcs/pristine/actions/userauthorization.php b/_darcs/pristine/actions/userauthorization.php
index 58ec36fc8..ecaa33167 100644
--- a/_darcs/pristine/actions/userauthorization.php
+++ b/_darcs/pristine/actions/userauthorization.php
@@ -24,7 +24,8 @@ define('TIMESTAMP_THRESHOLD', 300);
 
 class UserauthorizationAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@@ -69,7 +70,8 @@ class UserauthorizationAction extends Action {
         }
     }
 
-    function show_form($req) {
+    function show_form($req)
+    {
 
         $nickname = $req->get_parameter('omb_listenee_nickname');
         $profile = $req->get_parameter('omb_listenee_profile');
@@ -129,7 +131,8 @@ class UserauthorizationAction extends Action {
         common_show_footer();
     }
 
-    function send_authorization() {
+    function send_authorization()
+    {
         $req = $this->get_stored_request();
 
         if (!$req) {
@@ -197,7 +200,8 @@ class UserauthorizationAction extends Action {
         }
     }
 
-    function authorize_token(&$req) {
+    function authorize_token(&$req)
+    {
         $consumer_key = $req->get_parameter('oauth_consumer_key');
         $token_field = $req->get_parameter('oauth_token');
         common_debug('consumer key = "'.$consumer_key.'"', __FILE__);
@@ -222,7 +226,8 @@ class UserauthorizationAction extends Action {
 
     # XXX: refactor with similar code in finishremotesubscribe.php
 
-    function save_remote_profile(&$req) {
+    function save_remote_profile(&$req)
+    {
         # FIXME: we should really do this when the consumer comes
         # back for an access token. If they never do, we've got stuff in a
         # weird state.
@@ -312,13 +317,15 @@ class UserauthorizationAction extends Action {
         return TRUE;
     }
 
-    function add_avatar($profile, $url) {
+    function add_avatar($profile, $url)
+    {
         $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
         copy($url, $temp_filename);
         return $profile->setOriginal($temp_filename);
     }
 
-    function show_accept_message($tok) {
+    function show_accept_message($tok)
+    {
         common_show_header(_('Subscription authorized'));
         common_element('p', null,
                        _('The subscription has been authorized, but no '.
@@ -328,7 +335,8 @@ class UserauthorizationAction extends Action {
         common_show_footer();
     }
 
-    function show_reject_message($tok) {
+    function show_reject_message($tok)
+    {
         common_show_header(_('Subscription rejected'));
         common_element('p', null,
                        _('The subscription has been rejected, but no '.
@@ -337,23 +345,27 @@ class UserauthorizationAction extends Action {
         common_show_footer();
     }
 
-    function store_request($req) {
+    function store_request($req)
+    {
         common_ensure_session();
         $_SESSION['userauthorizationrequest'] = $req;
     }
 
-    function clear_request() {
+    function clear_request()
+    {
         common_ensure_session();
         unset($_SESSION['userauthorizationrequest']);
     }
 
-    function get_stored_request() {
+    function get_stored_request()
+    {
         common_ensure_session();
         $req = $_SESSION['userauthorizationrequest'];
         return $req;
     }
 
-    function get_new_request() {
+    function get_new_request()
+    {
         common_remove_magic_from_request();
         $req = OAuthRequest::from_request();
         return $req;
@@ -361,7 +373,8 @@ class UserauthorizationAction extends Action {
 
     # Throws an OAuthException if anything goes wrong
 
-    function validate_request(&$req) {
+    function validate_request(&$req)
+    {
         # OAuth stuff -- have to copy from OAuth.php since they're
         # all private methods, and there's no user-authentication method
         common_debug('checking version', __FILE__);
@@ -384,7 +397,8 @@ class UserauthorizationAction extends Action {
         return true;
     }
 
-    function validate_omb(&$req) {
+    function validate_omb(&$req)
+    {
         foreach (array('omb_version', 'omb_listener', 'omb_listenee',
                        'omb_listenee_profile', 'omb_listenee_nickname',
                        'omb_listenee_license') as $param)
@@ -498,7 +512,8 @@ class UserauthorizationAction extends Action {
 
     # Snagged from OAuthServer
 
-    function check_version(&$req) {
+    function check_version(&$req)
+    {
         $version = $req->get_parameter("oauth_version");
         if (!$version) {
             $version = 1.0;
@@ -511,7 +526,8 @@ class UserauthorizationAction extends Action {
 
     # Snagged from OAuthServer
 
-    function get_consumer($datastore, $req) {
+    function get_consumer($datastore, $req)
+    {
         $consumer_key = @$req->get_parameter("oauth_consumer_key");
         if (!$consumer_key) {
             throw new OAuthException("Invalid consumer key");
@@ -526,7 +542,8 @@ class UserauthorizationAction extends Action {
 
     # Mostly cadged from OAuthServer
 
-    function get_token($datastore, &$req, $consumer) {/*{{{*/
+    function get_token($datastore, &$req, $consumer)
+    {/*{{{*/
         $token_field = @$req->get_parameter('oauth_token');
         $token = $datastore->lookup_token($consumer, 'request', $token_field);
         if (!$token) {
@@ -535,7 +552,8 @@ class UserauthorizationAction extends Action {
         return $token;
     }
 
-    function check_timestamp(&$req) {
+    function check_timestamp(&$req)
+    {
         $timestamp = @$req->get_parameter('oauth_timestamp');
         $now = time();
         if ($now - $timestamp > TIMESTAMP_THRESHOLD) {
@@ -544,7 +562,8 @@ class UserauthorizationAction extends Action {
     }
 
     # NOTE: don't call twice on the same request; will fail!
-    function check_nonce(&$datastore, &$req, $consumer, $token) {
+    function check_nonce(&$datastore, &$req, $consumer, $token)
+    {
         $timestamp = @$req->get_parameter('oauth_timestamp');
         $nonce = @$req->get_parameter('oauth_nonce');
         $found = $datastore->lookup_nonce($consumer, $token, $nonce, $timestamp);
@@ -554,7 +573,8 @@ class UserauthorizationAction extends Action {
         return true;
     }
 
-    function check_signature(&$req, $consumer, $token) {
+    function check_signature(&$req, $consumer, $token)
+    {
         $signature_method = $this->get_signature_method($req);
         $signature = $req->get_parameter('oauth_signature');
         $valid_sig = $signature_method->check_signature($req,
@@ -566,7 +586,8 @@ class UserauthorizationAction extends Action {
         }
     }
 
-    function get_signature_method(&$req) {
+    function get_signature_method(&$req)
+    {
         $signature_method = @$req->get_parameter("oauth_signature_method");
         if (!$signature_method) {
             $signature_method = "PLAINTEXT";
diff --git a/_darcs/pristine/actions/userbyid.php b/_darcs/pristine/actions/userbyid.php
index 3fa92e9ce..d7b4088bd 100644
--- a/_darcs/pristine/actions/userbyid.php
+++ b/_darcs/pristine/actions/userbyid.php
@@ -21,11 +21,13 @@ if (!defined('LACONICA')) { exit(1); }
 
 class UserbyidAction extends Action {
     
-    function is_readonly() {                
+    function is_readonly()
+    {                
         return true;
     }
     
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $id = $this->trimmed('id');
         if (!$id) {
diff --git a/_darcs/pristine/actions/userrss.php b/_darcs/pristine/actions/userrss.php
index 6089718ae..c758a44e2 100644
--- a/_darcs/pristine/actions/userrss.php
+++ b/_darcs/pristine/actions/userrss.php
@@ -27,7 +27,8 @@ class UserrssAction extends Rss10Action {
 
     var $user = null;
 
-    function init() {
+    function init()
+    {
         $nickname = $this->trimmed('nickname');
         $this->user = User::staticGet('nickname', $nickname);
 
@@ -39,7 +40,8 @@ class UserrssAction extends Rss10Action {
         }
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
 
         $user = $this->user;
         
@@ -56,7 +58,8 @@ class UserrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         $user = $this->user;
         $profile = $user->getProfile();
         $c = array('url' => common_local_url('userrss',
@@ -68,7 +71,8 @@ class UserrssAction extends Rss10Action {
         return $c;
     }
 
-    function get_image() {
+    function get_image()
+    {
         $user = $this->user;
         $profile = $user->getProfile();
         if (!$profile) {
@@ -82,7 +86,8 @@ class UserrssAction extends Rss10Action {
 
     # override parent to add X-SUP-ID URL
     
-    function init_rss($limit=0) {
+    function init_rss($limit=0)
+    {
         $url = common_local_url('sup', null, $this->user->id);
         header('X-SUP-ID: '.$url);
         parent::init_rss($limit);
diff --git a/_darcs/pristine/actions/xrds.php b/_darcs/pristine/actions/xrds.php
index 54baf64be..1d4961d46 100644
--- a/_darcs/pristine/actions/xrds.php
+++ b/_darcs/pristine/actions/xrds.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/omb.php');
 
 class XrdsAction extends Action {
 
-    function is_readonly() {                
+    function is_readonly()
+    {                
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $nickname = $this->trimmed('nickname');
         $user = User::staticGet('nickname', $nickname);
@@ -38,7 +40,8 @@ class XrdsAction extends Action {
         $this->show_xrds($user);
     }
 
-    function show_xrds($user) {
+    function show_xrds($user)
+    {
 
         header('Content-Type: application/xrds+xml');
 
@@ -108,7 +111,8 @@ class XrdsAction extends Action {
         common_end_xml();
     }
 
-    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
+    function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
+    {
         common_element_start('Service');
         if ($uri) {
             common_element('URI', null, $uri);
diff --git a/_darcs/pristine/classes/Avatar.php b/_darcs/pristine/classes/Avatar.php
index bde983d79..3c754ec2d 100644
--- a/_darcs/pristine/classes/Avatar.php
+++ b/_darcs/pristine/classes/Avatar.php
@@ -21,14 +21,16 @@ class Avatar extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
     # We clean up the file, too
 
-    function delete() {
+    function delete()
+    {
         $filename = $this->filename;
         if (parent::delete()) {
             @unlink(common_avatar_path($filename));
@@ -38,7 +40,8 @@ class Avatar extends Memcached_DataObject
     # Create and save scaled version of this avatar
     # XXX: maybe break into different methods
 
-    function scale($size) {
+    function scale($size)
+    {
 
         $image_s = imagecreatetruecolor($size, $size);
         $image_a = $this->to_image();
@@ -76,7 +79,8 @@ class Avatar extends Memcached_DataObject
         }
     }
 
-    function to_image() {
+    function to_image()
+    {
         $filepath = common_avatar_path($this->filename);
         if ($this->mediatype == 'image/gif') {
             return imagecreatefromgif($filepath);
@@ -89,7 +93,8 @@ class Avatar extends Memcached_DataObject
         }
     }
     
-    function &pkeyGet($kv) {
+    function &pkeyGet($kv)
+    {
         return Memcached_DataObject::pkeyGet('Avatar', $kv);
     }
 }
diff --git a/_darcs/pristine/classes/Channel.php b/_darcs/pristine/classes/Channel.php
index ea3530406..02ece9c0f 100644
--- a/_darcs/pristine/classes/Channel.php
+++ b/_darcs/pristine/classes/Channel.php
@@ -21,23 +21,28 @@ if (!defined('LACONICA')) { exit(1); }
 
 class Channel {
     
-    function on($user) {
+    function on($user)
+    {
         return false;
     }
 
-    function off($user) {
+    function off($user)
+    {
         return false;
     }
 
-    function output($user, $text) {
+    function output($user, $text)
+    {
         return false;
     }
     
-    function error($user, $text) {
+    function error($user, $text)
+    {
         return false;
     }
     
-    function source() {
+    function source()
+    {
         return null;
     }
 }
@@ -46,33 +51,40 @@ class XMPPChannel extends Channel {
 
     var $conn = null;
     
-    function source() {
+    function source()
+    {
         return 'xmpp';
     }
     
-    function __construct($conn) {
+    function __construct($conn)
+    {
         $this->conn = $conn;
     }
     
-    function on($user) {
+    function on($user)
+    {
         return $this->set_notify($user, 1);
     }
     
-    function off($user) {
+    function off($user)
+    {
         return $this->set_notify($user, 0);
     }
 
-    function output($user, $text) {
+    function output($user, $text)
+    {
         $text = '['.common_config('site', 'name') . '] ' . $text;
         jabber_send_message($user->jabber, $text);
     }
     
-    function error($user, $text) {
+    function error($user, $text)
+    {
         $text = '['.common_config('site', 'name') . '] ' . $text;
         jabber_send_message($user->jabber, $text);
     }
     
-    function set_notify(&$user, $notify) {
+    function set_notify(&$user, $notify)
+    {
         $orig = clone($user);
         $user->jabbernotify = $notify;
         $result = $user->update($orig);
@@ -94,19 +106,23 @@ class XMPPChannel extends Channel {
 
 class WebChannel extends Channel {
 
-    function source() {
+    function source()
+    {
         return 'web';
     }
     
-    function on($user) {
+    function on($user)
+    {
         return false;
     }
     
-    function off($user) {
+    function off($user)
+    {
         return false;
     }
 
-    function output($user, $text) {
+    function output($user, $text)
+    {
         # XXX: buffer all output and send it at the end
         # XXX: even better, redirect to appropriate page
         #      depending on what command was run
@@ -115,7 +131,8 @@ class WebChannel extends Channel {
         common_show_footer();
     }
     
-    function error($user, $text) {
+    function error($user, $text)
+    {
         common_user_error($text);
     }
 }
@@ -123,7 +140,8 @@ class WebChannel extends Channel {
 
 class AjaxWebChannel extends WebChannel {
 
-    function output($user, $text) {
+    function output($user, $text)
+    {
         common_start_html('text/xml;charset=utf-8', true);
         common_element_start('head');
         common_element('title', null, _('Command results'));
@@ -134,7 +152,8 @@ class AjaxWebChannel extends WebChannel {
         common_element_end('html');
     }
 
-    function error($user, $text) {
+    function error($user, $text)
+    {
         common_start_html('text/xml;charset=utf-8', true);
         common_element_start('head');
         common_element('title', null, _('Ajax Error'));
@@ -151,23 +170,28 @@ class MailChannel extends Channel {
 
     var $addr = null;
 
-    function source() {
+    function source()
+    {
         return 'mail';
     }
     
-    function __construct($addr=null) {
+    function __construct($addr=null)
+    {
         $this->addr = $addr;
     }
     
-    function on($user) {
+    function on($user)
+    {
         return $this->set_notify($user, 1);
     }
     
-    function off($user) {
+    function off($user)
+    {
         return $this->set_notify($user, 0);
     }
 
-    function output($user, $text) {
+    function output($user, $text)
+    {
 
         $headers['From'] = $user->incomingemail;
         $headers['To'] = $this->addr;
@@ -177,7 +201,8 @@ class MailChannel extends Channel {
         return mail_send(array($this->addr), $headers, $text);
     }
     
-    function error($user, $text) {
+    function error($user, $text)
+    {
         
         $headers['From'] = $user->incomingemail;
         $headers['To'] = $this->addr;
@@ -187,7 +212,8 @@ class MailChannel extends Channel {
         return mail_send(array($this->addr), $headers, $text);
     }
     
-    function set_notify($user, $value) {
+    function set_notify($user, $value)
+    {
         $orig = clone($user);
         $user->smsnotify = $value;
         $result = $user->update($orig);
diff --git a/_darcs/pristine/classes/Command.php b/_darcs/pristine/classes/Command.php
index b146005a7..407a6ecba 100644
--- a/_darcs/pristine/classes/Command.php
+++ b/_darcs/pristine/classes/Command.php
@@ -25,17 +25,20 @@ class Command {
     
     var $user = null;
     
-    function __construct($user=null) {
+    function __construct($user=null)
+    {
         $this->user = $user;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         return false;
     }
 }
 
 class UnimplementedCommand extends Command {
-    function execute($channel) {
+    function execute($channel)
+    {
         $channel->error($this->user, _("Sorry, this command is not yet implemented."));
     }
 }
@@ -48,7 +51,8 @@ class TrackOffCommand extends UnimplementedCommand {
 
 class TrackCommand extends UnimplementedCommand {
     var $word = null;
-    function __construct($user, $word) {
+    function __construct($user, $word)
+    {
         parent::__construct($user);
         $this->word = $word;
     }
@@ -56,7 +60,8 @@ class TrackCommand extends UnimplementedCommand {
 
 class UntrackCommand extends UnimplementedCommand {
     var $word = null;
-    function __construct($user, $word) {
+    function __construct($user, $word)
+    {
         parent::__construct($user);
         $this->word = $word;
     }
@@ -64,7 +69,8 @@ class UntrackCommand extends UnimplementedCommand {
 
 class NudgeCommand extends UnimplementedCommand {
     var $other = null;
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
@@ -72,14 +78,16 @@ class NudgeCommand extends UnimplementedCommand {
 
 class InviteCommand extends UnimplementedCommand {
     var $other = null;
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
 }
 
 class StatsCommand extends Command {
-    function execute($channel) {
+    function execute($channel)
+    {
 
         $subs = new Subscription();
         $subs->subscriber = $this->user->id;
@@ -106,12 +114,14 @@ class FavCommand extends Command {
     
     var $other = null;
     
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         
         $recipient = 
           common_relative_profile($this->user, common_canonical_nickname($this->other));
@@ -149,12 +159,14 @@ class FavCommand extends Command {
 
 class WhoisCommand extends Command {
     var $other = null;
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         $recipient = 
           common_relative_profile($this->user, common_canonical_nickname($this->other));
         
@@ -184,13 +196,15 @@ class WhoisCommand extends Command {
 class MessageCommand extends Command {
     var $other = null;
     var $text = null;
-    function __construct($user, $other, $text) {
+    function __construct($user, $other, $text)
+    {
         parent::__construct($user);
         $this->other = $other;
         $this->text = $text;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         $other = User::staticGet('nickname', common_canonical_nickname($this->other));
         $len = mb_strlen($this->text);
         if ($len == 0) {
@@ -227,12 +241,14 @@ class GetCommand extends Command {
     
     var $other = null;
     
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         $target_nickname = common_canonical_nickname($this->other);
         
         $target =
@@ -257,12 +273,14 @@ class SubCommand extends Command {
     
     var $other = null;
     
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         
         if (!$this->other) {
             $channel->error($this->user, _('Specify the name of the user to subscribe to'));
@@ -283,12 +301,14 @@ class UnsubCommand extends Command {
 
     var $other = null;
     
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
 
-    function execute($channel) {
+    function execute($channel)
+    {
         if(!$this->other) {
             $channel->error($this->user, _('Specify the name of the user to unsubscribe from'));
             return;
@@ -306,11 +326,13 @@ class UnsubCommand extends Command {
 
 class OffCommand extends Command {
     var $other = null;
-    function __construct($user, $other=null) {
+    function __construct($user, $other=null)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
-    function execute($channel) {
+    function execute($channel)
+    {
         if ($other) {
             $channel->error($this->user, _("Command not yet implemented."));
         } else {
@@ -325,12 +347,14 @@ class OffCommand extends Command {
 
 class OnCommand extends Command {
     var $other = null;
-    function __construct($user, $other=null) {
+    function __construct($user, $other=null)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         if ($other) {
             $channel->error($this->user, _("Command not yet implemented."));
         } else {
@@ -344,7 +368,8 @@ class OnCommand extends Command {
 }
 
 class HelpCommand extends Command {
-    function execute($channel) {
+    function execute($channel)
+    {
         $channel->output($this->user,
                          _("Commands:\n".
                            "on - turn on notifications\n".
diff --git a/_darcs/pristine/classes/CommandInterpreter.php b/_darcs/pristine/classes/CommandInterpreter.php
index db02ce541..ff078bb05 100644
--- a/_darcs/pristine/classes/CommandInterpreter.php
+++ b/_darcs/pristine/classes/CommandInterpreter.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/classes/Command.php');
 
 class CommandInterpreter {
     
-    function handle_command($user, $text) {
+    function handle_command($user, $text)
+    {
         # XXX: localise
 
         $text = preg_replace('/\s+/', ' ', trim($text));
diff --git a/_darcs/pristine/classes/Confirm_address.php b/_darcs/pristine/classes/Confirm_address.php
index 71f2d0c72..ed3875d22 100644
--- a/_darcs/pristine/classes/Confirm_address.php
+++ b/_darcs/pristine/classes/Confirm_address.php
@@ -20,10 +20,12 @@ class Confirm_address extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function sequenceKey() { return array(false, false); }
+    function sequenceKey()
+    { return array(false, false); }
 }
diff --git a/_darcs/pristine/classes/Consumer.php b/_darcs/pristine/classes/Consumer.php
index c598312aa..d5b7b7e33 100644
--- a/_darcs/pristine/classes/Consumer.php
+++ b/_darcs/pristine/classes/Consumer.php
@@ -16,7 +16,8 @@ class Consumer extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Fave.php b/_darcs/pristine/classes/Fave.php
index 5d938d149..24df5938c 100644
--- a/_darcs/pristine/classes/Fave.php
+++ b/_darcs/pristine/classes/Fave.php
@@ -15,7 +15,8 @@ class Fave extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Fave',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Fave',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -31,7 +32,8 @@ class Fave extends Memcached_DataObject
         return $fave;
     }
     
-    function &pkeyGet($kv) {
+    function &pkeyGet($kv)
+    {
         return Memcached_DataObject::pkeyGet('Fave', $kv);
     }
 }
diff --git a/_darcs/pristine/classes/Foreign_link.php b/_darcs/pristine/classes/Foreign_link.php
index 41a95e641..79a4d262d 100644
--- a/_darcs/pristine/classes/Foreign_link.php
+++ b/_darcs/pristine/classes/Foreign_link.php
@@ -21,7 +21,8 @@ class Foreign_link extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -55,7 +56,8 @@ class Foreign_link extends Memcached_DataObject
     }
         
     # Convenience methods
-    function getForeignUser() {        
+    function getForeignUser()
+    {        
         $fuser = new Foreign_user();
         $fuser->service = $this->service;
         $fuser->id = $this->foreign_id;
@@ -69,7 +71,8 @@ class Foreign_link extends Memcached_DataObject
         return null;        
     }
     
-    function getUser() {
+    function getUser()
+    {
         return User::staticGet($this->user_id);
     }
         
diff --git a/_darcs/pristine/classes/Foreign_service.php b/_darcs/pristine/classes/Foreign_service.php
index 128411b71..ef614dbd6 100644
--- a/_darcs/pristine/classes/Foreign_service.php
+++ b/_darcs/pristine/classes/Foreign_service.php
@@ -17,7 +17,8 @@ class Foreign_service extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Foreign_subscription.php b/_darcs/pristine/classes/Foreign_subscription.php
index d8e8569fb..d50860621 100644
--- a/_darcs/pristine/classes/Foreign_subscription.php
+++ b/_darcs/pristine/classes/Foreign_subscription.php
@@ -16,7 +16,8 @@ class Foreign_subscription extends Memcached_DataObject
     public $created;                         // datetime()   not_null
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Foreign_user.php b/_darcs/pristine/classes/Foreign_user.php
index f8a980884..61727abe5 100644
--- a/_darcs/pristine/classes/Foreign_user.php
+++ b/_darcs/pristine/classes/Foreign_user.php
@@ -18,7 +18,8 @@ class Foreign_user extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -39,7 +40,8 @@ class Foreign_user extends Memcached_DataObject
         return null;        
     }
     
-    function updateKeys(&$orig) {
+    function updateKeys(&$orig)
+    {
         $parts = array();
         foreach (array('id', 'service', 'uri', 'nickname') as $k) {
             if (strcmp($this->$k, $orig->$k) != 0) {
diff --git a/_darcs/pristine/classes/Invitation.php b/_darcs/pristine/classes/Invitation.php
index ff6456445..8a36fd8df 100644
--- a/_darcs/pristine/classes/Invitation.php
+++ b/_darcs/pristine/classes/Invitation.php
@@ -17,7 +17,8 @@ class Invitation extends Memcached_DataObject
     public $created;                         // datetime()   not_null
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Memcached_DataObject.php b/_darcs/pristine/classes/Memcached_DataObject.php
index 1d12730c9..b9f599dbc 100644
--- a/_darcs/pristine/classes/Memcached_DataObject.php
+++ b/_darcs/pristine/classes/Memcached_DataObject.php
@@ -23,7 +23,8 @@ require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
 
 class Memcached_DataObject extends DB_DataObject 
 {
-    function &staticGet($cls, $k, $v=null) {
+    function &staticGet($cls, $k, $v=null)
+    {
         if (is_null($v)) {
             $v = $k;
             # XXX: HACK!
@@ -44,7 +45,8 @@ class Memcached_DataObject extends DB_DataObject
         }
     }
 
-    function &pkeyGet($cls, $kv) {
+    function &pkeyGet($cls, $kv)
+    {
         $i = Memcached_DataObject::multicache($cls, $kv);
         if ($i) {
             return $i;
@@ -62,12 +64,14 @@ class Memcached_DataObject extends DB_DataObject
         }
     }
 
-    function insert() {
+    function insert()
+    {
         $result = parent::insert();
         return $result;
     }
     
-    function update($orig=null) {
+    function update($orig=null)
+    {
         if (is_object($orig) && $orig instanceof Memcached_DataObject) {
             $orig->decache(); # might be different keys
         }
@@ -78,7 +82,8 @@ class Memcached_DataObject extends DB_DataObject
         return $result;
     }
     
-    function delete() {
+    function delete()
+    {
         $this->decache(); # while we still have the values!
         return parent::delete();
     }
@@ -100,7 +105,8 @@ class Memcached_DataObject extends DB_DataObject
         }
     }
 
-    function keyTypes() {
+    function keyTypes()
+    {
         global $_DB_DATAOBJECT;
         if (!isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"])) {
             $this->databaseStructure();
@@ -109,7 +115,8 @@ class Memcached_DataObject extends DB_DataObject
         return $_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"];
     }
     
-    function encache() {
+    function encache()
+    {
         $c = $this->memcache();
         if (!$c) {
             return false;
@@ -133,7 +140,8 @@ class Memcached_DataObject extends DB_DataObject
         }
     }
     
-    function decache() {
+    function decache()
+    {
         $c = $this->memcache();
         if (!$c) {
             return false;
@@ -158,7 +166,8 @@ class Memcached_DataObject extends DB_DataObject
         }
     }
 
-    function multicache($cls, $kv) {
+    function multicache($cls, $kv)
+    {
         ksort($kv);
         $c = Memcached_DataObject::memcache();
         if (!$c) {
@@ -170,7 +179,8 @@ class Memcached_DataObject extends DB_DataObject
         }
     }
 
-    function getSearchEngine($table) {
+    function getSearchEngine($table)
+    {
         require_once INSTALLDIR.'/lib/search_engines.php';
         static $search_engine;
         if (!isset($search_engine)) {
diff --git a/_darcs/pristine/classes/Message.php b/_darcs/pristine/classes/Message.php
index e04fbb3c0..4806057b4 100644
--- a/_darcs/pristine/classes/Message.php
+++ b/_darcs/pristine/classes/Message.php
@@ -22,16 +22,19 @@ class Message extends Memcached_DataObject
     public $source;                          // varchar(32)  
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Message',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Message',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
     
-    function getFrom() {
+    function getFrom()
+    {
         return Profile::staticGet('id', $this->from_profile);
     }
     
-    function getTo() {
+    function getTo()
+    {
         return Profile::staticGet('id', $this->to_profile);
     }
     
diff --git a/_darcs/pristine/classes/Nonce.php b/_darcs/pristine/classes/Nonce.php
index 54d20de9c..2c0edfa14 100644
--- a/_darcs/pristine/classes/Nonce.php
+++ b/_darcs/pristine/classes/Nonce.php
@@ -18,7 +18,8 @@ class Nonce extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Notice.php b/_darcs/pristine/classes/Notice.php
index e6152812c..d3aa4e828 100644
--- a/_darcs/pristine/classes/Notice.php
+++ b/_darcs/pristine/classes/Notice.php
@@ -48,23 +48,27 @@ class Notice extends Memcached_DataObject
     public $source;                             // varchar(32)
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Notice',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function getProfile() {
+    function getProfile()
+    {
         return Profile::staticGet('id', $this->profile_id);
     }
 
-    function delete() {
+    function delete()
+    {
         $this->blowCaches(true);
         $this->blowFavesCache(true);
         $this->blowInboxes();
         return parent::delete();
     }
 
-    function saveTags() {
+    function saveTags()
+    {
         /* extract all #hastags */
         $count = preg_match_all('/(?:^|\s)#([A-Za-z0-9_\-\.]{1,64})/', strtolower($this->content), $match);
         if (!$count) {
@@ -184,7 +188,8 @@ class Notice extends Memcached_DataObject
         return true;
     }
 
-    function blowCaches($blowLast=false) {
+    function blowCaches($blowLast=false)
+    {
         $this->blowSubsCache($blowLast);
         $this->blowNoticeCache($blowLast);
         $this->blowRepliesCache($blowLast);
@@ -192,7 +197,8 @@ class Notice extends Memcached_DataObject
         $this->blowTagCache($blowLast);
     }
 
-    function blowTagCache($blowLast=false) {
+    function blowTagCache($blowLast=false)
+    {
         $cache = common_memcache();
         if ($cache) {
             $tag = new Notice_tag();
@@ -210,7 +216,8 @@ class Notice extends Memcached_DataObject
         }
     }
 
-    function blowSubsCache($blowLast=false) {
+    function blowSubsCache($blowLast=false)
+    {
         $cache = common_memcache();
         if ($cache) {
             $user = new User();
@@ -230,7 +237,8 @@ class Notice extends Memcached_DataObject
         }
     }
 
-    function blowNoticeCache($blowLast=false) {
+    function blowNoticeCache($blowLast=false)
+    {
         if ($this->is_local) {
             $cache = common_memcache();
             if ($cache) {
@@ -242,7 +250,8 @@ class Notice extends Memcached_DataObject
         }
     }
 
-    function blowRepliesCache($blowLast=false) {
+    function blowRepliesCache($blowLast=false)
+    {
         $cache = common_memcache();
         if ($cache) {
             $reply = new Reply();
@@ -260,7 +269,8 @@ class Notice extends Memcached_DataObject
         }
     }
 
-    function blowPublicCache($blowLast=false) {
+    function blowPublicCache($blowLast=false)
+    {
         if ($this->is_local == 1) {
             $cache = common_memcache();
             if ($cache) {
@@ -272,7 +282,8 @@ class Notice extends Memcached_DataObject
         }
     }
 
-    function blowFavesCache($blowLast=false) {
+    function blowFavesCache($blowLast=false)
+    {
         $cache = common_memcache();
         if ($cache) {
             $fave = new Fave();
@@ -477,7 +488,8 @@ class Notice extends Memcached_DataObject
         return $wrapper;
     }
 
-    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null) {
+    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null)
+    {
 
         $parts = array();
 
@@ -499,7 +511,8 @@ class Notice extends Memcached_DataObject
                                  $offset, $limit, $since_id, $before_id, null, $since);
     }
 
-    function addToInboxes() {
+    function addToInboxes()
+    {
         $enabled = common_config('inboxes', 'enabled');
 
         if ($enabled === true || $enabled === 'transitional') {
@@ -522,7 +535,8 @@ class Notice extends Memcached_DataObject
 
     # Delete from inboxes if we're deleted.
 
-    function blowInboxes() {
+    function blowInboxes()
+    {
 
         $enabled = common_config('inboxes', 'enabled');
 
diff --git a/_darcs/pristine/classes/NoticeWrapper.php b/_darcs/pristine/classes/NoticeWrapper.php
index 19ae37c1b..e1b27c2f7 100644
--- a/_darcs/pristine/classes/NoticeWrapper.php
+++ b/_darcs/pristine/classes/NoticeWrapper.php
@@ -38,11 +38,13 @@ class NoticeWrapper extends Notice {
     var $notices = null;
     var $i = -1;
     
-    function __construct($arr) {
+    function __construct($arr)
+    {
         $this->notices = $arr;
     }
     
-    function fetch() {
+    function fetch()
+    {
         static $fields = array('id', 'profile_id', 'uri', 'content', 'rendered',
                                'url', 'created', 'modified', 'reply_to', 'is_local', 'source');
         $this->i++;
diff --git a/_darcs/pristine/classes/Notice_inbox.php b/_darcs/pristine/classes/Notice_inbox.php
index 922ba2660..81ddb4538 100644
--- a/_darcs/pristine/classes/Notice_inbox.php
+++ b/_darcs/pristine/classes/Notice_inbox.php
@@ -33,7 +33,8 @@ class Notice_inbox extends Memcached_DataObject
     public $source;                          // tinyint(1)   default_1
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Notice_source.php b/_darcs/pristine/classes/Notice_source.php
index a12397b0b..e7568bbca 100644
--- a/_darcs/pristine/classes/Notice_source.php
+++ b/_darcs/pristine/classes/Notice_source.php
@@ -17,7 +17,8 @@ class Notice_source extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Notice_tag.php b/_darcs/pristine/classes/Notice_tag.php
index 8c3911f76..94f9296d6 100644
--- a/_darcs/pristine/classes/Notice_tag.php
+++ b/_darcs/pristine/classes/Notice_tag.php
@@ -30,7 +30,8 @@ class Notice_tag extends Memcached_DataObject
     public $created;                         // datetime()   not_null
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -46,7 +47,8 @@ class Notice_tag extends Memcached_DataObject
                                  $offset, $limit);
     }
     
-    function blowCache() {
+    function blowCache()
+    {
         $cache = common_memcache();
         if ($cache) {
             $cache->delete(common_cache_key('notice_tag:notice_stream:' . $this->tag));
diff --git a/_darcs/pristine/classes/Profile.php b/_darcs/pristine/classes/Profile.php
index b95cbf993..fb6ff90f1 100644
--- a/_darcs/pristine/classes/Profile.php
+++ b/_darcs/pristine/classes/Profile.php
@@ -41,12 +41,14 @@ class Profile extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Profile',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function getAvatar($width, $height=null) {
+    function getAvatar($width, $height=null)
+    {
         if (is_null($height)) {
             $height = $width;
         }
@@ -55,7 +57,8 @@ class Profile extends Memcached_DataObject
                                      'height' => $height));
     }
 
-    function getOriginalAvatar() {
+    function getOriginalAvatar()
+    {
         $avatar = DB_DataObject::factory('avatar');
         $avatar->profile_id = $this->id;
         $avatar->original = true;
@@ -66,7 +69,8 @@ class Profile extends Memcached_DataObject
         }
     }
 
-    function setOriginal($source) {
+    function setOriginal($source)
+    {
 
         $info = @getimagesize($source);
 
@@ -117,7 +121,8 @@ class Profile extends Memcached_DataObject
         return $avatar;
     }
 
-    function delete_avatars() {
+    function delete_avatars()
+    {
         $avatar = new Avatar();
         $avatar->profile_id = $this->id;
         $avatar->find();
@@ -127,12 +132,14 @@ class Profile extends Memcached_DataObject
         return true;
     }
 
-    function getBestName() {
+    function getBestName()
+    {
         return ($this->fullname) ? $this->fullname : $this->nickname;
     }
 
     # Get latest notice on or before date; default now
-    function getCurrentNotice($dt=null) {
+    function getCurrentNotice($dt=null)
+    {
         $notice = new Notice();
         $notice->profile_id = $this->id;
         if ($dt) {
@@ -146,7 +153,8 @@ class Profile extends Memcached_DataObject
         return null;
     }
 
-    function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) {
+    function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
+    {
         $qry =
           'SELECT * ' .
           'FROM notice ' .
diff --git a/_darcs/pristine/classes/Profile_block.php b/_darcs/pristine/classes/Profile_block.php
index 41d6701eb..551e690e2 100644
--- a/_darcs/pristine/classes/Profile_block.php
+++ b/_darcs/pristine/classes/Profile_block.php
@@ -36,12 +36,14 @@ class Profile_block extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function get($blocker, $blocked) {
+    function get($blocker, $blocked)
+    {
         return Memcached_DataObject::pkeyGet('Profile_block',
                                              array('blocker' => $blocker,
                                                    'blocked' => $blocked));
diff --git a/_darcs/pristine/classes/Profile_tag.php b/_darcs/pristine/classes/Profile_tag.php
index 5c508c84f..cb60cbaec 100644
--- a/_darcs/pristine/classes/Profile_tag.php
+++ b/_darcs/pristine/classes/Profile_tag.php
@@ -16,7 +16,8 @@ class Profile_tag extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Queue_item.php b/_darcs/pristine/classes/Queue_item.php
index f2fc0be03..1b34d8ab4 100644
--- a/_darcs/pristine/classes/Queue_item.php
+++ b/_darcs/pristine/classes/Queue_item.php
@@ -16,12 +16,14 @@ class Queue_item extends Memcached_DataObject
     public $claimed;                         // datetime()  
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function sequenceKey() { return array(false, false); }
+    function sequenceKey()
+    { return array(false, false); }
     
     static function top($transport) {
 
diff --git a/_darcs/pristine/classes/Remember_me.php b/_darcs/pristine/classes/Remember_me.php
index 9d3f9378f..8dc29bfa3 100644
--- a/_darcs/pristine/classes/Remember_me.php
+++ b/_darcs/pristine/classes/Remember_me.php
@@ -15,10 +15,12 @@ class Remember_me extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function sequenceKey() { return array(false, false); }
+    function sequenceKey()
+    { return array(false, false); }
 }
diff --git a/_darcs/pristine/classes/Remote_profile.php b/_darcs/pristine/classes/Remote_profile.php
index 66b0f3a5c..5aa6d913e 100644
--- a/_darcs/pristine/classes/Remote_profile.php
+++ b/_darcs/pristine/classes/Remote_profile.php
@@ -38,7 +38,8 @@ class Remote_profile extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Reply.php b/_darcs/pristine/classes/Reply.php
index 10d6ced5b..af86aaf87 100644
--- a/_darcs/pristine/classes/Reply.php
+++ b/_darcs/pristine/classes/Reply.php
@@ -16,7 +16,8 @@ class Reply extends Memcached_DataObject
     public $replied_id;                      // int(4)  
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Reply',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Reply',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/Sms_carrier.php b/_darcs/pristine/classes/Sms_carrier.php
index b4a9d8655..ffa12de29 100644
--- a/_darcs/pristine/classes/Sms_carrier.php
+++ b/_darcs/pristine/classes/Sms_carrier.php
@@ -17,12 +17,14 @@ class Sms_carrier extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
     
-    function toEmailAddress($sms) {
+    function toEmailAddress($sms)
+    {
         return sprintf($this->email_pattern, $sms);
     }
 }
diff --git a/_darcs/pristine/classes/Subscription.php b/_darcs/pristine/classes/Subscription.php
index d70f99550..3fe0d167f 100644
--- a/_darcs/pristine/classes/Subscription.php
+++ b/_darcs/pristine/classes/Subscription.php
@@ -40,12 +40,14 @@ class Subscription extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
     
-    function &pkeyGet($kv) {
+    function &pkeyGet($kv)
+    {
         return Memcached_DataObject::pkeyGet('Subscription', $kv);
     }
 }
diff --git a/_darcs/pristine/classes/Token.php b/_darcs/pristine/classes/Token.php
index 3c88444c8..1fabd72f1 100644
--- a/_darcs/pristine/classes/Token.php
+++ b/_darcs/pristine/classes/Token.php
@@ -19,7 +19,8 @@ class Token extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Token',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Token',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/classes/User.php b/_darcs/pristine/classes/User.php
index 29e6a86e9..90d0ccfe0 100644
--- a/_darcs/pristine/classes/User.php
+++ b/_darcs/pristine/classes/User.php
@@ -62,16 +62,19 @@ class User extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('User',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function getProfile() {
+    function getProfile()
+    {
         return Profile::staticGet('id', $this->id);
     }
 
-    function isSubscribed($other) {
+    function isSubscribed($other)
+    {
         assert(!is_null($other));
         # XXX: cache results of this query
         $sub = Subscription::pkeyGet(array('subscriber' => $this->id,
@@ -81,7 +84,8 @@ class User extends Memcached_DataObject
 
     # 'update' won't write key columns, so we have to do it ourselves.
 
-    function updateKeys(&$orig) {
+    function updateKeys(&$orig)
+    {
         $parts = array();
         foreach (array('nickname', 'email', 'jabber', 'incomingemail', 'sms', 'carrier', 'smsemail', 'language', 'timezone') as $k) {
             if (strcmp($this->$k, $orig->$k) != 0) {
@@ -108,7 +112,8 @@ class User extends Memcached_DataObject
         return $result;
     }
 
-    function allowed_nickname($nickname) {
+    function allowed_nickname($nickname)
+    {
         # XXX: should already be validated for size, content, etc.
         static $blacklist = array('rss', 'xrds', 'doc', 'main',
                                   'settings', 'notice', 'user',
@@ -118,7 +123,8 @@ class User extends Memcached_DataObject
         return !in_array($nickname, $merged);
     }
 
-    function getCurrentNotice($dt=null) {
+    function getCurrentNotice($dt=null)
+    {
         $profile = $this->getProfile();
         if (!$profile) {
             return null;
@@ -126,11 +132,13 @@ class User extends Memcached_DataObject
         return $profile->getCurrentNotice($dt);
     }
 
-    function getCarrier() {
+    function getCarrier()
+    {
         return Sms_carrier::staticGet('id', $this->carrier);
     }
 
-    function subscribeTo($other) {
+    function subscribeTo($other)
+    {
         $sub = new Subscription();
         $sub->subscriber = $this->id;
         $sub->subscribed = $other->id;
@@ -144,7 +152,8 @@ class User extends Memcached_DataObject
         return true;
     }
 
-    function hasBlocked($other) {
+    function hasBlocked($other)
+    {
 
         $block = Profile_block::get($this->id, $other->id);
 
@@ -271,7 +280,8 @@ class User extends Memcached_DataObject
 
     # Things we do when the email changes
 
-    function emailChanged() {
+    function emailChanged()
+    {
 
         $invites = new Invitation();
         $invites->address = $this->email;
@@ -285,7 +295,8 @@ class User extends Memcached_DataObject
         }
     }
 
-    function hasFave($notice) {
+    function hasFave($notice)
+    {
         $cache = common_memcache();
 
         # XXX: Kind of a hack.
@@ -317,12 +328,14 @@ class User extends Memcached_DataObject
                                     'notice_id' => $notice->id));
         return ((is_null($fave)) ? false : true);
     }
-    function mutuallySubscribed($other) {
+    function mutuallySubscribed($other)
+    {
         return $this->isSubscribed($other) &&
           $other->isSubscribed($this);
     }
 
-        function mutuallySubscribedUsers() {
+        function mutuallySubscribedUsers()
+        {
 
         # 3-way join; probably should get cached
         $qry = 'SELECT user.* ' .
@@ -336,7 +349,8 @@ class User extends Memcached_DataObject
         return $user;
     }
 
-    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
+    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+    {
         $qry =
           'SELECT notice.* ' .
           'FROM notice JOIN reply ON notice.id = reply.notice_id ' .
@@ -346,7 +360,8 @@ class User extends Memcached_DataObject
                                  $offset, $limit, $since_id, $before_id, null, $since);
     }
 
-        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
+        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+        {
         $profile = $this->getProfile();
         if (!$profile) {
             return null;
@@ -355,7 +370,8 @@ class User extends Memcached_DataObject
         }
     }
 
-      function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE) {
+      function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE)
+      {
         $qry =
           'SELECT notice.* ' .
           'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
@@ -365,7 +381,8 @@ class User extends Memcached_DataObject
                                  $offset, $limit);
     }
 
-        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
+        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+        {
         $enabled = common_config('inboxes', 'enabled');
 
         # Complicated code, depending on whether we support inboxes yet
@@ -394,7 +411,8 @@ class User extends Memcached_DataObject
                                  $order, $since);
     }
 
-        function blowFavesCache() {
+        function blowFavesCache()
+        {
         $cache = common_memcache();
         if ($cache) {
             # Faves don't happen chronologically, so we need to blow
@@ -404,15 +422,18 @@ class User extends Memcached_DataObject
         }
     }
 
-        function getSelfTags() {
+        function getSelfTags()
+        {
         return Profile_tag::getTags($this->id, $this->id);
     }
 
-        function setSelfTags($newtags) {
+        function setSelfTags($newtags)
+        {
         return Profile_tag::setTags($this->id, $this->id, $newtags);
     }
 
-    function block($other) {
+    function block($other)
+    {
 
         # Add a new block record
 
@@ -450,7 +471,8 @@ class User extends Memcached_DataObject
         return true;
     }
 
-    function unblock($other) {
+    function unblock($other)
+    {
 
         # Get the block record
 
diff --git a/_darcs/pristine/classes/User_openid.php b/_darcs/pristine/classes/User_openid.php
index 7dc476dc4..f4fda1c72 100644
--- a/_darcs/pristine/classes/User_openid.php
+++ b/_darcs/pristine/classes/User_openid.php
@@ -17,7 +17,8 @@ class User_openid extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/_darcs/pristine/lib/Shorturl_api.php b/_darcs/pristine/lib/Shorturl_api.php
index 7beae0ec6..f3f4f08df 100644
--- a/_darcs/pristine/lib/Shorturl_api.php
+++ b/_darcs/pristine/lib/Shorturl_api.php
@@ -22,11 +22,13 @@ if (!defined('LACONICA')) { exit(1); }
 class ShortUrlApi {
     protected $service_url;
 
-    function __construct($service_url) {
+    function __construct($service_url)
+    {
         $this->service_url = $service_url;
     }
 
-    function shorten($url) {
+    function shorten($url)
+    {
         if ($this->is_long($url)) return $this->shorten_imp($url);
         return $url;
     }
@@ -68,7 +70,8 @@ class ShortUrlApi {
 }
 
 class LilUrl extends ShortUrlApi {
-    function __construct() {
+    function __construct()
+    {
         parent::__construct('http://ur1.ca/');
     }
 
@@ -86,7 +89,8 @@ class LilUrl extends ShortUrlApi {
 
 
 class PtitUrl extends ShortUrlApi {
-    function __construct() {
+    function __construct()
+    {
         parent::__construct('http://ptiturl.com/?creer=oui&action=Reduire&url=');
     }
 
@@ -103,7 +107,8 @@ class PtitUrl extends ShortUrlApi {
 }
 
 class TightUrl extends ShortUrlApi {
-    function __construct() {
+    function __construct()
+    {
         parent::__construct('http://2tu.us/?save=y&url=');
     }
 
diff --git a/_darcs/pristine/lib/common.php b/_darcs/pristine/lib/common.php
index 3e162f781..74c992f1c 100644
--- a/_darcs/pristine/lib/common.php
+++ b/_darcs/pristine/lib/common.php
@@ -163,7 +163,8 @@ require_once(INSTALLDIR.'/lib/subs.php');
 require_once(INSTALLDIR.'/lib/Shorturl_api.php');
 require_once(INSTALLDIR.'/lib/twitter.php');
 
-function __autoload($class) {
+function __autoload($class)
+{
     if ($class == 'OAuthRequest') {
         require_once('OAuth.php');
     } else if (file_exists(INSTALLDIR.'/classes/' . $class . '.php')) {
diff --git a/_darcs/pristine/lib/deleteaction.php b/_darcs/pristine/lib/deleteaction.php
index a7de6b8fb..a6e365121 100644
--- a/_darcs/pristine/lib/deleteaction.php
+++ b/_darcs/pristine/lib/deleteaction.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class DeleteAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $user = common_current_user();
         $notice_id = $this->trimmed('notice');
@@ -43,7 +44,8 @@ class DeleteAction extends Action {
         }
     }
 
-    function show_top($arr=null) {
+    function show_top($arr=null)
+    {
         $instr = $this->get_instructions();
         $output = common_markup_to_html($instr);
         common_element_start('div', 'instructions');
@@ -51,11 +53,13 @@ class DeleteAction extends Action {
         common_element_end('div');
     }
 
-    function get_title() {
+    function get_title()
+    {
         return null;
     }
 
-    function show_header() {
+    function show_header()
+    {
         return;
     }
 }
diff --git a/_darcs/pristine/lib/facebookaction.php b/_darcs/pristine/lib/facebookaction.php
index 731460f12..43464b19b 100644
--- a/_darcs/pristine/lib/facebookaction.php
+++ b/_darcs/pristine/lib/facebookaction.php
@@ -23,17 +23,20 @@ require_once(INSTALLDIR.'/extlib/facebook/facebook.php');
 
 class FacebookAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
     }
 
-    function get_facebook() {
+    function get_facebook()
+    {
         $apikey = common_config('facebook', 'apikey');
         $secret = common_config('facebook', 'secret');
         return new Facebook($apikey, $secret);
     }
 
-    function update_profile_box($facebook, $fbuid, $user) {
+    function update_profile_box($facebook, $fbuid, $user)
+    {
 
         $notice = $user->getCurrentNotice();
 
@@ -86,7 +89,8 @@ class FacebookAction extends Action {
 
     # Display methods
 
-    function show_header($selected ='Home') {
+    function show_header($selected ='Home')
+    {
 
         # Add a timestamp to the CSS file so Facebook cache wont ignore our changes
         $ts = filemtime(theme_file('facebookapp.css'));
@@ -108,12 +112,14 @@ class FacebookAction extends Action {
 
     }
 
-    function show_footer() {
+    function show_footer()
+    {
       $footer = '</div>';
       echo $footer;
     }
 
-    function show_login_form() {
+    function show_login_form()
+    {
 
         $loginform =
             ' <h2>To add the Identi.ca application, you need to log into your Identi.ca account.</h2>'
@@ -148,7 +154,8 @@ class FacebookAction extends Action {
             echo $loginform;
     }
 
-    function render_notice($notice) {
+    function render_notice($notice)
+    {
 
         global $config;
 
@@ -207,7 +214,8 @@ class FacebookAction extends Action {
         return $html;
     }
 
-    function source_link($source) {
+    function source_link($source)
+    {
         $source_name = _($source);
 
         $html = '<span class="noticesource">';
@@ -235,7 +243,8 @@ class FacebookAction extends Action {
         return $html;
     }
 
-    function pagination($have_before, $have_after, $page, $fbaction, $args=null) {
+    function pagination($have_before, $have_after, $page, $fbaction, $args=null)
+    {
 
         $html = '';
 
@@ -266,7 +275,8 @@ class FacebookAction extends Action {
         }
     }
 
-    function pagination_url($fbaction, $args=null) {
+    function pagination_url($fbaction, $args=null)
+    {
         global $config;
 
         $extra = '';
diff --git a/_darcs/pristine/lib/oauthstore.php b/_darcs/pristine/lib/oauthstore.php
index 421b618b7..7ec3ca655 100644
--- a/_darcs/pristine/lib/oauthstore.php
+++ b/_darcs/pristine/lib/oauthstore.php
@@ -25,7 +25,8 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
 
     # We keep a record of who's contacted us
 
-    function lookup_consumer($consumer_key) {
+    function lookup_consumer($consumer_key)
+    {
         $con = Consumer::staticGet('consumer_key', $consumer_key);
         if (!$con) {
             $con = new Consumer();
@@ -39,7 +40,8 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         return new OAuthConsumer($con->consumer_key, '');
     }
 
-    function lookup_token($consumer, $token_type, $token_key) {
+    function lookup_token($consumer, $token_type, $token_key)
+    {
         $t = new Token();
         $t->consumer_key = $consumer->key;
         $t->tok = $token_key;
@@ -51,7 +53,8 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         }
     }
 
-    function lookup_nonce($consumer, $token, $nonce, $timestamp) {
+    function lookup_nonce($consumer, $token, $nonce, $timestamp)
+    {
         $n = new Nonce();
         $n->consumer_key = $consumer->key;
         $n->tok = $token->key;
@@ -66,7 +69,8 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         }
     }
 
-    function new_request_token($consumer) {
+    function new_request_token($consumer)
+    {
         $t = new Token();
         $t->consumer_key = $consumer->key;
         $t->tok = common_good_rand(16);
@@ -83,11 +87,13 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
 
     # defined in OAuthDataStore, but not implemented anywhere
 
-    function fetch_request_token($consumer) {
+    function fetch_request_token($consumer)
+    {
         return $this->new_request_token($consumer);
     }
 
-    function new_access_token($token, $consumer) {
+    function new_access_token($token, $consumer)
+    {
         common_debug('new_access_token("'.$token->key.'","'.$consumer->key.'")', __FILE__);
         $rt = new Token();
         $rt->consumer_key = $consumer->key;
@@ -138,7 +144,8 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
 
     # defined in OAuthDataStore, but not implemented anywhere
 
-    function fetch_access_token($consumer) {
+    function fetch_access_token($consumer)
+    {
         return $this->new_access_token($consumer);
     }
 }
diff --git a/_darcs/pristine/lib/omb.php b/_darcs/pristine/lib/omb.php
index 8199b0679..c07bedab5 100644
--- a/_darcs/pristine/lib/omb.php
+++ b/_darcs/pristine/lib/omb.php
@@ -43,7 +43,8 @@ define('OAUTH_AUTH_HEADER', OAUTH_NAMESPACE.'parameters/auth-header');
 define('OAUTH_POST_BODY', OAUTH_NAMESPACE.'parameters/post-body');
 define('OAUTH_HMAC_SHA1', OAUTH_NAMESPACE.'signature/HMAC-SHA1');
 
-function omb_oauth_consumer() {
+function omb_oauth_consumer()
+{
     static $con = null;
     if (!$con) {
         $con = new OAuthConsumer(common_root_url(), '');
@@ -51,7 +52,8 @@ function omb_oauth_consumer() {
     return $con;
 }
 
-function omb_oauth_server() {
+function omb_oauth_server()
+{
     static $server = null;
     if (!$server) {
         $server = new OAuthServer(omb_oauth_datastore());
@@ -60,7 +62,8 @@ function omb_oauth_server() {
     return $server;
 }
 
-function omb_oauth_datastore() {
+function omb_oauth_datastore()
+{
     static $store = null;
     if (!$store) {
         $store = new LaconicaOAuthDataStore();
@@ -68,7 +71,8 @@ function omb_oauth_datastore() {
     return $store;
 }
 
-function omb_hmac_sha1() {
+function omb_hmac_sha1()
+{
     static $hmac_method = null;
     if (!$hmac_method) {
         $hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
@@ -76,20 +80,24 @@ function omb_hmac_sha1() {
     return $hmac_method;
 }
 
-function omb_get_services($xrd, $type) {
+function omb_get_services($xrd, $type)
+{
     return $xrd->services(array(omb_service_filter($type)));
 }
 
-function omb_service_filter($type) {
+function omb_service_filter($type)
+{
     return create_function('$s',
                            'return omb_match_service($s, \''.$type.'\');');
 }
 
-function omb_match_service($service, $type) {
+function omb_match_service($service, $type)
+{
     return in_array($type, $service->getTypes());
 }
 
-function omb_service_uri($service) {
+function omb_service_uri($service)
+{
     if (!$service) {
         return null;
     }
@@ -100,7 +108,8 @@ function omb_service_uri($service) {
     return $uris[0];
 }
 
-function omb_local_id($service) {
+function omb_local_id($service)
+{
     if (!$service) {
         return null;
     }
@@ -112,7 +121,8 @@ function omb_local_id($service) {
     return $service->parser->content($el);
 }
 
-function omb_broadcast_remote_subscribers($notice) {
+function omb_broadcast_remote_subscribers($notice)
+{
 
     # First, get remote users subscribed to this profile
     $rp = new Remote_profile();
@@ -142,11 +152,13 @@ function omb_broadcast_remote_subscribers($notice) {
     return true;
 }
 
-function omb_post_notice($notice, $remote_profile, $subscription) {
+function omb_post_notice($notice, $remote_profile, $subscription)
+{
     return omb_post_notice_keys($notice, $remote_profile->postnoticeurl, $subscription->token, $subscription->secret);
 }
 
-function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret) {
+function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret)
+{
 
     common_debug('Posting notice ' . $notice->id . ' to ' . $postnoticeurl, __FILE__);
 
@@ -216,7 +228,8 @@ function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret) {
     }
 }
 
-function omb_broadcast_profile($profile) {
+function omb_broadcast_profile($profile)
+{
     # First, get remote users subscribed to this profile
     # XXX: use a join here rather than looping through results
     $sub = new Subscription();
@@ -236,7 +249,8 @@ function omb_broadcast_profile($profile) {
     }
 }
 
-function omb_update_profile($profile, $remote_profile, $subscription) {
+function omb_update_profile($profile, $remote_profile, $subscription)
+{
     global $config; # for license URL
     $user = User::staticGet($profile->id);
     $con = omb_oauth_consumer();
diff --git a/_darcs/pristine/lib/openid.php b/_darcs/pristine/lib/openid.php
index 3ca359fa1..1e7f318fb 100644
--- a/_darcs/pristine/lib/openid.php
+++ b/_darcs/pristine/lib/openid.php
@@ -31,7 +31,8 @@ require_once('Auth/OpenID/MySQLStore.php');
 define('OPENID_COOKIE_EXPIRY', round(365.25 * 24 * 60 * 60));
 define('OPENID_COOKIE_KEY', 'lastusedopenid');
 
-function oid_store() {
+function oid_store()
+{
     static $store = null;
     if (!$store) {
         # Can't be called statically
@@ -42,23 +43,27 @@ function oid_store() {
     return $store;
 }
 
-function oid_consumer() {
+function oid_consumer()
+{
     $store = oid_store();
     $consumer = new Auth_OpenID_Consumer($store);
     return $consumer;
 }
 
-function oid_clear_last() {
+function oid_clear_last()
+{
     oid_set_last('');
 }
 
-function oid_set_last($openid_url) {
+function oid_set_last($openid_url)
+{
     common_set_cookie(OPENID_COOKIE_KEY,
                      $openid_url,
                      time() + OPENID_COOKIE_EXPIRY);
 }
 
-function oid_get_last() {
+function oid_get_last()
+{
     $openid_url = $_COOKIE[OPENID_COOKIE_KEY];
     if ($openid_url && strlen($openid_url) > 0) {
         return $openid_url;
@@ -67,7 +72,8 @@ function oid_get_last() {
     }
 }
 
-function oid_link_user($id, $canonical, $display) {
+function oid_link_user($id, $canonical, $display)
+{
 
     $oid = new User_openid();
     $oid->user_id = $id;
@@ -84,7 +90,8 @@ function oid_link_user($id, $canonical, $display) {
     return true;
 }
 
-function oid_get_user($openid_url) {
+function oid_get_user($openid_url)
+{
     $user = null;
     $oid = User_openid::staticGet('canonical', $openid_url);
     if ($oid) {
@@ -93,7 +100,8 @@ function oid_get_user($openid_url) {
     return $user;
 }
 
-function oid_check_immediate($openid_url, $backto=null) {
+function oid_check_immediate($openid_url, $backto=null)
+{
     if (!$backto) {
         $action = $_REQUEST['action'];
         $args = common_copy_args($_GET);
@@ -113,7 +121,8 @@ function oid_check_immediate($openid_url, $backto=null) {
                      true);
 }
 
-function oid_authenticate($openid_url, $returnto, $immediate=false) {
+function oid_authenticate($openid_url, $returnto, $immediate=false)
+{
 
     $consumer = oid_consumer();
 
@@ -190,7 +199,8 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) {
 
 # Half-assed attempt at a module-private function
 
-function _oid_print_instructions() {
+function _oid_print_instructions()
+{
     common_element('div', 'instructions',
                    _('This form should automatically submit itself. '.
                       'If not, click the submit button to go to your '.
@@ -199,7 +209,8 @@ function _oid_print_instructions() {
 
 # update a user from sreg parameters
 
-function oid_update_user(&$user, &$sreg) {
+function oid_update_user(&$user, &$sreg)
+{
 
     $profile = $user->getProfile();
 
diff --git a/_darcs/pristine/lib/personal.php b/_darcs/pristine/lib/personal.php
index 7ff9305f1..34ebe6894 100644
--- a/_darcs/pristine/lib/personal.php
+++ b/_darcs/pristine/lib/personal.php
@@ -21,16 +21,19 @@ if (!defined('LACONICA')) { exit(1); }
 
 class PersonalAction extends Action {
     
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
     
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         common_set_returnto($this->self_url());
     }
 
-    function views_menu() {
+    function views_menu()
+    {
 
         $user = null;
         $action = $this->trimmed('action');
@@ -85,7 +88,8 @@ class PersonalAction extends Action {
         common_element_end('ul');
     }
 
-    function show_feeds_list($feeds) {
+    function show_feeds_list($feeds)
+    {
         common_element_start('div', array('class' => 'feeds'));
         common_element('p', null, 'Feeds:');
         common_element_start('ul', array('class' => 'xoxo'));
@@ -97,7 +101,8 @@ class PersonalAction extends Action {
         common_element_end('div');
     }
 
-    function common_feed_item($feed) {
+    function common_feed_item($feed)
+    {
         $nickname = $this->trimmed('nickname');
 
         switch($feed['item']) {
@@ -181,7 +186,8 @@ class PersonalAction extends Action {
     }
 
     
-    function source_link($source) {
+    function source_link($source)
+    {
         $source_name = _($source);
         switch ($source) {
          case 'web':
diff --git a/_darcs/pristine/lib/profilelist.php b/_darcs/pristine/lib/profilelist.php
index 9929c8647..60737c3d4 100644
--- a/_darcs/pristine/lib/profilelist.php
+++ b/_darcs/pristine/lib/profilelist.php
@@ -28,13 +28,15 @@ class ProfileList {
     var $owner = null;
     var $action = null;
 
-    function __construct($profile, $owner=null, $action=null) {
+    function __construct($profile, $owner=null, $action=null)
+    {
         $this->profile = $profile;
         $this->owner = $owner;
         $this->action = $action;
     }
 
-    function show_list() {
+    function show_list()
+    {
 
         common_element_start('ul', array('id' => 'profiles', 'class' => 'profile_list'));
 
@@ -53,7 +55,8 @@ class ProfileList {
         return $cnt;
     }
 
-    function show() {
+    function show()
+    {
 
         common_element_start('li', array('class' => 'profile_single',
                                          'id' => 'profile-' . $this->profile->id));
@@ -159,11 +162,13 @@ class ProfileList {
 
     /* Override this in subclasses. */
 
-    function show_owner_controls($profile) {
+    function show_owner_controls($profile)
+    {
         return;
     }
 
-    function highlight($text) {
+    function highlight($text)
+    {
         return htmlspecialchars($text);
     }
 }
\ No newline at end of file
diff --git a/_darcs/pristine/lib/queuehandler.php b/_darcs/pristine/lib/queuehandler.php
index ecf58f69f..48487f8e9 100644
--- a/_darcs/pristine/lib/queuehandler.php
+++ b/_darcs/pristine/lib/queuehandler.php
@@ -29,43 +29,53 @@ class QueueHandler extends Daemon {
 
     var $_id = 'generic';
 
-    function QueueHandler($id=null) {
+    function QueueHandler($id=null)
+    {
         if ($id) {
             $this->set_id($id);
         }
     }
     
-    function class_name() {
+    function class_name()
+    {
         return ucfirst($this->transport()) . 'Handler';
     }
 
-    function name() {
+    function name()
+    {
         return strtolower($this->class_name().'.'.$this->get_id());
     }
     
-    function get_id() {
+    function get_id()
+    {
         return $this->_id;
     }
 
-    function set_id($id) {
+    function set_id($id)
+    {
         $this->_id = $id;
     }
     
-    function transport() {
+    function transport()
+    {
         return null;
     }
     
-    function start() {
+    function start()
+    {
     }
     
-    function finish() {
+    function finish()
+    {
     }
 
-    function handle_notice($notice) {
+    function handle_notice($notice)
+    {
         return true;
     }
     
-    function run() {
+    function run()
+    {
         if (!$this->start()) {
             return false;
         }
@@ -110,13 +120,15 @@ class QueueHandler extends Daemon {
         return true;
     }
 
-    function idle($timeout=0) {
+    function idle($timeout=0)
+    {
         if ($timeout>0) {
             sleep($timeout);
         }
     }
     
-    function clear_old_claims() {
+    function clear_old_claims()
+    {
         $qi = new Queue_item();
         $qi->transport = $this->transport();
         $qi->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
@@ -125,7 +137,8 @@ class QueueHandler extends Daemon {
         unset($qi);
     }
     
-    function log($level, $msg) {
+    function log($level, $msg)
+    {
         common_log($level, $this->class_name() . ' ('. $this->get_id() .'): '.$msg);
     }
 }
diff --git a/_darcs/pristine/lib/rssaction.php b/_darcs/pristine/lib/rssaction.php
index a21ce3a97..e02e1febb 100644
--- a/_darcs/pristine/lib/rssaction.php
+++ b/_darcs/pristine/lib/rssaction.php
@@ -26,11 +26,13 @@ class Rss10Action extends Action {
     # This will contain the details of each feed item's author and be used to generate SIOC data.
     var $creators = array();
 
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $limit = (int) $this->trimmed('limit');
         if ($limit == 0) {
@@ -39,26 +41,31 @@ class Rss10Action extends Action {
         $this->show_rss($limit);
     }
 
-    function init() {
+    function init()
+    {
         return true;
     }
 
-    function get_notices() {
+    function get_notices()
+    {
         return array();
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         return array('url' => '',
                      'title' => '',
                      'link' => '',
                      'description' => '');
     }
 
-    function get_image() {
+    function get_image()
+    {
         return null;
     }
 
-    function show_rss($limit=0) {
+    function show_rss($limit=0)
+    {
 
         if (!$this->init()) {
             return;
@@ -78,7 +85,8 @@ class Rss10Action extends Action {
         $this->end_rss();
     }
 
-    function show_channel($notices) {
+    function show_channel($notices)
+    {
 
         $channel = $this->get_channel();
         $image = $this->get_image();
@@ -106,7 +114,8 @@ class Rss10Action extends Action {
         common_element_end('channel');
     }
 
-    function show_image() {
+    function show_image()
+    {
         $image = $this->get_image();
         if ($image) {
             $channel = $this->get_channel();
@@ -118,7 +127,8 @@ class Rss10Action extends Action {
         }
     }
 
-    function show_item($notice) {
+    function show_item($notice)
+    {
         $profile = Profile::staticGet($notice->profile_id);
         $nurl = common_local_url('shownotice', array('notice' => $notice->id));
         $creator_uri = common_profile_uri($profile);
@@ -136,7 +146,8 @@ class Rss10Action extends Action {
         $this->creators[$creator_uri] = $profile;
     }
 
-    function show_creators() {
+    function show_creators()
+    {
         foreach ($this->creators as $uri => $profile) {
             $id = $profile->id;
             $nickname = $profile->nickname;
@@ -152,7 +163,8 @@ class Rss10Action extends Action {
         }
     }
 
-    function init_rss() {
+    function init_rss()
+    {
         $channel = $this->get_channel();
         header('Content-Type: application/rdf+xml');
 
@@ -183,7 +195,8 @@ class Rss10Action extends Action {
         common_element_end('sioc:Site');
     }
 
-    function end_rss() {
+    function end_rss()
+    {
         common_element_end('rdf:RDF');
     }
 }
diff --git a/_darcs/pristine/lib/search_engines.php b/_darcs/pristine/lib/search_engines.php
index d53d7d8d8..e96570d63 100644
--- a/_darcs/pristine/lib/search_engines.php
+++ b/_darcs/pristine/lib/search_engines.php
@@ -23,19 +23,23 @@ class SearchEngine {
     protected $target;
     protected $table;
 
-    function __construct($target, $table) {
+    function __construct($target, $table)
+    {
         $this->target = $target;
         $this->table = $table;
     }
 
-    function query($q) {
+    function query($q)
+    {
     }
 
-    function limit($offset, $count, $rss = false) {
+    function limit($offset, $count, $rss = false)
+    {
         return $this->target->limit($offset, $count);
     }
 
-    function set_sort_mode($mode) {
+    function set_sort_mode($mode)
+    {
         if ('chron' === $mode)
             return $this->target->orderBy('created desc');
     }
@@ -45,7 +49,8 @@ class SphinxSearch extends SearchEngine {
     private $sphinx;
     private $connected;
 
-    function __construct($target, $table) {
+    function __construct($target, $table)
+    {
         $fp = @fsockopen(common_config('sphinx', 'server'), common_config('sphinx', 'port'));
         if (!$fp) {
             $this->connected = false;
@@ -58,11 +63,13 @@ class SphinxSearch extends SearchEngine {
         $this->connected = true;
     }
 
-    function is_connected() {
+    function is_connected()
+    {
         return $this->connected;
     }
 
-    function limit($offset, $count, $rss = false) {
+    function limit($offset, $count, $rss = false)
+    {
         //FIXME without LARGEST_POSSIBLE, the most recent results aren't returned
         //      this probably has a large impact on performance
         $LARGEST_POSSIBLE = 1e6; 
@@ -78,7 +85,8 @@ class SphinxSearch extends SearchEngine {
         return $this->target->limit(0, $count);
     }
 
-    function query($q) {
+    function query($q)
+    {
         $result = $this->sphinx->query($q, $this->table);
         if (!isset($result['matches'])) return false;
         $id_set = join(', ', array_keys($result['matches']));
@@ -86,7 +94,8 @@ class SphinxSearch extends SearchEngine {
         return true;
      }
 
-    function set_sort_mode($mode) {
+    function set_sort_mode($mode)
+    {
         if ('chron' === $mode) {
             $this->sphinx->SetSortMode(SPH_SORT_ATTR_DESC, 'created_ts');
             return $this->target->orderBy('created desc');
@@ -95,7 +104,8 @@ class SphinxSearch extends SearchEngine {
 }
 
 class MySQLSearch extends SearchEngine {
-    function query($q) {
+    function query($q)
+    {
         if ('identica_people' === $this->table)
             return $this->target->whereAdd('MATCH(nickname, fullname, location, bio, homepage) ' .
                            'against (\''.addslashes($q).'\')');
@@ -106,7 +116,8 @@ class MySQLSearch extends SearchEngine {
 }
 
 class PGSearch extends SearchEngine {
-    function query($q) {
+    function query($q)
+    {
         if ('identica_people' === $this->table)
             return $this->target->whereAdd('textsearch @@ plainto_tsquery(\''.addslashes($q).'\')');
         if ('identica_notices' === $this->table)
diff --git a/_darcs/pristine/lib/searchaction.php b/_darcs/pristine/lib/searchaction.php
index 3eec91832..12a44a861 100644
--- a/_darcs/pristine/lib/searchaction.php
+++ b/_darcs/pristine/lib/searchaction.php
@@ -21,16 +21,19 @@ if (!defined('LACONICA')) { exit(1); }
 
 class SearchAction extends Action {
 
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $this->show_form();
     }
 
-    function show_top($arr=null) {
+    function show_top($arr=null)
+    {
         if ($arr) {
             $error = $arr[1];
         }
@@ -46,15 +49,18 @@ class SearchAction extends Action {
         $this->search_menu();
     }
 
-    function get_title() {
+    function get_title()
+    {
         return null;
     }
 
-    function show_header($arr) {
+    function show_header($arr)
+    {
         return;
     }
 
-    function show_form($error=null) {
+    function show_form($error=null)
+    {
         global $config;
 
         $q = $this->trimmed('q');
@@ -91,7 +97,8 @@ class SearchAction extends Action {
         common_show_footer();
     }
 
-    function search_menu() {
+    function search_menu()
+    {
         # action => array('prompt', 'title', $args)
         $action = $this->trimmed('action');
         $menu =
diff --git a/_darcs/pristine/lib/settingsaction.php b/_darcs/pristine/lib/settingsaction.php
index 208d2a1b6..5979c11f0 100644
--- a/_darcs/pristine/lib/settingsaction.php
+++ b/_darcs/pristine/lib/settingsaction.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class SettingsAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (!common_logged_in()) {
             common_user_error(_('Not logged in.'));
@@ -40,29 +41,34 @@ class SettingsAction extends Action {
     }
 
     # override!
-    function handle_post() {
+    function handle_post()
+    {
         return false;
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         return false;
     }
 
-    function message($msg, $success) {
+    function message($msg, $success)
+    {
         if ($msg) {
             common_element('div', ($success) ? 'success' : 'error',
                            $msg);
         }
     }
 
-    function form_header($title, $msg=null, $success=false) {
+    function form_header($title, $msg=null, $success=false)
+    {
         common_show_header($title,
                            null,
                            array($msg, $success),
                            array($this, 'show_top'));
     }
 
-    function show_top($arr) {
+    function show_top($arr)
+    {
         $msg = $arr[0];
         $success = $arr[1];
         if ($msg) {
@@ -77,7 +83,8 @@ class SettingsAction extends Action {
         $this->settings_menu();
     }
 
-    function settings_menu() {
+    function settings_menu()
+    {
         # action => array('prompt', 'title')
         $menu =
           array('profilesettings' =>
diff --git a/_darcs/pristine/lib/stream.php b/_darcs/pristine/lib/stream.php
index 2d45df2d3..45fbb9bd9 100644
--- a/_darcs/pristine/lib/stream.php
+++ b/_darcs/pristine/lib/stream.php
@@ -24,7 +24,8 @@ require_once(INSTALLDIR.'/lib/noticelist.php');
 
 class StreamAction extends PersonalAction {
 
-    function public_views_menu() {
+    function public_views_menu()
+    {
 
         $action = $this->trimmed('action');
 
@@ -48,7 +49,8 @@ class StreamAction extends PersonalAction {
 
     }
 
-    function show_notice_list($notice) {
+    function show_notice_list($notice)
+    {
         $nl = new NoticeList($notice);
         return $nl->show();
     }
diff --git a/_darcs/pristine/lib/subs.php b/_darcs/pristine/lib/subs.php
index 55e74e0b2..6fa1dcad3 100644
--- a/_darcs/pristine/lib/subs.php
+++ b/_darcs/pristine/lib/subs.php
@@ -25,7 +25,8 @@ require_once('XMPPHP/XMPP.php');
   Returns true or an error message.
 */
 
-function subs_subscribe_user($user, $other_nickname) {
+function subs_subscribe_user($user, $other_nickname)
+{
 
     $other = User::staticGet('nickname', $other_nickname);
 
@@ -41,7 +42,8 @@ function subs_subscribe_user($user, $other_nickname) {
  * Because the other way is quite a bit more complicated.
  */
 
-function subs_subscribe_to($user, $other) {
+function subs_subscribe_to($user, $other)
+{
 
     if ($user->isSubscribed($other)) {
         return _('Already subscribed!.');
@@ -82,14 +84,16 @@ function subs_subscribe_to($user, $other) {
     return true;
 }
 
-function subs_notify($listenee, $listener) {
+function subs_notify($listenee, $listener)
+{
     # XXX: add other notifications (Jabber, SMS) here
     # XXX: queue this and handle it offline
     # XXX: Whatever happens, do it in Twitter-like API, too
     subs_notify_email($listenee, $listener);
 }
 
-function subs_notify_email($listenee, $listener) {
+function subs_notify_email($listenee, $listener)
+{
     mail_subscribe_notify($listenee, $listener);
 }
 
@@ -97,7 +101,8 @@ function subs_notify_email($listenee, $listener) {
   Returns true or an error message.
 */
 
-function subs_unsubscribe_user($user, $other_nickname) {
+function subs_unsubscribe_user($user, $other_nickname)
+{
 
     $other = User::staticGet('nickname', $other_nickname);
 
@@ -111,7 +116,8 @@ function subs_unsubscribe_user($user, $other_nickname) {
 /* Unsubscribe user $user from profile $other
  * NB: other can be a remote user. */
 
-function subs_unsubscribe_to($user, $other) {
+function subs_unsubscribe_to($user, $other)
+{
 
     if (!$user->isSubscribed($other))
         return _('Not subscribed!.');
diff --git a/_darcs/pristine/lib/theme.php b/_darcs/pristine/lib/theme.php
index 346cff434..6f365bd99 100644
--- a/_darcs/pristine/lib/theme.php
+++ b/_darcs/pristine/lib/theme.php
@@ -19,12 +19,14 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-function theme_file($relative) {
+function theme_file($relative)
+{
     $theme = common_config('site', 'theme');
     return INSTALLDIR.'/theme/'.$theme.'/'.$relative;
 }
 
-function theme_path($relative) {
+function theme_path($relative)
+{
     $theme = common_config('site', 'theme');
     $server = common_config('theme', 'server');
     if ($server) {
diff --git a/_darcs/pristine/lib/twitter.php b/_darcs/pristine/lib/twitter.php
index 1212875ea..07871fb20 100644
--- a/_darcs/pristine/lib/twitter.php
+++ b/_darcs/pristine/lib/twitter.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-function get_twitter_data($uri, $screen_name, $password) {
+function get_twitter_data($uri, $screen_name, $password)
+{
 
     $options = array(
             CURLOPT_USERPWD => sprintf("%s:%s", $screen_name, $password),
@@ -48,7 +49,8 @@ function get_twitter_data($uri, $screen_name, $password) {
     return $data;
 }
 
-function twitter_user_info($screen_name, $password) {
+function twitter_user_info($screen_name, $password)
+{
 
     $uri = "http://twitter.com/users/show/$screen_name.json";
     $data = get_twitter_data($uri, $screen_name, $password);
@@ -66,7 +68,8 @@ function twitter_user_info($screen_name, $password) {
     return $twit_user;
 }
 
-function update_twitter_user($fuser, $twitter_id, $screen_name) {
+function update_twitter_user($fuser, $twitter_id, $screen_name)
+{
 
     $original = clone($fuser);
     $fuser->nickname = $screen_name;
@@ -81,7 +84,8 @@ function update_twitter_user($fuser, $twitter_id, $screen_name) {
     return true;
 }
 
-function add_twitter_user($twitter_id, $screen_name) {
+function add_twitter_user($twitter_id, $screen_name)
+{
 
     // Otherwise, create a new Twitter user
     $fuser = DB_DataObject::factory('foreign_user');
@@ -105,7 +109,8 @@ function add_twitter_user($twitter_id, $screen_name) {
 }
 
 // Creates or Updates a Twitter user
-function save_twitter_user($twitter_id, $screen_name) {
+function save_twitter_user($twitter_id, $screen_name)
+{
 
     // Check to see whether the Twitter user is already in the system,
     // and update its screen name and uri if so.
@@ -129,7 +134,8 @@ function save_twitter_user($twitter_id, $screen_name) {
     return true;
 }
 
-function retreive_twitter_friends($twitter_id, $screen_name, $password) {
+function retreive_twitter_friends($twitter_id, $screen_name, $password)
+{
 
     $uri = "http://twitter.com/statuses/friends/$twitter_id.json?page=";
     $twitter_user = twitter_user_info($screen_name, $password);
@@ -163,7 +169,8 @@ function retreive_twitter_friends($twitter_id, $screen_name, $password) {
     return $friends;
 }
 
-function save_twitter_friends($user, $twitter_id, $screen_name, $password) {
+function save_twitter_friends($user, $twitter_id, $screen_name, $password)
+{
 
     $friends = retreive_twitter_friends($twitter_id, $screen_name, $password);
 
diff --git a/_darcs/pristine/lib/twitterapi.php b/_darcs/pristine/lib/twitterapi.php
index ed86c77c4..3cddfa9c9 100644
--- a/_darcs/pristine/lib/twitterapi.php
+++ b/_darcs/pristine/lib/twitterapi.php
@@ -23,11 +23,13 @@ class TwitterapiAction extends Action {
 
     var $auth_user;
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
     }
 
-    function twitter_user_array($profile, $get_notice=false) {
+    function twitter_user_array($profile, $get_notice=false)
+    {
 
         $twitter_user = array();
 
@@ -55,7 +57,8 @@ class TwitterapiAction extends Action {
         return $twitter_user;
     }
 
-    function twitter_status_array($notice, $include_user=true) {
+    function twitter_status_array($notice, $include_user=true)
+    {
 
         $profile = $notice->getProfile();
 
@@ -83,7 +86,8 @@ class TwitterapiAction extends Action {
         return $twitter_status;
     }
 
-    function twitter_rss_entry_array($notice) {
+    function twitter_rss_entry_array($notice)
+    {
 
         $profile = $notice->getProfile();
 
@@ -107,7 +111,8 @@ class TwitterapiAction extends Action {
         return $entry;
     }
 
-    function twitter_rss_dmsg_array($message) {
+    function twitter_rss_dmsg_array($message)
+    {
 
         $server = common_config('site', 'server');
         $entry = array();
@@ -129,7 +134,8 @@ class TwitterapiAction extends Action {
         return $entry;
     }
 
-    function twitter_dmsg_array($message) {
+    function twitter_dmsg_array($message)
+    {
 
         $twitter_dm = array();
 
@@ -149,7 +155,8 @@ class TwitterapiAction extends Action {
         return $twitter_dm;
     }
 
-    function show_twitter_xml_status($twitter_status) {
+    function show_twitter_xml_status($twitter_status)
+    {
         common_element_start('status');
         foreach($twitter_status as $element => $value) {
             switch ($element) {
@@ -166,7 +173,8 @@ class TwitterapiAction extends Action {
         common_element_end('status');
     }
 
-    function show_twitter_xml_user($twitter_user, $role='user') {
+    function show_twitter_xml_user($twitter_user, $role='user')
+    {
         common_element_start($role);
         foreach($twitter_user as $element => $value) {
             if ($element == 'status') {
@@ -178,7 +186,8 @@ class TwitterapiAction extends Action {
         common_element_end($role);
     }
 
-    function show_twitter_rss_item($entry) {
+    function show_twitter_rss_item($entry)
+    {
         common_element_start('item');
         common_element('title', null, $entry['title']);
         common_element('description', null, $entry['description']);
@@ -188,7 +197,8 @@ class TwitterapiAction extends Action {
         common_element_end('item');
     }
 
-    function show_twitter_atom_entry($entry) {
+    function show_twitter_atom_entry($entry)
+    {
         common_element_start('entry');
         common_element('title', null, $entry['title']);
         common_element('content', array('type' => 'html'), $entry['content']);
@@ -199,39 +209,45 @@ class TwitterapiAction extends Action {
         common_element_end('entry');
     }
 
-    function show_json_objects($objects) {
+    function show_json_objects($objects)
+    {
         print(json_encode($objects));
     }
 
-    function show_single_xml_status($notice) {
+    function show_single_xml_status($notice)
+    {
         $this->init_document('xml');
         $twitter_status = $this->twitter_status_array($notice);
         $this->show_twitter_xml_status($twitter_status);
         $this->end_document('xml');
     }
 
-    function show_single_json_status($notice) {
+    function show_single_json_status($notice)
+    {
         $this->init_document('json');
         $status = $this->twitter_status_array($notice);
         $this->show_json_objects($status);
         $this->end_document('json');
     }
 
-    function show_single_xml_dmsg($message) {
+    function show_single_xml_dmsg($message)
+    {
         $this->init_document('xml');
         $dmsg = $this->twitter_dmsg_array($message);
         $this->show_twitter_xml_dmsg($dmsg);
         $this->end_document('xml');
     }
 
-    function show_single_json_dmsg($message) {
+    function show_single_json_dmsg($message)
+    {
         $this->init_document('json');
         $dmsg = $this->twitter_dmsg_array($message);
         $this->show_json_objects($dmsg);
         $this->end_document('json');
     }
 
-    function show_twitter_xml_dmsg($twitter_dm) {
+    function show_twitter_xml_dmsg($twitter_dm)
+    {
         common_element_start('direct_message');
         foreach($twitter_dm as $element => $value) {
             switch ($element) {
@@ -249,7 +265,8 @@ class TwitterapiAction extends Action {
         common_element_end('direct_message');
     }
 
-    function show_xml_timeline($notice) {
+    function show_xml_timeline($notice)
+    {
 
         $this->init_document('xml');
         common_element_start('statuses', array('type' => 'array'));
@@ -270,7 +287,8 @@ class TwitterapiAction extends Action {
         $this->end_document('xml');
     }
 
-    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null) {
+    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null)
+    {
 
         $this->init_document('rss');
 
@@ -304,7 +322,8 @@ class TwitterapiAction extends Action {
         $this->end_twitter_rss();
     }
 
-    function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null) {
+    function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null)
+    {
 
         $this->init_document('atom');
 
@@ -335,7 +354,8 @@ class TwitterapiAction extends Action {
 
     }
 
-    function show_json_timeline($notice) {
+    function show_json_timeline($notice)
+    {
 
         $this->init_document('json');
 
@@ -360,12 +380,14 @@ class TwitterapiAction extends Action {
 
     // Anyone know what date format this is?
     // Twitter's dates look like this: "Mon Jul 14 23:52:38 +0000 2008" -- Zach
-    function date_twitter($dt) {
+    function date_twitter($dt)
+    {
         $t = strtotime($dt);
         return date("D M d G:i:s O Y", $t);
     }
 
-    function replier_by_reply($reply_id) {
+    function replier_by_reply($reply_id)
+    {
         $notice = Notice::staticGet($reply_id);
         if ($notice) {
             $profile = $notice->getProfile();
@@ -381,7 +403,8 @@ class TwitterapiAction extends Action {
     }
 
     // XXX: Candidate for a general utility method somewhere?
-    function count_subscriptions($profile) {
+    function count_subscriptions($profile)
+    {
 
         $count = 0;
         $sub = new Subscription();
@@ -396,7 +419,8 @@ class TwitterapiAction extends Action {
         }
     }
 
-    function init_document($type='xml') {
+    function init_document($type='xml')
+    {
         switch ($type) {
          case 'xml':
             header('Content-Type: application/xml; charset=utf-8');
@@ -427,7 +451,8 @@ class TwitterapiAction extends Action {
         return;
     }
 
-    function end_document($type='xml') {
+    function end_document($type='xml')
+    {
         switch ($type) {
          case 'xml':
             common_end_xml();
@@ -453,7 +478,8 @@ class TwitterapiAction extends Action {
         return;
     }
 
-    function client_error($msg, $code = 400, $content_type = 'json') {
+    function client_error($msg, $code = 400, $content_type = 'json')
+    {
 
         static $status = array(400 => 'Bad Request',
                                401 => 'Unauthorized',
@@ -501,27 +527,32 @@ class TwitterapiAction extends Action {
 
     }
 
-    function init_twitter_rss() {
+    function init_twitter_rss()
+    {
         common_start_xml();
         common_element_start('rss', array('version' => '2.0'));
     }
 
-    function end_twitter_rss() {
+    function end_twitter_rss()
+    {
         common_element_end('rss');
         common_end_xml();
     }
 
-    function init_twitter_atom() {
+    function init_twitter_atom()
+    {
         common_start_xml();
         common_element_start('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', 'xml:lang' => 'en-US'));
     }
 
-    function end_twitter_atom() {
+    function end_twitter_atom()
+    {
         common_end_xml();
         common_element_end('feed');
     }
 
-    function show_profile($profile, $content_type='xml', $notice=null) {
+    function show_profile($profile, $content_type='xml', $notice=null)
+    {
         $profile_array = $this->twitter_user_array($profile, true);
         switch ($content_type) {
          case 'xml':
@@ -537,7 +568,8 @@ class TwitterapiAction extends Action {
         return;
     }
 
-    function get_user($id, $apidata=null) {
+    function get_user($id, $apidata=null)
+    {
         if (!$id) {
             return $apidata['user'];
         } else if (is_numeric($id)) {
@@ -548,7 +580,8 @@ class TwitterapiAction extends Action {
         }
     }
 
-    function get_profile($id) {
+    function get_profile($id)
+    {
         if (is_numeric($id)) {
             return Profile::staticGet($id);
         } else {
@@ -561,7 +594,8 @@ class TwitterapiAction extends Action {
         }
     }
 
-    function source_link($source) {
+    function source_link($source)
+    {
         $source_name = _($source);
         switch ($source) {
          case 'web':
@@ -580,7 +614,8 @@ class TwitterapiAction extends Action {
         return $source_name;
     }
 
-    function show_extended_profile($user, $apidata) {
+    function show_extended_profile($user, $apidata)
+    {
 
         $this->auth_user = $apidata['user'];
 
diff --git a/_darcs/pristine/lib/util.php b/_darcs/pristine/lib/util.php
index f0387ebe5..ed73b19e6 100644
--- a/_darcs/pristine/lib/util.php
+++ b/_darcs/pristine/lib/util.php
@@ -21,7 +21,8 @@
 
 // Show a server error
 
-function common_server_error($msg, $code=500) {
+function common_server_error($msg, $code=500)
+{
     static $status = array(500 => 'Internal Server Error',
                            501 => 'Not Implemented',
                            502 => 'Bad Gateway',
@@ -44,7 +45,8 @@ function common_server_error($msg, $code=500) {
 }
 
 // Show a user error
-function common_user_error($msg, $code=400) {
+function common_user_error($msg, $code=400)
+{
     static $status = array(400 => 'Bad Request',
                            401 => 'Unauthorized',
                            402 => 'Payment Required',
@@ -80,7 +82,8 @@ function common_user_error($msg, $code=400) {
 $xw = null;
 
 // Start an HTML element
-function common_element_start($tag, $attrs=null) {
+function common_element_start($tag, $attrs=null)
+{
     global $xw;
     $xw->startElement($tag);
     if (is_array($attrs)) {
@@ -92,7 +95,8 @@ function common_element_start($tag, $attrs=null) {
     }
 }
 
-function common_element_end($tag) {
+function common_element_end($tag)
+{
     static $empty_tag = array('base', 'meta', 'link', 'hr',
                               'br', 'param', 'img', 'area',
                               'input', 'col');
@@ -105,7 +109,8 @@ function common_element_end($tag) {
     }
 }
 
-function common_element($tag, $attrs=null, $content=null) {
+function common_element($tag, $attrs=null, $content=null)
+{
     common_element_start($tag, $attrs);
     global $xw;
     if (!is_null($content)) {
@@ -114,7 +119,8 @@ function common_element($tag, $attrs=null, $content=null) {
     common_element_end($tag);
 }
 
-function common_start_xml($doc=null, $public=null, $system=null, $indent=true) {
+function common_start_xml($doc=null, $public=null, $system=null, $indent=true)
+{
     global $xw;
     $xw = new XMLWriter();
     $xw->openURI('php://output');
@@ -125,13 +131,15 @@ function common_start_xml($doc=null, $public=null, $system=null, $indent=true) {
     }
 }
 
-function common_end_xml() {
+function common_end_xml()
+{
     global $xw;
     $xw->endDocument();
     $xw->flush();
 }
 
-function common_init_locale($language=null) {
+function common_init_locale($language=null)
+{
     if(!$language) {
         $language = common_language();
     }
@@ -144,7 +152,8 @@ function common_init_locale($language=null) {
                      $language);
 }
 
-function common_init_language() {
+function common_init_language()
+{
     mb_internal_encoding('UTF-8');
     $language = common_language();
     // So we don't have to make people install the gettext locales
@@ -160,7 +169,8 @@ function common_init_language() {
 
 define('PAGE_TYPE_PREFS', 'text/html,application/xhtml+xml,application/xml;q=0.3,text/xml;q=0.2');
 
-function common_show_header($pagetitle, $callable=null, $data=null, $headercall=null) {
+function common_show_header($pagetitle, $callable=null, $data=null, $headercall=null)
+{
 
     global $config, $xw;
     global $action; /* XXX: kind of cheating here. */
@@ -243,7 +253,8 @@ function common_show_header($pagetitle, $callable=null, $data=null, $headercall=
     common_element_start('div', array('id' => 'content'));
 }
 
-function common_start_html($type=null, $indent=true) {
+function common_start_html($type=null, $indent=true)
+{
 
     if (!$type) {
         $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
@@ -274,7 +285,8 @@ function common_start_html($type=null, $indent=true) {
                                        'lang' => $language));
 }
 
-function common_show_footer() {
+function common_show_footer()
+{
     global $xw, $config;
     common_element_end('div'); // content div
     common_foot_menu();
@@ -307,17 +319,20 @@ function common_show_footer() {
     common_end_xml();
 }
 
-function common_text($txt) {
+function common_text($txt)
+{
     global $xw;
     $xw->text($txt);
 }
 
-function common_raw($xml) {
+function common_raw($xml)
+{
     global $xw;
     $xw->writeRaw($xml);
 }
 
-function common_nav_menu() {
+function common_nav_menu()
+{
     $user = common_current_user();
     common_element_start('ul', array('id' => 'nav'));
     if ($user) {
@@ -344,7 +359,8 @@ function common_nav_menu() {
     common_element_end('ul');
 }
 
-function common_foot_menu() {
+function common_foot_menu()
+{
     common_element_start('ul', array('id' => 'nav_sub'));
     common_menu_item(common_local_url('doc', array('title' => 'help')),
                      _('Help'));
@@ -361,7 +377,8 @@ function common_foot_menu() {
     common_element_end('ul');
 }
 
-function common_menu_item($url, $text, $title=null, $is_selected=false) {
+function common_menu_item($url, $text, $title=null, $is_selected=false)
+{
     $lattrs = array();
     if ($is_selected) {
         $lattrs['class'] = 'current';
@@ -375,7 +392,8 @@ function common_menu_item($url, $text, $title=null, $is_selected=false) {
     common_element_end('li');
 }
 
-function common_input($id, $label, $value=null,$instructions=null) {
+function common_input($id, $label, $value=null,$instructions=null)
+{
     common_element_start('p');
     common_element('label', array('for' => $id), $label);
     $attrs = array('name' => $id,
@@ -418,7 +436,8 @@ function common_checkbox($id, $label, $checked=false, $instructions=null, $value
     common_element_end('p');
 }
 
-function common_dropdown($id, $label, $content, $instructions=null, $blank_select=FALSE, $selected=null) {
+function common_dropdown($id, $label, $content, $instructions=null, $blank_select=FALSE, $selected=null)
+{
     common_element_start('p');
     common_element('label', array('for' => $id), $label);
     common_element_start('select', array('id' => $id, 'name' => $id));
@@ -438,14 +457,16 @@ function common_dropdown($id, $label, $content, $instructions=null, $blank_selec
     }
     common_element_end('p');
 }
-function common_hidden($id, $value) {
+function common_hidden($id, $value)
+{
     common_element('input', array('name' => $id,
                                   'type' => 'hidden',
                                   'id' => $id,
                                   'value' => $value));
 }
 
-function common_password($id, $label, $instructions=null) {
+function common_password($id, $label, $instructions=null)
+{
     common_element_start('p');
     common_element('label', array('for' => $id), $label);
     $attrs = array('name' => $id,
@@ -459,7 +480,8 @@ function common_password($id, $label, $instructions=null) {
     common_element_end('p');
 }
 
-function common_submit($id, $label, $cls='submit') {
+function common_submit($id, $label, $cls='submit')
+{
     global $xw;
     common_element_start('p');
     common_element('input', array('type' => 'submit',
@@ -470,7 +492,8 @@ function common_submit($id, $label, $cls='submit') {
     common_element_end('p');
 }
 
-function common_textarea($id, $label, $content=null, $instructions=null) {
+function common_textarea($id, $label, $content=null, $instructions=null)
+{
     common_element_start('p');
     common_element('label', array('for' => $id), $label);
     common_element('textarea', array('rows' => 3,
@@ -484,7 +507,8 @@ function common_textarea($id, $label, $content=null, $instructions=null) {
     common_element_end('p');
 }
 
-function common_timezone() {
+function common_timezone()
+{
     if (common_logged_in()) {
         $user = common_current_user();
         if ($user->timezone) {
@@ -496,7 +520,8 @@ function common_timezone() {
     return $config['site']['timezone'];
 }
 
-function common_language() {
+function common_language()
+{
 
     // If there is a user logged in and they've set a language preference
     // then return that one...
@@ -521,12 +546,14 @@ function common_language() {
 }
 // salted, hashed passwords are stored in the DB
 
-function common_munge_password($password, $id) {
+function common_munge_password($password, $id)
+{
     return md5($password . $id);
 }
 
 // check if a username exists and has matching password
-function common_check_user($nickname, $password) {
+function common_check_user($nickname, $password)
+{
     // NEVER allow blank passwords, even if they match the DB
     if (mb_strlen($password) == 0) {
         return false;
@@ -545,15 +572,18 @@ function common_check_user($nickname, $password) {
 }
 
 // is the current user logged in?
-function common_logged_in() {
+function common_logged_in()
+{
     return (!is_null(common_current_user()));
 }
 
-function common_have_session() {
+function common_have_session()
+{
     return (0 != strcmp(session_id(), ''));
 }
 
-function common_ensure_session() {
+function common_ensure_session()
+{
     if (!common_have_session()) {
         @session_start();
     }
@@ -568,7 +598,8 @@ function common_ensure_session() {
 
 $_cur = false;
 
-function common_set_user($user) {
+function common_set_user($user)
+{
 
     global $_cur;
 
@@ -592,7 +623,8 @@ function common_set_user($user) {
     return false;
 }
 
-function common_set_cookie($key, $value, $expiration=0) {
+function common_set_cookie($key, $value, $expiration=0)
+{
     $path = common_config('site', 'path');
     $server = common_config('site', 'server');
 
@@ -611,7 +643,8 @@ function common_set_cookie($key, $value, $expiration=0) {
 define('REMEMBERME', 'rememberme');
 define('REMEMBERME_EXPIRY', 30 * 24 * 60 * 60); // 30 days
 
-function common_rememberme($user=null) {
+function common_rememberme($user=null)
+{
     if (!$user) {
         $user = common_current_user();
         if (!$user) {
@@ -650,7 +683,8 @@ function common_rememberme($user=null) {
     return true;
 }
 
-function common_remembered_user() {
+function common_remembered_user()
+{
 
     $user = null;
 
@@ -715,12 +749,14 @@ function common_remembered_user() {
 
 // must be called with a valid user!
 
-function common_forgetme() {
+function common_forgetme()
+{
     common_set_cookie(REMEMBERME, '', 0);
 }
 
 // who is the current user?
-function common_current_user() {
+function common_current_user()
+{
     global $_cur;
 
     if ($_cur === false) {
@@ -752,23 +788,27 @@ function common_current_user() {
 // cookie-stealing. So, we don't let them do certain things. New reg,
 // OpenID, and password logins _are_ real.
 
-function common_real_login($real=true) {
+function common_real_login($real=true)
+{
     common_ensure_session();
     $_SESSION['real_login'] = $real;
 }
 
-function common_is_real_login() {
+function common_is_real_login()
+{
     return common_logged_in() && $_SESSION['real_login'];
 }
 
 // get canonical version of nickname for comparison
-function common_canonical_nickname($nickname) {
+function common_canonical_nickname($nickname)
+{
     // XXX: UTF-8 canonicalization (like combining chars)
     return strtolower($nickname);
 }
 
 // get canonical version of email for comparison
-function common_canonical_email($email) {
+function common_canonical_email($email)
+{
     // XXX: canonicalize UTF-8
     // XXX: lcase the domain part
     return $email;
@@ -776,7 +816,8 @@ function common_canonical_email($email) {
 
 define('URL_REGEX', '^|[ \t\r\n])((ftp|http|https|gopher|mailto|news|nntp|telnet|wais|file|prospero|aim|webcal):(([A-Za-z0-9$_.+!*(),;/?:@&~=-])|%[A-Fa-f0-9]{2}){2,}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?:@&~=%-]*))?([A-Za-z0-9$_+!*();/?:~-]))');
 
-function common_render_content($text, $notice) {
+function common_render_content($text, $notice)
+{
     $r = common_render_text($text);
     $id = $notice->profile_id;
     $r = preg_replace('/(^|\s+)@([A-Za-z0-9]{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r);
@@ -785,7 +826,8 @@ function common_render_content($text, $notice) {
     return $r;
 }
 
-function common_render_text($text) {
+function common_render_text($text)
+{
     $r = htmlspecialchars($text);
 
     $r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r);
@@ -795,7 +837,8 @@ function common_render_text($text) {
     return $r;
 }
 
-function common_render_uri_thingy($matches) {
+function common_render_uri_thingy($matches)
+{
     $uri = $matches[0];
     $trailer = '';
 
@@ -829,20 +872,23 @@ function common_render_uri_thingy($matches) {
     return '<a href="' . $uri . '"' . $title . ' class="extlink">' . $uri . '</a>' . $trailer;
 }
 
-function common_longurl($short_url)  {
+function common_longurl($short_url)
+{
     $long_url = common_shorten_link($short_url, true);
     if ($long_url === $short_url) return false;
     return $long_url;
 }
 
-function common_longurl2($uri)  {
+function common_longurl2($uri)
+{
     $uri_e = urlencode($uri);
     $longurl = unserialize(file_get_contents("http://api.longurl.org/v1/expand?format=php&url=$uri_e"));
     if (empty($longurl['long_url']) || $uri === $longurl['long_url']) return false;
     return stripslashes($longurl['long_url']);
 }
 
-function common_shorten_links($text) {
+function common_shorten_links($text)
+{
     if (mb_strlen($text) <= 140) return $text;
     static $cache = array();
     if (isset($cache[$text])) return $cache[$text];
@@ -850,7 +896,8 @@ function common_shorten_links($text) {
     return $cache[$text] = preg_replace('@https?://[^)\]>\s]+@e', "common_shorten_link('\\0')", $text);
 }
 
-function common_shorten_link($url, $reverse = false) {
+function common_shorten_link($url, $reverse = false)
+{
     static $url_cache = array();
     if ($reverse) return isset($url_cache[$url]) ? $url_cache[$url] : $url;
 
@@ -911,28 +958,33 @@ function common_shorten_link($url, $reverse = false) {
     return $url;
 }
 
-function common_xml_safe_str($str) {
+function common_xml_safe_str($str)
+{
     $xmlStr = htmlentities(iconv('UTF-8', 'UTF-8//IGNORE', $str), ENT_NOQUOTES, 'UTF-8');
 
     // Replace control, formatting, and surrogate characters with '*', ala Twitter
     return preg_replace('/[\p{Cc}\p{Cf}\p{Cs}]/u', '*', $str);
 }
 
-function common_tag_link($tag) {
+function common_tag_link($tag)
+{
     $canonical = common_canonical_tag($tag);
     $url = common_local_url('tag', array('tag' => $canonical));
     return '<a href="' . htmlspecialchars($url) . '" rel="tag" class="hashlink">' . htmlspecialchars($tag) . '</a>';
 }
 
-function common_canonical_tag($tag) {
+function common_canonical_tag($tag)
+{
     return strtolower(str_replace(array('-', '_', '.'), '', $tag));
 }
 
-function common_valid_profile_tag($str) {
+function common_valid_profile_tag($str)
+{
     return preg_match('/^[A-Za-z0-9_\-\.]{1,64}$/', $str);
 }
 
-function common_at_link($sender_id, $nickname) {
+function common_at_link($sender_id, $nickname)
+{
     $sender = Profile::staticGet($sender_id);
     $recipient = common_relative_profile($sender, common_canonical_nickname($nickname));
     if ($recipient) {
@@ -942,7 +994,8 @@ function common_at_link($sender_id, $nickname) {
     }
 }
 
-function common_at_hash_link($sender_id, $tag) {
+function common_at_hash_link($sender_id, $tag)
+{
     $user = User::staticGet($sender_id);
     if (!$user) {
         return $tag;
@@ -958,7 +1011,8 @@ function common_at_hash_link($sender_id, $tag) {
     }
 }
 
-function common_relative_profile($sender, $nickname, $dt=null) {
+function common_relative_profile($sender, $nickname, $dt=null)
+{
     // Try to find profiles this profile is subscribed to that have this nickname
     $recipient = new Profile();
     // XXX: use a join instead of a subquery
@@ -995,7 +1049,8 @@ function common_relative_profile($sender, $nickname, $dt=null) {
 
 // where should the avatar go for this user?
 
-function common_avatar_filename($id, $extension, $size=null, $extra=null) {
+function common_avatar_filename($id, $extension, $size=null, $extra=null)
+{
     global $config;
 
     if ($size) {
@@ -1005,16 +1060,19 @@ function common_avatar_filename($id, $extension, $size=null, $extra=null) {
     }
 }
 
-function common_avatar_path($filename) {
+function common_avatar_path($filename)
+{
     global $config;
     return INSTALLDIR . '/avatar/' . $filename;
 }
 
-function common_avatar_url($filename) {
+function common_avatar_url($filename)
+{
     return common_path('avatar/'.$filename);
 }
 
-function common_avatar_display_url($avatar) {
+function common_avatar_display_url($avatar)
+{
     $server = common_config('avatar', 'server');
     if ($server) {
         return 'http://'.$server.'/'.$avatar->filename;
@@ -1023,14 +1081,16 @@ function common_avatar_display_url($avatar) {
     }
 }
 
-function common_default_avatar($size) {
+function common_default_avatar($size)
+{
     static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile',
                               AVATAR_STREAM_SIZE => 'stream',
                               AVATAR_MINI_SIZE => 'mini');
     return theme_path('default-avatar-'.$sizenames[$size].'.png');
 }
 
-function common_local_url($action, $args=null, $fragment=null) {
+function common_local_url($action, $args=null, $fragment=null)
+{
     $url = null;
     if (common_config('site','fancy')) {
         $url = common_fancy_url($action, $args);
@@ -1043,7 +1103,8 @@ function common_local_url($action, $args=null, $fragment=null) {
     return $url;
 }
 
-function common_fancy_url($action, $args=null) {
+function common_fancy_url($action, $args=null)
+{
     switch (strtolower($action)) {
      case 'public':
         if ($args && isset($args['page'])) {
@@ -1256,7 +1317,8 @@ function common_fancy_url($action, $args=null) {
     }
 }
 
-function common_simple_url($action, $args=null) {
+function common_simple_url($action, $args=null)
+{
     global $config;
     /* XXX: pretty URLs */
     $extra = '';
@@ -1268,13 +1330,15 @@ function common_simple_url($action, $args=null) {
     return common_path("index.php?action=${action}${extra}");
 }
 
-function common_path($relative) {
+function common_path($relative)
+{
     global $config;
     $pathpart = ($config['site']['path']) ? $config['site']['path']."/" : '';
     return "http://".$config['site']['server'].'/'.$pathpart.$relative;
 }
 
-function common_date_string($dt) {
+function common_date_string($dt)
+{
     // XXX: do some sexy date formatting
     // return date(DATE_RFC822, $dt);
     $t = strtotime($dt);
@@ -1308,7 +1372,8 @@ function common_date_string($dt) {
     }
 }
 
-function common_exact_date($dt) {
+function common_exact_date($dt)
+{
     static $_utc;
     static $_siteTz;
 
@@ -1323,32 +1388,37 @@ function common_exact_date($dt) {
     return $d->format(DATE_RFC850);
 }
 
-function common_date_w3dtf($dt) {
+function common_date_w3dtf($dt)
+{
     $dateStr = date('d F Y H:i:s', strtotime($dt));
     $d = new DateTime($dateStr, new DateTimeZone('UTC'));
     $d->setTimezone(new DateTimeZone(common_timezone()));
     return $d->format(DATE_W3C);
 }
 
-function common_date_rfc2822($dt) {
+function common_date_rfc2822($dt)
+{
     $dateStr = date('d F Y H:i:s', strtotime($dt));
     $d = new DateTime($dateStr, new DateTimeZone('UTC'));
     $d->setTimezone(new DateTimeZone(common_timezone()));
     return $d->format('r');
 }
 
-function common_date_iso8601($dt) {
+function common_date_iso8601($dt)
+{
     $dateStr = date('d F Y H:i:s', strtotime($dt));
     $d = new DateTime($dateStr, new DateTimeZone('UTC'));
     $d->setTimezone(new DateTimeZone(common_timezone()));
     return $d->format('c');
 }
 
-function common_sql_now() {
+function common_sql_now()
+{
     return strftime('%Y-%m-%d %H:%M:%S', time());
 }
 
-function common_redirect($url, $code=307) {
+function common_redirect($url, $code=307)
+{
     static $status = array(301 => "Moved Permanently",
                            302 => "Found",
                            303 => "See Other",
@@ -1364,7 +1434,8 @@ function common_redirect($url, $code=307) {
     exit;
 }
 
-function common_save_replies($notice) {
+function common_save_replies($notice)
+{
     // Alternative reply format
     $tname = false;
     if (preg_match('/^T ([A-Z0-9]{1,64}) /', $notice->content, $match)) {
@@ -1447,7 +1518,8 @@ function common_save_replies($notice) {
     }
 }
 
-function common_broadcast_notice($notice, $remote=false) {
+function common_broadcast_notice($notice, $remote=false)
+{
 
     // Check to see if notice should go to Twitter
     $flink = Foreign_link::getByUserID($notice->profile_id, 1); // 1 == Twitter
@@ -1474,7 +1546,8 @@ function common_broadcast_notice($notice, $remote=false) {
     }
 }
 
-function common_twitter_broadcast($notice, $flink) {
+function common_twitter_broadcast($notice, $flink)
+{
     global $config;
     $success = true;
     $fuser = $flink->getForeignUser();
@@ -1534,7 +1607,8 @@ function common_twitter_broadcast($notice, $flink) {
 
 // Stick the notice on the queue
 
-function common_enqueue_notice($notice) {
+function common_enqueue_notice($notice)
+{
     foreach (array('jabber', 'omb', 'sms', 'public') as $transport) {
         $qi = new Queue_item();
         $qi->notice_id = $notice->id;
@@ -1551,7 +1625,8 @@ function common_enqueue_notice($notice) {
     return $result;
 }
 
-function common_dequeue_notice($notice) {
+function common_dequeue_notice($notice)
+{
     $qi = Queue_item::staticGet($notice->id);
     if ($qi) {
         $result = $qi->delete();
@@ -1567,7 +1642,8 @@ function common_dequeue_notice($notice) {
     }
 }
 
-function common_real_broadcast($notice, $remote=false) {
+function common_real_broadcast($notice, $remote=false)
+{
     $success = true;
     if (!$remote) {
         // Make sure we have the OMB stuff
@@ -1601,7 +1677,8 @@ function common_real_broadcast($notice, $remote=false) {
     return $success;
 }
 
-function common_broadcast_profile($profile) {
+function common_broadcast_profile($profile)
+{
     // XXX: optionally use a queue system like http://code.google.com/p/microapps/wiki/NQDQ
     require_once(INSTALLDIR.'/lib/omb.php');
     omb_broadcast_profile($profile);
@@ -1609,13 +1686,15 @@ function common_broadcast_profile($profile) {
     return true;
 }
 
-function common_profile_url($nickname) {
+function common_profile_url($nickname)
+{
     return common_local_url('showstream', array('nickname' => $nickname));
 }
 
 // Don't call if nobody's logged in
 
-function common_notice_form($action=null, $content=null) {
+function common_notice_form($action=null, $content=null)
+{
     $user = common_current_user();
     assert(!is_null($user));
     common_element_start('form', array('id' => 'status_form',
@@ -1647,14 +1726,16 @@ function common_notice_form($action=null, $content=null) {
 
 // Should make up a reasonable root URL
 
-function common_root_url() {
+function common_root_url()
+{
     return common_path('');
 }
 
 // returns $bytes bytes of random data as a hexadecimal string
 // "good" here is a goal and not a guarantee
 
-function common_good_rand($bytes) {
+function common_good_rand($bytes)
+{
     // XXX: use random.org...?
     if (file_exists('/dev/urandom')) {
         return common_urandom($bytes);
@@ -1663,7 +1744,8 @@ function common_good_rand($bytes) {
     }
 }
 
-function common_urandom($bytes) {
+function common_urandom($bytes)
+{
     $h = fopen('/dev/urandom', 'rb');
     // should not block
     $src = fread($h, $bytes);
@@ -1675,7 +1757,8 @@ function common_urandom($bytes) {
     return $enc;
 }
 
-function common_mtrand($bytes) {
+function common_mtrand($bytes)
+{
     $enc = '';
     for ($i = 0; $i < $bytes; $i++) {
         $enc .= sprintf("%02x", mt_rand(0, 255));
@@ -1683,21 +1766,25 @@ function common_mtrand($bytes) {
     return $enc;
 }
 
-function common_set_returnto($url) {
+function common_set_returnto($url)
+{
     common_ensure_session();
     $_SESSION['returnto'] = $url;
 }
 
-function common_get_returnto() {
+function common_get_returnto()
+{
     common_ensure_session();
     return $_SESSION['returnto'];
 }
 
-function common_timestamp() {
+function common_timestamp()
+{
     return date('YmdHis');
 }
 
-function common_ensure_syslog() {
+function common_ensure_syslog()
+{
     static $initialized = false;
     if (!$initialized) {
         global $config;
@@ -1706,7 +1793,8 @@ function common_ensure_syslog() {
     }
 }
 
-function common_log($priority, $msg, $filename=null) {
+function common_log($priority, $msg, $filename=null)
+{
     $logfile = common_config('site', 'logfile');
     if ($logfile) {
         $log = fopen($logfile, "a");
@@ -1723,7 +1811,8 @@ function common_log($priority, $msg, $filename=null) {
     }
 }
 
-function common_debug($msg, $filename=null) {
+function common_debug($msg, $filename=null)
+{
     if ($filename) {
         common_log(LOG_DEBUG, basename($filename).' - '.$msg);
     } else {
@@ -1731,13 +1820,15 @@ function common_debug($msg, $filename=null) {
     }
 }
 
-function common_log_db_error(&$object, $verb, $filename=null) {
+function common_log_db_error(&$object, $verb, $filename=null)
+{
     $objstr = common_log_objstring($object);
     $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
     common_log(LOG_ERR, $last_error->message . '(' . $verb . ' on ' . $objstr . ')', $filename);
 }
 
-function common_log_objstring(&$object) {
+function common_log_objstring(&$object)
+{
     if (is_null($object)) {
         return "null";
     }
@@ -1750,11 +1841,13 @@ function common_log_objstring(&$object) {
     return $objstring;
 }
 
-function common_valid_http_url($url) {
+function common_valid_http_url($url)
+{
     return Validate::uri($url, array('allowed_schemes' => array('http', 'https')));
 }
 
-function common_valid_tag($tag) {
+function common_valid_tag($tag)
+{
     if (preg_match('/^tag:(.*?),(\d{4}(-\d{2}(-\d{2})?)?):(.*)$/', $tag, $matches)) {
         return (Validate::email($matches[1]) ||
                 preg_match('/^([\w-\.]+)$/', $matches[1]));
@@ -1764,7 +1857,8 @@ function common_valid_tag($tag) {
 
 // Does a little before-after block for next/prev page
 
-function common_pagination($have_before, $have_after, $page, $action, $args=null) {
+function common_pagination($have_before, $have_after, $page, $action, $args=null)
+{
 
     if ($have_before || $have_after) {
         common_element_start('div', array('id' => 'pagination'));
@@ -1799,7 +1893,8 @@ function common_pagination($have_before, $have_after, $page, $action, $args=null
 /* Following functions are copied from MediaWiki GlobalFunctions.php
  * and written by Evan Prodromou. */
 
-function common_accept_to_prefs($accept, $def = '*/*') {
+function common_accept_to_prefs($accept, $def = '*/*')
+{
     // No arg means accept anything (per HTTP spec)
     if(!$accept) {
         return array($def => 1);
@@ -1823,7 +1918,8 @@ function common_accept_to_prefs($accept, $def = '*/*') {
     return $prefs;
 }
 
-function common_mime_type_match($type, $avail) {
+function common_mime_type_match($type, $avail)
+{
     if(array_key_exists($type, $avail)) {
         return $type;
     } else {
@@ -1838,7 +1934,8 @@ function common_mime_type_match($type, $avail) {
     }
 }
 
-function common_negotiate_type($cprefs, $sprefs) {
+function common_negotiate_type($cprefs, $sprefs)
+{
     $combine = array();
 
     foreach(array_keys($sprefs) as $type) {
@@ -1874,12 +1971,14 @@ function common_negotiate_type($cprefs, $sprefs) {
     return $besttype;
 }
 
-function common_config($main, $sub) {
+function common_config($main, $sub)
+{
     global $config;
     return isset($config[$main][$sub]) ? $config[$main][$sub] : false;
 }
 
-function common_copy_args($from) {
+function common_copy_args($from)
+{
     $to = array();
     $strip = get_magic_quotes_gpc();
     foreach ($from as $k => $v) {
@@ -1890,25 +1989,29 @@ function common_copy_args($from) {
 
 // Neutralise the evil effects of magic_quotes_gpc in the current request.
 // This is used before handing a request off to OAuthRequest::from_request.
-function common_remove_magic_from_request() {
+function common_remove_magic_from_request()
+{
     if(get_magic_quotes_gpc()) {
         $_POST=array_map('stripslashes',$_POST);
         $_GET=array_map('stripslashes',$_GET);
     }
 }
 
-function common_user_uri(&$user) {
+function common_user_uri(&$user)
+{
     return common_local_url('userbyid', array('id' => $user->id));
 }
 
-function common_notice_uri(&$notice) {
+function common_notice_uri(&$notice)
+{
     return common_local_url('shownotice',
                             array('notice' => $notice->id));
 }
 
 // 36 alphanums - lookalikes (0, O, 1, I) = 32 chars = 5 bits
 
-function common_confirmation_code($bits) {
+function common_confirmation_code($bits)
+{
     // 36 alphanums - lookalikes (0, O, 1, I) = 32 chars = 5 bits
     static $codechars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ';
     $chars = ceil($bits/5);
@@ -1925,14 +2028,16 @@ function common_confirmation_code($bits) {
 
 // convert markup to HTML
 
-function common_markup_to_html($c) {
+function common_markup_to_html($c)
+{
     $c = preg_replace('/%%action.(\w+)%%/e', "common_local_url('\\1')", $c);
     $c = preg_replace('/%%doc.(\w+)%%/e', "common_local_url('doc', array('title'=>'\\1'))", $c);
     $c = preg_replace('/%%(\w+).(\w+)%%/e', 'common_config(\'\\1\', \'\\2\')', $c);
     return Markdown($c);
 }
 
-function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE) {
+function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE)
+{
     $avatar = $profile->getAvatar($size);
     if ($avatar) {
         return common_avatar_display_url($avatar);
@@ -1941,7 +2046,8 @@ function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE) {
     }
 }
 
-function common_profile_uri($profile) {
+function common_profile_uri($profile)
+{
     if (!$profile) {
         return null;
     }
@@ -1958,13 +2064,15 @@ function common_profile_uri($profile) {
     return null;
 }
 
-function common_canonical_sms($sms) {
+function common_canonical_sms($sms)
+{
     // strip non-digits
     preg_replace('/\D/', '', $sms);
     return $sms;
 }
 
-function common_error_handler($errno, $errstr, $errfile, $errline, $errcontext) {
+function common_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
+{
     switch ($errno) {
      case E_USER_ERROR:
         common_log(LOG_ERR, "[$errno] $errstr ($errfile:$errline)");
@@ -1985,7 +2093,8 @@ function common_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
     return true;
 }
 
-function common_session_token() {
+function common_session_token()
+{
     common_ensure_session();
     if (!array_key_exists('token', $_SESSION)) {
         $_SESSION['token'] = common_good_rand(64);
@@ -1993,7 +2102,8 @@ function common_session_token() {
     return $_SESSION['token'];
 }
 
-function common_disfavor_form($notice) {
+function common_disfavor_form($notice)
+{
     common_element_start('form', array('id' => 'disfavor-' . $notice->id,
                                        'method' => 'post',
                                        'class' => 'disfavor',
@@ -2020,7 +2130,8 @@ function common_disfavor_form($notice) {
     common_element_end('form');
 }
 
-function common_favor_form($notice) {
+function common_favor_form($notice)
+{
     common_element_start('form', array('id' => 'favor-' . $notice->id,
                                        'method' => 'post',
                                        'class' => 'favor',
@@ -2047,7 +2158,8 @@ function common_favor_form($notice) {
     common_element_end('form');
 }
 
-function common_nudge_form($profile) {
+function common_nudge_form($profile)
+{
     common_element_start('form', array('id' => 'nudge', 'method' => 'post',
                                        'action' => common_local_url('nudge', array('nickname' => $profile->nickname))));
     common_hidden('token', common_session_token());
@@ -2056,11 +2168,13 @@ function common_nudge_form($profile) {
                                   'value' => _('Send a nudge')));
     common_element_end('form');
 }
-function common_nudge_response() {
+function common_nudge_response()
+{
     common_element('p', array('id' => 'nudge_response'), _('Nudge sent!'));
 }
 
-function common_subscribe_form($profile) {
+function common_subscribe_form($profile)
+{
     common_element_start('form', array('id' => 'subscribe-' . $profile->id,
                                        'method' => 'post',
                                        'class' => 'subscribe',
@@ -2076,7 +2190,8 @@ function common_subscribe_form($profile) {
     common_element_end('form');
 }
 
-function common_unsubscribe_form($profile) {
+function common_unsubscribe_form($profile)
+{
     common_element_start('form', array('id' => 'unsubscribe-' . $profile->id,
                                        'method' => 'post',
                                        'class' => 'unsubscribe',
@@ -2093,7 +2208,8 @@ function common_unsubscribe_form($profile) {
 }
 
 // XXX: Refactor this code
-function common_profile_new_message_nudge ($cur, $profile) {
+function common_profile_new_message_nudge ($cur, $profile)
+{
     $user = User::staticGet('id', $profile->id);
 
     if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) {
@@ -2110,17 +2226,20 @@ function common_profile_new_message_nudge ($cur, $profile) {
     }
 }
 
-function common_cache_key($extra) {
+function common_cache_key($extra)
+{
     return 'laconica:' . common_keyize(common_config('site', 'name')) . ':' . $extra;
 }
 
-function common_keyize($str) {
+function common_keyize($str)
+{
     $str = strtolower($str);
     $str = preg_replace('/\s/', '_', $str);
     return $str;
 }
 
-function common_message_form($content, $user, $to) {
+function common_message_form($content, $user, $to)
+{
 
     common_element_start('form', array('id' => 'message_form',
                                        'method' => 'post',
@@ -2160,7 +2279,8 @@ function common_message_form($content, $user, $to) {
     common_element_end('form');
 }
 
-function common_memcache() {
+function common_memcache()
+{
     static $cache = null;
     if (!common_config('memcached', 'enabled')) {
         return null;
@@ -2180,22 +2300,26 @@ function common_memcache() {
     }
 }
 
-function common_compatible_license($from, $to) {
+function common_compatible_license($from, $to)
+{
     // XXX: better compatibility check needed here!
     return ($from == $to);
 }
 
 /* These are almost identical, so we use a helper function */
 
-function common_block_form($profile, $args=null) {
+function common_block_form($profile, $args=null)
+{
     common_blocking_form('block', _('Block'), $profile, $args);
 }
 
-function common_unblock_form($profile, $args=null) {
+function common_unblock_form($profile, $args=null)
+{
     common_blocking_form('unblock', _('Unblock'), $profile, $args);
 }
 
-function common_blocking_form($type, $label, $profile, $args=null) {
+function common_blocking_form($type, $label, $profile, $args=null)
+{
     common_element_start('form', array('id' => $type . '-' . $profile->id,
                                        'method' => 'post',
                                        'class' => $type,
diff --git a/_darcs/pristine/lib/xmppqueuehandler.php b/_darcs/pristine/lib/xmppqueuehandler.php
index 10c754a5b..0a73403f9 100644
--- a/_darcs/pristine/lib/xmppqueuehandler.php
+++ b/_darcs/pristine/lib/xmppqueuehandler.php
@@ -30,7 +30,8 @@ require_once(INSTALLDIR.'/lib/queuehandler.php');
 
 class XmppQueueHandler extends QueueHandler {
     
-    function start() {
+    function start()
+    {
         # Low priority; we don't want to receive messages
         $this->log(LOG_INFO, "INITIALIZE");
         $this->conn = jabber_connect($this->_id);
@@ -43,12 +44,14 @@ class XmppQueueHandler extends QueueHandler {
         return !is_null($this->conn);
     }
     
-    function handle_reconnect(&$pl) {
+    function handle_reconnect(&$pl)
+    {
         $this->conn->processUntil('session_start');
         $this->conn->presence(null, 'available', null, 'available', -1);
     }
 
-    function idle($timeout=0) {
+    function idle($timeout=0)
+    {
         # Process the queue for as long as needed
         try {
             if ($this->conn) {
@@ -60,7 +63,8 @@ class XmppQueueHandler extends QueueHandler {
         }
     }
     
-    function forward_message(&$pl) {
+    function forward_message(&$pl)
+    {
         if ($pl['type'] != 'chat') {
             $this->log(LOG_DEBUG, 'Ignoring message of type ' . $pl['type'] . ' from ' . $pl['from']);
             return;
@@ -74,14 +78,16 @@ class XmppQueueHandler extends QueueHandler {
         $this->conn->message($this->listener(), $pl['body'], 'chat', null, $this->ofrom($pl['from']));
     }
 
-    function ofrom($from) {
+    function ofrom($from)
+    {
         $address = "<addresses xmlns='http://jabber.org/protocol/address'>\n";
         $address .= "<address type='ofrom' jid='$from' />\n";
         $address .= "</addresses>\n";
         return $address;
     }
 
-    function listener() {
+    function listener()
+    {
         if (common_config('xmpp', 'listener')) {
             return common_config('xmpp', 'listener');
         } else {
diff --git a/_darcs/pristine/scripts/enjitqueuehandler.php b/_darcs/pristine/scripts/enjitqueuehandler.php
index 1c033603f..55d73e08c 100644
--- a/_darcs/pristine/scripts/enjitqueuehandler.php
+++ b/_darcs/pristine/scripts/enjitqueuehandler.php
@@ -35,17 +35,20 @@ set_error_handler('common_error_handler');
 
 class EnjitQueueHandler extends QueueHandler {
     
-    function transport() {
+    function transport()
+    {
         return 'enjit';
     }
 
-    function start() {
+    function start()
+    {
                 $this->log(LOG_INFO, "Starting EnjitQueueHandler");
                 $this->log(LOG_INFO, "Broadcasting to ".common_config('enjit', 'apiurl'));
         return true;
     }
 
-    function handle_notice($notice) {
+    function handle_notice($notice)
+    {
 
         $profile = Profile::staticGet($notice->profile_id);
 
diff --git a/_darcs/pristine/scripts/jabberqueuehandler.php b/_darcs/pristine/scripts/jabberqueuehandler.php
index 271aab22b..ea26aaf79 100644
--- a/_darcs/pristine/scripts/jabberqueuehandler.php
+++ b/_darcs/pristine/scripts/jabberqueuehandler.php
@@ -37,11 +37,13 @@ class JabberQueueHandler extends XmppQueueHandler {
 
     var $conn = null;
 
-    function transport() {
+    function transport()
+    {
         return 'jabber';
     }
 
-    function handle_notice($notice) {
+    function handle_notice($notice)
+    {
         try {
             return jabber_broadcast_notice($notice);
         } catch (XMPPHP_Exception $e) {
diff --git a/_darcs/pristine/scripts/maildaemon.php b/_darcs/pristine/scripts/maildaemon.php
index 886e72ba7..6100cd21b 100644
--- a/_darcs/pristine/scripts/maildaemon.php
+++ b/_darcs/pristine/scripts/maildaemon.php
@@ -36,10 +36,12 @@ require_once('Mail/mimeDecode.php');
 
 class MailerDaemon {
 
-    function __construct() {
+    function __construct()
+    {
     }
 
-    function handle_message($fname='php://stdin') {
+    function handle_message($fname='php://stdin')
+    {
         list($from, $to, $msg) = $this->parse_message($fname);
         if (!$from || !$to || !$msg) {
             $this->error(null, _('Could not parse message.'));
@@ -66,12 +68,14 @@ class MailerDaemon {
         $this->add_notice($user, $msg);
     }
 
-    function error($from, $msg) {
+    function error($from, $msg)
+    {
         file_put_contents("php://stderr", $msg . "\n");
         exit(1);
     }
 
-    function user_from($from_hdr) {
+    function user_from($from_hdr)
+    {
         $froms = mailparse_rfc822_parse_addresses($from_hdr);
         if (!$froms) {
             return null;
@@ -85,7 +89,8 @@ class MailerDaemon {
         return $user;
     }
 
-    function user_match_to($user, $to_hdr) {
+    function user_match_to($user, $to_hdr)
+    {
         $incoming = $user->incomingemail;
         $tos = mailparse_rfc822_parse_addresses($to_hdr);
         foreach ($tos as $to) {
@@ -96,7 +101,8 @@ class MailerDaemon {
         return false;
     }
 
-    function handle_command($user, $from, $msg) {
+    function handle_command($user, $from, $msg)
+    {
         $inter = new CommandInterpreter();
         $cmd = $inter->handle_command($user, $msg);
         if ($cmd) {
@@ -106,7 +112,8 @@ class MailerDaemon {
         return false;
     }
 
-    function respond($from, $to, $response) {
+    function respond($from, $to, $response)
+    {
 
         $headers['From'] = $to;
         $headers['To'] = $from;
@@ -115,11 +122,13 @@ class MailerDaemon {
         return mail_send(array($from), $headers, $response);
     }
 
-    function log($level, $msg) {
+    function log($level, $msg)
+    {
         common_log($level, 'MailDaemon: '.$msg);
     }
 
-    function add_notice($user, $msg) {
+    function add_notice($user, $msg)
+    {
         // should test
         // $msg_shortened = common_shorten_links($msg);
         // if (mb_strlen($msg_shortened) > 140) ERROR and STOP
@@ -133,7 +142,8 @@ class MailerDaemon {
                    'Added notice ' . $notice->id . ' from user ' . $user->nickname);
     }
 
-    function parse_message($fname) {
+    function parse_message($fname)
+    {
         $contents = file_get_contents($fname);
         $parsed = Mail_mimeDecode::decode(array('input' => $contents,
                                                 'include_bodies' => true,
@@ -166,11 +176,13 @@ class MailerDaemon {
         return array($from, $to, $msg);
     }
 
-    function unsupported_type($type) {
+    function unsupported_type($type)
+    {
         $this->error(null, "Unsupported message type: " . $type);
     }
 
-    function cleanup_msg($msg) {
+    function cleanup_msg($msg)
+    {
         $lines = explode("\n", $msg);
 
         $output = '';
diff --git a/_darcs/pristine/scripts/ombqueuehandler.php b/_darcs/pristine/scripts/ombqueuehandler.php
index 43c0980b6..299381ace 100644
--- a/_darcs/pristine/scripts/ombqueuehandler.php
+++ b/_darcs/pristine/scripts/ombqueuehandler.php
@@ -35,16 +35,19 @@ set_error_handler('common_error_handler');
 
 class OmbQueueHandler extends QueueHandler {
     
-    function transport() {
+    function transport()
+    {
         return 'omb';
     }
     
-    function start() {
+    function start()
+    {
         $this->log(LOG_INFO, "INITIALIZE");
         return true;
     }
 
-    function handle_notice($notice) {
+    function handle_notice($notice)
+    {
         if ($this->is_remote($notice)) {
             $this->log(LOG_DEBUG, 'Ignoring remote notice ' . $notice->id);
             return true;
@@ -53,10 +56,12 @@ class OmbQueueHandler extends QueueHandler {
         }
     }
     
-    function finish() {
+    function finish()
+    {
     }
 
-    function is_remote($notice) {
+    function is_remote($notice)
+    {
         $user = User::staticGet($notice->profile_id);
         return is_null($user);
     }
diff --git a/_darcs/pristine/scripts/publicqueuehandler.php b/_darcs/pristine/scripts/publicqueuehandler.php
index 2168aade2..b3542e5c5 100644
--- a/_darcs/pristine/scripts/publicqueuehandler.php
+++ b/_darcs/pristine/scripts/publicqueuehandler.php
@@ -35,11 +35,13 @@ set_error_handler('common_error_handler');
 
 class PublicQueueHandler extends XmppQueueHandler {
     
-    function transport() {
+    function transport()
+    {
         return 'public';
     }
     
-    function handle_notice($notice) {
+    function handle_notice($notice)
+    {
         try {
             return jabber_public_notice($notice);
         } catch (XMPPHP_Exception $e) {
diff --git a/_darcs/pristine/scripts/sitemap.php b/_darcs/pristine/scripts/sitemap.php
index b49bfe2a5..504783e88 100644
--- a/_darcs/pristine/scripts/sitemap.php
+++ b/_darcs/pristine/scripts/sitemap.php
@@ -18,7 +18,8 @@ index_map();
 # ------------------------------------------------------------------------------
 
 # Generate index sitemap of all other sitemaps.
-function index_map() {
+function index_map()
+{
     global $output_paths;
     $output_dir = $output_paths['output_dir'];
     $output_url = $output_paths['output_url'];
@@ -40,7 +41,8 @@ function index_map() {
 }
 
 # Generate sitemap of standard site elements.
-function standard_map() {
+function standard_map()
+{
     global $output_paths;
 
     $standard_map_urls .= url(
@@ -77,7 +79,8 @@ function standard_map() {
 }
 
 # Generate sitemaps of all notices.
-function notices_map() {
+function notices_map()
+{
     global $output_paths;
 
     $notices = DB_DataObject::factory('notice');
@@ -115,7 +118,8 @@ function notices_map() {
 }
 
 # Generate sitemaps of all users.
-function user_map() {
+function user_map()
+{
     global $output_paths;
 
     $users = DB_DataObject::factory('user');
@@ -208,7 +212,8 @@ function user_map() {
 # ------------------------------------------------------------------------------
 
 # Generate a <url></url> element.
-function url($url_args) {
+function url($url_args)
+{
     $url        = preg_replace('/&/', '&amp;', $url_args['url']); # escape ampersands for XML
     $lastmod    = $url_args['lastmod'];
     $changefreq = $url_args['changefreq'];
@@ -238,7 +243,8 @@ function url($url_args) {
     return $url_out;
 }
 
-function sitemap($sitemap_args) {
+function sitemap($sitemap_args)
+{
     $url        = preg_replace('/&/', '&amp;', $sitemap_args['url']); # escape ampersands for XML
     $lastmod    = $sitemap_args['lastmod'];
 
@@ -259,7 +265,8 @@ function sitemap($sitemap_args) {
 }
 
 # Generate a <urlset></urlset> element.
-function urlset($urlset_text) {
+function urlset($urlset_text)
+{
     $urlset = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
       '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" .
       $urlset_text .
@@ -269,7 +276,8 @@ function urlset($urlset_text) {
 }
 
 # Generate a <urlset></urlset> element.
-function sitemapindex($sitemapindex_text) {
+function sitemapindex($sitemapindex_text)
+{
     $sitemapindex = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
       '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" .
       $sitemapindex_text .
@@ -279,7 +287,8 @@ function sitemapindex($sitemapindex_text) {
 }
 
 # Generate a sitemap from an array containing <url></url> elements and write it to a file.
-function array_to_map($url_list, $filename_prefix) {
+function array_to_map($url_list, $filename_prefix)
+{
     global $output_paths;
 
     if ($url_list) {
@@ -297,7 +306,8 @@ function array_to_map($url_list, $filename_prefix) {
 # ------------------------------------------------------------------------------
 
 # Parse command line arguments.
-function parse_args() {
+function parse_args()
+{
     $args = getopt('f:d:u:');
 
     if (is_null($args[f]) && is_null($args[d]) && is_null($args[u])) {
@@ -338,7 +348,8 @@ function parse_args() {
 }
 
 # Ensure paths end with a "/".
-function trailing_slash($path) {
+function trailing_slash($path)
+{
     if (preg_match('/\/$/', $path) == 0) {
         $path .= '/';
     }
@@ -347,7 +358,8 @@ function trailing_slash($path) {
 }
 
 # Write data to disk.
-function write_file($path, $data) {
+function write_file($path, $data)
+{
     if (is_null($path)) {
         error('No path specified for writing to.');
     }     elseif (is_null($data)) {
@@ -364,7 +376,8 @@ function write_file($path, $data) {
 }
 
 # Display an error message and exit.
-function error ($error_msg) {
+function error ($error_msg)
+{
     if (is_null($error_msg)) {
         $error_msg = 'error() was called without any explanation!';
     }
diff --git a/_darcs/pristine/scripts/smsqueuehandler.php b/_darcs/pristine/scripts/smsqueuehandler.php
index f8b2e9d53..c962ad095 100644
--- a/_darcs/pristine/scripts/smsqueuehandler.php
+++ b/_darcs/pristine/scripts/smsqueuehandler.php
@@ -35,20 +35,24 @@ set_error_handler('common_error_handler');
 
 class SmsQueueHandler extends QueueHandler {
     
-    function transport() {
+    function transport()
+    {
         return 'sms';
     }
 
-    function start() {
+    function start()
+    {
         $this->log(LOG_INFO, "INITIALIZE");
         return true;
     }
 
-    function handle_notice($notice) {
+    function handle_notice($notice)
+    {
         return mail_broadcast_notice_sms($notice);
     }
     
-    function finish() {
+    function finish()
+    {
     }
 }
 
diff --git a/_darcs/pristine/scripts/xmppconfirmhandler.php b/_darcs/pristine/scripts/xmppconfirmhandler.php
index 9e177b3fa..b059149bc 100644
--- a/_darcs/pristine/scripts/xmppconfirmhandler.php
+++ b/_darcs/pristine/scripts/xmppconfirmhandler.php
@@ -39,11 +39,13 @@ class XmppConfirmHandler extends XmppQueueHandler {
 
     var $_id = 'confirm';
     
-    function class_name() {
+    function class_name()
+    {
         return 'XmppConfirmHandler';
     }
     
-    function run() {
+    function run()
+    {
         if (!$this->start()) {
             return false;
         }
@@ -99,7 +101,8 @@ class XmppConfirmHandler extends XmppQueueHandler {
         return true;
     }
 
-    function next_confirm() {
+    function next_confirm()
+    {
         $confirm = new Confirm_address();
         $confirm->whereAdd('claimed IS null');
         $confirm->whereAdd('sent IS null');
@@ -125,7 +128,8 @@ class XmppConfirmHandler extends XmppQueueHandler {
         return null;
     }
 
-    function clear_old_confirm_claims() {
+    function clear_old_confirm_claims()
+    {
         $confirm = new Confirm();
         $confirm->claimed = null;
         $confirm->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
diff --git a/_darcs/pristine/scripts/xmppdaemon.php b/_darcs/pristine/scripts/xmppdaemon.php
index ead842928..28ac64725 100644
--- a/_darcs/pristine/scripts/xmppdaemon.php
+++ b/_darcs/pristine/scripts/xmppdaemon.php
@@ -39,7 +39,8 @@ set_error_handler('common_error_handler');
 
 class XMPPDaemon extends Daemon {
 
-    function XMPPDaemon($resource=null) {
+    function XMPPDaemon($resource=null)
+    {
         static $attrs = array('server', 'port', 'user', 'password', 'host');
 
         foreach ($attrs as $attr)
@@ -56,7 +57,8 @@ class XMPPDaemon extends Daemon {
         $this->log(LOG_INFO, "INITIALIZE XMPPDaemon {$this->user}@{$this->server}/{$this->resource}");
     }
 
-    function connect() {
+    function connect()
+    {
 
         $connect_to = ($this->host) ? $this->host : $this->server;
 
@@ -75,11 +77,13 @@ class XMPPDaemon extends Daemon {
         return !$this->conn->isDisconnected();
     }
 
-    function name() {
+    function name()
+    {
         return strtolower('xmppdaemon.'.$this->resource);
     }
 
-    function run() {
+    function run()
+    {
         if ($this->connect()) {
 
             $this->conn->addEventHandler('message', 'handle_message', $this);
@@ -90,17 +94,20 @@ class XMPPDaemon extends Daemon {
         }
     }
 
-    function handle_reconnect(&$pl) {
+    function handle_reconnect(&$pl)
+    {
         $this->conn->processUntil('session_start');
         $this->conn->presence('Send me a message to post a notice', 'available', null, 'available', 100);
     }
 
-    function get_user($from) {
+    function get_user($from)
+    {
         $user = User::staticGet('jabber', jabber_normalize_jid($from));
         return $user;
     }
 
-    function handle_message(&$pl) {
+    function handle_message(&$pl)
+    {
         if ($pl['type'] != 'chat') {
             return;
         }
@@ -156,11 +163,13 @@ class XMPPDaemon extends Daemon {
         unset($user);
     }
 
-    function is_self($from) {
+    function is_self($from)
+    {
         return preg_match('/^'.strtolower(jabber_daemon_address()).'/', strtolower($from));
     }
 
-    function get_ofrom($pl) {
+    function get_ofrom($pl)
+    {
         $xml = $pl['xml'];
         $addresses = $xml->sub('addresses');
         if (!$addresses) {
@@ -194,7 +203,8 @@ class XMPPDaemon extends Daemon {
         return $jid;
     }
 
-    function is_autoreply($txt) {
+    function is_autoreply($txt)
+    {
         if (preg_match('/[\[\(]?[Aa]uto[-\s]?[Rr]e(ply|sponse)[\]\)]/', $txt)) {
             return true;
         } else {
@@ -202,7 +212,8 @@ class XMPPDaemon extends Daemon {
         }
     }
 
-    function is_otr($txt) {
+    function is_otr($txt)
+    {
         if (preg_match('/^\?OTR/', $txt)) {
             return true;
         } else {
@@ -210,7 +221,8 @@ class XMPPDaemon extends Daemon {
         }
     }
 
-    function is_direct($txt) {
+    function is_direct($txt)
+    {
         if (strtolower(substr($txt, 0, 2))=='d ') {
             return true;
         } else {
@@ -218,12 +230,14 @@ class XMPPDaemon extends Daemon {
         }
     }
 
-    function from_site($address, $msg) {
+    function from_site($address, $msg)
+    {
         $text = '['.common_config('site', 'name') . '] ' . $msg;
         jabber_send_message($address, $text);
     }
 
-    function handle_command($user, $body) {
+    function handle_command($user, $body)
+    {
         $inter = new CommandInterpreter();
         $cmd = $inter->handle_command($user, $body);
         if ($cmd) {
@@ -235,7 +249,8 @@ class XMPPDaemon extends Daemon {
         }
     }
 
-    function add_notice(&$user, &$pl) {
+    function add_notice(&$user, &$pl)
+    {
         $body = trim($pl['body']);
         $content_shortened = common_shorten_link($body);
         if (mb_strlen($content_shortened) > 140) {
@@ -257,7 +272,8 @@ class XMPPDaemon extends Daemon {
         unset($notice);
     }
 
-    function handle_presence(&$pl) {
+    function handle_presence(&$pl)
+    {
         $from = jabber_normalize_jid($pl['from']);
         switch ($pl['type']) {
          case 'subscribe':
@@ -291,11 +307,13 @@ class XMPPDaemon extends Daemon {
         }
     }
 
-    function log($level, $msg) {
+    function log($level, $msg)
+    {
         common_log($level, 'XMPPDaemon('.$this->resource.'): '.$msg);
     }
 
-    function subscribed($to) {
+    function subscribed($to)
+    {
         jabber_special_presence('subscribed', $to);
     }
 }
diff --git a/_darcs/tentative_pristine b/_darcs/tentative_pristine
index 62c02a301..4a4beb36c 100644
--- a/_darcs/tentative_pristine
+++ b/_darcs/tentative_pristine
@@ -1,1338 +1,3664 @@
-hunk ./actions/allrss.php 28
--    var $user = NULL;
-+    var $user = null;
-hunk ./actions/allrss.php 72
--            return NULL;
-+            return null;
-hunk ./actions/allrss.php 75
--        return ($avatar) ? $avatar->url : NULL;
-+        return ($avatar) ? $avatar->url : null;
-hunk ./actions/api.php 155
--            common_element('error', NULL, $msg);
--            common_element('request', NULL, $_SERVER['REQUEST_URI']);
-+            common_element('error', null, $msg);
-+            common_element('request', null, $_SERVER['REQUEST_URI']);
-hunk ./actions/block.php 24
--    var $profile = NULL;
-+    var $profile = null;
-hunk ./actions/block.php 80
--        common_element('p', NULL,
-+        common_element('p', null,
-hunk ./actions/confirmaddress.php 91
--        common_element('p', NULL,
-+        common_element('p', null,
-hunk ./actions/deletenotice.php 44
--    function show_form($error=NULL) {
-+    function show_form($error=null) {
-hunk ./actions/deletenotice.php 94
--                common_set_returnto(NULL);
-+                common_set_returnto(null);
-hunk ./actions/deleteprofile.php 39
--    function form_header($title, $msg=NULL, $success=false) {
-+    function form_header($title, $msg=null, $success=false) {
+hunk ./actions/accesstoken.php 25
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/all.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/all.php 57
+-    function show_header($user) {
++    function show_header($user)
++    {
+hunk ./actions/all.php 66
+-    function show_top($user) {
++    function show_top($user)
++    {
+hunk ./actions/all.php 82
+-    function show_notices($user) {
++    function show_notices($user)
++    {
+hunk ./actions/allrss.php 30
+-    function init() {
++    function init()
++    {
+hunk ./actions/allrss.php 43
+-    function get_notices($limit=0) {
++    function get_notices($limit=0)
++    {
+hunk ./actions/allrss.php 57
+-    function get_channel() {
++    function get_channel()
++    {
+hunk ./actions/allrss.php 71
+-    function get_image() {
++    function get_image()
++    {
+hunk ./actions/api.php 30
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/api.php 83
+-    function process_command() {
++    function process_command()
++    {
+hunk ./actions/api.php 113
+-    function requires_auth() {
++    function requires_auth()
++    {
+hunk ./actions/api.php 150
+-    function show_basic_auth_error() {
++    function show_basic_auth_error()
++    {
+hunk ./actions/api.php 173
+-    function is_readonly() {
++    function is_readonly()
++    {
+hunk ./actions/avatarbynickname.php 23
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/block.php 26
+-    function prepare($args) {
++    function prepare($args)
++    {
+hunk ./actions/block.php 60
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/block.php 76
+-    function are_you_sure_form() {
++    function are_you_sure_form()
++    {
+hunk ./actions/block.php 115
+-    function block_profile() {
++    function block_profile()
++    {
+hunk ./actions/confirmaddress.php 24
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/deletenotice.php 25
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/deletenotice.php 37
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/deletenotice.php 42
+-    function get_title() {
++    function get_title()
++    {
+hunk ./actions/deletenotice.php 47
+-    function show_form($error=null) {
++    function show_form($error=null)
++    {
+hunk ./actions/deletenotice.php 74
+-    function delete_notice() {
++    function delete_notice()
++    {
+hunk ./actions/deleteprofile.php 23
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/deleteprofile.php 36
+-    function get_instructions() {
++    function get_instructions()
++    {
 hunk ./actions/deleteprofile.php 41
--                           NULL,
-+                           null,
-hunk ./actions/deleteprofile.php 87
--    function show_form($msg=NULL, $success=false) {
-+    function show_form($msg=null, $success=false) {
-hunk ./actions/deleteprofile.php 89
--        common_element('h2', NULL, _('Delete my account confirmation'));
-+        common_element('h2', null, _('Delete my account confirmation'));
-hunk ./actions/deleteprofile.php 216
--        common_set_user(NULL);
-+        common_set_user(null);
-hunk ./actions/emailsettings.php 30
--    function show_form($msg=NULL, $success=false) {
-+    function show_form($msg=null, $success=false) {
-hunk ./actions/emailsettings.php 39
--        common_element('h2', NULL, _('Address'));
-+        common_element('h2', null, _('Address'));
-hunk ./actions/emailsettings.php 61
--                             ($this->arg('email')) ? $this->arg('email') : NULL,
-+                             ($this->arg('email')) ? $this->arg('email') : null,
-hunk ./actions/emailsettings.php 68
--            common_element('h2', NULL, _('Incoming email'));
-+            common_element('h2', null, _('Incoming email'));
-hunk ./actions/emailsettings.php 86
--        common_element('h2', NULL, _('Preferences'));
-+        common_element('h2', null, _('Preferences'));
-hunk ./actions/emailsettings.php 121
--            return NULL;
-+            return null;
-hunk ./actions/emailsettings.php 276
--        $user->email = NULL;
-+        $user->email = null;
-hunk ./actions/emailsettings.php 297
--        $user->incomingemail = NULL;
-+        $user->incomingemail = null;
-hunk ./actions/favorited.php 32
--                           array($this, 'show_header'), NULL,
-+                           array($this, 'show_header'), null,
-hunk ./actions/favoritesrss.php 28
--    var $user = NULL;
-+    var $user = null;
-hunk ./actions/favoritesrss.php 71
--        return NULL;
-+        return null;
-hunk ./actions/featured.php 33
--                           array($this, 'show_header'), NULL,
-+                           array($this, 'show_header'), null,
+-    function form_header($title, $msg=null, $success=false) {
++    function form_header($title, $msg=null, $success=false)
++    {
+hunk ./actions/deleteprofile.php 49
+-    function show_feeds_list($feeds) {
++    function show_feeds_list($feeds)
++    {
+hunk ./actions/deleteprofile.php 63
+-    function common_feed_item($feed) {
++    function common_feed_item($feed)
++    {
+hunk ./actions/deleteprofile.php 92
+-    function show_form($msg=null, $success=false) {
++    function show_form($msg=null, $success=false)
++    {
+hunk ./actions/deleteprofile.php 100
+-    function show_confirm_delete_form() {
++    function show_confirm_delete_form()
++    {
+hunk ./actions/deleteprofile.php 130
+-    function handle_post() {
++    function handle_post()
++    {
+hunk ./actions/deleteprofile.php 145
+-    function delete_account() {
++    function delete_account()
++    {
+hunk ./actions/deleteprofile.php 231
+-    function show_top($arr) {
++    function show_top($arr)
++    {
+hunk ./actions/deleteprofile.php 247
+-    function settings_menu() {
++    function settings_menu()
++    {
+hunk ./actions/disfavor.php 24
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/doc.php 24
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/emailsettings.php 26
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/emailsettings.php 31
+-    function show_form($msg=null, $success=false) {
++    function show_form($msg=null, $success=false)
++    {
+hunk ./actions/emailsettings.php 115
+-    function get_confirmation() {
++    function get_confirmation()
++    {
+hunk ./actions/emailsettings.php 128
+-    function handle_post() {
++    function handle_post()
++    {
+hunk ./actions/emailsettings.php 155
+-    function save_preferences() {
++    function save_preferences()
++    {
+hunk ./actions/emailsettings.php 193
+-    function add_address() {
++    function add_address()
++    {
+hunk ./actions/emailsettings.php 245
+-    function cancel_confirmation() {
++    function cancel_confirmation()
++    {
+hunk ./actions/emailsettings.php 269
+-    function remove_address() {
++    function remove_address()
++    {
+hunk ./actions/emailsettings.php 296
+-    function remove_incoming() {
++    function remove_incoming()
++    {
+hunk ./actions/emailsettings.php 316
+-    function new_incoming() {
++    function new_incoming()
++    {
+hunk ./actions/emailsettings.php 331
+-    function email_exists($email) {
++    function email_exists($email)
++    {
+hunk ./actions/facebookhome.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/facebookhome.php 33
+-    function login() {
++    function login()
++    {
+hunk ./actions/facebookhome.php 94
+-    function show_home($facebook, $fbuid, $user) {
++    function show_home($facebook, $fbuid, $user)
++    {
+hunk ./actions/facebookhome.php 105
+-    function show_notices($user) {
++    function show_notices($user)
++    {
+hunk ./actions/facebookinvite.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/facebookinvite.php 33
+-    function display() {
++    function display()
++    {
+hunk ./actions/facebookremove.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/facebooksettings.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/facebooksettings.php 33
+-    function display() {
++    function display()
++    {
+hunk ./actions/favor.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/favor.php 84
+-    function notify($fave, $notice, $user) {
++    function notify($fave, $notice, $user)
++    {
+hunk ./actions/favorited.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/favorited.php 41
+-    function show_top() {
++    function show_top()
++    {
+hunk ./actions/favorited.php 51
+-    function show_header() {
++    function show_header()
++    {
+hunk ./actions/favorited.php 56
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/favorited.php 61
+-    function show_notices($page) {
++    function show_notices($page)
++    {
+hunk ./actions/favoritesrss.php 30
+-    function init() {
++    function init()
++    {
+hunk ./actions/favoritesrss.php 43
+-    function get_notices($limit=0) {
++    function get_notices($limit=0)
++    {
+hunk ./actions/favoritesrss.php 59
+-    function get_channel() {
++    function get_channel()
++    {
+hunk ./actions/favoritesrss.php 73
+-    function get_image() {
++    function get_image()
++    {
+hunk ./actions/featured.php 27
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/featured.php 42
+-    function show_top() {
++    function show_top()
++    {
+hunk ./actions/featured.php 52
+-    function show_header() {
++    function show_header()
++    {
+hunk ./actions/featured.php 56
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/featured.php 61
+-    function show_notices($page) {
++    function show_notices($page)
++    {
+hunk ./actions/finishaddopenid.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/finishaddopenid.php 36
+-    function try_login() {
++    function try_login()
++    {
 hunk ./actions/finishaddopenid.php 100
--        common_element('p', NULL, $msg);
-+        common_element('p', null, $msg);
-hunk ./actions/finishopenidlogin.php 55
--    function show_top($error=NULL) {
-+    function show_top($error=null) {
-hunk ./actions/finishopenidlogin.php 65
--    function show_form($error=NULL, $username=NULL) {
--        common_show_header(_('OpenID Account Setup'), NULL, $error,
-+    function show_form($error=null, $username=null) {
-+        common_show_header(_('OpenID Account Setup'), null, $error,
-hunk ./actions/finishopenidlogin.php 73
--        common_element('h2', NULL,
-+        common_element('h2', null,
-hunk ./actions/finishopenidlogin.php 75
--        common_element('p', NULL,
-+        common_element('p', null,
-hunk ./actions/finishopenidlogin.php 91
--        common_element('h2', NULL,
-+        common_element('h2', null,
-hunk ./actions/finishopenidlogin.php 93
--        common_element('p', NULL,
-+        common_element('p', null,
-hunk ./actions/finishopenidlogin.php 144
--                $this->show_form(NULL, $this->best_new_nickname($display, $sreg));
-+                $this->show_form(null, $this->best_new_nickname($display, $sreg));
-hunk ./actions/finishopenidlogin.php 151
--        common_element('p', NULL, $msg);
-+        common_element('p', null, $msg);
-hunk ./actions/finishopenidlogin.php 293
--            common_set_returnto(NULL);
-+            common_set_returnto(null);
-hunk ./actions/finishopenidlogin.php 332
--        return NULL;
-+        return null;
-hunk ./actions/finishopenidlogin.php 372
--                return NULL;
-+                return null;
-hunk ./actions/finishopenidlogin.php 406
--        return NULL;
-+        return null;
-hunk ./actions/finishopenidlogin.php 413
--            return NULL;
-+            return null;
-hunk ./actions/finishremotesubscribe.php 281
--            return NULL;
-+            return null;
-hunk ./actions/foaf.php 69
--        common_element('mbox_sha1sum', NULL, sha1('mailto:' . $user->email));
-+        common_element('mbox_sha1sum', null, sha1('mailto:' . $user->email));
-hunk ./actions/foaf.php 71
--            common_element('name', NULL, $profile->fullname);
-+            common_element('name', null, $profile->fullname);
-hunk ./actions/foaf.php 77
--            common_element('rdfs:comment', NULL, $profile->bio);
-+            common_element('rdfs:comment', null, $profile->bio);
-hunk ./actions/foaf.php 83
--            common_element('name', NULL, $profile->location);
-+            common_element('name', null, $profile->location);
-hunk ./actions/foaf.php 159
--            $foaf_url = NULL;
-+            $foaf_url = null;
-hunk ./actions/foaf.php 169
--                                              common_root_url() : NULL);
-+                                              common_root_url() : null);
-hunk ./actions/foaf.php 189
--    function show_microblogging_account($profile, $service=NULL) {
-+    function show_microblogging_account($profile, $service=null) {
-hunk ./actions/foaf.php 197
--        common_element('accountName', NULL, $profile->nickname);
-+        common_element('accountName', null, $profile->nickname);
-hunk ./actions/imsettings.php 31
--    function show_form($msg=NULL, $success=false) {
-+    function show_form($msg=null, $success=false) {
-hunk ./actions/imsettings.php 40
--        common_element('h2', NULL, _('Address'));
-+        common_element('h2', null, _('Address'));
-hunk ./actions/imsettings.php 62
--                             ($this->arg('jabber')) ? $this->arg('jabber') : NULL,
-+                             ($this->arg('jabber')) ? $this->arg('jabber') : null,
-hunk ./actions/imsettings.php 68
--        common_element('h2', NULL, _('Preferences'));
-+        common_element('h2', null, _('Preferences'));
-hunk ./actions/imsettings.php 96
--            return NULL;
-+            return null;
-hunk ./actions/imsettings.php 247
--        $user->jabber = NULL;
-+        $user->jabber = null;
-hunk ./actions/invite.php 88
--            common_element('p', NULL, _('You are already subscribed to these users:'));
-+            common_element('p', null, _('You are already subscribed to these users:'));
-hunk ./actions/invite.php 91
--                common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
-+                common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
-hunk ./actions/invite.php 96
--            common_element('p', NULL, _('These people are already users and you were automatically subscribed to them:'));
-+            common_element('p', null, _('These people are already users and you were automatically subscribed to them:'));
-hunk ./actions/invite.php 99
--                common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
-+                common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
-hunk ./actions/invite.php 104
--            common_element('p', NULL, _('Invitation(s) sent to the following people:'));
-+            common_element('p', null, _('Invitation(s) sent to the following people:'));
-hunk ./actions/invite.php 107
--                common_element('li', NULL, $other);
-+                common_element('li', null, $other);
-hunk ./actions/invite.php 110
--            common_element('p', NULL, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
-+            common_element('p', null, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
-hunk ./actions/invite.php 115
--    function show_top($error=NULL) {
-+    function show_top($error=null) {
-hunk ./actions/invite.php 120
--            common_element('p', NULL,
-+            common_element('p', null,
-hunk ./actions/invite.php 126
--    function show_form($error=NULL) {
-+    function show_form($error=null) {
+-    function message($msg) {
++    function message($msg)
++    {
+hunk ./actions/finishimmediate.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/finishimmediate.php 57
+-    function go_backto() {
++    function go_backto()
++    {
+hunk ./actions/finishopenidlogin.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/finishopenidlogin.php 56
+-    function show_top($error=null) {
++    function show_top($error=null)
++    {
+hunk ./actions/finishopenidlogin.php 67
+-    function show_form($error=null, $username=null) {
++    function show_form($error=null, $username=null)
++    {
+hunk ./actions/finishopenidlogin.php 105
+-    function try_login() {
++    function try_login()
++    {
+hunk ./actions/finishopenidlogin.php 153
+-    function message($msg) {
++    function message($msg)
++    {
+hunk ./actions/finishopenidlogin.php 160
+-    function save_values($display, $canonical, $sreg) {
++    function save_values($display, $canonical, $sreg)
++    {
+hunk ./actions/finishopenidlogin.php 168
+-    function get_saved_values() {
++    function get_saved_values()
++    {
+hunk ./actions/finishopenidlogin.php 175
+-    function create_new_user() {
++    function create_new_user()
++    {
+hunk ./actions/finishopenidlogin.php 258
+-    function connect_user() {
++    function connect_user()
++    {
+hunk ./actions/finishopenidlogin.php 298
+-    function go_home($nickname) {
++    function go_home($nickname)
++    {
+hunk ./actions/finishopenidlogin.php 312
+-    function best_new_nickname($display, $sreg) {
++    function best_new_nickname($display, $sreg)
++    {
+hunk ./actions/finishopenidlogin.php 346
+-    function is_new_nickname($str) {
++    function is_new_nickname($str)
++    {
+hunk ./actions/finishopenidlogin.php 362
+-    function openid_to_nickname($openid) {
++    function openid_to_nickname($openid)
++    {
+hunk ./actions/finishopenidlogin.php 376
+-    function url_to_nickname($openid) {
++    function url_to_nickname($openid)
++    {
+hunk ./actions/finishopenidlogin.php 423
+-    function xri_to_nickname($xri) {
++    function xri_to_nickname($xri)
++    {
+hunk ./actions/finishopenidlogin.php 437
+-    function xri_base($xri) {
++    function xri_base($xri)
++    {
+hunk ./actions/finishopenidlogin.php 448
+-    function nicknamize($str) {
++    function nicknamize($str)
++    {
+hunk ./actions/finishremotesubscribe.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/finishremotesubscribe.php 235
+-    function add_avatar($profile, $url) {
++    function add_avatar($profile, $url)
++    {
+hunk ./actions/finishremotesubscribe.php 242
+-    function access_token($omb) {
++    function access_token($omb)
++    {
+hunk ./actions/foaf.php 28
+-    function is_readonly() {
++    function is_readonly()
++    {
+hunk ./actions/foaf.php 33
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/foaf.php 184
+-    function show_ppd($foaf_url, $person_uri) {
++    function show_ppd($foaf_url, $person_uri)
++    {
+hunk ./actions/foaf.php 192
+-    function show_microblogging_account($profile, $service=null) {
++    function show_microblogging_account($profile, $service=null)
++    {
+hunk ./actions/imsettings.php 27
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/imsettings.php 32
+-    function show_form($msg=null, $success=false) {
++    function show_form($msg=null, $success=false)
++    {
+hunk ./actions/imsettings.php 90
+-    function get_confirmation() {
++    function get_confirmation()
++    {
+hunk ./actions/imsettings.php 103
+-    function handle_post() {
++    function handle_post()
++    {
+hunk ./actions/imsettings.php 126
+-    function save_preferences() {
++    function save_preferences()
++    {
+hunk ./actions/imsettings.php 160
+-    function add_address() {
++    function add_address()
++    {
+hunk ./actions/imsettings.php 216
+-    function cancel_confirmation() {
++    function cancel_confirmation()
++    {
+hunk ./actions/imsettings.php 240
+-    function remove_address() {
++    function remove_address()
++    {
+hunk ./actions/imsettings.php 269
+-    function jabber_exists($jabber) {
++    function jabber_exists($jabber)
++    {
+hunk ./actions/invite.php 24
+-    function is_readonly() {
++    function is_readonly()
++    {
+hunk ./actions/invite.php 29
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/invite.php 43
+-    function send_invitations() {
++    function send_invitations()
++    {
+hunk ./actions/invite.php 118
+-    function show_top($error=null) {
++    function show_top($error=null)
++    {
 hunk ./actions/invite.php 130
--        common_show_header(_('Invite new users'), NULL, $error, array($this, 'show_top'));
-+        common_show_header(_('Invite new users'), null, $error, array($this, 'show_top'));
-hunk ./actions/login.php 66
--                common_set_returnto(NULL);
-+                common_set_returnto(null);
-hunk ./actions/login.php 94
--            common_set_returnto(NULL);
-+            common_set_returnto(null);
-hunk ./actions/login.php 103
--    function show_form($error=NULL) {
--        common_show_header(_('Login'), NULL, $error, array($this, 'show_top'));
-+    function show_form($error=null) {
-+        common_show_header(_('Login'), null, $error, array($this, 'show_top'));
-hunk ./actions/login.php 141
--    function show_top($error=NULL) {
-+    function show_top($error=null) {
-hunk ./actions/logout.php 35
--            common_set_user(NULL);
-+            common_set_user(null);
-hunk ./actions/newmessage.php 101
--    function show_form($msg=NULL) {
-+    function show_form($msg=null) {
-hunk ./actions/newmessage.php 120
--        common_show_header(_('New message'), NULL,
-+        common_show_header(_('New message'), null,
-hunk ./actions/newnotice.php 81
--        $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? NULL : $replyto);
-+        $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? null : $replyto);
-hunk ./actions/newnotice.php 124
--    function show_top($content=NULL) {
--        common_notice_form(NULL, $content);
-+    function show_top($content=null) {
-+        common_notice_form(null, $content);
-hunk ./actions/newnotice.php 128
--    function show_form($msg=NULL) {
-+    function show_form($msg=null) {
-hunk ./actions/newnotice.php 141
--        common_show_header(_('New notice'), NULL, $content,
-+        common_show_header(_('New notice'), null, $content,
-hunk ./actions/noticesearchrss.php 68
--        return NULL;
-+        return null;
-hunk ./actions/openidlogin.php 55
--            $this->show_form(NULL, $openid_url);
-+            $this->show_form(null, $openid_url);
-hunk ./actions/openidlogin.php 63
--    function show_top($error=NULL) {
-+    function show_top($error=null) {
-hunk ./actions/openidlogin.php 75
--    function show_form($error=NULL, $openid_url) {
--        common_show_header(_('OpenID Login'), NULL, $error, array($this, 'show_top'));
-+    function show_form($error=null, $openid_url) {
-+        common_show_header(_('OpenID Login'), null, $error, array($this, 'show_top'));
-hunk ./actions/openidsettings.php 33
--    function show_form($msg=NULL, $success=false) {
-+    function show_form($msg=null, $success=false) {
-hunk ./actions/openidsettings.php 44
--        common_element('h2', NULL, _('Add OpenID'));
--        common_element('p', NULL,
-+        common_element('h2', null, _('Add OpenID'));
-+        common_element('p', null,
-hunk ./actions/openidsettings.php 69
--            common_element('h2', NULL, _('Remove OpenID'));
-+            common_element('h2', null, _('Remove OpenID'));
-hunk ./actions/openidsettings.php 73
--                common_element('p', NULL,
-+                common_element('p', null,
-hunk ./actions/openidsettings.php 86
--                common_element('p', NULL,
-+                common_element('p', null,
-hunk ./actions/opensearch.php 45
--        common_element('ShortName', NULL, $short_name);
--        common_element('Contact', NULL, common_config('site', 'email'));
-+        common_element('ShortName', null, $short_name);
-+        common_element('Contact', null, common_config('site', 'email'));
-hunk ./actions/opensearch.php 51
--        common_element('AdultContent', NULL, 'false');
--        common_element('Language', NULL, common_language());
--        common_element('OutputEncoding', NULL, 'UTF-8');
--        common_element('InputEncoding', NULL, 'UTF-8');
-+        common_element('AdultContent', null, 'false');
-+        common_element('Language', null, common_language());
-+        common_element('OutputEncoding', null, 'UTF-8');
-+        common_element('InputEncoding', null, 'UTF-8');
-hunk ./actions/othersettings.php 30
--    function show_form($msg=NULL, $success=false) {
-+    function show_form($msg=null, $success=false) {
-hunk ./actions/othersettings.php 35
--        common_element('h2', NULL, _('URL Auto-shortening'));
-+        common_element('h2', null, _('URL Auto-shortening'));
-hunk ./actions/othersettings.php 60
--//        common_element('h2', NULL, _('Delete my account'));
-+//        common_element('h2', null, _('Delete my account'));
-hunk ./actions/peoplesearch.php 71
--    var $terms = NULL;
--    var $pattern = NULL;
-+    var $terms = null;
-+    var $pattern = null;
-hunk ./actions/peopletag.php 46
--                           NULL, $tag, array($this, 'show_top'));
-+                           null, $tag, array($this, 'show_top'));
-hunk ./actions/peopletag.php 97
--        return NULL;
-+        return null;
-hunk ./actions/profilesettings.php 31
--    function show_form($msg=NULL, $success=false) {
-+    function show_form($msg=null, $success=false) {
-hunk ./actions/profilesettings.php 34
--        common_element('h2', NULL, _('Avatar'));
-+        common_element('h2', null, _('Avatar'));
-hunk ./actions/profilesettings.php 36
--        common_element('h2', NULL, _('Change password'));
-+        common_element('h2', null, _('Change password'));
-hunk ./actions/profilesettings.php 38
--//        common_element('h2', NULL, _('Delete my account'));
-+//        common_element('h2', null, _('Delete my account'));
-hunk ./actions/public.php 34
--                           array($this, 'show_header'), NULL,
-+                           array($this, 'show_header'), null,
-hunk ./actions/publicrss.php 55
--        return NULL;
-+        return null;
-hunk ./actions/publicxrds.php 45
--        common_element('Type', NULL, 'xri://$xrds*simple');
-+        common_element('Type', null, 'xri://$xrds*simple');
-hunk ./actions/publicxrds.php 58
--    function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
-+    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
-hunk ./actions/publicxrds.php 61
--            common_element('URI', NULL, $uri);
-+            common_element('URI', null, $uri);
-hunk ./actions/publicxrds.php 63
--        common_element('Type', NULL, $type);
-+        common_element('Type', null, $type);
-hunk ./actions/publicxrds.php 66
--                common_element('Type', NULL, $param);
-+                common_element('Type', null, $param);
-hunk ./actions/publicxrds.php 71
--                common_element('Type', NULL, $sig);
-+                common_element('Type', null, $sig);
-hunk ./actions/publicxrds.php 75
--            common_element('LocalID', NULL, $localId);
-+            common_element('LocalID', null, $localId);
-hunk ./actions/recoverpassword.php 135
--    function show_top($msg=NULL) {
-+    function show_top($msg=null) {
+-    function show_form($error=null) {
++    function show_form($error=null)
++    {
+hunk ./actions/invite.php 157
+-    function send_invitation($email, $user, $personal) {
++    function send_invitation($email, $user, $personal)
++    {
+hunk ./actions/login.php 24
+-    function is_readonly() {
++    function is_readonly()
++    {
+hunk ./actions/login.php 29
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/login.php 41
+-    function check_login() {
++    function check_login()
++    {
+hunk ./actions/login.php 106
+-    function show_form($error=null) {
++    function show_form($error=null)
++    {
+hunk ./actions/login.php 127
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/login.php 146
+-    function show_top($error=null) {
++    function show_top($error=null)
++    {
+hunk ./actions/logout.php 26
+-    function is_readonly() {
++    function is_readonly()
++    {
+hunk ./actions/logout.php 31
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/microsummary.php 24
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/newmessage.php 24
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/newmessage.php 37
+-    function save_new_message() {
++    function save_new_message()
++    {
+hunk ./actions/newmessage.php 94
+-    function show_top($params) {
++    function show_top($params)
++    {
+hunk ./actions/newmessage.php 104
+-    function show_form($msg=null) {
++    function show_form($msg=null)
++    {
+hunk ./actions/newmessage.php 135
+-    function notify($from, $to, $message) {
++    function notify($from, $to, $message)
++    {
+hunk ./actions/newnotice.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/newnotice.php 47
+-    function save_new_notice() {
++    function save_new_notice()
++    {
+hunk ./actions/newnotice.php 115
+-    function ajax_error_msg($msg) {
++    function ajax_error_msg($msg)
++    {
+hunk ./actions/newnotice.php 127
+-    function show_top($content=null) {
++    function show_top($content=null)
++    {
+hunk ./actions/newnotice.php 132
+-    function show_form($msg=null) {
++    function show_form($msg=null)
++    {
+hunk ./actions/newnotice.php 154
+-    function show_notice($notice) {
++    function show_notice($notice)
++    {
+hunk ./actions/noticesearch.php 28
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/noticesearch.php 33
+-    function get_title() {
++    function get_title()
++    {
+hunk ./actions/noticesearch.php 38
+-    function show_results($q, $page) {
++    function show_results($q, $page)
++    {
+hunk ./actions/noticesearch.php 78
+-    function show_header($arr) {
++    function show_header($arr)
++    {
+hunk ./actions/noticesearch.php 94
+-    function show_notice($notice, $terms) {
++    function show_notice($notice, $terms)
++    {
+hunk ./actions/noticesearch.php 157
+-    function highlight($text, $terms) {
++    function highlight($text, $terms)
++    {
+hunk ./actions/noticesearchrss.php 28
+-    function init() {
++    function init()
++    {
+hunk ./actions/noticesearchrss.php 33
+-    function get_notices($limit=0) {
++    function get_notices($limit=0)
++    {
+hunk ./actions/noticesearchrss.php 59
+-    function get_channel() {
++    function get_channel()
++    {
+hunk ./actions/noticesearchrss.php 70
+-    function get_image() {
++    function get_image()
++    {
+hunk ./actions/nudge.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/nudge.php 75
+-    function notify($user, $other) {
++    function notify($user, $other)
++    {
+hunk ./actions/openidlogin.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/openidlogin.php 60
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/openidlogin.php 65
+-    function show_top($error=null) {
++    function show_top($error=null)
++    {
+hunk ./actions/openidlogin.php 78
+-    function show_form($error=null, $openid_url) {
++    function show_form($error=null, $openid_url)
++    {
+hunk ./actions/openidsettings.php 27
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/openidsettings.php 34
+-    function show_form($msg=null, $success=false) {
++    function show_form($msg=null, $success=false)
++    {
+hunk ./actions/openidsettings.php 121
+-    function handle_post() {
++    function handle_post()
++    {
+hunk ./actions/openidsettings.php 142
+-    function remove_openid() {
++    function remove_openid()
++    {
+hunk ./actions/opensearch.php 24
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/othersettings.php 26
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/othersettings.php 31
+-    function show_form($msg=null, $success=false) {
++    function show_form($msg=null, $success=false)
++    {
+hunk ./actions/othersettings.php 68
+-    function show_feeds_list($feeds) {
++    function show_feeds_list($feeds)
++    {
+hunk ./actions/othersettings.php 82
+-    function common_feed_item($feed) {
++    function common_feed_item($feed)
++    {
+hunk ./actions/othersettings.php 138
+-    function handle_post() {
++    function handle_post()
++    {
+hunk ./actions/othersettings.php 155
+-    function save_preferences() {
++    function save_preferences()
++    {
+hunk ./actions/peoplesearch.php 27
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/peoplesearch.php 33
+-    function get_title() {
++    function get_title()
++    {
+hunk ./actions/peoplesearch.php 38
+-    function show_results($q, $page) {
++    function show_results($q, $page)
++    {
+hunk ./actions/peoplesearch.php 77
+-    function __construct($profile, $terms) {
++    function __construct($profile, $terms)
++    {
+hunk ./actions/peoplesearch.php 85
+-    function highlight($text) {
++    function highlight($text)
++    {
+hunk ./actions/peopletag.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/peopletag.php 54
+-    function show_people($tag, $page) {
++    function show_people($tag, $page)
++    {
+hunk ./actions/peopletag.php 88
+-    function show_top($tag) {
++    function show_top($tag)
++    {
+hunk ./actions/peopletag.php 99
+-    function get_title() {
++    function get_title()
++    {
+hunk ./actions/peopletag.php 104
+-    function show_header($arr) {
++    function show_header($arr)
++    {
+hunk ./actions/postnotice.php 25
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/postnotice.php 43
+-    function save_notice(&$req, &$consumer, &$token) {
++    function save_notice(&$req, &$consumer, &$token)
++    {
+hunk ./actions/profilesettings.php 26
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/profilesettings.php 32
+-    function show_form($msg=null, $success=false) {
++    function show_form($msg=null, $success=false)
++    {
+hunk ./actions/profilesettings.php 45
+-    function handle_post() {
++    function handle_post()
++    {
+hunk ./actions/profilesettings.php 66
+-    function show_settings_form() {
++    function show_settings_form()
++    {
+hunk ./actions/profilesettings.php 117
+-    function show_avatar_form() {
++    function show_avatar_form()
++    {
+hunk ./actions/profilesettings.php 176
+-    function show_password_form() {
++    function show_password_form()
++    {
+hunk ./actions/profilesettings.php 199
+-    function save_profile() {
++    function save_profile()
++    {
+hunk ./actions/profilesettings.php 347
+-    function upload_avatar() {
++    function upload_avatar()
++    {
+hunk ./actions/profilesettings.php 395
+-    function nickname_exists($nickname) {
++    function nickname_exists($nickname)
++    {
+hunk ./actions/profilesettings.php 406
+-    function change_password() {
++    function change_password()
++    {
+hunk ./actions/public.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/public.php 45
+-    function show_top() {
++    function show_top()
++    {
+hunk ./actions/public.php 69
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/public.php 76
+-    function show_header() {
++    function show_header()
++    {
+hunk ./actions/public.php 87
+-    function show_notices($page) {
++    function show_notices($page)
++    {
+hunk ./actions/publicrss.php 28
+-    function init() {
++    function init()
++    {
+hunk ./actions/publicrss.php 33
+-    function get_notices($limit=0) {
++    function get_notices($limit=0)
++    {
+hunk ./actions/publicrss.php 47
+-    function get_channel() {
++    function get_channel()
++    {
+hunk ./actions/publicrss.php 57
+-    function get_image() {
++    function get_image()
++    {
+hunk ./actions/publicxrds.php 28
+-    function is_readonly() {
++    function is_readonly()
++    {
+hunk ./actions/publicxrds.php 33
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/publicxrds.php 60
+-    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
++    function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
++    {
+hunk ./actions/recoverpassword.php 28
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/recoverpassword.php 51
+-    function check_code() {
++    function check_code()
++    {
+hunk ./actions/recoverpassword.php 118
+-    function set_temp_user(&$user) {
++    function set_temp_user(&$user)
++    {
+hunk ./actions/recoverpassword.php 124
+-    function get_temp_user() {
++    function get_temp_user()
++    {
+hunk ./actions/recoverpassword.php 134
+-    function clear_temp_user() {
++    function clear_temp_user()
++    {
 hunk ./actions/recoverpassword.php 140
--            common_element('p', NULL, 
-+            common_element('p', null, 
-hunk ./actions/recoverpassword.php 149
--    function show_password_top($msg=NULL) {
-+    function show_password_top($msg=null) {
-hunk ./actions/recoverpassword.php 159
--    function show_form($msg=NULL) {
-+    function show_form($msg=null) {
-hunk ./actions/recoverpassword.php 161
--        common_show_header(_('Recover password'), NULL,
-+        common_show_header(_('Recover password'), null,
-hunk ./actions/recoverpassword.php 176
--    function show_password_form($msg=NULL) {
-+    function show_password_form($msg=null) {
-hunk ./actions/recoverpassword.php 178
--        common_show_header(_('Reset password'), NULL,
-+        common_show_header(_('Reset password'), null,
-hunk ./actions/recoverpassword.php 227
--                $confirm_email = NULL;
-+                $confirm_email = null;
-hunk ./actions/recoverpassword.php 270
--        common_element('p', NULL,
-+        common_element('p', null,
-hunk ./actions/recoverpassword.php 327
--        common_element('p', NULL, _('New password successfully saved. ' .
-+        common_element('p', null, _('New password successfully saved. ' .
-hunk ./actions/register.php 152
--    function show_top($error=NULL) {
-+    function show_top($error=null) {
-hunk ./actions/register.php 167
--    function show_form($error=NULL) {
-+    function show_form($error=null) {
-hunk ./actions/register.php 181
--        common_show_header(_('Register'), NULL, $error, array($this, 'show_top'));
-+        common_show_header(_('Register'), null, $error, array($this, 'show_top'));
-hunk ./actions/remotesubscribe.php 58
--    function show_top($err=NULL) {
-+    function show_top($err=null) {
-hunk ./actions/remotesubscribe.php 70
--    function show_form($err=NULL) {
-+    function show_form($err=null) {
+-    function show_top($msg=null) {
++    function show_top($msg=null)
++    {
+hunk ./actions/recoverpassword.php 155
+-    function show_password_top($msg=null) {
++    function show_password_top($msg=null)
++    {
+hunk ./actions/recoverpassword.php 166
+-    function show_form($msg=null) {
++    function show_form($msg=null)
++    {
+hunk ./actions/recoverpassword.php 184
+-    function show_password_form($msg=null) {
++    function show_password_form($msg=null)
++    {
+hunk ./actions/recoverpassword.php 203
+-    function recover_password() {
++    function recover_password()
++    {
+hunk ./actions/recoverpassword.php 287
+-    function reset_password() {
++    function reset_password()
++    {
+hunk ./actions/register.php 24
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/register.php 39
+-    function try_register() {
++    function try_register()
++    {
+hunk ./actions/register.php 138
+-    function nickname_exists($nickname) {
++    function nickname_exists($nickname)
++    {
+hunk ./actions/register.php 146
+-    function email_exists($email) {
++    function email_exists($email)
++    {
+hunk ./actions/register.php 156
+-    function show_top($error=null) {
++    function show_top($error=null)
++    {
+hunk ./actions/register.php 172
+-    function show_form($error=null) {
++    function show_form($error=null)
++    {
+hunk ./actions/register.php 245
+-    function show_success() {
++    function show_success()
++    {
+hunk ./actions/remotesubscribe.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/remotesubscribe.php 51
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/remotesubscribe.php 60
+-    function show_top($err=null) {
++    function show_top($err=null)
++    {
 hunk ./actions/remotesubscribe.php 73
--        common_show_header(_('Remote subscribe'), NULL, $err,
-+        common_show_header(_('Remote subscribe'), null, $err,
-hunk ./actions/remotesubscribe.php 156
--        $user = NULL;
-+        $user = null;
-hunk ./actions/remotesubscribe.php 176
--            return NULL;
-+            return null;
-hunk ./actions/remotesubscribe.php 184
--            return NULL;
-+            return null;
-hunk ./actions/remotesubscribe.php 188
--            return NULL;
-+            return null;
-hunk ./actions/remotesubscribe.php 194
--            return NULL;
-+            return null;
-hunk ./actions/remotesubscribe.php 202
--            return NULL;
-+            return null;
-hunk ./actions/remotesubscribe.php 206
--            return NULL;
-+            return null;
-hunk ./actions/remotesubscribe.php 213
--                return NULL;
-+                return null;
-hunk ./actions/remotesubscribe.php 218
--            return NULL;
-+            return null;
-hunk ./actions/remotesubscribe.php 228
--            return NULL;
-+            return null;
-hunk ./actions/remotesubscribe.php 242
--        return NULL;
-+        return null;
-hunk ./actions/remotesubscribe.php 270
--        $req = OAuthRequest::from_consumer_and_token($con, NULL, "POST", $url, $params);
-+        $req = OAuthRequest::from_consumer_and_token($con, null, "POST", $url, $params);
-hunk ./actions/remotesubscribe.php 275
--            return NULL;
-+            return null;
-hunk ./actions/remotesubscribe.php 283
--        $req->sign_request(omb_hmac_sha1(), $con, NULL);
-+        $req->sign_request(omb_hmac_sha1(), $con, null);
-hunk ./actions/remotesubscribe.php 294
--            return NULL;
-+            return null;
-hunk ./actions/repliesrss.php 28
--    var $user = NULL;
-+    var $user = null;
-hunk ./actions/repliesrss.php 74
--            return NULL;
-+            return null;
-hunk ./actions/repliesrss.php 77
--        return ($avatar) ? $avatar->url : NULL;
-+        return ($avatar) ? $avatar->url : null;
-hunk ./actions/showmessage.php 56
--            return NULL;
-+            return null;
-hunk ./actions/showmessage.php 88
--            return NULL;
-+            return null;
-hunk ./actions/shownotice.php 26
--    var $notice = NULL;
--    var $profile = NULL;
--    var $avatar = NULL;
-+    var $notice = null;
-+    var $profile = null;
-+    var $avatar = null;
-hunk ./actions/shownotice.php 76
--                           array($this, 'show_header'), NULL,
-+                           array($this, 'show_header'), null,
-hunk ./actions/showstream.php 288
--        common_element('h2', NULL, _('Subscriptions'));
-+        common_element('h2', null, _('Subscriptions'));
-hunk ./actions/showstream.php 418
--        common_element('h2', NULL, _('Currently'));
-+        common_element('h2', null, _('Currently'));
-hunk ./actions/smssettings.php 31
--    function show_form($msg=NULL, $success=false) {
-+    function show_form($msg=null, $success=false) {
-hunk ./actions/smssettings.php 39
--        common_element('h2', NULL, _('Address'));
-+        common_element('h2', null, _('Address'));
-hunk ./actions/smssettings.php 63
--                common_input('code', _('Confirmation code'), NULL,
-+                common_input('code', _('Confirmation code'), null,
-hunk ./actions/smssettings.php 68
--                             ($this->arg('sms')) ? $this->arg('sms') : NULL,
-+                             ($this->arg('sms')) ? $this->arg('sms') : null,
-hunk ./actions/smssettings.php 76
--            common_element('h2', NULL, _('Incoming email'));
-+            common_element('h2', null, _('Incoming email'));
-hunk ./actions/smssettings.php 94
--        common_element('h2', NULL, _('Preferences'));
-+        common_element('h2', null, _('Preferences'));
-hunk ./actions/smssettings.php 114
--            return NULL;
-+            return null;
-hunk ./actions/smssettings.php 271
--        $user->sms = NULL;
--        $user->carrier = NULL;        
--        $user->smsemail = NULL;        
-+        $user->sms = null;
-+        $user->carrier = null;        
-+        $user->smsemail = null;        
-hunk ./actions/subedit.php 24
--    var $profile = NULL;
-+    var $profile = null;
-hunk ./actions/tagother.php 52
--    function show_form($profile, $error=NULL) {
-+    function show_form($profile, $error=null) {
-hunk ./actions/tagother.php 57
--                           NULL, array($profile, $error), array($this, 'show_top'));
-+                           null, array($profile, $error), array($this, 'show_top'));
-hunk ./actions/tagother.php 181
--    function show_top($arr = NULL) {
-+    function show_top($arr = null) {
-hunk ./actions/tagother.php 187
--            common_element('p', NULL,
-+            common_element('p', null,
-hunk ./actions/tagrss.php 44
--            return NULL;
-+            return null;
-hunk ./actions/twitapidirect_messages.php 231
--        common_element('title', NULL, $title);
-+        common_element('title', null, $title);
+-    function show_form($err=null) {
++    function show_form($err=null)
++    {
+hunk ./actions/remotesubscribe.php 93
+-    function remote_subscription() {
++    function remote_subscription()
++    {
+hunk ./actions/remotesubscribe.php 160
+-    function get_user() {
++    function get_user()
++    {
+hunk ./actions/remotesubscribe.php 170
+-    function getOmb($xrds) {
++    function getOmb($xrds)
++    {
+hunk ./actions/remotesubscribe.php 231
+-    function getXRD($main_service, $main_xrds) {
++    function getXRD($main_service, $main_xrds)
++    {
+hunk ./actions/remotesubscribe.php 253
+-    function addServices($xrd, $types, &$omb) {
++    function addServices($xrd, $types, &$omb)
++    {
+hunk ./actions/remotesubscribe.php 267
+-    function request_token($omb) {
++    function request_token($omb)
++    {
+hunk ./actions/remotesubscribe.php 312
+-    function request_authorization($user, $omb, $token, $secret) {
++    function request_authorization($user, $omb, $token, $secret)
++    {
+hunk ./actions/remotesubscribe.php 394
+-    function make_nonce() {
++    function make_nonce()
++    {
+hunk ./actions/replies.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/replies.php 57
+-    function no_such_user() {
++    function no_such_user()
++    {
+hunk ./actions/replies.php 62
+-    function show_header($user) {
++    function show_header($user)
++    {
+hunk ./actions/replies.php 71
+-    function show_top($user) {
++    function show_top($user)
++    {
+hunk ./actions/replies.php 87
+-    function show_replies($user) {
++    function show_replies($user)
++    {
+hunk ./actions/repliesrss.php 30
+-    function init() {
++    function init()
++    {
+hunk ./actions/repliesrss.php 43
+-    function get_notices($limit=0) {
++    function get_notices($limit=0)
++    {
+hunk ./actions/repliesrss.php 59
+-    function get_channel() {
++    function get_channel()
++    {
+hunk ./actions/repliesrss.php 73
+-    function get_image() {
++    function get_image()
++    {
+hunk ./actions/requesttoken.php 26
+-    function is_readonly() {
++    function is_readonly()
++    {
+hunk ./actions/requesttoken.php 31
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/showfavorites.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/showfavorites.php 57
+-    function show_header($user) {
++    function show_header($user)
++    {
+hunk ./actions/showfavorites.php 66
+-    function show_top($user) {
++    function show_top($user)
++    {
+hunk ./actions/showfavorites.php 81
+-    function show_notices($user) {
++    function show_notices($user)
++    {
+hunk ./actions/showmessage.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/showmessage.php 48
+-    function get_message() {
++    function get_message()
++    {
+hunk ./actions/showmessage.php 55
+-    function get_title($user, $page) {
++    function get_title($user, $page)
++    {
+hunk ./actions/showmessage.php 76
+-    function get_messages($user, $page) {
++    function get_messages($user, $page)
++    {
+hunk ./actions/showmessage.php 84
+-    function get_message_profile($message) {
++    function get_message_profile($message)
++    {
+hunk ./actions/showmessage.php 97
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/showmessage.php 102
+-    function views_menu() {
++    function views_menu()
++    {
+hunk ./actions/shownotice.php 30
+-    function prepare($args) {
++    function prepare($args)
++    {
+hunk ./actions/shownotice.php 55
+-    function last_modified() {
++    function last_modified()
++    {
+hunk ./actions/shownotice.php 62
+-    function etag() {
++    function etag()
++    {
+hunk ./actions/shownotice.php 72
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/shownotice.php 91
+-    function show_header() {
++    function show_header()
++    {
+hunk ./actions/shownotice.php 111
+-    function show_top() {
++    function show_top()
++    {
+hunk ./actions/shownotice.php 119
+-    function no_such_notice() {
++    function no_such_notice()
++    {
+hunk ./actions/showstream.php 29
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/showstream.php 80
+-    function show_top($user) {
++    function show_top($user)
++    {
+hunk ./actions/showstream.php 105
+-    function show_header($user) {
++    function show_header($user)
++    {
+hunk ./actions/showstream.php 159
+-    function no_such_user() {
++    function no_such_user()
++    {
+hunk ./actions/showstream.php 164
+-    function show_profile($profile) {
++    function show_profile($profile)
++    {
+hunk ./actions/showstream.php 180
+-    function show_personal($profile) {
++    function show_personal($profile)
++    {
+hunk ./actions/showstream.php 255
+-    function show_remote_subscribe_link($profile) {
++    function show_remote_subscribe_link($profile)
++    {
+hunk ./actions/showstream.php 264
+-    function show_unsubscribe_form($profile) {
++    function show_unsubscribe_form($profile)
++    {
+hunk ./actions/showstream.php 279
+-    function show_subscriptions($profile) {
++    function show_subscriptions($profile)
++    {
+hunk ./actions/showstream.php 352
+-    function show_statistics($profile) {
++    function show_statistics($profile)
++    {
+hunk ./actions/showstream.php 413
+-    function show_notices($user) {
++    function show_notices($user)
++    {
+hunk ./actions/showstream.php 427
+-    function show_last_notice($profile) {
++    function show_last_notice($profile)
++    {
+hunk ./actions/showstream.php 453
+-    function newListItem($notice) {
++    function newListItem($notice)
++    {
+hunk ./actions/showstream.php 460
+-    function showAuthor() {
++    function showAuthor()
++    {
+hunk ./actions/smssettings.php 27
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/smssettings.php 32
+-    function show_form($msg=null, $success=false) {
++    function show_form($msg=null, $success=false)
++    {
+hunk ./actions/smssettings.php 108
+-    function get_confirmation() {
++    function get_confirmation()
++    {
+hunk ./actions/smssettings.php 121
+-    function handle_post() {
++    function handle_post()
++    {
+hunk ./actions/smssettings.php 151
+-    function save_preferences() {
++    function save_preferences()
++    {
+hunk ./actions/smssettings.php 179
+-    function add_address() {
++    function add_address()
++    {
+hunk ./actions/smssettings.php 235
+-    function cancel_confirmation() {
++    function cancel_confirmation()
++    {
+hunk ./actions/smssettings.php 263
+-    function remove_address() {
++    function remove_address()
++    {
+hunk ./actions/smssettings.php 293
+-    function sms_exists($sms) {
++    function sms_exists($sms)
++    {
+hunk ./actions/smssettings.php 304
+-    function carrier_select() {
++    function carrier_select()
++    {
+hunk ./actions/smssettings.php 329
+-    function confirm_code() {
++    function confirm_code()
++    {
+hunk ./actions/subedit.php 26
+-    function prepare($args) {
++    function prepare($args)
++    {
+hunk ./actions/subedit.php 60
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/subscribe.php 24
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/subscribers.php 26
+-    function gallery_type() {
++    function gallery_type()
++    {
+hunk ./actions/subscribers.php 31
+-    function get_instructions(&$profile) {
++    function get_instructions(&$profile)
++    {
+hunk ./actions/subscribers.php 41
+-    function fields() {
++    function fields()
++    {
+hunk ./actions/subscribers.php 46
+-    function div_class() {
++    function div_class()
++    {
+hunk ./actions/subscribers.php 51
+-    function get_other(&$subs) {
++    function get_other(&$subs)
++    {
+hunk ./actions/subscribers.php 56
+-    function profile_list_class() {
++    function profile_list_class()
++    {
+hunk ./actions/subscribers.php 63
+-    function show_owner_controls($profile) {
++    function show_owner_controls($profile)
++    {
+hunk ./actions/subscriptions.php 26
+-    function gallery_type() {
++    function gallery_type()
++    {
+hunk ./actions/subscriptions.php 31
+-    function get_instructions(&$profile) {
++    function get_instructions(&$profile)
++    {
+hunk ./actions/subscriptions.php 41
+-    function fields() {
++    function fields()
++    {
+hunk ./actions/subscriptions.php 46
+-    function div_class() {
++    function div_class()
++    {
+hunk ./actions/subscriptions.php 51
+-    function get_other(&$subs) {
++    function get_other(&$subs)
++    {
+hunk ./actions/subscriptions.php 56
+-    function profile_list_class() {
++    function profile_list_class()
++    {
+hunk ./actions/subscriptions.php 64
+-    function show_owner_controls($profile) {
++    function show_owner_controls($profile)
++    {
+hunk ./actions/sup.php 24
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/sup.php 46
+-    function available_periods() {
++    function available_periods()
++    {
+hunk ./actions/sup.php 60
+-    function get_updates($seconds) {
++    function get_updates($seconds)
++    {
+hunk ./actions/sup.php 81
+-    function is_readonly() {
++    function is_readonly()
++    {
+hunk ./actions/tag.php 27
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/tag.php 50
+-    function show_header($tag = false) {
++    function show_header($tag = false)
++    {
+hunk ./actions/tag.php 60
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/tag.php 65
+-    function show_top($tag = false) {
++    function show_top($tag = false)
++    {
+hunk ./actions/tag.php 131
+-    function show_tag($tag, $weight, $relative) {
++    function show_tag($tag, $weight, $relative)
++    {
+hunk ./actions/tag.php 157
+-    function show_notices($tag) {
++    function show_notices($tag)
++    {
+hunk ./actions/tagother.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/tagother.php 53
+-    function show_form($profile, $error=null) {
++    function show_form($profile, $error=null)
++    {
+hunk ./actions/tagother.php 108
+-    function save_tags() {
++    function save_tags()
++    {
+hunk ./actions/tagother.php 184
+-    function show_top($arr = null) {
++    function show_top($arr = null)
++    {
+hunk ./actions/tagrss.php 28
+-    function init() {
++    function init()
++    {
+hunk ./actions/tagrss.php 41
+-    function get_notices($limit=0) {
++    function get_notices($limit=0)
++    {
+hunk ./actions/tagrss.php 58
+-    function get_channel() {
++    function get_channel()
++    {
+hunk ./actions/twitapiaccount.php 26
+-    function verify_credentials($args, $apidata) {
++    function verify_credentials($args, $apidata)
++    {
+hunk ./actions/twitapiaccount.php 38
+-    function end_session($args, $apidata) {
++    function end_session($args, $apidata)
++    {
+hunk ./actions/twitapiaccount.php 44
+-    function update_location($args, $apidata) {
++    function update_location($args, $apidata)
++    {
+hunk ./actions/twitapiaccount.php 90
+-    function update_delivery_device($args, $apidata) {
++    function update_delivery_device($args, $apidata)
++    {
+hunk ./actions/twitapiaccount.php 96
+-    function rate_limit_status($args, $apidata) {
++    function rate_limit_status($args, $apidata)
++    {
+hunk ./actions/twitapiblocks.php 26
+-    function create($args, $apidata) {
++    function create($args, $apidata)
++    {
+hunk ./actions/twitapiblocks.php 50
+-    function destroy($args, $apidata) {
++    function destroy($args, $apidata)
++    {
+hunk ./actions/twitapidirect_messages.php 26
+-    function direct_messages($args, $apidata) {
++    function direct_messages($args, $apidata)
++    {
+hunk ./actions/twitapidirect_messages.php 32
+-    function sent($args, $apidata) {
++    function sent($args, $apidata)
++    {
+hunk ./actions/twitapidirect_messages.php 38
+-    function show_messages($args, $apidata, $type) {
++    function show_messages($args, $apidata, $type)
++    {
+hunk ./actions/twitapidirect_messages.php 116
+-    function create($args, $apidata) {
++    function create($args, $apidata)
++    {
+hunk ./actions/twitapidirect_messages.php 180
+-    function destroy($args, $apidata) {
++    function destroy($args, $apidata)
++    {
+hunk ./actions/twitapidirect_messages.php 186
+-    function show_xml_dmsgs($message) {
++    function show_xml_dmsgs($message)
++    {
+hunk ./actions/twitapidirect_messages.php 209
+-    function show_json_dmsgs($message) {
++    function show_json_dmsgs($message)
++    {
 hunk ./actions/twitapidirect_messages.php 233
--        common_element('link', NULL, $link);
--        common_element('description', NULL, $subtitle);
--        common_element('language', NULL, 'en-us');
--        common_element('ttl', NULL, '40');
-+        common_element('link', null, $link);
-+        common_element('description', null, $subtitle);
-+        common_element('language', null, 'en-us');
-+        common_element('ttl', null, '40');
-hunk ./actions/twitapidirect_messages.php 259
--        common_element('title', NULL, $title);
-+        common_element('title', null, $title);
-hunk ./actions/twitapidirect_messages.php 261
--        common_element('id', NULL, "tag:$siteserver,2008:DirectMessage");
--        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
--        common_element('updated', NULL, common_date_iso8601(strftime('%c')));
--        common_element('subtitle', NULL, $subtitle);
-+        common_element('id', null, "tag:$siteserver,2008:DirectMessage");
-+        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
-+        common_element('updated', null, common_date_iso8601(strftime('%c')));
-+        common_element('subtitle', null, $subtitle);
-hunk ./actions/twitapifriendships.php 141
--            common_element('friends', NULL, $result);
-+            common_element('friends', null, $result);
-hunk ./actions/twitapihelp.php 35
--            common_element('ok', NULL, 'true');
-+            common_element('ok', null, 'true');
-hunk ./actions/twitapistatuses.php 115
--        $user = $this->get_user(NULL, $apidata);
-+        $user = $this->get_user(null, $apidata);
-hunk ./actions/twitapistatuses.php 203
--        $suplink = common_local_url('sup', NULL, $user->id);
-+        $suplink = common_local_url('sup', null, $user->id);
-hunk ./actions/twitapistatuses.php 294
--            $reply_to = NULL;
-+            $reply_to = null;
-hunk ./actions/twittersettings.php 33
--    function show_form($msg=NULL, $success=false) {
-+    function show_form($msg=null, $success=false) {
-hunk ./actions/twittersettings.php 36
--        $fuser = NULL;
-+        $fuser = null;
-hunk ./actions/twittersettings.php 50
--        common_element('h2', NULL, _('Twitter Account'));
-+        common_element('h2', null, _('Twitter Account'));
-hunk ./actions/twittersettings.php 70
--        common_element('h2', NULL, _('Preferences'));
-+        common_element('h2', null, _('Preferences'));
-hunk ./actions/twittersettings.php 129
--            common_element('h3', NULL, _('Twitter Friends'));
-+            common_element('h3', null, _('Twitter Friends'));
-hunk ./actions/unblock.php 24
--    var $profile = NULL;
-+    var $profile = null;
-hunk ./actions/userauthorization.php 84
--        common_element('p', NULL, _('Please check these details to make sure '.
-+        common_element('p', null, _('Please check these details to make sure '.
-hunk ./actions/userauthorization.php 323
--        common_element('p', NULL,
-+        common_element('p', null,
-hunk ./actions/userauthorization.php 333
--        common_element('p', NULL,
-+        common_element('p', null,
-hunk ./actions/userbyid.php 41
--        $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : NULL;
-+        $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
-hunk ./actions/userrss.php 28
--    var $user = NULL;
-+    var $user = null;
-hunk ./actions/userrss.php 47
--            return NULL;
-+            return null;
-hunk ./actions/userrss.php 77
--            return NULL;
-+            return null;
-hunk ./actions/userrss.php 80
--        return ($avatar) ? $avatar->url : NULL;
-+        return ($avatar) ? $avatar->url : null;
-hunk ./actions/userrss.php 86
--        $url = common_local_url('sup', NULL, $this->user->id);
-+        $url = common_local_url('sup', null, $this->user->id);
-hunk ./actions/xrds.php 53
--        common_element('Type', NULL, 'xri://$xrds*simple');
-+        common_element('Type', null, 'xri://$xrds*simple');
-hunk ./actions/xrds.php 72
--                            NULL,
-+                            null,
-hunk ./actions/xrds.php 85
--        common_element('Type', NULL, 'xri://$xrds*simple');
-+        common_element('Type', null, 'xri://$xrds*simple');
-hunk ./actions/xrds.php 98
--        common_element('Type', NULL, 'xri://$xrds*simple');
-+        common_element('Type', null, 'xri://$xrds*simple');
-hunk ./actions/xrds.php 111
--    function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
-+    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
+-    function show_rss_dmsgs($message, $title, $link, $subtitle) {
++    function show_rss_dmsgs($message, $title, $link, $subtitle)
++    {
+hunk ./actions/twitapidirect_messages.php 263
+-    function show_atom_dmsgs($message, $title, $link, $subtitle) {
++    function show_atom_dmsgs($message, $title, $link, $subtitle)
++    {
+hunk ./actions/twitapidirect_messages.php 291
+-    function notify($from, $to, $message) {
++    function notify($from, $to, $message)
++    {
+hunk ./actions/twitapifavorites.php 26
+-    function favorites($args, $apidata) {
++    function favorites($args, $apidata)
++    {
+hunk ./actions/twitapifavorites.php 89
+-    function create($args, $apidata) {
++    function create($args, $apidata)
++    {
+hunk ./actions/twitapifavorites.php 139
+-    function destroy($args, $apidata) {
++    function destroy($args, $apidata)
++    {
+hunk ./actions/twitapifavorites.php 147
+-    function notify($fave, $notice, $user) {
++    function notify($fave, $notice, $user)
++    {
+hunk ./actions/twitapifavorites.php 159
+-    function notify_mail($other, $user, $notice) {
++    function notify_mail($other, $user, $notice)
++    {
+hunk ./actions/twitapifriendships.php 26
+-    function create($args, $apidata) {
++    function create($args, $apidata)
++    {
+hunk ./actions/twitapifriendships.php 79
+-    function destroy($args, $apidata) {
++    function destroy($args, $apidata)
++    {
+hunk ./actions/twitapifriendships.php 115
+-    function exists($args, $apidata) {
++    function exists($args, $apidata)
++    {
+hunk ./actions/twitapihelp.php 30
+-    function test($args, $apidata) {
++    function test($args, $apidata)
++    {
+hunk ./actions/twitapihelp.php 48
+-    function downtime_schedule($args, $apidata) {
++    function downtime_schedule($args, $apidata)
++    {
+hunk ./actions/twitapinotifications.php 27
+-    function follow($args, $apidata) {
++    function follow($args, $apidata)
++    {
+hunk ./actions/twitapinotifications.php 33
+-    function leave($args, $apidata) {
++    function leave($args, $apidata)
++    {
+hunk ./actions/twitapistatuses.php 26
+-    function public_timeline($args, $apidata) {
++    function public_timeline($args, $apidata)
++    {
+hunk ./actions/twitapistatuses.php 88
+-    function friends_timeline($args, $apidata) {
++    function friends_timeline($args, $apidata)
++    {
+hunk ./actions/twitapistatuses.php 151
+-    function user_timeline($args, $apidata) {
++    function user_timeline($args, $apidata)
++    {
+hunk ./actions/twitapistatuses.php 232
+-    function update($args, $apidata) {
++    function update($args, $apidata)
++    {
+hunk ./actions/twitapistatuses.php 328
+-    function replies($args, $apidata) {
++    function replies($args, $apidata)
++    {
+hunk ./actions/twitapistatuses.php 396
+-    function show($args, $apidata) {
++    function show($args, $apidata)
++    {
+hunk ./actions/twitapistatuses.php 422
+-    function destroy($args, $apidata) {
++    function destroy($args, $apidata)
++    {
+hunk ./actions/twitapistatuses.php 467
+-    function friends($args, $apidata) {
++    function friends($args, $apidata)
++    {
+hunk ./actions/twitapistatuses.php 473
+-    function followers($args, $apidata) {
++    function followers($args, $apidata)
++    {
+hunk ./actions/twitapistatuses.php 480
+-    function subscriptions($apidata, $other_attr, $user_attr) {
++    function subscriptions($apidata, $other_attr, $user_attr)
++    {
+hunk ./actions/twitapistatuses.php 536
+-    function show_profiles($profiles, $type) {
++    function show_profiles($profiles, $type)
++    {
+hunk ./actions/twitapistatuses.php 558
+-    function featured($args, $apidata) {
++    function featured($args, $apidata)
++    {
+hunk ./actions/twitapistatuses.php 564
+-    function supported($cmd) {
++    function supported($cmd)
++    {
+hunk ./actions/twitapiusers.php 26
+-    function show($args, $apidata) {
++    function show($args, $apidata)
++    {
+hunk ./actions/twittersettings.php 28
+-    function get_instructions() {
++    function get_instructions()
++    {
+hunk ./actions/twittersettings.php 34
+-    function show_form($msg=null, $success=false) {
++    function show_form($msg=null, $success=false)
++    {
+hunk ./actions/twittersettings.php 96
+-    function subscribed_twitter_users() {
++    function subscribed_twitter_users()
++    {
+hunk ./actions/twittersettings.php 125
+-    function show_twitter_subscriptions() {
++    function show_twitter_subscriptions()
++    {
+hunk ./actions/twittersettings.php 187
+-    function handle_post() {
++    function handle_post()
++    {
+hunk ./actions/twittersettings.php 208
+-    function add_twitter_acct() {
++    function add_twitter_acct()
++    {
+hunk ./actions/twittersettings.php 270
+-    function remove_twitter_acct() {
++    function remove_twitter_acct()
++    {
+hunk ./actions/twittersettings.php 294
+-    function save_preferences() {
++    function save_preferences()
++    {
+hunk ./actions/twittersettings.php 341
+-    function verify_credentials($screen_name, $password) {
++    function verify_credentials($screen_name, $password)
++    {
+hunk ./actions/twittersettings.php 365
+-    function set_flags(&$flink, $noticesync, $replysync, $friendsync) {
++    function set_flags(&$flink, $noticesync, $replysync, $friendsync)
++    {
+hunk ./actions/unblock.php 26
+-    function prepare($args) {
++    function prepare($args)
++    {
+hunk ./actions/unblock.php 60
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/unblock.php 68
+-    function unblock_profile() {
++    function unblock_profile()
++    {
+hunk ./actions/unsubscribe.php 22
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/updateprofile.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/updateprofile.php 44
+-    function update_profile($req, $consumer, $token) {
++    function update_profile($req, $consumer, $token)
++    {
+hunk ./actions/userauthorization.php 27
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/userauthorization.php 73
+-    function show_form($req) {
++    function show_form($req)
++    {
+hunk ./actions/userauthorization.php 134
+-    function send_authorization() {
++    function send_authorization()
++    {
+hunk ./actions/userauthorization.php 203
+-    function authorize_token(&$req) {
++    function authorize_token(&$req)
++    {
+hunk ./actions/userauthorization.php 229
+-    function save_remote_profile(&$req) {
++    function save_remote_profile(&$req)
++    {
+hunk ./actions/userauthorization.php 320
+-    function add_avatar($profile, $url) {
++    function add_avatar($profile, $url)
++    {
+hunk ./actions/userauthorization.php 327
+-    function show_accept_message($tok) {
++    function show_accept_message($tok)
++    {
+hunk ./actions/userauthorization.php 338
+-    function show_reject_message($tok) {
++    function show_reject_message($tok)
++    {
+hunk ./actions/userauthorization.php 348
+-    function store_request($req) {
++    function store_request($req)
++    {
+hunk ./actions/userauthorization.php 354
+-    function clear_request() {
++    function clear_request()
++    {
+hunk ./actions/userauthorization.php 360
+-    function get_stored_request() {
++    function get_stored_request()
++    {
+hunk ./actions/userauthorization.php 367
+-    function get_new_request() {
++    function get_new_request()
++    {
+hunk ./actions/userauthorization.php 376
+-    function validate_request(&$req) {
++    function validate_request(&$req)
++    {
+hunk ./actions/userauthorization.php 400
+-    function validate_omb(&$req) {
++    function validate_omb(&$req)
++    {
+hunk ./actions/userauthorization.php 515
+-    function check_version(&$req) {
++    function check_version(&$req)
++    {
+hunk ./actions/userauthorization.php 529
+-    function get_consumer($datastore, $req) {
++    function get_consumer($datastore, $req)
++    {
+hunk ./actions/userauthorization.php 545
+-    function get_token($datastore, &$req, $consumer) {/*{{{*/
++    function get_token($datastore, &$req, $consumer)
++    {/*{{{*/
+hunk ./actions/userauthorization.php 555
+-    function check_timestamp(&$req) {
++    function check_timestamp(&$req)
++    {
+hunk ./actions/userauthorization.php 565
+-    function check_nonce(&$datastore, &$req, $consumer, $token) {
++    function check_nonce(&$datastore, &$req, $consumer, $token)
++    {
+hunk ./actions/userauthorization.php 576
+-    function check_signature(&$req, $consumer, $token) {
++    function check_signature(&$req, $consumer, $token)
++    {
+hunk ./actions/userauthorization.php 589
+-    function get_signature_method(&$req) {
++    function get_signature_method(&$req)
++    {
+hunk ./actions/userbyid.php 24
+-    function is_readonly() {                
++    function is_readonly()
++    {                
+hunk ./actions/userbyid.php 29
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/userrss.php 30
+-    function init() {
++    function init()
++    {
+hunk ./actions/userrss.php 43
+-    function get_notices($limit=0) {
++    function get_notices($limit=0)
++    {
+hunk ./actions/userrss.php 61
+-    function get_channel() {
++    function get_channel()
++    {
+hunk ./actions/userrss.php 74
+-    function get_image() {
++    function get_image()
++    {
+hunk ./actions/userrss.php 89
+-    function init_rss($limit=0) {
++    function init_rss($limit=0)
++    {
+hunk ./actions/xrds.php 26
+-    function is_readonly() {                
++    function is_readonly()
++    {                
+hunk ./actions/xrds.php 31
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./actions/xrds.php 43
+-    function show_xrds($user) {
++    function show_xrds($user)
++    {
 hunk ./actions/xrds.php 114
--            common_element('URI', NULL, $uri);
-+            common_element('URI', null, $uri);
-hunk ./actions/xrds.php 116
--        common_element('Type', NULL, $type);
-+        common_element('Type', null, $type);
-hunk ./actions/xrds.php 119
--                common_element('Type', NULL, $param);
-+                common_element('Type', null, $param);
-hunk ./actions/xrds.php 124
--                common_element('Type', NULL, $sig);
-+                common_element('Type', null, $sig);
-hunk ./actions/xrds.php 128
--            common_element('LocalID', NULL, $localId);
-+            common_element('LocalID', null, $localId);
+-    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
++    function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
++    {
 hunk ./classes/Avatar.php 24
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
-hunk ./classes/Avatar.php 75
--            return NULL;
-+            return null;
-hunk ./classes/Avatar.php 88
--            return NULL;
-+            return null;
-hunk ./classes/Channel.php 41
--        return NULL;
-+        return null;
-hunk ./classes/Channel.php 47
--    var $conn = NULL;
-+    var $conn = null;
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
+hunk ./classes/Avatar.php 32
+-    function delete() {
++    function delete()
++    {
+hunk ./classes/Avatar.php 43
+-    function scale($size) {
++    function scale($size)
++    {
+hunk ./classes/Avatar.php 82
+-    function to_image() {
++    function to_image()
++    {
+hunk ./classes/Avatar.php 96
+-    function &pkeyGet($kv) {
++    function &pkeyGet($kv)
++    {
+hunk ./classes/Channel.php 24
+-    function on($user) {
++    function on($user)
++    {
+hunk ./classes/Channel.php 29
+-    function off($user) {
++    function off($user)
++    {
+hunk ./classes/Channel.php 34
+-    function output($user, $text) {
++    function output($user, $text)
++    {
+hunk ./classes/Channel.php 39
+-    function error($user, $text) {
++    function error($user, $text)
++    {
+hunk ./classes/Channel.php 44
+-    function source() {
++    function source()
++    {
+hunk ./classes/Channel.php 54
+-    function source() {
++    function source()
++    {
+hunk ./classes/Channel.php 59
+-    function __construct($conn) {
++    function __construct($conn)
++    {
+hunk ./classes/Channel.php 64
+-    function on($user) {
++    function on($user)
++    {
+hunk ./classes/Channel.php 69
+-    function off($user) {
++    function off($user)
++    {
+hunk ./classes/Channel.php 74
+-    function output($user, $text) {
++    function output($user, $text)
++    {
+hunk ./classes/Channel.php 80
+-    function error($user, $text) {
++    function error($user, $text)
++    {
+hunk ./classes/Channel.php 86
+-    function set_notify(&$user, $notify) {
++    function set_notify(&$user, $notify)
++    {
+hunk ./classes/Channel.php 109
+-    function source() {
++    function source()
++    {
 hunk ./classes/Channel.php 114
--        common_element('p', NULL, $text);
-+        common_element('p', null, $text);
-hunk ./classes/Channel.php 152
--    var $addr = NULL;
-+    var $addr = null;
-hunk ./classes/Channel.php 158
--    function __construct($addr=NULL) {
-+    function __construct($addr=null) {
-hunk ./classes/Command.php 26
--    var $user = NULL;
-+    var $user = null;
+-    function on($user) {
++    function on($user)
++    {
+hunk ./classes/Channel.php 119
+-    function off($user) {
++    function off($user)
++    {
+hunk ./classes/Channel.php 124
+-    function output($user, $text) {
++    function output($user, $text)
++    {
+hunk ./classes/Channel.php 134
+-    function error($user, $text) {
++    function error($user, $text)
++    {
+hunk ./classes/Channel.php 143
+-    function output($user, $text) {
++    function output($user, $text)
++    {
+hunk ./classes/Channel.php 155
+-    function error($user, $text) {
++    function error($user, $text)
++    {
+hunk ./classes/Channel.php 173
+-    function source() {
++    function source()
++    {
+hunk ./classes/Channel.php 178
+-    function __construct($addr=null) {
++    function __construct($addr=null)
++    {
+hunk ./classes/Channel.php 183
+-    function on($user) {
++    function on($user)
++    {
+hunk ./classes/Channel.php 188
+-    function off($user) {
++    function off($user)
++    {
+hunk ./classes/Channel.php 193
+-    function output($user, $text) {
++    function output($user, $text)
++    {
+hunk ./classes/Channel.php 204
+-    function error($user, $text) {
++    function error($user, $text)
++    {
+hunk ./classes/Channel.php 215
+-    function set_notify($user, $value) {
++    function set_notify($user, $value)
++    {
 hunk ./classes/Command.php 28
--    function __construct($user=NULL) {
-+    function __construct($user=null) {
-hunk ./classes/Command.php 50
--    var $word = NULL;
-+    var $word = null;
-hunk ./classes/Command.php 58
--    var $word = NULL;
-+    var $word = null;
-hunk ./classes/Command.php 66
--    var $other = NULL;
-+    var $other = null;
-hunk ./classes/Command.php 74
--    var $other = NULL;
-+    var $other = null;
-hunk ./classes/Command.php 107
--    var $other = NULL;
-+    var $other = null;
-hunk ./classes/Command.php 151
--    var $other = NULL;
-+    var $other = null;
-hunk ./classes/Command.php 185
--    var $other = NULL;
--    var $text = NULL;
-+    var $other = null;
-+    var $text = null;
-hunk ./classes/Command.php 228
--    var $other = NULL;
-+    var $other = null;
-hunk ./classes/Command.php 258
--    var $other = NULL;
-+    var $other = null;
-hunk ./classes/Command.php 284
--    var $other = NULL;
-+    var $other = null;
-hunk ./classes/Command.php 308
--    var $other = NULL;
--    function __construct($user, $other=NULL) {
-+    var $other = null;
-+    function __construct($user, $other=null) {
-hunk ./classes/Command.php 327
--    var $other = NULL;
--    function __construct($user, $other=NULL) {
-+    var $other = null;
-+    function __construct($user, $other=null) {
-hunk ./classes/CommandInterpreter.php 40
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 47
--                    return NULL;
-+                    return null;
-hunk ./classes/CommandInterpreter.php 58
--                    return NULL;
-+                    return null;
-hunk ./classes/CommandInterpreter.php 68
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 75
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 79
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 86
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 90
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 97
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 101
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 107
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 111
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 117
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 121
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 127
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 131
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 137
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 141
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 147
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 152
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 156
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 162
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 166
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 174
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 178
--                return NULL;
-+                return null;
-hunk ./classes/CommandInterpreter.php 187
--                return NULL;
-+                return null;
+-    function __construct($user=null) {
++    function __construct($user=null)
++    {
+hunk ./classes/Command.php 33
+-    function execute($channel) {
++    function execute($channel)
++    {
+hunk ./classes/Command.php 40
+-    function execute($channel) {
++    function execute($channel)
++    {
+hunk ./classes/Command.php 54
+-    function __construct($user, $word) {
++    function __construct($user, $word)
++    {
+hunk ./classes/Command.php 63
+-    function __construct($user, $word) {
++    function __construct($user, $word)
++    {
+hunk ./classes/Command.php 72
+-    function __construct($user, $other) {
++    function __construct($user, $other)
++    {
+hunk ./classes/Command.php 81
+-    function __construct($user, $other) {
++    function __construct($user, $other)
++    {
+hunk ./classes/Command.php 89
+-    function execute($channel) {
++    function execute($channel)
++    {
+hunk ./classes/Command.php 117
+-    function __construct($user, $other) {
++    function __construct($user, $other)
++    {
+hunk ./classes/Command.php 123
+-    function execute($channel) {
++    function execute($channel)
++    {
+hunk ./classes/Command.php 162
+-    function __construct($user, $other) {
++    function __construct($user, $other)
++    {
+hunk ./classes/Command.php 168
+-    function execute($channel) {
++    function execute($channel)
++    {
+hunk ./classes/Command.php 199
+-    function __construct($user, $other, $text) {
++    function __construct($user, $other, $text)
++    {
+hunk ./classes/Command.php 206
+-    function execute($channel) {
++    function execute($channel)
++    {
+hunk ./classes/Command.php 244
+-    function __construct($user, $other) {
++    function __construct($user, $other)
++    {
+hunk ./classes/Command.php 250
+-    function execute($channel) {
++    function execute($channel)
++    {
+hunk ./classes/Command.php 276
+-    function __construct($user, $other) {
++    function __construct($user, $other)
++    {
+hunk ./classes/Command.php 282
+-    function execute($channel) {
++    function execute($channel)
++    {
+hunk ./classes/Command.php 304
+-    function __construct($user, $other) {
++    function __construct($user, $other)
++    {
+hunk ./classes/Command.php 310
+-    function execute($channel) {
++    function execute($channel)
++    {
+hunk ./classes/Command.php 329
+-    function __construct($user, $other=null) {
++    function __construct($user, $other=null)
++    {
+hunk ./classes/Command.php 334
+-    function execute($channel) {
++    function execute($channel)
++    {
+hunk ./classes/Command.php 350
+-    function __construct($user, $other=null) {
++    function __construct($user, $other=null)
++    {
+hunk ./classes/Command.php 356
+-    function execute($channel) {
++    function execute($channel)
++    {
+hunk ./classes/Command.php 371
+-    function execute($channel) {
++    function execute($channel)
++    {
+hunk ./classes/CommandInterpreter.php 26
+-    function handle_command($user, $text) {
++    function handle_command($user, $text)
++    {
 hunk ./classes/Confirm_address.php 23
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
+hunk ./classes/Confirm_address.php 29
+-    function sequenceKey() { return array(false, false); }
++    function sequenceKey()
++    { return array(false, false); }
 hunk ./classes/Consumer.php 19
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
 hunk ./classes/Fave.php 18
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Fave',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Fave',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Fave',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Fave',$k,$v); }
+hunk ./classes/Fave.php 35
+-    function &pkeyGet($kv) {
++    function &pkeyGet($kv)
++    {
 hunk ./classes/Foreign_link.php 24
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
-hunk ./classes/Foreign_link.php 41
--        return NULL;        
-+        return null;        
-hunk ./classes/Foreign_link.php 54
--        return NULL;        
-+        return null;        
-hunk ./classes/Foreign_link.php 69
--        return NULL;        
-+        return null;        
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
+hunk ./classes/Foreign_link.php 59
+-    function getForeignUser() {        
++    function getForeignUser()
++    {        
+hunk ./classes/Foreign_link.php 74
+-    function getUser() {
++    function getUser()
++    {
 hunk ./classes/Foreign_service.php 20
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
 hunk ./classes/Foreign_subscription.php 19
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
 hunk ./classes/Foreign_user.php 21
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
-hunk ./classes/Foreign_user.php 39
--        return NULL;        
-+        return null;        
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
+hunk ./classes/Foreign_user.php 43
+-    function updateKeys(&$orig) {
++    function updateKeys(&$orig)
++    {
 hunk ./classes/Invitation.php 20
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
 hunk ./classes/Memcached_DataObject.php 26
--    function &staticGet($cls, $k, $v=NULL) {
-+    function &staticGet($cls, $k, $v=null) {
-hunk ./classes/Memcached_DataObject.php 59
--                $i = NULL;
-+                $i = null;
-hunk ./classes/Memcached_DataObject.php 70
--    function update($orig=NULL) {
-+    function update($orig=null) {
+-    function &staticGet($cls, $k, $v=null) {
++    function &staticGet($cls, $k, $v=null)
++    {
+hunk ./classes/Memcached_DataObject.php 48
+-    function &pkeyGet($cls, $kv) {
++    function &pkeyGet($cls, $kv)
++    {
+hunk ./classes/Memcached_DataObject.php 67
+-    function insert() {
++    function insert()
++    {
+hunk ./classes/Memcached_DataObject.php 73
+-    function update($orig=null) {
++    function update($orig=null)
++    {
+hunk ./classes/Memcached_DataObject.php 85
+-    function delete() {
++    function delete()
++    {
+hunk ./classes/Memcached_DataObject.php 108
+-    function keyTypes() {
++    function keyTypes()
++    {
+hunk ./classes/Memcached_DataObject.php 118
+-    function encache() {
++    function encache()
++    {
+hunk ./classes/Memcached_DataObject.php 143
+-    function decache() {
++    function decache()
++    {
+hunk ./classes/Memcached_DataObject.php 169
+-    function multicache($cls, $kv) {
++    function multicache($cls, $kv)
++    {
+hunk ./classes/Memcached_DataObject.php 182
+-    function getSearchEngine($table) {
++    function getSearchEngine($table)
++    {
 hunk ./classes/Message.php 25
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Message',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Message',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Message',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Message',$k,$v); }
+hunk ./classes/Message.php 31
+-    function getFrom() {
++    function getFrom()
++    {
+hunk ./classes/Message.php 36
+-    function getTo() {
++    function getTo()
++    {
 hunk ./classes/Nonce.php 21
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
 hunk ./classes/Notice.php 51
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
-hunk ./classes/Notice.php 94
--    static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL, $uri=NULL) {
-+    static function saveNew($profile_id, $content, $source=null, $is_local=1, $reply_to=null, $uri=null) {
-hunk ./classes/Notice.php 296
--    static function getStream($qry, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $order=NULL, $since=NULL) {
-+    static function getStream($qry, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $order=null, $since=null) {
-hunk ./classes/Notice.php 386
--            return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
-+            return Notice::getStreamDirect($qry, $offset, $limit, null, null, $order, null);
-hunk ./classes/Notice.php 394
--            return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
-+            return Notice::getStreamDirect($qry, $offset, $limit, null, null, $order, null);
-hunk ./classes/Notice.php 426
--                                                  $last_id, NULL, $order, NULL);
-+                                                  $last_id, null, $order, null);
-hunk ./classes/Notice.php 450
--        $notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW, NULL, NULL, $order, NULL);
-+        $notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW, null, null, $order, null);
-hunk ./classes/Notice.php 480
--    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=NULL) {
-+    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null) {
-hunk ./classes/Notice.php 499
--                                 $offset, $limit, $since_id, $before_id, NULL, $since);
-+                                 $offset, $limit, $since_id, $before_id, null, $since);
-hunk ./classes/NoticeWrapper.php 38
--    var $notices = NULL;
-+    var $notices = null;
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Notice',$k,$v); }
+hunk ./classes/Notice.php 57
+-    function getProfile() {
++    function getProfile()
++    {
+hunk ./classes/Notice.php 62
+-    function delete() {
++    function delete()
++    {
+hunk ./classes/Notice.php 70
+-    function saveTags() {
++    function saveTags()
++    {
+hunk ./classes/Notice.php 191
+-    function blowCaches($blowLast=false) {
++    function blowCaches($blowLast=false)
++    {
+hunk ./classes/Notice.php 200
+-    function blowTagCache($blowLast=false) {
++    function blowTagCache($blowLast=false)
++    {
+hunk ./classes/Notice.php 219
+-    function blowSubsCache($blowLast=false) {
++    function blowSubsCache($blowLast=false)
++    {
+hunk ./classes/Notice.php 240
+-    function blowNoticeCache($blowLast=false) {
++    function blowNoticeCache($blowLast=false)
++    {
+hunk ./classes/Notice.php 253
+-    function blowRepliesCache($blowLast=false) {
++    function blowRepliesCache($blowLast=false)
++    {
+hunk ./classes/Notice.php 272
+-    function blowPublicCache($blowLast=false) {
++    function blowPublicCache($blowLast=false)
++    {
+hunk ./classes/Notice.php 285
+-    function blowFavesCache($blowLast=false) {
++    function blowFavesCache($blowLast=false)
++    {
+hunk ./classes/Notice.php 491
+-    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null) {
++    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null)
++    {
+hunk ./classes/Notice.php 514
+-    function addToInboxes() {
++    function addToInboxes()
++    {
+hunk ./classes/Notice.php 538
+-    function blowInboxes() {
++    function blowInboxes()
++    {
+hunk ./classes/NoticeWrapper.php 41
+-    function __construct($arr) {
++    function __construct($arr)
++    {
+hunk ./classes/NoticeWrapper.php 46
+-    function fetch() {
++    function fetch()
++    {
 hunk ./classes/Notice_inbox.php 36
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
 hunk ./classes/Notice_source.php 20
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
 hunk ./classes/Notice_tag.php 33
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
+hunk ./classes/Notice_tag.php 50
+-    function blowCache() {
++    function blowCache()
++    {
 hunk ./classes/Profile.php 44
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile',$k,$v); }
-hunk ./classes/Profile.php 49
--    function getAvatar($width, $height=NULL) {
-+    function getAvatar($width, $height=null) {
-hunk ./classes/Profile.php 65
--            return NULL;
-+            return null;
-hunk ./classes/Profile.php 74
--            return NULL;
-+            return null;
-hunk ./classes/Profile.php 79
--                                           NULL, common_timestamp());
-+                                           null, common_timestamp());
-hunk ./classes/Profile.php 99
--            return NULL;
-+            return null;
-hunk ./classes/Profile.php 104
--            return NULL;
-+            return null;
-hunk ./classes/Profile.php 112
--                    return NULL;
-+                    return null;
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Profile',$k,$v); }
+hunk ./classes/Profile.php 50
+-    function getAvatar($width, $height=null) {
++    function getAvatar($width, $height=null)
++    {
+hunk ./classes/Profile.php 60
+-    function getOriginalAvatar() {
++    function getOriginalAvatar()
++    {
+hunk ./classes/Profile.php 72
+-    function setOriginal($source) {
++    function setOriginal($source)
++    {
+hunk ./classes/Profile.php 124
+-    function delete_avatars() {
++    function delete_avatars()
++    {
 hunk ./classes/Profile.php 135
--    function getCurrentNotice($dt=NULL) {
-+    function getCurrentNotice($dt=null) {
-hunk ./classes/Profile.php 146
--        return NULL;
-+        return null;
+-    function getBestName() {
++    function getBestName()
++    {
+hunk ./classes/Profile.php 141
+-    function getCurrentNotice($dt=null) {
++    function getCurrentNotice($dt=null)
++    {
+hunk ./classes/Profile.php 156
+-    function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) {
++    function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
++    {
 hunk ./classes/Profile_block.php 39
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
+hunk ./classes/Profile_block.php 45
+-    function get($blocker, $blocked) {
++    function get($blocker, $blocked)
++    {
 hunk ./classes/Profile_tag.php 19
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
 hunk ./classes/Queue_item.php 19
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
-hunk ./classes/Queue_item.php 31
--        $qi->whereAdd('claimed is NULL');
-+        $qi->whereAdd('claimed is null');
-hunk ./classes/Queue_item.php 39
--            # can we force it to only update if claimed is still NULL
-+            # can we force it to only update if claimed is still null
-hunk ./classes/Queue_item.php 52
--        $qi = NULL;
--        return NULL;
-+        $qi = null;
-+        return null;
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
+hunk ./classes/Queue_item.php 25
+-    function sequenceKey() { return array(false, false); }
++    function sequenceKey()
++    { return array(false, false); }
 hunk ./classes/Remember_me.php 18
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
+hunk ./classes/Remember_me.php 24
+-    function sequenceKey() { return array(false, false); }
++    function sequenceKey()
++    { return array(false, false); }
 hunk ./classes/Remote_profile.php 41
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
 hunk ./classes/Reply.php 19
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Reply',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Reply',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Reply',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Reply',$k,$v); }
 hunk ./classes/Sms_carrier.php 20
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
+hunk ./classes/Sms_carrier.php 26
+-    function toEmailAddress($sms) {
++    function toEmailAddress($sms)
++    {
 hunk ./classes/Subscription.php 43
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
+hunk ./classes/Subscription.php 49
+-    function &pkeyGet($kv) {
++    function &pkeyGet($kv)
++    {
 hunk ./classes/Token.php 22
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Token',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Token',$k,$v); }
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Token',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('Token',$k,$v); }
 hunk ./classes/User.php 65
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User',$k,$v); }
-hunk ./classes/User.php 121
--    function getCurrentNotice($dt=NULL) {
-+    function getCurrentNotice($dt=null) {
-hunk ./classes/User.php 124
--            return NULL;
-+            return null;
-hunk ./classes/User.php 339
--    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
-+    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
-hunk ./classes/User.php 346
--                                 $offset, $limit, $since_id, $before_id, NULL, $since);
-+                                 $offset, $limit, $since_id, $before_id, null, $since);
-hunk ./classes/User.php 349
--        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
-+        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('User',$k,$v); }
+hunk ./classes/User.php 71
+-    function getProfile() {
++    function getProfile()
++    {
+hunk ./classes/User.php 76
+-    function isSubscribed($other) {
++    function isSubscribed($other)
++    {
+hunk ./classes/User.php 87
+-    function updateKeys(&$orig) {
++    function updateKeys(&$orig)
++    {
+hunk ./classes/User.php 115
+-    function allowed_nickname($nickname) {
++    function allowed_nickname($nickname)
++    {
+hunk ./classes/User.php 126
+-    function getCurrentNotice($dt=null) {
++    function getCurrentNotice($dt=null)
++    {
+hunk ./classes/User.php 135
+-    function getCarrier() {
++    function getCarrier()
++    {
+hunk ./classes/User.php 140
+-    function subscribeTo($other) {
++    function subscribeTo($other)
++    {
+hunk ./classes/User.php 155
+-    function hasBlocked($other) {
++    function hasBlocked($other)
++    {
+hunk ./classes/User.php 283
+-    function emailChanged() {
++    function emailChanged()
++    {
+hunk ./classes/User.php 298
+-    function hasFave($notice) {
++    function hasFave($notice)
++    {
+hunk ./classes/User.php 331
+-    function mutuallySubscribed($other) {
++    function mutuallySubscribed($other)
++    {
+hunk ./classes/User.php 337
+-        function mutuallySubscribedUsers() {
++        function mutuallySubscribedUsers()
++        {
 hunk ./classes/User.php 352
--            return NULL;
-+            return null;
-hunk ./classes/User.php 368
--        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
-+        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
-hunk ./classes/User.php 380
--            $order = NULL;
-+            $order = null;
+-    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
++    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
++    {
+hunk ./classes/User.php 363
+-        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
++        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
++        {
+hunk ./classes/User.php 373
+-      function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE) {
++      function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE)
++      {
+hunk ./classes/User.php 384
+-        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
++        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
++        {
+hunk ./classes/User.php 414
+-        function blowFavesCache() {
++        function blowFavesCache()
++        {
+hunk ./classes/User.php 425
+-        function getSelfTags() {
++        function getSelfTags()
++        {
+hunk ./classes/User.php 430
+-        function setSelfTags($newtags) {
++        function setSelfTags($newtags)
++        {
+hunk ./classes/User.php 435
+-    function block($other) {
++    function block($other)
++    {
+hunk ./classes/User.php 474
+-    function unblock($other) {
++    function unblock($other)
++    {
 hunk ./classes/User_openid.php 20
--    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
-+    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
-hunk ./lib/common.php 61
--              'logfile' => NULL,
-+              'logfile' => null,
-hunk ./lib/common.php 67
--              array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : NULL,
--              'broughtby' => NULL,
-+              array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : null,
-+              'broughtby' => null,
-hunk ./lib/common.php 70
--              'broughtbyurl' => NULL,
-+              'broughtbyurl' => null,
-hunk ./lib/common.php 85
--              'params' => NULL),
-+              'params' => null),
-hunk ./lib/common.php 92
--        array('server' => NULL),
-+        array('server' => null),
-hunk ./lib/common.php 97
--        array('server' => NULL),
-+        array('server' => null),
-hunk ./lib/common.php 110
--              'host' => NULL, # only set if != server
-+              'host' => null, # only set if != server
-hunk ./lib/common.php 143
--        'mirror' => NULL,
-+        'mirror' => null,
-hunk ./lib/deleteaction.php 46
--    function show_top($arr=NULL) {
-+    function show_top($arr=null) {
-hunk ./lib/deleteaction.php 55
--        return NULL;
-+        return null;
-hunk ./lib/facebookaction.php 84
--        $facebook->api_client->profile_setFBML(NULL, $fbuid, $fbml, NULL, NULL, $fbml_main);
-+        $facebook->api_client->profile_setFBML(null, $fbuid, $fbml, null, null, $fbml_main);
-hunk ./lib/facebookaction.php 238
--    function pagination($have_before, $have_after, $page, $fbaction, $args=NULL) {
-+    function pagination($have_before, $have_after, $page, $fbaction, $args=null) {
-hunk ./lib/facebookaction.php 269
--    function pagination_url($fbaction, $args=NULL) {
-+    function pagination_url($fbaction, $args=null) {
-hunk ./lib/oauthstore.php 36
--                return NULL;
-+                return null;
-hunk ./lib/oauthstore.php 50
--            return NULL;
-+            return null;
-hunk ./lib/oauthstore.php 78
--            return NULL;
-+            return null;
-hunk ./lib/oauthstore.php 107
--                return NULL;
-+                return null;
-hunk ./lib/oauthstore.php 114
--                    return NULL;
-+                    return null;
-hunk ./lib/oauthstore.php 121
--                    return NULL;
-+                    return null;
-hunk ./lib/oauthstore.php 128
--                    return NULL;
-+                    return null;
-hunk ./lib/oauthstore.php 135
--            return NULL;
-+            return null;
-hunk ./lib/omb.php 47
--    static $con = NULL;
-+    static $con = null;
-hunk ./lib/omb.php 64
--    static $store = NULL;
-+    static $store = null;
-hunk ./lib/omb.php 72
--    static $hmac_method = NULL;
-+    static $hmac_method = null;
+-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
++    function staticGet($k,$v=null)
++    { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
+hunk ./lib/Shorturl_api.php 25
+-    function __construct($service_url) {
++    function __construct($service_url)
++    {
+hunk ./lib/Shorturl_api.php 30
+-    function shorten($url) {
++    function shorten($url)
++    {
+hunk ./lib/Shorturl_api.php 73
+-    function __construct() {
++    function __construct()
++    {
+hunk ./lib/Shorturl_api.php 92
+-    function __construct() {
++    function __construct()
++    {
+hunk ./lib/Shorturl_api.php 110
+-    function __construct() {
++    function __construct()
++    {
+hunk ./lib/common.php 166
+-function __autoload($class) {
++function __autoload($class)
++{
+hunk ./lib/deleteaction.php 24
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./lib/deleteaction.php 47
+-    function show_top($arr=null) {
++    function show_top($arr=null)
++    {
+hunk ./lib/deleteaction.php 56
+-    function get_title() {
++    function get_title()
++    {
+hunk ./lib/deleteaction.php 61
+-    function show_header() {
++    function show_header()
++    {
+hunk ./lib/facebookaction.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./lib/facebookaction.php 31
+-    function get_facebook() {
++    function get_facebook()
++    {
+hunk ./lib/facebookaction.php 38
+-    function update_profile_box($facebook, $fbuid, $user) {
++    function update_profile_box($facebook, $fbuid, $user)
++    {
+hunk ./lib/facebookaction.php 92
+-    function show_header($selected ='Home') {
++    function show_header($selected ='Home')
++    {
+hunk ./lib/facebookaction.php 115
+-    function show_footer() {
++    function show_footer()
++    {
+hunk ./lib/facebookaction.php 121
+-    function show_login_form() {
++    function show_login_form()
++    {
+hunk ./lib/facebookaction.php 157
+-    function render_notice($notice) {
++    function render_notice($notice)
++    {
+hunk ./lib/facebookaction.php 217
+-    function source_link($source) {
++    function source_link($source)
++    {
+hunk ./lib/facebookaction.php 246
+-    function pagination($have_before, $have_after, $page, $fbaction, $args=null) {
++    function pagination($have_before, $have_after, $page, $fbaction, $args=null)
++    {
+hunk ./lib/facebookaction.php 278
+-    function pagination_url($fbaction, $args=null) {
++    function pagination_url($fbaction, $args=null)
++    {
+hunk ./lib/oauthstore.php 28
+-    function lookup_consumer($consumer_key) {
++    function lookup_consumer($consumer_key)
++    {
+hunk ./lib/oauthstore.php 43
+-    function lookup_token($consumer, $token_type, $token_key) {
++    function lookup_token($consumer, $token_type, $token_key)
++    {
+hunk ./lib/oauthstore.php 56
+-    function lookup_nonce($consumer, $token, $nonce, $timestamp) {
++    function lookup_nonce($consumer, $token, $nonce, $timestamp)
++    {
+hunk ./lib/oauthstore.php 72
+-    function new_request_token($consumer) {
++    function new_request_token($consumer)
++    {
+hunk ./lib/oauthstore.php 90
+-    function fetch_request_token($consumer) {
++    function fetch_request_token($consumer)
++    {
+hunk ./lib/oauthstore.php 95
+-    function new_access_token($token, $consumer) {
++    function new_access_token($token, $consumer)
++    {
+hunk ./lib/oauthstore.php 147
+-    function fetch_access_token($consumer) {
++    function fetch_access_token($consumer)
++    {
+hunk ./lib/omb.php 46
+-function omb_oauth_consumer() {
++function omb_oauth_consumer()
++{
+hunk ./lib/omb.php 55
+-function omb_oauth_server() {
++function omb_oauth_server()
++{
+hunk ./lib/omb.php 65
+-function omb_oauth_datastore() {
++function omb_oauth_datastore()
++{
+hunk ./lib/omb.php 74
+-function omb_hmac_sha1() {
++function omb_hmac_sha1()
++{
+hunk ./lib/omb.php 83
+-function omb_get_services($xrd, $type) {
++function omb_get_services($xrd, $type)
++{
+hunk ./lib/omb.php 88
+-function omb_service_filter($type) {
++function omb_service_filter($type)
++{
 hunk ./lib/omb.php 94
--        return NULL;
-+        return null;
-hunk ./lib/omb.php 98
--        return NULL;
-+        return null;
-hunk ./lib/omb.php 105
--        return NULL;
-+        return null;
-hunk ./lib/omb.php 109
--        return NULL;
-+        return null;
-hunk ./lib/openid.php 35
--    static $store = NULL;
-+    static $store = null;
-hunk ./lib/openid.php 66
--        return NULL;
-+        return null;
-hunk ./lib/openid.php 88
--    $user = NULL;
-+    $user = null;
-hunk ./lib/openid.php 96
--function oid_check_immediate($openid_url, $backto=NULL) {
-+function oid_check_immediate($openid_url, $backto=null) {
-hunk ./lib/openid.php 180
--            common_show_header(_('OpenID Auto-Submit'), NULL, NULL, '_oid_print_instructions');
-+            common_show_header(_('OpenID Auto-Submit'), null, null, '_oid_print_instructions');
-hunk ./lib/openid.php 182
--            common_element('script', NULL,
-+            common_element('script', null,
+-function omb_match_service($service, $type) {
++function omb_match_service($service, $type)
++{
+hunk ./lib/omb.php 99
+-function omb_service_uri($service) {
++function omb_service_uri($service)
++{
+hunk ./lib/omb.php 111
+-function omb_local_id($service) {
++function omb_local_id($service)
++{
+hunk ./lib/omb.php 124
+-function omb_broadcast_remote_subscribers($notice) {
++function omb_broadcast_remote_subscribers($notice)
++{
+hunk ./lib/omb.php 155
+-function omb_post_notice($notice, $remote_profile, $subscription) {
++function omb_post_notice($notice, $remote_profile, $subscription)
++{
+hunk ./lib/omb.php 160
+-function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret) {
++function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret)
++{
+hunk ./lib/omb.php 231
+-function omb_broadcast_profile($profile) {
++function omb_broadcast_profile($profile)
++{
+hunk ./lib/omb.php 252
+-function omb_update_profile($profile, $remote_profile, $subscription) {
++function omb_update_profile($profile, $remote_profile, $subscription)
++{
+hunk ./lib/openid.php 34
+-function oid_store() {
++function oid_store()
++{
+hunk ./lib/openid.php 46
+-function oid_consumer() {
++function oid_consumer()
++{
+hunk ./lib/openid.php 53
+-function oid_clear_last() {
++function oid_clear_last()
++{
+hunk ./lib/openid.php 58
+-function oid_set_last($openid_url) {
++function oid_set_last($openid_url)
++{
+hunk ./lib/openid.php 65
+-function oid_get_last() {
++function oid_get_last()
++{
+hunk ./lib/openid.php 75
+-function oid_link_user($id, $canonical, $display) {
++function oid_link_user($id, $canonical, $display)
++{
+hunk ./lib/openid.php 93
+-function oid_get_user($openid_url) {
++function oid_get_user($openid_url)
++{
+hunk ./lib/openid.php 103
+-function oid_check_immediate($openid_url, $backto=null) {
++function oid_check_immediate($openid_url, $backto=null)
++{
+hunk ./lib/openid.php 124
+-function oid_authenticate($openid_url, $returnto, $immediate=false) {
++function oid_authenticate($openid_url, $returnto, $immediate=false)
++{
+hunk ./lib/openid.php 202
+-function _oid_print_instructions() {
++function _oid_print_instructions()
++{
+hunk ./lib/openid.php 212
+-function oid_update_user(&$user, &$sreg) {
++function oid_update_user(&$user, &$sreg)
++{
+hunk ./lib/personal.php 24
+-    function is_readonly() {
++    function is_readonly()
++    {
+hunk ./lib/personal.php 29
+-    function handle($args) {
++    function handle($args)
++    {
 hunk ./lib/personal.php 35
--        $user = NULL;
-+        $user = null;
-hunk ./lib/profilelist.php 27
--    var $profile = NULL;
--    var $owner = NULL;
--    var $action = NULL;
-+    var $profile = null;
-+    var $owner = null;
-+    var $action = null;
+-    function views_menu() {
++    function views_menu()
++    {
+hunk ./lib/personal.php 91
+-    function show_feeds_list($feeds) {
++    function show_feeds_list($feeds)
++    {
+hunk ./lib/personal.php 104
+-    function common_feed_item($feed) {
++    function common_feed_item($feed)
++    {
+hunk ./lib/personal.php 189
+-    function source_link($source) {
++    function source_link($source)
++    {
 hunk ./lib/profilelist.php 31
--    function __construct($profile, $owner=NULL, $action=NULL) {
-+    function __construct($profile, $owner=null, $action=null) {
+-    function __construct($profile, $owner=null, $action=null) {
++    function __construct($profile, $owner=null, $action=null)
++    {
+hunk ./lib/profilelist.php 38
+-    function show_list() {
++    function show_list()
++    {
+hunk ./lib/profilelist.php 58
+-    function show() {
++    function show()
++    {
+hunk ./lib/profilelist.php 165
+-    function show_owner_controls($profile) {
++    function show_owner_controls($profile)
++    {
+hunk ./lib/profilelist.php 170
+-    function highlight($text) {
++    function highlight($text)
++    {
 hunk ./lib/queuehandler.php 32
--    function QueueHandler($id=NULL) {
-+    function QueueHandler($id=null) {
-hunk ./lib/queuehandler.php 55
--        return NULL;
-+        return null;
-hunk ./lib/queuehandler.php 86
--                        $qi->claimed = NULL;
-+                        $qi->claimed = null;
-hunk ./lib/queuehandler.php 94
--                    $notice = NULL;
-+                    $notice = null;
-hunk ./lib/rssaction.php 58
--        return NULL;
-+        return null;
-hunk ./lib/rssaction.php 87
--        common_element('title', NULL, $channel['title']);
--        common_element('link', NULL, $channel['link']);
--        common_element('description', NULL, $channel['description']);
-+        common_element('title', null, $channel['title']);
-+        common_element('link', null, $channel['link']);
-+        common_element('description', null, $channel['description']);
-hunk ./lib/rssaction.php 114
--            common_element('title', NULL, $channel['title']);
--            common_element('link', NULL, $channel['link']);
--            common_element('url', NULL, $image);
-+            common_element('title', null, $channel['title']);
-+            common_element('link', null, $channel['link']);
-+            common_element('url', null, $image);
-hunk ./lib/rssaction.php 127
--        common_element('title', NULL, $title);
--        common_element('link', NULL, $nurl);
--        common_element('description', NULL, $profile->nickname."'s status on ".common_exact_date($notice->created));
--        common_element('dc:date', NULL, common_date_w3dtf($notice->created));
--        common_element('dc:creator', NULL, ($profile->fullname) ? $profile->fullname : $profile->nickname);
-+        common_element('title', null, $title);
-+        common_element('link', null, $nurl);
-+        common_element('description', null, $profile->nickname."'s status on ".common_exact_date($notice->created));
-+        common_element('dc:date', null, common_date_w3dtf($notice->created));
-+        common_element('dc:creator', null, ($profile->fullname) ? $profile->fullname : $profile->nickname);
-hunk ./lib/rssaction.php 144
--            common_element('foaf:nick', NULL, $nickname);
-+            common_element('foaf:nick', null, $nickname);
-hunk ./lib/rssaction.php 146
--                common_element('foaf:name', NULL, $profile->fullname);
-+                common_element('foaf:name', null, $profile->fullname);
-hunk ./lib/rssaction.php 148
--            common_element('sioc:id', NULL, $id);
-+            common_element('sioc:id', null, $id);
-hunk ./lib/rssaction.php 178
--        common_element('sioc:name', NULL, common_config('site', 'name'));
-+        common_element('sioc:name', null, common_config('site', 'name'));
-hunk ./lib/searchaction.php 33
--    function show_top($arr=NULL) {
-+    function show_top($arr=null) {
-hunk ./lib/searchaction.php 50
--        return NULL;
-+        return null;
+-    function QueueHandler($id=null) {
++    function QueueHandler($id=null)
++    {
+hunk ./lib/queuehandler.php 39
+-    function class_name() {
++    function class_name()
++    {
+hunk ./lib/queuehandler.php 44
+-    function name() {
++    function name()
++    {
+hunk ./lib/queuehandler.php 49
+-    function get_id() {
++    function get_id()
++    {
+hunk ./lib/queuehandler.php 54
+-    function set_id($id) {
++    function set_id($id)
++    {
+hunk ./lib/queuehandler.php 59
+-    function transport() {
++    function transport()
++    {
+hunk ./lib/queuehandler.php 64
+-    function start() {
++    function start()
++    {
+hunk ./lib/queuehandler.php 68
+-    function finish() {
++    function finish()
++    {
+hunk ./lib/queuehandler.php 72
+-    function handle_notice($notice) {
++    function handle_notice($notice)
++    {
+hunk ./lib/queuehandler.php 77
+-    function run() {
++    function run()
++    {
+hunk ./lib/queuehandler.php 123
+-    function idle($timeout=0) {
++    function idle($timeout=0)
++    {
+hunk ./lib/queuehandler.php 130
+-    function clear_old_claims() {
++    function clear_old_claims()
++    {
+hunk ./lib/queuehandler.php 140
+-    function log($level, $msg) {
++    function log($level, $msg)
++    {
+hunk ./lib/rssaction.php 29
+-    function is_readonly() {
++    function is_readonly()
++    {
+hunk ./lib/rssaction.php 34
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./lib/rssaction.php 44
+-    function init() {
++    function init()
++    {
+hunk ./lib/rssaction.php 49
+-    function get_notices() {
++    function get_notices()
++    {
+hunk ./lib/rssaction.php 54
+-    function get_channel() {
++    function get_channel()
++    {
+hunk ./lib/rssaction.php 62
+-    function get_image() {
++    function get_image()
++    {
+hunk ./lib/rssaction.php 67
+-    function show_rss($limit=0) {
++    function show_rss($limit=0)
++    {
+hunk ./lib/rssaction.php 88
+-    function show_channel($notices) {
++    function show_channel($notices)
++    {
+hunk ./lib/rssaction.php 117
+-    function show_image() {
++    function show_image()
++    {
+hunk ./lib/rssaction.php 130
+-    function show_item($notice) {
++    function show_item($notice)
++    {
+hunk ./lib/rssaction.php 149
+-    function show_creators() {
++    function show_creators()
++    {
+hunk ./lib/rssaction.php 166
+-    function init_rss() {
++    function init_rss()
++    {
+hunk ./lib/rssaction.php 198
+-    function end_rss() {
++    function end_rss()
++    {
+hunk ./lib/search_engines.php 26
+-    function __construct($target, $table) {
++    function __construct($target, $table)
++    {
+hunk ./lib/search_engines.php 32
+-    function query($q) {
++    function query($q)
++    {
+hunk ./lib/search_engines.php 36
+-    function limit($offset, $count, $rss = false) {
++    function limit($offset, $count, $rss = false)
++    {
+hunk ./lib/search_engines.php 41
+-    function set_sort_mode($mode) {
++    function set_sort_mode($mode)
++    {
+hunk ./lib/search_engines.php 52
+-    function __construct($target, $table) {
++    function __construct($target, $table)
++    {
+hunk ./lib/search_engines.php 66
+-    function is_connected() {
++    function is_connected()
++    {
+hunk ./lib/search_engines.php 71
+-    function limit($offset, $count, $rss = false) {
++    function limit($offset, $count, $rss = false)
++    {
+hunk ./lib/search_engines.php 88
+-    function query($q) {
++    function query($q)
++    {
+hunk ./lib/search_engines.php 97
+-    function set_sort_mode($mode) {
++    function set_sort_mode($mode)
++    {
+hunk ./lib/search_engines.php 107
+-    function query($q) {
++    function query($q)
++    {
+hunk ./lib/search_engines.php 119
+-    function query($q) {
++    function query($q)
++    {
+hunk ./lib/searchaction.php 24
+-    function is_readonly() {
++    function is_readonly()
++    {
+hunk ./lib/searchaction.php 29
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./lib/searchaction.php 35
+-    function show_top($arr=null) {
++    function show_top($arr=null)
++    {
+hunk ./lib/searchaction.php 52
+-    function get_title() {
++    function get_title()
++    {
 hunk ./lib/searchaction.php 57
--    function show_form($error=NULL) {
-+    function show_form($error=null) {
-hunk ./lib/searchaction.php 102
--                      ($action != 'peoplesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL),
-+                      ($action != 'peoplesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : null),
-hunk ./lib/searchaction.php 106
--                       ($action != 'noticesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL)
-+                       ($action != 'noticesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : null)
-hunk ./lib/settingsaction.php 47
--    function show_form($msg=NULL, $success=false) {
-+    function show_form($msg=null, $success=false) {
-hunk ./lib/settingsaction.php 58
--    function form_header($title, $msg=NULL, $success=false) {
-+    function form_header($title, $msg=null, $success=false) {
-hunk ./lib/settingsaction.php 60
--                           NULL,
-+                           null,
-hunk ./lib/twitter.php 151
--            return NULL;
-+            return null;
-hunk ./lib/twitter.php 157
--            return NULL;
-+            return null;
-hunk ./lib/twitterapi.php 37
--        $twitter_user['description'] = ($profile->bio) ? $profile->bio : NULL;
--        $twitter_user['location'] = ($profile->location) ? $profile->location : NULL;
-+        $twitter_user['description'] = ($profile->bio) ? $profile->bio : null;
-+        $twitter_user['location'] = ($profile->location) ? $profile->location : null;
-hunk ./lib/twitterapi.php 45
--        $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : NULL;
-+        $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : null;
-hunk ./lib/twitterapi.php 66
--        $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : NULL;
-+        $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : null;
-hunk ./lib/twitterapi.php 69
--        $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : NULL;
-+        $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : null;
-hunk ./lib/twitterapi.php 160
--                common_element($element, NULL, common_xml_safe_str($value));
-+                common_element($element, null, common_xml_safe_str($value));
-hunk ./lib/twitterapi.php 163
--                common_element($element, NULL, $value);
-+                common_element($element, null, $value);
-hunk ./lib/twitterapi.php 175
--                common_element($element, NULL, $value);
-+                common_element($element, null, $value);
-hunk ./lib/twitterapi.php 183
--        common_element('title', NULL, $entry['title']);
--        common_element('description', NULL, $entry['description']);
--        common_element('pubDate', NULL, $entry['pubDate']);
--        common_element('guid', NULL, $entry['guid']);
--        common_element('link', NULL, $entry['link']);
-+        common_element('title', null, $entry['title']);
-+        common_element('description', null, $entry['description']);
-+        common_element('pubDate', null, $entry['pubDate']);
-+        common_element('guid', null, $entry['guid']);
-+        common_element('link', null, $entry['link']);
-hunk ./lib/twitterapi.php 193
--        common_element('title', NULL, $entry['title']);
-+        common_element('title', null, $entry['title']);
-hunk ./lib/twitterapi.php 195
--        common_element('id', NULL, $entry['id']);
--        common_element('published', NULL, $entry['published']);
--        common_element('updated', NULL, $entry['updated']);
--        common_element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), NULL);
-+        common_element('id', null, $entry['id']);
-+        common_element('published', null, $entry['published']);
-+        common_element('updated', null, $entry['updated']);
-+        common_element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), null);
-hunk ./lib/twitterapi.php 243
--                common_element($element, NULL, common_xml_safe_str($value));
-+                common_element($element, null, common_xml_safe_str($value));
-hunk ./lib/twitterapi.php 246
--                common_element($element, NULL, $value);
-+                common_element($element, null, $value);
-hunk ./lib/twitterapi.php 273
--    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=NULL) {
-+    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null) {
-hunk ./lib/twitterapi.php 278
--        common_element('title', NULL, $title);
--        common_element('link', NULL, $link);
-+        common_element('title', null, $title);
-+        common_element('link', null, $link);
-hunk ./lib/twitterapi.php 287
--        common_element('description', NULL, $subtitle);
--        common_element('language', NULL, 'en-us');
--        common_element('ttl', NULL, '40');
-+        common_element('description', null, $subtitle);
-+        common_element('language', null, 'en-us');
-+        common_element('ttl', null, '40');
-hunk ./lib/twitterapi.php 307
--    function show_atom_timeline($notice, $title, $id, $link, $subtitle=NULL, $suplink=NULL) {
-+    function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null) {
-hunk ./lib/twitterapi.php 311
--        common_element('title', NULL, $title);
--        common_element('id', NULL, $id);
--        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
-+        common_element('title', null, $title);
-+        common_element('id', null, $id);
-+        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
-hunk ./lib/twitterapi.php 320
--        common_element('subtitle', NULL, $subtitle);
-+        common_element('subtitle', null, $subtitle);
-hunk ./lib/twitterapi.php 380
--        return NULL;
-+        return null;
-hunk ./lib/twitterapi.php 491
--            common_element('error', NULL, $msg);
--            common_element('request', NULL, $_SERVER['REQUEST_URI']);
-+            common_element('error', null, $msg);
-+            common_element('request', null, $_SERVER['REQUEST_URI']);
-hunk ./lib/twitterapi.php 524
--    function show_profile($profile, $content_type='xml', $notice=NULL) {
-+    function show_profile($profile, $content_type='xml', $notice=null) {
-hunk ./lib/twitterapi.php 540
--    function get_user($id, $apidata=NULL) {
-+    function get_user($id, $apidata=null) {
-hunk ./lib/twitterapi.php 559
--                return NULL;
-+                return null;
-hunk ./lib/xmppqueuehandler.php 41
--            jabber_send_presence("Send me a message to post a notice", 'available', NULL, 'available', -1);
-+            jabber_send_presence("Send me a message to post a notice", 'available', null, 'available', -1);
-hunk ./lib/xmppqueuehandler.php 48
--        $this->conn->presence(NULL, 'available', NULL, 'available', -1);
-+        $this->conn->presence(null, 'available', null, 'available', -1);
-hunk ./lib/xmppqueuehandler.php 74
--        $this->conn->message($this->listener(), $pl['body'], 'chat', NULL, $this->ofrom($pl['from']));
-+        $this->conn->message($this->listener(), $pl['body'], 'chat', null, $this->ofrom($pl['from']));
-hunk ./scripts/enjitqueuehandler.php 120
--$id = ($argc > 1) ? $argv[1] : NULL;
-+$id = ($argc > 1) ? $argv[1] : null;
-hunk ./scripts/fixup_inboxes.php 37
--$start_at = ($argc > 1) ? $argv[1] : NULL;
-+$start_at = ($argc > 1) ? $argv[1] : null;
-hunk ./scripts/fixup_notices_rendered.php 34
--$start_at = ($argc > 1) ? $argv[1] : NULL;
-+$start_at = ($argc > 1) ? $argv[1] : null;
-hunk ./scripts/jabberqueuehandler.php 38
--    var $conn = NULL;
-+    var $conn = null;
-hunk ./scripts/maildaemon.php 45
--            $this->error(NULL, _('Could not parse message.'));
-+            $this->error(null, _('Could not parse message.'));
+-    function show_header($arr) {
++    function show_header($arr)
++    {
+hunk ./lib/searchaction.php 62
+-    function show_form($error=null) {
++    function show_form($error=null)
++    {
+hunk ./lib/searchaction.php 100
+-    function search_menu() {
++    function search_menu()
++    {
+hunk ./lib/settingsaction.php 24
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./lib/settingsaction.php 44
+-    function handle_post() {
++    function handle_post()
++    {
+hunk ./lib/settingsaction.php 49
+-    function show_form($msg=null, $success=false) {
++    function show_form($msg=null, $success=false)
++    {
+hunk ./lib/settingsaction.php 54
+-    function message($msg, $success) {
++    function message($msg, $success)
++    {
+hunk ./lib/settingsaction.php 62
+-    function form_header($title, $msg=null, $success=false) {
++    function form_header($title, $msg=null, $success=false)
++    {
+hunk ./lib/settingsaction.php 70
+-    function show_top($arr) {
++    function show_top($arr)
++    {
+hunk ./lib/settingsaction.php 86
+-    function settings_menu() {
++    function settings_menu()
++    {
+hunk ./lib/stream.php 27
+-    function public_views_menu() {
++    function public_views_menu()
++    {
+hunk ./lib/stream.php 52
+-    function show_notice_list($notice) {
++    function show_notice_list($notice)
++    {
+hunk ./lib/subs.php 28
+-function subs_subscribe_user($user, $other_nickname) {
++function subs_subscribe_user($user, $other_nickname)
++{
+hunk ./lib/subs.php 45
+-function subs_subscribe_to($user, $other) {
++function subs_subscribe_to($user, $other)
++{
+hunk ./lib/subs.php 87
+-function subs_notify($listenee, $listener) {
++function subs_notify($listenee, $listener)
++{
+hunk ./lib/subs.php 95
+-function subs_notify_email($listenee, $listener) {
++function subs_notify_email($listenee, $listener)
++{
+hunk ./lib/subs.php 104
+-function subs_unsubscribe_user($user, $other_nickname) {
++function subs_unsubscribe_user($user, $other_nickname)
++{
+hunk ./lib/subs.php 119
+-function subs_unsubscribe_to($user, $other) {
++function subs_unsubscribe_to($user, $other)
++{
+hunk ./lib/theme.php 22
+-function theme_file($relative) {
++function theme_file($relative)
++{
+hunk ./lib/theme.php 28
+-function theme_path($relative) {
++function theme_path($relative)
++{
+hunk ./lib/twitter.php 22
+-function get_twitter_data($uri, $screen_name, $password) {
++function get_twitter_data($uri, $screen_name, $password)
++{
+hunk ./lib/twitter.php 52
+-function twitter_user_info($screen_name, $password) {
++function twitter_user_info($screen_name, $password)
++{
+hunk ./lib/twitter.php 71
+-function update_twitter_user($fuser, $twitter_id, $screen_name) {
++function update_twitter_user($fuser, $twitter_id, $screen_name)
++{
+hunk ./lib/twitter.php 87
+-function add_twitter_user($twitter_id, $screen_name) {
++function add_twitter_user($twitter_id, $screen_name)
++{
+hunk ./lib/twitter.php 112
+-function save_twitter_user($twitter_id, $screen_name) {
++function save_twitter_user($twitter_id, $screen_name)
++{
+hunk ./lib/twitter.php 137
+-function retreive_twitter_friends($twitter_id, $screen_name, $password) {
++function retreive_twitter_friends($twitter_id, $screen_name, $password)
++{
+hunk ./lib/twitter.php 172
+-function save_twitter_friends($user, $twitter_id, $screen_name, $password) {
++function save_twitter_friends($user, $twitter_id, $screen_name, $password)
++{
+hunk ./lib/twitterapi.php 26
+-    function handle($args) {
++    function handle($args)
++    {
+hunk ./lib/twitterapi.php 31
+-    function twitter_user_array($profile, $get_notice=false) {
++    function twitter_user_array($profile, $get_notice=false)
++    {
+hunk ./lib/twitterapi.php 60
+-    function twitter_status_array($notice, $include_user=true) {
++    function twitter_status_array($notice, $include_user=true)
++    {
+hunk ./lib/twitterapi.php 89
+-    function twitter_rss_entry_array($notice) {
++    function twitter_rss_entry_array($notice)
++    {
+hunk ./lib/twitterapi.php 114
+-    function twitter_rss_dmsg_array($message) {
++    function twitter_rss_dmsg_array($message)
++    {
+hunk ./lib/twitterapi.php 137
+-    function twitter_dmsg_array($message) {
++    function twitter_dmsg_array($message)
++    {
+hunk ./lib/twitterapi.php 158
+-    function show_twitter_xml_status($twitter_status) {
++    function show_twitter_xml_status($twitter_status)
++    {
+hunk ./lib/twitterapi.php 176
+-    function show_twitter_xml_user($twitter_user, $role='user') {
++    function show_twitter_xml_user($twitter_user, $role='user')
++    {
+hunk ./lib/twitterapi.php 189
+-    function show_twitter_rss_item($entry) {
++    function show_twitter_rss_item($entry)
++    {
+hunk ./lib/twitterapi.php 200
+-    function show_twitter_atom_entry($entry) {
++    function show_twitter_atom_entry($entry)
++    {
+hunk ./lib/twitterapi.php 212
+-    function show_json_objects($objects) {
++    function show_json_objects($objects)
++    {
+hunk ./lib/twitterapi.php 217
+-    function show_single_xml_status($notice) {
++    function show_single_xml_status($notice)
++    {
+hunk ./lib/twitterapi.php 225
+-    function show_single_json_status($notice) {
++    function show_single_json_status($notice)
++    {
+hunk ./lib/twitterapi.php 233
+-    function show_single_xml_dmsg($message) {
++    function show_single_xml_dmsg($message)
++    {
+hunk ./lib/twitterapi.php 241
+-    function show_single_json_dmsg($message) {
++    function show_single_json_dmsg($message)
++    {
+hunk ./lib/twitterapi.php 249
+-    function show_twitter_xml_dmsg($twitter_dm) {
++    function show_twitter_xml_dmsg($twitter_dm)
++    {
+hunk ./lib/twitterapi.php 268
+-    function show_xml_timeline($notice) {
++    function show_xml_timeline($notice)
++    {
+hunk ./lib/twitterapi.php 290
+-    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null) {
++    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null)
++    {
+hunk ./lib/twitterapi.php 325
+-    function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null) {
++    function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null)
++    {
+hunk ./lib/twitterapi.php 357
+-    function show_json_timeline($notice) {
++    function show_json_timeline($notice)
++    {
+hunk ./lib/twitterapi.php 383
+-    function date_twitter($dt) {
++    function date_twitter($dt)
++    {
+hunk ./lib/twitterapi.php 389
+-    function replier_by_reply($reply_id) {
++    function replier_by_reply($reply_id)
++    {
+hunk ./lib/twitterapi.php 406
+-    function count_subscriptions($profile) {
++    function count_subscriptions($profile)
++    {
+hunk ./lib/twitterapi.php 422
+-    function init_document($type='xml') {
++    function init_document($type='xml')
++    {
+hunk ./lib/twitterapi.php 454
+-    function end_document($type='xml') {
++    function end_document($type='xml')
++    {
+hunk ./lib/twitterapi.php 481
+-    function client_error($msg, $code = 400, $content_type = 'json') {
++    function client_error($msg, $code = 400, $content_type = 'json')
++    {
+hunk ./lib/twitterapi.php 530
+-    function init_twitter_rss() {
++    function init_twitter_rss()
++    {
+hunk ./lib/twitterapi.php 536
+-    function end_twitter_rss() {
++    function end_twitter_rss()
++    {
+hunk ./lib/twitterapi.php 542
+-    function init_twitter_atom() {
++    function init_twitter_atom()
++    {
+hunk ./lib/twitterapi.php 548
+-    function end_twitter_atom() {
++    function end_twitter_atom()
++    {
+hunk ./lib/twitterapi.php 554
+-    function show_profile($profile, $content_type='xml', $notice=null) {
++    function show_profile($profile, $content_type='xml', $notice=null)
++    {
+hunk ./lib/twitterapi.php 571
+-    function get_user($id, $apidata=null) {
++    function get_user($id, $apidata=null)
++    {
+hunk ./lib/twitterapi.php 583
+-    function get_profile($id) {
++    function get_profile($id)
++    {
+hunk ./lib/twitterapi.php 597
+-    function source_link($source) {
++    function source_link($source)
++    {
+hunk ./lib/twitterapi.php 617
+-    function show_extended_profile($user, $apidata) {
++    function show_extended_profile($user, $apidata)
++    {
+hunk ./lib/util.php 24
+-function common_server_error($msg, $code=500) {
++function common_server_error($msg, $code=500)
++{
+hunk ./lib/util.php 48
+-function common_user_error($msg, $code=400) {
++function common_user_error($msg, $code=400)
++{
+hunk ./lib/util.php 85
+-function common_element_start($tag, $attrs=null) {
++function common_element_start($tag, $attrs=null)
++{
+hunk ./lib/util.php 98
+-function common_element_end($tag) {
++function common_element_end($tag)
++{
+hunk ./lib/util.php 112
+-function common_element($tag, $attrs=null, $content=null) {
++function common_element($tag, $attrs=null, $content=null)
++{
+hunk ./lib/util.php 122
+-function common_start_xml($doc=null, $public=null, $system=null, $indent=true) {
++function common_start_xml($doc=null, $public=null, $system=null, $indent=true)
++{
+hunk ./lib/util.php 134
+-function common_end_xml() {
++function common_end_xml()
++{
+hunk ./lib/util.php 141
+-function common_init_locale($language=null) {
++function common_init_locale($language=null)
++{
+hunk ./lib/util.php 155
+-function common_init_language() {
++function common_init_language()
++{
+hunk ./lib/util.php 172
+-function common_show_header($pagetitle, $callable=null, $data=null, $headercall=null) {
++function common_show_header($pagetitle, $callable=null, $data=null, $headercall=null)
++{
+hunk ./lib/util.php 256
+-function common_start_html($type=null, $indent=true) {
++function common_start_html($type=null, $indent=true)
++{
+hunk ./lib/util.php 288
+-function common_show_footer() {
++function common_show_footer()
++{
+hunk ./lib/util.php 322
+-function common_text($txt) {
++function common_text($txt)
++{
+hunk ./lib/util.php 328
+-function common_raw($xml) {
++function common_raw($xml)
++{
+hunk ./lib/util.php 334
+-function common_nav_menu() {
++function common_nav_menu()
++{
+hunk ./lib/util.php 362
+-function common_foot_menu() {
++function common_foot_menu()
++{
+hunk ./lib/util.php 380
+-function common_menu_item($url, $text, $title=null, $is_selected=false) {
++function common_menu_item($url, $text, $title=null, $is_selected=false)
++{
+hunk ./lib/util.php 395
+-function common_input($id, $label, $value=null,$instructions=null) {
++function common_input($id, $label, $value=null,$instructions=null)
++{
+hunk ./lib/util.php 439
+-function common_dropdown($id, $label, $content, $instructions=null, $blank_select=FALSE, $selected=null) {
++function common_dropdown($id, $label, $content, $instructions=null, $blank_select=FALSE, $selected=null)
++{
+hunk ./lib/util.php 460
+-function common_hidden($id, $value) {
++function common_hidden($id, $value)
++{
+hunk ./lib/util.php 468
+-function common_password($id, $label, $instructions=null) {
++function common_password($id, $label, $instructions=null)
++{
+hunk ./lib/util.php 483
+-function common_submit($id, $label, $cls='submit') {
++function common_submit($id, $label, $cls='submit')
++{
+hunk ./lib/util.php 495
+-function common_textarea($id, $label, $content=null, $instructions=null) {
++function common_textarea($id, $label, $content=null, $instructions=null)
++{
+hunk ./lib/util.php 510
+-function common_timezone() {
++function common_timezone()
++{
+hunk ./lib/util.php 523
+-function common_language() {
++function common_language()
++{
+hunk ./lib/util.php 549
+-function common_munge_password($password, $id) {
++function common_munge_password($password, $id)
++{
+hunk ./lib/util.php 555
+-function common_check_user($nickname, $password) {
++function common_check_user($nickname, $password)
++{
+hunk ./lib/util.php 575
+-function common_logged_in() {
++function common_logged_in()
++{
+hunk ./lib/util.php 580
+-function common_have_session() {
++function common_have_session()
++{
+hunk ./lib/util.php 585
+-function common_ensure_session() {
++function common_ensure_session()
++{
+hunk ./lib/util.php 601
+-function common_set_user($user) {
++function common_set_user($user)
++{
+hunk ./lib/util.php 626
+-function common_set_cookie($key, $value, $expiration=0) {
++function common_set_cookie($key, $value, $expiration=0)
++{
+hunk ./lib/util.php 646
+-function common_rememberme($user=null) {
++function common_rememberme($user=null)
++{
+hunk ./lib/util.php 686
+-function common_remembered_user() {
++function common_remembered_user()
++{
+hunk ./lib/util.php 752
+-function common_forgetme() {
++function common_forgetme()
++{
+hunk ./lib/util.php 758
+-function common_current_user() {
++function common_current_user()
++{
+hunk ./lib/util.php 791
+-function common_real_login($real=true) {
++function common_real_login($real=true)
++{
+hunk ./lib/util.php 797
+-function common_is_real_login() {
++function common_is_real_login()
++{
+hunk ./lib/util.php 803
+-function common_canonical_nickname($nickname) {
++function common_canonical_nickname($nickname)
++{
+hunk ./lib/util.php 810
+-function common_canonical_email($email) {
++function common_canonical_email($email)
++{
+hunk ./lib/util.php 819
+-function common_render_content($text, $notice) {
++function common_render_content($text, $notice)
++{
+hunk ./lib/util.php 829
+-function common_render_text($text) {
++function common_render_text($text)
++{
+hunk ./lib/util.php 840
+-function common_render_uri_thingy($matches) {
++function common_render_uri_thingy($matches)
++{
+hunk ./lib/util.php 875
+-function common_longurl($short_url)  {
++function common_longurl($short_url)
++{
+hunk ./lib/util.php 882
+-function common_longurl2($uri)  {
++function common_longurl2($uri)
++{
+hunk ./lib/util.php 890
+-function common_shorten_links($text) {
++function common_shorten_links($text)
++{
+hunk ./lib/util.php 899
+-function common_shorten_link($url, $reverse = false) {
++function common_shorten_link($url, $reverse = false)
++{
+hunk ./lib/util.php 961
+-function common_xml_safe_str($str) {
++function common_xml_safe_str($str)
++{
+hunk ./lib/util.php 969
+-function common_tag_link($tag) {
++function common_tag_link($tag)
++{
+hunk ./lib/util.php 976
+-function common_canonical_tag($tag) {
++function common_canonical_tag($tag)
++{
+hunk ./lib/util.php 981
+-function common_valid_profile_tag($str) {
++function common_valid_profile_tag($str)
++{
+hunk ./lib/util.php 986
+-function common_at_link($sender_id, $nickname) {
++function common_at_link($sender_id, $nickname)
++{
+hunk ./lib/util.php 997
+-function common_at_hash_link($sender_id, $tag) {
++function common_at_hash_link($sender_id, $tag)
++{
+hunk ./lib/util.php 1014
+-function common_relative_profile($sender, $nickname, $dt=null) {
++function common_relative_profile($sender, $nickname, $dt=null)
++{
+hunk ./lib/util.php 1052
+-function common_avatar_filename($id, $extension, $size=null, $extra=null) {
++function common_avatar_filename($id, $extension, $size=null, $extra=null)
++{
+hunk ./lib/util.php 1063
+-function common_avatar_path($filename) {
++function common_avatar_path($filename)
++{
+hunk ./lib/util.php 1069
+-function common_avatar_url($filename) {
++function common_avatar_url($filename)
++{
+hunk ./lib/util.php 1074
+-function common_avatar_display_url($avatar) {
++function common_avatar_display_url($avatar)
++{
+hunk ./lib/util.php 1084
+-function common_default_avatar($size) {
++function common_default_avatar($size)
++{
+hunk ./lib/util.php 1092
+-function common_local_url($action, $args=null, $fragment=null) {
++function common_local_url($action, $args=null, $fragment=null)
++{
+hunk ./lib/util.php 1106
+-function common_fancy_url($action, $args=null) {
++function common_fancy_url($action, $args=null)
++{
+hunk ./lib/util.php 1320
+-function common_simple_url($action, $args=null) {
++function common_simple_url($action, $args=null)
++{
+hunk ./lib/util.php 1333
+-function common_path($relative) {
++function common_path($relative)
++{
+hunk ./lib/util.php 1340
+-function common_date_string($dt) {
++function common_date_string($dt)
++{
+hunk ./lib/util.php 1375
+-function common_exact_date($dt) {
++function common_exact_date($dt)
++{
+hunk ./lib/util.php 1391
+-function common_date_w3dtf($dt) {
++function common_date_w3dtf($dt)
++{
+hunk ./lib/util.php 1399
+-function common_date_rfc2822($dt) {
++function common_date_rfc2822($dt)
++{
+hunk ./lib/util.php 1407
+-function common_date_iso8601($dt) {
++function common_date_iso8601($dt)
++{
+hunk ./lib/util.php 1415
+-function common_sql_now() {
++function common_sql_now()
++{
+hunk ./lib/util.php 1420
+-function common_redirect($url, $code=307) {
++function common_redirect($url, $code=307)
++{
+hunk ./lib/util.php 1437
+-function common_save_replies($notice) {
++function common_save_replies($notice)
++{
+hunk ./lib/util.php 1521
+-function common_broadcast_notice($notice, $remote=false) {
++function common_broadcast_notice($notice, $remote=false)
++{
+hunk ./lib/util.php 1549
+-function common_twitter_broadcast($notice, $flink) {
++function common_twitter_broadcast($notice, $flink)
++{
+hunk ./lib/util.php 1610
+-function common_enqueue_notice($notice) {
++function common_enqueue_notice($notice)
++{
+hunk ./lib/util.php 1628
+-function common_dequeue_notice($notice) {
++function common_dequeue_notice($notice)
++{
+hunk ./lib/util.php 1645
+-function common_real_broadcast($notice, $remote=false) {
++function common_real_broadcast($notice, $remote=false)
++{
+hunk ./lib/util.php 1680
+-function common_broadcast_profile($profile) {
++function common_broadcast_profile($profile)
++{
+hunk ./lib/util.php 1689
+-function common_profile_url($nickname) {
++function common_profile_url($nickname)
++{
+hunk ./lib/util.php 1696
+-function common_notice_form($action=null, $content=null) {
++function common_notice_form($action=null, $content=null)
++{
+hunk ./lib/util.php 1729
+-function common_root_url() {
++function common_root_url()
++{
+hunk ./lib/util.php 1737
+-function common_good_rand($bytes) {
++function common_good_rand($bytes)
++{
+hunk ./lib/util.php 1747
+-function common_urandom($bytes) {
++function common_urandom($bytes)
++{
+hunk ./lib/util.php 1760
+-function common_mtrand($bytes) {
++function common_mtrand($bytes)
++{
+hunk ./lib/util.php 1769
+-function common_set_returnto($url) {
++function common_set_returnto($url)
++{
+hunk ./lib/util.php 1775
+-function common_get_returnto() {
++function common_get_returnto()
++{
+hunk ./lib/util.php 1781
+-function common_timestamp() {
++function common_timestamp()
++{
+hunk ./lib/util.php 1786
+-function common_ensure_syslog() {
++function common_ensure_syslog()
++{
+hunk ./lib/util.php 1796
+-function common_log($priority, $msg, $filename=null) {
++function common_log($priority, $msg, $filename=null)
++{
+hunk ./lib/util.php 1814
+-function common_debug($msg, $filename=null) {
++function common_debug($msg, $filename=null)
++{
+hunk ./lib/util.php 1823
+-function common_log_db_error(&$object, $verb, $filename=null) {
++function common_log_db_error(&$object, $verb, $filename=null)
++{
+hunk ./lib/util.php 1830
+-function common_log_objstring(&$object) {
++function common_log_objstring(&$object)
++{
+hunk ./lib/util.php 1844
+-function common_valid_http_url($url) {
++function common_valid_http_url($url)
++{
+hunk ./lib/util.php 1849
+-function common_valid_tag($tag) {
++function common_valid_tag($tag)
++{
+hunk ./lib/util.php 1860
+-function common_pagination($have_before, $have_after, $page, $action, $args=null) {
++function common_pagination($have_before, $have_after, $page, $action, $args=null)
++{
+hunk ./lib/util.php 1896
+-function common_accept_to_prefs($accept, $def = '*/*') {
++function common_accept_to_prefs($accept, $def = '*/*')
++{
+hunk ./lib/util.php 1921
+-function common_mime_type_match($type, $avail) {
++function common_mime_type_match($type, $avail)
++{
+hunk ./lib/util.php 1937
+-function common_negotiate_type($cprefs, $sprefs) {
++function common_negotiate_type($cprefs, $sprefs)
++{
+hunk ./lib/util.php 1974
+-function common_config($main, $sub) {
++function common_config($main, $sub)
++{
+hunk ./lib/util.php 1980
+-function common_copy_args($from) {
++function common_copy_args($from)
++{
+hunk ./lib/util.php 1992
+-function common_remove_magic_from_request() {
++function common_remove_magic_from_request()
++{
+hunk ./lib/util.php 2000
+-function common_user_uri(&$user) {
++function common_user_uri(&$user)
++{
+hunk ./lib/util.php 2005
+-function common_notice_uri(&$notice) {
++function common_notice_uri(&$notice)
++{
+hunk ./lib/util.php 2013
+-function common_confirmation_code($bits) {
++function common_confirmation_code($bits)
++{
+hunk ./lib/util.php 2031
+-function common_markup_to_html($c) {
++function common_markup_to_html($c)
++{
+hunk ./lib/util.php 2039
+-function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE) {
++function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE)
++{
+hunk ./lib/util.php 2049
+-function common_profile_uri($profile) {
++function common_profile_uri($profile)
++{
+hunk ./lib/util.php 2067
+-function common_canonical_sms($sms) {
++function common_canonical_sms($sms)
++{
+hunk ./lib/util.php 2074
+-function common_error_handler($errno, $errstr, $errfile, $errline, $errcontext) {
++function common_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
++{
+hunk ./lib/util.php 2096
+-function common_session_token() {
++function common_session_token()
++{
+hunk ./lib/util.php 2105
+-function common_disfavor_form($notice) {
++function common_disfavor_form($notice)
++{
+hunk ./lib/util.php 2133
+-function common_favor_form($notice) {
++function common_favor_form($notice)
++{
+hunk ./lib/util.php 2161
+-function common_nudge_form($profile) {
++function common_nudge_form($profile)
++{
+hunk ./lib/util.php 2171
+-function common_nudge_response() {
++function common_nudge_response()
++{
+hunk ./lib/util.php 2176
+-function common_subscribe_form($profile) {
++function common_subscribe_form($profile)
++{
+hunk ./lib/util.php 2193
+-function common_unsubscribe_form($profile) {
++function common_unsubscribe_form($profile)
++{
+hunk ./lib/util.php 2211
+-function common_profile_new_message_nudge ($cur, $profile) {
++function common_profile_new_message_nudge ($cur, $profile)
++{
+hunk ./lib/util.php 2229
+-function common_cache_key($extra) {
++function common_cache_key($extra)
++{
+hunk ./lib/util.php 2234
+-function common_keyize($str) {
++function common_keyize($str)
++{
+hunk ./lib/util.php 2241
+-function common_message_form($content, $user, $to) {
++function common_message_form($content, $user, $to)
++{
+hunk ./lib/util.php 2282
+-function common_memcache() {
++function common_memcache()
++{
+hunk ./lib/util.php 2303
+-function common_compatible_license($from, $to) {
++function common_compatible_license($from, $to)
++{
+hunk ./lib/util.php 2311
+-function common_block_form($profile, $args=null) {
++function common_block_form($profile, $args=null)
++{
+hunk ./lib/util.php 2316
+-function common_unblock_form($profile, $args=null) {
++function common_unblock_form($profile, $args=null)
++{
+hunk ./lib/util.php 2321
+-function common_blocking_form($type, $label, $profile, $args=null) {
++function common_blocking_form($type, $label, $profile, $args=null)
++{
+hunk ./lib/xmppqueuehandler.php 33
+-    function start() {
++    function start()
++    {
+hunk ./lib/xmppqueuehandler.php 47
+-    function handle_reconnect(&$pl) {
++    function handle_reconnect(&$pl)
++    {
+hunk ./lib/xmppqueuehandler.php 53
+-    function idle($timeout=0) {
++    function idle($timeout=0)
++    {
+hunk ./lib/xmppqueuehandler.php 66
+-    function forward_message(&$pl) {
++    function forward_message(&$pl)
++    {
+hunk ./lib/xmppqueuehandler.php 81
+-    function ofrom($from) {
++    function ofrom($from)
++    {
+hunk ./lib/xmppqueuehandler.php 89
+-    function listener() {
++    function listener()
++    {
+hunk ./scripts/enjitqueuehandler.php 38
+-    function transport() {
++    function transport()
++    {
+hunk ./scripts/enjitqueuehandler.php 43
+-    function start() {
++    function start()
++    {
+hunk ./scripts/enjitqueuehandler.php 50
+-    function handle_notice($notice) {
++    function handle_notice($notice)
++    {
+hunk ./scripts/jabberqueuehandler.php 40
+-    function transport() {
++    function transport()
++    {
+hunk ./scripts/jabberqueuehandler.php 45
+-    function handle_notice($notice) {
++    function handle_notice($notice)
++    {
+hunk ./scripts/maildaemon.php 39
+-    function __construct() {
++    function __construct()
++    {
+hunk ./scripts/maildaemon.php 43
+-    function handle_message($fname='php://stdin') {
++    function handle_message($fname='php://stdin')
++    {
+hunk ./scripts/maildaemon.php 71
+-    function error($from, $msg) {
++    function error($from, $msg)
++    {
 hunk ./scripts/maildaemon.php 77
--            return NULL;
-+            return null;
-hunk ./scripts/maildaemon.php 143
--            return NULL;
-+            return null;
-hunk ./scripts/maildaemon.php 170
--        $this->error(NULL, "Unsupported message type: " . $type);
-+        $this->error(null, "Unsupported message type: " . $type);
-hunk ./scripts/ombqueuehandler.php 70
--$id = ($argc > 1) ? $argv[1] : NULL;
-+$id = ($argc > 1) ? $argv[1] : null;
-hunk ./scripts/smsqueuehandler.php 60
--$id = ($argc > 1) ? $argv[1] : NULL;
-+$id = ($argc > 1) ? $argv[1] : null;
+-    function user_from($from_hdr) {
++    function user_from($from_hdr)
++    {
+hunk ./scripts/maildaemon.php 92
+-    function user_match_to($user, $to_hdr) {
++    function user_match_to($user, $to_hdr)
++    {
+hunk ./scripts/maildaemon.php 104
+-    function handle_command($user, $from, $msg) {
++    function handle_command($user, $from, $msg)
++    {
+hunk ./scripts/maildaemon.php 115
+-    function respond($from, $to, $response) {
++    function respond($from, $to, $response)
++    {
+hunk ./scripts/maildaemon.php 125
+-    function log($level, $msg) {
++    function log($level, $msg)
++    {
+hunk ./scripts/maildaemon.php 130
+-    function add_notice($user, $msg) {
++    function add_notice($user, $msg)
++    {
+hunk ./scripts/maildaemon.php 145
+-    function parse_message($fname) {
++    function parse_message($fname)
++    {
+hunk ./scripts/maildaemon.php 179
+-    function unsupported_type($type) {
++    function unsupported_type($type)
++    {
+hunk ./scripts/maildaemon.php 184
+-    function cleanup_msg($msg) {
++    function cleanup_msg($msg)
++    {
+hunk ./scripts/ombqueuehandler.php 38
+-    function transport() {
++    function transport()
++    {
+hunk ./scripts/ombqueuehandler.php 43
+-    function start() {
++    function start()
++    {
+hunk ./scripts/ombqueuehandler.php 49
+-    function handle_notice($notice) {
++    function handle_notice($notice)
++    {
+hunk ./scripts/ombqueuehandler.php 59
+-    function finish() {
++    function finish()
++    {
+hunk ./scripts/ombqueuehandler.php 63
+-    function is_remote($notice) {
++    function is_remote($notice)
++    {
+hunk ./scripts/publicqueuehandler.php 38
+-    function transport() {
++    function transport()
++    {
+hunk ./scripts/publicqueuehandler.php 43
+-    function handle_notice($notice) {
++    function handle_notice($notice)
++    {
+hunk ./scripts/sitemap.php 21
+-function index_map() {
++function index_map()
++{
+hunk ./scripts/sitemap.php 44
+-function standard_map() {
++function standard_map()
++{
+hunk ./scripts/sitemap.php 82
+-function notices_map() {
++function notices_map()
++{
+hunk ./scripts/sitemap.php 121
+-function user_map() {
++function user_map()
++{
+hunk ./scripts/sitemap.php 215
+-function url($url_args) {
++function url($url_args)
++{
+hunk ./scripts/sitemap.php 246
+-function sitemap($sitemap_args) {
++function sitemap($sitemap_args)
++{
+hunk ./scripts/sitemap.php 268
+-function urlset($urlset_text) {
++function urlset($urlset_text)
++{
+hunk ./scripts/sitemap.php 279
+-function sitemapindex($sitemapindex_text) {
++function sitemapindex($sitemapindex_text)
++{
+hunk ./scripts/sitemap.php 290
+-function array_to_map($url_list, $filename_prefix) {
++function array_to_map($url_list, $filename_prefix)
++{
+hunk ./scripts/sitemap.php 309
+-function parse_args() {
++function parse_args()
++{
+hunk ./scripts/sitemap.php 351
+-function trailing_slash($path) {
++function trailing_slash($path)
++{
+hunk ./scripts/sitemap.php 361
+-function write_file($path, $data) {
++function write_file($path, $data)
++{
+hunk ./scripts/sitemap.php 379
+-function error ($error_msg) {
++function error ($error_msg)
++{
+hunk ./scripts/smsqueuehandler.php 38
+-    function transport() {
++    function transport()
++    {
+hunk ./scripts/smsqueuehandler.php 43
+-    function start() {
++    function start()
++    {
+hunk ./scripts/smsqueuehandler.php 49
+-    function handle_notice($notice) {
++    function handle_notice($notice)
++    {
+hunk ./scripts/smsqueuehandler.php 54
+-    function finish() {
++    function finish()
++    {
+hunk ./scripts/xmppconfirmhandler.php 42
+-    function class_name() {
++    function class_name()
++    {
+hunk ./scripts/xmppconfirmhandler.php 47
+-    function run() {
++    function run()
++    {
 hunk ./scripts/xmppconfirmhandler.php 104
--        $confirm->whereAdd('claimed IS NULL');
--        $confirm->whereAdd('sent IS NULL');
-+        $confirm->whereAdd('claimed IS null');
-+        $confirm->whereAdd('sent IS null');
-hunk ./scripts/xmppconfirmhandler.php 125
--        return NULL;
-+        return null;
-hunk ./scripts/xmppconfirmhandler.php 130
--        $confirm->claimed = NULL;
-+        $confirm->claimed = null;
+-    function next_confirm() {
++    function next_confirm()
++    {
+hunk ./scripts/xmppconfirmhandler.php 131
+-    function clear_old_confirm_claims() {
++    function clear_old_confirm_claims()
++    {
 hunk ./scripts/xmppdaemon.php 42
--    function XMPPDaemon($resource=NULL) {
-+    function XMPPDaemon($resource=null) {
-hunk ./scripts/xmppdaemon.php 74
--                             NULL, 'available', 100);
-+                             null, 'available', 100);
-hunk ./scripts/xmppdaemon.php 95
--        $this->conn->presence('Send me a message to post a notice', 'available', NULL, 'available', 100);
-+        $this->conn->presence('Send me a message to post a notice', 'available', null, 'available', 100);
-hunk ./scripts/xmppdaemon.php 168
--            return NULL;
-+            return null;
-hunk ./scripts/xmppdaemon.php 173
--            return NULL;
-+            return null;
-hunk ./scripts/xmppdaemon.php 177
--            return NULL;
-+            return null;
-hunk ./scripts/xmppdaemon.php 182
--            return NULL;
-+            return null;
-hunk ./scripts/xmppdaemon.php 186
--            return NULL;
-+            return null;
-hunk ./scripts/xmppdaemon.php 191
--            return NULL;
-+            return null;
+-    function XMPPDaemon($resource=null) {
++    function XMPPDaemon($resource=null)
++    {
+hunk ./scripts/xmppdaemon.php 60
+-    function connect() {
++    function connect()
++    {
+hunk ./scripts/xmppdaemon.php 80
+-    function name() {
++    function name()
++    {
+hunk ./scripts/xmppdaemon.php 85
+-    function run() {
++    function run()
++    {
+hunk ./scripts/xmppdaemon.php 97
+-    function handle_reconnect(&$pl) {
++    function handle_reconnect(&$pl)
++    {
+hunk ./scripts/xmppdaemon.php 103
+-    function get_user($from) {
++    function get_user($from)
++    {
+hunk ./scripts/xmppdaemon.php 109
+-    function handle_message(&$pl) {
++    function handle_message(&$pl)
++    {
+hunk ./scripts/xmppdaemon.php 166
+-    function is_self($from) {
++    function is_self($from)
++    {
+hunk ./scripts/xmppdaemon.php 171
+-    function get_ofrom($pl) {
++    function get_ofrom($pl)
++    {
+hunk ./scripts/xmppdaemon.php 206
+-    function is_autoreply($txt) {
++    function is_autoreply($txt)
++    {
+hunk ./scripts/xmppdaemon.php 215
+-    function is_otr($txt) {
++    function is_otr($txt)
++    {
+hunk ./scripts/xmppdaemon.php 224
+-    function is_direct($txt) {
++    function is_direct($txt)
++    {
+hunk ./scripts/xmppdaemon.php 233
+-    function from_site($address, $msg) {
++    function from_site($address, $msg)
++    {
+hunk ./scripts/xmppdaemon.php 239
+-    function handle_command($user, $body) {
++    function handle_command($user, $body)
++    {
+hunk ./scripts/xmppdaemon.php 252
+-    function add_notice(&$user, &$pl) {
++    function add_notice(&$user, &$pl)
++    {
+hunk ./scripts/xmppdaemon.php 275
+-    function handle_presence(&$pl) {
++    function handle_presence(&$pl)
++    {
+hunk ./scripts/xmppdaemon.php 310
+-    function log($level, $msg) {
++    function log($level, $msg)
++    {
+hunk ./scripts/xmppdaemon.php 315
+-    function subscribed($to) {
++    function subscribed($to)
++    {
diff --git a/actions/accesstoken.php b/actions/accesstoken.php
index a468c33a6..738ec071f 100644
--- a/actions/accesstoken.php
+++ b/actions/accesstoken.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/omb.php');
 
 class AccesstokenAction extends Action {
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         try {
             common_debug('getting request from env variables', __FILE__);
diff --git a/actions/all.php b/actions/all.php
index 066ee77bf..028a3679a 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/actions/showstream.php');
 
 class AllAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -53,7 +54,8 @@ class AllAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_header($user) {
+    function show_header($user)
+    {
         common_element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('allrss', array('nickname' =>
                                                                                $user->nickname)),
@@ -61,7 +63,8 @@ class AllAction extends StreamAction {
                                      'title' => sprintf(_('Feed for friends of %s'), $user->nickname)));
     }
 
-    function show_top($user) {
+    function show_top($user)
+    {
         $cur = common_current_user();
 
         if ($cur && $cur->id == $user->id) {
@@ -76,7 +79,8 @@ class AllAction extends StreamAction {
                                               'item' => 'allrss')));
     }
 
-    function show_notices($user) {
+    function show_notices($user)
+    {
 
         $page = $this->trimmed('page');
         if (!$page) {
diff --git a/actions/allrss.php b/actions/allrss.php
index 851cd0ad5..9c20cd416 100644
--- a/actions/allrss.php
+++ b/actions/allrss.php
@@ -27,7 +27,8 @@ class AllrssAction extends Rss10Action {
 
     var $user = null;
 
-    function init() {
+    function init()
+    {
         $nickname = $this->trimmed('nickname');
         $this->user = User::staticGet('nickname', $nickname);
 
@@ -39,7 +40,8 @@ class AllrssAction extends Rss10Action {
         }
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
 
         $user = $this->user;
         
@@ -52,7 +54,8 @@ class AllrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         $user = $this->user;
         $c = array('url' => common_local_url('allrss',
                                              array('nickname' =>
@@ -65,7 +68,8 @@ class AllrssAction extends Rss10Action {
         return $c;
     }
 
-    function get_image() {
+    function get_image()
+    {
         $user = $this->user;
         $profile = $user->getProfile();
         if (!$profile) {
diff --git a/actions/api.php b/actions/api.php
index e7646a7bb..8ccd86f0b 100644
--- a/actions/api.php
+++ b/actions/api.php
@@ -27,7 +27,8 @@ class ApiAction extends Action {
     var $api_method;
     var $api_action;
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $this->api_action = $this->arg('apiaction');
@@ -79,7 +80,8 @@ class ApiAction extends Action {
         }
     }
 
-    function process_command() {
+    function process_command()
+    {
         $action = "twitapi$this->api_action";
         $actionfile = INSTALLDIR."/actions/$action.php";
 
@@ -108,7 +110,8 @@ class ApiAction extends Action {
     }
 
     # Whitelist of API methods that don't need authentication
-    function requires_auth() {
+    function requires_auth()
+    {
         static $noauth = array( 'statuses/public_timeline',
                                 'statuses/show',
                                 'users/show',
@@ -144,7 +147,8 @@ class ApiAction extends Action {
         }
     }
 
-    function show_basic_auth_error() {
+    function show_basic_auth_error()
+    {
         header('HTTP/1.1 401 Unauthorized');
         $msg = 'Could not authenticate you.';
 
@@ -166,7 +170,8 @@ class ApiAction extends Action {
         }
     }
 
-    function is_readonly() {
+    function is_readonly()
+    {
         # NOTE: before handle(), can't use $this->arg
         $apiaction = $_REQUEST['apiaction'];
         $method = $_REQUEST['method'];
diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php
index 2ca861a66..4aeb4112a 100644
--- a/actions/avatarbynickname.php
+++ b/actions/avatarbynickname.php
@@ -20,7 +20,8 @@
 if (!defined('LACONICA')) { exit(1); }
 
 class AvatarbynicknameAction extends Action {
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $nickname = $this->trimmed('nickname');
         if (!$nickname) {
diff --git a/actions/block.php b/actions/block.php
index cfcd29848..702adcffa 100644
--- a/actions/block.php
+++ b/actions/block.php
@@ -23,7 +23,8 @@ class BlockAction extends Action {
 
     var $profile = null;
 
-    function prepare($args) {
+    function prepare($args)
+    {
 
         parent::prepare($args);
 
@@ -56,7 +57,8 @@ class BlockAction extends Action {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             if ($this->arg('block')) {
@@ -71,7 +73,8 @@ class BlockAction extends Action {
         }
     }
 
-    function are_you_sure_form() {
+    function are_you_sure_form()
+    {
 
         $id = $this->profile->id;
 
@@ -109,7 +112,8 @@ class BlockAction extends Action {
         common_show_footer();
     }
 
-    function block_profile() {
+    function block_profile()
+    {
 
         $cur = common_current_user();
 
diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php
index 562b70fe9..d926864a6 100644
--- a/actions/confirmaddress.php
+++ b/actions/confirmaddress.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class ConfirmaddressAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (!common_logged_in()) {
             common_set_returnto($this->self_url());
diff --git a/actions/deletenotice.php b/actions/deletenotice.php
index 0777918d2..4f00db617 100644
--- a/actions/deletenotice.php
+++ b/actions/deletenotice.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/deleteaction.php');
 
 class DeletenoticeAction extends DeleteAction {
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         # XXX: Ajax!
 
@@ -33,15 +34,18 @@ class DeletenoticeAction extends DeleteAction {
         }
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('You are about to permanently delete a notice.  Once this is done, it cannot be undone.');
     }
 
-    function get_title() {
+    function get_title()
+    {
         return _('Delete notice');
     }
 
-    function show_form($error=null) {
+    function show_form($error=null)
+    {
         $user = common_current_user();
 
         common_show_header($this->get_title(), array($this, 'show_header'), $error,
@@ -67,7 +71,8 @@ class DeletenoticeAction extends DeleteAction {
         common_show_footer();
     }
 
-    function delete_notice() {
+    function delete_notice()
+    {
         # CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
diff --git a/actions/deleteprofile.php b/actions/deleteprofile.php
index 503b3666d..b1c346cb2 100644
--- a/actions/deleteprofile.php
+++ b/actions/deleteprofile.php
@@ -20,7 +20,8 @@
 if (!defined('LACONICA')) { exit(1); }
 
 class DeleteprofileAction extends Action {
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $this->server_error(_('Code not yet ready.'));
         return;
@@ -32,18 +33,21 @@ class DeleteprofileAction extends Action {
         }
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Export and delete your user information.');
     }
 
-    function form_header($title, $msg=null, $success=false) {
+    function form_header($title, $msg=null, $success=false)
+    {
         common_show_header($title,
                            null,
                            array($msg, $success),
                            array($this, 'show_top'));
     }
 
-    function show_feeds_list($feeds) {
+    function show_feeds_list($feeds)
+    {
         common_element_start('div', array('class' => 'feedsdel'));
         common_element('p', null, 'Feeds:');
         common_element_start('ul', array('class' => 'xoxo'));
@@ -56,7 +60,8 @@ class DeleteprofileAction extends Action {
     }
 
     //TODO move to common.php (and retrace its origin)
-    function common_feed_item($feed) {
+    function common_feed_item($feed)
+    {
         $user = common_current_user();
         $nickname = $user->nickname;
 
@@ -84,14 +89,16 @@ class DeleteprofileAction extends Action {
         common_element_end('li');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $this->form_header(_('Delete my account'), $msg, $success);
         common_element('h2', null, _('Delete my account confirmation'));
         $this->show_confirm_delete_form();
         common_show_footer();
     }
 
-    function show_confirm_delete_form() {
+    function show_confirm_delete_form()
+    {
         $user = common_current_user();
         $notices = DB_DataObject::factory('notice');
         $notices->profile_id = $user->id;
@@ -120,7 +127,8 @@ class DeleteprofileAction extends Action {
         common_element_end('form');
     }
 
-    function handle_post() {
+    function handle_post()
+    {
         # CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
@@ -134,7 +142,8 @@ class DeleteprofileAction extends Action {
         $this->show_form();
     }
 
-    function delete_account() {
+    function delete_account()
+    {
         $user = common_current_user();
         assert(!is_null($user)); # should already be checked
 
@@ -219,7 +228,8 @@ class DeleteprofileAction extends Action {
         common_redirect(common_local_url('public'));
     }
 
-    function show_top($arr) {
+    function show_top($arr)
+    {
         $msg = $arr[0];
         $success = $arr[1];
         if ($msg) {
@@ -234,7 +244,8 @@ class DeleteprofileAction extends Action {
         $this->settings_menu();
     }
 
-    function settings_menu() {
+    function settings_menu()
+    {
         # action => array('prompt', 'title')
         $menu =
           array('profilesettings' =>
diff --git a/actions/disfavor.php b/actions/disfavor.php
index e47e68a8c..f0b528453 100644
--- a/actions/disfavor.php
+++ b/actions/disfavor.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class DisfavorAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
diff --git a/actions/doc.php b/actions/doc.php
index 0cf665d68..441ac19a7 100644
--- a/actions/doc.php
+++ b/actions/doc.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class DocAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $title = $this->trimmed('title');
         $filename = INSTALLDIR.'/doc/'.$title;
diff --git a/actions/emailsettings.php b/actions/emailsettings.php
index 06b3ef29f..3dcf7716f 100644
--- a/actions/emailsettings.php
+++ b/actions/emailsettings.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
 
 class EmailsettingsAction extends SettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Manage how you get email from %%site.name%%.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $user = common_current_user();
         $this->form_header(_('Email Settings'), $msg, $success);
         common_element_start('form', array('method' => 'post',
@@ -110,7 +112,8 @@ class EmailsettingsAction extends SettingsAction {
         common_show_footer();
     }
 
-    function get_confirmation() {
+    function get_confirmation()
+    {
         $user = common_current_user();
         $confirm = new Confirm_address();
         $confirm->user_id = $user->id;
@@ -122,7 +125,8 @@ class EmailsettingsAction extends SettingsAction {
         }
     }
 
-    function handle_post() {
+    function handle_post()
+    {
 
         # CSRF protection
         $token = $this->trimmed('token');
@@ -148,7 +152,8 @@ class EmailsettingsAction extends SettingsAction {
         }
     }
 
-    function save_preferences() {
+    function save_preferences()
+    {
 
         $emailnotifysub = $this->boolean('emailnotifysub');
         $emailnotifyfav = $this->boolean('emailnotifyfav');
@@ -185,7 +190,8 @@ class EmailsettingsAction extends SettingsAction {
         $this->show_form(_('Preferences saved.'), true);
     }
 
-    function add_address() {
+    function add_address()
+    {
 
         $user = common_current_user();
 
@@ -236,7 +242,8 @@ class EmailsettingsAction extends SettingsAction {
         $this->show_form($msg, TRUE);
     }
 
-    function cancel_confirmation() {
+    function cancel_confirmation()
+    {
         $email = $this->arg('email');
         $confirm = $this->get_confirmation();
         if (!$confirm) {
@@ -259,7 +266,8 @@ class EmailsettingsAction extends SettingsAction {
         $this->show_form(_('Confirmation cancelled.'), TRUE);
     }
 
-    function remove_address() {
+    function remove_address()
+    {
 
         $user = common_current_user();
         $email = $this->arg('email');
@@ -285,7 +293,8 @@ class EmailsettingsAction extends SettingsAction {
         $this->show_form(_('The address was removed.'), TRUE);
     }
 
-    function remove_incoming() {
+    function remove_incoming()
+    {
         $user = common_current_user();
         
         if (!$user->incomingemail) {
@@ -304,7 +313,8 @@ class EmailsettingsAction extends SettingsAction {
         $this->show_form(_('Incoming email address removed.'), TRUE);
     }
 
-    function new_incoming() {
+    function new_incoming()
+    {
         $user = common_current_user();
         
         $orig = clone($user);
@@ -318,7 +328,8 @@ class EmailsettingsAction extends SettingsAction {
         $this->show_form(_('New incoming email address added.'), TRUE);
     }
     
-    function email_exists($email) {
+    function email_exists($email)
+    {
         $user = common_current_user();
         $other = User::staticGet('email', $email);
         if (!$other) {
diff --git a/actions/facebookhome.php b/actions/facebookhome.php
index c964f451a..006f35eca 100644
--- a/actions/facebookhome.php
+++ b/actions/facebookhome.php
@@ -23,13 +23,15 @@ require_once(INSTALLDIR.'/lib/facebookaction.php');
 
 class FacebookhomeAction extends FacebookAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $this->login();
     }
 
-    function login() {
+    function login()
+    {
 
         $user = null;
 
@@ -89,7 +91,8 @@ class FacebookhomeAction extends FacebookAction {
 
     }
 
-    function show_home($facebook, $fbuid, $user) {
+    function show_home($facebook, $fbuid, $user)
+    {
 
         $this->show_header('Home');
 
@@ -99,7 +102,8 @@ class FacebookhomeAction extends FacebookAction {
         $this->show_footer();
     }
 
-    function show_notices($user) {
+    function show_notices($user)
+    {
 
         $page = $this->trimmed('page');
         if (!$page) {
diff --git a/actions/facebookinvite.php b/actions/facebookinvite.php
index 3a85a7c5c..fc226e65a 100644
--- a/actions/facebookinvite.php
+++ b/actions/facebookinvite.php
@@ -23,13 +23,15 @@ require_once(INSTALLDIR.'/lib/facebookaction.php');
 
 class FacebookinviteAction extends FacebookAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $this->display();
     }
 
-    function display() {
+    function display()
+    {
 
         $facebook = $this->get_facebook();
 
diff --git a/actions/facebookremove.php b/actions/facebookremove.php
index 1215f6622..79dc32e49 100644
--- a/actions/facebookremove.php
+++ b/actions/facebookremove.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/facebookaction.php');
 
 class FacebookremoveAction extends FacebookAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $secret = common_config('facebook', 'secret');
diff --git a/actions/facebooksettings.php b/actions/facebooksettings.php
index a5ad9d07a..03ad57813 100644
--- a/actions/facebooksettings.php
+++ b/actions/facebooksettings.php
@@ -23,13 +23,15 @@ require_once(INSTALLDIR.'/lib/facebookaction.php');
 
 class FacebooksettingsAction extends FacebookAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $this->display();
     }
 
-    function display() {
+    function display()
+    {
 
         $facebook = $this->get_facebook();
 
diff --git a/actions/favor.php b/actions/favor.php
index c0b0324b5..3ec4af0b5 100644
--- a/actions/favor.php
+++ b/actions/favor.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/mail.php');
 
 class FavorAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if (!common_logged_in()) {
@@ -80,7 +81,8 @@ class FavorAction extends Action {
         }
     }
 
-    function notify($fave, $notice, $user) {
+    function notify($fave, $notice, $user)
+    {
         $other = User::staticGet('id', $notice->profile_id);
         if ($other && $other->id != $user->id) {
             if ($other->email && $other->emailnotifyfav) {
diff --git a/actions/favorited.php b/actions/favorited.php
index e69630d50..d479e1b3e 100644
--- a/actions/favorited.php
+++ b/actions/favorited.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/stream.php');
 
 class FavoritedAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -37,7 +38,8 @@ class FavoritedAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_top() {
+    function show_top()
+    {
         $instr = $this->get_instructions();
         $output = common_markup_to_html($instr);
         common_element_start('div', 'instructions');
@@ -46,15 +48,18 @@ class FavoritedAction extends StreamAction {
         $this->public_views_menu();
     }
 
-    function show_header() {
+    function show_header()
+    {
         return;
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Showing recently popular notices');
     }
 
-    function show_notices($page) {
+    function show_notices($page)
+    {
 
         $qry = 'SELECT notice.*, sum(exp(-(now() - fave.modified) / %s)) as weight ' .
                 'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
diff --git a/actions/favoritesrss.php b/actions/favoritesrss.php
index 7071812d7..aa8a3c6f4 100644
--- a/actions/favoritesrss.php
+++ b/actions/favoritesrss.php
@@ -27,7 +27,8 @@ class FavoritesrssAction extends Rss10Action {
 
     var $user = null;
     
-    function init() {
+    function init()
+    {
         $nickname = $this->trimmed('nickname');
         $this->user = User::staticGet('nickname', $nickname);
 
@@ -39,7 +40,8 @@ class FavoritesrssAction extends Rss10Action {
         }
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
 
         $user = $this->user;
 
@@ -54,7 +56,8 @@ class FavoritesrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         $user = $this->user;
         $c = array('url' => common_local_url('favoritesrss',
                                              array('nickname' =>
@@ -67,7 +70,8 @@ class FavoritesrssAction extends Rss10Action {
         return $c;
     }
 
-    function get_image() {
+    function get_image()
+    {
         return null;
     }
 }
\ No newline at end of file
diff --git a/actions/featured.php b/actions/featured.php
index f478a4017..1763adeab 100644
--- a/actions/featured.php
+++ b/actions/featured.php
@@ -24,7 +24,8 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
 
 class FeaturedAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -38,7 +39,8 @@ class FeaturedAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_top() {
+    function show_top()
+    {
         $instr = $this->get_instructions();
         $output = common_markup_to_html($instr);
         common_element_start('div', 'instructions');
@@ -47,14 +49,17 @@ class FeaturedAction extends StreamAction {
         $this->public_views_menu();
     }
 
-    function show_header() {
+    function show_header()
+    {
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Featured users');
     }
 
-    function show_notices($page) {
+    function show_notices($page)
+    {
 
         // XXX: Note I'm doing it this two-stage way because a raw query
         // with a JOIN was *not* working. --Zach
diff --git a/actions/finishaddopenid.php b/actions/finishaddopenid.php
index 7607688de..d8409b6e9 100644
--- a/actions/finishaddopenid.php
+++ b/actions/finishaddopenid.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class FinishaddopenidAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (!common_logged_in()) {
             common_user_error(_('Not logged in.'));
@@ -32,7 +33,8 @@ class FinishaddopenidAction extends Action {
         }
     }
     
-    function try_login() {
+    function try_login()
+    {
 
         $consumer =& oid_consumer();
 
@@ -95,7 +97,8 @@ class FinishaddopenidAction extends Action {
         }
     }
 
-    function message($msg) {
+    function message($msg)
+    {
         common_show_header(_('OpenID Login'));
         common_element('p', null, $msg);
         common_show_footer();
diff --git a/actions/finishimmediate.php b/actions/finishimmediate.php
index ea711f5c5..c4a1c1af9 100644
--- a/actions/finishimmediate.php
+++ b/actions/finishimmediate.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class FinishimmediateAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $consumer = oid_consumer();
@@ -53,7 +54,8 @@ class FinishimmediateAction extends Action {
         return;
     }
 
-    function go_backto() {
+    function go_backto()
+    {
         common_ensure_session();
         $backto = $_SESSION['openid_immediate_backto'];
         if (!$backto) {
diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php
index ae5b136a2..eb52d73b1 100644
--- a/actions/finishopenidlogin.php
+++ b/actions/finishopenidlogin.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class FinishopenidloginAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (common_logged_in()) {
             common_user_error(_('Already logged in.'));
@@ -52,7 +53,8 @@ class FinishopenidloginAction extends Action {
         }
     }
 
-    function show_top($error=null) {
+    function show_top($error=null)
+    {
         if ($error) {
             common_element('div', array('class' => 'error'), $error);
         } else {
@@ -62,7 +64,8 @@ class FinishopenidloginAction extends Action {
         }
     }
 
-    function show_form($error=null, $username=null) {
+    function show_form($error=null, $username=null)
+    {
         common_show_header(_('OpenID Account Setup'), null, $error,
                            array($this, 'show_top'));
 
@@ -99,7 +102,8 @@ class FinishopenidloginAction extends Action {
         common_show_footer();
     }
 
-    function try_login() {
+    function try_login()
+    {
 
         $consumer = oid_consumer();
 
@@ -146,26 +150,30 @@ class FinishopenidloginAction extends Action {
         }
     }
 
-    function message($msg) {
+    function message($msg)
+    {
         common_show_header(_('OpenID Login'));
         common_element('p', null, $msg);
         common_show_footer();
     }
 
-    function save_values($display, $canonical, $sreg) {
+    function save_values($display, $canonical, $sreg)
+    {
         common_ensure_session();
         $_SESSION['openid_display'] = $display;
         $_SESSION['openid_canonical'] = $canonical;
         $_SESSION['openid_sreg'] = $sreg;
     }
 
-    function get_saved_values() {
+    function get_saved_values()
+    {
         return array($_SESSION['openid_display'],
                      $_SESSION['openid_canonical'],
                      $_SESSION['openid_sreg']);
     }
 
-    function create_new_user() {
+    function create_new_user()
+    {
 
         # FIXME: save invite code before redirect, and check here
 
@@ -247,7 +255,8 @@ class FinishopenidloginAction extends Action {
         common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)));
     }
 
-    function connect_user() {
+    function connect_user()
+    {
 
         $nickname = $this->trimmed('nickname');
         $password = $this->trimmed('password');
@@ -286,7 +295,8 @@ class FinishopenidloginAction extends Action {
         $this->go_home($user->nickname);
     }
 
-    function go_home($nickname) {
+    function go_home($nickname)
+    {
         $url = common_get_returnto();
         if ($url) {
             # We don't have to return to it again
@@ -299,7 +309,8 @@ class FinishopenidloginAction extends Action {
         common_redirect($url);
     }
 
-    function best_new_nickname($display, $sreg) {
+    function best_new_nickname($display, $sreg)
+    {
 
         # Try the passed-in nickname
 
@@ -332,7 +343,8 @@ class FinishopenidloginAction extends Action {
         return null;
     }
 
-    function is_new_nickname($str) {
+    function is_new_nickname($str)
+    {
         if (!Validate::string($str, array('min_length' => 1,
                                           'max_length' => 64,
                                           'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
@@ -347,7 +359,8 @@ class FinishopenidloginAction extends Action {
         return true;
     }
 
-    function openid_to_nickname($openid) {
+    function openid_to_nickname($openid)
+    {
         if (Auth_Yadis_identifierScheme($openid) == 'XRI') {
             return $this->xri_to_nickname($openid);
         } else {
@@ -360,7 +373,8 @@ class FinishopenidloginAction extends Action {
     # 2. One element in path, like http://profile.typekey.com/EvanProdromou/
     #    or http://getopenid.com/evanprodromou
 
-    function url_to_nickname($openid) {
+    function url_to_nickname($openid)
+    {
         static $bad = array('query', 'user', 'password', 'port', 'fragment');
 
         $parts = parse_url($openid);
@@ -406,7 +420,8 @@ class FinishopenidloginAction extends Action {
         return null;
     }
 
-    function xri_to_nickname($xri) {
+    function xri_to_nickname($xri)
+    {
         $base = $this->xri_base($xri);
 
         if (!$base) {
@@ -419,7 +434,8 @@ class FinishopenidloginAction extends Action {
         }
     }
 
-    function xri_base($xri) {
+    function xri_base($xri)
+    {
         if (substr($xri, 0, 6) == 'xri://') {
             return substr($xri, 6);
         } else {
@@ -429,7 +445,8 @@ class FinishopenidloginAction extends Action {
 
     # Given a string, try to make it work as a nickname
 
-    function nicknamize($str) {
+    function nicknamize($str)
+    {
         $str = preg_replace('/\W/', '', $str);
         return strtolower($str);
     }
diff --git a/actions/finishremotesubscribe.php b/actions/finishremotesubscribe.php
index edd4ae541..38a56c962 100644
--- a/actions/finishremotesubscribe.php
+++ b/actions/finishremotesubscribe.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/omb.php');
 
 class FinishremotesubscribeAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -231,13 +232,15 @@ class FinishremotesubscribeAction extends Action {
                                                              $user->nickname)));
     }
 
-    function add_avatar($profile, $url) {
+    function add_avatar($profile, $url)
+    {
         $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
         copy($url, $temp_filename);
         return $profile->setOriginal($temp_filename);
     }
 
-    function access_token($omb) {
+    function access_token($omb)
+    {
 
         common_debug('starting request for access token', __FILE__);
 
diff --git a/actions/foaf.php b/actions/foaf.php
index 218e20f5f..893e2a861 100644
--- a/actions/foaf.php
+++ b/actions/foaf.php
@@ -25,11 +25,13 @@ define('BOTH', 0);
 
 class FoafAction extends Action {
 
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $nickname = $this->trimmed('nickname');
@@ -179,14 +181,16 @@ class FoafAction extends Action {
         common_element_end('rdf:RDF');
     }
 
-    function show_ppd($foaf_url, $person_uri) {
+    function show_ppd($foaf_url, $person_uri)
+    {
         common_element_start('PersonalProfileDocument', array('rdf:about' => $foaf_url));
         common_element('maker', array('rdf:resource' => $person_uri));
         common_element('primaryTopic', array('rdf:resource' => $person_uri));
         common_element_end('PersonalProfileDocument');
     }
 
-    function show_microblogging_account($profile, $service=null) {
+    function show_microblogging_account($profile, $service=null)
+    {
         # Their account
         common_element_start('holdsAccount');
         common_element_start('OnlineAccount');
diff --git a/actions/imsettings.php b/actions/imsettings.php
index 8f546f8e7..cccd5db49 100644
--- a/actions/imsettings.php
+++ b/actions/imsettings.php
@@ -24,11 +24,13 @@ require_once(INSTALLDIR.'/lib/jabber.php');
 
 class ImsettingsAction extends SettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('You can send and receive notices through Jabber/GTalk [instant messages](%%doc.im%%). Configure your address and settings below.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $user = common_current_user();
         $this->form_header(_('IM Settings'), $msg, $success);
         common_element_start('form', array('method' => 'post',
@@ -85,7 +87,8 @@ class ImsettingsAction extends SettingsAction {
         common_show_footer();
     }
 
-    function get_confirmation() {
+    function get_confirmation()
+    {
         $user = common_current_user();
         $confirm = new Confirm_address();
         $confirm->user_id = $user->id;
@@ -97,7 +100,8 @@ class ImsettingsAction extends SettingsAction {
         }
     }
 
-    function handle_post() {
+    function handle_post()
+    {
 
         # CSRF protection
         $token = $this->trimmed('token');
@@ -119,7 +123,8 @@ class ImsettingsAction extends SettingsAction {
         }
     }
 
-    function save_preferences() {
+    function save_preferences()
+    {
 
         $jabbernotify = $this->boolean('jabbernotify');
         $updatefrompresence = $this->boolean('updatefrompresence');
@@ -152,7 +157,8 @@ class ImsettingsAction extends SettingsAction {
         $this->show_form(_('Preferences saved.'), true);
     }
 
-    function add_address() {
+    function add_address()
+    {
 
         $user = common_current_user();
 
@@ -207,7 +213,8 @@ class ImsettingsAction extends SettingsAction {
         $this->show_form($msg, TRUE);
     }
 
-    function cancel_confirmation() {
+    function cancel_confirmation()
+    {
         $jabber = $this->arg('jabber');
         $confirm = $this->get_confirmation();
         if (!$confirm) {
@@ -230,7 +237,8 @@ class ImsettingsAction extends SettingsAction {
         $this->show_form(_('Confirmation cancelled.'), TRUE);
     }
 
-    function remove_address() {
+    function remove_address()
+    {
 
         $user = common_current_user();
         $jabber = $this->arg('jabber');
@@ -258,7 +266,8 @@ class ImsettingsAction extends SettingsAction {
         $this->show_form(_('The address was removed.'), TRUE);
     }
 
-    function jabber_exists($jabber) {
+    function jabber_exists($jabber)
+    {
         $user = common_current_user();
         $other = User::staticGet('jabber', $jabber);
         if (!$other) {
diff --git a/actions/invite.php b/actions/invite.php
index feef94d0f..b0fc79958 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -21,11 +21,13 @@ if (!defined('LACONICA')) { exit(1); }
 
 class InviteAction extends Action {
 
-    function is_readonly() {
+    function is_readonly()
+    {
         return false;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (!common_logged_in()) {
             $this->client_error(sprintf(_('You must be logged in to invite other users to use %s'),
@@ -38,7 +40,8 @@ class InviteAction extends Action {
         }
     }
 
-    function send_invitations() {
+    function send_invitations()
+    {
 
         # CSRF protection
         $token = $this->trimmed('token');
@@ -112,7 +115,8 @@ class InviteAction extends Action {
         common_show_footer();
     }
 
-    function show_top($error=null) {
+    function show_top($error=null)
+    {
         if ($error) {
             common_element('p', 'error', $error);
         } else {
@@ -123,7 +127,8 @@ class InviteAction extends Action {
         }
     }
 
-    function show_form($error=null) {
+    function show_form($error=null)
+    {
 
         global $config;
 
@@ -149,7 +154,8 @@ class InviteAction extends Action {
         common_show_footer();
     }
 
-    function send_invitation($email, $user, $personal) {
+    function send_invitation($email, $user, $personal)
+    {
 
         $profile = $user->getProfile();
         $bestname = $profile->getBestName();
diff --git a/actions/login.php b/actions/login.php
index f3509519e..6ad07b610 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -21,11 +21,13 @@ if (!defined('LACONICA')) { exit(1); }
 
 class LoginAction extends Action {
 
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (common_is_real_login()) {
             common_user_error(_('Already logged in.'));
@@ -36,7 +38,8 @@ class LoginAction extends Action {
         }
     }
 
-    function check_login() {
+    function check_login()
+    {
         # XXX: login throttle
 
         # CSRF protection - token set in common_notice_form()
@@ -100,7 +103,8 @@ class LoginAction extends Action {
         common_redirect($url);
     }
 
-    function show_form($error=null) {
+    function show_form($error=null)
+    {
         common_show_header(_('Login'), null, $error, array($this, 'show_top'));
         common_element_start('form', array('method' => 'post',
                                            'id' => 'login',
@@ -120,7 +124,8 @@ class LoginAction extends Action {
         common_show_footer();
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         if (common_logged_in() &&
             !common_is_real_login() &&
             common_get_returnto())
@@ -138,7 +143,8 @@ class LoginAction extends Action {
         }
     }
 
-    function show_top($error=null) {
+    function show_top($error=null)
+    {
         if ($error) {
             common_element('p', 'error', $error);
         } else {
diff --git a/actions/logout.php b/actions/logout.php
index 4c59e47ad..effb5abbe 100644
--- a/actions/logout.php
+++ b/actions/logout.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class LogoutAction extends Action {
     
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
     
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (!common_logged_in()) {
             common_user_error(_('Not logged in.'));
diff --git a/actions/microsummary.php b/actions/microsummary.php
index ced4b0d1e..a19a26dcf 100644
--- a/actions/microsummary.php
+++ b/actions/microsummary.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class MicrosummaryAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
diff --git a/actions/newmessage.php b/actions/newmessage.php
index eb582c2a5..0a537ad2d 100644
--- a/actions/newmessage.php
+++ b/actions/newmessage.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class NewmessageAction extends Action {
     
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if (!common_logged_in()) {
@@ -33,7 +34,8 @@ class NewmessageAction extends Action {
         }
     }
 
-    function save_new_message() {
+    function save_new_message()
+    {
         $user = common_current_user();
         assert($user); # XXX: maybe an error instead...
 
@@ -89,7 +91,8 @@ class NewmessageAction extends Action {
         common_redirect($url, 303);
     }
 
-    function show_top($params) {
+    function show_top($params)
+    {
 
         list($content, $user, $to) = $params;
         
@@ -98,7 +101,8 @@ class NewmessageAction extends Action {
         common_message_form($content, $user, $to);
     }
 
-    function show_form($msg=null) {
+    function show_form($msg=null)
+    {
         
         $content = $this->trimmed('content');
         $user = common_current_user();
@@ -128,7 +132,8 @@ class NewmessageAction extends Action {
         common_show_footer();
     }
     
-    function notify($from, $to, $message) {
+    function notify($from, $to, $message)
+    {
         mail_notify_message($message, $from, $to);
         # XXX: Jabber, SMS notifications... probably queued
     }
diff --git a/actions/newnotice.php b/actions/newnotice.php
index 98556c36b..1f6117c1e 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -23,7 +23,8 @@ require_once INSTALLDIR . '/lib/noticelist.php';
 
 class NewnoticeAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if (!common_logged_in()) {
@@ -43,7 +44,8 @@ class NewnoticeAction extends Action {
         }
     }
 
-    function save_new_notice() {
+    function save_new_notice()
+    {
 
         $user = common_current_user();
         assert($user); # XXX: maybe an error instead...
@@ -110,7 +112,8 @@ class NewnoticeAction extends Action {
         }
     }
 
-    function ajax_error_msg($msg) {
+    function ajax_error_msg($msg)
+    {
         common_start_html('text/xml;charset=utf-8', true);
         common_element_start('head');
         common_element('title', null, _('Ajax Error'));
@@ -121,11 +124,13 @@ class NewnoticeAction extends Action {
         common_element_end('html');
     }
 
-    function show_top($content=null) {
+    function show_top($content=null)
+    {
         common_notice_form(null, $content);
     }
 
-    function show_form($msg=null) {
+    function show_form($msg=null)
+    {
         if ($msg && $this->boolean('ajax')) {
             $this->ajax_error_msg($msg);
             return;
@@ -146,7 +151,8 @@ class NewnoticeAction extends Action {
         common_show_footer();
     }
 
-    function show_notice($notice) {
+    function show_notice($notice)
+    {
         $nli = new NoticeListItem($notice);
         $nli->show();
     }
diff --git a/actions/noticesearch.php b/actions/noticesearch.php
index 53d78e199..782c8fe98 100644
--- a/actions/noticesearch.php
+++ b/actions/noticesearch.php
@@ -25,15 +25,18 @@ require_once(INSTALLDIR.'/lib/searchaction.php');
 
 class NoticesearchAction extends SearchAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Search for notices on %%site.name%% by their contents. Separate search terms by spaces; they must be 3 characters or more.');
     }
 
-    function get_title() {
+    function get_title()
+    {
         return _('Text search');
     }
 
-    function show_results($q, $page) {
+    function show_results($q, $page)
+    {
 
         $notice = new Notice();
 
@@ -72,7 +75,8 @@ class NoticesearchAction extends SearchAction {
                           $page, 'noticesearch', array('q' => $q));
     }
 
-    function show_header($arr) {
+    function show_header($arr)
+    {
         if ($arr) {
             $q = $arr[0];
         }
@@ -87,7 +91,8 @@ class NoticesearchAction extends SearchAction {
 
     # XXX: refactor and combine with StreamAction::show_notice()
 
-    function show_notice($notice, $terms) {
+    function show_notice($notice, $terms)
+    {
         $profile = $notice->getProfile();
         if (!$profile) {
             common_log_db_error($notice, 'SELECT', __FILE__);
@@ -149,7 +154,8 @@ class NoticesearchAction extends SearchAction {
         common_element_end('li');
     }
 
-    function highlight($text, $terms) {
+    function highlight($text, $terms)
+    {
         /* Highligh serach terms */
         $pattern = '/('.implode('|',array_map('htmlspecialchars', $terms)).')/i';
         $result = preg_replace($pattern, '<strong>\\1</strong>', $text);
diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php
index d61234df8..c41d34873 100644
--- a/actions/noticesearchrss.php
+++ b/actions/noticesearchrss.php
@@ -25,11 +25,13 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class NoticesearchrssAction extends Rss10Action {
 
-    function init() {
+    function init()
+    {
         return true;
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
 
         $q = $this->trimmed('q');
         $notices = array();
@@ -54,7 +56,8 @@ class NoticesearchrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         global $config;
         $q = $this->trimmed('q');
         $c = array('url' => common_local_url('noticesearchrss', array('q' => $q)),
@@ -64,7 +67,8 @@ class NoticesearchrssAction extends Rss10Action {
         return $c;
     }
 
-    function get_image() {
+    function get_image()
+    {
         return null;
     }
 }
diff --git a/actions/nudge.php b/actions/nudge.php
index 6f3b4c95c..e0268e9d0 100644
--- a/actions/nudge.php
+++ b/actions/nudge.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/mail.php');
 
 class NudgeAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if (!common_logged_in()) {
@@ -71,7 +72,8 @@ class NudgeAction extends Action {
         }
     }
 
-    function notify($user, $other) {
+    function notify($user, $other)
+    {
         if ($other->id != $user->id) {
             if ($other->email && $other->emailnotifynudge) {
                 mail_notify_nudge($user, $other);
diff --git a/actions/openidlogin.php b/actions/openidlogin.php
index 1bf37f28f..b8681215e 100644
--- a/actions/openidlogin.php
+++ b/actions/openidlogin.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class OpenidloginAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (common_logged_in()) {
             common_user_error(_('Already logged in.'));
@@ -56,11 +57,13 @@ class OpenidloginAction extends Action {
         }
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Login with an [OpenID](%%doc.openid%%) account.');
     }
 
-    function show_top($error=null) {
+    function show_top($error=null)
+    {
         if ($error) {
             common_element('div', array('class' => 'error'), $error);
         } else {
@@ -72,7 +75,8 @@ class OpenidloginAction extends Action {
         }
     }
 
-    function show_form($error=null, $openid_url) {
+    function show_form($error=null, $openid_url)
+    {
         common_show_header(_('OpenID Login'), null, $error, array($this, 'show_top'));
         $formaction = common_local_url('openidlogin');
         common_element_start('form', array('method' => 'post',
diff --git a/actions/openidsettings.php b/actions/openidsettings.php
index 9c0eda6f0..ce4143d41 100644
--- a/actions/openidsettings.php
+++ b/actions/openidsettings.php
@@ -24,13 +24,15 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class OpenidsettingsAction extends SettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('[OpenID](%%doc.openid%%) lets you log into many sites ' .
                   ' with the same user account. '.
                   ' Manage your associated OpenIDs from here.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
 
         $user = common_current_user();
 
@@ -116,7 +118,8 @@ class OpenidsettingsAction extends SettingsAction {
         common_show_footer();
     }
 
-    function handle_post() {
+    function handle_post()
+    {
         # CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
@@ -136,7 +139,8 @@ class OpenidsettingsAction extends SettingsAction {
         }
     }
 
-    function remove_openid() {
+    function remove_openid()
+    {
 
         $openid_url = $this->trimmed('openid_url');
         $oid = User_openid::staticGet('canonical', $openid_url);
diff --git a/actions/opensearch.php b/actions/opensearch.php
index dcde160a4..f9c6f4c57 100644
--- a/actions/opensearch.php
+++ b/actions/opensearch.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class OpensearchAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
diff --git a/actions/othersettings.php b/actions/othersettings.php
index 1da6577cb..0c1418387 100644
--- a/actions/othersettings.php
+++ b/actions/othersettings.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
 
 class OthersettingsAction extends SettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Manage various other options.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $user = common_current_user();
 
         $this->form_header(_('Other Settings'), $msg, $success);
@@ -63,7 +65,8 @@ class OthersettingsAction extends SettingsAction {
         common_show_footer();
     }
 
-    function show_feeds_list($feeds) {
+    function show_feeds_list($feeds)
+    {
         common_element_start('div', array('class' => 'feedsdel'));
         common_element('p', null, 'Feeds:');
         common_element_start('ul', array('class' => 'xoxo'));
@@ -76,7 +79,8 @@ class OthersettingsAction extends SettingsAction {
     }
 
     //TODO move to common.php (and retrace its origin)
-    function common_feed_item($feed) {
+    function common_feed_item($feed)
+    {
         $user = common_current_user();
         $nickname = $user->nickname;
 
@@ -131,7 +135,8 @@ class OthersettingsAction extends SettingsAction {
 //        common_element_end('form');
 //    }
 
-    function handle_post() {
+    function handle_post()
+    {
 
         # CSRF protection
         $token = $this->trimmed('token');
@@ -147,7 +152,8 @@ class OthersettingsAction extends SettingsAction {
         }
     }
 
-    function save_preferences() {
+    function save_preferences()
+    {
 
         $urlshorteningservice = $this->trimmed('urlshorteningservice');
 
diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php
index a52ac317f..6d3f6a73f 100644
--- a/actions/peoplesearch.php
+++ b/actions/peoplesearch.php
@@ -24,16 +24,19 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
 
 class PeoplesearchAction extends SearchAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Search for people on %%site.name%% by their name, location, or interests. ' .
                   'Separate the terms by spaces; they must be 3 characters or more.');
     }
 
-    function get_title() {
+    function get_title()
+    {
         return _('People search');
     }
 
-    function show_results($q, $page) {
+    function show_results($q, $page)
+    {
 
         $profile = new Profile();
 
@@ -71,14 +74,16 @@ class PeopleSearchResults extends ProfileList {
     var $terms = null;
     var $pattern = null;
     
-    function __construct($profile, $terms) {
+    function __construct($profile, $terms)
+    {
         parent::__construct($profile);
         $this->terms = array_map('preg_quote', 
                                  array_map('htmlspecialchars', $terms));
         $this->pattern = '/('.implode('|',$terms).')/i';
     }
     
-    function highlight($text) {
+    function highlight($text)
+    {
         return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
     }
 }
diff --git a/actions/peopletag.php b/actions/peopletag.php
index 0327ecbc2..c7e463026 100644
--- a/actions/peopletag.php
+++ b/actions/peopletag.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
 
 class PeopletagAction extends Action {
     
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -50,7 +51,8 @@ class PeopletagAction extends Action {
         common_show_footer();
     }
 
-    function show_people($tag, $page) {
+    function show_people($tag, $page)
+    {
         
         $profile = new Profile();
 
@@ -83,7 +85,8 @@ class PeopletagAction extends Action {
                           array('tag' => $tag));
     }
     
-    function show_top($tag) {
+    function show_top($tag)
+    {
         $instr = sprintf(_('These are users who have tagged themselves "%s" ' .
                            'to show a common interest, characteristic, hobby or job.'), $tag);
         common_element_start('div', 'instructions');
@@ -93,11 +96,13 @@ class PeopletagAction extends Action {
         common_element_end('div');
     }
 
-    function get_title() {
+    function get_title()
+    {
         return null;
     }
 
-    function show_header($arr) {
+    function show_header($arr)
+    {
         return;
     }
 }
diff --git a/actions/postnotice.php b/actions/postnotice.php
index 66e4dc806..8b0781dfd 100644
--- a/actions/postnotice.php
+++ b/actions/postnotice.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/omb.php');
 
 class PostnoticeAction extends Action {
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         try {
             common_remove_magic_from_request();
@@ -39,7 +40,8 @@ class PostnoticeAction extends Action {
         }
     }
 
-    function save_notice(&$req, &$consumer, &$token) {
+    function save_notice(&$req, &$consumer, &$token)
+    {
         $version = $req->get_parameter('omb_version');
         if ($version != OMB_VERSION_01) {
             common_user_error(_('Unsupported OMB version'), 400);
diff --git a/actions/profilesettings.php b/actions/profilesettings.php
index 0fa1288dc..7f7ee17a5 100644
--- a/actions/profilesettings.php
+++ b/actions/profilesettings.php
@@ -23,12 +23,14 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
 
 class ProfilesettingsAction extends SettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('You can update your personal profile info here '.
                   'so people know more about you.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $this->form_header(_('Profile settings'), $msg, $success);
         $this->show_settings_form();
         common_element('h2', null, _('Avatar'));
@@ -40,7 +42,8 @@ class ProfilesettingsAction extends SettingsAction {
         common_show_footer();
     }
 
-    function handle_post() {
+    function handle_post()
+    {
 
         # CSRF protection
 
@@ -60,7 +63,8 @@ class ProfilesettingsAction extends SettingsAction {
 
     }
 
-    function show_settings_form() {
+    function show_settings_form()
+    {
 
         $user = common_current_user();
         $profile = $user->getProfile();
@@ -110,7 +114,8 @@ class ProfilesettingsAction extends SettingsAction {
 
     }
 
-    function show_avatar_form() {
+    function show_avatar_form()
+    {
 
         $user = common_current_user();
         $profile = $user->getProfile();
@@ -168,7 +173,8 @@ class ProfilesettingsAction extends SettingsAction {
 
     }
 
-    function show_password_form() {
+    function show_password_form()
+    {
 
         $user = common_current_user();
         common_element_start('form', array('method' => 'POST',
@@ -190,7 +196,8 @@ class ProfilesettingsAction extends SettingsAction {
         common_element_end('form');
     }
 
-    function save_profile() {
+    function save_profile()
+    {
         $nickname = $this->trimmed('nickname');
         $fullname = $this->trimmed('fullname');
         $homepage = $this->trimmed('homepage');
@@ -337,7 +344,8 @@ class ProfilesettingsAction extends SettingsAction {
     }
 
 
-    function upload_avatar() {
+    function upload_avatar()
+    {
         switch ($_FILES['avatarfile']['error']) {
          case UPLOAD_ERR_OK: # success, jump out
             break;
@@ -384,7 +392,8 @@ class ProfilesettingsAction extends SettingsAction {
         @unlink($_FILES['avatarfile']['tmp_name']);
     }
 
-    function nickname_exists($nickname) {
+    function nickname_exists($nickname)
+    {
         $user = common_current_user();
         $other = User::staticGet('nickname', $nickname);
         if (!$other) {
@@ -394,7 +403,8 @@ class ProfilesettingsAction extends SettingsAction {
         }
     }
 
-    function change_password() {
+    function change_password()
+    {
 
         $user = common_current_user();
         assert(!is_null($user)); # should already be checked
diff --git a/actions/public.php b/actions/public.php
index 60238e54d..62be3da99 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/stream.php');
 
 class PublicAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -41,7 +42,8 @@ class PublicAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_top() {
+    function show_top()
+    {
         if (common_logged_in()) {
             common_notice_form('public');
         } else {
@@ -64,13 +66,15 @@ class PublicAction extends StreamAction {
                                               'item' => 'publicatom')));
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
                  'based on the Free Software [Laconica](http://laconi.ca/) tool. ' .
                  '[Join now](%%action.register%%) to share notices about yourself with friends, family, and colleagues! ([Read more](%%doc.help%%))');
     }
 
-    function show_header() {
+    function show_header()
+    {
         common_element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('publicrss'),
                                      'type' => 'application/rss+xml',
@@ -80,7 +84,8 @@ class PublicAction extends StreamAction {
                                      'content' => common_local_url('publicxrds')));
     }
 
-    function show_notices($page) {
+    function show_notices($page)
+    {
 
         $cnt = 0;
         $notice = Notice::publicStream(($page-1)*NOTICES_PER_PAGE,
diff --git a/actions/publicrss.php b/actions/publicrss.php
index 764f0fae2..8e554122e 100644
--- a/actions/publicrss.php
+++ b/actions/publicrss.php
@@ -25,11 +25,13 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class PublicrssAction extends Rss10Action {
 
-    function init() {
+    function init()
+    {
         return true;
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
         
         $notices = array();
         
@@ -42,7 +44,8 @@ class PublicrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         global $config;
         $c = array('url' => common_local_url('publicrss'),
                    'title' => sprintf(_('%s Public Stream'), $config['site']['name']),
@@ -51,7 +54,8 @@ class PublicrssAction extends Rss10Action {
         return $c;
     }
 
-    function get_image() {
+    function get_image()
+    {
         return null;
     }
 }
\ No newline at end of file
diff --git a/actions/publicxrds.php b/actions/publicxrds.php
index 5e3349185..63c80d81e 100644
--- a/actions/publicxrds.php
+++ b/actions/publicxrds.php
@@ -25,11 +25,13 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 class PublicxrdsAction extends Action {
 
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -55,7 +57,8 @@ class PublicxrdsAction extends Action {
         common_end_xml();
     }
 
-    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
+    function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
+    {
         common_element_start('Service');
         if ($uri) {
             common_element('URI', null, $uri);
diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php
index 068d582fa..a482d4711 100644
--- a/actions/recoverpassword.php
+++ b/actions/recoverpassword.php
@@ -25,7 +25,8 @@ define(MAX_RECOVERY_TIME, 24 * 60 * 60);
 
 class RecoverpasswordAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (common_logged_in()) {
             $this->client_error(_('You are already logged in!'));
@@ -47,7 +48,8 @@ class RecoverpasswordAction extends Action {
         }
     }
 
-    function check_code() {
+    function check_code()
+    {
 
         $code = $this->trimmed('code');
         $confirm = Confirm_address::staticGet('code', $code);
@@ -113,12 +115,14 @@ class RecoverpasswordAction extends Action {
         $this->show_password_form();
     }
 
-    function set_temp_user(&$user) {
+    function set_temp_user(&$user)
+    {
         common_ensure_session();
         $_SESSION['tempuser'] = $user->id;
     }
 
-    function get_temp_user() {
+    function get_temp_user()
+    {
         common_ensure_session();
         $user_id = $_SESSION['tempuser'];
         if ($user_id) {
@@ -127,12 +131,14 @@ class RecoverpasswordAction extends Action {
         return $user;
     }
 
-    function clear_temp_user() {
+    function clear_temp_user()
+    {
         common_ensure_session();
         unset($_SESSION['tempuser']);
     }
 
-    function show_top($msg=null) {
+    function show_top($msg=null)
+    {
         if ($msg) {
             common_element('div', 'error', $msg);
         } else {
@@ -146,7 +152,8 @@ class RecoverpasswordAction extends Action {
         }
     }
 
-    function show_password_top($msg=null) {
+    function show_password_top($msg=null)
+    {
         if ($msg) {
             common_element('div', 'error', $msg);
         } else {
@@ -156,7 +163,8 @@ class RecoverpasswordAction extends Action {
         }
     }
 
-    function show_form($msg=null) {
+    function show_form($msg=null)
+    {
 
         common_show_header(_('Recover password'), null,
         $msg, array($this, 'show_top'));
@@ -173,7 +181,8 @@ class RecoverpasswordAction extends Action {
         common_show_footer();
     }
 
-    function show_password_form($msg=null) {
+    function show_password_form($msg=null)
+    {
 
         common_show_header(_('Reset password'), null,
         $msg, array($this, 'show_password_top'));
@@ -191,7 +200,8 @@ class RecoverpasswordAction extends Action {
         common_show_footer();
     }
 
-    function recover_password() {
+    function recover_password()
+    {
         $nore = $this->trimmed('nicknameoremail');
         if (!$nore) {
             $this->show_form(_('Enter a nickname or email address.'));
@@ -274,7 +284,8 @@ class RecoverpasswordAction extends Action {
         common_show_footer();
     }
 
-    function reset_password() {
+    function reset_password()
+    {
 
         # CSRF protection
         $token = $this->trimmed('token');
diff --git a/actions/register.php b/actions/register.php
index f3eaf6122..444e67e35 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class RegisterAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if (common_config('site', 'closed')) {
@@ -35,7 +36,8 @@ class RegisterAction extends Action {
         }
     }
 
-    function try_register() {
+    function try_register()
+    {
 
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
@@ -133,14 +135,16 @@ class RegisterAction extends Action {
 
     # checks if *CANONICAL* nickname exists
 
-    function nickname_exists($nickname) {
+    function nickname_exists($nickname)
+    {
         $user = User::staticGet('nickname', $nickname);
         return ($user !== false);
     }
 
     # checks if *CANONICAL* email exists
 
-    function email_exists($email) {
+    function email_exists($email)
+    {
         $email = common_canonical_email($email);
         if (!$email || strlen($email) == 0) {
             return false;
@@ -149,7 +153,8 @@ class RegisterAction extends Action {
         return ($user !== false);
     }
 
-    function show_top($error=null) {
+    function show_top($error=null)
+    {
         if ($error) {
             common_element('p', 'error', $error);
         } else {
@@ -164,7 +169,8 @@ class RegisterAction extends Action {
         }
     }
 
-    function show_form($error=null) {
+    function show_form($error=null)
+    {
         global $config;
 
         $code = $this->trimmed('code');
@@ -236,7 +242,8 @@ class RegisterAction extends Action {
         common_show_footer();
     }
 
-    function show_success() {
+    function show_success()
+    {
         $nickname = $this->arg('nickname');
         common_show_header(_('Registration successful'));
         common_element_start('div', 'success');
diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php
index be2cb1025..02c026849 100644
--- a/actions/remotesubscribe.php
+++ b/actions/remotesubscribe.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/omb.php');
 
 class RemotesubscribeAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -47,7 +48,8 @@ class RemotesubscribeAction extends Action {
         }
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('To subscribe, you can [login](%%action.login%%),' .
                   ' or [register](%%action.register%%) a new ' .
                   ' account. If you already have an account ' .
@@ -55,7 +57,8 @@ class RemotesubscribeAction extends Action {
                   ' enter your profile URL below.');
     }
 
-    function show_top($err=null) {
+    function show_top($err=null)
+    {
         if ($err) {
             common_element('div', 'error', $err);
         } else {
@@ -67,7 +70,8 @@ class RemotesubscribeAction extends Action {
         }
     }
 
-    function show_form($err=null) {
+    function show_form($err=null)
+    {
         $nickname = $this->trimmed('nickname');
         $profile = $this->trimmed('profile_url');
         common_show_header(_('Remote subscribe'), null, $err,
@@ -86,7 +90,8 @@ class RemotesubscribeAction extends Action {
         common_show_footer();
     }
 
-    function remote_subscription() {
+    function remote_subscription()
+    {
         $user = $this->get_user();
 
         if (!$user) {
@@ -152,7 +157,8 @@ class RemotesubscribeAction extends Action {
         $this->request_authorization($user, $omb, $token, $secret);
     }
 
-    function get_user() {
+    function get_user()
+    {
         $user = null;
         $nickname = $this->trimmed('nickname');
         if ($nickname) {
@@ -161,7 +167,8 @@ class RemotesubscribeAction extends Action {
         return $user;
     }
 
-    function getOmb($xrds) {
+    function getOmb($xrds)
+    {
 
         static $omb_endpoints = array(OMB_ENDPOINT_UPDATEPROFILE, OMB_ENDPOINT_POSTNOTICE);
         static $oauth_endpoints = array(OAUTH_ENDPOINT_REQUEST, OAUTH_ENDPOINT_AUTHORIZE,
@@ -221,7 +228,8 @@ class RemotesubscribeAction extends Action {
         return $omb;
     }
 
-    function getXRD($main_service, $main_xrds) {
+    function getXRD($main_service, $main_xrds)
+    {
         $uri = omb_service_uri($main_service);
         if (strpos($uri, "#") !== 0) {
             # FIXME: more rigorous handling of external service definitions
@@ -242,7 +250,8 @@ class RemotesubscribeAction extends Action {
         return null;
     }
 
-    function addServices($xrd, $types, &$omb) {
+    function addServices($xrd, $types, &$omb)
+    {
         foreach ($types as $type) {
             $matches = omb_get_services($xrd, $type);
             if ($matches) {
@@ -255,7 +264,8 @@ class RemotesubscribeAction extends Action {
         return true;
     }
 
-    function request_token($omb) {
+    function request_token($omb)
+    {
         $con = omb_oauth_consumer();
 
         $url = omb_service_uri($omb[OAUTH_ENDPOINT_REQUEST]);
@@ -299,7 +309,8 @@ class RemotesubscribeAction extends Action {
         return array($return['oauth_token'], $return['oauth_token_secret']);
     }
 
-    function request_authorization($user, $omb, $token, $secret) {
+    function request_authorization($user, $omb, $token, $secret)
+    {
         global $config; # for license URL
 
         $con = omb_oauth_consumer();
@@ -380,7 +391,8 @@ class RemotesubscribeAction extends Action {
         return;
     }
 
-    function make_nonce() {
+    function make_nonce()
+    {
         return common_good_rand(16);
     }
 }
diff --git a/actions/replies.php b/actions/replies.php
index be80fae79..da2f27f31 100644
--- a/actions/replies.php
+++ b/actions/replies.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/actions/showstream.php');
 
 class RepliesAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -53,11 +54,13 @@ class RepliesAction extends StreamAction {
         common_show_footer();
     }
 
-    function no_such_user() {
+    function no_such_user()
+    {
         common_user_error(_('No such user.'));
     }
 
-    function show_header($user) {
+    function show_header($user)
+    {
         common_element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('repliesrss', array('nickname' =>
                                                                                     $user->nickname)),
@@ -65,7 +68,8 @@ class RepliesAction extends StreamAction {
                                      'title' => sprintf(_('Feed for replies to %s'), $user->nickname)));
     }
 
-    function show_top($user) {
+    function show_top($user)
+    {
         $cur = common_current_user();
 
         if ($cur && $cur->id == $user->id) {
@@ -80,7 +84,8 @@ class RepliesAction extends StreamAction {
                                               'item' => 'repliesrss')));
     }
 
-    function show_replies($user) {
+    function show_replies($user)
+    {
 
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
diff --git a/actions/repliesrss.php b/actions/repliesrss.php
index 9652ae9ea..19ab0866a 100644
--- a/actions/repliesrss.php
+++ b/actions/repliesrss.php
@@ -27,7 +27,8 @@ class RepliesrssAction extends Rss10Action {
 
     var $user = null;
 
-    function init() {
+    function init()
+    {
         $nickname = $this->trimmed('nickname');
         $this->user = User::staticGet('nickname', $nickname);
 
@@ -39,7 +40,8 @@ class RepliesrssAction extends Rss10Action {
         }
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
 
         $user = $this->user;
 
@@ -54,7 +56,8 @@ class RepliesrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         $user = $this->user;
         $c = array('url' => common_local_url('repliesrss',
                                              array('nickname' =>
@@ -67,7 +70,8 @@ class RepliesrssAction extends Rss10Action {
         return $c;
     }
 
-    function get_image() {
+    function get_image()
+    {
         $user = $this->user;
         $profile = $user->getProfile();
         if (!$profile) {
diff --git a/actions/requesttoken.php b/actions/requesttoken.php
index 4950d93c0..091846756 100644
--- a/actions/requesttoken.php
+++ b/actions/requesttoken.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/omb.php');
 
 class RequesttokenAction extends Action {
     
-    function is_readonly() {
+    function is_readonly()
+    {
         return false;
     }
     
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         try {
             common_remove_magic_from_request();
diff --git a/actions/showfavorites.php b/actions/showfavorites.php
index 2fd1e586d..8131cac67 100644
--- a/actions/showfavorites.php
+++ b/actions/showfavorites.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/actions/showstream.php');
 
 class ShowfavoritesAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -53,7 +54,8 @@ class ShowfavoritesAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_header($user) {
+    function show_header($user)
+    {
         common_element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('favoritesrss', array('nickname' =>
                                                                                       $user->nickname)),
@@ -61,7 +63,8 @@ class ShowfavoritesAction extends StreamAction {
                                      'title' => sprintf(_('Feed for favorites of %s'), $user->nickname)));
     }
 
-    function show_top($user) {
+    function show_top($user)
+    {
         $cur = common_current_user();
 
         if ($cur && $cur->id == $user->id) {
@@ -75,7 +78,8 @@ class ShowfavoritesAction extends StreamAction {
         $this->views_menu();
     }
 
-    function show_notices($user) {
+    function show_notices($user)
+    {
 
         $page = $this->trimmed('page');
         if (!$page) {
diff --git a/actions/showmessage.php b/actions/showmessage.php
index a5e03c72d..b706fe2fa 100644
--- a/actions/showmessage.php
+++ b/actions/showmessage.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/mailbox.php');
 
 class ShowmessageAction extends MailboxAction {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         Action::handle($args);
 
@@ -44,13 +45,15 @@ class ShowmessageAction extends MailboxAction {
         }
     }
     
-    function get_message() {
+    function get_message()
+    {
         $id = $this->trimmed('message');
         $message = Message::staticGet('id', $id);
         return $message;
     }
     
-    function get_title($user, $page) {
+    function get_title($user, $page)
+    {
         $message = $this->get_message();
         if (!$message) {
             return null;
@@ -70,14 +73,16 @@ class ShowmessageAction extends MailboxAction {
         return $title;
     }
 
-    function get_messages($user, $page) {
+    function get_messages($user, $page)
+    {
         $message = new Message();
         $message->id = $this->trimmed('message');
         $message->find();
         return $message;
     }
     
-    function get_message_profile($message) {
+    function get_message_profile($message)
+    {
         $user = common_current_user();
         if ($user->id == $message->from_profile) {
             return $message->getTo();
@@ -89,11 +94,13 @@ class ShowmessageAction extends MailboxAction {
         }
     }
     
-    function get_instructions() {
+    function get_instructions()
+    {
         return '';
     }
     
-    function views_menu() {
+    function views_menu()
+    {
         return;
     }
 }
diff --git a/actions/shownotice.php b/actions/shownotice.php
index 04af61a6f..abdaa72ca 100644
--- a/actions/shownotice.php
+++ b/actions/shownotice.php
@@ -27,7 +27,8 @@ class ShownoticeAction extends StreamAction {
     var $profile = null;
     var $avatar = null;
 
-    function prepare($args) {
+    function prepare($args)
+    {
 
         parent::prepare($args);
 
@@ -51,13 +52,15 @@ class ShownoticeAction extends StreamAction {
         return true;
     }
 
-    function last_modified() {
+    function last_modified()
+    {
         return max(strtotime($this->notice->created),
                    strtotime($this->profile->modified),
                    ($this->avatar) ? strtotime($this->avatar->modified) : 0);
     }
 
-    function etag() {
+    function etag()
+    {
         return 'W/"' . implode(':', array($this->arg('action'),
                                           common_language(),
                                           $this->notice->id,
@@ -66,7 +69,8 @@ class ShownoticeAction extends StreamAction {
                                           ($this->avatar) ? strtotime($this->avatar->modified) : 0)) . '"';
     }
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -84,7 +88,8 @@ class ShownoticeAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_header() {
+    function show_header()
+    {
 
         $user = User::staticGet($this->profile->id);
 
@@ -103,14 +108,16 @@ class ShownoticeAction extends StreamAction {
         }
     }
 
-    function show_top() {
+    function show_top()
+    {
         $cur = common_current_user();
         if ($cur && $cur->id == $this->profile->id) {
             common_notice_form();
         }
     }
 
-    function no_such_notice() {
+    function no_such_notice()
+    {
         common_user_error(_('No such notice.'));
     }
 }
diff --git a/actions/showstream.php b/actions/showstream.php
index 485c2e3d1..c31bce87a 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -26,7 +26,8 @@ define('SUBSCRIPTIONS', 80);
 
 class ShowstreamAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -76,7 +77,8 @@ class ShowstreamAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_top($user) {
+    function show_top($user)
+    {
         $cur = common_current_user();
 
         if ($cur && $cur->id == $user->id) {
@@ -100,7 +102,8 @@ class ShowstreamAction extends StreamAction {
                                               'item' => 'foaf')));
     }
 
-    function show_header($user) {
+    function show_header($user)
+    {
         # Feeds
         common_element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('api',
@@ -153,11 +156,13 @@ class ShowstreamAction extends StreamAction {
                                                                 array('nickname' => $profile->nickname))));
     }
 
-    function no_such_user() {
+    function no_such_user()
+    {
         $this->client_error(_('No such user.'), 404);
     }
 
-    function show_profile($profile) {
+    function show_profile($profile)
+    {
 
         common_element_start('div', array('id' => 'profile', 'class' => 'vcard'));
 
@@ -172,7 +177,8 @@ class ShowstreamAction extends StreamAction {
         common_element_end('div');
     }
 
-    function show_personal($profile) {
+    function show_personal($profile)
+    {
 
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
         common_element_start('div', array('id' => 'profile_avatar'));
@@ -246,7 +252,8 @@ class ShowstreamAction extends StreamAction {
         common_element_end('div');
     }
 
-    function show_remote_subscribe_link($profile) {
+    function show_remote_subscribe_link($profile)
+    {
         $url = common_local_url('remotesubscribe',
                                 array('nickname' => $profile->nickname));
         common_element('a', array('href' => $url,
@@ -254,7 +261,8 @@ class ShowstreamAction extends StreamAction {
                        _('Subscribe'));
     }
 
-    function show_unsubscribe_form($profile) {
+    function show_unsubscribe_form($profile)
+    {
         common_element_start('form', array('id' => 'unsubscribe', 'method' => 'post',
                                            'action' => common_local_url('unsubscribe')));
         common_hidden('token', common_session_token());
@@ -268,7 +276,8 @@ class ShowstreamAction extends StreamAction {
         common_element_end('form');
     }
 
-    function show_subscriptions($profile) {
+    function show_subscriptions($profile)
+    {
         global $config;
 
         $subs = DB_DataObject::factory('subscription');
@@ -340,7 +349,8 @@ class ShowstreamAction extends StreamAction {
         common_element_end('div');
     }
 
-    function show_statistics($profile) {
+    function show_statistics($profile)
+    {
 
         // XXX: WORM cache this
         $subs = DB_DataObject::factory('subscription');
@@ -400,7 +410,8 @@ class ShowstreamAction extends StreamAction {
         common_element_end('div');
     }
 
-    function show_notices($user) {
+    function show_notices($user)
+    {
 
         $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
@@ -413,7 +424,8 @@ class ShowstreamAction extends StreamAction {
                           'showstream', array('nickname' => $user->nickname));
     }
 
-    function show_last_notice($profile) {
+    function show_last_notice($profile)
+    {
 
         common_element('h2', null, _('Currently'));
 
@@ -438,13 +450,15 @@ class ShowstreamAction extends StreamAction {
 # We don't show the author for a profile, since we already know who it is!
 
 class ProfileNoticeList extends NoticeList {
-    function newListItem($notice) {
+    function newListItem($notice)
+    {
         return new ProfileNoticeListItem($notice);
     }
 }
 
 class ProfileNoticeListItem extends NoticeListItem {
-    function showAuthor() {
+    function showAuthor()
+    {
         return;
     }
 }
diff --git a/actions/smssettings.php b/actions/smssettings.php
index 71ab39514..470a042ed 100644
--- a/actions/smssettings.php
+++ b/actions/smssettings.php
@@ -24,11 +24,13 @@ require_once(INSTALLDIR.'/actions/emailsettings.php');
 
 class SmssettingsAction extends EmailsettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('You can receive SMS messages through email from %%site.name%%.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $user = common_current_user();
         $this->form_header(_('SMS Settings'), $msg, $success);
         common_element_start('form', array('method' => 'post',
@@ -103,7 +105,8 @@ class SmssettingsAction extends EmailsettingsAction {
         common_show_footer();
     }
 
-    function get_confirmation() {
+    function get_confirmation()
+    {
         $user = common_current_user();
         $confirm = new Confirm_address();
         $confirm->user_id = $user->id;
@@ -115,7 +118,8 @@ class SmssettingsAction extends EmailsettingsAction {
         }
     }
 
-    function handle_post() {
+    function handle_post()
+    {
 
         # CSRF protection
 
@@ -144,7 +148,8 @@ class SmssettingsAction extends EmailsettingsAction {
         }
     }
 
-    function save_preferences() {
+    function save_preferences()
+    {
 
         $smsnotify = $this->boolean('smsnotify');
         
@@ -171,7 +176,8 @@ class SmssettingsAction extends EmailsettingsAction {
         $this->show_form(_('Preferences saved.'), true);
     }
 
-    function add_address() {
+    function add_address()
+    {
 
         $user = common_current_user();
 
@@ -226,7 +232,8 @@ class SmssettingsAction extends EmailsettingsAction {
         $this->show_form($msg, TRUE);
     }
 
-    function cancel_confirmation() {
+    function cancel_confirmation()
+    {
         
         $sms = $this->trimmed('sms');
         $carrier = $this->trimmed('carrier');
@@ -253,7 +260,8 @@ class SmssettingsAction extends EmailsettingsAction {
         $this->show_form(_('Confirmation cancelled.'), TRUE);
     }
 
-    function remove_address() {
+    function remove_address()
+    {
 
         $user = common_current_user();
         $sms = $this->arg('sms');
@@ -282,7 +290,8 @@ class SmssettingsAction extends EmailsettingsAction {
         $this->show_form(_('The address was removed.'), TRUE);
     }
     
-    function sms_exists($sms) {
+    function sms_exists($sms)
+    {
         $user = common_current_user();
         $other = User::staticGet('sms', $sms);
         if (!$other) {
@@ -292,7 +301,8 @@ class SmssettingsAction extends EmailsettingsAction {
         }
     }
 
-    function carrier_select() {
+    function carrier_select()
+    {
         $carrier = new Sms_carrier();
         $cnt = $carrier->find();
 
@@ -316,7 +326,8 @@ class SmssettingsAction extends EmailsettingsAction {
                                common_config('site', 'email')));
     }
 
-    function confirm_code() {
+    function confirm_code()
+    {
         
         $code = $this->trimmed('code');
         
diff --git a/actions/subedit.php b/actions/subedit.php
index db935eb28..874102857 100644
--- a/actions/subedit.php
+++ b/actions/subedit.php
@@ -23,7 +23,8 @@ class SubeditAction extends Action {
 
     var $profile = null;
 
-    function prepare($args) {
+    function prepare($args)
+    {
 
         parent::prepare($args);
 
@@ -56,7 +57,8 @@ class SubeditAction extends Action {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $cur = common_current_user();
diff --git a/actions/subscribe.php b/actions/subscribe.php
index c94c4d7eb..93884f081 100644
--- a/actions/subscribe.php
+++ b/actions/subscribe.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class SubscribeAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if (!common_logged_in()) {
diff --git a/actions/subscribers.php b/actions/subscribers.php
index b9ca92af3..8c7805f51 100644
--- a/actions/subscribers.php
+++ b/actions/subscribers.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/gallery.php');
 
 class SubscribersAction extends GalleryAction {
 
-    function gallery_type() {
+    function gallery_type()
+    {
         return _('Subscribers');
     }
 
-    function get_instructions(&$profile) {
+    function get_instructions(&$profile)
+    {
         $user =& common_current_user();
         if ($user && ($user->id == $profile->id)) {
             return _('These are the people who listen to your notices.');
@@ -36,25 +38,30 @@ class SubscribersAction extends GalleryAction {
         }
     }
 
-    function fields() {
+    function fields()
+    {
         return array('subscriber', 'subscribed');
     }
 
-    function div_class() {
+    function div_class()
+    {
         return 'subscribers';
     }
 
-    function get_other(&$subs) {
+    function get_other(&$subs)
+    {
         return $subs->subscriber;
     }
 
-    function profile_list_class() {
+    function profile_list_class()
+    {
         return 'SubscribersList';
     }
 }
 
 class SubscribersList extends ProfileList {
-    function show_owner_controls($profile) {
+    function show_owner_controls($profile)
+    {
         common_block_form($profile, array('action' => 'subscribers',
                                           'nickname' => $this->owner->nickname));
     }
diff --git a/actions/subscriptions.php b/actions/subscriptions.php
index c24f23a07..ad4a3f9e5 100644
--- a/actions/subscriptions.php
+++ b/actions/subscriptions.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/gallery.php');
 
 class SubscriptionsAction extends GalleryAction {
 
-    function gallery_type() {
+    function gallery_type()
+    {
         return _('Subscriptions');
     }
 
-    function get_instructions(&$profile) {
+    function get_instructions(&$profile)
+    {
         $user =& common_current_user();
         if ($user && ($user->id == $profile->id)) {
             return _('These are the people whose notices you listen to.');
@@ -36,26 +38,31 @@ class SubscriptionsAction extends GalleryAction {
         }
     }
 
-    function fields() {
+    function fields()
+    {
         return array('subscribed', 'subscriber');
     }
 
-    function div_class() {
+    function div_class()
+    {
         return 'subscriptions';
     }
 
-    function get_other(&$subs) {
+    function get_other(&$subs)
+    {
         return $subs->subscribed;
     }
 
-    function profile_list_class() {
+    function profile_list_class()
+    {
         return 'SubscriptionsList';
     }
 }
 
 class SubscriptionsList extends ProfileList {
 
-    function show_owner_controls($profile) {
+    function show_owner_controls($profile)
+    {
 
         $sub = Subscription::pkeyGet(array('subscriber' => $this->owner->id,
                                            'subscribed' => $profile->id));
diff --git a/actions/sup.php b/actions/sup.php
index 3c9cbea2c..2a139b322 100644
--- a/actions/sup.php
+++ b/actions/sup.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class SupAction extends Action {
     
-    function handle($args) {
+    function handle($args)
+    {
         
         parent::handle($args);
         
@@ -42,7 +43,8 @@ class SupAction extends Action {
                                 'updates' => $updates));
     }
     
-    function available_periods() {
+    function available_periods()
+    {
         static $periods = array(86400, 43200, 21600, 7200,
                                 3600, 1800,    600, 300, 120,
                                 60, 30, 15); 
@@ -55,7 +57,8 @@ class SupAction extends Action {
         return $available;
     }
     
-    function get_updates($seconds) {
+    function get_updates($seconds)
+    {
         $notice = new Notice();
 
         # XXX: cache this. Depends on how big this protocol becomes;
@@ -75,7 +78,8 @@ class SupAction extends Action {
         return $updates;
     }
     
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
 }
diff --git a/actions/tag.php b/actions/tag.php
index 1325b85a5..d7b35d613 100644
--- a/actions/tag.php
+++ b/actions/tag.php
@@ -24,7 +24,8 @@ define('TAGS_PER_PAGE', 100);
 
 class TagAction extends StreamAction {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -46,7 +47,8 @@ class TagAction extends StreamAction {
         common_show_footer();
     }
 
-    function show_header($tag = false) {
+    function show_header($tag = false)
+    {
         if ($tag) {
             common_element('link', array('rel' => 'alternate',
                                          'href' => common_local_url('tagrss', array('tag' => $tag)),
@@ -55,11 +57,13 @@ class TagAction extends StreamAction {
         }
     }
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Showing most popular tags from the last week');
     }
 
-    function show_top($tag = false) {
+    function show_top($tag = false)
+    {
         if (!$tag) {
             $instr = $this->get_instructions();
             $output = common_markup_to_html($instr);
@@ -124,7 +128,8 @@ class TagAction extends StreamAction {
         }
     }
 
-    function show_tag($tag, $weight, $relative) {
+    function show_tag($tag, $weight, $relative)
+    {
 
         # XXX: these should probably tune to the size of the site
         if ($relative > 0.1) {
@@ -149,7 +154,8 @@ class TagAction extends StreamAction {
         common_text(' ');
     }
 
-    function show_notices($tag) {
+    function show_notices($tag)
+    {
 
         $cnt = 0;
 
diff --git a/actions/tagother.php b/actions/tagother.php
index 4691fef07..ed17ac531 100644
--- a/actions/tagother.php
+++ b/actions/tagother.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
 
 class TagotherAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
 
         parent::handle($args);
 
@@ -49,7 +50,8 @@ class TagotherAction extends Action {
         }
     }
 
-    function show_form($profile, $error=null) {
+    function show_form($profile, $error=null)
+    {
 
         $user = common_current_user();
 
@@ -103,7 +105,8 @@ class TagotherAction extends Action {
 
     }
 
-    function save_tags() {
+    function save_tags()
+    {
 
         $id = $this->trimmed('id');
         $tagstring = $this->trimmed('tags');
@@ -178,7 +181,8 @@ class TagotherAction extends Action {
         }
     }
 
-    function show_top($arr = null) {
+    function show_top($arr = null)
+    {
         list($profile, $error) = $arr;
         if ($error) {
             common_element('p', 'error', $error);
diff --git a/actions/tagrss.php b/actions/tagrss.php
index 6199a285d..bb4edf473 100644
--- a/actions/tagrss.php
+++ b/actions/tagrss.php
@@ -25,7 +25,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class TagrssAction extends Rss10Action {
 
-    function init() {
+    function init()
+    {
         $tag = $this->trimmed('tag');
         $this->tag = Notice_tag::staticGet('tag', $tag);
 
@@ -37,7 +38,8 @@ class TagrssAction extends Rss10Action {
         }
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
         $tag = $this->tag;
 
         if (is_null($tag)) {
@@ -53,7 +55,8 @@ class TagrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         $tag = $this->tag->tag;
 
         $c = array('url' => common_local_url('tagrss', array('tag' => $tagname)),
diff --git a/actions/twitapiaccount.php b/actions/twitapiaccount.php
index b1caa3481..d5e9143c2 100644
--- a/actions/twitapiaccount.php
+++ b/actions/twitapiaccount.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapiaccountAction extends TwitterapiAction {
 
-    function verify_credentials($args, $apidata) {
+    function verify_credentials($args, $apidata)
+    {
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
@@ -34,12 +35,14 @@ class TwitapiaccountAction extends TwitterapiAction {
         $this->show_extended_profile($apidata['user'], $apidata);
     }
 
-    function end_session($args, $apidata) {
+    function end_session($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
 
-    function update_location($args, $apidata) {
+    function update_location($args, $apidata)
+    {
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
@@ -84,12 +87,14 @@ class TwitapiaccountAction extends TwitterapiAction {
     }
 
 
-    function update_delivery_device($args, $apidata) {
+    function update_delivery_device($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
 
-    function rate_limit_status($args, $apidata) {
+    function rate_limit_status($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
diff --git a/actions/twitapiblocks.php b/actions/twitapiblocks.php
index 16b2e76bc..2170141f1 100644
--- a/actions/twitapiblocks.php
+++ b/actions/twitapiblocks.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapiblocksAction extends TwitterapiAction {
 
-    function create($args, $apidata) {
+    function create($args, $apidata)
+    {
 
         parent::handle($args);
 
@@ -46,7 +47,8 @@ class TwitapiblocksAction extends TwitterapiAction {
         }
     }
 
-    function destroy($args, $apidata) {
+    function destroy($args, $apidata)
+    {
         parent::handle($args);
         $blockee = $this->get_user($apidata['api_arg'], $apidata);
 
diff --git a/actions/twitapidirect_messages.php b/actions/twitapidirect_messages.php
index 7adb4eadd..e9f7aa0bf 100644
--- a/actions/twitapidirect_messages.php
+++ b/actions/twitapidirect_messages.php
@@ -23,17 +23,20 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class Twitapidirect_messagesAction extends TwitterapiAction {
 
-    function direct_messages($args, $apidata) {
+    function direct_messages($args, $apidata)
+    {
         parent::handle($args);
         return $this->show_messages($args, $apidata, 'received');
     }
 
-    function sent($args, $apidata) {
+    function sent($args, $apidata)
+    {
         parent::handle($args);
         return $this->show_messages($args, $apidata, 'sent');
     }
 
-    function show_messages($args, $apidata, $type) {
+    function show_messages($args, $apidata, $type)
+    {
 
         $user = $apidata['user'];
 
@@ -110,7 +113,8 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
     }
 
     // had to change this from "new" to "create" to avoid PHP reserved word
-    function create($args, $apidata) {
+    function create($args, $apidata)
+    {
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
@@ -173,12 +177,14 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
 
     }
 
-    function destroy($args, $apidata) {
+    function destroy($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
 
-    function show_xml_dmsgs($message) {
+    function show_xml_dmsgs($message)
+    {
 
         $this->init_document('xml');
         common_element_start('direct-messages', array('type' => 'array'));
@@ -200,7 +206,8 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
 
     }
 
-    function show_json_dmsgs($message) {
+    function show_json_dmsgs($message)
+    {
 
         $this->init_document('json');
 
@@ -223,7 +230,8 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
 
     }
 
-    function show_rss_dmsgs($message, $title, $link, $subtitle) {
+    function show_rss_dmsgs($message, $title, $link, $subtitle)
+    {
 
         $this->init_document('rss');
 
@@ -252,7 +260,8 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
 
     }
 
-    function show_atom_dmsgs($message, $title, $link, $subtitle) {
+    function show_atom_dmsgs($message, $title, $link, $subtitle)
+    {
 
         $this->init_document('atom');
 
@@ -279,7 +288,8 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
     }
 
     // swiped from MessageAction. Should it be place in util.php?
-    function notify($from, $to, $message) {
+    function notify($from, $to, $message)
+    {
         mail_notify_message($message, $from, $to);
         # XXX: Jabber, SMS notifications... probably queued
     }
diff --git a/actions/twitapifavorites.php b/actions/twitapifavorites.php
index ad8c5f18b..e7a43f770 100644
--- a/actions/twitapifavorites.php
+++ b/actions/twitapifavorites.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapifavoritesAction extends TwitterapiAction {
 
-    function favorites($args, $apidata) {
+    function favorites($args, $apidata)
+    {
         parent::handle($args);
 
         $this->auth_user = $apidata['user'];
@@ -85,7 +86,8 @@ class TwitapifavoritesAction extends TwitterapiAction {
 
     }
 
-    function create($args, $apidata) {
+    function create($args, $apidata)
+    {
         parent::handle($args);
 
         // Check for RESTfulness
@@ -134,14 +136,16 @@ class TwitapifavoritesAction extends TwitterapiAction {
 
     }
 
-    function destroy($args, $apidata) {
+    function destroy($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
 
     // XXX: these two funcs swiped from faves.  Maybe put in util.php, or some common base class?
 
-    function notify($fave, $notice, $user) {
+    function notify($fave, $notice, $user)
+    {
         $other = User::staticGet('id', $notice->profile_id);
         if ($other && $other->id != $user->id) {
             if ($other->email && $other->emailnotifyfav) {
@@ -152,7 +156,8 @@ class TwitapifavoritesAction extends TwitterapiAction {
         }
     }
 
-    function notify_mail($other, $user, $notice) {
+    function notify_mail($other, $user, $notice)
+    {
         $profile = $user->getProfile();
         $bestname = $profile->getBestName();
         $subject = sprintf(_('%s added your notice as a favorite'), $bestname);
diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php
index a52f0fe4d..a59cb543c 100644
--- a/actions/twitapifriendships.php
+++ b/actions/twitapifriendships.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapifriendshipsAction extends TwitterapiAction {
 
-    function create($args, $apidata) {
+    function create($args, $apidata)
+    {
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
@@ -75,7 +76,8 @@ class TwitapifriendshipsAction extends TwitterapiAction {
 
     }
 
-    function destroy($args, $apidata) {
+    function destroy($args, $apidata)
+    {
         parent::handle($args);
 
         if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
@@ -110,7 +112,8 @@ class TwitapifriendshipsAction extends TwitterapiAction {
 
     }
 
-    function exists($args, $apidata) {
+    function exists($args, $apidata)
+    {
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
diff --git a/actions/twitapihelp.php b/actions/twitapihelp.php
index f0e9adfdb..27262f089 100644
--- a/actions/twitapihelp.php
+++ b/actions/twitapihelp.php
@@ -27,7 +27,8 @@ class TwitapihelpAction extends TwitterapiAction {
      * URL:http://identi.ca/api/help/test.format
      * Formats: xml, json
      */
-    function test($args, $apidata) {
+    function test($args, $apidata)
+    {
         parent::handle($args);
 
         if ($apidata['content-type'] == 'xml') {
@@ -44,7 +45,8 @@ class TwitapihelpAction extends TwitterapiAction {
 
     }
 
-    function downtime_schedule($args, $apidata) {
+    function downtime_schedule($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
diff --git a/actions/twitapinotifications.php b/actions/twitapinotifications.php
index 26f66d7e5..e24d3829c 100644
--- a/actions/twitapinotifications.php
+++ b/actions/twitapinotifications.php
@@ -24,12 +24,14 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 # This naming convention looks real sick
 class TwitapinotificationsAction extends TwitterapiAction {
 
-    function follow($args, $apidata) {
+    function follow($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
 
-    function leave($args, $apidata) {
+    function leave($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index ffa94b309..f280184c0 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapistatusesAction extends TwitterapiAction {
 
-    function public_timeline($args, $apidata) {
+    function public_timeline($args, $apidata)
+    {
         parent::handle($args);
 
         $sitename = common_config('site', 'name');
@@ -84,7 +85,8 @@ class TwitapistatusesAction extends TwitterapiAction {
 
     }
 
-    function friends_timeline($args, $apidata) {
+    function friends_timeline($args, $apidata)
+    {
         parent::handle($args);
 
         $since = $this->arg('since');
@@ -146,7 +148,8 @@ class TwitapistatusesAction extends TwitterapiAction {
 
     }
 
-    function user_timeline($args, $apidata) {
+    function user_timeline($args, $apidata)
+    {
         parent::handle($args);
 
         $this->auth_user = $apidata['user'];
@@ -226,7 +229,8 @@ class TwitapistatusesAction extends TwitterapiAction {
 
     }
 
-    function update($args, $apidata) {
+    function update($args, $apidata)
+    {
 
         parent::handle($args);
 
@@ -321,7 +325,8 @@ class TwitapistatusesAction extends TwitterapiAction {
         $this->show($args, $apidata);
     }
 
-    function replies($args, $apidata) {
+    function replies($args, $apidata)
+    {
 
         parent::handle($args);
 
@@ -388,7 +393,8 @@ class TwitapistatusesAction extends TwitterapiAction {
 
     }
 
-    function show($args, $apidata) {
+    function show($args, $apidata)
+    {
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
@@ -413,7 +419,8 @@ class TwitapistatusesAction extends TwitterapiAction {
 
     }
 
-    function destroy($args, $apidata) {
+    function destroy($args, $apidata)
+    {
 
         parent::handle($args);
 
@@ -457,18 +464,21 @@ class TwitapistatusesAction extends TwitterapiAction {
 
     }
 
-    function friends($args, $apidata) {
+    function friends($args, $apidata)
+    {
         parent::handle($args);
         return $this->subscriptions($apidata, 'subscribed', 'subscriber');
     }
 
-    function followers($args, $apidata) {
+    function followers($args, $apidata)
+    {
         parent::handle($args);
 
         return $this->subscriptions($apidata, 'subscriber', 'subscribed');
     }
 
-    function subscriptions($apidata, $other_attr, $user_attr) {
+    function subscriptions($apidata, $other_attr, $user_attr)
+    {
 
         # XXX: lite
 
@@ -523,7 +533,8 @@ class TwitapistatusesAction extends TwitterapiAction {
         $this->end_document($type);
     }
 
-    function show_profiles($profiles, $type) {
+    function show_profiles($profiles, $type)
+    {
         switch ($type) {
          case 'xml':
             common_element_start('users', array('type' => 'array'));
@@ -544,12 +555,14 @@ class TwitapistatusesAction extends TwitterapiAction {
         }
     }
 
-    function featured($args, $apidata) {
+    function featured($args, $apidata)
+    {
         parent::handle($args);
         common_server_error(_('API method under construction.'), $code=501);
     }
 
-    function supported($cmd) {
+    function supported($cmd)
+    {
 
         $cmdlist = array('MessageCommand', 'SubCommand', 'UnsubCommand', 'FavCommand', 'OnCommand', 'OffCommand');
 
diff --git a/actions/twitapiusers.php b/actions/twitapiusers.php
index 43f6969f4..4644e6be6 100644
--- a/actions/twitapiusers.php
+++ b/actions/twitapiusers.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapiusersAction extends TwitterapiAction {
 
-    function show($args, $apidata) {
+    function show($args, $apidata)
+    {
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
diff --git a/actions/twittersettings.php b/actions/twittersettings.php
index 8cbd39fbd..437bdd363 100644
--- a/actions/twittersettings.php
+++ b/actions/twittersettings.php
@@ -25,12 +25,14 @@ define('SUBSCRIPTIONS', 80);
 
 class TwittersettingsAction extends SettingsAction {
 
-    function get_instructions() {
+    function get_instructions()
+    {
         return _('Add your Twitter account to automatically send your notices to Twitter, ' .
             'and subscribe to Twitter friends already here.');
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         $user = common_current_user();
         $profile = $user->getProfile();
         $fuser = null;
@@ -91,7 +93,8 @@ class TwittersettingsAction extends SettingsAction {
         common_show_footer();
     }
 
-    function subscribed_twitter_users() {
+    function subscribed_twitter_users()
+    {
 
         $current_user = common_current_user();
 
@@ -119,7 +122,8 @@ class TwittersettingsAction extends SettingsAction {
         return $users;
     }
 
-    function show_twitter_subscriptions() {
+    function show_twitter_subscriptions()
+    {
 
         $friends = $this->subscribed_twitter_users();
         $friends_count = count($friends);
@@ -180,7 +184,8 @@ class TwittersettingsAction extends SettingsAction {
 
     }
 
-    function handle_post() {
+    function handle_post()
+    {
 
         # CSRF protection
         $token = $this->trimmed('token');
@@ -200,7 +205,8 @@ class TwittersettingsAction extends SettingsAction {
         }
     }
 
-    function add_twitter_acct() {
+    function add_twitter_acct()
+    {
 
         $screen_name = $this->trimmed('twitter_username');
         $password = $this->trimmed('twitter_password');
@@ -261,7 +267,8 @@ class TwittersettingsAction extends SettingsAction {
         $this->show_form(_('Twitter settings saved.'), true);
     }
 
-    function remove_twitter_acct() {
+    function remove_twitter_acct()
+    {
 
         $user = common_current_user();
         $flink = Foreign_link::getByUserID($user->id, 1);
@@ -284,7 +291,8 @@ class TwittersettingsAction extends SettingsAction {
         $this->show_form(_('Twitter account removed.'), TRUE);
     }
 
-    function save_preferences() {
+    function save_preferences()
+    {
 
         $noticesync = $this->boolean('noticesync');
         $friendsync = $this->boolean('friendsync');
@@ -330,7 +338,8 @@ class TwittersettingsAction extends SettingsAction {
         $this->show_form(_('Twitter preferences saved.'));
     }
 
-    function verify_credentials($screen_name, $password) {
+    function verify_credentials($screen_name, $password)
+    {
         $uri = 'http://twitter.com/account/verify_credentials.json';
         $data = get_twitter_data($uri, $screen_name, $password);
 
@@ -353,7 +362,8 @@ class TwittersettingsAction extends SettingsAction {
         return false;
     }
 
-    function set_flags(&$flink, $noticesync, $replysync, $friendsync) {
+    function set_flags(&$flink, $noticesync, $replysync, $friendsync)
+    {
         if ($noticesync) {
             $flink->noticesync |= FOREIGN_NOTICE_SEND;
         } else {
diff --git a/actions/unblock.php b/actions/unblock.php
index 51ec0ae57..66ce0c879 100644
--- a/actions/unblock.php
+++ b/actions/unblock.php
@@ -23,7 +23,8 @@ class UnblockAction extends Action {
 
     var $profile = null;
 
-    function prepare($args) {
+    function prepare($args)
+    {
 
         parent::prepare($args);
 
@@ -56,14 +57,16 @@ class UnblockAction extends Action {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $this->unblock_profile();
         }
     }
 
-    function unblock_profile() {
+    function unblock_profile()
+    {
 
         $cur = common_current_user();
 
diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php
index 38fcc21de..e4e04aaa0 100644
--- a/actions/unsubscribe.php
+++ b/actions/unsubscribe.php
@@ -19,7 +19,8 @@
 
 class UnsubscribeAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (!common_logged_in()) {
             common_user_error(_('Not logged in.'));
diff --git a/actions/updateprofile.php b/actions/updateprofile.php
index 4b4bb53a1..2cfff1b51 100644
--- a/actions/updateprofile.php
+++ b/actions/updateprofile.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/omb.php');
 
 class UpdateprofileAction extends Action {
     
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         try {
             common_remove_magic_from_request();
@@ -40,7 +41,8 @@ class UpdateprofileAction extends Action {
         }
     }
 
-    function update_profile($req, $consumer, $token) {
+    function update_profile($req, $consumer, $token)
+    {
         $version = $req->get_parameter('omb_version');
         if ($version != OMB_VERSION_01) {
             $this->client_error(_('Unsupported OMB version'), 400);
diff --git a/actions/userauthorization.php b/actions/userauthorization.php
index 58ec36fc8..ecaa33167 100644
--- a/actions/userauthorization.php
+++ b/actions/userauthorization.php
@@ -24,7 +24,8 @@ define('TIMESTAMP_THRESHOLD', 300);
 
 class UserauthorizationAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@@ -69,7 +70,8 @@ class UserauthorizationAction extends Action {
         }
     }
 
-    function show_form($req) {
+    function show_form($req)
+    {
 
         $nickname = $req->get_parameter('omb_listenee_nickname');
         $profile = $req->get_parameter('omb_listenee_profile');
@@ -129,7 +131,8 @@ class UserauthorizationAction extends Action {
         common_show_footer();
     }
 
-    function send_authorization() {
+    function send_authorization()
+    {
         $req = $this->get_stored_request();
 
         if (!$req) {
@@ -197,7 +200,8 @@ class UserauthorizationAction extends Action {
         }
     }
 
-    function authorize_token(&$req) {
+    function authorize_token(&$req)
+    {
         $consumer_key = $req->get_parameter('oauth_consumer_key');
         $token_field = $req->get_parameter('oauth_token');
         common_debug('consumer key = "'.$consumer_key.'"', __FILE__);
@@ -222,7 +226,8 @@ class UserauthorizationAction extends Action {
 
     # XXX: refactor with similar code in finishremotesubscribe.php
 
-    function save_remote_profile(&$req) {
+    function save_remote_profile(&$req)
+    {
         # FIXME: we should really do this when the consumer comes
         # back for an access token. If they never do, we've got stuff in a
         # weird state.
@@ -312,13 +317,15 @@ class UserauthorizationAction extends Action {
         return TRUE;
     }
 
-    function add_avatar($profile, $url) {
+    function add_avatar($profile, $url)
+    {
         $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
         copy($url, $temp_filename);
         return $profile->setOriginal($temp_filename);
     }
 
-    function show_accept_message($tok) {
+    function show_accept_message($tok)
+    {
         common_show_header(_('Subscription authorized'));
         common_element('p', null,
                        _('The subscription has been authorized, but no '.
@@ -328,7 +335,8 @@ class UserauthorizationAction extends Action {
         common_show_footer();
     }
 
-    function show_reject_message($tok) {
+    function show_reject_message($tok)
+    {
         common_show_header(_('Subscription rejected'));
         common_element('p', null,
                        _('The subscription has been rejected, but no '.
@@ -337,23 +345,27 @@ class UserauthorizationAction extends Action {
         common_show_footer();
     }
 
-    function store_request($req) {
+    function store_request($req)
+    {
         common_ensure_session();
         $_SESSION['userauthorizationrequest'] = $req;
     }
 
-    function clear_request() {
+    function clear_request()
+    {
         common_ensure_session();
         unset($_SESSION['userauthorizationrequest']);
     }
 
-    function get_stored_request() {
+    function get_stored_request()
+    {
         common_ensure_session();
         $req = $_SESSION['userauthorizationrequest'];
         return $req;
     }
 
-    function get_new_request() {
+    function get_new_request()
+    {
         common_remove_magic_from_request();
         $req = OAuthRequest::from_request();
         return $req;
@@ -361,7 +373,8 @@ class UserauthorizationAction extends Action {
 
     # Throws an OAuthException if anything goes wrong
 
-    function validate_request(&$req) {
+    function validate_request(&$req)
+    {
         # OAuth stuff -- have to copy from OAuth.php since they're
         # all private methods, and there's no user-authentication method
         common_debug('checking version', __FILE__);
@@ -384,7 +397,8 @@ class UserauthorizationAction extends Action {
         return true;
     }
 
-    function validate_omb(&$req) {
+    function validate_omb(&$req)
+    {
         foreach (array('omb_version', 'omb_listener', 'omb_listenee',
                        'omb_listenee_profile', 'omb_listenee_nickname',
                        'omb_listenee_license') as $param)
@@ -498,7 +512,8 @@ class UserauthorizationAction extends Action {
 
     # Snagged from OAuthServer
 
-    function check_version(&$req) {
+    function check_version(&$req)
+    {
         $version = $req->get_parameter("oauth_version");
         if (!$version) {
             $version = 1.0;
@@ -511,7 +526,8 @@ class UserauthorizationAction extends Action {
 
     # Snagged from OAuthServer
 
-    function get_consumer($datastore, $req) {
+    function get_consumer($datastore, $req)
+    {
         $consumer_key = @$req->get_parameter("oauth_consumer_key");
         if (!$consumer_key) {
             throw new OAuthException("Invalid consumer key");
@@ -526,7 +542,8 @@ class UserauthorizationAction extends Action {
 
     # Mostly cadged from OAuthServer
 
-    function get_token($datastore, &$req, $consumer) {/*{{{*/
+    function get_token($datastore, &$req, $consumer)
+    {/*{{{*/
         $token_field = @$req->get_parameter('oauth_token');
         $token = $datastore->lookup_token($consumer, 'request', $token_field);
         if (!$token) {
@@ -535,7 +552,8 @@ class UserauthorizationAction extends Action {
         return $token;
     }
 
-    function check_timestamp(&$req) {
+    function check_timestamp(&$req)
+    {
         $timestamp = @$req->get_parameter('oauth_timestamp');
         $now = time();
         if ($now - $timestamp > TIMESTAMP_THRESHOLD) {
@@ -544,7 +562,8 @@ class UserauthorizationAction extends Action {
     }
 
     # NOTE: don't call twice on the same request; will fail!
-    function check_nonce(&$datastore, &$req, $consumer, $token) {
+    function check_nonce(&$datastore, &$req, $consumer, $token)
+    {
         $timestamp = @$req->get_parameter('oauth_timestamp');
         $nonce = @$req->get_parameter('oauth_nonce');
         $found = $datastore->lookup_nonce($consumer, $token, $nonce, $timestamp);
@@ -554,7 +573,8 @@ class UserauthorizationAction extends Action {
         return true;
     }
 
-    function check_signature(&$req, $consumer, $token) {
+    function check_signature(&$req, $consumer, $token)
+    {
         $signature_method = $this->get_signature_method($req);
         $signature = $req->get_parameter('oauth_signature');
         $valid_sig = $signature_method->check_signature($req,
@@ -566,7 +586,8 @@ class UserauthorizationAction extends Action {
         }
     }
 
-    function get_signature_method(&$req) {
+    function get_signature_method(&$req)
+    {
         $signature_method = @$req->get_parameter("oauth_signature_method");
         if (!$signature_method) {
             $signature_method = "PLAINTEXT";
diff --git a/actions/userbyid.php b/actions/userbyid.php
index 3fa92e9ce..d7b4088bd 100644
--- a/actions/userbyid.php
+++ b/actions/userbyid.php
@@ -21,11 +21,13 @@ if (!defined('LACONICA')) { exit(1); }
 
 class UserbyidAction extends Action {
     
-    function is_readonly() {                
+    function is_readonly()
+    {                
         return true;
     }
     
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $id = $this->trimmed('id');
         if (!$id) {
diff --git a/actions/userrss.php b/actions/userrss.php
index 6089718ae..c758a44e2 100644
--- a/actions/userrss.php
+++ b/actions/userrss.php
@@ -27,7 +27,8 @@ class UserrssAction extends Rss10Action {
 
     var $user = null;
 
-    function init() {
+    function init()
+    {
         $nickname = $this->trimmed('nickname');
         $this->user = User::staticGet('nickname', $nickname);
 
@@ -39,7 +40,8 @@ class UserrssAction extends Rss10Action {
         }
     }
 
-    function get_notices($limit=0) {
+    function get_notices($limit=0)
+    {
 
         $user = $this->user;
         
@@ -56,7 +58,8 @@ class UserrssAction extends Rss10Action {
         return $notices;
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         $user = $this->user;
         $profile = $user->getProfile();
         $c = array('url' => common_local_url('userrss',
@@ -68,7 +71,8 @@ class UserrssAction extends Rss10Action {
         return $c;
     }
 
-    function get_image() {
+    function get_image()
+    {
         $user = $this->user;
         $profile = $user->getProfile();
         if (!$profile) {
@@ -82,7 +86,8 @@ class UserrssAction extends Rss10Action {
 
     # override parent to add X-SUP-ID URL
     
-    function init_rss($limit=0) {
+    function init_rss($limit=0)
+    {
         $url = common_local_url('sup', null, $this->user->id);
         header('X-SUP-ID: '.$url);
         parent::init_rss($limit);
diff --git a/actions/xrds.php b/actions/xrds.php
index 54baf64be..1d4961d46 100644
--- a/actions/xrds.php
+++ b/actions/xrds.php
@@ -23,11 +23,13 @@ require_once(INSTALLDIR.'/lib/omb.php');
 
 class XrdsAction extends Action {
 
-    function is_readonly() {                
+    function is_readonly()
+    {                
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $nickname = $this->trimmed('nickname');
         $user = User::staticGet('nickname', $nickname);
@@ -38,7 +40,8 @@ class XrdsAction extends Action {
         $this->show_xrds($user);
     }
 
-    function show_xrds($user) {
+    function show_xrds($user)
+    {
 
         header('Content-Type: application/xrds+xml');
 
@@ -108,7 +111,8 @@ class XrdsAction extends Action {
         common_end_xml();
     }
 
-    function show_service($type, $uri, $params=null, $sigs=null, $localId=null) {
+    function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
+    {
         common_element_start('Service');
         if ($uri) {
             common_element('URI', null, $uri);
diff --git a/classes/Avatar.php b/classes/Avatar.php
index bde983d79..3c754ec2d 100644
--- a/classes/Avatar.php
+++ b/classes/Avatar.php
@@ -21,14 +21,16 @@ class Avatar extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
     # We clean up the file, too
 
-    function delete() {
+    function delete()
+    {
         $filename = $this->filename;
         if (parent::delete()) {
             @unlink(common_avatar_path($filename));
@@ -38,7 +40,8 @@ class Avatar extends Memcached_DataObject
     # Create and save scaled version of this avatar
     # XXX: maybe break into different methods
 
-    function scale($size) {
+    function scale($size)
+    {
 
         $image_s = imagecreatetruecolor($size, $size);
         $image_a = $this->to_image();
@@ -76,7 +79,8 @@ class Avatar extends Memcached_DataObject
         }
     }
 
-    function to_image() {
+    function to_image()
+    {
         $filepath = common_avatar_path($this->filename);
         if ($this->mediatype == 'image/gif') {
             return imagecreatefromgif($filepath);
@@ -89,7 +93,8 @@ class Avatar extends Memcached_DataObject
         }
     }
     
-    function &pkeyGet($kv) {
+    function &pkeyGet($kv)
+    {
         return Memcached_DataObject::pkeyGet('Avatar', $kv);
     }
 }
diff --git a/classes/Channel.php b/classes/Channel.php
index ea3530406..02ece9c0f 100644
--- a/classes/Channel.php
+++ b/classes/Channel.php
@@ -21,23 +21,28 @@ if (!defined('LACONICA')) { exit(1); }
 
 class Channel {
     
-    function on($user) {
+    function on($user)
+    {
         return false;
     }
 
-    function off($user) {
+    function off($user)
+    {
         return false;
     }
 
-    function output($user, $text) {
+    function output($user, $text)
+    {
         return false;
     }
     
-    function error($user, $text) {
+    function error($user, $text)
+    {
         return false;
     }
     
-    function source() {
+    function source()
+    {
         return null;
     }
 }
@@ -46,33 +51,40 @@ class XMPPChannel extends Channel {
 
     var $conn = null;
     
-    function source() {
+    function source()
+    {
         return 'xmpp';
     }
     
-    function __construct($conn) {
+    function __construct($conn)
+    {
         $this->conn = $conn;
     }
     
-    function on($user) {
+    function on($user)
+    {
         return $this->set_notify($user, 1);
     }
     
-    function off($user) {
+    function off($user)
+    {
         return $this->set_notify($user, 0);
     }
 
-    function output($user, $text) {
+    function output($user, $text)
+    {
         $text = '['.common_config('site', 'name') . '] ' . $text;
         jabber_send_message($user->jabber, $text);
     }
     
-    function error($user, $text) {
+    function error($user, $text)
+    {
         $text = '['.common_config('site', 'name') . '] ' . $text;
         jabber_send_message($user->jabber, $text);
     }
     
-    function set_notify(&$user, $notify) {
+    function set_notify(&$user, $notify)
+    {
         $orig = clone($user);
         $user->jabbernotify = $notify;
         $result = $user->update($orig);
@@ -94,19 +106,23 @@ class XMPPChannel extends Channel {
 
 class WebChannel extends Channel {
 
-    function source() {
+    function source()
+    {
         return 'web';
     }
     
-    function on($user) {
+    function on($user)
+    {
         return false;
     }
     
-    function off($user) {
+    function off($user)
+    {
         return false;
     }
 
-    function output($user, $text) {
+    function output($user, $text)
+    {
         # XXX: buffer all output and send it at the end
         # XXX: even better, redirect to appropriate page
         #      depending on what command was run
@@ -115,7 +131,8 @@ class WebChannel extends Channel {
         common_show_footer();
     }
     
-    function error($user, $text) {
+    function error($user, $text)
+    {
         common_user_error($text);
     }
 }
@@ -123,7 +140,8 @@ class WebChannel extends Channel {
 
 class AjaxWebChannel extends WebChannel {
 
-    function output($user, $text) {
+    function output($user, $text)
+    {
         common_start_html('text/xml;charset=utf-8', true);
         common_element_start('head');
         common_element('title', null, _('Command results'));
@@ -134,7 +152,8 @@ class AjaxWebChannel extends WebChannel {
         common_element_end('html');
     }
 
-    function error($user, $text) {
+    function error($user, $text)
+    {
         common_start_html('text/xml;charset=utf-8', true);
         common_element_start('head');
         common_element('title', null, _('Ajax Error'));
@@ -151,23 +170,28 @@ class MailChannel extends Channel {
 
     var $addr = null;
 
-    function source() {
+    function source()
+    {
         return 'mail';
     }
     
-    function __construct($addr=null) {
+    function __construct($addr=null)
+    {
         $this->addr = $addr;
     }
     
-    function on($user) {
+    function on($user)
+    {
         return $this->set_notify($user, 1);
     }
     
-    function off($user) {
+    function off($user)
+    {
         return $this->set_notify($user, 0);
     }
 
-    function output($user, $text) {
+    function output($user, $text)
+    {
 
         $headers['From'] = $user->incomingemail;
         $headers['To'] = $this->addr;
@@ -177,7 +201,8 @@ class MailChannel extends Channel {
         return mail_send(array($this->addr), $headers, $text);
     }
     
-    function error($user, $text) {
+    function error($user, $text)
+    {
         
         $headers['From'] = $user->incomingemail;
         $headers['To'] = $this->addr;
@@ -187,7 +212,8 @@ class MailChannel extends Channel {
         return mail_send(array($this->addr), $headers, $text);
     }
     
-    function set_notify($user, $value) {
+    function set_notify($user, $value)
+    {
         $orig = clone($user);
         $user->smsnotify = $value;
         $result = $user->update($orig);
diff --git a/classes/Command.php b/classes/Command.php
index b146005a7..407a6ecba 100644
--- a/classes/Command.php
+++ b/classes/Command.php
@@ -25,17 +25,20 @@ class Command {
     
     var $user = null;
     
-    function __construct($user=null) {
+    function __construct($user=null)
+    {
         $this->user = $user;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         return false;
     }
 }
 
 class UnimplementedCommand extends Command {
-    function execute($channel) {
+    function execute($channel)
+    {
         $channel->error($this->user, _("Sorry, this command is not yet implemented."));
     }
 }
@@ -48,7 +51,8 @@ class TrackOffCommand extends UnimplementedCommand {
 
 class TrackCommand extends UnimplementedCommand {
     var $word = null;
-    function __construct($user, $word) {
+    function __construct($user, $word)
+    {
         parent::__construct($user);
         $this->word = $word;
     }
@@ -56,7 +60,8 @@ class TrackCommand extends UnimplementedCommand {
 
 class UntrackCommand extends UnimplementedCommand {
     var $word = null;
-    function __construct($user, $word) {
+    function __construct($user, $word)
+    {
         parent::__construct($user);
         $this->word = $word;
     }
@@ -64,7 +69,8 @@ class UntrackCommand extends UnimplementedCommand {
 
 class NudgeCommand extends UnimplementedCommand {
     var $other = null;
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
@@ -72,14 +78,16 @@ class NudgeCommand extends UnimplementedCommand {
 
 class InviteCommand extends UnimplementedCommand {
     var $other = null;
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
 }
 
 class StatsCommand extends Command {
-    function execute($channel) {
+    function execute($channel)
+    {
 
         $subs = new Subscription();
         $subs->subscriber = $this->user->id;
@@ -106,12 +114,14 @@ class FavCommand extends Command {
     
     var $other = null;
     
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         
         $recipient = 
           common_relative_profile($this->user, common_canonical_nickname($this->other));
@@ -149,12 +159,14 @@ class FavCommand extends Command {
 
 class WhoisCommand extends Command {
     var $other = null;
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         $recipient = 
           common_relative_profile($this->user, common_canonical_nickname($this->other));
         
@@ -184,13 +196,15 @@ class WhoisCommand extends Command {
 class MessageCommand extends Command {
     var $other = null;
     var $text = null;
-    function __construct($user, $other, $text) {
+    function __construct($user, $other, $text)
+    {
         parent::__construct($user);
         $this->other = $other;
         $this->text = $text;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         $other = User::staticGet('nickname', common_canonical_nickname($this->other));
         $len = mb_strlen($this->text);
         if ($len == 0) {
@@ -227,12 +241,14 @@ class GetCommand extends Command {
     
     var $other = null;
     
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         $target_nickname = common_canonical_nickname($this->other);
         
         $target =
@@ -257,12 +273,14 @@ class SubCommand extends Command {
     
     var $other = null;
     
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         
         if (!$this->other) {
             $channel->error($this->user, _('Specify the name of the user to subscribe to'));
@@ -283,12 +301,14 @@ class UnsubCommand extends Command {
 
     var $other = null;
     
-    function __construct($user, $other) {
+    function __construct($user, $other)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
 
-    function execute($channel) {
+    function execute($channel)
+    {
         if(!$this->other) {
             $channel->error($this->user, _('Specify the name of the user to unsubscribe from'));
             return;
@@ -306,11 +326,13 @@ class UnsubCommand extends Command {
 
 class OffCommand extends Command {
     var $other = null;
-    function __construct($user, $other=null) {
+    function __construct($user, $other=null)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
-    function execute($channel) {
+    function execute($channel)
+    {
         if ($other) {
             $channel->error($this->user, _("Command not yet implemented."));
         } else {
@@ -325,12 +347,14 @@ class OffCommand extends Command {
 
 class OnCommand extends Command {
     var $other = null;
-    function __construct($user, $other=null) {
+    function __construct($user, $other=null)
+    {
         parent::__construct($user);
         $this->other = $other;
     }
     
-    function execute($channel) {
+    function execute($channel)
+    {
         if ($other) {
             $channel->error($this->user, _("Command not yet implemented."));
         } else {
@@ -344,7 +368,8 @@ class OnCommand extends Command {
 }
 
 class HelpCommand extends Command {
-    function execute($channel) {
+    function execute($channel)
+    {
         $channel->output($this->user,
                          _("Commands:\n".
                            "on - turn on notifications\n".
diff --git a/classes/CommandInterpreter.php b/classes/CommandInterpreter.php
index db02ce541..ff078bb05 100644
--- a/classes/CommandInterpreter.php
+++ b/classes/CommandInterpreter.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/classes/Command.php');
 
 class CommandInterpreter {
     
-    function handle_command($user, $text) {
+    function handle_command($user, $text)
+    {
         # XXX: localise
 
         $text = preg_replace('/\s+/', ' ', trim($text));
diff --git a/classes/Confirm_address.php b/classes/Confirm_address.php
index 71f2d0c72..ed3875d22 100644
--- a/classes/Confirm_address.php
+++ b/classes/Confirm_address.php
@@ -20,10 +20,12 @@ class Confirm_address extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function sequenceKey() { return array(false, false); }
+    function sequenceKey()
+    { return array(false, false); }
 }
diff --git a/classes/Consumer.php b/classes/Consumer.php
index c598312aa..d5b7b7e33 100644
--- a/classes/Consumer.php
+++ b/classes/Consumer.php
@@ -16,7 +16,8 @@ class Consumer extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Fave.php b/classes/Fave.php
index 5d938d149..24df5938c 100644
--- a/classes/Fave.php
+++ b/classes/Fave.php
@@ -15,7 +15,8 @@ class Fave extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Fave',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Fave',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -31,7 +32,8 @@ class Fave extends Memcached_DataObject
         return $fave;
     }
     
-    function &pkeyGet($kv) {
+    function &pkeyGet($kv)
+    {
         return Memcached_DataObject::pkeyGet('Fave', $kv);
     }
 }
diff --git a/classes/Foreign_link.php b/classes/Foreign_link.php
index 41a95e641..79a4d262d 100644
--- a/classes/Foreign_link.php
+++ b/classes/Foreign_link.php
@@ -21,7 +21,8 @@ class Foreign_link extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -55,7 +56,8 @@ class Foreign_link extends Memcached_DataObject
     }
         
     # Convenience methods
-    function getForeignUser() {        
+    function getForeignUser()
+    {        
         $fuser = new Foreign_user();
         $fuser->service = $this->service;
         $fuser->id = $this->foreign_id;
@@ -69,7 +71,8 @@ class Foreign_link extends Memcached_DataObject
         return null;        
     }
     
-    function getUser() {
+    function getUser()
+    {
         return User::staticGet($this->user_id);
     }
         
diff --git a/classes/Foreign_service.php b/classes/Foreign_service.php
index 128411b71..ef614dbd6 100644
--- a/classes/Foreign_service.php
+++ b/classes/Foreign_service.php
@@ -17,7 +17,8 @@ class Foreign_service extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Foreign_subscription.php b/classes/Foreign_subscription.php
index d8e8569fb..d50860621 100644
--- a/classes/Foreign_subscription.php
+++ b/classes/Foreign_subscription.php
@@ -16,7 +16,8 @@ class Foreign_subscription extends Memcached_DataObject
     public $created;                         // datetime()   not_null
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Foreign_user.php b/classes/Foreign_user.php
index f8a980884..61727abe5 100644
--- a/classes/Foreign_user.php
+++ b/classes/Foreign_user.php
@@ -18,7 +18,8 @@ class Foreign_user extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -39,7 +40,8 @@ class Foreign_user extends Memcached_DataObject
         return null;        
     }
     
-    function updateKeys(&$orig) {
+    function updateKeys(&$orig)
+    {
         $parts = array();
         foreach (array('id', 'service', 'uri', 'nickname') as $k) {
             if (strcmp($this->$k, $orig->$k) != 0) {
diff --git a/classes/Invitation.php b/classes/Invitation.php
index ff6456445..8a36fd8df 100644
--- a/classes/Invitation.php
+++ b/classes/Invitation.php
@@ -17,7 +17,8 @@ class Invitation extends Memcached_DataObject
     public $created;                         // datetime()   not_null
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php
index 1d12730c9..b9f599dbc 100644
--- a/classes/Memcached_DataObject.php
+++ b/classes/Memcached_DataObject.php
@@ -23,7 +23,8 @@ require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
 
 class Memcached_DataObject extends DB_DataObject 
 {
-    function &staticGet($cls, $k, $v=null) {
+    function &staticGet($cls, $k, $v=null)
+    {
         if (is_null($v)) {
             $v = $k;
             # XXX: HACK!
@@ -44,7 +45,8 @@ class Memcached_DataObject extends DB_DataObject
         }
     }
 
-    function &pkeyGet($cls, $kv) {
+    function &pkeyGet($cls, $kv)
+    {
         $i = Memcached_DataObject::multicache($cls, $kv);
         if ($i) {
             return $i;
@@ -62,12 +64,14 @@ class Memcached_DataObject extends DB_DataObject
         }
     }
 
-    function insert() {
+    function insert()
+    {
         $result = parent::insert();
         return $result;
     }
     
-    function update($orig=null) {
+    function update($orig=null)
+    {
         if (is_object($orig) && $orig instanceof Memcached_DataObject) {
             $orig->decache(); # might be different keys
         }
@@ -78,7 +82,8 @@ class Memcached_DataObject extends DB_DataObject
         return $result;
     }
     
-    function delete() {
+    function delete()
+    {
         $this->decache(); # while we still have the values!
         return parent::delete();
     }
@@ -100,7 +105,8 @@ class Memcached_DataObject extends DB_DataObject
         }
     }
 
-    function keyTypes() {
+    function keyTypes()
+    {
         global $_DB_DATAOBJECT;
         if (!isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"])) {
             $this->databaseStructure();
@@ -109,7 +115,8 @@ class Memcached_DataObject extends DB_DataObject
         return $_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"];
     }
     
-    function encache() {
+    function encache()
+    {
         $c = $this->memcache();
         if (!$c) {
             return false;
@@ -133,7 +140,8 @@ class Memcached_DataObject extends DB_DataObject
         }
     }
     
-    function decache() {
+    function decache()
+    {
         $c = $this->memcache();
         if (!$c) {
             return false;
@@ -158,7 +166,8 @@ class Memcached_DataObject extends DB_DataObject
         }
     }
 
-    function multicache($cls, $kv) {
+    function multicache($cls, $kv)
+    {
         ksort($kv);
         $c = Memcached_DataObject::memcache();
         if (!$c) {
@@ -170,7 +179,8 @@ class Memcached_DataObject extends DB_DataObject
         }
     }
 
-    function getSearchEngine($table) {
+    function getSearchEngine($table)
+    {
         require_once INSTALLDIR.'/lib/search_engines.php';
         static $search_engine;
         if (!isset($search_engine)) {
diff --git a/classes/Message.php b/classes/Message.php
index e04fbb3c0..4806057b4 100644
--- a/classes/Message.php
+++ b/classes/Message.php
@@ -22,16 +22,19 @@ class Message extends Memcached_DataObject
     public $source;                          // varchar(32)  
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Message',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Message',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
     
-    function getFrom() {
+    function getFrom()
+    {
         return Profile::staticGet('id', $this->from_profile);
     }
     
-    function getTo() {
+    function getTo()
+    {
         return Profile::staticGet('id', $this->to_profile);
     }
     
diff --git a/classes/Nonce.php b/classes/Nonce.php
index 54d20de9c..2c0edfa14 100644
--- a/classes/Nonce.php
+++ b/classes/Nonce.php
@@ -18,7 +18,8 @@ class Nonce extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Notice.php b/classes/Notice.php
index e6152812c..d3aa4e828 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -48,23 +48,27 @@ class Notice extends Memcached_DataObject
     public $source;                             // varchar(32)
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Notice',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function getProfile() {
+    function getProfile()
+    {
         return Profile::staticGet('id', $this->profile_id);
     }
 
-    function delete() {
+    function delete()
+    {
         $this->blowCaches(true);
         $this->blowFavesCache(true);
         $this->blowInboxes();
         return parent::delete();
     }
 
-    function saveTags() {
+    function saveTags()
+    {
         /* extract all #hastags */
         $count = preg_match_all('/(?:^|\s)#([A-Za-z0-9_\-\.]{1,64})/', strtolower($this->content), $match);
         if (!$count) {
@@ -184,7 +188,8 @@ class Notice extends Memcached_DataObject
         return true;
     }
 
-    function blowCaches($blowLast=false) {
+    function blowCaches($blowLast=false)
+    {
         $this->blowSubsCache($blowLast);
         $this->blowNoticeCache($blowLast);
         $this->blowRepliesCache($blowLast);
@@ -192,7 +197,8 @@ class Notice extends Memcached_DataObject
         $this->blowTagCache($blowLast);
     }
 
-    function blowTagCache($blowLast=false) {
+    function blowTagCache($blowLast=false)
+    {
         $cache = common_memcache();
         if ($cache) {
             $tag = new Notice_tag();
@@ -210,7 +216,8 @@ class Notice extends Memcached_DataObject
         }
     }
 
-    function blowSubsCache($blowLast=false) {
+    function blowSubsCache($blowLast=false)
+    {
         $cache = common_memcache();
         if ($cache) {
             $user = new User();
@@ -230,7 +237,8 @@ class Notice extends Memcached_DataObject
         }
     }
 
-    function blowNoticeCache($blowLast=false) {
+    function blowNoticeCache($blowLast=false)
+    {
         if ($this->is_local) {
             $cache = common_memcache();
             if ($cache) {
@@ -242,7 +250,8 @@ class Notice extends Memcached_DataObject
         }
     }
 
-    function blowRepliesCache($blowLast=false) {
+    function blowRepliesCache($blowLast=false)
+    {
         $cache = common_memcache();
         if ($cache) {
             $reply = new Reply();
@@ -260,7 +269,8 @@ class Notice extends Memcached_DataObject
         }
     }
 
-    function blowPublicCache($blowLast=false) {
+    function blowPublicCache($blowLast=false)
+    {
         if ($this->is_local == 1) {
             $cache = common_memcache();
             if ($cache) {
@@ -272,7 +282,8 @@ class Notice extends Memcached_DataObject
         }
     }
 
-    function blowFavesCache($blowLast=false) {
+    function blowFavesCache($blowLast=false)
+    {
         $cache = common_memcache();
         if ($cache) {
             $fave = new Fave();
@@ -477,7 +488,8 @@ class Notice extends Memcached_DataObject
         return $wrapper;
     }
 
-    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null) {
+    function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null)
+    {
 
         $parts = array();
 
@@ -499,7 +511,8 @@ class Notice extends Memcached_DataObject
                                  $offset, $limit, $since_id, $before_id, null, $since);
     }
 
-    function addToInboxes() {
+    function addToInboxes()
+    {
         $enabled = common_config('inboxes', 'enabled');
 
         if ($enabled === true || $enabled === 'transitional') {
@@ -522,7 +535,8 @@ class Notice extends Memcached_DataObject
 
     # Delete from inboxes if we're deleted.
 
-    function blowInboxes() {
+    function blowInboxes()
+    {
 
         $enabled = common_config('inboxes', 'enabled');
 
diff --git a/classes/NoticeWrapper.php b/classes/NoticeWrapper.php
index 19ae37c1b..e1b27c2f7 100644
--- a/classes/NoticeWrapper.php
+++ b/classes/NoticeWrapper.php
@@ -38,11 +38,13 @@ class NoticeWrapper extends Notice {
     var $notices = null;
     var $i = -1;
     
-    function __construct($arr) {
+    function __construct($arr)
+    {
         $this->notices = $arr;
     }
     
-    function fetch() {
+    function fetch()
+    {
         static $fields = array('id', 'profile_id', 'uri', 'content', 'rendered',
                                'url', 'created', 'modified', 'reply_to', 'is_local', 'source');
         $this->i++;
diff --git a/classes/Notice_inbox.php b/classes/Notice_inbox.php
index 922ba2660..81ddb4538 100644
--- a/classes/Notice_inbox.php
+++ b/classes/Notice_inbox.php
@@ -33,7 +33,8 @@ class Notice_inbox extends Memcached_DataObject
     public $source;                          // tinyint(1)   default_1
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Notice_source.php b/classes/Notice_source.php
index a12397b0b..e7568bbca 100644
--- a/classes/Notice_source.php
+++ b/classes/Notice_source.php
@@ -17,7 +17,8 @@ class Notice_source extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Notice_tag.php b/classes/Notice_tag.php
index 8c3911f76..94f9296d6 100644
--- a/classes/Notice_tag.php
+++ b/classes/Notice_tag.php
@@ -30,7 +30,8 @@ class Notice_tag extends Memcached_DataObject
     public $created;                         // datetime()   not_null
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -46,7 +47,8 @@ class Notice_tag extends Memcached_DataObject
                                  $offset, $limit);
     }
     
-    function blowCache() {
+    function blowCache()
+    {
         $cache = common_memcache();
         if ($cache) {
             $cache->delete(common_cache_key('notice_tag:notice_stream:' . $this->tag));
diff --git a/classes/Profile.php b/classes/Profile.php
index b95cbf993..fb6ff90f1 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -41,12 +41,14 @@ class Profile extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Profile',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function getAvatar($width, $height=null) {
+    function getAvatar($width, $height=null)
+    {
         if (is_null($height)) {
             $height = $width;
         }
@@ -55,7 +57,8 @@ class Profile extends Memcached_DataObject
                                      'height' => $height));
     }
 
-    function getOriginalAvatar() {
+    function getOriginalAvatar()
+    {
         $avatar = DB_DataObject::factory('avatar');
         $avatar->profile_id = $this->id;
         $avatar->original = true;
@@ -66,7 +69,8 @@ class Profile extends Memcached_DataObject
         }
     }
 
-    function setOriginal($source) {
+    function setOriginal($source)
+    {
 
         $info = @getimagesize($source);
 
@@ -117,7 +121,8 @@ class Profile extends Memcached_DataObject
         return $avatar;
     }
 
-    function delete_avatars() {
+    function delete_avatars()
+    {
         $avatar = new Avatar();
         $avatar->profile_id = $this->id;
         $avatar->find();
@@ -127,12 +132,14 @@ class Profile extends Memcached_DataObject
         return true;
     }
 
-    function getBestName() {
+    function getBestName()
+    {
         return ($this->fullname) ? $this->fullname : $this->nickname;
     }
 
     # Get latest notice on or before date; default now
-    function getCurrentNotice($dt=null) {
+    function getCurrentNotice($dt=null)
+    {
         $notice = new Notice();
         $notice->profile_id = $this->id;
         if ($dt) {
@@ -146,7 +153,8 @@ class Profile extends Memcached_DataObject
         return null;
     }
 
-    function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) {
+    function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
+    {
         $qry =
           'SELECT * ' .
           'FROM notice ' .
diff --git a/classes/Profile_block.php b/classes/Profile_block.php
index 41d6701eb..551e690e2 100644
--- a/classes/Profile_block.php
+++ b/classes/Profile_block.php
@@ -36,12 +36,14 @@ class Profile_block extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Profile_block',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function get($blocker, $blocked) {
+    function get($blocker, $blocked)
+    {
         return Memcached_DataObject::pkeyGet('Profile_block',
                                              array('blocker' => $blocker,
                                                    'blocked' => $blocked));
diff --git a/classes/Profile_tag.php b/classes/Profile_tag.php
index 5c508c84f..cb60cbaec 100644
--- a/classes/Profile_tag.php
+++ b/classes/Profile_tag.php
@@ -16,7 +16,8 @@ class Profile_tag extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Queue_item.php b/classes/Queue_item.php
index f2fc0be03..1b34d8ab4 100644
--- a/classes/Queue_item.php
+++ b/classes/Queue_item.php
@@ -16,12 +16,14 @@ class Queue_item extends Memcached_DataObject
     public $claimed;                         // datetime()  
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function sequenceKey() { return array(false, false); }
+    function sequenceKey()
+    { return array(false, false); }
     
     static function top($transport) {
 
diff --git a/classes/Remember_me.php b/classes/Remember_me.php
index 9d3f9378f..8dc29bfa3 100644
--- a/classes/Remember_me.php
+++ b/classes/Remember_me.php
@@ -15,10 +15,12 @@ class Remember_me extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function sequenceKey() { return array(false, false); }
+    function sequenceKey()
+    { return array(false, false); }
 }
diff --git a/classes/Remote_profile.php b/classes/Remote_profile.php
index 66b0f3a5c..5aa6d913e 100644
--- a/classes/Remote_profile.php
+++ b/classes/Remote_profile.php
@@ -38,7 +38,8 @@ class Remote_profile extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Reply.php b/classes/Reply.php
index 10d6ced5b..af86aaf87 100644
--- a/classes/Reply.php
+++ b/classes/Reply.php
@@ -16,7 +16,8 @@ class Reply extends Memcached_DataObject
     public $replied_id;                      // int(4)  
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Reply',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Reply',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/Sms_carrier.php b/classes/Sms_carrier.php
index b4a9d8655..ffa12de29 100644
--- a/classes/Sms_carrier.php
+++ b/classes/Sms_carrier.php
@@ -17,12 +17,14 @@ class Sms_carrier extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
     
-    function toEmailAddress($sms) {
+    function toEmailAddress($sms)
+    {
         return sprintf($this->email_pattern, $sms);
     }
 }
diff --git a/classes/Subscription.php b/classes/Subscription.php
index d70f99550..3fe0d167f 100644
--- a/classes/Subscription.php
+++ b/classes/Subscription.php
@@ -40,12 +40,14 @@ class Subscription extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
     
-    function &pkeyGet($kv) {
+    function &pkeyGet($kv)
+    {
         return Memcached_DataObject::pkeyGet('Subscription', $kv);
     }
 }
diff --git a/classes/Token.php b/classes/Token.php
index 3c88444c8..1fabd72f1 100644
--- a/classes/Token.php
+++ b/classes/Token.php
@@ -19,7 +19,8 @@ class Token extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Token',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('Token',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/classes/User.php b/classes/User.php
index 29e6a86e9..90d0ccfe0 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -62,16 +62,19 @@ class User extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('User',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    function getProfile() {
+    function getProfile()
+    {
         return Profile::staticGet('id', $this->id);
     }
 
-    function isSubscribed($other) {
+    function isSubscribed($other)
+    {
         assert(!is_null($other));
         # XXX: cache results of this query
         $sub = Subscription::pkeyGet(array('subscriber' => $this->id,
@@ -81,7 +84,8 @@ class User extends Memcached_DataObject
 
     # 'update' won't write key columns, so we have to do it ourselves.
 
-    function updateKeys(&$orig) {
+    function updateKeys(&$orig)
+    {
         $parts = array();
         foreach (array('nickname', 'email', 'jabber', 'incomingemail', 'sms', 'carrier', 'smsemail', 'language', 'timezone') as $k) {
             if (strcmp($this->$k, $orig->$k) != 0) {
@@ -108,7 +112,8 @@ class User extends Memcached_DataObject
         return $result;
     }
 
-    function allowed_nickname($nickname) {
+    function allowed_nickname($nickname)
+    {
         # XXX: should already be validated for size, content, etc.
         static $blacklist = array('rss', 'xrds', 'doc', 'main',
                                   'settings', 'notice', 'user',
@@ -118,7 +123,8 @@ class User extends Memcached_DataObject
         return !in_array($nickname, $merged);
     }
 
-    function getCurrentNotice($dt=null) {
+    function getCurrentNotice($dt=null)
+    {
         $profile = $this->getProfile();
         if (!$profile) {
             return null;
@@ -126,11 +132,13 @@ class User extends Memcached_DataObject
         return $profile->getCurrentNotice($dt);
     }
 
-    function getCarrier() {
+    function getCarrier()
+    {
         return Sms_carrier::staticGet('id', $this->carrier);
     }
 
-    function subscribeTo($other) {
+    function subscribeTo($other)
+    {
         $sub = new Subscription();
         $sub->subscriber = $this->id;
         $sub->subscribed = $other->id;
@@ -144,7 +152,8 @@ class User extends Memcached_DataObject
         return true;
     }
 
-    function hasBlocked($other) {
+    function hasBlocked($other)
+    {
 
         $block = Profile_block::get($this->id, $other->id);
 
@@ -271,7 +280,8 @@ class User extends Memcached_DataObject
 
     # Things we do when the email changes
 
-    function emailChanged() {
+    function emailChanged()
+    {
 
         $invites = new Invitation();
         $invites->address = $this->email;
@@ -285,7 +295,8 @@ class User extends Memcached_DataObject
         }
     }
 
-    function hasFave($notice) {
+    function hasFave($notice)
+    {
         $cache = common_memcache();
 
         # XXX: Kind of a hack.
@@ -317,12 +328,14 @@ class User extends Memcached_DataObject
                                     'notice_id' => $notice->id));
         return ((is_null($fave)) ? false : true);
     }
-    function mutuallySubscribed($other) {
+    function mutuallySubscribed($other)
+    {
         return $this->isSubscribed($other) &&
           $other->isSubscribed($this);
     }
 
-        function mutuallySubscribedUsers() {
+        function mutuallySubscribedUsers()
+        {
 
         # 3-way join; probably should get cached
         $qry = 'SELECT user.* ' .
@@ -336,7 +349,8 @@ class User extends Memcached_DataObject
         return $user;
     }
 
-    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
+    function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+    {
         $qry =
           'SELECT notice.* ' .
           'FROM notice JOIN reply ON notice.id = reply.notice_id ' .
@@ -346,7 +360,8 @@ class User extends Memcached_DataObject
                                  $offset, $limit, $since_id, $before_id, null, $since);
     }
 
-        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
+        function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+        {
         $profile = $this->getProfile();
         if (!$profile) {
             return null;
@@ -355,7 +370,8 @@ class User extends Memcached_DataObject
         }
     }
 
-      function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE) {
+      function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE)
+      {
         $qry =
           'SELECT notice.* ' .
           'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
@@ -365,7 +381,8 @@ class User extends Memcached_DataObject
                                  $offset, $limit);
     }
 
-        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
+        function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+        {
         $enabled = common_config('inboxes', 'enabled');
 
         # Complicated code, depending on whether we support inboxes yet
@@ -394,7 +411,8 @@ class User extends Memcached_DataObject
                                  $order, $since);
     }
 
-        function blowFavesCache() {
+        function blowFavesCache()
+        {
         $cache = common_memcache();
         if ($cache) {
             # Faves don't happen chronologically, so we need to blow
@@ -404,15 +422,18 @@ class User extends Memcached_DataObject
         }
     }
 
-        function getSelfTags() {
+        function getSelfTags()
+        {
         return Profile_tag::getTags($this->id, $this->id);
     }
 
-        function setSelfTags($newtags) {
+        function setSelfTags($newtags)
+        {
         return Profile_tag::setTags($this->id, $this->id, $newtags);
     }
 
-    function block($other) {
+    function block($other)
+    {
 
         # Add a new block record
 
@@ -450,7 +471,8 @@ class User extends Memcached_DataObject
         return true;
     }
 
-    function unblock($other) {
+    function unblock($other)
+    {
 
         # Get the block record
 
diff --git a/classes/User_openid.php b/classes/User_openid.php
index 7dc476dc4..f4fda1c72 100644
--- a/classes/User_openid.php
+++ b/classes/User_openid.php
@@ -17,7 +17,8 @@ class User_openid extends Memcached_DataObject
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* Static get */
-    function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
+    function staticGet($k,$v=null)
+    { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
diff --git a/lib/Shorturl_api.php b/lib/Shorturl_api.php
index 7beae0ec6..f3f4f08df 100644
--- a/lib/Shorturl_api.php
+++ b/lib/Shorturl_api.php
@@ -22,11 +22,13 @@ if (!defined('LACONICA')) { exit(1); }
 class ShortUrlApi {
     protected $service_url;
 
-    function __construct($service_url) {
+    function __construct($service_url)
+    {
         $this->service_url = $service_url;
     }
 
-    function shorten($url) {
+    function shorten($url)
+    {
         if ($this->is_long($url)) return $this->shorten_imp($url);
         return $url;
     }
@@ -68,7 +70,8 @@ class ShortUrlApi {
 }
 
 class LilUrl extends ShortUrlApi {
-    function __construct() {
+    function __construct()
+    {
         parent::__construct('http://ur1.ca/');
     }
 
@@ -86,7 +89,8 @@ class LilUrl extends ShortUrlApi {
 
 
 class PtitUrl extends ShortUrlApi {
-    function __construct() {
+    function __construct()
+    {
         parent::__construct('http://ptiturl.com/?creer=oui&action=Reduire&url=');
     }
 
@@ -103,7 +107,8 @@ class PtitUrl extends ShortUrlApi {
 }
 
 class TightUrl extends ShortUrlApi {
-    function __construct() {
+    function __construct()
+    {
         parent::__construct('http://2tu.us/?save=y&url=');
     }
 
diff --git a/lib/common.php b/lib/common.php
index 3e162f781..74c992f1c 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -163,7 +163,8 @@ require_once(INSTALLDIR.'/lib/subs.php');
 require_once(INSTALLDIR.'/lib/Shorturl_api.php');
 require_once(INSTALLDIR.'/lib/twitter.php');
 
-function __autoload($class) {
+function __autoload($class)
+{
     if ($class == 'OAuthRequest') {
         require_once('OAuth.php');
     } else if (file_exists(INSTALLDIR.'/classes/' . $class . '.php')) {
diff --git a/lib/deleteaction.php b/lib/deleteaction.php
index a7de6b8fb..a6e365121 100644
--- a/lib/deleteaction.php
+++ b/lib/deleteaction.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class DeleteAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $user = common_current_user();
         $notice_id = $this->trimmed('notice');
@@ -43,7 +44,8 @@ class DeleteAction extends Action {
         }
     }
 
-    function show_top($arr=null) {
+    function show_top($arr=null)
+    {
         $instr = $this->get_instructions();
         $output = common_markup_to_html($instr);
         common_element_start('div', 'instructions');
@@ -51,11 +53,13 @@ class DeleteAction extends Action {
         common_element_end('div');
     }
 
-    function get_title() {
+    function get_title()
+    {
         return null;
     }
 
-    function show_header() {
+    function show_header()
+    {
         return;
     }
 }
diff --git a/lib/facebookaction.php b/lib/facebookaction.php
index 731460f12..43464b19b 100644
--- a/lib/facebookaction.php
+++ b/lib/facebookaction.php
@@ -23,17 +23,20 @@ require_once(INSTALLDIR.'/extlib/facebook/facebook.php');
 
 class FacebookAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
     }
 
-    function get_facebook() {
+    function get_facebook()
+    {
         $apikey = common_config('facebook', 'apikey');
         $secret = common_config('facebook', 'secret');
         return new Facebook($apikey, $secret);
     }
 
-    function update_profile_box($facebook, $fbuid, $user) {
+    function update_profile_box($facebook, $fbuid, $user)
+    {
 
         $notice = $user->getCurrentNotice();
 
@@ -86,7 +89,8 @@ class FacebookAction extends Action {
 
     # Display methods
 
-    function show_header($selected ='Home') {
+    function show_header($selected ='Home')
+    {
 
         # Add a timestamp to the CSS file so Facebook cache wont ignore our changes
         $ts = filemtime(theme_file('facebookapp.css'));
@@ -108,12 +112,14 @@ class FacebookAction extends Action {
 
     }
 
-    function show_footer() {
+    function show_footer()
+    {
       $footer = '</div>';
       echo $footer;
     }
 
-    function show_login_form() {
+    function show_login_form()
+    {
 
         $loginform =
             ' <h2>To add the Identi.ca application, you need to log into your Identi.ca account.</h2>'
@@ -148,7 +154,8 @@ class FacebookAction extends Action {
             echo $loginform;
     }
 
-    function render_notice($notice) {
+    function render_notice($notice)
+    {
 
         global $config;
 
@@ -207,7 +214,8 @@ class FacebookAction extends Action {
         return $html;
     }
 
-    function source_link($source) {
+    function source_link($source)
+    {
         $source_name = _($source);
 
         $html = '<span class="noticesource">';
@@ -235,7 +243,8 @@ class FacebookAction extends Action {
         return $html;
     }
 
-    function pagination($have_before, $have_after, $page, $fbaction, $args=null) {
+    function pagination($have_before, $have_after, $page, $fbaction, $args=null)
+    {
 
         $html = '';
 
@@ -266,7 +275,8 @@ class FacebookAction extends Action {
         }
     }
 
-    function pagination_url($fbaction, $args=null) {
+    function pagination_url($fbaction, $args=null)
+    {
         global $config;
 
         $extra = '';
diff --git a/lib/oauthstore.php b/lib/oauthstore.php
index 421b618b7..7ec3ca655 100644
--- a/lib/oauthstore.php
+++ b/lib/oauthstore.php
@@ -25,7 +25,8 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
 
     # We keep a record of who's contacted us
 
-    function lookup_consumer($consumer_key) {
+    function lookup_consumer($consumer_key)
+    {
         $con = Consumer::staticGet('consumer_key', $consumer_key);
         if (!$con) {
             $con = new Consumer();
@@ -39,7 +40,8 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         return new OAuthConsumer($con->consumer_key, '');
     }
 
-    function lookup_token($consumer, $token_type, $token_key) {
+    function lookup_token($consumer, $token_type, $token_key)
+    {
         $t = new Token();
         $t->consumer_key = $consumer->key;
         $t->tok = $token_key;
@@ -51,7 +53,8 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         }
     }
 
-    function lookup_nonce($consumer, $token, $nonce, $timestamp) {
+    function lookup_nonce($consumer, $token, $nonce, $timestamp)
+    {
         $n = new Nonce();
         $n->consumer_key = $consumer->key;
         $n->tok = $token->key;
@@ -66,7 +69,8 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         }
     }
 
-    function new_request_token($consumer) {
+    function new_request_token($consumer)
+    {
         $t = new Token();
         $t->consumer_key = $consumer->key;
         $t->tok = common_good_rand(16);
@@ -83,11 +87,13 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
 
     # defined in OAuthDataStore, but not implemented anywhere
 
-    function fetch_request_token($consumer) {
+    function fetch_request_token($consumer)
+    {
         return $this->new_request_token($consumer);
     }
 
-    function new_access_token($token, $consumer) {
+    function new_access_token($token, $consumer)
+    {
         common_debug('new_access_token("'.$token->key.'","'.$consumer->key.'")', __FILE__);
         $rt = new Token();
         $rt->consumer_key = $consumer->key;
@@ -138,7 +144,8 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
 
     # defined in OAuthDataStore, but not implemented anywhere
 
-    function fetch_access_token($consumer) {
+    function fetch_access_token($consumer)
+    {
         return $this->new_access_token($consumer);
     }
 }
diff --git a/lib/omb.php b/lib/omb.php
index 8199b0679..c07bedab5 100644
--- a/lib/omb.php
+++ b/lib/omb.php
@@ -43,7 +43,8 @@ define('OAUTH_AUTH_HEADER', OAUTH_NAMESPACE.'parameters/auth-header');
 define('OAUTH_POST_BODY', OAUTH_NAMESPACE.'parameters/post-body');
 define('OAUTH_HMAC_SHA1', OAUTH_NAMESPACE.'signature/HMAC-SHA1');
 
-function omb_oauth_consumer() {
+function omb_oauth_consumer()
+{
     static $con = null;
     if (!$con) {
         $con = new OAuthConsumer(common_root_url(), '');
@@ -51,7 +52,8 @@ function omb_oauth_consumer() {
     return $con;
 }
 
-function omb_oauth_server() {
+function omb_oauth_server()
+{
     static $server = null;
     if (!$server) {
         $server = new OAuthServer(omb_oauth_datastore());
@@ -60,7 +62,8 @@ function omb_oauth_server() {
     return $server;
 }
 
-function omb_oauth_datastore() {
+function omb_oauth_datastore()
+{
     static $store = null;
     if (!$store) {
         $store = new LaconicaOAuthDataStore();
@@ -68,7 +71,8 @@ function omb_oauth_datastore() {
     return $store;
 }
 
-function omb_hmac_sha1() {
+function omb_hmac_sha1()
+{
     static $hmac_method = null;
     if (!$hmac_method) {
         $hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
@@ -76,20 +80,24 @@ function omb_hmac_sha1() {
     return $hmac_method;
 }
 
-function omb_get_services($xrd, $type) {
+function omb_get_services($xrd, $type)
+{
     return $xrd->services(array(omb_service_filter($type)));
 }
 
-function omb_service_filter($type) {
+function omb_service_filter($type)
+{
     return create_function('$s',
                            'return omb_match_service($s, \''.$type.'\');');
 }
 
-function omb_match_service($service, $type) {
+function omb_match_service($service, $type)
+{
     return in_array($type, $service->getTypes());
 }
 
-function omb_service_uri($service) {
+function omb_service_uri($service)
+{
     if (!$service) {
         return null;
     }
@@ -100,7 +108,8 @@ function omb_service_uri($service) {
     return $uris[0];
 }
 
-function omb_local_id($service) {
+function omb_local_id($service)
+{
     if (!$service) {
         return null;
     }
@@ -112,7 +121,8 @@ function omb_local_id($service) {
     return $service->parser->content($el);
 }
 
-function omb_broadcast_remote_subscribers($notice) {
+function omb_broadcast_remote_subscribers($notice)
+{
 
     # First, get remote users subscribed to this profile
     $rp = new Remote_profile();
@@ -142,11 +152,13 @@ function omb_broadcast_remote_subscribers($notice) {
     return true;
 }
 
-function omb_post_notice($notice, $remote_profile, $subscription) {
+function omb_post_notice($notice, $remote_profile, $subscription)
+{
     return omb_post_notice_keys($notice, $remote_profile->postnoticeurl, $subscription->token, $subscription->secret);
 }
 
-function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret) {
+function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret)
+{
 
     common_debug('Posting notice ' . $notice->id . ' to ' . $postnoticeurl, __FILE__);
 
@@ -216,7 +228,8 @@ function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret) {
     }
 }
 
-function omb_broadcast_profile($profile) {
+function omb_broadcast_profile($profile)
+{
     # First, get remote users subscribed to this profile
     # XXX: use a join here rather than looping through results
     $sub = new Subscription();
@@ -236,7 +249,8 @@ function omb_broadcast_profile($profile) {
     }
 }
 
-function omb_update_profile($profile, $remote_profile, $subscription) {
+function omb_update_profile($profile, $remote_profile, $subscription)
+{
     global $config; # for license URL
     $user = User::staticGet($profile->id);
     $con = omb_oauth_consumer();
diff --git a/lib/openid.php b/lib/openid.php
index 3ca359fa1..1e7f318fb 100644
--- a/lib/openid.php
+++ b/lib/openid.php
@@ -31,7 +31,8 @@ require_once('Auth/OpenID/MySQLStore.php');
 define('OPENID_COOKIE_EXPIRY', round(365.25 * 24 * 60 * 60));
 define('OPENID_COOKIE_KEY', 'lastusedopenid');
 
-function oid_store() {
+function oid_store()
+{
     static $store = null;
     if (!$store) {
         # Can't be called statically
@@ -42,23 +43,27 @@ function oid_store() {
     return $store;
 }
 
-function oid_consumer() {
+function oid_consumer()
+{
     $store = oid_store();
     $consumer = new Auth_OpenID_Consumer($store);
     return $consumer;
 }
 
-function oid_clear_last() {
+function oid_clear_last()
+{
     oid_set_last('');
 }
 
-function oid_set_last($openid_url) {
+function oid_set_last($openid_url)
+{
     common_set_cookie(OPENID_COOKIE_KEY,
                      $openid_url,
                      time() + OPENID_COOKIE_EXPIRY);
 }
 
-function oid_get_last() {
+function oid_get_last()
+{
     $openid_url = $_COOKIE[OPENID_COOKIE_KEY];
     if ($openid_url && strlen($openid_url) > 0) {
         return $openid_url;
@@ -67,7 +72,8 @@ function oid_get_last() {
     }
 }
 
-function oid_link_user($id, $canonical, $display) {
+function oid_link_user($id, $canonical, $display)
+{
 
     $oid = new User_openid();
     $oid->user_id = $id;
@@ -84,7 +90,8 @@ function oid_link_user($id, $canonical, $display) {
     return true;
 }
 
-function oid_get_user($openid_url) {
+function oid_get_user($openid_url)
+{
     $user = null;
     $oid = User_openid::staticGet('canonical', $openid_url);
     if ($oid) {
@@ -93,7 +100,8 @@ function oid_get_user($openid_url) {
     return $user;
 }
 
-function oid_check_immediate($openid_url, $backto=null) {
+function oid_check_immediate($openid_url, $backto=null)
+{
     if (!$backto) {
         $action = $_REQUEST['action'];
         $args = common_copy_args($_GET);
@@ -113,7 +121,8 @@ function oid_check_immediate($openid_url, $backto=null) {
                      true);
 }
 
-function oid_authenticate($openid_url, $returnto, $immediate=false) {
+function oid_authenticate($openid_url, $returnto, $immediate=false)
+{
 
     $consumer = oid_consumer();
 
@@ -190,7 +199,8 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) {
 
 # Half-assed attempt at a module-private function
 
-function _oid_print_instructions() {
+function _oid_print_instructions()
+{
     common_element('div', 'instructions',
                    _('This form should automatically submit itself. '.
                       'If not, click the submit button to go to your '.
@@ -199,7 +209,8 @@ function _oid_print_instructions() {
 
 # update a user from sreg parameters
 
-function oid_update_user(&$user, &$sreg) {
+function oid_update_user(&$user, &$sreg)
+{
 
     $profile = $user->getProfile();
 
diff --git a/lib/personal.php b/lib/personal.php
index 7ff9305f1..34ebe6894 100644
--- a/lib/personal.php
+++ b/lib/personal.php
@@ -21,16 +21,19 @@ if (!defined('LACONICA')) { exit(1); }
 
 class PersonalAction extends Action {
     
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
     
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         common_set_returnto($this->self_url());
     }
 
-    function views_menu() {
+    function views_menu()
+    {
 
         $user = null;
         $action = $this->trimmed('action');
@@ -85,7 +88,8 @@ class PersonalAction extends Action {
         common_element_end('ul');
     }
 
-    function show_feeds_list($feeds) {
+    function show_feeds_list($feeds)
+    {
         common_element_start('div', array('class' => 'feeds'));
         common_element('p', null, 'Feeds:');
         common_element_start('ul', array('class' => 'xoxo'));
@@ -97,7 +101,8 @@ class PersonalAction extends Action {
         common_element_end('div');
     }
 
-    function common_feed_item($feed) {
+    function common_feed_item($feed)
+    {
         $nickname = $this->trimmed('nickname');
 
         switch($feed['item']) {
@@ -181,7 +186,8 @@ class PersonalAction extends Action {
     }
 
     
-    function source_link($source) {
+    function source_link($source)
+    {
         $source_name = _($source);
         switch ($source) {
          case 'web':
diff --git a/lib/profilelist.php b/lib/profilelist.php
index 9929c8647..60737c3d4 100644
--- a/lib/profilelist.php
+++ b/lib/profilelist.php
@@ -28,13 +28,15 @@ class ProfileList {
     var $owner = null;
     var $action = null;
 
-    function __construct($profile, $owner=null, $action=null) {
+    function __construct($profile, $owner=null, $action=null)
+    {
         $this->profile = $profile;
         $this->owner = $owner;
         $this->action = $action;
     }
 
-    function show_list() {
+    function show_list()
+    {
 
         common_element_start('ul', array('id' => 'profiles', 'class' => 'profile_list'));
 
@@ -53,7 +55,8 @@ class ProfileList {
         return $cnt;
     }
 
-    function show() {
+    function show()
+    {
 
         common_element_start('li', array('class' => 'profile_single',
                                          'id' => 'profile-' . $this->profile->id));
@@ -159,11 +162,13 @@ class ProfileList {
 
     /* Override this in subclasses. */
 
-    function show_owner_controls($profile) {
+    function show_owner_controls($profile)
+    {
         return;
     }
 
-    function highlight($text) {
+    function highlight($text)
+    {
         return htmlspecialchars($text);
     }
 }
\ No newline at end of file
diff --git a/lib/queuehandler.php b/lib/queuehandler.php
index ecf58f69f..48487f8e9 100644
--- a/lib/queuehandler.php
+++ b/lib/queuehandler.php
@@ -29,43 +29,53 @@ class QueueHandler extends Daemon {
 
     var $_id = 'generic';
 
-    function QueueHandler($id=null) {
+    function QueueHandler($id=null)
+    {
         if ($id) {
             $this->set_id($id);
         }
     }
     
-    function class_name() {
+    function class_name()
+    {
         return ucfirst($this->transport()) . 'Handler';
     }
 
-    function name() {
+    function name()
+    {
         return strtolower($this->class_name().'.'.$this->get_id());
     }
     
-    function get_id() {
+    function get_id()
+    {
         return $this->_id;
     }
 
-    function set_id($id) {
+    function set_id($id)
+    {
         $this->_id = $id;
     }
     
-    function transport() {
+    function transport()
+    {
         return null;
     }
     
-    function start() {
+    function start()
+    {
     }
     
-    function finish() {
+    function finish()
+    {
     }
 
-    function handle_notice($notice) {
+    function handle_notice($notice)
+    {
         return true;
     }
     
-    function run() {
+    function run()
+    {
         if (!$this->start()) {
             return false;
         }
@@ -110,13 +120,15 @@ class QueueHandler extends Daemon {
         return true;
     }
 
-    function idle($timeout=0) {
+    function idle($timeout=0)
+    {
         if ($timeout>0) {
             sleep($timeout);
         }
     }
     
-    function clear_old_claims() {
+    function clear_old_claims()
+    {
         $qi = new Queue_item();
         $qi->transport = $this->transport();
         $qi->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
@@ -125,7 +137,8 @@ class QueueHandler extends Daemon {
         unset($qi);
     }
     
-    function log($level, $msg) {
+    function log($level, $msg)
+    {
         common_log($level, $this->class_name() . ' ('. $this->get_id() .'): '.$msg);
     }
 }
diff --git a/lib/rssaction.php b/lib/rssaction.php
index a21ce3a97..e02e1febb 100644
--- a/lib/rssaction.php
+++ b/lib/rssaction.php
@@ -26,11 +26,13 @@ class Rss10Action extends Action {
     # This will contain the details of each feed item's author and be used to generate SIOC data.
     var $creators = array();
 
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $limit = (int) $this->trimmed('limit');
         if ($limit == 0) {
@@ -39,26 +41,31 @@ class Rss10Action extends Action {
         $this->show_rss($limit);
     }
 
-    function init() {
+    function init()
+    {
         return true;
     }
 
-    function get_notices() {
+    function get_notices()
+    {
         return array();
     }
 
-    function get_channel() {
+    function get_channel()
+    {
         return array('url' => '',
                      'title' => '',
                      'link' => '',
                      'description' => '');
     }
 
-    function get_image() {
+    function get_image()
+    {
         return null;
     }
 
-    function show_rss($limit=0) {
+    function show_rss($limit=0)
+    {
 
         if (!$this->init()) {
             return;
@@ -78,7 +85,8 @@ class Rss10Action extends Action {
         $this->end_rss();
     }
 
-    function show_channel($notices) {
+    function show_channel($notices)
+    {
 
         $channel = $this->get_channel();
         $image = $this->get_image();
@@ -106,7 +114,8 @@ class Rss10Action extends Action {
         common_element_end('channel');
     }
 
-    function show_image() {
+    function show_image()
+    {
         $image = $this->get_image();
         if ($image) {
             $channel = $this->get_channel();
@@ -118,7 +127,8 @@ class Rss10Action extends Action {
         }
     }
 
-    function show_item($notice) {
+    function show_item($notice)
+    {
         $profile = Profile::staticGet($notice->profile_id);
         $nurl = common_local_url('shownotice', array('notice' => $notice->id));
         $creator_uri = common_profile_uri($profile);
@@ -136,7 +146,8 @@ class Rss10Action extends Action {
         $this->creators[$creator_uri] = $profile;
     }
 
-    function show_creators() {
+    function show_creators()
+    {
         foreach ($this->creators as $uri => $profile) {
             $id = $profile->id;
             $nickname = $profile->nickname;
@@ -152,7 +163,8 @@ class Rss10Action extends Action {
         }
     }
 
-    function init_rss() {
+    function init_rss()
+    {
         $channel = $this->get_channel();
         header('Content-Type: application/rdf+xml');
 
@@ -183,7 +195,8 @@ class Rss10Action extends Action {
         common_element_end('sioc:Site');
     }
 
-    function end_rss() {
+    function end_rss()
+    {
         common_element_end('rdf:RDF');
     }
 }
diff --git a/lib/search_engines.php b/lib/search_engines.php
index d53d7d8d8..e96570d63 100644
--- a/lib/search_engines.php
+++ b/lib/search_engines.php
@@ -23,19 +23,23 @@ class SearchEngine {
     protected $target;
     protected $table;
 
-    function __construct($target, $table) {
+    function __construct($target, $table)
+    {
         $this->target = $target;
         $this->table = $table;
     }
 
-    function query($q) {
+    function query($q)
+    {
     }
 
-    function limit($offset, $count, $rss = false) {
+    function limit($offset, $count, $rss = false)
+    {
         return $this->target->limit($offset, $count);
     }
 
-    function set_sort_mode($mode) {
+    function set_sort_mode($mode)
+    {
         if ('chron' === $mode)
             return $this->target->orderBy('created desc');
     }
@@ -45,7 +49,8 @@ class SphinxSearch extends SearchEngine {
     private $sphinx;
     private $connected;
 
-    function __construct($target, $table) {
+    function __construct($target, $table)
+    {
         $fp = @fsockopen(common_config('sphinx', 'server'), common_config('sphinx', 'port'));
         if (!$fp) {
             $this->connected = false;
@@ -58,11 +63,13 @@ class SphinxSearch extends SearchEngine {
         $this->connected = true;
     }
 
-    function is_connected() {
+    function is_connected()
+    {
         return $this->connected;
     }
 
-    function limit($offset, $count, $rss = false) {
+    function limit($offset, $count, $rss = false)
+    {
         //FIXME without LARGEST_POSSIBLE, the most recent results aren't returned
         //      this probably has a large impact on performance
         $LARGEST_POSSIBLE = 1e6; 
@@ -78,7 +85,8 @@ class SphinxSearch extends SearchEngine {
         return $this->target->limit(0, $count);
     }
 
-    function query($q) {
+    function query($q)
+    {
         $result = $this->sphinx->query($q, $this->table);
         if (!isset($result['matches'])) return false;
         $id_set = join(', ', array_keys($result['matches']));
@@ -86,7 +94,8 @@ class SphinxSearch extends SearchEngine {
         return true;
      }
 
-    function set_sort_mode($mode) {
+    function set_sort_mode($mode)
+    {
         if ('chron' === $mode) {
             $this->sphinx->SetSortMode(SPH_SORT_ATTR_DESC, 'created_ts');
             return $this->target->orderBy('created desc');
@@ -95,7 +104,8 @@ class SphinxSearch extends SearchEngine {
 }
 
 class MySQLSearch extends SearchEngine {
-    function query($q) {
+    function query($q)
+    {
         if ('identica_people' === $this->table)
             return $this->target->whereAdd('MATCH(nickname, fullname, location, bio, homepage) ' .
                            'against (\''.addslashes($q).'\')');
@@ -106,7 +116,8 @@ class MySQLSearch extends SearchEngine {
 }
 
 class PGSearch extends SearchEngine {
-    function query($q) {
+    function query($q)
+    {
         if ('identica_people' === $this->table)
             return $this->target->whereAdd('textsearch @@ plainto_tsquery(\''.addslashes($q).'\')');
         if ('identica_notices' === $this->table)
diff --git a/lib/searchaction.php b/lib/searchaction.php
index 3eec91832..12a44a861 100644
--- a/lib/searchaction.php
+++ b/lib/searchaction.php
@@ -21,16 +21,19 @@ if (!defined('LACONICA')) { exit(1); }
 
 class SearchAction extends Action {
 
-    function is_readonly() {
+    function is_readonly()
+    {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         $this->show_form();
     }
 
-    function show_top($arr=null) {
+    function show_top($arr=null)
+    {
         if ($arr) {
             $error = $arr[1];
         }
@@ -46,15 +49,18 @@ class SearchAction extends Action {
         $this->search_menu();
     }
 
-    function get_title() {
+    function get_title()
+    {
         return null;
     }
 
-    function show_header($arr) {
+    function show_header($arr)
+    {
         return;
     }
 
-    function show_form($error=null) {
+    function show_form($error=null)
+    {
         global $config;
 
         $q = $this->trimmed('q');
@@ -91,7 +97,8 @@ class SearchAction extends Action {
         common_show_footer();
     }
 
-    function search_menu() {
+    function search_menu()
+    {
         # action => array('prompt', 'title', $args)
         $action = $this->trimmed('action');
         $menu =
diff --git a/lib/settingsaction.php b/lib/settingsaction.php
index 208d2a1b6..5979c11f0 100644
--- a/lib/settingsaction.php
+++ b/lib/settingsaction.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 class SettingsAction extends Action {
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if (!common_logged_in()) {
             common_user_error(_('Not logged in.'));
@@ -40,29 +41,34 @@ class SettingsAction extends Action {
     }
 
     # override!
-    function handle_post() {
+    function handle_post()
+    {
         return false;
     }
 
-    function show_form($msg=null, $success=false) {
+    function show_form($msg=null, $success=false)
+    {
         return false;
     }
 
-    function message($msg, $success) {
+    function message($msg, $success)
+    {
         if ($msg) {
             common_element('div', ($success) ? 'success' : 'error',
                            $msg);
         }
     }
 
-    function form_header($title, $msg=null, $success=false) {
+    function form_header($title, $msg=null, $success=false)
+    {
         common_show_header($title,
                            null,
                            array($msg, $success),
                            array($this, 'show_top'));
     }
 
-    function show_top($arr) {
+    function show_top($arr)
+    {
         $msg = $arr[0];
         $success = $arr[1];
         if ($msg) {
@@ -77,7 +83,8 @@ class SettingsAction extends Action {
         $this->settings_menu();
     }
 
-    function settings_menu() {
+    function settings_menu()
+    {
         # action => array('prompt', 'title')
         $menu =
           array('profilesettings' =>
diff --git a/lib/stream.php b/lib/stream.php
index 2d45df2d3..45fbb9bd9 100644
--- a/lib/stream.php
+++ b/lib/stream.php
@@ -24,7 +24,8 @@ require_once(INSTALLDIR.'/lib/noticelist.php');
 
 class StreamAction extends PersonalAction {
 
-    function public_views_menu() {
+    function public_views_menu()
+    {
 
         $action = $this->trimmed('action');
 
@@ -48,7 +49,8 @@ class StreamAction extends PersonalAction {
 
     }
 
-    function show_notice_list($notice) {
+    function show_notice_list($notice)
+    {
         $nl = new NoticeList($notice);
         return $nl->show();
     }
diff --git a/lib/subs.php b/lib/subs.php
index 55e74e0b2..6fa1dcad3 100644
--- a/lib/subs.php
+++ b/lib/subs.php
@@ -25,7 +25,8 @@ require_once('XMPPHP/XMPP.php');
   Returns true or an error message.
 */
 
-function subs_subscribe_user($user, $other_nickname) {
+function subs_subscribe_user($user, $other_nickname)
+{
 
     $other = User::staticGet('nickname', $other_nickname);
 
@@ -41,7 +42,8 @@ function subs_subscribe_user($user, $other_nickname) {
  * Because the other way is quite a bit more complicated.
  */
 
-function subs_subscribe_to($user, $other) {
+function subs_subscribe_to($user, $other)
+{
 
     if ($user->isSubscribed($other)) {
         return _('Already subscribed!.');
@@ -82,14 +84,16 @@ function subs_subscribe_to($user, $other) {
     return true;
 }
 
-function subs_notify($listenee, $listener) {
+function subs_notify($listenee, $listener)
+{
     # XXX: add other notifications (Jabber, SMS) here
     # XXX: queue this and handle it offline
     # XXX: Whatever happens, do it in Twitter-like API, too
     subs_notify_email($listenee, $listener);
 }
 
-function subs_notify_email($listenee, $listener) {
+function subs_notify_email($listenee, $listener)
+{
     mail_subscribe_notify($listenee, $listener);
 }
 
@@ -97,7 +101,8 @@ function subs_notify_email($listenee, $listener) {
   Returns true or an error message.
 */
 
-function subs_unsubscribe_user($user, $other_nickname) {
+function subs_unsubscribe_user($user, $other_nickname)
+{
 
     $other = User::staticGet('nickname', $other_nickname);
 
@@ -111,7 +116,8 @@ function subs_unsubscribe_user($user, $other_nickname) {
 /* Unsubscribe user $user from profile $other
  * NB: other can be a remote user. */
 
-function subs_unsubscribe_to($user, $other) {
+function subs_unsubscribe_to($user, $other)
+{
 
     if (!$user->isSubscribed($other))
         return _('Not subscribed!.');
diff --git a/lib/theme.php b/lib/theme.php
index 346cff434..6f365bd99 100644
--- a/lib/theme.php
+++ b/lib/theme.php
@@ -19,12 +19,14 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-function theme_file($relative) {
+function theme_file($relative)
+{
     $theme = common_config('site', 'theme');
     return INSTALLDIR.'/theme/'.$theme.'/'.$relative;
 }
 
-function theme_path($relative) {
+function theme_path($relative)
+{
     $theme = common_config('site', 'theme');
     $server = common_config('theme', 'server');
     if ($server) {
diff --git a/lib/twitter.php b/lib/twitter.php
index 1212875ea..07871fb20 100644
--- a/lib/twitter.php
+++ b/lib/twitter.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-function get_twitter_data($uri, $screen_name, $password) {
+function get_twitter_data($uri, $screen_name, $password)
+{
 
     $options = array(
             CURLOPT_USERPWD => sprintf("%s:%s", $screen_name, $password),
@@ -48,7 +49,8 @@ function get_twitter_data($uri, $screen_name, $password) {
     return $data;
 }
 
-function twitter_user_info($screen_name, $password) {
+function twitter_user_info($screen_name, $password)
+{
 
     $uri = "http://twitter.com/users/show/$screen_name.json";
     $data = get_twitter_data($uri, $screen_name, $password);
@@ -66,7 +68,8 @@ function twitter_user_info($screen_name, $password) {
     return $twit_user;
 }
 
-function update_twitter_user($fuser, $twitter_id, $screen_name) {
+function update_twitter_user($fuser, $twitter_id, $screen_name)
+{
 
     $original = clone($fuser);
     $fuser->nickname = $screen_name;
@@ -81,7 +84,8 @@ function update_twitter_user($fuser, $twitter_id, $screen_name) {
     return true;
 }
 
-function add_twitter_user($twitter_id, $screen_name) {
+function add_twitter_user($twitter_id, $screen_name)
+{
 
     // Otherwise, create a new Twitter user
     $fuser = DB_DataObject::factory('foreign_user');
@@ -105,7 +109,8 @@ function add_twitter_user($twitter_id, $screen_name) {
 }
 
 // Creates or Updates a Twitter user
-function save_twitter_user($twitter_id, $screen_name) {
+function save_twitter_user($twitter_id, $screen_name)
+{
 
     // Check to see whether the Twitter user is already in the system,
     // and update its screen name and uri if so.
@@ -129,7 +134,8 @@ function save_twitter_user($twitter_id, $screen_name) {
     return true;
 }
 
-function retreive_twitter_friends($twitter_id, $screen_name, $password) {
+function retreive_twitter_friends($twitter_id, $screen_name, $password)
+{
 
     $uri = "http://twitter.com/statuses/friends/$twitter_id.json?page=";
     $twitter_user = twitter_user_info($screen_name, $password);
@@ -163,7 +169,8 @@ function retreive_twitter_friends($twitter_id, $screen_name, $password) {
     return $friends;
 }
 
-function save_twitter_friends($user, $twitter_id, $screen_name, $password) {
+function save_twitter_friends($user, $twitter_id, $screen_name, $password)
+{
 
     $friends = retreive_twitter_friends($twitter_id, $screen_name, $password);
 
diff --git a/lib/twitterapi.php b/lib/twitterapi.php
index ed86c77c4..3cddfa9c9 100644
--- a/lib/twitterapi.php
+++ b/lib/twitterapi.php
@@ -23,11 +23,13 @@ class TwitterapiAction extends Action {
 
     var $auth_user;
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
     }
 
-    function twitter_user_array($profile, $get_notice=false) {
+    function twitter_user_array($profile, $get_notice=false)
+    {
 
         $twitter_user = array();
 
@@ -55,7 +57,8 @@ class TwitterapiAction extends Action {
         return $twitter_user;
     }
 
-    function twitter_status_array($notice, $include_user=true) {
+    function twitter_status_array($notice, $include_user=true)
+    {
 
         $profile = $notice->getProfile();
 
@@ -83,7 +86,8 @@ class TwitterapiAction extends Action {
         return $twitter_status;
     }
 
-    function twitter_rss_entry_array($notice) {
+    function twitter_rss_entry_array($notice)
+    {
 
         $profile = $notice->getProfile();
 
@@ -107,7 +111,8 @@ class TwitterapiAction extends Action {
         return $entry;
     }
 
-    function twitter_rss_dmsg_array($message) {
+    function twitter_rss_dmsg_array($message)
+    {
 
         $server = common_config('site', 'server');
         $entry = array();
@@ -129,7 +134,8 @@ class TwitterapiAction extends Action {
         return $entry;
     }
 
-    function twitter_dmsg_array($message) {
+    function twitter_dmsg_array($message)
+    {
 
         $twitter_dm = array();
 
@@ -149,7 +155,8 @@ class TwitterapiAction extends Action {
         return $twitter_dm;
     }
 
-    function show_twitter_xml_status($twitter_status) {
+    function show_twitter_xml_status($twitter_status)
+    {
         common_element_start('status');
         foreach($twitter_status as $element => $value) {
             switch ($element) {
@@ -166,7 +173,8 @@ class TwitterapiAction extends Action {
         common_element_end('status');
     }
 
-    function show_twitter_xml_user($twitter_user, $role='user') {
+    function show_twitter_xml_user($twitter_user, $role='user')
+    {
         common_element_start($role);
         foreach($twitter_user as $element => $value) {
             if ($element == 'status') {
@@ -178,7 +186,8 @@ class TwitterapiAction extends Action {
         common_element_end($role);
     }
 
-    function show_twitter_rss_item($entry) {
+    function show_twitter_rss_item($entry)
+    {
         common_element_start('item');
         common_element('title', null, $entry['title']);
         common_element('description', null, $entry['description']);
@@ -188,7 +197,8 @@ class TwitterapiAction extends Action {
         common_element_end('item');
     }
 
-    function show_twitter_atom_entry($entry) {
+    function show_twitter_atom_entry($entry)
+    {
         common_element_start('entry');
         common_element('title', null, $entry['title']);
         common_element('content', array('type' => 'html'), $entry['content']);
@@ -199,39 +209,45 @@ class TwitterapiAction extends Action {
         common_element_end('entry');
     }
 
-    function show_json_objects($objects) {
+    function show_json_objects($objects)
+    {
         print(json_encode($objects));
     }
 
-    function show_single_xml_status($notice) {
+    function show_single_xml_status($notice)
+    {
         $this->init_document('xml');
         $twitter_status = $this->twitter_status_array($notice);
         $this->show_twitter_xml_status($twitter_status);
         $this->end_document('xml');
     }
 
-    function show_single_json_status($notice) {
+    function show_single_json_status($notice)
+    {
         $this->init_document('json');
         $status = $this->twitter_status_array($notice);
         $this->show_json_objects($status);
         $this->end_document('json');
     }
 
-    function show_single_xml_dmsg($message) {
+    function show_single_xml_dmsg($message)
+    {
         $this->init_document('xml');
         $dmsg = $this->twitter_dmsg_array($message);
         $this->show_twitter_xml_dmsg($dmsg);
         $this->end_document('xml');
     }
 
-    function show_single_json_dmsg($message) {
+    function show_single_json_dmsg($message)
+    {
         $this->init_document('json');
         $dmsg = $this->twitter_dmsg_array($message);
         $this->show_json_objects($dmsg);
         $this->end_document('json');
     }
 
-    function show_twitter_xml_dmsg($twitter_dm) {
+    function show_twitter_xml_dmsg($twitter_dm)
+    {
         common_element_start('direct_message');
         foreach($twitter_dm as $element => $value) {
             switch ($element) {
@@ -249,7 +265,8 @@ class TwitterapiAction extends Action {
         common_element_end('direct_message');
     }
 
-    function show_xml_timeline($notice) {
+    function show_xml_timeline($notice)
+    {
 
         $this->init_document('xml');
         common_element_start('statuses', array('type' => 'array'));
@@ -270,7 +287,8 @@ class TwitterapiAction extends Action {
         $this->end_document('xml');
     }
 
-    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null) {
+    function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null)
+    {
 
         $this->init_document('rss');
 
@@ -304,7 +322,8 @@ class TwitterapiAction extends Action {
         $this->end_twitter_rss();
     }
 
-    function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null) {
+    function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null)
+    {
 
         $this->init_document('atom');
 
@@ -335,7 +354,8 @@ class TwitterapiAction extends Action {
 
     }
 
-    function show_json_timeline($notice) {
+    function show_json_timeline($notice)
+    {
 
         $this->init_document('json');
 
@@ -360,12 +380,14 @@ class TwitterapiAction extends Action {
 
     // Anyone know what date format this is?
     // Twitter's dates look like this: "Mon Jul 14 23:52:38 +0000 2008" -- Zach
-    function date_twitter($dt) {
+    function date_twitter($dt)
+    {
         $t = strtotime($dt);
         return date("D M d G:i:s O Y", $t);
     }
 
-    function replier_by_reply($reply_id) {
+    function replier_by_reply($reply_id)
+    {
         $notice = Notice::staticGet($reply_id);
         if ($notice) {
             $profile = $notice->getProfile();
@@ -381,7 +403,8 @@ class TwitterapiAction extends Action {
     }
 
     // XXX: Candidate for a general utility method somewhere?
-    function count_subscriptions($profile) {
+    function count_subscriptions($profile)
+    {
 
         $count = 0;
         $sub = new Subscription();
@@ -396,7 +419,8 @@ class TwitterapiAction extends Action {
         }
     }
 
-    function init_document($type='xml') {
+    function init_document($type='xml')
+    {
         switch ($type) {
          case 'xml':
             header('Content-Type: application/xml; charset=utf-8');
@@ -427,7 +451,8 @@ class TwitterapiAction extends Action {
         return;
     }
 
-    function end_document($type='xml') {
+    function end_document($type='xml')
+    {
         switch ($type) {
          case 'xml':
             common_end_xml();
@@ -453,7 +478,8 @@ class TwitterapiAction extends Action {
         return;
     }
 
-    function client_error($msg, $code = 400, $content_type = 'json') {
+    function client_error($msg, $code = 400, $content_type = 'json')
+    {
 
         static $status = array(400 => 'Bad Request',
                                401 => 'Unauthorized',
@@ -501,27 +527,32 @@ class TwitterapiAction extends Action {
 
     }
 
-    function init_twitter_rss() {
+    function init_twitter_rss()
+    {
         common_start_xml();
         common_element_start('rss', array('version' => '2.0'));
     }
 
-    function end_twitter_rss() {
+    function end_twitter_rss()
+    {
         common_element_end('rss');
         common_end_xml();
     }
 
-    function init_twitter_atom() {
+    function init_twitter_atom()
+    {
         common_start_xml();
         common_element_start('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', 'xml:lang' => 'en-US'));
     }
 
-    function end_twitter_atom() {
+    function end_twitter_atom()
+    {
         common_end_xml();
         common_element_end('feed');
     }
 
-    function show_profile($profile, $content_type='xml', $notice=null) {
+    function show_profile($profile, $content_type='xml', $notice=null)
+    {
         $profile_array = $this->twitter_user_array($profile, true);
         switch ($content_type) {
          case 'xml':
@@ -537,7 +568,8 @@ class TwitterapiAction extends Action {
         return;
     }
 
-    function get_user($id, $apidata=null) {
+    function get_user($id, $apidata=null)
+    {
         if (!$id) {
             return $apidata['user'];
         } else if (is_numeric($id)) {
@@ -548,7 +580,8 @@ class TwitterapiAction extends Action {
         }
     }
 
-    function get_profile($id) {
+    function get_profile($id)
+    {
         if (is_numeric($id)) {
             return Profile::staticGet($id);
         } else {
@@ -561,7 +594,8 @@ class TwitterapiAction extends Action {
         }
     }
 
-    function source_link($source) {
+    function source_link($source)
+    {
         $source_name = _($source);
         switch ($source) {
          case 'web':
@@ -580,7 +614,8 @@ class TwitterapiAction extends Action {
         return $source_name;
     }
 
-    function show_extended_profile($user, $apidata) {
+    function show_extended_profile($user, $apidata)
+    {
 
         $this->auth_user = $apidata['user'];
 
diff --git a/lib/util.php b/lib/util.php
index f0387ebe5..ed73b19e6 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -21,7 +21,8 @@
 
 // Show a server error
 
-function common_server_error($msg, $code=500) {
+function common_server_error($msg, $code=500)
+{
     static $status = array(500 => 'Internal Server Error',
                            501 => 'Not Implemented',
                            502 => 'Bad Gateway',
@@ -44,7 +45,8 @@ function common_server_error($msg, $code=500) {
 }
 
 // Show a user error
-function common_user_error($msg, $code=400) {
+function common_user_error($msg, $code=400)
+{
     static $status = array(400 => 'Bad Request',
                            401 => 'Unauthorized',
                            402 => 'Payment Required',
@@ -80,7 +82,8 @@ function common_user_error($msg, $code=400) {
 $xw = null;
 
 // Start an HTML element
-function common_element_start($tag, $attrs=null) {
+function common_element_start($tag, $attrs=null)
+{
     global $xw;
     $xw->startElement($tag);
     if (is_array($attrs)) {
@@ -92,7 +95,8 @@ function common_element_start($tag, $attrs=null) {
     }
 }
 
-function common_element_end($tag) {
+function common_element_end($tag)
+{
     static $empty_tag = array('base', 'meta', 'link', 'hr',
                               'br', 'param', 'img', 'area',
                               'input', 'col');
@@ -105,7 +109,8 @@ function common_element_end($tag) {
     }
 }
 
-function common_element($tag, $attrs=null, $content=null) {
+function common_element($tag, $attrs=null, $content=null)
+{
     common_element_start($tag, $attrs);
     global $xw;
     if (!is_null($content)) {
@@ -114,7 +119,8 @@ function common_element($tag, $attrs=null, $content=null) {
     common_element_end($tag);
 }
 
-function common_start_xml($doc=null, $public=null, $system=null, $indent=true) {
+function common_start_xml($doc=null, $public=null, $system=null, $indent=true)
+{
     global $xw;
     $xw = new XMLWriter();
     $xw->openURI('php://output');
@@ -125,13 +131,15 @@ function common_start_xml($doc=null, $public=null, $system=null, $indent=true) {
     }
 }
 
-function common_end_xml() {
+function common_end_xml()
+{
     global $xw;
     $xw->endDocument();
     $xw->flush();
 }
 
-function common_init_locale($language=null) {
+function common_init_locale($language=null)
+{
     if(!$language) {
         $language = common_language();
     }
@@ -144,7 +152,8 @@ function common_init_locale($language=null) {
                      $language);
 }
 
-function common_init_language() {
+function common_init_language()
+{
     mb_internal_encoding('UTF-8');
     $language = common_language();
     // So we don't have to make people install the gettext locales
@@ -160,7 +169,8 @@ function common_init_language() {
 
 define('PAGE_TYPE_PREFS', 'text/html,application/xhtml+xml,application/xml;q=0.3,text/xml;q=0.2');
 
-function common_show_header($pagetitle, $callable=null, $data=null, $headercall=null) {
+function common_show_header($pagetitle, $callable=null, $data=null, $headercall=null)
+{
 
     global $config, $xw;
     global $action; /* XXX: kind of cheating here. */
@@ -243,7 +253,8 @@ function common_show_header($pagetitle, $callable=null, $data=null, $headercall=
     common_element_start('div', array('id' => 'content'));
 }
 
-function common_start_html($type=null, $indent=true) {
+function common_start_html($type=null, $indent=true)
+{
 
     if (!$type) {
         $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
@@ -274,7 +285,8 @@ function common_start_html($type=null, $indent=true) {
                                        'lang' => $language));
 }
 
-function common_show_footer() {
+function common_show_footer()
+{
     global $xw, $config;
     common_element_end('div'); // content div
     common_foot_menu();
@@ -307,17 +319,20 @@ function common_show_footer() {
     common_end_xml();
 }
 
-function common_text($txt) {
+function common_text($txt)
+{
     global $xw;
     $xw->text($txt);
 }
 
-function common_raw($xml) {
+function common_raw($xml)
+{
     global $xw;
     $xw->writeRaw($xml);
 }
 
-function common_nav_menu() {
+function common_nav_menu()
+{
     $user = common_current_user();
     common_element_start('ul', array('id' => 'nav'));
     if ($user) {
@@ -344,7 +359,8 @@ function common_nav_menu() {
     common_element_end('ul');
 }
 
-function common_foot_menu() {
+function common_foot_menu()
+{
     common_element_start('ul', array('id' => 'nav_sub'));
     common_menu_item(common_local_url('doc', array('title' => 'help')),
                      _('Help'));
@@ -361,7 +377,8 @@ function common_foot_menu() {
     common_element_end('ul');
 }
 
-function common_menu_item($url, $text, $title=null, $is_selected=false) {
+function common_menu_item($url, $text, $title=null, $is_selected=false)
+{
     $lattrs = array();
     if ($is_selected) {
         $lattrs['class'] = 'current';
@@ -375,7 +392,8 @@ function common_menu_item($url, $text, $title=null, $is_selected=false) {
     common_element_end('li');
 }
 
-function common_input($id, $label, $value=null,$instructions=null) {
+function common_input($id, $label, $value=null,$instructions=null)
+{
     common_element_start('p');
     common_element('label', array('for' => $id), $label);
     $attrs = array('name' => $id,
@@ -418,7 +436,8 @@ function common_checkbox($id, $label, $checked=false, $instructions=null, $value
     common_element_end('p');
 }
 
-function common_dropdown($id, $label, $content, $instructions=null, $blank_select=FALSE, $selected=null) {
+function common_dropdown($id, $label, $content, $instructions=null, $blank_select=FALSE, $selected=null)
+{
     common_element_start('p');
     common_element('label', array('for' => $id), $label);
     common_element_start('select', array('id' => $id, 'name' => $id));
@@ -438,14 +457,16 @@ function common_dropdown($id, $label, $content, $instructions=null, $blank_selec
     }
     common_element_end('p');
 }
-function common_hidden($id, $value) {
+function common_hidden($id, $value)
+{
     common_element('input', array('name' => $id,
                                   'type' => 'hidden',
                                   'id' => $id,
                                   'value' => $value));
 }
 
-function common_password($id, $label, $instructions=null) {
+function common_password($id, $label, $instructions=null)
+{
     common_element_start('p');
     common_element('label', array('for' => $id), $label);
     $attrs = array('name' => $id,
@@ -459,7 +480,8 @@ function common_password($id, $label, $instructions=null) {
     common_element_end('p');
 }
 
-function common_submit($id, $label, $cls='submit') {
+function common_submit($id, $label, $cls='submit')
+{
     global $xw;
     common_element_start('p');
     common_element('input', array('type' => 'submit',
@@ -470,7 +492,8 @@ function common_submit($id, $label, $cls='submit') {
     common_element_end('p');
 }
 
-function common_textarea($id, $label, $content=null, $instructions=null) {
+function common_textarea($id, $label, $content=null, $instructions=null)
+{
     common_element_start('p');
     common_element('label', array('for' => $id), $label);
     common_element('textarea', array('rows' => 3,
@@ -484,7 +507,8 @@ function common_textarea($id, $label, $content=null, $instructions=null) {
     common_element_end('p');
 }
 
-function common_timezone() {
+function common_timezone()
+{
     if (common_logged_in()) {
         $user = common_current_user();
         if ($user->timezone) {
@@ -496,7 +520,8 @@ function common_timezone() {
     return $config['site']['timezone'];
 }
 
-function common_language() {
+function common_language()
+{
 
     // If there is a user logged in and they've set a language preference
     // then return that one...
@@ -521,12 +546,14 @@ function common_language() {
 }
 // salted, hashed passwords are stored in the DB
 
-function common_munge_password($password, $id) {
+function common_munge_password($password, $id)
+{
     return md5($password . $id);
 }
 
 // check if a username exists and has matching password
-function common_check_user($nickname, $password) {
+function common_check_user($nickname, $password)
+{
     // NEVER allow blank passwords, even if they match the DB
     if (mb_strlen($password) == 0) {
         return false;
@@ -545,15 +572,18 @@ function common_check_user($nickname, $password) {
 }
 
 // is the current user logged in?
-function common_logged_in() {
+function common_logged_in()
+{
     return (!is_null(common_current_user()));
 }
 
-function common_have_session() {
+function common_have_session()
+{
     return (0 != strcmp(session_id(), ''));
 }
 
-function common_ensure_session() {
+function common_ensure_session()
+{
     if (!common_have_session()) {
         @session_start();
     }
@@ -568,7 +598,8 @@ function common_ensure_session() {
 
 $_cur = false;
 
-function common_set_user($user) {
+function common_set_user($user)
+{
 
     global $_cur;
 
@@ -592,7 +623,8 @@ function common_set_user($user) {
     return false;
 }
 
-function common_set_cookie($key, $value, $expiration=0) {
+function common_set_cookie($key, $value, $expiration=0)
+{
     $path = common_config('site', 'path');
     $server = common_config('site', 'server');
 
@@ -611,7 +643,8 @@ function common_set_cookie($key, $value, $expiration=0) {
 define('REMEMBERME', 'rememberme');
 define('REMEMBERME_EXPIRY', 30 * 24 * 60 * 60); // 30 days
 
-function common_rememberme($user=null) {
+function common_rememberme($user=null)
+{
     if (!$user) {
         $user = common_current_user();
         if (!$user) {
@@ -650,7 +683,8 @@ function common_rememberme($user=null) {
     return true;
 }
 
-function common_remembered_user() {
+function common_remembered_user()
+{
 
     $user = null;
 
@@ -715,12 +749,14 @@ function common_remembered_user() {
 
 // must be called with a valid user!
 
-function common_forgetme() {
+function common_forgetme()
+{
     common_set_cookie(REMEMBERME, '', 0);
 }
 
 // who is the current user?
-function common_current_user() {
+function common_current_user()
+{
     global $_cur;
 
     if ($_cur === false) {
@@ -752,23 +788,27 @@ function common_current_user() {
 // cookie-stealing. So, we don't let them do certain things. New reg,
 // OpenID, and password logins _are_ real.
 
-function common_real_login($real=true) {
+function common_real_login($real=true)
+{
     common_ensure_session();
     $_SESSION['real_login'] = $real;
 }
 
-function common_is_real_login() {
+function common_is_real_login()
+{
     return common_logged_in() && $_SESSION['real_login'];
 }
 
 // get canonical version of nickname for comparison
-function common_canonical_nickname($nickname) {
+function common_canonical_nickname($nickname)
+{
     // XXX: UTF-8 canonicalization (like combining chars)
     return strtolower($nickname);
 }
 
 // get canonical version of email for comparison
-function common_canonical_email($email) {
+function common_canonical_email($email)
+{
     // XXX: canonicalize UTF-8
     // XXX: lcase the domain part
     return $email;
@@ -776,7 +816,8 @@ function common_canonical_email($email) {
 
 define('URL_REGEX', '^|[ \t\r\n])((ftp|http|https|gopher|mailto|news|nntp|telnet|wais|file|prospero|aim|webcal):(([A-Za-z0-9$_.+!*(),;/?:@&~=-])|%[A-Fa-f0-9]{2}){2,}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?:@&~=%-]*))?([A-Za-z0-9$_+!*();/?:~-]))');
 
-function common_render_content($text, $notice) {
+function common_render_content($text, $notice)
+{
     $r = common_render_text($text);
     $id = $notice->profile_id;
     $r = preg_replace('/(^|\s+)@([A-Za-z0-9]{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r);
@@ -785,7 +826,8 @@ function common_render_content($text, $notice) {
     return $r;
 }
 
-function common_render_text($text) {
+function common_render_text($text)
+{
     $r = htmlspecialchars($text);
 
     $r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r);
@@ -795,7 +837,8 @@ function common_render_text($text) {
     return $r;
 }
 
-function common_render_uri_thingy($matches) {
+function common_render_uri_thingy($matches)
+{
     $uri = $matches[0];
     $trailer = '';
 
@@ -829,20 +872,23 @@ function common_render_uri_thingy($matches) {
     return '<a href="' . $uri . '"' . $title . ' class="extlink">' . $uri . '</a>' . $trailer;
 }
 
-function common_longurl($short_url)  {
+function common_longurl($short_url)
+{
     $long_url = common_shorten_link($short_url, true);
     if ($long_url === $short_url) return false;
     return $long_url;
 }
 
-function common_longurl2($uri)  {
+function common_longurl2($uri)
+{
     $uri_e = urlencode($uri);
     $longurl = unserialize(file_get_contents("http://api.longurl.org/v1/expand?format=php&url=$uri_e"));
     if (empty($longurl['long_url']) || $uri === $longurl['long_url']) return false;
     return stripslashes($longurl['long_url']);
 }
 
-function common_shorten_links($text) {
+function common_shorten_links($text)
+{
     if (mb_strlen($text) <= 140) return $text;
     static $cache = array();
     if (isset($cache[$text])) return $cache[$text];
@@ -850,7 +896,8 @@ function common_shorten_links($text) {
     return $cache[$text] = preg_replace('@https?://[^)\]>\s]+@e', "common_shorten_link('\\0')", $text);
 }
 
-function common_shorten_link($url, $reverse = false) {
+function common_shorten_link($url, $reverse = false)
+{
     static $url_cache = array();
     if ($reverse) return isset($url_cache[$url]) ? $url_cache[$url] : $url;
 
@@ -911,28 +958,33 @@ function common_shorten_link($url, $reverse = false) {
     return $url;
 }
 
-function common_xml_safe_str($str) {
+function common_xml_safe_str($str)
+{
     $xmlStr = htmlentities(iconv('UTF-8', 'UTF-8//IGNORE', $str), ENT_NOQUOTES, 'UTF-8');
 
     // Replace control, formatting, and surrogate characters with '*', ala Twitter
     return preg_replace('/[\p{Cc}\p{Cf}\p{Cs}]/u', '*', $str);
 }
 
-function common_tag_link($tag) {
+function common_tag_link($tag)
+{
     $canonical = common_canonical_tag($tag);
     $url = common_local_url('tag', array('tag' => $canonical));
     return '<a href="' . htmlspecialchars($url) . '" rel="tag" class="hashlink">' . htmlspecialchars($tag) . '</a>';
 }
 
-function common_canonical_tag($tag) {
+function common_canonical_tag($tag)
+{
     return strtolower(str_replace(array('-', '_', '.'), '', $tag));
 }
 
-function common_valid_profile_tag($str) {
+function common_valid_profile_tag($str)
+{
     return preg_match('/^[A-Za-z0-9_\-\.]{1,64}$/', $str);
 }
 
-function common_at_link($sender_id, $nickname) {
+function common_at_link($sender_id, $nickname)
+{
     $sender = Profile::staticGet($sender_id);
     $recipient = common_relative_profile($sender, common_canonical_nickname($nickname));
     if ($recipient) {
@@ -942,7 +994,8 @@ function common_at_link($sender_id, $nickname) {
     }
 }
 
-function common_at_hash_link($sender_id, $tag) {
+function common_at_hash_link($sender_id, $tag)
+{
     $user = User::staticGet($sender_id);
     if (!$user) {
         return $tag;
@@ -958,7 +1011,8 @@ function common_at_hash_link($sender_id, $tag) {
     }
 }
 
-function common_relative_profile($sender, $nickname, $dt=null) {
+function common_relative_profile($sender, $nickname, $dt=null)
+{
     // Try to find profiles this profile is subscribed to that have this nickname
     $recipient = new Profile();
     // XXX: use a join instead of a subquery
@@ -995,7 +1049,8 @@ function common_relative_profile($sender, $nickname, $dt=null) {
 
 // where should the avatar go for this user?
 
-function common_avatar_filename($id, $extension, $size=null, $extra=null) {
+function common_avatar_filename($id, $extension, $size=null, $extra=null)
+{
     global $config;
 
     if ($size) {
@@ -1005,16 +1060,19 @@ function common_avatar_filename($id, $extension, $size=null, $extra=null) {
     }
 }
 
-function common_avatar_path($filename) {
+function common_avatar_path($filename)
+{
     global $config;
     return INSTALLDIR . '/avatar/' . $filename;
 }
 
-function common_avatar_url($filename) {
+function common_avatar_url($filename)
+{
     return common_path('avatar/'.$filename);
 }
 
-function common_avatar_display_url($avatar) {
+function common_avatar_display_url($avatar)
+{
     $server = common_config('avatar', 'server');
     if ($server) {
         return 'http://'.$server.'/'.$avatar->filename;
@@ -1023,14 +1081,16 @@ function common_avatar_display_url($avatar) {
     }
 }
 
-function common_default_avatar($size) {
+function common_default_avatar($size)
+{
     static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile',
                               AVATAR_STREAM_SIZE => 'stream',
                               AVATAR_MINI_SIZE => 'mini');
     return theme_path('default-avatar-'.$sizenames[$size].'.png');
 }
 
-function common_local_url($action, $args=null, $fragment=null) {
+function common_local_url($action, $args=null, $fragment=null)
+{
     $url = null;
     if (common_config('site','fancy')) {
         $url = common_fancy_url($action, $args);
@@ -1043,7 +1103,8 @@ function common_local_url($action, $args=null, $fragment=null) {
     return $url;
 }
 
-function common_fancy_url($action, $args=null) {
+function common_fancy_url($action, $args=null)
+{
     switch (strtolower($action)) {
      case 'public':
         if ($args && isset($args['page'])) {
@@ -1256,7 +1317,8 @@ function common_fancy_url($action, $args=null) {
     }
 }
 
-function common_simple_url($action, $args=null) {
+function common_simple_url($action, $args=null)
+{
     global $config;
     /* XXX: pretty URLs */
     $extra = '';
@@ -1268,13 +1330,15 @@ function common_simple_url($action, $args=null) {
     return common_path("index.php?action=${action}${extra}");
 }
 
-function common_path($relative) {
+function common_path($relative)
+{
     global $config;
     $pathpart = ($config['site']['path']) ? $config['site']['path']."/" : '';
     return "http://".$config['site']['server'].'/'.$pathpart.$relative;
 }
 
-function common_date_string($dt) {
+function common_date_string($dt)
+{
     // XXX: do some sexy date formatting
     // return date(DATE_RFC822, $dt);
     $t = strtotime($dt);
@@ -1308,7 +1372,8 @@ function common_date_string($dt) {
     }
 }
 
-function common_exact_date($dt) {
+function common_exact_date($dt)
+{
     static $_utc;
     static $_siteTz;
 
@@ -1323,32 +1388,37 @@ function common_exact_date($dt) {
     return $d->format(DATE_RFC850);
 }
 
-function common_date_w3dtf($dt) {
+function common_date_w3dtf($dt)
+{
     $dateStr = date('d F Y H:i:s', strtotime($dt));
     $d = new DateTime($dateStr, new DateTimeZone('UTC'));
     $d->setTimezone(new DateTimeZone(common_timezone()));
     return $d->format(DATE_W3C);
 }
 
-function common_date_rfc2822($dt) {
+function common_date_rfc2822($dt)
+{
     $dateStr = date('d F Y H:i:s', strtotime($dt));
     $d = new DateTime($dateStr, new DateTimeZone('UTC'));
     $d->setTimezone(new DateTimeZone(common_timezone()));
     return $d->format('r');
 }
 
-function common_date_iso8601($dt) {
+function common_date_iso8601($dt)
+{
     $dateStr = date('d F Y H:i:s', strtotime($dt));
     $d = new DateTime($dateStr, new DateTimeZone('UTC'));
     $d->setTimezone(new DateTimeZone(common_timezone()));
     return $d->format('c');
 }
 
-function common_sql_now() {
+function common_sql_now()
+{
     return strftime('%Y-%m-%d %H:%M:%S', time());
 }
 
-function common_redirect($url, $code=307) {
+function common_redirect($url, $code=307)
+{
     static $status = array(301 => "Moved Permanently",
                            302 => "Found",
                            303 => "See Other",
@@ -1364,7 +1434,8 @@ function common_redirect($url, $code=307) {
     exit;
 }
 
-function common_save_replies($notice) {
+function common_save_replies($notice)
+{
     // Alternative reply format
     $tname = false;
     if (preg_match('/^T ([A-Z0-9]{1,64}) /', $notice->content, $match)) {
@@ -1447,7 +1518,8 @@ function common_save_replies($notice) {
     }
 }
 
-function common_broadcast_notice($notice, $remote=false) {
+function common_broadcast_notice($notice, $remote=false)
+{
 
     // Check to see if notice should go to Twitter
     $flink = Foreign_link::getByUserID($notice->profile_id, 1); // 1 == Twitter
@@ -1474,7 +1546,8 @@ function common_broadcast_notice($notice, $remote=false) {
     }
 }
 
-function common_twitter_broadcast($notice, $flink) {
+function common_twitter_broadcast($notice, $flink)
+{
     global $config;
     $success = true;
     $fuser = $flink->getForeignUser();
@@ -1534,7 +1607,8 @@ function common_twitter_broadcast($notice, $flink) {
 
 // Stick the notice on the queue
 
-function common_enqueue_notice($notice) {
+function common_enqueue_notice($notice)
+{
     foreach (array('jabber', 'omb', 'sms', 'public') as $transport) {
         $qi = new Queue_item();
         $qi->notice_id = $notice->id;
@@ -1551,7 +1625,8 @@ function common_enqueue_notice($notice) {
     return $result;
 }
 
-function common_dequeue_notice($notice) {
+function common_dequeue_notice($notice)
+{
     $qi = Queue_item::staticGet($notice->id);
     if ($qi) {
         $result = $qi->delete();
@@ -1567,7 +1642,8 @@ function common_dequeue_notice($notice) {
     }
 }
 
-function common_real_broadcast($notice, $remote=false) {
+function common_real_broadcast($notice, $remote=false)
+{
     $success = true;
     if (!$remote) {
         // Make sure we have the OMB stuff
@@ -1601,7 +1677,8 @@ function common_real_broadcast($notice, $remote=false) {
     return $success;
 }
 
-function common_broadcast_profile($profile) {
+function common_broadcast_profile($profile)
+{
     // XXX: optionally use a queue system like http://code.google.com/p/microapps/wiki/NQDQ
     require_once(INSTALLDIR.'/lib/omb.php');
     omb_broadcast_profile($profile);
@@ -1609,13 +1686,15 @@ function common_broadcast_profile($profile) {
     return true;
 }
 
-function common_profile_url($nickname) {
+function common_profile_url($nickname)
+{
     return common_local_url('showstream', array('nickname' => $nickname));
 }
 
 // Don't call if nobody's logged in
 
-function common_notice_form($action=null, $content=null) {
+function common_notice_form($action=null, $content=null)
+{
     $user = common_current_user();
     assert(!is_null($user));
     common_element_start('form', array('id' => 'status_form',
@@ -1647,14 +1726,16 @@ function common_notice_form($action=null, $content=null) {
 
 // Should make up a reasonable root URL
 
-function common_root_url() {
+function common_root_url()
+{
     return common_path('');
 }
 
 // returns $bytes bytes of random data as a hexadecimal string
 // "good" here is a goal and not a guarantee
 
-function common_good_rand($bytes) {
+function common_good_rand($bytes)
+{
     // XXX: use random.org...?
     if (file_exists('/dev/urandom')) {
         return common_urandom($bytes);
@@ -1663,7 +1744,8 @@ function common_good_rand($bytes) {
     }
 }
 
-function common_urandom($bytes) {
+function common_urandom($bytes)
+{
     $h = fopen('/dev/urandom', 'rb');
     // should not block
     $src = fread($h, $bytes);
@@ -1675,7 +1757,8 @@ function common_urandom($bytes) {
     return $enc;
 }
 
-function common_mtrand($bytes) {
+function common_mtrand($bytes)
+{
     $enc = '';
     for ($i = 0; $i < $bytes; $i++) {
         $enc .= sprintf("%02x", mt_rand(0, 255));
@@ -1683,21 +1766,25 @@ function common_mtrand($bytes) {
     return $enc;
 }
 
-function common_set_returnto($url) {
+function common_set_returnto($url)
+{
     common_ensure_session();
     $_SESSION['returnto'] = $url;
 }
 
-function common_get_returnto() {
+function common_get_returnto()
+{
     common_ensure_session();
     return $_SESSION['returnto'];
 }
 
-function common_timestamp() {
+function common_timestamp()
+{
     return date('YmdHis');
 }
 
-function common_ensure_syslog() {
+function common_ensure_syslog()
+{
     static $initialized = false;
     if (!$initialized) {
         global $config;
@@ -1706,7 +1793,8 @@ function common_ensure_syslog() {
     }
 }
 
-function common_log($priority, $msg, $filename=null) {
+function common_log($priority, $msg, $filename=null)
+{
     $logfile = common_config('site', 'logfile');
     if ($logfile) {
         $log = fopen($logfile, "a");
@@ -1723,7 +1811,8 @@ function common_log($priority, $msg, $filename=null) {
     }
 }
 
-function common_debug($msg, $filename=null) {
+function common_debug($msg, $filename=null)
+{
     if ($filename) {
         common_log(LOG_DEBUG, basename($filename).' - '.$msg);
     } else {
@@ -1731,13 +1820,15 @@ function common_debug($msg, $filename=null) {
     }
 }
 
-function common_log_db_error(&$object, $verb, $filename=null) {
+function common_log_db_error(&$object, $verb, $filename=null)
+{
     $objstr = common_log_objstring($object);
     $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
     common_log(LOG_ERR, $last_error->message . '(' . $verb . ' on ' . $objstr . ')', $filename);
 }
 
-function common_log_objstring(&$object) {
+function common_log_objstring(&$object)
+{
     if (is_null($object)) {
         return "null";
     }
@@ -1750,11 +1841,13 @@ function common_log_objstring(&$object) {
     return $objstring;
 }
 
-function common_valid_http_url($url) {
+function common_valid_http_url($url)
+{
     return Validate::uri($url, array('allowed_schemes' => array('http', 'https')));
 }
 
-function common_valid_tag($tag) {
+function common_valid_tag($tag)
+{
     if (preg_match('/^tag:(.*?),(\d{4}(-\d{2}(-\d{2})?)?):(.*)$/', $tag, $matches)) {
         return (Validate::email($matches[1]) ||
                 preg_match('/^([\w-\.]+)$/', $matches[1]));
@@ -1764,7 +1857,8 @@ function common_valid_tag($tag) {
 
 // Does a little before-after block for next/prev page
 
-function common_pagination($have_before, $have_after, $page, $action, $args=null) {
+function common_pagination($have_before, $have_after, $page, $action, $args=null)
+{
 
     if ($have_before || $have_after) {
         common_element_start('div', array('id' => 'pagination'));
@@ -1799,7 +1893,8 @@ function common_pagination($have_before, $have_after, $page, $action, $args=null
 /* Following functions are copied from MediaWiki GlobalFunctions.php
  * and written by Evan Prodromou. */
 
-function common_accept_to_prefs($accept, $def = '*/*') {
+function common_accept_to_prefs($accept, $def = '*/*')
+{
     // No arg means accept anything (per HTTP spec)
     if(!$accept) {
         return array($def => 1);
@@ -1823,7 +1918,8 @@ function common_accept_to_prefs($accept, $def = '*/*') {
     return $prefs;
 }
 
-function common_mime_type_match($type, $avail) {
+function common_mime_type_match($type, $avail)
+{
     if(array_key_exists($type, $avail)) {
         return $type;
     } else {
@@ -1838,7 +1934,8 @@ function common_mime_type_match($type, $avail) {
     }
 }
 
-function common_negotiate_type($cprefs, $sprefs) {
+function common_negotiate_type($cprefs, $sprefs)
+{
     $combine = array();
 
     foreach(array_keys($sprefs) as $type) {
@@ -1874,12 +1971,14 @@ function common_negotiate_type($cprefs, $sprefs) {
     return $besttype;
 }
 
-function common_config($main, $sub) {
+function common_config($main, $sub)
+{
     global $config;
     return isset($config[$main][$sub]) ? $config[$main][$sub] : false;
 }
 
-function common_copy_args($from) {
+function common_copy_args($from)
+{
     $to = array();
     $strip = get_magic_quotes_gpc();
     foreach ($from as $k => $v) {
@@ -1890,25 +1989,29 @@ function common_copy_args($from) {
 
 // Neutralise the evil effects of magic_quotes_gpc in the current request.
 // This is used before handing a request off to OAuthRequest::from_request.
-function common_remove_magic_from_request() {
+function common_remove_magic_from_request()
+{
     if(get_magic_quotes_gpc()) {
         $_POST=array_map('stripslashes',$_POST);
         $_GET=array_map('stripslashes',$_GET);
     }
 }
 
-function common_user_uri(&$user) {
+function common_user_uri(&$user)
+{
     return common_local_url('userbyid', array('id' => $user->id));
 }
 
-function common_notice_uri(&$notice) {
+function common_notice_uri(&$notice)
+{
     return common_local_url('shownotice',
                             array('notice' => $notice->id));
 }
 
 // 36 alphanums - lookalikes (0, O, 1, I) = 32 chars = 5 bits
 
-function common_confirmation_code($bits) {
+function common_confirmation_code($bits)
+{
     // 36 alphanums - lookalikes (0, O, 1, I) = 32 chars = 5 bits
     static $codechars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ';
     $chars = ceil($bits/5);
@@ -1925,14 +2028,16 @@ function common_confirmation_code($bits) {
 
 // convert markup to HTML
 
-function common_markup_to_html($c) {
+function common_markup_to_html($c)
+{
     $c = preg_replace('/%%action.(\w+)%%/e', "common_local_url('\\1')", $c);
     $c = preg_replace('/%%doc.(\w+)%%/e', "common_local_url('doc', array('title'=>'\\1'))", $c);
     $c = preg_replace('/%%(\w+).(\w+)%%/e', 'common_config(\'\\1\', \'\\2\')', $c);
     return Markdown($c);
 }
 
-function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE) {
+function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE)
+{
     $avatar = $profile->getAvatar($size);
     if ($avatar) {
         return common_avatar_display_url($avatar);
@@ -1941,7 +2046,8 @@ function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE) {
     }
 }
 
-function common_profile_uri($profile) {
+function common_profile_uri($profile)
+{
     if (!$profile) {
         return null;
     }
@@ -1958,13 +2064,15 @@ function common_profile_uri($profile) {
     return null;
 }
 
-function common_canonical_sms($sms) {
+function common_canonical_sms($sms)
+{
     // strip non-digits
     preg_replace('/\D/', '', $sms);
     return $sms;
 }
 
-function common_error_handler($errno, $errstr, $errfile, $errline, $errcontext) {
+function common_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
+{
     switch ($errno) {
      case E_USER_ERROR:
         common_log(LOG_ERR, "[$errno] $errstr ($errfile:$errline)");
@@ -1985,7 +2093,8 @@ function common_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
     return true;
 }
 
-function common_session_token() {
+function common_session_token()
+{
     common_ensure_session();
     if (!array_key_exists('token', $_SESSION)) {
         $_SESSION['token'] = common_good_rand(64);
@@ -1993,7 +2102,8 @@ function common_session_token() {
     return $_SESSION['token'];
 }
 
-function common_disfavor_form($notice) {
+function common_disfavor_form($notice)
+{
     common_element_start('form', array('id' => 'disfavor-' . $notice->id,
                                        'method' => 'post',
                                        'class' => 'disfavor',
@@ -2020,7 +2130,8 @@ function common_disfavor_form($notice) {
     common_element_end('form');
 }
 
-function common_favor_form($notice) {
+function common_favor_form($notice)
+{
     common_element_start('form', array('id' => 'favor-' . $notice->id,
                                        'method' => 'post',
                                        'class' => 'favor',
@@ -2047,7 +2158,8 @@ function common_favor_form($notice) {
     common_element_end('form');
 }
 
-function common_nudge_form($profile) {
+function common_nudge_form($profile)
+{
     common_element_start('form', array('id' => 'nudge', 'method' => 'post',
                                        'action' => common_local_url('nudge', array('nickname' => $profile->nickname))));
     common_hidden('token', common_session_token());
@@ -2056,11 +2168,13 @@ function common_nudge_form($profile) {
                                   'value' => _('Send a nudge')));
     common_element_end('form');
 }
-function common_nudge_response() {
+function common_nudge_response()
+{
     common_element('p', array('id' => 'nudge_response'), _('Nudge sent!'));
 }
 
-function common_subscribe_form($profile) {
+function common_subscribe_form($profile)
+{
     common_element_start('form', array('id' => 'subscribe-' . $profile->id,
                                        'method' => 'post',
                                        'class' => 'subscribe',
@@ -2076,7 +2190,8 @@ function common_subscribe_form($profile) {
     common_element_end('form');
 }
 
-function common_unsubscribe_form($profile) {
+function common_unsubscribe_form($profile)
+{
     common_element_start('form', array('id' => 'unsubscribe-' . $profile->id,
                                        'method' => 'post',
                                        'class' => 'unsubscribe',
@@ -2093,7 +2208,8 @@ function common_unsubscribe_form($profile) {
 }
 
 // XXX: Refactor this code
-function common_profile_new_message_nudge ($cur, $profile) {
+function common_profile_new_message_nudge ($cur, $profile)
+{
     $user = User::staticGet('id', $profile->id);
 
     if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) {
@@ -2110,17 +2226,20 @@ function common_profile_new_message_nudge ($cur, $profile) {
     }
 }
 
-function common_cache_key($extra) {
+function common_cache_key($extra)
+{
     return 'laconica:' . common_keyize(common_config('site', 'name')) . ':' . $extra;
 }
 
-function common_keyize($str) {
+function common_keyize($str)
+{
     $str = strtolower($str);
     $str = preg_replace('/\s/', '_', $str);
     return $str;
 }
 
-function common_message_form($content, $user, $to) {
+function common_message_form($content, $user, $to)
+{
 
     common_element_start('form', array('id' => 'message_form',
                                        'method' => 'post',
@@ -2160,7 +2279,8 @@ function common_message_form($content, $user, $to) {
     common_element_end('form');
 }
 
-function common_memcache() {
+function common_memcache()
+{
     static $cache = null;
     if (!common_config('memcached', 'enabled')) {
         return null;
@@ -2180,22 +2300,26 @@ function common_memcache() {
     }
 }
 
-function common_compatible_license($from, $to) {
+function common_compatible_license($from, $to)
+{
     // XXX: better compatibility check needed here!
     return ($from == $to);
 }
 
 /* These are almost identical, so we use a helper function */
 
-function common_block_form($profile, $args=null) {
+function common_block_form($profile, $args=null)
+{
     common_blocking_form('block', _('Block'), $profile, $args);
 }
 
-function common_unblock_form($profile, $args=null) {
+function common_unblock_form($profile, $args=null)
+{
     common_blocking_form('unblock', _('Unblock'), $profile, $args);
 }
 
-function common_blocking_form($type, $label, $profile, $args=null) {
+function common_blocking_form($type, $label, $profile, $args=null)
+{
     common_element_start('form', array('id' => $type . '-' . $profile->id,
                                        'method' => 'post',
                                        'class' => $type,
diff --git a/lib/xmppqueuehandler.php b/lib/xmppqueuehandler.php
index 10c754a5b..0a73403f9 100644
--- a/lib/xmppqueuehandler.php
+++ b/lib/xmppqueuehandler.php
@@ -30,7 +30,8 @@ require_once(INSTALLDIR.'/lib/queuehandler.php');
 
 class XmppQueueHandler extends QueueHandler {
     
-    function start() {
+    function start()
+    {
         # Low priority; we don't want to receive messages
         $this->log(LOG_INFO, "INITIALIZE");
         $this->conn = jabber_connect($this->_id);
@@ -43,12 +44,14 @@ class XmppQueueHandler extends QueueHandler {
         return !is_null($this->conn);
     }
     
-    function handle_reconnect(&$pl) {
+    function handle_reconnect(&$pl)
+    {
         $this->conn->processUntil('session_start');
         $this->conn->presence(null, 'available', null, 'available', -1);
     }
 
-    function idle($timeout=0) {
+    function idle($timeout=0)
+    {
         # Process the queue for as long as needed
         try {
             if ($this->conn) {
@@ -60,7 +63,8 @@ class XmppQueueHandler extends QueueHandler {
         }
     }
     
-    function forward_message(&$pl) {
+    function forward_message(&$pl)
+    {
         if ($pl['type'] != 'chat') {
             $this->log(LOG_DEBUG, 'Ignoring message of type ' . $pl['type'] . ' from ' . $pl['from']);
             return;
@@ -74,14 +78,16 @@ class XmppQueueHandler extends QueueHandler {
         $this->conn->message($this->listener(), $pl['body'], 'chat', null, $this->ofrom($pl['from']));
     }
 
-    function ofrom($from) {
+    function ofrom($from)
+    {
         $address = "<addresses xmlns='http://jabber.org/protocol/address'>\n";
         $address .= "<address type='ofrom' jid='$from' />\n";
         $address .= "</addresses>\n";
         return $address;
     }
 
-    function listener() {
+    function listener()
+    {
         if (common_config('xmpp', 'listener')) {
             return common_config('xmpp', 'listener');
         } else {
diff --git a/scripts/enjitqueuehandler.php b/scripts/enjitqueuehandler.php
index 1c033603f..55d73e08c 100755
--- a/scripts/enjitqueuehandler.php
+++ b/scripts/enjitqueuehandler.php
@@ -35,17 +35,20 @@ set_error_handler('common_error_handler');
 
 class EnjitQueueHandler extends QueueHandler {
     
-    function transport() {
+    function transport()
+    {
         return 'enjit';
     }
 
-    function start() {
+    function start()
+    {
                 $this->log(LOG_INFO, "Starting EnjitQueueHandler");
                 $this->log(LOG_INFO, "Broadcasting to ".common_config('enjit', 'apiurl'));
         return true;
     }
 
-    function handle_notice($notice) {
+    function handle_notice($notice)
+    {
 
         $profile = Profile::staticGet($notice->profile_id);
 
diff --git a/scripts/jabberqueuehandler.php b/scripts/jabberqueuehandler.php
index 271aab22b..ea26aaf79 100755
--- a/scripts/jabberqueuehandler.php
+++ b/scripts/jabberqueuehandler.php
@@ -37,11 +37,13 @@ class JabberQueueHandler extends XmppQueueHandler {
 
     var $conn = null;
 
-    function transport() {
+    function transport()
+    {
         return 'jabber';
     }
 
-    function handle_notice($notice) {
+    function handle_notice($notice)
+    {
         try {
             return jabber_broadcast_notice($notice);
         } catch (XMPPHP_Exception $e) {
diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php
index 886e72ba7..6100cd21b 100755
--- a/scripts/maildaemon.php
+++ b/scripts/maildaemon.php
@@ -36,10 +36,12 @@ require_once('Mail/mimeDecode.php');
 
 class MailerDaemon {
 
-    function __construct() {
+    function __construct()
+    {
     }
 
-    function handle_message($fname='php://stdin') {
+    function handle_message($fname='php://stdin')
+    {
         list($from, $to, $msg) = $this->parse_message($fname);
         if (!$from || !$to || !$msg) {
             $this->error(null, _('Could not parse message.'));
@@ -66,12 +68,14 @@ class MailerDaemon {
         $this->add_notice($user, $msg);
     }
 
-    function error($from, $msg) {
+    function error($from, $msg)
+    {
         file_put_contents("php://stderr", $msg . "\n");
         exit(1);
     }
 
-    function user_from($from_hdr) {
+    function user_from($from_hdr)
+    {
         $froms = mailparse_rfc822_parse_addresses($from_hdr);
         if (!$froms) {
             return null;
@@ -85,7 +89,8 @@ class MailerDaemon {
         return $user;
     }
 
-    function user_match_to($user, $to_hdr) {
+    function user_match_to($user, $to_hdr)
+    {
         $incoming = $user->incomingemail;
         $tos = mailparse_rfc822_parse_addresses($to_hdr);
         foreach ($tos as $to) {
@@ -96,7 +101,8 @@ class MailerDaemon {
         return false;
     }
 
-    function handle_command($user, $from, $msg) {
+    function handle_command($user, $from, $msg)
+    {
         $inter = new CommandInterpreter();
         $cmd = $inter->handle_command($user, $msg);
         if ($cmd) {
@@ -106,7 +112,8 @@ class MailerDaemon {
         return false;
     }
 
-    function respond($from, $to, $response) {
+    function respond($from, $to, $response)
+    {
 
         $headers['From'] = $to;
         $headers['To'] = $from;
@@ -115,11 +122,13 @@ class MailerDaemon {
         return mail_send(array($from), $headers, $response);
     }
 
-    function log($level, $msg) {
+    function log($level, $msg)
+    {
         common_log($level, 'MailDaemon: '.$msg);
     }
 
-    function add_notice($user, $msg) {
+    function add_notice($user, $msg)
+    {
         // should test
         // $msg_shortened = common_shorten_links($msg);
         // if (mb_strlen($msg_shortened) > 140) ERROR and STOP
@@ -133,7 +142,8 @@ class MailerDaemon {
                    'Added notice ' . $notice->id . ' from user ' . $user->nickname);
     }
 
-    function parse_message($fname) {
+    function parse_message($fname)
+    {
         $contents = file_get_contents($fname);
         $parsed = Mail_mimeDecode::decode(array('input' => $contents,
                                                 'include_bodies' => true,
@@ -166,11 +176,13 @@ class MailerDaemon {
         return array($from, $to, $msg);
     }
 
-    function unsupported_type($type) {
+    function unsupported_type($type)
+    {
         $this->error(null, "Unsupported message type: " . $type);
     }
 
-    function cleanup_msg($msg) {
+    function cleanup_msg($msg)
+    {
         $lines = explode("\n", $msg);
 
         $output = '';
diff --git a/scripts/ombqueuehandler.php b/scripts/ombqueuehandler.php
index 43c0980b6..299381ace 100755
--- a/scripts/ombqueuehandler.php
+++ b/scripts/ombqueuehandler.php
@@ -35,16 +35,19 @@ set_error_handler('common_error_handler');
 
 class OmbQueueHandler extends QueueHandler {
     
-    function transport() {
+    function transport()
+    {
         return 'omb';
     }
     
-    function start() {
+    function start()
+    {
         $this->log(LOG_INFO, "INITIALIZE");
         return true;
     }
 
-    function handle_notice($notice) {
+    function handle_notice($notice)
+    {
         if ($this->is_remote($notice)) {
             $this->log(LOG_DEBUG, 'Ignoring remote notice ' . $notice->id);
             return true;
@@ -53,10 +56,12 @@ class OmbQueueHandler extends QueueHandler {
         }
     }
     
-    function finish() {
+    function finish()
+    {
     }
 
-    function is_remote($notice) {
+    function is_remote($notice)
+    {
         $user = User::staticGet($notice->profile_id);
         return is_null($user);
     }
diff --git a/scripts/publicqueuehandler.php b/scripts/publicqueuehandler.php
index 2168aade2..b3542e5c5 100755
--- a/scripts/publicqueuehandler.php
+++ b/scripts/publicqueuehandler.php
@@ -35,11 +35,13 @@ set_error_handler('common_error_handler');
 
 class PublicQueueHandler extends XmppQueueHandler {
     
-    function transport() {
+    function transport()
+    {
         return 'public';
     }
     
-    function handle_notice($notice) {
+    function handle_notice($notice)
+    {
         try {
             return jabber_public_notice($notice);
         } catch (XMPPHP_Exception $e) {
diff --git a/scripts/sitemap.php b/scripts/sitemap.php
index b49bfe2a5..504783e88 100644
--- a/scripts/sitemap.php
+++ b/scripts/sitemap.php
@@ -18,7 +18,8 @@ index_map();
 # ------------------------------------------------------------------------------
 
 # Generate index sitemap of all other sitemaps.
-function index_map() {
+function index_map()
+{
     global $output_paths;
     $output_dir = $output_paths['output_dir'];
     $output_url = $output_paths['output_url'];
@@ -40,7 +41,8 @@ function index_map() {
 }
 
 # Generate sitemap of standard site elements.
-function standard_map() {
+function standard_map()
+{
     global $output_paths;
 
     $standard_map_urls .= url(
@@ -77,7 +79,8 @@ function standard_map() {
 }
 
 # Generate sitemaps of all notices.
-function notices_map() {
+function notices_map()
+{
     global $output_paths;
 
     $notices = DB_DataObject::factory('notice');
@@ -115,7 +118,8 @@ function notices_map() {
 }
 
 # Generate sitemaps of all users.
-function user_map() {
+function user_map()
+{
     global $output_paths;
 
     $users = DB_DataObject::factory('user');
@@ -208,7 +212,8 @@ function user_map() {
 # ------------------------------------------------------------------------------
 
 # Generate a <url></url> element.
-function url($url_args) {
+function url($url_args)
+{
     $url        = preg_replace('/&/', '&amp;', $url_args['url']); # escape ampersands for XML
     $lastmod    = $url_args['lastmod'];
     $changefreq = $url_args['changefreq'];
@@ -238,7 +243,8 @@ function url($url_args) {
     return $url_out;
 }
 
-function sitemap($sitemap_args) {
+function sitemap($sitemap_args)
+{
     $url        = preg_replace('/&/', '&amp;', $sitemap_args['url']); # escape ampersands for XML
     $lastmod    = $sitemap_args['lastmod'];
 
@@ -259,7 +265,8 @@ function sitemap($sitemap_args) {
 }
 
 # Generate a <urlset></urlset> element.
-function urlset($urlset_text) {
+function urlset($urlset_text)
+{
     $urlset = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
       '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" .
       $urlset_text .
@@ -269,7 +276,8 @@ function urlset($urlset_text) {
 }
 
 # Generate a <urlset></urlset> element.
-function sitemapindex($sitemapindex_text) {
+function sitemapindex($sitemapindex_text)
+{
     $sitemapindex = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
       '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" .
       $sitemapindex_text .
@@ -279,7 +287,8 @@ function sitemapindex($sitemapindex_text) {
 }
 
 # Generate a sitemap from an array containing <url></url> elements and write it to a file.
-function array_to_map($url_list, $filename_prefix) {
+function array_to_map($url_list, $filename_prefix)
+{
     global $output_paths;
 
     if ($url_list) {
@@ -297,7 +306,8 @@ function array_to_map($url_list, $filename_prefix) {
 # ------------------------------------------------------------------------------
 
 # Parse command line arguments.
-function parse_args() {
+function parse_args()
+{
     $args = getopt('f:d:u:');
 
     if (is_null($args[f]) && is_null($args[d]) && is_null($args[u])) {
@@ -338,7 +348,8 @@ function parse_args() {
 }
 
 # Ensure paths end with a "/".
-function trailing_slash($path) {
+function trailing_slash($path)
+{
     if (preg_match('/\/$/', $path) == 0) {
         $path .= '/';
     }
@@ -347,7 +358,8 @@ function trailing_slash($path) {
 }
 
 # Write data to disk.
-function write_file($path, $data) {
+function write_file($path, $data)
+{
     if (is_null($path)) {
         error('No path specified for writing to.');
     }     elseif (is_null($data)) {
@@ -364,7 +376,8 @@ function write_file($path, $data) {
 }
 
 # Display an error message and exit.
-function error ($error_msg) {
+function error ($error_msg)
+{
     if (is_null($error_msg)) {
         $error_msg = 'error() was called without any explanation!';
     }
diff --git a/scripts/smsqueuehandler.php b/scripts/smsqueuehandler.php
index f8b2e9d53..c962ad095 100755
--- a/scripts/smsqueuehandler.php
+++ b/scripts/smsqueuehandler.php
@@ -35,20 +35,24 @@ set_error_handler('common_error_handler');
 
 class SmsQueueHandler extends QueueHandler {
     
-    function transport() {
+    function transport()
+    {
         return 'sms';
     }
 
-    function start() {
+    function start()
+    {
         $this->log(LOG_INFO, "INITIALIZE");
         return true;
     }
 
-    function handle_notice($notice) {
+    function handle_notice($notice)
+    {
         return mail_broadcast_notice_sms($notice);
     }
     
-    function finish() {
+    function finish()
+    {
     }
 }
 
diff --git a/scripts/xmppconfirmhandler.php b/scripts/xmppconfirmhandler.php
index 9e177b3fa..b059149bc 100755
--- a/scripts/xmppconfirmhandler.php
+++ b/scripts/xmppconfirmhandler.php
@@ -39,11 +39,13 @@ class XmppConfirmHandler extends XmppQueueHandler {
 
     var $_id = 'confirm';
     
-    function class_name() {
+    function class_name()
+    {
         return 'XmppConfirmHandler';
     }
     
-    function run() {
+    function run()
+    {
         if (!$this->start()) {
             return false;
         }
@@ -99,7 +101,8 @@ class XmppConfirmHandler extends XmppQueueHandler {
         return true;
     }
 
-    function next_confirm() {
+    function next_confirm()
+    {
         $confirm = new Confirm_address();
         $confirm->whereAdd('claimed IS null');
         $confirm->whereAdd('sent IS null');
@@ -125,7 +128,8 @@ class XmppConfirmHandler extends XmppQueueHandler {
         return null;
     }
 
-    function clear_old_confirm_claims() {
+    function clear_old_confirm_claims()
+    {
         $confirm = new Confirm();
         $confirm->claimed = null;
         $confirm->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
diff --git a/scripts/xmppdaemon.php b/scripts/xmppdaemon.php
index ead842928..28ac64725 100755
--- a/scripts/xmppdaemon.php
+++ b/scripts/xmppdaemon.php
@@ -39,7 +39,8 @@ set_error_handler('common_error_handler');
 
 class XMPPDaemon extends Daemon {
 
-    function XMPPDaemon($resource=null) {
+    function XMPPDaemon($resource=null)
+    {
         static $attrs = array('server', 'port', 'user', 'password', 'host');
 
         foreach ($attrs as $attr)
@@ -56,7 +57,8 @@ class XMPPDaemon extends Daemon {
         $this->log(LOG_INFO, "INITIALIZE XMPPDaemon {$this->user}@{$this->server}/{$this->resource}");
     }
 
-    function connect() {
+    function connect()
+    {
 
         $connect_to = ($this->host) ? $this->host : $this->server;
 
@@ -75,11 +77,13 @@ class XMPPDaemon extends Daemon {
         return !$this->conn->isDisconnected();
     }
 
-    function name() {
+    function name()
+    {
         return strtolower('xmppdaemon.'.$this->resource);
     }
 
-    function run() {
+    function run()
+    {
         if ($this->connect()) {
 
             $this->conn->addEventHandler('message', 'handle_message', $this);
@@ -90,17 +94,20 @@ class XMPPDaemon extends Daemon {
         }
     }
 
-    function handle_reconnect(&$pl) {
+    function handle_reconnect(&$pl)
+    {
         $this->conn->processUntil('session_start');
         $this->conn->presence('Send me a message to post a notice', 'available', null, 'available', 100);
     }
 
-    function get_user($from) {
+    function get_user($from)
+    {
         $user = User::staticGet('jabber', jabber_normalize_jid($from));
         return $user;
     }
 
-    function handle_message(&$pl) {
+    function handle_message(&$pl)
+    {
         if ($pl['type'] != 'chat') {
             return;
         }
@@ -156,11 +163,13 @@ class XMPPDaemon extends Daemon {
         unset($user);
     }
 
-    function is_self($from) {
+    function is_self($from)
+    {
         return preg_match('/^'.strtolower(jabber_daemon_address()).'/', strtolower($from));
     }
 
-    function get_ofrom($pl) {
+    function get_ofrom($pl)
+    {
         $xml = $pl['xml'];
         $addresses = $xml->sub('addresses');
         if (!$addresses) {
@@ -194,7 +203,8 @@ class XMPPDaemon extends Daemon {
         return $jid;
     }
 
-    function is_autoreply($txt) {
+    function is_autoreply($txt)
+    {
         if (preg_match('/[\[\(]?[Aa]uto[-\s]?[Rr]e(ply|sponse)[\]\)]/', $txt)) {
             return true;
         } else {
@@ -202,7 +212,8 @@ class XMPPDaemon extends Daemon {
         }
     }
 
-    function is_otr($txt) {
+    function is_otr($txt)
+    {
         if (preg_match('/^\?OTR/', $txt)) {
             return true;
         } else {
@@ -210,7 +221,8 @@ class XMPPDaemon extends Daemon {
         }
     }
 
-    function is_direct($txt) {
+    function is_direct($txt)
+    {
         if (strtolower(substr($txt, 0, 2))=='d ') {
             return true;
         } else {
@@ -218,12 +230,14 @@ class XMPPDaemon extends Daemon {
         }
     }
 
-    function from_site($address, $msg) {
+    function from_site($address, $msg)
+    {
         $text = '['.common_config('site', 'name') . '] ' . $msg;
         jabber_send_message($address, $text);
     }
 
-    function handle_command($user, $body) {
+    function handle_command($user, $body)
+    {
         $inter = new CommandInterpreter();
         $cmd = $inter->handle_command($user, $body);
         if ($cmd) {
@@ -235,7 +249,8 @@ class XMPPDaemon extends Daemon {
         }
     }
 
-    function add_notice(&$user, &$pl) {
+    function add_notice(&$user, &$pl)
+    {
         $body = trim($pl['body']);
         $content_shortened = common_shorten_link($body);
         if (mb_strlen($content_shortened) > 140) {
@@ -257,7 +272,8 @@ class XMPPDaemon extends Daemon {
         unset($notice);
     }
 
-    function handle_presence(&$pl) {
+    function handle_presence(&$pl)
+    {
         $from = jabber_normalize_jid($pl['from']);
         switch ($pl['type']) {
          case 'subscribe':
@@ -291,11 +307,13 @@ class XMPPDaemon extends Daemon {
         }
     }
 
-    function log($level, $msg) {
+    function log($level, $msg)
+    {
         common_log($level, 'XMPPDaemon('.$this->resource.'): '.$msg);
     }
 
-    function subscribed($to) {
+    function subscribed($to)
+    {
         jabber_special_presence('subscribed', $to);
     }
 }
-- 
cgit v1.2.3-54-g00ecf


From b264c03d32d04d7a33d28a5830848660f4484943 Mon Sep 17 00:00:00 2001
From: Evan Prodromou <evan@prodromou.name>
Date: Tue, 23 Dec 2008 14:49:23 -0500
Subject: move opening brace of class declaration to next line

Another gigantor PEAR coding standards patch. Here, I've moved the
opening curly bracket on a class statement to the following line.

darcs-hash:20081223194923-84dde-77a93de314caadbcb5b70bf346a4648be77a864e.gz
---
 _darcs/inventory                                   |   7 +
 ...dde-77a93de314caadbcb5b70bf346a4648be77a864e.gz | Bin 0 -> 2725 bytes
 _darcs/pristine/actions/accesstoken.php            |   3 +-
 _darcs/pristine/actions/all.php                    |   3 +-
 _darcs/pristine/actions/allrss.php                 |   3 +-
 _darcs/pristine/actions/api.php                    |   3 +-
 _darcs/pristine/actions/avatarbynickname.php       |   3 +-
 _darcs/pristine/actions/block.php                  |   3 +-
 _darcs/pristine/actions/confirmaddress.php         |   3 +-
 _darcs/pristine/actions/deletenotice.php           |   3 +-
 _darcs/pristine/actions/deleteprofile.php          |   3 +-
 _darcs/pristine/actions/disfavor.php               |   3 +-
 _darcs/pristine/actions/doc.php                    |   3 +-
 _darcs/pristine/actions/emailsettings.php          |   3 +-
 _darcs/pristine/actions/facebookhome.php           |   3 +-
 _darcs/pristine/actions/facebookinvite.php         |   3 +-
 _darcs/pristine/actions/facebookremove.php         |   3 +-
 _darcs/pristine/actions/facebooksettings.php       |   3 +-
 _darcs/pristine/actions/favor.php                  |   3 +-
 _darcs/pristine/actions/favorited.php              |   3 +-
 _darcs/pristine/actions/favoritesrss.php           |   3 +-
 _darcs/pristine/actions/featured.php               |   3 +-
 _darcs/pristine/actions/finishaddopenid.php        |   3 +-
 _darcs/pristine/actions/finishimmediate.php        |   3 +-
 _darcs/pristine/actions/finishopenidlogin.php      |   3 +-
 _darcs/pristine/actions/finishremotesubscribe.php  |   3 +-
 _darcs/pristine/actions/foaf.php                   |   3 +-
 _darcs/pristine/actions/imsettings.php             |   3 +-
 _darcs/pristine/actions/invite.php                 |   3 +-
 _darcs/pristine/actions/login.php                  |   3 +-
 _darcs/pristine/actions/logout.php                 |   3 +-
 _darcs/pristine/actions/microsummary.php           |   3 +-
 _darcs/pristine/actions/newmessage.php             |   3 +-
 _darcs/pristine/actions/newnotice.php              |   3 +-
 _darcs/pristine/actions/noticesearch.php           |   3 +-
 _darcs/pristine/actions/noticesearchrss.php        |   3 +-
 _darcs/pristine/actions/nudge.php                  |   3 +-
 _darcs/pristine/actions/openidlogin.php            |   3 +-
 _darcs/pristine/actions/openidsettings.php         |   3 +-
 _darcs/pristine/actions/opensearch.php             |   3 +-
 _darcs/pristine/actions/othersettings.php          |   3 +-
 _darcs/pristine/actions/peoplesearch.php           |   6 +-
 _darcs/pristine/actions/peopletag.php              |   3 +-
 _darcs/pristine/actions/postnotice.php             |   3 +-
 _darcs/pristine/actions/profilesettings.php        |   3 +-
 _darcs/pristine/actions/public.php                 |   3 +-
 _darcs/pristine/actions/publicrss.php              |   3 +-
 _darcs/pristine/actions/publicxrds.php             |   3 +-
 _darcs/pristine/actions/recoverpassword.php        |   3 +-
 _darcs/pristine/actions/register.php               |   3 +-
 _darcs/pristine/actions/remotesubscribe.php        |   3 +-
 _darcs/pristine/actions/replies.php                |   3 +-
 _darcs/pristine/actions/repliesrss.php             |   3 +-
 _darcs/pristine/actions/requesttoken.php           |   3 +-
 _darcs/pristine/actions/showfavorites.php          |   3 +-
 _darcs/pristine/actions/showmessage.php            |   3 +-
 _darcs/pristine/actions/shownotice.php             |   3 +-
 _darcs/pristine/actions/showstream.php             |   9 +-
 _darcs/pristine/actions/smssettings.php            |   3 +-
 _darcs/pristine/actions/subedit.php                |   3 +-
 _darcs/pristine/actions/subscribe.php              |   3 +-
 _darcs/pristine/actions/subscribers.php            |   6 +-
 _darcs/pristine/actions/subscriptions.php          |   6 +-
 _darcs/pristine/actions/sup.php                    |   3 +-
 _darcs/pristine/actions/tag.php                    |   3 +-
 _darcs/pristine/actions/tagother.php               |   3 +-
 _darcs/pristine/actions/tagrss.php                 |   3 +-
 _darcs/pristine/actions/twitapiaccount.php         |   3 +-
 _darcs/pristine/actions/twitapiblocks.php          |   3 +-
 _darcs/pristine/actions/twitapidirect_messages.php |   3 +-
 _darcs/pristine/actions/twitapifavorites.php       |   3 +-
 _darcs/pristine/actions/twitapifriendships.php     |   3 +-
 _darcs/pristine/actions/twitapihelp.php            |   3 +-
 _darcs/pristine/actions/twitapinotifications.php   |   3 +-
 _darcs/pristine/actions/twitapistatuses.php        |   3 +-
 _darcs/pristine/actions/twitapiusers.php           |   3 +-
 _darcs/pristine/actions/twittersettings.php        |   3 +-
 _darcs/pristine/actions/unblock.php                |   3 +-
 _darcs/pristine/actions/unsubscribe.php            |   3 +-
 _darcs/pristine/actions/updateprofile.php          |   3 +-
 _darcs/pristine/actions/userauthorization.php      |   3 +-
 _darcs/pristine/actions/userbyid.php               |   3 +-
 _darcs/pristine/actions/userrss.php                |   3 +-
 _darcs/pristine/actions/xrds.php                   |   3 +-
 _darcs/pristine/classes/Channel.php                |  15 +-
 _darcs/pristine/classes/Command.php                |  54 +-
 _darcs/pristine/classes/CommandInterpreter.php     |   3 +-
 _darcs/pristine/classes/NoticeWrapper.php          |   3 +-
 _darcs/pristine/lib/Shorturl_api.php               |  12 +-
 _darcs/pristine/lib/deleteaction.php               |   3 +-
 _darcs/pristine/lib/facebookaction.php             |   3 +-
 _darcs/pristine/lib/oauthstore.php                 |  27 +-
 _darcs/pristine/lib/personal.php                   |   3 +-
 _darcs/pristine/lib/profilelist.php                |   3 +-
 _darcs/pristine/lib/queuehandler.php               |   3 +-
 _darcs/pristine/lib/rssaction.php                  |   3 +-
 _darcs/pristine/lib/search_engines.php             |  12 +-
 _darcs/pristine/lib/searchaction.php               |   3 +-
 _darcs/pristine/lib/settingsaction.php             |   3 +-
 _darcs/pristine/lib/stream.php                     |   3 +-
 _darcs/pristine/lib/twitterapi.php                 |   3 +-
 _darcs/pristine/lib/xmppqueuehandler.php           |   3 +-
 _darcs/pristine/scripts/enjitqueuehandler.php      |   3 +-
 _darcs/pristine/scripts/jabberqueuehandler.php     |   3 +-
 _darcs/pristine/scripts/maildaemon.php             |   3 +-
 _darcs/pristine/scripts/ombqueuehandler.php        |   3 +-
 _darcs/pristine/scripts/publicqueuehandler.php     |   3 +-
 _darcs/pristine/scripts/smsqueuehandler.php        |   3 +-
 _darcs/pristine/scripts/xmppconfirmhandler.php     |   3 +-
 _darcs/pristine/scripts/xmppdaemon.php             |   3 +-
 _darcs/tentative_pristine                          | 816 +++++++++++++++------
 actions/accesstoken.php                            |   3 +-
 actions/all.php                                    |   3 +-
 actions/allrss.php                                 |   3 +-
 actions/api.php                                    |   3 +-
 actions/avatarbynickname.php                       |   3 +-
 actions/block.php                                  |   3 +-
 actions/confirmaddress.php                         |   3 +-
 actions/deletenotice.php                           |   3 +-
 actions/deleteprofile.php                          |   3 +-
 actions/disfavor.php                               |   3 +-
 actions/doc.php                                    |   3 +-
 actions/emailsettings.php                          |   3 +-
 actions/facebookhome.php                           |   3 +-
 actions/facebookinvite.php                         |   3 +-
 actions/facebookremove.php                         |   3 +-
 actions/facebooksettings.php                       |   3 +-
 actions/favor.php                                  |   3 +-
 actions/favorited.php                              |   3 +-
 actions/favoritesrss.php                           |   3 +-
 actions/featured.php                               |   3 +-
 actions/finishaddopenid.php                        |   3 +-
 actions/finishimmediate.php                        |   3 +-
 actions/finishopenidlogin.php                      |   3 +-
 actions/finishremotesubscribe.php                  |   3 +-
 actions/foaf.php                                   |   3 +-
 actions/imsettings.php                             |   3 +-
 actions/invite.php                                 |   3 +-
 actions/login.php                                  |   3 +-
 actions/logout.php                                 |   3 +-
 actions/microsummary.php                           |   3 +-
 actions/newmessage.php                             |   3 +-
 actions/newnotice.php                              |   3 +-
 actions/noticesearch.php                           |   3 +-
 actions/noticesearchrss.php                        |   3 +-
 actions/nudge.php                                  |   3 +-
 actions/openidlogin.php                            |   3 +-
 actions/openidsettings.php                         |   3 +-
 actions/opensearch.php                             |   3 +-
 actions/othersettings.php                          |   3 +-
 actions/peoplesearch.php                           |   6 +-
 actions/peopletag.php                              |   3 +-
 actions/postnotice.php                             |   3 +-
 actions/profilesettings.php                        |   3 +-
 actions/public.php                                 |   3 +-
 actions/publicrss.php                              |   3 +-
 actions/publicxrds.php                             |   3 +-
 actions/recoverpassword.php                        |   3 +-
 actions/register.php                               |   3 +-
 actions/remotesubscribe.php                        |   3 +-
 actions/replies.php                                |   3 +-
 actions/repliesrss.php                             |   3 +-
 actions/requesttoken.php                           |   3 +-
 actions/showfavorites.php                          |   3 +-
 actions/showmessage.php                            |   3 +-
 actions/shownotice.php                             |   3 +-
 actions/showstream.php                             |   9 +-
 actions/smssettings.php                            |   3 +-
 actions/subedit.php                                |   3 +-
 actions/subscribe.php                              |   3 +-
 actions/subscribers.php                            |   6 +-
 actions/subscriptions.php                          |   6 +-
 actions/sup.php                                    |   3 +-
 actions/tag.php                                    |   3 +-
 actions/tagother.php                               |   3 +-
 actions/tagrss.php                                 |   3 +-
 actions/twitapiaccount.php                         |   3 +-
 actions/twitapiblocks.php                          |   3 +-
 actions/twitapidirect_messages.php                 |   3 +-
 actions/twitapifavorites.php                       |   3 +-
 actions/twitapifriendships.php                     |   3 +-
 actions/twitapihelp.php                            |   3 +-
 actions/twitapinotifications.php                   |   3 +-
 actions/twitapistatuses.php                        |   3 +-
 actions/twitapiusers.php                           |   3 +-
 actions/twittersettings.php                        |   3 +-
 actions/unblock.php                                |   3 +-
 actions/unsubscribe.php                            |   3 +-
 actions/updateprofile.php                          |   3 +-
 actions/userauthorization.php                      |   3 +-
 actions/userbyid.php                               |   3 +-
 actions/userrss.php                                |   3 +-
 actions/xrds.php                                   |   3 +-
 classes/Channel.php                                |  15 +-
 classes/Command.php                                |  54 +-
 classes/CommandInterpreter.php                     |   3 +-
 classes/NoticeWrapper.php                          |   3 +-
 lib/Shorturl_api.php                               |  12 +-
 lib/deleteaction.php                               |   3 +-
 lib/facebookaction.php                             |   3 +-
 lib/oauthstore.php                                 |  27 +-
 lib/personal.php                                   |   3 +-
 lib/profilelist.php                                |   3 +-
 lib/queuehandler.php                               |   3 +-
 lib/rssaction.php                                  |   3 +-
 lib/search_engines.php                             |  12 +-
 lib/searchaction.php                               |   3 +-
 lib/settingsaction.php                             |   3 +-
 lib/stream.php                                     |   3 +-
 lib/twitterapi.php                                 |   3 +-
 lib/xmppqueuehandler.php                           |   3 +-
 scripts/enjitqueuehandler.php                      |   3 +-
 scripts/jabberqueuehandler.php                     |   3 +-
 scripts/maildaemon.php                             |   3 +-
 scripts/ombqueuehandler.php                        |   3 +-
 scripts/publicqueuehandler.php                     |   3 +-
 scripts/smsqueuehandler.php                        |   3 +-
 scripts/xmppconfirmhandler.php                     |   3 +-
 scripts/xmppdaemon.php                             |   3 +-
 219 files changed, 1183 insertions(+), 528 deletions(-)
 create mode 100644 _darcs/patches/20081223194923-84dde-77a93de314caadbcb5b70bf346a4648be77a864e.gz

(limited to 'actions/twitapihelp.php')

diff --git a/_darcs/inventory b/_darcs/inventory
index 0c5a7d9b5..347e0fb3f 100644
--- a/_darcs/inventory
+++ b/_darcs/inventory
@@ -85,4 +85,11 @@ Evan Prodromou <evan@prodromou.name>**20081223194428
  More PEAR coding standards global changes. Here, I've changed all
  instances of TRUE to true and FALSE to false.
  
+] 
+[move opening brace of class declaration to next line
+Evan Prodromou <evan@prodromou.name>**20081223194923
+ 
+ Another gigantor PEAR coding standards patch. Here, I've moved the
+ opening curly bracket on a class statement to the following line.
+ 
 ] 
\ No newline at end of file
diff --git a/_darcs/patches/20081223194923-84dde-77a93de314caadbcb5b70bf346a4648be77a864e.gz b/_darcs/patches/20081223194923-84dde-77a93de314caadbcb5b70bf346a4648be77a864e.gz
new file mode 100644
index 000000000..667508279
Binary files /dev/null and b/_darcs/patches/20081223194923-84dde-77a93de314caadbcb5b70bf346a4648be77a864e.gz differ
diff --git a/_darcs/pristine/actions/accesstoken.php b/_darcs/pristine/actions/accesstoken.php
index cab5425bf..072ce27eb 100644
--- a/_darcs/pristine/actions/accesstoken.php
+++ b/_darcs/pristine/actions/accesstoken.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class AccesstokenAction extends Action {
+class AccesstokenAction extends Action
+{
     function handle($args)
     {
         parent::handle($args);
diff --git a/_darcs/pristine/actions/all.php b/_darcs/pristine/actions/all.php
index 028a3679a..526ac5f40 100644
--- a/_darcs/pristine/actions/all.php
+++ b/_darcs/pristine/actions/all.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/actions/showstream.php');
 
-class AllAction extends StreamAction {
+class AllAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/allrss.php b/_darcs/pristine/actions/allrss.php
index 9c20cd416..660afb9e2 100644
--- a/_darcs/pristine/actions/allrss.php
+++ b/_darcs/pristine/actions/allrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class AllrssAction extends Rss10Action {
+class AllrssAction extends Rss10Action
+{
 
     var $user = null;
 
diff --git a/_darcs/pristine/actions/api.php b/_darcs/pristine/actions/api.php
index 8ccd86f0b..dfdefe3b0 100644
--- a/_darcs/pristine/actions/api.php
+++ b/_darcs/pristine/actions/api.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class ApiAction extends Action {
+class ApiAction extends Action
+{
 
     var $user;
     var $content_type;
diff --git a/_darcs/pristine/actions/avatarbynickname.php b/_darcs/pristine/actions/avatarbynickname.php
index 4aeb4112a..666f386f6 100644
--- a/_darcs/pristine/actions/avatarbynickname.php
+++ b/_darcs/pristine/actions/avatarbynickname.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class AvatarbynicknameAction extends Action {
+class AvatarbynicknameAction extends Action
+{
     function handle($args)
     {
         parent::handle($args);
diff --git a/_darcs/pristine/actions/block.php b/_darcs/pristine/actions/block.php
index 702adcffa..c1ff7c044 100644
--- a/_darcs/pristine/actions/block.php
+++ b/_darcs/pristine/actions/block.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class BlockAction extends Action {
+class BlockAction extends Action
+{
 
     var $profile = null;
 
diff --git a/_darcs/pristine/actions/confirmaddress.php b/_darcs/pristine/actions/confirmaddress.php
index d926864a6..1d5c53ff2 100644
--- a/_darcs/pristine/actions/confirmaddress.php
+++ b/_darcs/pristine/actions/confirmaddress.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class ConfirmaddressAction extends Action {
+class ConfirmaddressAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/deletenotice.php b/_darcs/pristine/actions/deletenotice.php
index 4f00db617..e9b4b3254 100644
--- a/_darcs/pristine/actions/deletenotice.php
+++ b/_darcs/pristine/actions/deletenotice.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/deleteaction.php');
 
-class DeletenoticeAction extends DeleteAction {
+class DeletenoticeAction extends DeleteAction
+{
     function handle($args)
     {
         parent::handle($args);
diff --git a/_darcs/pristine/actions/deleteprofile.php b/_darcs/pristine/actions/deleteprofile.php
index b1c346cb2..e12fe131a 100644
--- a/_darcs/pristine/actions/deleteprofile.php
+++ b/_darcs/pristine/actions/deleteprofile.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class DeleteprofileAction extends Action {
+class DeleteprofileAction extends Action
+{
     function handle($args)
     {
         parent::handle($args);
diff --git a/_darcs/pristine/actions/disfavor.php b/_darcs/pristine/actions/disfavor.php
index f0b528453..74aae86cc 100644
--- a/_darcs/pristine/actions/disfavor.php
+++ b/_darcs/pristine/actions/disfavor.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class DisfavorAction extends Action {
+class DisfavorAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/doc.php b/_darcs/pristine/actions/doc.php
index 441ac19a7..856025e66 100644
--- a/_darcs/pristine/actions/doc.php
+++ b/_darcs/pristine/actions/doc.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class DocAction extends Action {
+class DocAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/emailsettings.php b/_darcs/pristine/actions/emailsettings.php
index 7f08efd29..3fa8ce296 100644
--- a/_darcs/pristine/actions/emailsettings.php
+++ b/_darcs/pristine/actions/emailsettings.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 
-class EmailsettingsAction extends SettingsAction {
+class EmailsettingsAction extends SettingsAction
+{
 
     function get_instructions()
     {
diff --git a/_darcs/pristine/actions/facebookhome.php b/_darcs/pristine/actions/facebookhome.php
index 006f35eca..dcdb102e6 100644
--- a/_darcs/pristine/actions/facebookhome.php
+++ b/_darcs/pristine/actions/facebookhome.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/facebookaction.php');
 
-class FacebookhomeAction extends FacebookAction {
+class FacebookhomeAction extends FacebookAction
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/facebookinvite.php b/_darcs/pristine/actions/facebookinvite.php
index fc226e65a..48a820e44 100644
--- a/_darcs/pristine/actions/facebookinvite.php
+++ b/_darcs/pristine/actions/facebookinvite.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/facebookaction.php');
 
-class FacebookinviteAction extends FacebookAction {
+class FacebookinviteAction extends FacebookAction
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/facebookremove.php b/_darcs/pristine/actions/facebookremove.php
index 79dc32e49..a200fefbf 100644
--- a/_darcs/pristine/actions/facebookremove.php
+++ b/_darcs/pristine/actions/facebookremove.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/facebookaction.php');
 
-class FacebookremoveAction extends FacebookAction {
+class FacebookremoveAction extends FacebookAction
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/facebooksettings.php b/_darcs/pristine/actions/facebooksettings.php
index 03ad57813..38542d4b6 100644
--- a/_darcs/pristine/actions/facebooksettings.php
+++ b/_darcs/pristine/actions/facebooksettings.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/facebookaction.php');
 
-class FacebooksettingsAction extends FacebookAction {
+class FacebooksettingsAction extends FacebookAction
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/favor.php b/_darcs/pristine/actions/favor.php
index 3ec4af0b5..8103f8181 100644
--- a/_darcs/pristine/actions/favor.php
+++ b/_darcs/pristine/actions/favor.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/mail.php');
 
-class FavorAction extends Action {
+class FavorAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/favorited.php b/_darcs/pristine/actions/favorited.php
index d479e1b3e..71a9e026e 100644
--- a/_darcs/pristine/actions/favorited.php
+++ b/_darcs/pristine/actions/favorited.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/stream.php');
 
-class FavoritedAction extends StreamAction {
+class FavoritedAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/favoritesrss.php b/_darcs/pristine/actions/favoritesrss.php
index aa8a3c6f4..8c7ce52bf 100644
--- a/_darcs/pristine/actions/favoritesrss.php
+++ b/_darcs/pristine/actions/favoritesrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class FavoritesrssAction extends Rss10Action {
+class FavoritesrssAction extends Rss10Action
+{
 
     var $user = null;
     
diff --git a/_darcs/pristine/actions/featured.php b/_darcs/pristine/actions/featured.php
index 1763adeab..2bf8b0b81 100644
--- a/_darcs/pristine/actions/featured.php
+++ b/_darcs/pristine/actions/featured.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/stream.php');
 require_once(INSTALLDIR.'/lib/profilelist.php');
 
-class FeaturedAction extends StreamAction {
+class FeaturedAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/finishaddopenid.php b/_darcs/pristine/actions/finishaddopenid.php
index d8409b6e9..0ce1680aa 100644
--- a/_darcs/pristine/actions/finishaddopenid.php
+++ b/_darcs/pristine/actions/finishaddopenid.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/openid.php');
 
-class FinishaddopenidAction extends Action {
+class FinishaddopenidAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/finishimmediate.php b/_darcs/pristine/actions/finishimmediate.php
index c4a1c1af9..0964c39f4 100644
--- a/_darcs/pristine/actions/finishimmediate.php
+++ b/_darcs/pristine/actions/finishimmediate.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/openid.php');
 
-class FinishimmediateAction extends Action {
+class FinishimmediateAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/finishopenidlogin.php b/_darcs/pristine/actions/finishopenidlogin.php
index eb52d73b1..bdb8516a3 100644
--- a/_darcs/pristine/actions/finishopenidlogin.php
+++ b/_darcs/pristine/actions/finishopenidlogin.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/openid.php');
 
-class FinishopenidloginAction extends Action {
+class FinishopenidloginAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/finishremotesubscribe.php b/_darcs/pristine/actions/finishremotesubscribe.php
index 5aace4fa9..cee3a1818 100644
--- a/_darcs/pristine/actions/finishremotesubscribe.php
+++ b/_darcs/pristine/actions/finishremotesubscribe.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class FinishremotesubscribeAction extends Action {
+class FinishremotesubscribeAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/foaf.php b/_darcs/pristine/actions/foaf.php
index 27548bfff..30e98960c 100644
--- a/_darcs/pristine/actions/foaf.php
+++ b/_darcs/pristine/actions/foaf.php
@@ -23,7 +23,8 @@ define('LISTENER', 1);
 define('LISTENEE', -1);
 define('BOTH', 0);
 
-class FoafAction extends Action {
+class FoafAction extends Action
+{
 
     function is_readonly()
     {
diff --git a/_darcs/pristine/actions/imsettings.php b/_darcs/pristine/actions/imsettings.php
index 56fb14758..8ecf200ec 100644
--- a/_darcs/pristine/actions/imsettings.php
+++ b/_darcs/pristine/actions/imsettings.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 require_once(INSTALLDIR.'/lib/jabber.php');
 
-class ImsettingsAction extends SettingsAction {
+class ImsettingsAction extends SettingsAction
+{
 
     function get_instructions()
     {
diff --git a/_darcs/pristine/actions/invite.php b/_darcs/pristine/actions/invite.php
index b0fc79958..80e022a3d 100644
--- a/_darcs/pristine/actions/invite.php
+++ b/_darcs/pristine/actions/invite.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class InviteAction extends Action {
+class InviteAction extends Action
+{
 
     function is_readonly()
     {
diff --git a/_darcs/pristine/actions/login.php b/_darcs/pristine/actions/login.php
index 6ad07b610..8600d44fd 100644
--- a/_darcs/pristine/actions/login.php
+++ b/_darcs/pristine/actions/login.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class LoginAction extends Action {
+class LoginAction extends Action
+{
 
     function is_readonly()
     {
diff --git a/_darcs/pristine/actions/logout.php b/_darcs/pristine/actions/logout.php
index effb5abbe..201378730 100644
--- a/_darcs/pristine/actions/logout.php
+++ b/_darcs/pristine/actions/logout.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/openid.php');
 
-class LogoutAction extends Action {
+class LogoutAction extends Action
+{
     
     function is_readonly()
     {
diff --git a/_darcs/pristine/actions/microsummary.php b/_darcs/pristine/actions/microsummary.php
index a19a26dcf..13ddc4e3e 100644
--- a/_darcs/pristine/actions/microsummary.php
+++ b/_darcs/pristine/actions/microsummary.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class MicrosummaryAction extends Action {
+class MicrosummaryAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/newmessage.php b/_darcs/pristine/actions/newmessage.php
index 0a537ad2d..27fa9d518 100644
--- a/_darcs/pristine/actions/newmessage.php
+++ b/_darcs/pristine/actions/newmessage.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class NewmessageAction extends Action {
+class NewmessageAction extends Action
+{
     
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/newnotice.php b/_darcs/pristine/actions/newnotice.php
index 1f6117c1e..c412e893d 100644
--- a/_darcs/pristine/actions/newnotice.php
+++ b/_darcs/pristine/actions/newnotice.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once INSTALLDIR . '/lib/noticelist.php';
 
-class NewnoticeAction extends Action {
+class NewnoticeAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/noticesearch.php b/_darcs/pristine/actions/noticesearch.php
index 782c8fe98..b36fc8ad2 100644
--- a/_darcs/pristine/actions/noticesearch.php
+++ b/_darcs/pristine/actions/noticesearch.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/searchaction.php');
 
 # XXX common parent for people and content search?
 
-class NoticesearchAction extends SearchAction {
+class NoticesearchAction extends SearchAction
+{
 
     function get_instructions()
     {
diff --git a/_darcs/pristine/actions/noticesearchrss.php b/_darcs/pristine/actions/noticesearchrss.php
index c41d34873..20fe0ff2a 100644
--- a/_darcs/pristine/actions/noticesearchrss.php
+++ b/_darcs/pristine/actions/noticesearchrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class NoticesearchrssAction extends Rss10Action {
+class NoticesearchrssAction extends Rss10Action
+{
 
     function init()
     {
diff --git a/_darcs/pristine/actions/nudge.php b/_darcs/pristine/actions/nudge.php
index e0268e9d0..a6480a582 100644
--- a/_darcs/pristine/actions/nudge.php
+++ b/_darcs/pristine/actions/nudge.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/mail.php');
 
-class NudgeAction extends Action {
+class NudgeAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/openidlogin.php b/_darcs/pristine/actions/openidlogin.php
index b8681215e..09679e372 100644
--- a/_darcs/pristine/actions/openidlogin.php
+++ b/_darcs/pristine/actions/openidlogin.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/openid.php');
 
-class OpenidloginAction extends Action {
+class OpenidloginAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/openidsettings.php b/_darcs/pristine/actions/openidsettings.php
index ce4143d41..039236048 100644
--- a/_darcs/pristine/actions/openidsettings.php
+++ b/_darcs/pristine/actions/openidsettings.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 require_once(INSTALLDIR.'/lib/openid.php');
 
-class OpenidsettingsAction extends SettingsAction {
+class OpenidsettingsAction extends SettingsAction
+{
 
     function get_instructions()
     {
diff --git a/_darcs/pristine/actions/opensearch.php b/_darcs/pristine/actions/opensearch.php
index f9c6f4c57..96691fa6f 100644
--- a/_darcs/pristine/actions/opensearch.php
+++ b/_darcs/pristine/actions/opensearch.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class OpensearchAction extends Action {
+class OpensearchAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/othersettings.php b/_darcs/pristine/actions/othersettings.php
index dc1bcd02b..c2f08934c 100644
--- a/_darcs/pristine/actions/othersettings.php
+++ b/_darcs/pristine/actions/othersettings.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 
-class OthersettingsAction extends SettingsAction {
+class OthersettingsAction extends SettingsAction
+{
 
     function get_instructions()
     {
diff --git a/_darcs/pristine/actions/peoplesearch.php b/_darcs/pristine/actions/peoplesearch.php
index 6d3f6a73f..0d0fae4e5 100644
--- a/_darcs/pristine/actions/peoplesearch.php
+++ b/_darcs/pristine/actions/peoplesearch.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/searchaction.php');
 require_once(INSTALLDIR.'/lib/profilelist.php');
 
-class PeoplesearchAction extends SearchAction {
+class PeoplesearchAction extends SearchAction
+{
 
     function get_instructions()
     {
@@ -69,7 +70,8 @@ class PeoplesearchAction extends SearchAction {
     }
 }
 
-class PeopleSearchResults extends ProfileList {
+class PeopleSearchResults extends ProfileList
+{
 
     var $terms = null;
     var $pattern = null;
diff --git a/_darcs/pristine/actions/peopletag.php b/_darcs/pristine/actions/peopletag.php
index c7e463026..13a0b7a41 100644
--- a/_darcs/pristine/actions/peopletag.php
+++ b/_darcs/pristine/actions/peopletag.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/profilelist.php');
 
-class PeopletagAction extends Action {
+class PeopletagAction extends Action
+{
     
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/postnotice.php b/_darcs/pristine/actions/postnotice.php
index 8b0781dfd..dec62a678 100644
--- a/_darcs/pristine/actions/postnotice.php
+++ b/_darcs/pristine/actions/postnotice.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class PostnoticeAction extends Action {
+class PostnoticeAction extends Action
+{
     function handle($args)
     {
         parent::handle($args);
diff --git a/_darcs/pristine/actions/profilesettings.php b/_darcs/pristine/actions/profilesettings.php
index beb9979d0..6c22a7933 100644
--- a/_darcs/pristine/actions/profilesettings.php
+++ b/_darcs/pristine/actions/profilesettings.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 
-class ProfilesettingsAction extends SettingsAction {
+class ProfilesettingsAction extends SettingsAction
+{
 
     function get_instructions()
     {
diff --git a/_darcs/pristine/actions/public.php b/_darcs/pristine/actions/public.php
index 62be3da99..039e885e6 100644
--- a/_darcs/pristine/actions/public.php
+++ b/_darcs/pristine/actions/public.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/stream.php');
 
-class PublicAction extends StreamAction {
+class PublicAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/publicrss.php b/_darcs/pristine/actions/publicrss.php
index 8e554122e..822bc2db7 100644
--- a/_darcs/pristine/actions/publicrss.php
+++ b/_darcs/pristine/actions/publicrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class PublicrssAction extends Rss10Action {
+class PublicrssAction extends Rss10Action
+{
 
     function init()
     {
diff --git a/_darcs/pristine/actions/publicxrds.php b/_darcs/pristine/actions/publicxrds.php
index 63c80d81e..3d731d79f 100644
--- a/_darcs/pristine/actions/publicxrds.php
+++ b/_darcs/pristine/actions/publicxrds.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 # XXX: factor out similarities with XrdsAction
 
-class PublicxrdsAction extends Action {
+class PublicxrdsAction extends Action
+{
 
     function is_readonly()
     {
diff --git a/_darcs/pristine/actions/recoverpassword.php b/_darcs/pristine/actions/recoverpassword.php
index a482d4711..bb6ef81d6 100644
--- a/_darcs/pristine/actions/recoverpassword.php
+++ b/_darcs/pristine/actions/recoverpassword.php
@@ -23,7 +23,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 define(MAX_RECOVERY_TIME, 24 * 60 * 60);
 
-class RecoverpasswordAction extends Action {
+class RecoverpasswordAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/register.php b/_darcs/pristine/actions/register.php
index 444e67e35..ac14879e2 100644
--- a/_darcs/pristine/actions/register.php
+++ b/_darcs/pristine/actions/register.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class RegisterAction extends Action {
+class RegisterAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/remotesubscribe.php b/_darcs/pristine/actions/remotesubscribe.php
index 02c026849..a9494772e 100644
--- a/_darcs/pristine/actions/remotesubscribe.php
+++ b/_darcs/pristine/actions/remotesubscribe.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class RemotesubscribeAction extends Action {
+class RemotesubscribeAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/replies.php b/_darcs/pristine/actions/replies.php
index da2f27f31..eceeb4d65 100644
--- a/_darcs/pristine/actions/replies.php
+++ b/_darcs/pristine/actions/replies.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/actions/showstream.php');
 
-class RepliesAction extends StreamAction {
+class RepliesAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/repliesrss.php b/_darcs/pristine/actions/repliesrss.php
index 19ab0866a..5f85f8d2e 100644
--- a/_darcs/pristine/actions/repliesrss.php
+++ b/_darcs/pristine/actions/repliesrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class RepliesrssAction extends Rss10Action {
+class RepliesrssAction extends Rss10Action
+{
 
     var $user = null;
 
diff --git a/_darcs/pristine/actions/requesttoken.php b/_darcs/pristine/actions/requesttoken.php
index 091846756..a74548739 100644
--- a/_darcs/pristine/actions/requesttoken.php
+++ b/_darcs/pristine/actions/requesttoken.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class RequesttokenAction extends Action {
+class RequesttokenAction extends Action
+{
     
     function is_readonly()
     {
diff --git a/_darcs/pristine/actions/showfavorites.php b/_darcs/pristine/actions/showfavorites.php
index 8131cac67..f4344833d 100644
--- a/_darcs/pristine/actions/showfavorites.php
+++ b/_darcs/pristine/actions/showfavorites.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/actions/showstream.php');
 
-class ShowfavoritesAction extends StreamAction {
+class ShowfavoritesAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/showmessage.php b/_darcs/pristine/actions/showmessage.php
index b706fe2fa..25330a568 100644
--- a/_darcs/pristine/actions/showmessage.php
+++ b/_darcs/pristine/actions/showmessage.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/mailbox.php');
 
-class ShowmessageAction extends MailboxAction {
+class ShowmessageAction extends MailboxAction
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/shownotice.php b/_darcs/pristine/actions/shownotice.php
index abdaa72ca..2df09cb3f 100644
--- a/_darcs/pristine/actions/shownotice.php
+++ b/_darcs/pristine/actions/shownotice.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/stream.php');
 
-class ShownoticeAction extends StreamAction {
+class ShownoticeAction extends StreamAction
+{
 
     var $notice = null;
     var $profile = null;
diff --git a/_darcs/pristine/actions/showstream.php b/_darcs/pristine/actions/showstream.php
index c31bce87a..e4e5d96d1 100644
--- a/_darcs/pristine/actions/showstream.php
+++ b/_darcs/pristine/actions/showstream.php
@@ -24,7 +24,8 @@ require_once(INSTALLDIR.'/lib/stream.php');
 define('SUBSCRIPTIONS_PER_ROW', 4);
 define('SUBSCRIPTIONS', 80);
 
-class ShowstreamAction extends StreamAction {
+class ShowstreamAction extends StreamAction
+{
 
     function handle($args)
     {
@@ -449,14 +450,16 @@ class ShowstreamAction extends StreamAction {
 
 # We don't show the author for a profile, since we already know who it is!
 
-class ProfileNoticeList extends NoticeList {
+class ProfileNoticeList extends NoticeList
+{
     function newListItem($notice)
     {
         return new ProfileNoticeListItem($notice);
     }
 }
 
-class ProfileNoticeListItem extends NoticeListItem {
+class ProfileNoticeListItem extends NoticeListItem
+{
     function showAuthor()
     {
         return;
diff --git a/_darcs/pristine/actions/smssettings.php b/_darcs/pristine/actions/smssettings.php
index 444da2590..fad71135c 100644
--- a/_darcs/pristine/actions/smssettings.php
+++ b/_darcs/pristine/actions/smssettings.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 require_once(INSTALLDIR.'/actions/emailsettings.php');
 
-class SmssettingsAction extends EmailsettingsAction {
+class SmssettingsAction extends EmailsettingsAction
+{
 
     function get_instructions()
     {
diff --git a/_darcs/pristine/actions/subedit.php b/_darcs/pristine/actions/subedit.php
index 874102857..1142b7a03 100644
--- a/_darcs/pristine/actions/subedit.php
+++ b/_darcs/pristine/actions/subedit.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class SubeditAction extends Action {
+class SubeditAction extends Action
+{
 
     var $profile = null;
 
diff --git a/_darcs/pristine/actions/subscribe.php b/_darcs/pristine/actions/subscribe.php
index 93884f081..f33d1d207 100644
--- a/_darcs/pristine/actions/subscribe.php
+++ b/_darcs/pristine/actions/subscribe.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class SubscribeAction extends Action {
+class SubscribeAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/subscribers.php b/_darcs/pristine/actions/subscribers.php
index 8c7805f51..31d0468d9 100644
--- a/_darcs/pristine/actions/subscribers.php
+++ b/_darcs/pristine/actions/subscribers.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/gallery.php');
 
-class SubscribersAction extends GalleryAction {
+class SubscribersAction extends GalleryAction
+{
 
     function gallery_type()
     {
@@ -59,7 +60,8 @@ class SubscribersAction extends GalleryAction {
     }
 }
 
-class SubscribersList extends ProfileList {
+class SubscribersList extends ProfileList
+{
     function show_owner_controls($profile)
     {
         common_block_form($profile, array('action' => 'subscribers',
diff --git a/_darcs/pristine/actions/subscriptions.php b/_darcs/pristine/actions/subscriptions.php
index ad4a3f9e5..afe8fb260 100644
--- a/_darcs/pristine/actions/subscriptions.php
+++ b/_darcs/pristine/actions/subscriptions.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/gallery.php');
 
-class SubscriptionsAction extends GalleryAction {
+class SubscriptionsAction extends GalleryAction
+{
 
     function gallery_type()
     {
@@ -59,7 +60,8 @@ class SubscriptionsAction extends GalleryAction {
     }
 }
 
-class SubscriptionsList extends ProfileList {
+class SubscriptionsList extends ProfileList
+{
 
     function show_owner_controls($profile)
     {
diff --git a/_darcs/pristine/actions/sup.php b/_darcs/pristine/actions/sup.php
index 2a139b322..6a1897585 100644
--- a/_darcs/pristine/actions/sup.php
+++ b/_darcs/pristine/actions/sup.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class SupAction extends Action {
+class SupAction extends Action
+{
     
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/tag.php b/_darcs/pristine/actions/tag.php
index d7b35d613..8a3f90c16 100644
--- a/_darcs/pristine/actions/tag.php
+++ b/_darcs/pristine/actions/tag.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/actions/showstream.php');
 define('TAGS_PER_PAGE', 100);
 
-class TagAction extends StreamAction {
+class TagAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/tagother.php b/_darcs/pristine/actions/tagother.php
index ed17ac531..ff6788cc6 100644
--- a/_darcs/pristine/actions/tagother.php
+++ b/_darcs/pristine/actions/tagother.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 
-class TagotherAction extends Action {
+class TagotherAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/tagrss.php b/_darcs/pristine/actions/tagrss.php
index bb4edf473..912d71413 100644
--- a/_darcs/pristine/actions/tagrss.php
+++ b/_darcs/pristine/actions/tagrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class TagrssAction extends Rss10Action {
+class TagrssAction extends Rss10Action
+{
 
     function init()
     {
diff --git a/_darcs/pristine/actions/twitapiaccount.php b/_darcs/pristine/actions/twitapiaccount.php
index d5e9143c2..79e1ed990 100644
--- a/_darcs/pristine/actions/twitapiaccount.php
+++ b/_darcs/pristine/actions/twitapiaccount.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapiaccountAction extends TwitterapiAction {
+class TwitapiaccountAction extends TwitterapiAction
+{
 
     function verify_credentials($args, $apidata)
     {
diff --git a/_darcs/pristine/actions/twitapiblocks.php b/_darcs/pristine/actions/twitapiblocks.php
index 2170141f1..5d64f2f7d 100644
--- a/_darcs/pristine/actions/twitapiblocks.php
+++ b/_darcs/pristine/actions/twitapiblocks.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapiblocksAction extends TwitterapiAction {
+class TwitapiblocksAction extends TwitterapiAction
+{
 
     function create($args, $apidata)
     {
diff --git a/_darcs/pristine/actions/twitapidirect_messages.php b/_darcs/pristine/actions/twitapidirect_messages.php
index e9f7aa0bf..e0731f66f 100644
--- a/_darcs/pristine/actions/twitapidirect_messages.php
+++ b/_darcs/pristine/actions/twitapidirect_messages.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class Twitapidirect_messagesAction extends TwitterapiAction {
+class Twitapidirect_messagesAction extends TwitterapiAction
+{
 
     function direct_messages($args, $apidata)
     {
diff --git a/_darcs/pristine/actions/twitapifavorites.php b/_darcs/pristine/actions/twitapifavorites.php
index e7a43f770..55e04732f 100644
--- a/_darcs/pristine/actions/twitapifavorites.php
+++ b/_darcs/pristine/actions/twitapifavorites.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapifavoritesAction extends TwitterapiAction {
+class TwitapifavoritesAction extends TwitterapiAction
+{
 
     function favorites($args, $apidata)
     {
diff --git a/_darcs/pristine/actions/twitapifriendships.php b/_darcs/pristine/actions/twitapifriendships.php
index 5eca96298..ba4afe441 100644
--- a/_darcs/pristine/actions/twitapifriendships.php
+++ b/_darcs/pristine/actions/twitapifriendships.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapifriendshipsAction extends TwitterapiAction {
+class TwitapifriendshipsAction extends TwitterapiAction
+{
 
     function create($args, $apidata)
     {
diff --git a/_darcs/pristine/actions/twitapihelp.php b/_darcs/pristine/actions/twitapihelp.php
index 27262f089..1b84cb11b 100644
--- a/_darcs/pristine/actions/twitapihelp.php
+++ b/_darcs/pristine/actions/twitapihelp.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapihelpAction extends TwitterapiAction {
+class TwitapihelpAction extends TwitterapiAction
+{
 
     /* Returns the string "ok" in the requested format with a 200 OK HTTP status code.
      * URL:http://identi.ca/api/help/test.format
diff --git a/_darcs/pristine/actions/twitapinotifications.php b/_darcs/pristine/actions/twitapinotifications.php
index e24d3829c..a19d652c3 100644
--- a/_darcs/pristine/actions/twitapinotifications.php
+++ b/_darcs/pristine/actions/twitapinotifications.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 # This naming convention looks real sick
-class TwitapinotificationsAction extends TwitterapiAction {
+class TwitapinotificationsAction extends TwitterapiAction
+{
 
     function follow($args, $apidata)
     {
diff --git a/_darcs/pristine/actions/twitapistatuses.php b/_darcs/pristine/actions/twitapistatuses.php
index f280184c0..e629d5cc4 100644
--- a/_darcs/pristine/actions/twitapistatuses.php
+++ b/_darcs/pristine/actions/twitapistatuses.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapistatusesAction extends TwitterapiAction {
+class TwitapistatusesAction extends TwitterapiAction
+{
 
     function public_timeline($args, $apidata)
     {
diff --git a/_darcs/pristine/actions/twitapiusers.php b/_darcs/pristine/actions/twitapiusers.php
index 4644e6be6..409986985 100644
--- a/_darcs/pristine/actions/twitapiusers.php
+++ b/_darcs/pristine/actions/twitapiusers.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapiusersAction extends TwitterapiAction {
+class TwitapiusersAction extends TwitterapiAction
+{
 
     function show($args, $apidata)
     {
diff --git a/_darcs/pristine/actions/twittersettings.php b/_darcs/pristine/actions/twittersettings.php
index 1f55b31b6..26dede0ac 100644
--- a/_darcs/pristine/actions/twittersettings.php
+++ b/_darcs/pristine/actions/twittersettings.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
 
 define('SUBSCRIPTIONS', 80);
 
-class TwittersettingsAction extends SettingsAction {
+class TwittersettingsAction extends SettingsAction
+{
 
     function get_instructions()
     {
diff --git a/_darcs/pristine/actions/unblock.php b/_darcs/pristine/actions/unblock.php
index 66ce0c879..112304f71 100644
--- a/_darcs/pristine/actions/unblock.php
+++ b/_darcs/pristine/actions/unblock.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class UnblockAction extends Action {
+class UnblockAction extends Action
+{
 
     var $profile = null;
 
diff --git a/_darcs/pristine/actions/unsubscribe.php b/_darcs/pristine/actions/unsubscribe.php
index e4e04aaa0..1c2e13635 100644
--- a/_darcs/pristine/actions/unsubscribe.php
+++ b/_darcs/pristine/actions/unsubscribe.php
@@ -17,7 +17,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-class UnsubscribeAction extends Action {
+class UnsubscribeAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/updateprofile.php b/_darcs/pristine/actions/updateprofile.php
index 2cfff1b51..abb034c81 100644
--- a/_darcs/pristine/actions/updateprofile.php
+++ b/_darcs/pristine/actions/updateprofile.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class UpdateprofileAction extends Action {
+class UpdateprofileAction extends Action
+{
     
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/userauthorization.php b/_darcs/pristine/actions/userauthorization.php
index c73d515d3..05efbc16c 100644
--- a/_darcs/pristine/actions/userauthorization.php
+++ b/_darcs/pristine/actions/userauthorization.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/omb.php');
 define('TIMESTAMP_THRESHOLD', 300);
 
-class UserauthorizationAction extends Action {
+class UserauthorizationAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/actions/userbyid.php b/_darcs/pristine/actions/userbyid.php
index d7b4088bd..d57ed21a5 100644
--- a/_darcs/pristine/actions/userbyid.php
+++ b/_darcs/pristine/actions/userbyid.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class UserbyidAction extends Action {
+class UserbyidAction extends Action
+{
     
     function is_readonly()
     {                
diff --git a/_darcs/pristine/actions/userrss.php b/_darcs/pristine/actions/userrss.php
index c758a44e2..1e9fe121f 100644
--- a/_darcs/pristine/actions/userrss.php
+++ b/_darcs/pristine/actions/userrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class UserrssAction extends Rss10Action {
+class UserrssAction extends Rss10Action
+{
 
     var $user = null;
 
diff --git a/_darcs/pristine/actions/xrds.php b/_darcs/pristine/actions/xrds.php
index 1d4961d46..7edc6aa39 100644
--- a/_darcs/pristine/actions/xrds.php
+++ b/_darcs/pristine/actions/xrds.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class XrdsAction extends Action {
+class XrdsAction extends Action
+{
 
     function is_readonly()
     {                
diff --git a/_darcs/pristine/classes/Channel.php b/_darcs/pristine/classes/Channel.php
index 02ece9c0f..2e3e4e8d4 100644
--- a/_darcs/pristine/classes/Channel.php
+++ b/_darcs/pristine/classes/Channel.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class Channel {
+class Channel
+{
     
     function on($user)
     {
@@ -47,7 +48,8 @@ class Channel {
     }
 }
 
-class XMPPChannel extends Channel {
+class XMPPChannel extends Channel
+{
 
     var $conn = null;
     
@@ -104,7 +106,8 @@ class XMPPChannel extends Channel {
 }
 
 
-class WebChannel extends Channel {
+class WebChannel extends Channel
+{
 
     function source()
     {
@@ -138,7 +141,8 @@ class WebChannel extends Channel {
 }
 
 
-class AjaxWebChannel extends WebChannel {
+class AjaxWebChannel extends WebChannel
+{
 
     function output($user, $text)
     {
@@ -166,7 +170,8 @@ class AjaxWebChannel extends WebChannel {
 }
 
 
-class MailChannel extends Channel {
+class MailChannel extends Channel
+{
 
     var $addr = null;
 
diff --git a/_darcs/pristine/classes/Command.php b/_darcs/pristine/classes/Command.php
index 407a6ecba..eacbdacb3 100644
--- a/_darcs/pristine/classes/Command.php
+++ b/_darcs/pristine/classes/Command.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/classes/Channel.php');
 
-class Command {
+class Command
+{
     
     var $user = null;
     
@@ -36,20 +37,24 @@ class Command {
     }
 }
 
-class UnimplementedCommand extends Command {
+class UnimplementedCommand extends Command
+{
     function execute($channel)
     {
         $channel->error($this->user, _("Sorry, this command is not yet implemented."));
     }
 }
 
-class TrackingCommand extends UnimplementedCommand {
+class TrackingCommand extends UnimplementedCommand
+{
 }
 
-class TrackOffCommand extends UnimplementedCommand {
+class TrackOffCommand extends UnimplementedCommand
+{
 }
 
-class TrackCommand extends UnimplementedCommand {
+class TrackCommand extends UnimplementedCommand
+{
     var $word = null;
     function __construct($user, $word)
     {
@@ -58,7 +63,8 @@ class TrackCommand extends UnimplementedCommand {
     }
 }
 
-class UntrackCommand extends UnimplementedCommand {
+class UntrackCommand extends UnimplementedCommand
+{
     var $word = null;
     function __construct($user, $word)
     {
@@ -67,7 +73,8 @@ class UntrackCommand extends UnimplementedCommand {
     }
 }
 
-class NudgeCommand extends UnimplementedCommand {
+class NudgeCommand extends UnimplementedCommand
+{
     var $other = null;
     function __construct($user, $other)
     {
@@ -76,7 +83,8 @@ class NudgeCommand extends UnimplementedCommand {
     }
 }
 
-class InviteCommand extends UnimplementedCommand {
+class InviteCommand extends UnimplementedCommand
+{
     var $other = null;
     function __construct($user, $other)
     {
@@ -85,7 +93,8 @@ class InviteCommand extends UnimplementedCommand {
     }
 }
 
-class StatsCommand extends Command {
+class StatsCommand extends Command
+{
     function execute($channel)
     {
 
@@ -110,7 +119,8 @@ class StatsCommand extends Command {
     }
 }
 
-class FavCommand extends Command {
+class FavCommand extends Command
+{
     
     var $other = null;
     
@@ -157,7 +167,8 @@ class FavCommand extends Command {
     }
 }
 
-class WhoisCommand extends Command {
+class WhoisCommand extends Command
+{
     var $other = null;
     function __construct($user, $other)
     {
@@ -193,7 +204,8 @@ class WhoisCommand extends Command {
     }
 }
 
-class MessageCommand extends Command {
+class MessageCommand extends Command
+{
     var $other = null;
     var $text = null;
     function __construct($user, $other, $text)
@@ -237,7 +249,8 @@ class MessageCommand extends Command {
     }
 }
 
-class GetCommand extends Command {
+class GetCommand extends Command
+{
     
     var $other = null;
     
@@ -269,7 +282,8 @@ class GetCommand extends Command {
     }
 }
 
-class SubCommand extends Command {
+class SubCommand extends Command
+{
     
     var $other = null;
     
@@ -297,7 +311,8 @@ class SubCommand extends Command {
     }
 }
 
-class UnsubCommand extends Command {
+class UnsubCommand extends Command
+{
 
     var $other = null;
     
@@ -324,7 +339,8 @@ class UnsubCommand extends Command {
     }
 }
 
-class OffCommand extends Command {
+class OffCommand extends Command
+{
     var $other = null;
     function __construct($user, $other=null)
     {
@@ -345,7 +361,8 @@ class OffCommand extends Command {
     }
 }
 
-class OnCommand extends Command {
+class OnCommand extends Command
+{
     var $other = null;
     function __construct($user, $other=null)
     {
@@ -367,7 +384,8 @@ class OnCommand extends Command {
     }
 }
 
-class HelpCommand extends Command {
+class HelpCommand extends Command
+{
     function execute($channel)
     {
         $channel->output($this->user,
diff --git a/_darcs/pristine/classes/CommandInterpreter.php b/_darcs/pristine/classes/CommandInterpreter.php
index ff078bb05..f409ed07f 100644
--- a/_darcs/pristine/classes/CommandInterpreter.php
+++ b/_darcs/pristine/classes/CommandInterpreter.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/classes/Command.php');
 
-class CommandInterpreter {
+class CommandInterpreter
+{
     
     function handle_command($user, $text)
     {
diff --git a/_darcs/pristine/classes/NoticeWrapper.php b/_darcs/pristine/classes/NoticeWrapper.php
index e1b27c2f7..233340ccd 100644
--- a/_darcs/pristine/classes/NoticeWrapper.php
+++ b/_darcs/pristine/classes/NoticeWrapper.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/classes/Notice.php');
 
-class NoticeWrapper extends Notice {
+class NoticeWrapper extends Notice
+{
 
     public $id;                              // int(4)  primary_key not_null
     public $profile_id;                      // int(4)   not_null
diff --git a/_darcs/pristine/lib/Shorturl_api.php b/_darcs/pristine/lib/Shorturl_api.php
index f3f4f08df..fe106cb83 100644
--- a/_darcs/pristine/lib/Shorturl_api.php
+++ b/_darcs/pristine/lib/Shorturl_api.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class ShortUrlApi {
+class ShortUrlApi
+{
     protected $service_url;
 
     function __construct($service_url)
@@ -69,7 +70,8 @@ class ShortUrlApi {
     }
 }
 
-class LilUrl extends ShortUrlApi {
+class LilUrl extends ShortUrlApi
+{
     function __construct()
     {
         parent::__construct('http://ur1.ca/');
@@ -88,7 +90,8 @@ class LilUrl extends ShortUrlApi {
 }
 
 
-class PtitUrl extends ShortUrlApi {
+class PtitUrl extends ShortUrlApi
+{
     function __construct()
     {
         parent::__construct('http://ptiturl.com/?creer=oui&action=Reduire&url=');
@@ -106,7 +109,8 @@ class PtitUrl extends ShortUrlApi {
     }
 }
 
-class TightUrl extends ShortUrlApi {
+class TightUrl extends ShortUrlApi
+{
     function __construct()
     {
         parent::__construct('http://2tu.us/?save=y&url=');
diff --git a/_darcs/pristine/lib/deleteaction.php b/_darcs/pristine/lib/deleteaction.php
index a6e365121..9e89c0a54 100644
--- a/_darcs/pristine/lib/deleteaction.php
+++ b/_darcs/pristine/lib/deleteaction.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class DeleteAction extends Action {
+class DeleteAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/lib/facebookaction.php b/_darcs/pristine/lib/facebookaction.php
index 43464b19b..d5b7ed0fb 100644
--- a/_darcs/pristine/lib/facebookaction.php
+++ b/_darcs/pristine/lib/facebookaction.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/extlib/facebook/facebook.php');
 
-class FacebookAction extends Action {
+class FacebookAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/lib/oauthstore.php b/_darcs/pristine/lib/oauthstore.php
index faae82db1..7ad3be20e 100644
--- a/_darcs/pristine/lib/oauthstore.php
+++ b/_darcs/pristine/lib/oauthstore.php
@@ -21,9 +21,10 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class LaconicaOAuthDataStore extends OAuthDataStore {
+class LaconicaOAuthDataStore extends OAuthDataStore
+{
 
-    # We keep a record of who's contacted us
+    // We keep a record of who's contacted us
 
     function lookup_consumer($consumer_key)
     {
@@ -75,8 +76,8 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         $t->consumer_key = $consumer->key;
         $t->tok = common_good_rand(16);
         $t->secret = common_good_rand(16);
-        $t->type = 0; # request
-        $t->state = 0; # unauthorized
+        $t->type = 0; // request
+        $t->state = 0; // unauthorized
         $t->created = DB_DataObject_Cast::dateTime();
         if (!$t->insert()) {
             return null;
@@ -85,7 +86,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         }
     }
 
-    # defined in OAuthDataStore, but not implemented anywhere
+    // defined in OAuthDataStore, but not implemented anywhere
 
     function fetch_request_token($consumer)
     {
@@ -98,14 +99,14 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         $rt = new Token();
         $rt->consumer_key = $consumer->key;
         $rt->tok = $token->key;
-        $rt->type = 0; # request
-        if ($rt->find(true) && $rt->state == 1) { # authorized
+        $rt->type = 0; // request
+        if ($rt->find(true) && $rt->state == 1) { // authorized
             common_debug('request token found.', __FILE__);
             $at = new Token();
             $at->consumer_key = $consumer->key;
             $at->tok = common_good_rand(16);
             $at->secret = common_good_rand(16);
-            $at->type = 1; # access
+            $at->type = 1; // access
             $at->created = DB_DataObject_Cast::dateTime();
             if (!$at->insert()) {
                 $e = $at->_lastError;
@@ -113,15 +114,15 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
                 return null;
             } else {
                 common_debug('access token "'.$at->tok.'" inserted', __FILE__);
-                # burn the old one
+                // burn the old one
                 $orig_rt = clone($rt);
-                $rt->state = 2; # used
+                $rt->state = 2; // used
                 if (!$rt->update($orig_rt)) {
                     return null;
                 }
                 common_debug('request token "'.$rt->tok.'" updated', __FILE__);
-                # Update subscription
-                # XXX: mixing levels here
+                // Update subscription
+                // XXX: mixing levels here
                 $sub = Subscription::staticGet('token', $rt->tok);
                 if (!$sub) {
                     return null;
@@ -142,7 +143,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         }
     }
 
-    # defined in OAuthDataStore, but not implemented anywhere
+    // defined in OAuthDataStore, but not implemented anywhere
 
     function fetch_access_token($consumer)
     {
diff --git a/_darcs/pristine/lib/personal.php b/_darcs/pristine/lib/personal.php
index 34ebe6894..02b01fece 100644
--- a/_darcs/pristine/lib/personal.php
+++ b/_darcs/pristine/lib/personal.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class PersonalAction extends Action {
+class PersonalAction extends Action
+{
     
     function is_readonly()
     {
diff --git a/_darcs/pristine/lib/profilelist.php b/_darcs/pristine/lib/profilelist.php
index 60737c3d4..bda05daf3 100644
--- a/_darcs/pristine/lib/profilelist.php
+++ b/_darcs/pristine/lib/profilelist.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 define('PROFILES_PER_PAGE', 20);
 
-class ProfileList {
+class ProfileList
+{
 
     var $profile = null;
     var $owner = null;
diff --git a/_darcs/pristine/lib/queuehandler.php b/_darcs/pristine/lib/queuehandler.php
index 48487f8e9..9ce9e32b3 100644
--- a/_darcs/pristine/lib/queuehandler.php
+++ b/_darcs/pristine/lib/queuehandler.php
@@ -25,7 +25,8 @@ require_once(INSTALLDIR.'/lib/daemon.php');
 require_once(INSTALLDIR.'/classes/Queue_item.php');
 require_once(INSTALLDIR.'/classes/Notice.php');
 
-class QueueHandler extends Daemon {
+class QueueHandler extends Daemon
+{
 
     var $_id = 'generic';
 
diff --git a/_darcs/pristine/lib/rssaction.php b/_darcs/pristine/lib/rssaction.php
index e02e1febb..9564cfb46 100644
--- a/_darcs/pristine/lib/rssaction.php
+++ b/_darcs/pristine/lib/rssaction.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 define('DEFAULT_RSS_LIMIT', 48);
 
-class Rss10Action extends Action {
+class Rss10Action extends Action
+{
 
     # This will contain the details of each feed item's author and be used to generate SIOC data.
     var $creators = array();
diff --git a/_darcs/pristine/lib/search_engines.php b/_darcs/pristine/lib/search_engines.php
index e96570d63..559107910 100644
--- a/_darcs/pristine/lib/search_engines.php
+++ b/_darcs/pristine/lib/search_engines.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class SearchEngine {
+class SearchEngine
+{
     protected $target;
     protected $table;
 
@@ -45,7 +46,8 @@ class SearchEngine {
     }
 }
 
-class SphinxSearch extends SearchEngine {
+class SphinxSearch extends SearchEngine
+{
     private $sphinx;
     private $connected;
 
@@ -103,7 +105,8 @@ class SphinxSearch extends SearchEngine {
     }
 }
 
-class MySQLSearch extends SearchEngine {
+class MySQLSearch extends SearchEngine
+{
     function query($q)
     {
         if ('identica_people' === $this->table)
@@ -115,7 +118,8 @@ class MySQLSearch extends SearchEngine {
     }
 }
 
-class PGSearch extends SearchEngine {
+class PGSearch extends SearchEngine
+{
     function query($q)
     {
         if ('identica_people' === $this->table)
diff --git a/_darcs/pristine/lib/searchaction.php b/_darcs/pristine/lib/searchaction.php
index 12a44a861..bc90fac1a 100644
--- a/_darcs/pristine/lib/searchaction.php
+++ b/_darcs/pristine/lib/searchaction.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class SearchAction extends Action {
+class SearchAction extends Action
+{
 
     function is_readonly()
     {
diff --git a/_darcs/pristine/lib/settingsaction.php b/_darcs/pristine/lib/settingsaction.php
index 5979c11f0..46f713fa8 100644
--- a/_darcs/pristine/lib/settingsaction.php
+++ b/_darcs/pristine/lib/settingsaction.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class SettingsAction extends Action {
+class SettingsAction extends Action
+{
 
     function handle($args)
     {
diff --git a/_darcs/pristine/lib/stream.php b/_darcs/pristine/lib/stream.php
index 45fbb9bd9..73758adee 100644
--- a/_darcs/pristine/lib/stream.php
+++ b/_darcs/pristine/lib/stream.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/personal.php');
 require_once(INSTALLDIR.'/lib/noticelist.php');
 
-class StreamAction extends PersonalAction {
+class StreamAction extends PersonalAction
+{
 
     function public_views_menu()
     {
diff --git a/_darcs/pristine/lib/twitterapi.php b/_darcs/pristine/lib/twitterapi.php
index 3cddfa9c9..50bcb06fe 100644
--- a/_darcs/pristine/lib/twitterapi.php
+++ b/_darcs/pristine/lib/twitterapi.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class TwitterapiAction extends Action {
+class TwitterapiAction extends Action
+{
 
     var $auth_user;
 
diff --git a/_darcs/pristine/lib/xmppqueuehandler.php b/_darcs/pristine/lib/xmppqueuehandler.php
index 0a73403f9..91015fd45 100644
--- a/_darcs/pristine/lib/xmppqueuehandler.php
+++ b/_darcs/pristine/lib/xmppqueuehandler.php
@@ -28,7 +28,8 @@ require_once(INSTALLDIR.'/lib/queuehandler.php');
  * superclass.
  */
 
-class XmppQueueHandler extends QueueHandler {
+class XmppQueueHandler extends QueueHandler
+{
     
     function start()
     {
diff --git a/_darcs/pristine/scripts/enjitqueuehandler.php b/_darcs/pristine/scripts/enjitqueuehandler.php
index 55d73e08c..3a4f8315d 100644
--- a/_darcs/pristine/scripts/enjitqueuehandler.php
+++ b/_darcs/pristine/scripts/enjitqueuehandler.php
@@ -33,7 +33,8 @@ require_once(INSTALLDIR . '/lib/queuehandler.php');
 
 set_error_handler('common_error_handler');
 
-class EnjitQueueHandler extends QueueHandler {
+class EnjitQueueHandler extends QueueHandler
+{
     
     function transport()
     {
diff --git a/_darcs/pristine/scripts/jabberqueuehandler.php b/_darcs/pristine/scripts/jabberqueuehandler.php
index ea26aaf79..924fc4545 100644
--- a/_darcs/pristine/scripts/jabberqueuehandler.php
+++ b/_darcs/pristine/scripts/jabberqueuehandler.php
@@ -33,7 +33,8 @@ require_once(INSTALLDIR . '/lib/xmppqueuehandler.php');
 
 set_error_handler('common_error_handler');
 
-class JabberQueueHandler extends XmppQueueHandler {
+class JabberQueueHandler extends XmppQueueHandler
+{
 
     var $conn = null;
 
diff --git a/_darcs/pristine/scripts/maildaemon.php b/_darcs/pristine/scripts/maildaemon.php
index 6100cd21b..b9facec1a 100644
--- a/_darcs/pristine/scripts/maildaemon.php
+++ b/_darcs/pristine/scripts/maildaemon.php
@@ -34,7 +34,8 @@ require_once('Mail/mimeDecode.php');
 # FIXME: we use both Mail_mimeDecode and mailparse
 # Need to move everything to mailparse
 
-class MailerDaemon {
+class MailerDaemon
+{
 
     function __construct()
     {
diff --git a/_darcs/pristine/scripts/ombqueuehandler.php b/_darcs/pristine/scripts/ombqueuehandler.php
index 299381ace..cdcea51dc 100644
--- a/_darcs/pristine/scripts/ombqueuehandler.php
+++ b/_darcs/pristine/scripts/ombqueuehandler.php
@@ -33,7 +33,8 @@ require_once(INSTALLDIR . '/lib/queuehandler.php');
 
 set_error_handler('common_error_handler');
 
-class OmbQueueHandler extends QueueHandler {
+class OmbQueueHandler extends QueueHandler
+{
     
     function transport()
     {
diff --git a/_darcs/pristine/scripts/publicqueuehandler.php b/_darcs/pristine/scripts/publicqueuehandler.php
index b3542e5c5..5075c12df 100644
--- a/_darcs/pristine/scripts/publicqueuehandler.php
+++ b/_darcs/pristine/scripts/publicqueuehandler.php
@@ -33,7 +33,8 @@ require_once(INSTALLDIR . '/lib/xmppqueuehandler.php');
 
 set_error_handler('common_error_handler');
 
-class PublicQueueHandler extends XmppQueueHandler {
+class PublicQueueHandler extends XmppQueueHandler
+{
     
     function transport()
     {
diff --git a/_darcs/pristine/scripts/smsqueuehandler.php b/_darcs/pristine/scripts/smsqueuehandler.php
index c962ad095..38f2f11fe 100644
--- a/_darcs/pristine/scripts/smsqueuehandler.php
+++ b/_darcs/pristine/scripts/smsqueuehandler.php
@@ -33,7 +33,8 @@ require_once(INSTALLDIR . '/lib/queuehandler.php');
 
 set_error_handler('common_error_handler');
 
-class SmsQueueHandler extends QueueHandler {
+class SmsQueueHandler extends QueueHandler
+{
     
     function transport()
     {
diff --git a/_darcs/pristine/scripts/xmppconfirmhandler.php b/_darcs/pristine/scripts/xmppconfirmhandler.php
index 1eb932330..2b8b085ce 100644
--- a/_darcs/pristine/scripts/xmppconfirmhandler.php
+++ b/_darcs/pristine/scripts/xmppconfirmhandler.php
@@ -35,7 +35,8 @@ set_error_handler('common_error_handler');
 
 define('CLAIM_TIMEOUT', 1200);
 
-class XmppConfirmHandler extends XmppQueueHandler {
+class XmppConfirmHandler extends XmppQueueHandler
+{
 
     var $_id = 'confirm';
     
diff --git a/_darcs/pristine/scripts/xmppdaemon.php b/_darcs/pristine/scripts/xmppdaemon.php
index 28ac64725..01fe8914f 100644
--- a/_darcs/pristine/scripts/xmppdaemon.php
+++ b/_darcs/pristine/scripts/xmppdaemon.php
@@ -37,7 +37,8 @@ set_error_handler('common_error_handler');
 # in jabber.php, which create a new XMPP class. A more elegant (?) solution
 # might be to use make this a subclass of XMPP.
 
-class XMPPDaemon extends Daemon {
+class XMPPDaemon extends Daemon
+{
 
     function XMPPDaemon($resource=null)
     {
diff --git a/_darcs/tentative_pristine b/_darcs/tentative_pristine
index c8cd44461..573c67a4f 100644
--- a/_darcs/tentative_pristine
+++ b/_darcs/tentative_pristine
@@ -1,225 +1,593 @@
-hunk ./actions/accesstoken.php 36
--            common_debug('got this token: "'.print_r($token,TRUE).'"', __FILE__);
-+            common_debug('got this token: "'.print_r($token,true).'"', __FILE__);
-hunk ./actions/emailsettings.php 121
--        if ($confirm->find(TRUE)) {
-+        if ($confirm->find(true)) {
-hunk ./actions/emailsettings.php 182
--        if ($result === FALSE) {
-+        if ($result === false) {
-hunk ./actions/emailsettings.php 232
--        if ($result === FALSE) {
-+        if ($result === false) {
-hunk ./actions/emailsettings.php 242
--        $this->show_form($msg, TRUE);
-+        $this->show_form($msg, true);
-hunk ./actions/emailsettings.php 266
--        $this->show_form(_('Confirmation cancelled.'), TRUE);
-+        $this->show_form(_('Confirmation cancelled.'), true);
-hunk ./actions/emailsettings.php 293
--        $this->show_form(_('The address was removed.'), TRUE);
-+        $this->show_form(_('The address was removed.'), true);
-hunk ./actions/emailsettings.php 313
--        $this->show_form(_('Incoming email address removed.'), TRUE);
-+        $this->show_form(_('Incoming email address removed.'), true);
-hunk ./actions/emailsettings.php 328
--        $this->show_form(_('New incoming email address added.'), TRUE);
-+        $this->show_form(_('New incoming email address added.'), true);
-hunk ./actions/finishremotesubscribe.php 281
--        common_debug('got result: "'.print_r($result,TRUE).'"', __FILE__);
-+        common_debug('got result: "'.print_r($result,true).'"', __FILE__);
-hunk ./actions/foaf.php 125
--                    common_debug('Got a bad subscription: '.print_r($sub,TRUE));
-+                    common_debug('Got a bad subscription: '.print_r($sub,true));
-hunk ./actions/foaf.php 147
--                    common_debug('Got a bad subscription: '.print_r($sub,TRUE));
-+                    common_debug('Got a bad subscription: '.print_r($sub,true));
-hunk ./actions/imsettings.php 96
--        if ($confirm->find(TRUE)) {
-+        if ($confirm->find(true)) {
-hunk ./actions/imsettings.php 149
--        if ($result === FALSE) {
-+        if ($result === false) {
-hunk ./actions/imsettings.php 199
--        if ($result === FALSE) {
-+        if ($result === false) {
-hunk ./actions/imsettings.php 213
--        $this->show_form($msg, TRUE);
-+        $this->show_form($msg, true);
-hunk ./actions/imsettings.php 237
--        $this->show_form(_('Confirmation cancelled.'), TRUE);
-+        $this->show_form(_('Confirmation cancelled.'), true);
-hunk ./actions/imsettings.php 266
--        $this->show_form(_('The address was removed.'), TRUE);
-+        $this->show_form(_('The address was removed.'), true);
-hunk ./actions/othersettings.php 56
--        common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), FALSE, $user->urlshorteningservice);
-+        common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), false, $user->urlshorteningservice);
-hunk ./actions/othersettings.php 177
--        if ($result === FALSE) {
-+        if ($result === false) {
-hunk ./actions/profilesettings.php 99
--        common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), TRUE, $language);
-+        common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), true, $language);
-hunk ./actions/profilesettings.php 105
--        common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), TRUE, $timezone);
-+        common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), true, $timezone);
-hunk ./actions/profilesettings.php 281
--            if ($result === FALSE) {
-+            if ($result === false) {
-hunk ./actions/profilesettings.php 301
--            if ($result === FALSE) {
-+            if ($result === false) {
-hunk ./actions/profilesettings.php 343
--        $this->show_form(_('Settings saved.'), TRUE);
-+        $this->show_form(_('Settings saved.'), true);
-hunk ./actions/profilesettings.php 437
--        if ($val !== TRUE) {
-+        if ($val !== true) {
-hunk ./actions/smssettings.php 114
--        if ($confirm->find(TRUE)) {
-+        if ($confirm->find(true)) {
-hunk ./actions/smssettings.php 168
--        if ($result === FALSE) {
-+        if ($result === false) {
-hunk ./actions/smssettings.php 218
--        if ($result === FALSE) {
-+        if ($result === false) {
-hunk ./actions/smssettings.php 232
--        $this->show_form($msg, TRUE);
-+        $this->show_form($msg, true);
-hunk ./actions/smssettings.php 260
--        $this->show_form(_('Confirmation cancelled.'), TRUE);
-+        $this->show_form(_('Confirmation cancelled.'), true);
-hunk ./actions/smssettings.php 290
--        $this->show_form(_('The address was removed.'), TRUE);
-+        $this->show_form(_('The address was removed.'), true);
-hunk ./actions/twitapifriendships.php 99
--        if ($sub->find(TRUE)) {
-+        if ($sub->find(true)) {
-hunk ./actions/twittersettings.php 291
--        $this->show_form(_('Twitter account removed.'), TRUE);
-+        $this->show_form(_('Twitter account removed.'), true);
-hunk ./actions/twittersettings.php 328
--        if ($result === FALSE) {
-+        if ($result === false) {
-hunk ./actions/userauthorization.php 214
--        common_debug('request token to look up: "'.print_r($rt,TRUE).'"');
-+        common_debug('request token to look up: "'.print_r($rt,true).'"');
-hunk ./actions/userauthorization.php 224
--        return FALSE;
-+        return false;
-hunk ./actions/userauthorization.php 280
--                return FALSE;
-+                return false;
-hunk ./actions/userauthorization.php 287
--                return FALSE;
-+                return false;
-hunk ./actions/userauthorization.php 292
--                return FALSE;
-+                return false;
-hunk ./actions/userauthorization.php 298
--                return FALSE;
-+                return false;
-hunk ./actions/userauthorization.php 314
--            return FALSE;
-+            return false;
-hunk ./actions/userauthorization.php 317
--        return TRUE;
-+        return true;
-hunk ./actions/userauthorization.php 443
--            if ($sub->find(TRUE)) {
-+            if ($sub->find(true)) {
-hunk ./classes/Foreign_link.php 38
--        if ($flink->find(TRUE)) {
-+        if ($flink->find(true)) {
-hunk ./classes/Foreign_link.php 51
--        if ($flink->find(TRUE)) {
-+        if ($flink->find(true)) {
-hunk ./classes/Foreign_link.php 67
--        if ($fuser->find(TRUE)) {
-+        if ($fuser->find(true)) {
-hunk ./classes/Notice.php 324
--        $needAnd = FALSE;
--        $needWhere = TRUE;
-+        $needAnd = false;
-+        $needWhere = true;
-hunk ./classes/Notice.php 328
--            $needWhere = FALSE;
--            $needAnd = TRUE;
-+            $needWhere = false;
-+            $needAnd = true;
-hunk ./classes/Notice.php 336
--                $needWhere = FALSE;
-+                $needWhere = false;
-hunk ./classes/Notice.php 348
--                $needWhere = FALSE;
-+                $needWhere = false;
-hunk ./classes/Notice.php 360
--                $needWhere = FALSE;
-+                $needWhere = false;
-hunk ./classes/Notice.php 414
--        if ($notices !== FALSE) {
-+        if ($notices !== false) {
-hunk ./classes/Queue_item.php 37
--        $cnt = $qi->find(TRUE);
-+        $cnt = $qi->find(true);
-hunk ./classes/User.php 202
--            return FALSE;
-+            return false;
-hunk ./classes/User.php 236
--            return FALSE;
-+            return false;
-hunk ./classes/User.php 250
--            return FALSE;
-+            return false;
-hunk ./classes/User.php 264
--                return FALSE;
-+                return false;
-hunk ./lib/oauthstore.php 62
--        if ($n->find(TRUE)) {
--            return TRUE;
-+        if ($n->find(true)) {
-+            return true;
-hunk ./lib/oauthstore.php 68
--            return FALSE;
-+            return false;
+hunk ./actions/accesstoken.php 24
+-class AccesstokenAction extends Action {
++class AccesstokenAction extends Action
++{
+hunk ./actions/all.php 24
+-class AllAction extends StreamAction {
++class AllAction extends StreamAction
++{
+hunk ./actions/allrss.php 26
+-class AllrssAction extends Rss10Action {
++class AllrssAction extends Rss10Action
++{
+hunk ./actions/api.php 22
+-class ApiAction extends Action {
++class ApiAction extends Action
++{
+hunk ./actions/avatarbynickname.php 22
+-class AvatarbynicknameAction extends Action {
++class AvatarbynicknameAction extends Action
++{
+hunk ./actions/block.php 22
+-class BlockAction extends Action {
++class BlockAction extends Action
++{
+hunk ./actions/confirmaddress.php 22
+-class ConfirmaddressAction extends Action {
++class ConfirmaddressAction extends Action
++{
+hunk ./actions/deletenotice.php 24
+-class DeletenoticeAction extends DeleteAction {
++class DeletenoticeAction extends DeleteAction
++{
+hunk ./actions/deleteprofile.php 22
+-class DeleteprofileAction extends Action {
++class DeleteprofileAction extends Action
++{
+hunk ./actions/disfavor.php 22
+-class DisfavorAction extends Action {
++class DisfavorAction extends Action
++{
+hunk ./actions/doc.php 22
+-class DocAction extends Action {
++class DocAction extends Action
++{
+hunk ./actions/emailsettings.php 24
+-class EmailsettingsAction extends SettingsAction {
++class EmailsettingsAction extends SettingsAction
++{
+hunk ./actions/facebookhome.php 24
+-class FacebookhomeAction extends FacebookAction {
++class FacebookhomeAction extends FacebookAction
++{
+hunk ./actions/facebookinvite.php 24
+-class FacebookinviteAction extends FacebookAction {
++class FacebookinviteAction extends FacebookAction
++{
+hunk ./actions/facebookremove.php 24
+-class FacebookremoveAction extends FacebookAction {
++class FacebookremoveAction extends FacebookAction
++{
+hunk ./actions/facebooksettings.php 24
+-class FacebooksettingsAction extends FacebookAction {
++class FacebooksettingsAction extends FacebookAction
++{
+hunk ./actions/favor.php 24
+-class FavorAction extends Action {
++class FavorAction extends Action
++{
+hunk ./actions/favorited.php 24
+-class FavoritedAction extends StreamAction {
++class FavoritedAction extends StreamAction
++{
+hunk ./actions/favoritesrss.php 26
+-class FavoritesrssAction extends Rss10Action {
++class FavoritesrssAction extends Rss10Action
++{
+hunk ./actions/featured.php 25
+-class FeaturedAction extends StreamAction {
++class FeaturedAction extends StreamAction
++{
+hunk ./actions/finishaddopenid.php 24
+-class FinishaddopenidAction extends Action {
++class FinishaddopenidAction extends Action
++{
+hunk ./actions/finishimmediate.php 24
+-class FinishimmediateAction extends Action {
++class FinishimmediateAction extends Action
++{
+hunk ./actions/finishopenidlogin.php 24
+-class FinishopenidloginAction extends Action {
++class FinishopenidloginAction extends Action
++{
+hunk ./actions/finishremotesubscribe.php 24
+-class FinishremotesubscribeAction extends Action {
++class FinishremotesubscribeAction extends Action
++{
+hunk ./actions/foaf.php 26
+-class FoafAction extends Action {
++class FoafAction extends Action
++{
+hunk ./actions/imsettings.php 25
+-class ImsettingsAction extends SettingsAction {
++class ImsettingsAction extends SettingsAction
++{
+hunk ./actions/invite.php 22
+-class InviteAction extends Action {
++class InviteAction extends Action
++{
+hunk ./actions/login.php 22
+-class LoginAction extends Action {
++class LoginAction extends Action
++{
+hunk ./actions/logout.php 24
+-class LogoutAction extends Action {
++class LogoutAction extends Action
++{
+hunk ./actions/microsummary.php 22
+-class MicrosummaryAction extends Action {
++class MicrosummaryAction extends Action
++{
+hunk ./actions/newmessage.php 22
+-class NewmessageAction extends Action {
++class NewmessageAction extends Action
++{
+hunk ./actions/newnotice.php 24
+-class NewnoticeAction extends Action {
++class NewnoticeAction extends Action
++{
+hunk ./actions/noticesearch.php 26
+-class NoticesearchAction extends SearchAction {
++class NoticesearchAction extends SearchAction
++{
+hunk ./actions/noticesearchrss.php 26
+-class NoticesearchrssAction extends Rss10Action {
++class NoticesearchrssAction extends Rss10Action
++{
+hunk ./actions/nudge.php 24
+-class NudgeAction extends Action {
++class NudgeAction extends Action
++{
+hunk ./actions/openidlogin.php 24
+-class OpenidloginAction extends Action {
++class OpenidloginAction extends Action
++{
+hunk ./actions/openidsettings.php 25
+-class OpenidsettingsAction extends SettingsAction {
++class OpenidsettingsAction extends SettingsAction
++{
+hunk ./actions/opensearch.php 22
+-class OpensearchAction extends Action {
++class OpensearchAction extends Action
++{
+hunk ./actions/othersettings.php 24
+-class OthersettingsAction extends SettingsAction {
++class OthersettingsAction extends SettingsAction
++{
+hunk ./actions/peoplesearch.php 25
+-class PeoplesearchAction extends SearchAction {
++class PeoplesearchAction extends SearchAction
++{
+hunk ./actions/peoplesearch.php 73
+-class PeopleSearchResults extends ProfileList {
++class PeopleSearchResults extends ProfileList
++{
+hunk ./actions/peopletag.php 24
+-class PeopletagAction extends Action {
++class PeopletagAction extends Action
++{
+hunk ./actions/postnotice.php 24
+-class PostnoticeAction extends Action {
++class PostnoticeAction extends Action
++{
+hunk ./actions/profilesettings.php 24
+-class ProfilesettingsAction extends SettingsAction {
++class ProfilesettingsAction extends SettingsAction
++{
+hunk ./actions/public.php 24
+-class PublicAction extends StreamAction {
++class PublicAction extends StreamAction
++{
+hunk ./actions/publicrss.php 26
+-class PublicrssAction extends Rss10Action {
++class PublicrssAction extends Rss10Action
++{
+hunk ./actions/publicxrds.php 26
+-class PublicxrdsAction extends Action {
++class PublicxrdsAction extends Action
++{
+hunk ./actions/recoverpassword.php 26
+-class RecoverpasswordAction extends Action {
++class RecoverpasswordAction extends Action
++{
+hunk ./actions/register.php 22
+-class RegisterAction extends Action {
++class RegisterAction extends Action
++{
+hunk ./actions/remotesubscribe.php 24
+-class RemotesubscribeAction extends Action {
++class RemotesubscribeAction extends Action
++{
+hunk ./actions/replies.php 24
+-class RepliesAction extends StreamAction {
++class RepliesAction extends StreamAction
++{
+hunk ./actions/repliesrss.php 26
+-class RepliesrssAction extends Rss10Action {
++class RepliesrssAction extends Rss10Action
++{
+hunk ./actions/requesttoken.php 24
+-class RequesttokenAction extends Action {
++class RequesttokenAction extends Action
++{
+hunk ./actions/showfavorites.php 24
+-class ShowfavoritesAction extends StreamAction {
++class ShowfavoritesAction extends StreamAction
++{
+hunk ./actions/showmessage.php 24
+-class ShowmessageAction extends MailboxAction {
++class ShowmessageAction extends MailboxAction
++{
+hunk ./actions/shownotice.php 24
+-class ShownoticeAction extends StreamAction {
++class ShownoticeAction extends StreamAction
++{
+hunk ./actions/showstream.php 27
+-class ShowstreamAction extends StreamAction {
++class ShowstreamAction extends StreamAction
++{
+hunk ./actions/showstream.php 453
+-class ProfileNoticeList extends NoticeList {
++class ProfileNoticeList extends NoticeList
++{
+hunk ./actions/showstream.php 461
+-class ProfileNoticeListItem extends NoticeListItem {
++class ProfileNoticeListItem extends NoticeListItem
++{
+hunk ./actions/smssettings.php 25
+-class SmssettingsAction extends EmailsettingsAction {
++class SmssettingsAction extends EmailsettingsAction
++{
+hunk ./actions/subedit.php 22
+-class SubeditAction extends Action {
++class SubeditAction extends Action
++{
+hunk ./actions/subscribe.php 22
+-class SubscribeAction extends Action {
++class SubscribeAction extends Action
++{
+hunk ./actions/subscribers.php 24
+-class SubscribersAction extends GalleryAction {
++class SubscribersAction extends GalleryAction
++{
+hunk ./actions/subscribers.php 63
+-class SubscribersList extends ProfileList {
++class SubscribersList extends ProfileList
++{
+hunk ./actions/subscriptions.php 24
+-class SubscriptionsAction extends GalleryAction {
++class SubscriptionsAction extends GalleryAction
++{
+hunk ./actions/subscriptions.php 63
+-class SubscriptionsList extends ProfileList {
++class SubscriptionsList extends ProfileList
++{
+hunk ./actions/sup.php 22
+-class SupAction extends Action {
++class SupAction extends Action
++{
+hunk ./actions/tag.php 25
+-class TagAction extends StreamAction {
++class TagAction extends StreamAction
++{
+hunk ./actions/tagother.php 24
+-class TagotherAction extends Action {
++class TagotherAction extends Action
++{
+hunk ./actions/tagrss.php 26
+-class TagrssAction extends Rss10Action {
++class TagrssAction extends Rss10Action
++{
+hunk ./actions/twitapiaccount.php 24
+-class TwitapiaccountAction extends TwitterapiAction {
++class TwitapiaccountAction extends TwitterapiAction
++{
+hunk ./actions/twitapiblocks.php 24
+-class TwitapiblocksAction extends TwitterapiAction {
++class TwitapiblocksAction extends TwitterapiAction
++{
+hunk ./actions/twitapidirect_messages.php 24
+-class Twitapidirect_messagesAction extends TwitterapiAction {
++class Twitapidirect_messagesAction extends TwitterapiAction
++{
+hunk ./actions/twitapifavorites.php 24
+-class TwitapifavoritesAction extends TwitterapiAction {
++class TwitapifavoritesAction extends TwitterapiAction
++{
+hunk ./actions/twitapifriendships.php 24
+-class TwitapifriendshipsAction extends TwitterapiAction {
++class TwitapifriendshipsAction extends TwitterapiAction
++{
+hunk ./actions/twitapihelp.php 24
+-class TwitapihelpAction extends TwitterapiAction {
++class TwitapihelpAction extends TwitterapiAction
++{
+hunk ./actions/twitapinotifications.php 25
+-class TwitapinotificationsAction extends TwitterapiAction {
++class TwitapinotificationsAction extends TwitterapiAction
++{
+hunk ./actions/twitapistatuses.php 24
+-class TwitapistatusesAction extends TwitterapiAction {
++class TwitapistatusesAction extends TwitterapiAction
++{
+hunk ./actions/twitapiusers.php 24
+-class TwitapiusersAction extends TwitterapiAction {
++class TwitapiusersAction extends TwitterapiAction
++{
+hunk ./actions/twittersettings.php 26
+-class TwittersettingsAction extends SettingsAction {
++class TwittersettingsAction extends SettingsAction
++{
+hunk ./actions/unblock.php 22
+-class UnblockAction extends Action {
++class UnblockAction extends Action
++{
+hunk ./actions/unsubscribe.php 20
+-class UnsubscribeAction extends Action {
++class UnsubscribeAction extends Action
++{
+hunk ./actions/updateprofile.php 24
+-class UpdateprofileAction extends Action {
++class UpdateprofileAction extends Action
++{
+hunk ./actions/userauthorization.php 25
+-class UserauthorizationAction extends Action {
++class UserauthorizationAction extends Action
++{
+hunk ./actions/userbyid.php 22
+-class UserbyidAction extends Action {
++class UserbyidAction extends Action
++{
+hunk ./actions/userrss.php 26
+-class UserrssAction extends Rss10Action {
++class UserrssAction extends Rss10Action
++{
+hunk ./actions/xrds.php 24
+-class XrdsAction extends Action {
++class XrdsAction extends Action
++{
+hunk ./classes/Channel.php 22
+-class Channel {
++class Channel
++{
+hunk ./classes/Channel.php 51
+-class XMPPChannel extends Channel {
++class XMPPChannel extends Channel
++{
+hunk ./classes/Channel.php 109
+-class WebChannel extends Channel {
++class WebChannel extends Channel
++{
+hunk ./classes/Channel.php 144
+-class AjaxWebChannel extends WebChannel {
++class AjaxWebChannel extends WebChannel
++{
+hunk ./classes/Channel.php 173
+-class MailChannel extends Channel {
++class MailChannel extends Channel
++{
+hunk ./classes/Command.php 24
+-class Command {
++class Command
++{
+hunk ./classes/Command.php 40
+-class UnimplementedCommand extends Command {
++class UnimplementedCommand extends Command
++{
+hunk ./classes/Command.php 48
+-class TrackingCommand extends UnimplementedCommand {
++class TrackingCommand extends UnimplementedCommand
++{
+hunk ./classes/Command.php 52
+-class TrackOffCommand extends UnimplementedCommand {
++class TrackOffCommand extends UnimplementedCommand
++{
+hunk ./classes/Command.php 56
+-class TrackCommand extends UnimplementedCommand {
++class TrackCommand extends UnimplementedCommand
++{
+hunk ./classes/Command.php 66
+-class UntrackCommand extends UnimplementedCommand {
++class UntrackCommand extends UnimplementedCommand
++{
+hunk ./classes/Command.php 76
+-class NudgeCommand extends UnimplementedCommand {
++class NudgeCommand extends UnimplementedCommand
++{
+hunk ./classes/Command.php 86
+-class InviteCommand extends UnimplementedCommand {
++class InviteCommand extends UnimplementedCommand
++{
+hunk ./classes/Command.php 96
+-class StatsCommand extends Command {
++class StatsCommand extends Command
++{
+hunk ./classes/Command.php 122
+-class FavCommand extends Command {
++class FavCommand extends Command
++{
+hunk ./classes/Command.php 170
+-class WhoisCommand extends Command {
++class WhoisCommand extends Command
++{
+hunk ./classes/Command.php 207
+-class MessageCommand extends Command {
++class MessageCommand extends Command
++{
+hunk ./classes/Command.php 252
+-class GetCommand extends Command {
++class GetCommand extends Command
++{
+hunk ./classes/Command.php 285
+-class SubCommand extends Command {
++class SubCommand extends Command
++{
+hunk ./classes/Command.php 314
+-class UnsubCommand extends Command {
++class UnsubCommand extends Command
++{
+hunk ./classes/Command.php 342
+-class OffCommand extends Command {
++class OffCommand extends Command
++{
+hunk ./classes/Command.php 364
+-class OnCommand extends Command {
++class OnCommand extends Command
++{
+hunk ./classes/Command.php 387
+-class HelpCommand extends Command {
++class HelpCommand extends Command
++{
+hunk ./classes/CommandInterpreter.php 24
+-class CommandInterpreter {
++class CommandInterpreter
++{
+hunk ./classes/NoticeWrapper.php 24
+-class NoticeWrapper extends Notice {
++class NoticeWrapper extends Notice
++{
+hunk ./lib/Shorturl_api.php 22
+-class ShortUrlApi {
++class ShortUrlApi
++{
+hunk ./lib/Shorturl_api.php 73
+-class LilUrl extends ShortUrlApi {
++class LilUrl extends ShortUrlApi
++{
+hunk ./lib/Shorturl_api.php 93
+-class PtitUrl extends ShortUrlApi {
++class PtitUrl extends ShortUrlApi
++{
+hunk ./lib/Shorturl_api.php 112
+-class TightUrl extends ShortUrlApi {
++class TightUrl extends ShortUrlApi
++{
+hunk ./lib/deleteaction.php 22
+-class DeleteAction extends Action {
++class DeleteAction extends Action
++{
+hunk ./lib/facebookaction.php 24
+-class FacebookAction extends Action {
++class FacebookAction extends Action
++{
+hunk ./lib/oauthstore.php 24
+-class LaconicaOAuthDataStore extends OAuthDataStore {
++class LaconicaOAuthDataStore extends OAuthDataStore
++{
+hunk ./lib/oauthstore.php 27
+-    # We keep a record of who's contacted us
++    // We keep a record of who's contacted us
+hunk ./lib/oauthstore.php 79
+-        $t->type = 0; # request
+-        $t->state = 0; # unauthorized
++        $t->type = 0; // request
++        $t->state = 0; // unauthorized
+hunk ./lib/oauthstore.php 89
+-    # defined in OAuthDataStore, but not implemented anywhere
++    // defined in OAuthDataStore, but not implemented anywhere
 hunk ./lib/oauthstore.php 102
--        if ($rt->find(TRUE) && $rt->state == 1) { # authorized
-+        if ($rt->find(true) && $rt->state == 1) { # authorized
-hunk ./lib/omb.php 142
--                $posted[$rp->postnoticeurl] = TRUE;
-+                $posted[$rp->postnoticeurl] = true;
-hunk ./lib/omb.php 211
--    common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__);
-+    common_debug('Got HTTP result "'.print_r($result,true).'"', __FILE__);
-hunk ./lib/omb.php 244
--                        $updated[$rp->updateprofileurl] = TRUE;
-+                        $updated[$rp->updateprofileurl] = true;
-hunk ./lib/omb.php 296
--    common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__);
-+    common_debug('Got HTTP result "'.print_r($result,true).'"', __FILE__);
-hunk ./lib/util.php 439
--function common_dropdown($id, $label, $content, $instructions=null, $blank_select=FALSE, $selected=null)
-+function common_dropdown($id, $label, $content, $instructions=null, $blank_select=false, $selected=null)
-hunk ./lib/util.php 1021
--    if ($recipient->find(TRUE)) {
-+    if ($recipient->find(true)) {
-hunk ./lib/util.php 1031
--    if ($recipient->find(TRUE)) {
-+    if ($recipient->find(true)) {
-hunk ./lib/util.php 2261
--    common_dropdown('to', _('To'), $mutual, null, FALSE, $to->id);
-+    common_dropdown('to', _('To'), $mutual, null, false, $to->id);
-hunk ./scripts/sitemap.php 334
--        if (is_writable($output_dir) === FALSE) {
-+        if (is_writable($output_dir) === false) {
-hunk ./scripts/sitemap.php 369
--    if (($fh_out = fopen($path,'w')) === FALSE) {
-+    if (($fh_out = fopen($path,'w')) === false) {
-hunk ./scripts/sitemap.php 373
--    if (fwrite($fh_out, $data) === FALSE) {
-+    if (fwrite($fh_out, $data) === false) {
-hunk ./scripts/xmppconfirmhandler.php 113
--        if ($confirm->find(TRUE)) {
-+        if ($confirm->find(true)) {
+-        $rt->type = 0; # request
+-        if ($rt->find(true) && $rt->state == 1) { # authorized
++        $rt->type = 0; // request
++        if ($rt->find(true) && $rt->state == 1) { // authorized
+hunk ./lib/oauthstore.php 109
+-            $at->type = 1; # access
++            $at->type = 1; // access
+hunk ./lib/oauthstore.php 117
+-                # burn the old one
++                // burn the old one
+hunk ./lib/oauthstore.php 119
+-                $rt->state = 2; # used
++                $rt->state = 2; // used
+hunk ./lib/oauthstore.php 124
+-                # Update subscription
+-                # XXX: mixing levels here
++                // Update subscription
++                // XXX: mixing levels here
+hunk ./lib/oauthstore.php 146
+-    # defined in OAuthDataStore, but not implemented anywhere
++    // defined in OAuthDataStore, but not implemented anywhere
+hunk ./lib/personal.php 22
+-class PersonalAction extends Action {
++class PersonalAction extends Action
++{
+hunk ./lib/profilelist.php 25
+-class ProfileList {
++class ProfileList
++{
+hunk ./lib/queuehandler.php 28
+-class QueueHandler extends Daemon {
++class QueueHandler extends Daemon
++{
+hunk ./lib/rssaction.php 24
+-class Rss10Action extends Action {
++class Rss10Action extends Action
++{
+hunk ./lib/search_engines.php 22
+-class SearchEngine {
++class SearchEngine
++{
+hunk ./lib/search_engines.php 49
+-class SphinxSearch extends SearchEngine {
++class SphinxSearch extends SearchEngine
++{
+hunk ./lib/search_engines.php 108
+-class MySQLSearch extends SearchEngine {
++class MySQLSearch extends SearchEngine
++{
+hunk ./lib/search_engines.php 121
+-class PGSearch extends SearchEngine {
++class PGSearch extends SearchEngine
++{
+hunk ./lib/searchaction.php 22
+-class SearchAction extends Action {
++class SearchAction extends Action
++{
+hunk ./lib/settingsaction.php 22
+-class SettingsAction extends Action {
++class SettingsAction extends Action
++{
+hunk ./lib/stream.php 25
+-class StreamAction extends PersonalAction {
++class StreamAction extends PersonalAction
++{
+hunk ./lib/twitterapi.php 22
+-class TwitterapiAction extends Action {
++class TwitterapiAction extends Action
++{
+hunk ./lib/xmppqueuehandler.php 31
+-class XmppQueueHandler extends QueueHandler {
++class XmppQueueHandler extends QueueHandler
++{
+hunk ./scripts/enjitqueuehandler.php 36
+-class EnjitQueueHandler extends QueueHandler {
++class EnjitQueueHandler extends QueueHandler
++{
+hunk ./scripts/jabberqueuehandler.php 36
+-class JabberQueueHandler extends XmppQueueHandler {
++class JabberQueueHandler extends XmppQueueHandler
++{
+hunk ./scripts/maildaemon.php 37
+-class MailerDaemon {
++class MailerDaemon
++{
+hunk ./scripts/ombqueuehandler.php 36
+-class OmbQueueHandler extends QueueHandler {
++class OmbQueueHandler extends QueueHandler
++{
+hunk ./scripts/publicqueuehandler.php 36
+-class PublicQueueHandler extends XmppQueueHandler {
++class PublicQueueHandler extends XmppQueueHandler
++{
+hunk ./scripts/smsqueuehandler.php 36
+-class SmsQueueHandler extends QueueHandler {
++class SmsQueueHandler extends QueueHandler
++{
+hunk ./scripts/xmppconfirmhandler.php 38
+-class XmppConfirmHandler extends XmppQueueHandler {
++class XmppConfirmHandler extends XmppQueueHandler
++{
+hunk ./scripts/xmppdaemon.php 40
+-class XMPPDaemon extends Daemon {
++class XMPPDaemon extends Daemon
++{
diff --git a/actions/accesstoken.php b/actions/accesstoken.php
index cab5425bf..072ce27eb 100644
--- a/actions/accesstoken.php
+++ b/actions/accesstoken.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class AccesstokenAction extends Action {
+class AccesstokenAction extends Action
+{
     function handle($args)
     {
         parent::handle($args);
diff --git a/actions/all.php b/actions/all.php
index 028a3679a..526ac5f40 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/actions/showstream.php');
 
-class AllAction extends StreamAction {
+class AllAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/actions/allrss.php b/actions/allrss.php
index 9c20cd416..660afb9e2 100644
--- a/actions/allrss.php
+++ b/actions/allrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class AllrssAction extends Rss10Action {
+class AllrssAction extends Rss10Action
+{
 
     var $user = null;
 
diff --git a/actions/api.php b/actions/api.php
index 8ccd86f0b..dfdefe3b0 100644
--- a/actions/api.php
+++ b/actions/api.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class ApiAction extends Action {
+class ApiAction extends Action
+{
 
     var $user;
     var $content_type;
diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php
index 4aeb4112a..666f386f6 100644
--- a/actions/avatarbynickname.php
+++ b/actions/avatarbynickname.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class AvatarbynicknameAction extends Action {
+class AvatarbynicknameAction extends Action
+{
     function handle($args)
     {
         parent::handle($args);
diff --git a/actions/block.php b/actions/block.php
index 702adcffa..c1ff7c044 100644
--- a/actions/block.php
+++ b/actions/block.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class BlockAction extends Action {
+class BlockAction extends Action
+{
 
     var $profile = null;
 
diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php
index d926864a6..1d5c53ff2 100644
--- a/actions/confirmaddress.php
+++ b/actions/confirmaddress.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class ConfirmaddressAction extends Action {
+class ConfirmaddressAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/deletenotice.php b/actions/deletenotice.php
index 4f00db617..e9b4b3254 100644
--- a/actions/deletenotice.php
+++ b/actions/deletenotice.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/deleteaction.php');
 
-class DeletenoticeAction extends DeleteAction {
+class DeletenoticeAction extends DeleteAction
+{
     function handle($args)
     {
         parent::handle($args);
diff --git a/actions/deleteprofile.php b/actions/deleteprofile.php
index b1c346cb2..e12fe131a 100644
--- a/actions/deleteprofile.php
+++ b/actions/deleteprofile.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class DeleteprofileAction extends Action {
+class DeleteprofileAction extends Action
+{
     function handle($args)
     {
         parent::handle($args);
diff --git a/actions/disfavor.php b/actions/disfavor.php
index f0b528453..74aae86cc 100644
--- a/actions/disfavor.php
+++ b/actions/disfavor.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class DisfavorAction extends Action {
+class DisfavorAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/doc.php b/actions/doc.php
index 441ac19a7..856025e66 100644
--- a/actions/doc.php
+++ b/actions/doc.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class DocAction extends Action {
+class DocAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/emailsettings.php b/actions/emailsettings.php
index 7f08efd29..3fa8ce296 100644
--- a/actions/emailsettings.php
+++ b/actions/emailsettings.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 
-class EmailsettingsAction extends SettingsAction {
+class EmailsettingsAction extends SettingsAction
+{
 
     function get_instructions()
     {
diff --git a/actions/facebookhome.php b/actions/facebookhome.php
index 006f35eca..dcdb102e6 100644
--- a/actions/facebookhome.php
+++ b/actions/facebookhome.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/facebookaction.php');
 
-class FacebookhomeAction extends FacebookAction {
+class FacebookhomeAction extends FacebookAction
+{
 
     function handle($args)
     {
diff --git a/actions/facebookinvite.php b/actions/facebookinvite.php
index fc226e65a..48a820e44 100644
--- a/actions/facebookinvite.php
+++ b/actions/facebookinvite.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/facebookaction.php');
 
-class FacebookinviteAction extends FacebookAction {
+class FacebookinviteAction extends FacebookAction
+{
 
     function handle($args)
     {
diff --git a/actions/facebookremove.php b/actions/facebookremove.php
index 79dc32e49..a200fefbf 100644
--- a/actions/facebookremove.php
+++ b/actions/facebookremove.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/facebookaction.php');
 
-class FacebookremoveAction extends FacebookAction {
+class FacebookremoveAction extends FacebookAction
+{
 
     function handle($args)
     {
diff --git a/actions/facebooksettings.php b/actions/facebooksettings.php
index 03ad57813..38542d4b6 100644
--- a/actions/facebooksettings.php
+++ b/actions/facebooksettings.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/facebookaction.php');
 
-class FacebooksettingsAction extends FacebookAction {
+class FacebooksettingsAction extends FacebookAction
+{
 
     function handle($args)
     {
diff --git a/actions/favor.php b/actions/favor.php
index 3ec4af0b5..8103f8181 100644
--- a/actions/favor.php
+++ b/actions/favor.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/mail.php');
 
-class FavorAction extends Action {
+class FavorAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/favorited.php b/actions/favorited.php
index d479e1b3e..71a9e026e 100644
--- a/actions/favorited.php
+++ b/actions/favorited.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/stream.php');
 
-class FavoritedAction extends StreamAction {
+class FavoritedAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/actions/favoritesrss.php b/actions/favoritesrss.php
index aa8a3c6f4..8c7ce52bf 100644
--- a/actions/favoritesrss.php
+++ b/actions/favoritesrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class FavoritesrssAction extends Rss10Action {
+class FavoritesrssAction extends Rss10Action
+{
 
     var $user = null;
     
diff --git a/actions/featured.php b/actions/featured.php
index 1763adeab..2bf8b0b81 100644
--- a/actions/featured.php
+++ b/actions/featured.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/stream.php');
 require_once(INSTALLDIR.'/lib/profilelist.php');
 
-class FeaturedAction extends StreamAction {
+class FeaturedAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/actions/finishaddopenid.php b/actions/finishaddopenid.php
index d8409b6e9..0ce1680aa 100644
--- a/actions/finishaddopenid.php
+++ b/actions/finishaddopenid.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/openid.php');
 
-class FinishaddopenidAction extends Action {
+class FinishaddopenidAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/finishimmediate.php b/actions/finishimmediate.php
index c4a1c1af9..0964c39f4 100644
--- a/actions/finishimmediate.php
+++ b/actions/finishimmediate.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/openid.php');
 
-class FinishimmediateAction extends Action {
+class FinishimmediateAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php
index eb52d73b1..bdb8516a3 100644
--- a/actions/finishopenidlogin.php
+++ b/actions/finishopenidlogin.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/openid.php');
 
-class FinishopenidloginAction extends Action {
+class FinishopenidloginAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/finishremotesubscribe.php b/actions/finishremotesubscribe.php
index 5aace4fa9..cee3a1818 100644
--- a/actions/finishremotesubscribe.php
+++ b/actions/finishremotesubscribe.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class FinishremotesubscribeAction extends Action {
+class FinishremotesubscribeAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/foaf.php b/actions/foaf.php
index 27548bfff..30e98960c 100644
--- a/actions/foaf.php
+++ b/actions/foaf.php
@@ -23,7 +23,8 @@ define('LISTENER', 1);
 define('LISTENEE', -1);
 define('BOTH', 0);
 
-class FoafAction extends Action {
+class FoafAction extends Action
+{
 
     function is_readonly()
     {
diff --git a/actions/imsettings.php b/actions/imsettings.php
index 56fb14758..8ecf200ec 100644
--- a/actions/imsettings.php
+++ b/actions/imsettings.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 require_once(INSTALLDIR.'/lib/jabber.php');
 
-class ImsettingsAction extends SettingsAction {
+class ImsettingsAction extends SettingsAction
+{
 
     function get_instructions()
     {
diff --git a/actions/invite.php b/actions/invite.php
index b0fc79958..80e022a3d 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class InviteAction extends Action {
+class InviteAction extends Action
+{
 
     function is_readonly()
     {
diff --git a/actions/login.php b/actions/login.php
index 6ad07b610..8600d44fd 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class LoginAction extends Action {
+class LoginAction extends Action
+{
 
     function is_readonly()
     {
diff --git a/actions/logout.php b/actions/logout.php
index effb5abbe..201378730 100644
--- a/actions/logout.php
+++ b/actions/logout.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/openid.php');
 
-class LogoutAction extends Action {
+class LogoutAction extends Action
+{
     
     function is_readonly()
     {
diff --git a/actions/microsummary.php b/actions/microsummary.php
index a19a26dcf..13ddc4e3e 100644
--- a/actions/microsummary.php
+++ b/actions/microsummary.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class MicrosummaryAction extends Action {
+class MicrosummaryAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/newmessage.php b/actions/newmessage.php
index 0a537ad2d..27fa9d518 100644
--- a/actions/newmessage.php
+++ b/actions/newmessage.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class NewmessageAction extends Action {
+class NewmessageAction extends Action
+{
     
     function handle($args)
     {
diff --git a/actions/newnotice.php b/actions/newnotice.php
index 1f6117c1e..c412e893d 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once INSTALLDIR . '/lib/noticelist.php';
 
-class NewnoticeAction extends Action {
+class NewnoticeAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/noticesearch.php b/actions/noticesearch.php
index 782c8fe98..b36fc8ad2 100644
--- a/actions/noticesearch.php
+++ b/actions/noticesearch.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/searchaction.php');
 
 # XXX common parent for people and content search?
 
-class NoticesearchAction extends SearchAction {
+class NoticesearchAction extends SearchAction
+{
 
     function get_instructions()
     {
diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php
index c41d34873..20fe0ff2a 100644
--- a/actions/noticesearchrss.php
+++ b/actions/noticesearchrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class NoticesearchrssAction extends Rss10Action {
+class NoticesearchrssAction extends Rss10Action
+{
 
     function init()
     {
diff --git a/actions/nudge.php b/actions/nudge.php
index e0268e9d0..a6480a582 100644
--- a/actions/nudge.php
+++ b/actions/nudge.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/mail.php');
 
-class NudgeAction extends Action {
+class NudgeAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/openidlogin.php b/actions/openidlogin.php
index b8681215e..09679e372 100644
--- a/actions/openidlogin.php
+++ b/actions/openidlogin.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/openid.php');
 
-class OpenidloginAction extends Action {
+class OpenidloginAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/openidsettings.php b/actions/openidsettings.php
index ce4143d41..039236048 100644
--- a/actions/openidsettings.php
+++ b/actions/openidsettings.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 require_once(INSTALLDIR.'/lib/openid.php');
 
-class OpenidsettingsAction extends SettingsAction {
+class OpenidsettingsAction extends SettingsAction
+{
 
     function get_instructions()
     {
diff --git a/actions/opensearch.php b/actions/opensearch.php
index f9c6f4c57..96691fa6f 100644
--- a/actions/opensearch.php
+++ b/actions/opensearch.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class OpensearchAction extends Action {
+class OpensearchAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/othersettings.php b/actions/othersettings.php
index dc1bcd02b..c2f08934c 100644
--- a/actions/othersettings.php
+++ b/actions/othersettings.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 
-class OthersettingsAction extends SettingsAction {
+class OthersettingsAction extends SettingsAction
+{
 
     function get_instructions()
     {
diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php
index 6d3f6a73f..0d0fae4e5 100644
--- a/actions/peoplesearch.php
+++ b/actions/peoplesearch.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/searchaction.php');
 require_once(INSTALLDIR.'/lib/profilelist.php');
 
-class PeoplesearchAction extends SearchAction {
+class PeoplesearchAction extends SearchAction
+{
 
     function get_instructions()
     {
@@ -69,7 +70,8 @@ class PeoplesearchAction extends SearchAction {
     }
 }
 
-class PeopleSearchResults extends ProfileList {
+class PeopleSearchResults extends ProfileList
+{
 
     var $terms = null;
     var $pattern = null;
diff --git a/actions/peopletag.php b/actions/peopletag.php
index c7e463026..13a0b7a41 100644
--- a/actions/peopletag.php
+++ b/actions/peopletag.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/profilelist.php');
 
-class PeopletagAction extends Action {
+class PeopletagAction extends Action
+{
     
     function handle($args)
     {
diff --git a/actions/postnotice.php b/actions/postnotice.php
index 8b0781dfd..dec62a678 100644
--- a/actions/postnotice.php
+++ b/actions/postnotice.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class PostnoticeAction extends Action {
+class PostnoticeAction extends Action
+{
     function handle($args)
     {
         parent::handle($args);
diff --git a/actions/profilesettings.php b/actions/profilesettings.php
index beb9979d0..6c22a7933 100644
--- a/actions/profilesettings.php
+++ b/actions/profilesettings.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 
-class ProfilesettingsAction extends SettingsAction {
+class ProfilesettingsAction extends SettingsAction
+{
 
     function get_instructions()
     {
diff --git a/actions/public.php b/actions/public.php
index 62be3da99..039e885e6 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/stream.php');
 
-class PublicAction extends StreamAction {
+class PublicAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/actions/publicrss.php b/actions/publicrss.php
index 8e554122e..822bc2db7 100644
--- a/actions/publicrss.php
+++ b/actions/publicrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class PublicrssAction extends Rss10Action {
+class PublicrssAction extends Rss10Action
+{
 
     function init()
     {
diff --git a/actions/publicxrds.php b/actions/publicxrds.php
index 63c80d81e..3d731d79f 100644
--- a/actions/publicxrds.php
+++ b/actions/publicxrds.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/openid.php');
 
 # XXX: factor out similarities with XrdsAction
 
-class PublicxrdsAction extends Action {
+class PublicxrdsAction extends Action
+{
 
     function is_readonly()
     {
diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php
index a482d4711..bb6ef81d6 100644
--- a/actions/recoverpassword.php
+++ b/actions/recoverpassword.php
@@ -23,7 +23,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 define(MAX_RECOVERY_TIME, 24 * 60 * 60);
 
-class RecoverpasswordAction extends Action {
+class RecoverpasswordAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/register.php b/actions/register.php
index 444e67e35..ac14879e2 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class RegisterAction extends Action {
+class RegisterAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php
index 02c026849..a9494772e 100644
--- a/actions/remotesubscribe.php
+++ b/actions/remotesubscribe.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class RemotesubscribeAction extends Action {
+class RemotesubscribeAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/replies.php b/actions/replies.php
index da2f27f31..eceeb4d65 100644
--- a/actions/replies.php
+++ b/actions/replies.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/actions/showstream.php');
 
-class RepliesAction extends StreamAction {
+class RepliesAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/actions/repliesrss.php b/actions/repliesrss.php
index 19ab0866a..5f85f8d2e 100644
--- a/actions/repliesrss.php
+++ b/actions/repliesrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class RepliesrssAction extends Rss10Action {
+class RepliesrssAction extends Rss10Action
+{
 
     var $user = null;
 
diff --git a/actions/requesttoken.php b/actions/requesttoken.php
index 091846756..a74548739 100644
--- a/actions/requesttoken.php
+++ b/actions/requesttoken.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class RequesttokenAction extends Action {
+class RequesttokenAction extends Action
+{
     
     function is_readonly()
     {
diff --git a/actions/showfavorites.php b/actions/showfavorites.php
index 8131cac67..f4344833d 100644
--- a/actions/showfavorites.php
+++ b/actions/showfavorites.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/actions/showstream.php');
 
-class ShowfavoritesAction extends StreamAction {
+class ShowfavoritesAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/actions/showmessage.php b/actions/showmessage.php
index b706fe2fa..25330a568 100644
--- a/actions/showmessage.php
+++ b/actions/showmessage.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/mailbox.php');
 
-class ShowmessageAction extends MailboxAction {
+class ShowmessageAction extends MailboxAction
+{
 
     function handle($args)
     {
diff --git a/actions/shownotice.php b/actions/shownotice.php
index abdaa72ca..2df09cb3f 100644
--- a/actions/shownotice.php
+++ b/actions/shownotice.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/stream.php');
 
-class ShownoticeAction extends StreamAction {
+class ShownoticeAction extends StreamAction
+{
 
     var $notice = null;
     var $profile = null;
diff --git a/actions/showstream.php b/actions/showstream.php
index c31bce87a..e4e5d96d1 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -24,7 +24,8 @@ require_once(INSTALLDIR.'/lib/stream.php');
 define('SUBSCRIPTIONS_PER_ROW', 4);
 define('SUBSCRIPTIONS', 80);
 
-class ShowstreamAction extends StreamAction {
+class ShowstreamAction extends StreamAction
+{
 
     function handle($args)
     {
@@ -449,14 +450,16 @@ class ShowstreamAction extends StreamAction {
 
 # We don't show the author for a profile, since we already know who it is!
 
-class ProfileNoticeList extends NoticeList {
+class ProfileNoticeList extends NoticeList
+{
     function newListItem($notice)
     {
         return new ProfileNoticeListItem($notice);
     }
 }
 
-class ProfileNoticeListItem extends NoticeListItem {
+class ProfileNoticeListItem extends NoticeListItem
+{
     function showAuthor()
     {
         return;
diff --git a/actions/smssettings.php b/actions/smssettings.php
index 444da2590..fad71135c 100644
--- a/actions/smssettings.php
+++ b/actions/smssettings.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 require_once(INSTALLDIR.'/actions/emailsettings.php');
 
-class SmssettingsAction extends EmailsettingsAction {
+class SmssettingsAction extends EmailsettingsAction
+{
 
     function get_instructions()
     {
diff --git a/actions/subedit.php b/actions/subedit.php
index 874102857..1142b7a03 100644
--- a/actions/subedit.php
+++ b/actions/subedit.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class SubeditAction extends Action {
+class SubeditAction extends Action
+{
 
     var $profile = null;
 
diff --git a/actions/subscribe.php b/actions/subscribe.php
index 93884f081..f33d1d207 100644
--- a/actions/subscribe.php
+++ b/actions/subscribe.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class SubscribeAction extends Action {
+class SubscribeAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/subscribers.php b/actions/subscribers.php
index 8c7805f51..31d0468d9 100644
--- a/actions/subscribers.php
+++ b/actions/subscribers.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/gallery.php');
 
-class SubscribersAction extends GalleryAction {
+class SubscribersAction extends GalleryAction
+{
 
     function gallery_type()
     {
@@ -59,7 +60,8 @@ class SubscribersAction extends GalleryAction {
     }
 }
 
-class SubscribersList extends ProfileList {
+class SubscribersList extends ProfileList
+{
     function show_owner_controls($profile)
     {
         common_block_form($profile, array('action' => 'subscribers',
diff --git a/actions/subscriptions.php b/actions/subscriptions.php
index ad4a3f9e5..afe8fb260 100644
--- a/actions/subscriptions.php
+++ b/actions/subscriptions.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/gallery.php');
 
-class SubscriptionsAction extends GalleryAction {
+class SubscriptionsAction extends GalleryAction
+{
 
     function gallery_type()
     {
@@ -59,7 +60,8 @@ class SubscriptionsAction extends GalleryAction {
     }
 }
 
-class SubscriptionsList extends ProfileList {
+class SubscriptionsList extends ProfileList
+{
 
     function show_owner_controls($profile)
     {
diff --git a/actions/sup.php b/actions/sup.php
index 2a139b322..6a1897585 100644
--- a/actions/sup.php
+++ b/actions/sup.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class SupAction extends Action {
+class SupAction extends Action
+{
     
     function handle($args)
     {
diff --git a/actions/tag.php b/actions/tag.php
index d7b35d613..8a3f90c16 100644
--- a/actions/tag.php
+++ b/actions/tag.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/actions/showstream.php');
 define('TAGS_PER_PAGE', 100);
 
-class TagAction extends StreamAction {
+class TagAction extends StreamAction
+{
 
     function handle($args)
     {
diff --git a/actions/tagother.php b/actions/tagother.php
index ed17ac531..ff6788cc6 100644
--- a/actions/tagother.php
+++ b/actions/tagother.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/settingsaction.php');
 
-class TagotherAction extends Action {
+class TagotherAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/tagrss.php b/actions/tagrss.php
index bb4edf473..912d71413 100644
--- a/actions/tagrss.php
+++ b/actions/tagrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class TagrssAction extends Rss10Action {
+class TagrssAction extends Rss10Action
+{
 
     function init()
     {
diff --git a/actions/twitapiaccount.php b/actions/twitapiaccount.php
index d5e9143c2..79e1ed990 100644
--- a/actions/twitapiaccount.php
+++ b/actions/twitapiaccount.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapiaccountAction extends TwitterapiAction {
+class TwitapiaccountAction extends TwitterapiAction
+{
 
     function verify_credentials($args, $apidata)
     {
diff --git a/actions/twitapiblocks.php b/actions/twitapiblocks.php
index 2170141f1..5d64f2f7d 100644
--- a/actions/twitapiblocks.php
+++ b/actions/twitapiblocks.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapiblocksAction extends TwitterapiAction {
+class TwitapiblocksAction extends TwitterapiAction
+{
 
     function create($args, $apidata)
     {
diff --git a/actions/twitapidirect_messages.php b/actions/twitapidirect_messages.php
index e9f7aa0bf..e0731f66f 100644
--- a/actions/twitapidirect_messages.php
+++ b/actions/twitapidirect_messages.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class Twitapidirect_messagesAction extends TwitterapiAction {
+class Twitapidirect_messagesAction extends TwitterapiAction
+{
 
     function direct_messages($args, $apidata)
     {
diff --git a/actions/twitapifavorites.php b/actions/twitapifavorites.php
index e7a43f770..55e04732f 100644
--- a/actions/twitapifavorites.php
+++ b/actions/twitapifavorites.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapifavoritesAction extends TwitterapiAction {
+class TwitapifavoritesAction extends TwitterapiAction
+{
 
     function favorites($args, $apidata)
     {
diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php
index 5eca96298..ba4afe441 100644
--- a/actions/twitapifriendships.php
+++ b/actions/twitapifriendships.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapifriendshipsAction extends TwitterapiAction {
+class TwitapifriendshipsAction extends TwitterapiAction
+{
 
     function create($args, $apidata)
     {
diff --git a/actions/twitapihelp.php b/actions/twitapihelp.php
index 27262f089..1b84cb11b 100644
--- a/actions/twitapihelp.php
+++ b/actions/twitapihelp.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapihelpAction extends TwitterapiAction {
+class TwitapihelpAction extends TwitterapiAction
+{
 
     /* Returns the string "ok" in the requested format with a 200 OK HTTP status code.
      * URL:http://identi.ca/api/help/test.format
diff --git a/actions/twitapinotifications.php b/actions/twitapinotifications.php
index e24d3829c..a19d652c3 100644
--- a/actions/twitapinotifications.php
+++ b/actions/twitapinotifications.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 # This naming convention looks real sick
-class TwitapinotificationsAction extends TwitterapiAction {
+class TwitapinotificationsAction extends TwitterapiAction
+{
 
     function follow($args, $apidata)
     {
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index f280184c0..e629d5cc4 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapistatusesAction extends TwitterapiAction {
+class TwitapistatusesAction extends TwitterapiAction
+{
 
     function public_timeline($args, $apidata)
     {
diff --git a/actions/twitapiusers.php b/actions/twitapiusers.php
index 4644e6be6..409986985 100644
--- a/actions/twitapiusers.php
+++ b/actions/twitapiusers.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapiusersAction extends TwitterapiAction {
+class TwitapiusersAction extends TwitterapiAction
+{
 
     function show($args, $apidata)
     {
diff --git a/actions/twittersettings.php b/actions/twittersettings.php
index 1f55b31b6..26dede0ac 100644
--- a/actions/twittersettings.php
+++ b/actions/twittersettings.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
 
 define('SUBSCRIPTIONS', 80);
 
-class TwittersettingsAction extends SettingsAction {
+class TwittersettingsAction extends SettingsAction
+{
 
     function get_instructions()
     {
diff --git a/actions/unblock.php b/actions/unblock.php
index 66ce0c879..112304f71 100644
--- a/actions/unblock.php
+++ b/actions/unblock.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class UnblockAction extends Action {
+class UnblockAction extends Action
+{
 
     var $profile = null;
 
diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php
index e4e04aaa0..1c2e13635 100644
--- a/actions/unsubscribe.php
+++ b/actions/unsubscribe.php
@@ -17,7 +17,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-class UnsubscribeAction extends Action {
+class UnsubscribeAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/updateprofile.php b/actions/updateprofile.php
index 2cfff1b51..abb034c81 100644
--- a/actions/updateprofile.php
+++ b/actions/updateprofile.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class UpdateprofileAction extends Action {
+class UpdateprofileAction extends Action
+{
     
     function handle($args)
     {
diff --git a/actions/userauthorization.php b/actions/userauthorization.php
index c73d515d3..05efbc16c 100644
--- a/actions/userauthorization.php
+++ b/actions/userauthorization.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/omb.php');
 define('TIMESTAMP_THRESHOLD', 300);
 
-class UserauthorizationAction extends Action {
+class UserauthorizationAction extends Action
+{
 
     function handle($args)
     {
diff --git a/actions/userbyid.php b/actions/userbyid.php
index d7b4088bd..d57ed21a5 100644
--- a/actions/userbyid.php
+++ b/actions/userbyid.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class UserbyidAction extends Action {
+class UserbyidAction extends Action
+{
     
     function is_readonly()
     {                
diff --git a/actions/userrss.php b/actions/userrss.php
index c758a44e2..1e9fe121f 100644
--- a/actions/userrss.php
+++ b/actions/userrss.php
@@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 // Formatting of RSS handled by Rss10Action
 
-class UserrssAction extends Rss10Action {
+class UserrssAction extends Rss10Action
+{
 
     var $user = null;
 
diff --git a/actions/xrds.php b/actions/xrds.php
index 1d4961d46..7edc6aa39 100644
--- a/actions/xrds.php
+++ b/actions/xrds.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class XrdsAction extends Action {
+class XrdsAction extends Action
+{
 
     function is_readonly()
     {                
diff --git a/classes/Channel.php b/classes/Channel.php
index 02ece9c0f..2e3e4e8d4 100644
--- a/classes/Channel.php
+++ b/classes/Channel.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class Channel {
+class Channel
+{
     
     function on($user)
     {
@@ -47,7 +48,8 @@ class Channel {
     }
 }
 
-class XMPPChannel extends Channel {
+class XMPPChannel extends Channel
+{
 
     var $conn = null;
     
@@ -104,7 +106,8 @@ class XMPPChannel extends Channel {
 }
 
 
-class WebChannel extends Channel {
+class WebChannel extends Channel
+{
 
     function source()
     {
@@ -138,7 +141,8 @@ class WebChannel extends Channel {
 }
 
 
-class AjaxWebChannel extends WebChannel {
+class AjaxWebChannel extends WebChannel
+{
 
     function output($user, $text)
     {
@@ -166,7 +170,8 @@ class AjaxWebChannel extends WebChannel {
 }
 
 
-class MailChannel extends Channel {
+class MailChannel extends Channel
+{
 
     var $addr = null;
 
diff --git a/classes/Command.php b/classes/Command.php
index 407a6ecba..eacbdacb3 100644
--- a/classes/Command.php
+++ b/classes/Command.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/classes/Channel.php');
 
-class Command {
+class Command
+{
     
     var $user = null;
     
@@ -36,20 +37,24 @@ class Command {
     }
 }
 
-class UnimplementedCommand extends Command {
+class UnimplementedCommand extends Command
+{
     function execute($channel)
     {
         $channel->error($this->user, _("Sorry, this command is not yet implemented."));
     }
 }
 
-class TrackingCommand extends UnimplementedCommand {
+class TrackingCommand extends UnimplementedCommand
+{
 }
 
-class TrackOffCommand extends UnimplementedCommand {
+class TrackOffCommand extends UnimplementedCommand
+{
 }
 
-class TrackCommand extends UnimplementedCommand {
+class TrackCommand extends UnimplementedCommand
+{
     var $word = null;
     function __construct($user, $word)
     {
@@ -58,7 +63,8 @@ class TrackCommand extends UnimplementedCommand {
     }
 }
 
-class UntrackCommand extends UnimplementedCommand {
+class UntrackCommand extends UnimplementedCommand
+{
     var $word = null;
     function __construct($user, $word)
     {
@@ -67,7 +73,8 @@ class UntrackCommand extends UnimplementedCommand {
     }
 }
 
-class NudgeCommand extends UnimplementedCommand {
+class NudgeCommand extends UnimplementedCommand
+{
     var $other = null;
     function __construct($user, $other)
     {
@@ -76,7 +83,8 @@ class NudgeCommand extends UnimplementedCommand {
     }
 }
 
-class InviteCommand extends UnimplementedCommand {
+class InviteCommand extends UnimplementedCommand
+{
     var $other = null;
     function __construct($user, $other)
     {
@@ -85,7 +93,8 @@ class InviteCommand extends UnimplementedCommand {
     }
 }
 
-class StatsCommand extends Command {
+class StatsCommand extends Command
+{
     function execute($channel)
     {
 
@@ -110,7 +119,8 @@ class StatsCommand extends Command {
     }
 }
 
-class FavCommand extends Command {
+class FavCommand extends Command
+{
     
     var $other = null;
     
@@ -157,7 +167,8 @@ class FavCommand extends Command {
     }
 }
 
-class WhoisCommand extends Command {
+class WhoisCommand extends Command
+{
     var $other = null;
     function __construct($user, $other)
     {
@@ -193,7 +204,8 @@ class WhoisCommand extends Command {
     }
 }
 
-class MessageCommand extends Command {
+class MessageCommand extends Command
+{
     var $other = null;
     var $text = null;
     function __construct($user, $other, $text)
@@ -237,7 +249,8 @@ class MessageCommand extends Command {
     }
 }
 
-class GetCommand extends Command {
+class GetCommand extends Command
+{
     
     var $other = null;
     
@@ -269,7 +282,8 @@ class GetCommand extends Command {
     }
 }
 
-class SubCommand extends Command {
+class SubCommand extends Command
+{
     
     var $other = null;
     
@@ -297,7 +311,8 @@ class SubCommand extends Command {
     }
 }
 
-class UnsubCommand extends Command {
+class UnsubCommand extends Command
+{
 
     var $other = null;
     
@@ -324,7 +339,8 @@ class UnsubCommand extends Command {
     }
 }
 
-class OffCommand extends Command {
+class OffCommand extends Command
+{
     var $other = null;
     function __construct($user, $other=null)
     {
@@ -345,7 +361,8 @@ class OffCommand extends Command {
     }
 }
 
-class OnCommand extends Command {
+class OnCommand extends Command
+{
     var $other = null;
     function __construct($user, $other=null)
     {
@@ -367,7 +384,8 @@ class OnCommand extends Command {
     }
 }
 
-class HelpCommand extends Command {
+class HelpCommand extends Command
+{
     function execute($channel)
     {
         $channel->output($this->user,
diff --git a/classes/CommandInterpreter.php b/classes/CommandInterpreter.php
index ff078bb05..f409ed07f 100644
--- a/classes/CommandInterpreter.php
+++ b/classes/CommandInterpreter.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/classes/Command.php');
 
-class CommandInterpreter {
+class CommandInterpreter
+{
     
     function handle_command($user, $text)
     {
diff --git a/classes/NoticeWrapper.php b/classes/NoticeWrapper.php
index e1b27c2f7..233340ccd 100644
--- a/classes/NoticeWrapper.php
+++ b/classes/NoticeWrapper.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/classes/Notice.php');
 
-class NoticeWrapper extends Notice {
+class NoticeWrapper extends Notice
+{
 
     public $id;                              // int(4)  primary_key not_null
     public $profile_id;                      // int(4)   not_null
diff --git a/lib/Shorturl_api.php b/lib/Shorturl_api.php
index f3f4f08df..fe106cb83 100644
--- a/lib/Shorturl_api.php
+++ b/lib/Shorturl_api.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class ShortUrlApi {
+class ShortUrlApi
+{
     protected $service_url;
 
     function __construct($service_url)
@@ -69,7 +70,8 @@ class ShortUrlApi {
     }
 }
 
-class LilUrl extends ShortUrlApi {
+class LilUrl extends ShortUrlApi
+{
     function __construct()
     {
         parent::__construct('http://ur1.ca/');
@@ -88,7 +90,8 @@ class LilUrl extends ShortUrlApi {
 }
 
 
-class PtitUrl extends ShortUrlApi {
+class PtitUrl extends ShortUrlApi
+{
     function __construct()
     {
         parent::__construct('http://ptiturl.com/?creer=oui&action=Reduire&url=');
@@ -106,7 +109,8 @@ class PtitUrl extends ShortUrlApi {
     }
 }
 
-class TightUrl extends ShortUrlApi {
+class TightUrl extends ShortUrlApi
+{
     function __construct()
     {
         parent::__construct('http://2tu.us/?save=y&url=');
diff --git a/lib/deleteaction.php b/lib/deleteaction.php
index a6e365121..9e89c0a54 100644
--- a/lib/deleteaction.php
+++ b/lib/deleteaction.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class DeleteAction extends Action {
+class DeleteAction extends Action
+{
 
     function handle($args)
     {
diff --git a/lib/facebookaction.php b/lib/facebookaction.php
index 43464b19b..d5b7ed0fb 100644
--- a/lib/facebookaction.php
+++ b/lib/facebookaction.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/extlib/facebook/facebook.php');
 
-class FacebookAction extends Action {
+class FacebookAction extends Action
+{
 
     function handle($args)
     {
diff --git a/lib/oauthstore.php b/lib/oauthstore.php
index faae82db1..7ad3be20e 100644
--- a/lib/oauthstore.php
+++ b/lib/oauthstore.php
@@ -21,9 +21,10 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/omb.php');
 
-class LaconicaOAuthDataStore extends OAuthDataStore {
+class LaconicaOAuthDataStore extends OAuthDataStore
+{
 
-    # We keep a record of who's contacted us
+    // We keep a record of who's contacted us
 
     function lookup_consumer($consumer_key)
     {
@@ -75,8 +76,8 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         $t->consumer_key = $consumer->key;
         $t->tok = common_good_rand(16);
         $t->secret = common_good_rand(16);
-        $t->type = 0; # request
-        $t->state = 0; # unauthorized
+        $t->type = 0; // request
+        $t->state = 0; // unauthorized
         $t->created = DB_DataObject_Cast::dateTime();
         if (!$t->insert()) {
             return null;
@@ -85,7 +86,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         }
     }
 
-    # defined in OAuthDataStore, but not implemented anywhere
+    // defined in OAuthDataStore, but not implemented anywhere
 
     function fetch_request_token($consumer)
     {
@@ -98,14 +99,14 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         $rt = new Token();
         $rt->consumer_key = $consumer->key;
         $rt->tok = $token->key;
-        $rt->type = 0; # request
-        if ($rt->find(true) && $rt->state == 1) { # authorized
+        $rt->type = 0; // request
+        if ($rt->find(true) && $rt->state == 1) { // authorized
             common_debug('request token found.', __FILE__);
             $at = new Token();
             $at->consumer_key = $consumer->key;
             $at->tok = common_good_rand(16);
             $at->secret = common_good_rand(16);
-            $at->type = 1; # access
+            $at->type = 1; // access
             $at->created = DB_DataObject_Cast::dateTime();
             if (!$at->insert()) {
                 $e = $at->_lastError;
@@ -113,15 +114,15 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
                 return null;
             } else {
                 common_debug('access token "'.$at->tok.'" inserted', __FILE__);
-                # burn the old one
+                // burn the old one
                 $orig_rt = clone($rt);
-                $rt->state = 2; # used
+                $rt->state = 2; // used
                 if (!$rt->update($orig_rt)) {
                     return null;
                 }
                 common_debug('request token "'.$rt->tok.'" updated', __FILE__);
-                # Update subscription
-                # XXX: mixing levels here
+                // Update subscription
+                // XXX: mixing levels here
                 $sub = Subscription::staticGet('token', $rt->tok);
                 if (!$sub) {
                     return null;
@@ -142,7 +143,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
         }
     }
 
-    # defined in OAuthDataStore, but not implemented anywhere
+    // defined in OAuthDataStore, but not implemented anywhere
 
     function fetch_access_token($consumer)
     {
diff --git a/lib/personal.php b/lib/personal.php
index 34ebe6894..02b01fece 100644
--- a/lib/personal.php
+++ b/lib/personal.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class PersonalAction extends Action {
+class PersonalAction extends Action
+{
     
     function is_readonly()
     {
diff --git a/lib/profilelist.php b/lib/profilelist.php
index 60737c3d4..bda05daf3 100644
--- a/lib/profilelist.php
+++ b/lib/profilelist.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 define('PROFILES_PER_PAGE', 20);
 
-class ProfileList {
+class ProfileList
+{
 
     var $profile = null;
     var $owner = null;
diff --git a/lib/queuehandler.php b/lib/queuehandler.php
index 48487f8e9..9ce9e32b3 100644
--- a/lib/queuehandler.php
+++ b/lib/queuehandler.php
@@ -25,7 +25,8 @@ require_once(INSTALLDIR.'/lib/daemon.php');
 require_once(INSTALLDIR.'/classes/Queue_item.php');
 require_once(INSTALLDIR.'/classes/Notice.php');
 
-class QueueHandler extends Daemon {
+class QueueHandler extends Daemon
+{
 
     var $_id = 'generic';
 
diff --git a/lib/rssaction.php b/lib/rssaction.php
index e02e1febb..9564cfb46 100644
--- a/lib/rssaction.php
+++ b/lib/rssaction.php
@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
 
 define('DEFAULT_RSS_LIMIT', 48);
 
-class Rss10Action extends Action {
+class Rss10Action extends Action
+{
 
     # This will contain the details of each feed item's author and be used to generate SIOC data.
     var $creators = array();
diff --git a/lib/search_engines.php b/lib/search_engines.php
index e96570d63..559107910 100644
--- a/lib/search_engines.php
+++ b/lib/search_engines.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class SearchEngine {
+class SearchEngine
+{
     protected $target;
     protected $table;
 
@@ -45,7 +46,8 @@ class SearchEngine {
     }
 }
 
-class SphinxSearch extends SearchEngine {
+class SphinxSearch extends SearchEngine
+{
     private $sphinx;
     private $connected;
 
@@ -103,7 +105,8 @@ class SphinxSearch extends SearchEngine {
     }
 }
 
-class MySQLSearch extends SearchEngine {
+class MySQLSearch extends SearchEngine
+{
     function query($q)
     {
         if ('identica_people' === $this->table)
@@ -115,7 +118,8 @@ class MySQLSearch extends SearchEngine {
     }
 }
 
-class PGSearch extends SearchEngine {
+class PGSearch extends SearchEngine
+{
     function query($q)
     {
         if ('identica_people' === $this->table)
diff --git a/lib/searchaction.php b/lib/searchaction.php
index 12a44a861..bc90fac1a 100644
--- a/lib/searchaction.php
+++ b/lib/searchaction.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class SearchAction extends Action {
+class SearchAction extends Action
+{
 
     function is_readonly()
     {
diff --git a/lib/settingsaction.php b/lib/settingsaction.php
index 5979c11f0..46f713fa8 100644
--- a/lib/settingsaction.php
+++ b/lib/settingsaction.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class SettingsAction extends Action {
+class SettingsAction extends Action
+{
 
     function handle($args)
     {
diff --git a/lib/stream.php b/lib/stream.php
index 45fbb9bd9..73758adee 100644
--- a/lib/stream.php
+++ b/lib/stream.php
@@ -22,7 +22,8 @@ if (!defined('LACONICA')) { exit(1); }
 require_once(INSTALLDIR.'/lib/personal.php');
 require_once(INSTALLDIR.'/lib/noticelist.php');
 
-class StreamAction extends PersonalAction {
+class StreamAction extends PersonalAction
+{
 
     function public_views_menu()
     {
diff --git a/lib/twitterapi.php b/lib/twitterapi.php
index 3cddfa9c9..50bcb06fe 100644
--- a/lib/twitterapi.php
+++ b/lib/twitterapi.php
@@ -19,7 +19,8 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-class TwitterapiAction extends Action {
+class TwitterapiAction extends Action
+{
 
     var $auth_user;
 
diff --git a/lib/xmppqueuehandler.php b/lib/xmppqueuehandler.php
index 0a73403f9..91015fd45 100644
--- a/lib/xmppqueuehandler.php
+++ b/lib/xmppqueuehandler.php
@@ -28,7 +28,8 @@ require_once(INSTALLDIR.'/lib/queuehandler.php');
  * superclass.
  */
 
-class XmppQueueHandler extends QueueHandler {
+class XmppQueueHandler extends QueueHandler
+{
     
     function start()
     {
diff --git a/scripts/enjitqueuehandler.php b/scripts/enjitqueuehandler.php
index 55d73e08c..3a4f8315d 100755
--- a/scripts/enjitqueuehandler.php
+++ b/scripts/enjitqueuehandler.php
@@ -33,7 +33,8 @@ require_once(INSTALLDIR . '/lib/queuehandler.php');
 
 set_error_handler('common_error_handler');
 
-class EnjitQueueHandler extends QueueHandler {
+class EnjitQueueHandler extends QueueHandler
+{
     
     function transport()
     {
diff --git a/scripts/jabberqueuehandler.php b/scripts/jabberqueuehandler.php
index ea26aaf79..924fc4545 100755
--- a/scripts/jabberqueuehandler.php
+++ b/scripts/jabberqueuehandler.php
@@ -33,7 +33,8 @@ require_once(INSTALLDIR . '/lib/xmppqueuehandler.php');
 
 set_error_handler('common_error_handler');
 
-class JabberQueueHandler extends XmppQueueHandler {
+class JabberQueueHandler extends XmppQueueHandler
+{
 
     var $conn = null;
 
diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php
index 6100cd21b..b9facec1a 100755
--- a/scripts/maildaemon.php
+++ b/scripts/maildaemon.php
@@ -34,7 +34,8 @@ require_once('Mail/mimeDecode.php');
 # FIXME: we use both Mail_mimeDecode and mailparse
 # Need to move everything to mailparse
 
-class MailerDaemon {
+class MailerDaemon
+{
 
     function __construct()
     {
diff --git a/scripts/ombqueuehandler.php b/scripts/ombqueuehandler.php
index 299381ace..cdcea51dc 100755
--- a/scripts/ombqueuehandler.php
+++ b/scripts/ombqueuehandler.php
@@ -33,7 +33,8 @@ require_once(INSTALLDIR . '/lib/queuehandler.php');
 
 set_error_handler('common_error_handler');
 
-class OmbQueueHandler extends QueueHandler {
+class OmbQueueHandler extends QueueHandler
+{
     
     function transport()
     {
diff --git a/scripts/publicqueuehandler.php b/scripts/publicqueuehandler.php
index b3542e5c5..5075c12df 100755
--- a/scripts/publicqueuehandler.php
+++ b/scripts/publicqueuehandler.php
@@ -33,7 +33,8 @@ require_once(INSTALLDIR . '/lib/xmppqueuehandler.php');
 
 set_error_handler('common_error_handler');
 
-class PublicQueueHandler extends XmppQueueHandler {
+class PublicQueueHandler extends XmppQueueHandler
+{
     
     function transport()
     {
diff --git a/scripts/smsqueuehandler.php b/scripts/smsqueuehandler.php
index c962ad095..38f2f11fe 100755
--- a/scripts/smsqueuehandler.php
+++ b/scripts/smsqueuehandler.php
@@ -33,7 +33,8 @@ require_once(INSTALLDIR . '/lib/queuehandler.php');
 
 set_error_handler('common_error_handler');
 
-class SmsQueueHandler extends QueueHandler {
+class SmsQueueHandler extends QueueHandler
+{
     
     function transport()
     {
diff --git a/scripts/xmppconfirmhandler.php b/scripts/xmppconfirmhandler.php
index 1eb932330..2b8b085ce 100755
--- a/scripts/xmppconfirmhandler.php
+++ b/scripts/xmppconfirmhandler.php
@@ -35,7 +35,8 @@ set_error_handler('common_error_handler');
 
 define('CLAIM_TIMEOUT', 1200);
 
-class XmppConfirmHandler extends XmppQueueHandler {
+class XmppConfirmHandler extends XmppQueueHandler
+{
 
     var $_id = 'confirm';
     
diff --git a/scripts/xmppdaemon.php b/scripts/xmppdaemon.php
index 28ac64725..01fe8914f 100755
--- a/scripts/xmppdaemon.php
+++ b/scripts/xmppdaemon.php
@@ -37,7 +37,8 @@ set_error_handler('common_error_handler');
 # in jabber.php, which create a new XMPP class. A more elegant (?) solution
 # might be to use make this a subclass of XMPP.
 
-class XMPPDaemon extends Daemon {
+class XMPPDaemon extends Daemon
+{
 
     function XMPPDaemon($resource=null)
     {
-- 
cgit v1.2.3-54-g00ecf


From eaa81d25fa7bd954132ce7f901fae69b0d46ec1a Mon Sep 17 00:00:00 2001
From: Evan Prodromou <evan@controlyourself.ca>
Date: Thu, 15 Jan 2009 22:57:15 +0000
Subject: Convert all actions to use new UI functions

I did a massive search-and-replace to get all the action subclasses to
use the new output function (common_element() -> $this->element(), etc.)

There's still a lot to do, but it's a first step
---
 actions/all.php                    |   2 +-
 actions/api.php                    |   8 +-
 actions/block.php                  |  16 ++--
 actions/confirmaddress.php         |   2 +-
 actions/deletenotice.php           |  18 ++---
 actions/deleteprofile.php          |  40 +++++-----
 actions/disfavor.php               |  12 +--
 actions/doc.php                    |   2 +-
 actions/emailsettings.php          |  72 ++++++++---------
 actions/facebookhome.php           |   2 +-
 actions/facebookinvite.php         |  38 ++++-----
 actions/facebooksettings.php       |  40 +++++-----
 actions/favor.php                  |  12 +--
 actions/favorited.php              |  10 +--
 actions/featured.php               |   6 +-
 actions/finishaddopenid.php        |   2 +-
 actions/finishopenidlogin.php      |  42 +++++-----
 actions/foaf.php                   |  72 ++++++++---------
 actions/imsettings.php             |  48 ++++++------
 actions/invite.php                 |  46 +++++------
 actions/login.php                  |  54 ++++++++-----
 actions/newmessage.php             |   2 +-
 actions/newnotice.php              |  28 +++----
 actions/noticesearch.php           |  48 ++++++------
 actions/nudge.php                  |  12 +--
 actions/openidlogin.php            |  20 ++---
 actions/openidsettings.php         |  48 ++++++------
 actions/opensearch.php             |  24 +++---
 actions/othersettings.php          |  40 +++++-----
 actions/peoplesearch.php           |   2 +-
 actions/peopletag.php              |  10 +--
 actions/profilesettings.php        |  90 ++++++++++-----------
 actions/publicxrds.php             |  24 +++---
 actions/recoverpassword.php        |  36 ++++-----
 actions/register.php               |  58 +++++++-------
 actions/remotesubscribe.php        |  20 ++---
 actions/replies.php                |   2 +-
 actions/showfavorites.php          |   2 +-
 actions/shownotice.php             |   8 +-
 actions/showstream.php             | 156 ++++++++++++++++++-------------------
 actions/smssettings.php            |  86 ++++++++++----------
 actions/subscribe.php              |  12 +--
 actions/subscriptions.php          |  14 ++--
 actions/tag.php                    |  16 ++--
 actions/tagother.php               |  54 ++++++-------
 actions/twitapidirect_messages.php |  28 +++----
 actions/twitapifriendships.php     |   2 +-
 actions/twitapihelp.php            |   2 +-
 actions/twitapilaconica.php        |  12 +--
 actions/twitapistatuses.php        |   4 +-
 actions/twittersettings.php        |  64 +++++++--------
 actions/unsubscribe.php            |  12 +--
 actions/userauthorization.php      |  44 +++++------
 actions/xrds.php                   |  36 ++++-----
 lib/action.php                     |  23 +++---
 55 files changed, 801 insertions(+), 782 deletions(-)

(limited to 'actions/twitapihelp.php')

diff --git a/actions/all.php b/actions/all.php
index 526ac5f40..a8a74fb33 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -57,7 +57,7 @@ class AllAction extends StreamAction
 
     function show_header($user)
     {
-        common_element('link', array('rel' => 'alternate',
+        $this->element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('allrss', array('nickname' =>
                                                                                $user->nickname)),
                                      'type' => 'application/rss+xml',
diff --git a/actions/api.php b/actions/api.php
index 7a0759831..9cbf9a468 100644
--- a/actions/api.php
+++ b/actions/api.php
@@ -159,10 +159,10 @@ class ApiAction extends Action
         if ($this->content_type == 'xml') {
             header('Content-Type: application/xml; charset=utf-8');
             common_start_xml();
-            common_element_start('hash');
-            common_element('error', null, $msg);
-            common_element('request', null, $_SERVER['REQUEST_URI']);
-            common_element_end('hash');
+            $this->elementStart('hash');
+            $this->element('error', null, $msg);
+            $this->element('request', null, $_SERVER['REQUEST_URI']);
+            $this->elementEnd('hash');
             common_end_xml();
         } else if ($this->content_type == 'json')  {
             header('Content-Type: application/json; charset=utf-8');
diff --git a/actions/block.php b/actions/block.php
index c1ff7c044..f8f6f24fd 100644
--- a/actions/block.php
+++ b/actions/block.php
@@ -81,34 +81,34 @@ class BlockAction extends Action
 
         common_show_header(_('Block user'));
 
-        common_element('p', null,
+        $this->element('p', null,
                        _('Are you sure you want to block this user? '.
                          'Afterwards, they will be unsubscribed from you, '.
                          'unable to subscribe to you in the future, and '.
                          'you will not be notified of any @-replies from them.'));
 
-        common_element_start('form', array('id' => 'block-' . $id,
+        $this->elementStart('form', array('id' => 'block-' . $id,
                                            'method' => 'post',
                                            'class' => 'block',
                                            'action' => common_local_url('block')));
 
-        common_hidden('token', common_session_token());
+        $this->hidden('token', common_session_token());
 
-        common_element('input', array('id' => 'blockto-' . $id,
+        $this->element('input', array('id' => 'blockto-' . $id,
                                       'name' => 'blockto',
                                       'type' => 'hidden',
                                       'value' => $id));
 
         foreach ($this->args as $k => $v) {
             if (substr($k, 0, 9) == 'returnto-') {
-                common_hidden($k, $v);
+                $this->hidden($k, $v);
             }
         }
 
-        common_submit('no', _('No'));
-        common_submit('yes', _('Yes'));
+        $this->submit('no', _('No'));
+        $this->submit('yes', _('Yes'));
 
-        common_element_end('form');
+        $this->elementEnd('form');
 
         common_show_footer();
     }
diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php
index 1d5c53ff2..31a157768 100644
--- a/actions/confirmaddress.php
+++ b/actions/confirmaddress.php
@@ -90,7 +90,7 @@ class ConfirmaddressAction extends Action
         $cur->query('COMMIT');
 
         common_show_header(_('Confirm Address'));
-        common_element('p', null,
+        $this->element('p', null,
                        sprintf(_('The address "%s" has been confirmed for your account.'), $cur->$type));
         common_show_footer();
     }
diff --git a/actions/deletenotice.php b/actions/deletenotice.php
index e9b4b3254..bae0eac1b 100644
--- a/actions/deletenotice.php
+++ b/actions/deletenotice.php
@@ -51,24 +51,24 @@ class DeletenoticeAction extends DeleteAction
 
         common_show_header($this->get_title(), array($this, 'show_header'), $error,
                            array($this, 'show_top'));
-        common_element_start('form', array('id' => 'notice_delete_form',
+        $this->elementStart('form', array('id' => 'notice_delete_form',
                                    'method' => 'post',
                                    'action' => common_local_url('deletenotice')));
-        common_hidden('token', common_session_token());
-        common_hidden('notice', $this->trimmed('notice'));
-        common_element_start('p');
-        common_element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?'));
+        $this->hidden('token', common_session_token());
+        $this->hidden('notice', $this->trimmed('notice'));
+        $this->elementStart('p');
+        $this->element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?'));
 
-        common_element('input', array('id' => 'submit_no',
+        $this->element('input', array('id' => 'submit_no',
                           'name' => 'submit',
                           'type' => 'submit',
                           'value' => _('No')));
-        common_element('input', array('id' => 'submit_yes',
+        $this->element('input', array('id' => 'submit_yes',
                           'name' => 'submit',
                           'type' => 'submit',
                           'value' => _('Yes')));
-        common_element_end('p');
-        common_element_end('form');
+        $this->elementEnd('p');
+        $this->elementEnd('form');
         common_show_footer();
     }
 
diff --git a/actions/deleteprofile.php b/actions/deleteprofile.php
index e12fe131a..ef4687d5f 100644
--- a/actions/deleteprofile.php
+++ b/actions/deleteprofile.php
@@ -49,15 +49,15 @@ class DeleteprofileAction extends Action
 
     function show_feeds_list($feeds)
     {
-        common_element_start('div', array('class' => 'feedsdel'));
-        common_element('p', null, 'Feeds:');
-        common_element_start('ul', array('class' => 'xoxo'));
+        $this->elementStart('div', array('class' => 'feedsdel'));
+        $this->element('p', null, 'Feeds:');
+        $this->elementStart('ul', array('class' => 'xoxo'));
 
         foreach ($feeds as $key => $value) {
             $this->common_feed_item($feeds[$key]);
         }
-        common_element_end('ul');
-        common_element_end('div');
+        $this->elementEnd('ul');
+        $this->elementEnd('div');
     }
 
     //TODO move to common.php (and retrace its origin)
@@ -81,19 +81,19 @@ class DeleteprofileAction extends Action
                 $feed['textContent'] = "FOAF";
                 break;
         }
-        common_element_start('li');
-        common_element('a', array('href' => $feed['href'],
+        $this->elementStart('li');
+        $this->element('a', array('href' => $feed['href'],
                                   'class' => $feed_classname,
                                   'type' => $feed_mimetype,
                                   'title' => $feed_title),
                             $feed['textContent']);
-        common_element_end('li');
+        $this->elementEnd('li');
     }
 
     function show_form($msg=null, $success=false)
     {
         $this->form_header(_('Delete my account'), $msg, $success);
-        common_element('h2', null, _('Delete my account confirmation'));
+        $this->element('h2', null, _('Delete my account confirmation'));
         $this->show_confirm_delete_form();
         common_show_footer();
     }
@@ -105,13 +105,13 @@ class DeleteprofileAction extends Action
         $notices->profile_id = $user->id;
         $notice_count = (int) $notices->count();
 
-        common_element_start('form', array('method' => 'POST',
+        $this->elementStart('form', array('method' => 'POST',
                                            'id' => 'delete',
                                            'action' =>
                                            common_local_url('deleteprofile')));
 
-        common_hidden('token', common_session_token());
-        common_element('p', null, "Last chance to copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
+        $this->hidden('token', common_session_token());
+        $this->element('p', null, "Last chance to copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
 
         $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
                                               'type' => 'rss',
@@ -122,10 +122,10 @@ class DeleteprofileAction extends Action
                                               'version' => 'FOAF',
                                               'item' => 'foaf')));
 
-        common_checkbox('confirmation', _('Check if you are sure you want to delete your account.'));
+        $this->checkbox('confirmation', _('Check if you are sure you want to delete your account.'));
 
-        common_submit('deleteaccount', _('Delete my account'));
-        common_element_end('form');
+        $this->submit('deleteaccount', _('Delete my account'));
+        $this->elementEnd('form');
     }
 
     function handle_post()
@@ -238,9 +238,9 @@ class DeleteprofileAction extends Action
         } else {
             $inst = $this->get_instructions();
             $output = common_markup_to_html($inst);
-            common_element_start('div', 'instructions');
-            common_raw($output);
-            common_element_end('div');
+            $this->elementStart('div', 'instructions');
+            $this->raw($output);
+            $this->elementEnd('div');
         }
         $this->settings_menu();
     }
@@ -272,7 +272,7 @@ class DeleteprofileAction extends Action
                       _('Other options')));
 
         $action = $this->trimmed('action');
-        common_element_start('ul', array('id' => 'nav_views'));
+        $this->elementStart('ul', array('id' => 'nav_views'));
         foreach ($menu as $menuaction => $menudesc) {
             if ($menuaction == 'imsettings' &&
                 !common_config('xmpp', 'enabled')) {
@@ -283,7 +283,7 @@ class DeleteprofileAction extends Action
                     $menudesc[1],
                     $action == $menuaction);
         }
-        common_element_end('ul');
+        $this->elementEnd('ul');
     }
 }
 
diff --git a/actions/disfavor.php b/actions/disfavor.php
index 74aae86cc..9a27f34b1 100644
--- a/actions/disfavor.php
+++ b/actions/disfavor.php
@@ -70,13 +70,13 @@ class DisfavorAction extends Action
 
         if ($this->boolean('ajax')) {
             common_start_html('text/xml;charset=utf-8', true);
-            common_element_start('head');
-            common_element('title', null, _('Add to favorites'));
-            common_element_end('head');
-            common_element_start('body');
+            $this->elementStart('head');
+            $this->element('title', null, _('Add to favorites'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
             common_favor_form($notice);
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             common_redirect(common_local_url('showfavorites',
                                              array('nickname' => $user->nickname)));
diff --git a/actions/doc.php b/actions/doc.php
index 856025e66..98da31267 100644
--- a/actions/doc.php
+++ b/actions/doc.php
@@ -34,7 +34,7 @@ class DocAction extends Action
         $c = file_get_contents($filename);
         $output = common_markup_to_html($c);
         common_show_header(_(ucfirst($title)));
-        common_raw($output);
+        $this->raw($output);
         common_show_footer();
     }
 }
diff --git a/actions/emailsettings.php b/actions/emailsettings.php
index 3fa8ce296..39f186bff 100644
--- a/actions/emailsettings.php
+++ b/actions/emailsettings.php
@@ -33,83 +33,83 @@ class EmailsettingsAction extends SettingsAction
     {
         $user = common_current_user();
         $this->form_header(_('Email Settings'), $msg, $success);
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'emailsettings',
                                            'action' =>
                                            common_local_url('emailsettings')));
-        common_hidden('token', common_session_token());
+        $this->hidden('token', common_session_token());
 
-        common_element('h2', null, _('Address'));
+        $this->element('h2', null, _('Address'));
 
         if ($user->email) {
-            common_element_start('p');
-            common_element('span', 'address confirmed', $user->email);
-            common_element('span', 'input_instructions',
+            $this->elementStart('p');
+            $this->element('span', 'address confirmed', $user->email);
+            $this->element('span', 'input_instructions',
                            _('Current confirmed email address.'));
-            common_hidden('email', $user->email);
-            common_element_end('p');
-            common_submit('remove', _('Remove'));
+            $this->hidden('email', $user->email);
+            $this->elementEnd('p');
+            $this->submit('remove', _('Remove'));
         } else {
             $confirm = $this->get_confirmation();
             if ($confirm) {
-                common_element_start('p');
-                common_element('span', 'address unconfirmed', $confirm->address);
-                common_element('span', 'input_instructions',
+                $this->elementStart('p');
+                $this->element('span', 'address unconfirmed', $confirm->address);
+                $this->element('span', 'input_instructions',
                                _('Awaiting confirmation on this address. Check your inbox (and spam box!) for a message with further instructions.'));
-                common_hidden('email', $confirm->address);
-                common_element_end('p');
-                common_submit('cancel', _('Cancel'));
+                $this->hidden('email', $confirm->address);
+                $this->elementEnd('p');
+                $this->submit('cancel', _('Cancel'));
             } else {
-                common_input('email', _('Email Address'),
+                $this->input('email', _('Email Address'),
                              ($this->arg('email')) ? $this->arg('email') : null,
                              _('Email address, like "UserName@example.org"'));
-                common_submit('add', _('Add'));
+                $this->submit('add', _('Add'));
             }
         }
 
         if ($user->email) {
-            common_element('h2', null, _('Incoming email'));
+            $this->element('h2', null, _('Incoming email'));
             
             if ($user->incomingemail) {
-                common_element_start('p');
-                common_element('span', 'address', $user->incomingemail);
-                common_element('span', 'input_instructions',
+                $this->elementStart('p');
+                $this->element('span', 'address', $user->incomingemail);
+                $this->element('span', 'input_instructions',
                                _('Send email to this address to post new notices.'));
-                common_element_end('p');
-                common_submit('removeincoming', _('Remove'));
+                $this->elementEnd('p');
+                $this->submit('removeincoming', _('Remove'));
             }
             
-            common_element_start('p');
-            common_element('span', 'input_instructions',
+            $this->elementStart('p');
+            $this->element('span', 'input_instructions',
                            _('Make a new email address for posting to; cancels the old one.'));
-            common_element_end('p');
-            common_submit('newincoming', _('New'));
+            $this->elementEnd('p');
+            $this->submit('newincoming', _('New'));
         }
         
-        common_element('h2', null, _('Preferences'));
+        $this->element('h2', null, _('Preferences'));
 
-        common_checkbox('emailnotifysub',
+        $this->checkbox('emailnotifysub',
                         _('Send me notices of new subscriptions through email.'),
                         $user->emailnotifysub);
-        common_checkbox('emailnotifyfav',
+        $this->checkbox('emailnotifyfav',
                         _('Send me email when someone adds my notice as a favorite.'),
                         $user->emailnotifyfav);
-        common_checkbox('emailnotifymsg',
+        $this->checkbox('emailnotifymsg',
                         _('Send me email when someone sends me a private message.'),
                         $user->emailnotifymsg);
-        common_checkbox('emailnotifynudge',
+        $this->checkbox('emailnotifynudge',
                         _('Allow friends to nudge me and send me an email.'),
                         $user->emailnotifynudge);
-        common_checkbox('emailpost',
+        $this->checkbox('emailpost',
                         _('I want to post notices by email.'),
                         $user->emailpost);
-        common_checkbox('emailmicroid',
+        $this->checkbox('emailmicroid',
                         _('Publish a MicroID for my email address.'),
                         $user->emailmicroid);
 
-        common_submit('save', _('Save'));
+        $this->submit('save', _('Save'));
         
-        common_element_end('form');
+        $this->elementEnd('form');
         common_show_footer();
     }
 
diff --git a/actions/facebookhome.php b/actions/facebookhome.php
index f72f08a34..d2ac7617d 100644
--- a/actions/facebookhome.php
+++ b/actions/facebookhome.php
@@ -105,7 +105,7 @@ class FacebookhomeAction extends FacebookAction
         $this->show_header('Home');
 
         if ($msg) {
-            common_element('fb:success', array('message' => $msg));
+            $this->element('fb:success', array('message' => $msg));
         }
 
         echo $this->show_notices($user);
diff --git a/actions/facebookinvite.php b/actions/facebookinvite.php
index fe0c5e493..103d5a568 100644
--- a/actions/facebookinvite.php
+++ b/actions/facebookinvite.php
@@ -43,22 +43,22 @@ class FacebookinviteAction extends FacebookAction
 
         $this->show_header('Invite');
 
-        common_element('h2', null, _('Thanks for inviting your friends to use Identi.ca!'));
-        common_element('p', null, _('Invitations have been sent to the following users:'));
+        $this->element('h2', null, _('Thanks for inviting your friends to use Identi.ca!'));
+        $this->element('p', null, _('Invitations have been sent to the following users:'));
 
         $friend_ids = $_POST['ids']; // Hmm... $this->arg('ids') doesn't seem to work
 
-        common_element_start("ul");
+        $this->elementStart("ul");
 
         foreach ($friend_ids as $friend) {
-            common_element_start('li');
-            common_element('fb:profile-pic', array('uid' => $friend));
-            common_element('fb:name', array('uid' => $friend,
+            $this->elementStart('li');
+            $this->element('fb:profile-pic', array('uid' => $friend));
+            $this->element('fb:name', array('uid' => $friend,
                                             'capitalize' => 'true'));
-            common_element_end('li');
+            $this->elementEnd('li');
         }
 
-        common_element_end("ul");
+        $this->elementEnd("ul");
 
         $this->show_footer();
     }
@@ -77,32 +77,32 @@ class FacebookinviteAction extends FacebookAction
         $content = _('You have been invited to Identi.ca!') .
             htmlentities('<fb:req-choice url="http://apps.facebook.com/identica_app/" label="Add"/>');
 
-        common_element_start('fb:request-form', array('action' => 'invite.php',
+        $this->elementStart('fb:request-form', array('action' => 'invite.php',
                                                       'method' => 'post',
                                                       'invite' => 'true',
                                                       'type' => 'Identi.ca',
                                                       'content' => $content));
-        common_hidden('invite', 'true');
+        $this->hidden('invite', 'true');
         $actiontext = 'Invite your friends to use Identi.ca.';
-        common_element('fb:multi-friend-selector', array('showborder' => 'false',
+        $this->element('fb:multi-friend-selector', array('showborder' => 'false',
                                                                'actiontext' => $actiontext,
                                                                'exclude_ids' => implode(',', $exclude_ids),
                                                                'bypass' => 'cancel'));
 
-        common_element_end('fb:request-form');
+        $this->elementEnd('fb:request-form');
 
-        common_element('h2', null, _('Friends already using Identi.ca:'));
-        common_element_start("ul");
+        $this->element('h2', null, _('Friends already using Identi.ca:'));
+        $this->elementStart("ul");
 
         foreach ($exclude_ids as $friend) {
-            common_element_start('li');
-            common_element('fb:profile-pic', array('uid' => $friend));
-            common_element('fb:name', array('uid' => $friend,
+            $this->elementStart('li');
+            $this->element('fb:profile-pic', array('uid' => $friend));
+            $this->element('fb:name', array('uid' => $friend,
                                             'capitalize' => 'true'));
-            common_element_end('li');
+            $this->elementEnd('li');
         }
 
-        common_element_end("ul");
+        $this->elementEnd("ul");
 
         $this->show_footer();
 
diff --git a/actions/facebooksettings.php b/actions/facebooksettings.php
index ab04ad82b..8b071353a 100644
--- a/actions/facebooksettings.php
+++ b/actions/facebooksettings.php
@@ -68,43 +68,43 @@ class FacebooksettingsAction extends FacebookAction
 
         $this->show_header('Settings', $msg, $success);
 
-        common_element_start('fb:if-section-not-added', array('section' => 'profile'));
-        common_element('h2', null, _('Add an Identi.ca box to my profile'));
-        common_element_start('p');
-        common_element('fb:add-section-button', array('section' => 'profile'));
-        common_element_end('p');
-
-        common_element_end('fb:if-section-not-added');
-        common_element_start('p');
-        common_element_start('fb:prompt-permission', array('perms' => 'status_update'));
-        common_element('h2', null, _('Allow Identi.ca to update my Facebook status'));
-        common_element_end('fb:prompt-permission');
-        common_element_end('p');
+        $this->elementStart('fb:if-section-not-added', array('section' => 'profile'));
+        $this->element('h2', null, _('Add an Identi.ca box to my profile'));
+        $this->elementStart('p');
+        $this->element('fb:add-section-button', array('section' => 'profile'));
+        $this->elementEnd('p');
+
+        $this->elementEnd('fb:if-section-not-added');
+        $this->elementStart('p');
+        $this->elementStart('fb:prompt-permission', array('perms' => 'status_update'));
+        $this->element('h2', null, _('Allow Identi.ca to update my Facebook status'));
+        $this->elementEnd('fb:prompt-permission');
+        $this->elementEnd('p');
 
         if ($facebook->api_client->users_hasAppPermission('status_update')) {
 
-            common_element_start('form', array('method' => 'post',
+            $this->elementStart('form', array('method' => 'post',
                                                'id' => 'facebook_settings'));
 
-            common_element('h2', null, _('Sync preferences'));
+            $this->element('h2', null, _('Sync preferences'));
 
-            common_checkbox('noticesync', _('Automatically update my Facebook status with my notices.'),
+            $this->checkbox('noticesync', _('Automatically update my Facebook status with my notices.'),
                                 ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
 
-            common_checkbox('replysync', _('Send local "@" replies to Facebook.'),
+            $this->checkbox('replysync', _('Send local "@" replies to Facebook.'),
                              ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
 
-            // function common_input($id, $label, $value=null,$instructions=null)
+            // function $this->input($id, $label, $value=null,$instructions=null)
 
             $prefix = $facebook->api_client->data_getUserPreference(1);
             
 
-            common_input('prefix', _('Prefix'),
+            $this->input('prefix', _('Prefix'),
                          ($prefix) ? $prefix : null,
                          _('A string to prefix notices with.'));
-            common_submit('save', _('Save'));
+            $this->submit('save', _('Save'));
 
-            common_element_end('form');
+            $this->elementEnd('form');
 
         }
 
diff --git a/actions/favor.php b/actions/favor.php
index 8103f8181..1dfef9bbb 100644
--- a/actions/favor.php
+++ b/actions/favor.php
@@ -69,13 +69,13 @@ class FavorAction extends Action
         
         if ($this->boolean('ajax')) {
             common_start_html('text/xml;charset=utf-8', true);
-            common_element_start('head');
-            common_element('title', null, _('Disfavor favorite'));
-            common_element_end('head');
-            common_element_start('body');
+            $this->elementStart('head');
+            $this->element('title', null, _('Disfavor favorite'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
             common_disfavor_form($notice);
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             common_redirect(common_local_url('showfavorites',
                                              array('nickname' => $user->nickname)));
diff --git a/actions/favorited.php b/actions/favorited.php
index 71a9e026e..936905732 100644
--- a/actions/favorited.php
+++ b/actions/favorited.php
@@ -43,9 +43,9 @@ class FavoritedAction extends StreamAction
     {
         $instr = $this->get_instructions();
         $output = common_markup_to_html($instr);
-        common_element_start('div', 'instructions');
-        common_raw($output);
-        common_element_end('div');
+        $this->elementStart('div', 'instructions');
+        $this->raw($output);
+        $this->elementEnd('div');
         $this->public_views_menu();
     }
 
@@ -81,7 +81,7 @@ class FavoritedAction extends StreamAction
         $notice = new Notice;
         $notice->query(sprintf($qry, common_config('popular', 'dropoff')));
 
-        common_element_start('ul', array('id' => 'notices'));
+        $this->elementStart('ul', array('id' => 'notices'));
 
         $cnt = 0;
 
@@ -96,7 +96,7 @@ class FavoritedAction extends StreamAction
             $item->show();
         }
 
-        common_element_end('ul');
+        $this->elementEnd('ul');
 
         common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
                           $page, 'favorited');
diff --git a/actions/featured.php b/actions/featured.php
index 2bf8b0b81..035622691 100644
--- a/actions/featured.php
+++ b/actions/featured.php
@@ -44,9 +44,9 @@ class FeaturedAction extends StreamAction
     {
         $instr = $this->get_instructions();
         $output = common_markup_to_html($instr);
-        common_element_start('div', 'instructions');
-        common_raw($output);
-        common_element_end('div');
+        $this->elementStart('div', 'instructions');
+        $this->raw($output);
+        $this->elementEnd('div');
         $this->public_views_menu();
     }
 
diff --git a/actions/finishaddopenid.php b/actions/finishaddopenid.php
index 0ce1680aa..7de631712 100644
--- a/actions/finishaddopenid.php
+++ b/actions/finishaddopenid.php
@@ -101,7 +101,7 @@ class FinishaddopenidAction extends Action
     function message($msg)
     {
         common_show_header(_('OpenID Login'));
-        common_element('p', null, $msg);
+        $this->element('p', null, $msg);
         common_show_footer();
     }
 }
diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php
index bdb8516a3..112429002 100644
--- a/actions/finishopenidlogin.php
+++ b/actions/finishopenidlogin.php
@@ -57,10 +57,10 @@ class FinishopenidloginAction extends Action
     function show_top($error=null)
     {
         if ($error) {
-            common_element('div', array('class' => 'error'), $error);
+            $this->element('div', array('class' => 'error'), $error);
         } else {
             global $config;
-            common_element('div', 'instructions',
+            $this->element('div', 'instructions',
                            sprintf(_('This is the first time you\'ve logged into %s so we must connect your OpenID to a local account. You can either create a new account, or connect with your existing account, if you have one.'), $config['site']['name']));
         }
     }
@@ -70,36 +70,36 @@ class FinishopenidloginAction extends Action
         common_show_header(_('OpenID Account Setup'), null, $error,
                            array($this, 'show_top'));
 
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'account_connect',
                                            'action' => common_local_url('finishopenidlogin')));
-        common_hidden('token', common_session_token());
-        common_element('h2', null,
+        $this->hidden('token', common_session_token());
+        $this->element('h2', null,
                        _('Create new account'));
-        common_element('p', null,
+        $this->element('p', null,
                        _('Create a new user with this nickname.'));
-        common_input('newname', _('New nickname'),
+        $this->input('newname', _('New nickname'),
                      ($username) ? $username : '',
                      _('1-64 lowercase letters or numbers, no punctuation or spaces'));
-        common_element_start('p');
-        common_element('input', array('type' => 'checkbox',
+        $this->elementStart('p');
+        $this->element('input', array('type' => 'checkbox',
                                       'id' => 'license',
                                       'name' => 'license',
                                       'value' => 'true'));
-        common_text(_('My text and files are available under '));
-        common_element('a', array(href => common_config('license', 'url')),
+        $this->text(_('My text and files are available under '));
+        $this->element('a', array(href => common_config('license', 'url')),
                        common_config('license', 'title'));
-        common_text(_(' except this private data: password, email address, IM address, phone number.'));
-        common_element_end('p');
-        common_submit('create', _('Create'));
-        common_element('h2', null,
+        $this->text(_(' except this private data: password, email address, IM address, phone number.'));
+        $this->elementEnd('p');
+        $this->submit('create', _('Create'));
+        $this->element('h2', null,
                        _('Connect existing account'));
-        common_element('p', null,
+        $this->element('p', null,
                        _('If you already have an account, login with your username and password to connect it to your OpenID.'));
-        common_input('nickname', _('Existing nickname'));
-        common_password('password', _('Password'));
-        common_submit('connect', _('Connect'));
-        common_element_end('form');
+        $this->input('nickname', _('Existing nickname'));
+        $this->password('password', _('Password'));
+        $this->submit('connect', _('Connect'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 
@@ -154,7 +154,7 @@ class FinishopenidloginAction extends Action
     function message($msg)
     {
         common_show_header(_('OpenID Login'));
-        common_element('p', null, $msg);
+        $this->element('p', null, $msg);
         common_show_footer();
     }
 
diff --git a/actions/foaf.php b/actions/foaf.php
index 30e98960c..6f73ce505 100644
--- a/actions/foaf.php
+++ b/actions/foaf.php
@@ -54,7 +54,7 @@ class FoafAction extends Action
         header('Content-Type: application/rdf+xml');
 
         common_start_xml();
-        common_element_start('rdf:RDF', array('xmlns:rdf' =>
+        $this->elementStart('rdf:RDF', array('xmlns:rdf' =>
                                               'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
                                               'xmlns:rdfs' =>
                                               'http://www.w3.org/2000/01/rdf-schema#',
@@ -67,25 +67,25 @@ class FoafAction extends Action
         $this->show_ppd('', $user->uri);
 
         # XXX: might not be a person
-        common_element_start('Person', array('rdf:about' =>
+        $this->elementStart('Person', array('rdf:about' =>
                                              $user->uri));
-        common_element('mbox_sha1sum', null, sha1('mailto:' . $user->email));
+        $this->element('mbox_sha1sum', null, sha1('mailto:' . $user->email));
         if ($profile->fullname) {
-            common_element('name', null, $profile->fullname);
+            $this->element('name', null, $profile->fullname);
         }
         if ($profile->homepage) {
-            common_element('homepage', array('rdf:resource' => $profile->homepage));
+            $this->element('homepage', array('rdf:resource' => $profile->homepage));
         }
         if ($profile->bio) {
-            common_element('rdfs:comment', null, $profile->bio);
+            $this->element('rdfs:comment', null, $profile->bio);
         }
         # XXX: more structured location data
         if ($profile->location) {
-            common_element_start('based_near');
-            common_element_start('geo:SpatialThing');
-            common_element('name', null, $profile->location);
-            common_element_end('geo:SpatialThing');
-            common_element_end('based_near');
+            $this->elementStart('based_near');
+            $this->elementStart('geo:SpatialThing');
+            $this->element('name', null, $profile->location);
+            $this->elementEnd('geo:SpatialThing');
+            $this->elementEnd('based_near');
         }
 
         $this->show_microblogging_account($profile, common_root_url());
@@ -93,18 +93,18 @@ class FoafAction extends Action
         $avatar = $profile->getOriginalAvatar();
 
         if ($avatar) {
-            common_element_start('img');
-            common_element_start('Image', array('rdf:about' => $avatar->url));
+            $this->elementStart('img');
+            $this->elementStart('Image', array('rdf:about' => $avatar->url));
             foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
                 $scaled = $profile->getAvatar($size);
                 if (!$scaled->original) { # sometimes the original has one of our scaled sizes
-                    common_element_start('thumbnail');
-                    common_element('Image', array('rdf:about' => $scaled->url));
-                    common_element_end('thumbnail');
+                    $this->elementStart('thumbnail');
+                    $this->element('Image', array('rdf:about' => $scaled->url));
+                    $this->elementEnd('thumbnail');
                 }
             }
-            common_element_end('Image');
-            common_element_end('img');
+            $this->elementEnd('Image');
+            $this->elementEnd('img');
         }
 
         # Get people user is subscribed to
@@ -126,7 +126,7 @@ class FoafAction extends Action
                     common_debug('Got a bad subscription: '.print_r($sub,true));
                     continue;
                 }
-                common_element('knows', array('rdf:resource' => $other->uri));
+                $this->element('knows', array('rdf:resource' => $other->uri));
                 $person[$other->uri] = array(LISTENEE, $other);
             }
         }
@@ -156,7 +156,7 @@ class FoafAction extends Action
             }
         }
 
-        common_element_end('Person');
+        $this->elementEnd('Person');
 
         foreach ($person as $uri => $p) {
             $foaf_url = null;
@@ -164,44 +164,44 @@ class FoafAction extends Action
                 $foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname));
             }
             $profile = Profile::staticGet($p[1]->id);
-            common_element_start('Person', array('rdf:about' => $uri));
+            $this->elementStart('Person', array('rdf:about' => $uri));
             if ($p[0] == LISTENER || $p[0] == BOTH) {
-                common_element('knows', array('rdf:resource' => $user->uri));
+                $this->element('knows', array('rdf:resource' => $user->uri));
             }
             $this->show_microblogging_account($profile, ($p[1] instanceof User) ?
                                               common_root_url() : null);
             if ($foaf_url) {
-                common_element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
+                $this->element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
             }
-            common_element_end('Person');
+            $this->elementEnd('Person');
             if ($foaf_url) {
                 $this->show_ppd($foaf_url, $uri);
             }
         }
 
-        common_element_end('rdf:RDF');
+        $this->elementEnd('rdf:RDF');
     }
 
     function show_ppd($foaf_url, $person_uri)
     {
-        common_element_start('PersonalProfileDocument', array('rdf:about' => $foaf_url));
-        common_element('maker', array('rdf:resource' => $person_uri));
-        common_element('primaryTopic', array('rdf:resource' => $person_uri));
-        common_element_end('PersonalProfileDocument');
+        $this->elementStart('PersonalProfileDocument', array('rdf:about' => $foaf_url));
+        $this->element('maker', array('rdf:resource' => $person_uri));
+        $this->element('primaryTopic', array('rdf:resource' => $person_uri));
+        $this->elementEnd('PersonalProfileDocument');
     }
 
     function show_microblogging_account($profile, $service=null)
     {
         # Their account
-        common_element_start('holdsAccount');
-        common_element_start('OnlineAccount');
+        $this->elementStart('holdsAccount');
+        $this->elementStart('OnlineAccount');
         if ($service) {
-            common_element('accountServiceHomepage', array('rdf:resource' =>
+            $this->element('accountServiceHomepage', array('rdf:resource' =>
                                                            $service));
         }
-        common_element('accountName', null, $profile->nickname);
-        common_element('homepage', array('rdf:resource' => $profile->profileurl));
-        common_element_end('OnlineAccount');
-        common_element_end('holdsAccount');
+        $this->element('accountName', null, $profile->nickname);
+        $this->element('homepage', array('rdf:resource' => $profile->profileurl));
+        $this->elementEnd('OnlineAccount');
+        $this->elementEnd('holdsAccount');
     }
 }
diff --git a/actions/imsettings.php b/actions/imsettings.php
index 8ecf200ec..693f49efa 100644
--- a/actions/imsettings.php
+++ b/actions/imsettings.php
@@ -34,57 +34,57 @@ class ImsettingsAction extends SettingsAction
     {
         $user = common_current_user();
         $this->form_header(_('IM Settings'), $msg, $success);
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'imsettings',
                                            'action' =>
                                            common_local_url('imsettings')));
-        common_hidden('token', common_session_token());
+        $this->hidden('token', common_session_token());
 
-        common_element('h2', null, _('Address'));
+        $this->element('h2', null, _('Address'));
 
         if ($user->jabber) {
-            common_element_start('p');
-            common_element('span', 'address confirmed', $user->jabber);
-            common_element('span', 'input_instructions',
+            $this->elementStart('p');
+            $this->element('span', 'address confirmed', $user->jabber);
+            $this->element('span', 'input_instructions',
                            _('Current confirmed Jabber/GTalk address.'));
-            common_hidden('jabber', $user->jabber);
-            common_element_end('p');
-            common_submit('remove', _('Remove'));
+            $this->hidden('jabber', $user->jabber);
+            $this->elementEnd('p');
+            $this->submit('remove', _('Remove'));
         } else {
             $confirm = $this->get_confirmation();
             if ($confirm) {
-                common_element_start('p');
-                common_element('span', 'address unconfirmed', $confirm->address);
-                common_element('span', 'input_instructions',
+                $this->elementStart('p');
+                $this->element('span', 'address unconfirmed', $confirm->address);
+                $this->element('span', 'input_instructions',
                                 sprintf(_('Awaiting confirmation on this address. Check your Jabber/GTalk account for a message with further instructions. (Did you add %s to your buddy list?)'), jabber_daemon_address()));
-                common_hidden('jabber', $confirm->address);
-                common_element_end('p');
-                common_submit('cancel', _('Cancel'));
+                $this->hidden('jabber', $confirm->address);
+                $this->elementEnd('p');
+                $this->submit('cancel', _('Cancel'));
             } else {
-                common_input('jabber', _('IM Address'),
+                $this->input('jabber', _('IM Address'),
                              ($this->arg('jabber')) ? $this->arg('jabber') : null,
                          sprintf(_('Jabber or GTalk address, like "UserName@example.org". First, make sure to add %s to your buddy list in your IM client or on GTalk.'), jabber_daemon_address()));
-                common_submit('add', _('Add'));
+                $this->submit('add', _('Add'));
             }
         }
 
-        common_element('h2', null, _('Preferences'));
+        $this->element('h2', null, _('Preferences'));
 
-        common_checkbox('jabbernotify',
+        $this->checkbox('jabbernotify',
                         _('Send me notices through Jabber/GTalk.'),
                         $user->jabbernotify);
-        common_checkbox('updatefrompresence',
+        $this->checkbox('updatefrompresence',
                         _('Post a notice when my Jabber/GTalk status changes.'),
                         $user->updatefrompresence);
-        common_checkbox('jabberreplies',
+        $this->checkbox('jabberreplies',
                         _('Send me replies through Jabber/GTalk from people I\'m not subscribed to.'),
                         $user->jabberreplies);
-        common_checkbox('jabbermicroid',
+        $this->checkbox('jabbermicroid',
                         _('Publish a MicroID for my Jabber/GTalk address.'),
                         $user->jabbermicroid);
-        common_submit('save', _('Save'));
+        $this->submit('save', _('Save'));
 
-        common_element_end('form');
+        $this->elementEnd('form');
         common_show_footer();
     }
 
diff --git a/actions/invite.php b/actions/invite.php
index 80e022a3d..15233602e 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -89,29 +89,29 @@ class InviteAction extends Action
 
         common_show_header(_('Invitation(s) sent'));
         if ($already) {
-            common_element('p', null, _('You are already subscribed to these users:'));
-            common_element_start('ul');
+            $this->element('p', null, _('You are already subscribed to these users:'));
+            $this->elementStart('ul');
             foreach ($already as $other) {
-                common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
+                $this->element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
             }
-            common_element_end('ul');
+            $this->elementEnd('ul');
         }
         if ($subbed) {
-            common_element('p', null, _('These people are already users and you were automatically subscribed to them:'));
-            common_element_start('ul');
+            $this->element('p', null, _('These people are already users and you were automatically subscribed to them:'));
+            $this->elementStart('ul');
             foreach ($subbed as $other) {
-                common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
+                $this->element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
             }
-            common_element_end('ul');
+            $this->elementEnd('ul');
         }
         if ($sent) {
-            common_element('p', null, _('Invitation(s) sent to the following people:'));
-            common_element_start('ul');
+            $this->element('p', null, _('Invitation(s) sent to the following people:'));
+            $this->elementStart('ul');
             foreach ($sent as $other) {
-                common_element('li', null, $other);
+                $this->element('li', null, $other);
             }
-            common_element_end('ul');
-            common_element('p', null, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
+            $this->elementEnd('ul');
+            $this->element('p', null, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
         }
         common_show_footer();
     }
@@ -119,12 +119,12 @@ class InviteAction extends Action
     function show_top($error=null)
     {
         if ($error) {
-            common_element('p', 'error', $error);
+            $this->element('p', 'error', $error);
         } else {
-            common_element_start('div', 'instructions');
-            common_element('p', null,
+            $this->elementStart('div', 'instructions');
+            $this->element('p', null,
                            _('Use this form to invite your friends and colleagues to use this service.'));
-            common_element_end('div');
+            $this->elementEnd('div');
         }
     }
 
@@ -135,22 +135,22 @@ class InviteAction extends Action
 
         common_show_header(_('Invite new users'), null, $error, array($this, 'show_top'));
 
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'invite',
                                            'action' => common_local_url('invite')));
-        common_hidden('token', common_session_token());
+        $this->hidden('token', common_session_token());
 
-        common_textarea('addresses', _('Email addresses'),
+        $this->textarea('addresses', _('Email addresses'),
                         $this->trimmed('addresses'),
                         _('Addresses of friends to invite (one per line)'));
 
-        common_textarea('personal', _('Personal message'),
+        $this->textarea('personal', _('Personal message'),
                         $this->trimmed('personal'),
                         _('Optionally add a personal message to the invitation.'));
 
-        common_submit('send', _('Send'));
+        $this->submit('send', _('Send'));
 
-        common_element_end('form');
+        $this->elementEnd('form');
 
         common_show_footer();
     }
diff --git a/actions/login.php b/actions/login.php
index 8600d44fd..fd98e656d 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -106,22 +106,45 @@ class LoginAction extends Action
 
     function show_form($error=null)
     {
-        common_show_header(_('Login'), null, $error, array($this, 'show_top'));
-        common_element_start('form', array('method' => 'post',
+	$this->error = $error;
+	$this->showPage();
+    }
+
+    function title()
+    {
+	return _('Login');
+    }
+
+    function showPageNotice()
+    {
+        if ($this->error) {
+            $this->element('p', 'error', $this->error);
+        } else {
+            $instr = $this->get_instructions();
+            $output = common_markup_to_html($instr);
+	    $this->elementStart('div', 'instructions');
+            $this->raw($output);
+            $this->elementEnd('div');
+        }
+    }
+    
+    function showContent()
+    {      
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'login',
                                            'action' => common_local_url('login')));
-        common_input('nickname', _('Nickname'));
-        common_password('password', _('Password'));
-        common_checkbox('rememberme', _('Remember me'), false,
+        $this->input('nickname', _('Nickname'));
+        $this->password('password', _('Password'));
+        $this->checkbox('rememberme', _('Remember me'), false,
                         _('Automatically login in the future; ' .
                            'not for shared computers!'));
-        common_submit('submit', _('Login'));
-        common_hidden('token', common_session_token());
-        common_element_end('form');
-        common_element_start('p');
-        common_element('a', array('href' => common_local_url('recoverpassword')),
+        $this->submit('submit', _('Login'));
+        $this->hidden('token', common_session_token());
+        $this->elementEnd('form');
+        $this->elementStart('p');
+        $this->element('a', array('href' => common_local_url('recoverpassword')),
                        _('Lost or forgotten password?'));
-        common_element_end('p');
+        $this->elementEnd('p');
         common_show_footer();
     }
 
@@ -146,14 +169,5 @@ class LoginAction extends Action
 
     function show_top($error=null)
     {
-        if ($error) {
-            common_element('p', 'error', $error);
-        } else {
-            $instr = $this->get_instructions();
-            $output = common_markup_to_html($instr);
-            common_element_start('div', 'instructions');
-            common_raw($output);
-            common_element_end('div');
-        }
     }
 }
diff --git a/actions/newmessage.php b/actions/newmessage.php
index 27fa9d518..6221b67e9 100644
--- a/actions/newmessage.php
+++ b/actions/newmessage.php
@@ -127,7 +127,7 @@ class NewmessageAction extends Action
                            array($this, 'show_top'));
         
         if ($msg) {
-            common_element('p', array('id'=>'error'), $msg);
+            $this->element('p', array('id'=>'error'), $msg);
         }
         
         common_show_footer();
diff --git a/actions/newnotice.php b/actions/newnotice.php
index c412e893d..89792d95a 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -92,13 +92,13 @@ class NewnoticeAction extends Action
 
         if ($this->boolean('ajax')) {
             common_start_html('text/xml;charset=utf-8', true);
-            common_element_start('head');
-            common_element('title', null, _('Notice posted'));
-            common_element_end('head');
-            common_element_start('body');
+            $this->elementStart('head');
+            $this->element('title', null, _('Notice posted'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
             $this->show_notice($notice);
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             $returnto = $this->trimmed('returnto');
 
@@ -116,13 +116,13 @@ class NewnoticeAction extends Action
     function ajax_error_msg($msg)
     {
         common_start_html('text/xml;charset=utf-8', true);
-        common_element_start('head');
-        common_element('title', null, _('Ajax Error'));
-        common_element_end('head');
-        common_element_start('body');
-        common_element('p', array('id' => 'error'), $msg);
-        common_element_end('body');
-        common_element_end('html');
+        $this->elementStart('head');
+        $this->element('title', null, _('Ajax Error'));
+        $this->elementEnd('head');
+        $this->elementStart('body');
+        $this->element('p', array('id' => 'error'), $msg);
+        $this->elementEnd('body');
+        $this->elementEnd('html');
     }
 
     function show_top($content=null)
@@ -147,7 +147,7 @@ class NewnoticeAction extends Action
         common_show_header(_('New notice'), null, $content,
                            array($this, 'show_top'));
         if ($msg) {
-            common_element('p', array('id' => 'error'), $msg);
+            $this->element('p', array('id' => 'error'), $msg);
         }
         common_show_footer();
     }
diff --git a/actions/noticesearch.php b/actions/noticesearch.php
index b36fc8ad2..d998b9da8 100644
--- a/actions/noticesearch.php
+++ b/actions/noticesearch.php
@@ -58,7 +58,7 @@ class NoticesearchAction extends SearchAction
         }
         if ($cnt > 0) {
             $terms = preg_split('/[\s,]+/', $q);
-            common_element_start('ul', array('id' => 'notices'));
+            $this->elementStart('ul', array('id' => 'notices'));
             for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
                 if ($notice->fetch()) {
                     $this->show_notice($notice, $terms);
@@ -67,9 +67,9 @@ class NoticesearchAction extends SearchAction
                     break;
                 }
             }
-            common_element_end('ul');
+            $this->elementEnd('ul');
         } else {
-            common_element('p', 'error', _('No results'));
+            $this->element('p', 'error', _('No results'));
         }
 
         common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
@@ -82,7 +82,7 @@ class NoticesearchAction extends SearchAction
             $q = $arr[0];
         }
         if ($q) {
-            common_element('link', array('rel' => 'alternate',
+            $this->element('link', array('rel' => 'alternate',
                                          'href' => common_local_url('noticesearchrss',
                                                                     array('q' => $q)),
                                          'type' => 'application/rss+xml',
@@ -101,58 +101,58 @@ class NoticesearchAction extends SearchAction
             return;
         }
         # XXX: RDFa
-        common_element_start('li', array('class' => 'notice_single',
+        $this->elementStart('li', array('class' => 'notice_single',
                                           'id' => 'notice-' . $notice->id));
         $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
-        common_element_start('a', array('href' => $profile->profileurl));
-        common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
+        $this->elementStart('a', array('href' => $profile->profileurl));
+        $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
                                     'class' => 'avatar stream',
                                     'width' => AVATAR_STREAM_SIZE,
                                     'height' => AVATAR_STREAM_SIZE,
                                     'alt' =>
                                     ($profile->fullname) ? $profile->fullname :
                                     $profile->nickname));
-        common_element_end('a');
-        common_element('a', array('href' => $profile->profileurl,
+        $this->elementEnd('a');
+        $this->element('a', array('href' => $profile->profileurl,
                                   'class' => 'nickname'),
                        $profile->nickname);
         # FIXME: URL, image, video, audio
-        common_element_start('p', array('class' => 'content'));
+        $this->elementStart('p', array('class' => 'content'));
         if ($notice->rendered) {
-            common_raw($this->highlight($notice->rendered, $terms));
+            $this->raw($this->highlight($notice->rendered, $terms));
         } else {
             # XXX: may be some uncooked notices in the DB,
             # we cook them right now. This should probably disappear in future
             # versions (>> 0.4.x)
-            common_raw($this->highlight(common_render_content($notice->content, $notice), $terms));
+            $this->raw($this->highlight(common_render_content($notice->content, $notice), $terms));
         }
-        common_element_end('p');
+        $this->elementEnd('p');
         $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
-        common_element_start('p', 'time');
-        common_element('a', array('class' => 'permalink',
+        $this->elementStart('p', 'time');
+        $this->element('a', array('class' => 'permalink',
                                   'href' => $noticeurl,
                                   'title' => common_exact_date($notice->created)),
                        common_date_string($notice->created));
         if ($notice->reply_to) {
             $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
-            common_text(' (');
-            common_element('a', array('class' => 'inreplyto',
+            $this->text(' (');
+            $this->element('a', array('class' => 'inreplyto',
                                       'href' => $replyurl),
                            _('in reply to...'));
-            common_text(')');
+            $this->text(')');
         }
-        common_element_start('a',
+        $this->elementStart('a',
                              array('href' => common_local_url('newnotice',
                                                               array('replyto' => $profile->nickname)),
                                    'onclick' => 'doreply("'.$profile->nickname.'"); return false',
                                    'title' => _('reply'),
                                    'class' => 'replybutton'));
-        common_hidden('posttoken', common_session_token());
+        $this->hidden('posttoken', common_session_token());
         
-        common_raw('&rarr;');
-        common_element_end('a');
-        common_element_end('p');
-        common_element_end('li');
+        $this->raw('&rarr;');
+        $this->elementEnd('a');
+        $this->elementEnd('p');
+        $this->elementEnd('li');
     }
 
     function highlight($text, $terms)
diff --git a/actions/nudge.php b/actions/nudge.php
index a6480a582..de930e462 100644
--- a/actions/nudge.php
+++ b/actions/nudge.php
@@ -59,13 +59,13 @@ class NudgeAction extends Action
 
         if ($this->boolean('ajax')) {
             common_start_html('text/xml;charset=utf-8', true);
-            common_element_start('head');
-            common_element('title', null, _('Nudge sent'));
-            common_element_end('head');
-            common_element_start('body');
+            $this->elementStart('head');
+            $this->element('title', null, _('Nudge sent'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
             common_nudge_response();
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             // display a confirmation to the user
             common_redirect(common_local_url('showstream',
diff --git a/actions/openidlogin.php b/actions/openidlogin.php
index 09679e372..82791af34 100644
--- a/actions/openidlogin.php
+++ b/actions/openidlogin.php
@@ -66,13 +66,13 @@ class OpenidloginAction extends Action
     function show_top($error=null)
     {
         if ($error) {
-            common_element('div', array('class' => 'error'), $error);
+            $this->element('div', array('class' => 'error'), $error);
         } else {
             $instr = $this->get_instructions();
             $output = common_markup_to_html($instr);
-            common_element_start('div', 'instructions');
-            common_raw($output);
-            common_element_end('div');
+            $this->elementStart('div', 'instructions');
+            $this->raw($output);
+            $this->elementEnd('div');
         }
     }
 
@@ -80,18 +80,18 @@ class OpenidloginAction extends Action
     {
         common_show_header(_('OpenID Login'), null, $error, array($this, 'show_top'));
         $formaction = common_local_url('openidlogin');
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'openidlogin',
                                            'action' => $formaction));
-        common_hidden('token', common_session_token());
-        common_input('openid_url', _('OpenID URL'),
+        $this->hidden('token', common_session_token());
+        $this->input('openid_url', _('OpenID URL'),
                      $openid_url,
                      _('Your OpenID URL'));
-        common_checkbox('rememberme', _('Remember me'), false,
+        $this->checkbox('rememberme', _('Remember me'), false,
                         _('Automatically login in the future; ' .
                            'not for shared computers!'));
-        common_submit('submit', _('Login'));
-        common_element_end('form');
+        $this->submit('submit', _('Login'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 }
diff --git a/actions/openidsettings.php b/actions/openidsettings.php
index 039236048..9265b5ea6 100644
--- a/actions/openidsettings.php
+++ b/actions/openidsettings.php
@@ -39,28 +39,28 @@ class OpenidsettingsAction extends SettingsAction
 
         $this->form_header(_('OpenID settings'), $msg, $success);
 
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'openidadd',
                                            'action' =>
                                            common_local_url('openidsettings')));
-        common_hidden('token', common_session_token());
-        common_element('h2', null, _('Add OpenID'));
-        common_element('p', null,
+        $this->hidden('token', common_session_token());
+        $this->element('h2', null, _('Add OpenID'));
+        $this->element('p', null,
                        _('If you want to add an OpenID to your account, ' .
                           'enter it in the box below and click "Add".'));
-        common_element_start('p');
-        common_element('label', array('for' => 'openid_url'),
+        $this->elementStart('p');
+        $this->element('label', array('for' => 'openid_url'),
                        _('OpenID URL'));
-        common_element('input', array('name' => 'openid_url',
+        $this->element('input', array('name' => 'openid_url',
                                       'type' => 'text',
                                       'id' => 'openid_url'));
-        common_element('input', array('type' => 'submit',
+        $this->element('input', array('type' => 'submit',
                                       'id' => 'add',
                                       'name' => 'add',
                                       'class' => 'submit',
                                       'value' => _('Add')));
-        common_element_end('p');
-        common_element_end('form');
+        $this->elementEnd('p');
+        $this->elementEnd('form');
 
         $oid = new User_openid();
         $oid->user_id = $user->id;
@@ -69,48 +69,48 @@ class OpenidsettingsAction extends SettingsAction
 
         if ($cnt > 0) {
 
-            common_element('h2', null, _('Remove OpenID'));
+            $this->element('h2', null, _('Remove OpenID'));
 
             if ($cnt == 1 && !$user->password) {
 
-                common_element('p', null,
+                $this->element('p', null,
                                _('Removing your only OpenID would make it impossible to log in! ' .
                                   'If you need to remove it, add another OpenID first.'));
 
                 if ($oid->fetch()) {
-                    common_element_start('p');
-                    common_element('a', array('href' => $oid->canonical),
+                    $this->elementStart('p');
+                    $this->element('a', array('href' => $oid->canonical),
                                    $oid->display);
-                    common_element_end('p');
+                    $this->elementEnd('p');
                 }
 
             } else {
 
-                common_element('p', null,
+                $this->element('p', null,
                                _('You can remove an OpenID from your account '.
                                   'by clicking the button marked "Remove".'));
                 $idx = 0;
 
                 while ($oid->fetch()) {
-                    common_element_start('form', array('method' => 'POST',
+                    $this->elementStart('form', array('method' => 'POST',
                                                        'id' => 'openiddelete' . $idx,
                                                        'action' =>
                                                        common_local_url('openidsettings')));
-                    common_element_start('p');
-                    common_hidden('token', common_session_token());
-                    common_element('a', array('href' => $oid->canonical),
+                    $this->elementStart('p');
+                    $this->hidden('token', common_session_token());
+                    $this->element('a', array('href' => $oid->canonical),
                                    $oid->display);
-                    common_element('input', array('type' => 'hidden',
+                    $this->element('input', array('type' => 'hidden',
                                                   'id' => 'openid_url'.$idx,
                                                   'name' => 'openid_url',
                                                   'value' => $oid->canonical));
-                    common_element('input', array('type' => 'submit',
+                    $this->element('input', array('type' => 'submit',
                                                   'id' => 'remove'.$idx,
                                                   'name' => 'remove',
                                                   'class' => 'submit',
                                                   'value' => _('Remove')));
-                    common_element_end('p');
-                    common_element_end('form');
+                    $this->elementEnd('p');
+                    $this->elementEnd('form');
                     $idx++;
                 }
             }
diff --git a/actions/opensearch.php b/actions/opensearch.php
index 96691fa6f..6e6e794e9 100644
--- a/actions/opensearch.php
+++ b/actions/opensearch.php
@@ -41,21 +41,21 @@ class OpensearchAction extends Action
         header('Content-Type: text/html');
 
         common_start_xml();
-        common_element_start('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
+        $this->elementStart('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
 
         $short_name =  common_config('site', 'name').' '.$short_name;
-        common_element('ShortName', null, $short_name);
-        common_element('Contact', null, common_config('site', 'email'));
-        common_element('Url', array('type' => 'text/html', 'method' => 'get',
+        $this->element('ShortName', null, $short_name);
+        $this->element('Contact', null, common_config('site', 'email'));
+        $this->element('Url', array('type' => 'text/html', 'method' => 'get',
                        'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
-        common_element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
-        common_element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
-        common_element('AdultContent', null, 'false');
-        common_element('Language', null, common_language());
-        common_element('OutputEncoding', null, 'UTF-8');
-        common_element('InputEncoding', null, 'UTF-8');
-
-        common_element_end('OpenSearchDescription');
+        $this->element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
+        $this->element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
+        $this->element('AdultContent', null, 'false');
+        $this->element('Language', null, common_language());
+        $this->element('OutputEncoding', null, 'UTF-8');
+        $this->element('InputEncoding', null, 'UTF-8');
+
+        $this->elementEnd('OpenSearchDescription');
         common_end_xml();
     }
 }
diff --git a/actions/othersettings.php b/actions/othersettings.php
index c2f08934c..97cbd0094 100644
--- a/actions/othersettings.php
+++ b/actions/othersettings.php
@@ -35,12 +35,12 @@ class OthersettingsAction extends SettingsAction
 
         $this->form_header(_('Other Settings'), $msg, $success);
 
-        common_element('h2', null, _('URL Auto-shortening'));
-        common_element_start('form', array('method' => 'post',
+        $this->element('h2', null, _('URL Auto-shortening'));
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'othersettings',
                                            'action' =>
                                            common_local_url('othersettings')));
-        common_hidden('token', common_session_token());
+        $this->hidden('token', common_session_token());
 
         $services = array(
             '' => 'None',
@@ -54,13 +54,13 @@ class OthersettingsAction extends SettingsAction
             'metamark.net' => 'metamark.net'
         );
 
-        common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), false, $user->urlshorteningservice);
+        $this->dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), false, $user->urlshorteningservice);
 
-        common_submit('save', _('Save'));
+        $this->submit('save', _('Save'));
 
-        common_element_end('form');
+        $this->elementEnd('form');
 
-//        common_element('h2', null, _('Delete my account'));
+//        $this->element('h2', null, _('Delete my account'));
 //        $this->show_delete_form();
 
         common_show_footer();
@@ -68,15 +68,15 @@ class OthersettingsAction extends SettingsAction
 
     function show_feeds_list($feeds)
     {
-        common_element_start('div', array('class' => 'feedsdel'));
-        common_element('p', null, 'Feeds:');
-        common_element_start('ul', array('class' => 'xoxo'));
+        $this->elementStart('div', array('class' => 'feedsdel'));
+        $this->element('p', null, 'Feeds:');
+        $this->elementStart('ul', array('class' => 'xoxo'));
 
         foreach ($feeds as $key => $value) {
             $this->common_feed_item($feeds[$key]);
         }
-        common_element_end('ul');
-        common_element_end('div');
+        $this->elementEnd('ul');
+        $this->elementEnd('div');
     }
 
     //TODO move to common.php (and retrace its origin)
@@ -100,13 +100,13 @@ class OthersettingsAction extends SettingsAction
                 $feed['textContent'] = "FOAF";
                 break;
         }
-        common_element_start('li');
-        common_element('a', array('href' => $feed['href'],
+        $this->elementStart('li');
+        $this->element('a', array('href' => $feed['href'],
                                   'class' => $feed_classname,
                                   'type' => $feed_mimetype,
                                   'title' => $feed_title),
                             $feed['textContent']);
-        common_element_end('li');
+        $this->elementEnd('li');
     }
 
 //    function show_delete_form() {
@@ -115,13 +115,13 @@ class OthersettingsAction extends SettingsAction
 //      $notices->profile_id = $user->id;
 //      $notice_count = (int) $notices->count();
 //
-//        common_element_start('form', array('method' => 'POST',
+//        $this->elementStart('form', array('method' => 'POST',
 //                                           'id' => 'delete',
 //                                           'action' =>
 //                                           common_local_url('deleteprofile')));
 //
-//        common_hidden('token', common_session_token());
-//      common_element('p', null, "You can copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
+//        $this->hidden('token', common_session_token());
+//      $this->element('p', null, "You can copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
 //
 //        $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
 //                                              'type' => 'rss',
@@ -132,8 +132,8 @@ class OthersettingsAction extends SettingsAction
 //                                              'version' => 'FOAF',
 //                                              'item' => 'foaf')));
 //
-//        common_submit('deleteaccount', _('Delete my account'));
-//        common_element_end('form');
+//        $this->submit('deleteaccount', _('Delete my account'));
+//        $this->elementEnd('form');
 //    }
 
     function handle_post()
diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php
index 0d0fae4e5..2b13b0812 100644
--- a/actions/peoplesearch.php
+++ b/actions/peoplesearch.php
@@ -60,7 +60,7 @@ class PeoplesearchAction extends SearchAction
             $results = new PeopleSearchResults($profile, $terms);
             $results->show_list();
         } else {
-            common_element('p', 'error', _('No results'));
+            $this->element('p', 'error', _('No results'));
         }
 
         $profile->free();
diff --git a/actions/peopletag.php b/actions/peopletag.php
index 13a0b7a41..2680638d7 100644
--- a/actions/peopletag.php
+++ b/actions/peopletag.php
@@ -90,11 +90,11 @@ class PeopletagAction extends Action
     {
         $instr = sprintf(_('These are users who have tagged themselves "%s" ' .
                            'to show a common interest, characteristic, hobby or job.'), $tag);
-        common_element_start('div', 'instructions');
-        common_element_start('p');
-        common_text($instr);
-        common_element_end('p');
-        common_element_end('div');
+        $this->elementStart('div', 'instructions');
+        $this->elementStart('p');
+        $this->text($instr);
+        $this->elementEnd('p');
+        $this->elementEnd('div');
     }
 
     function get_title()
diff --git a/actions/profilesettings.php b/actions/profilesettings.php
index d861919b9..ef45fc1d9 100644
--- a/actions/profilesettings.php
+++ b/actions/profilesettings.php
@@ -34,11 +34,11 @@ class ProfilesettingsAction extends SettingsAction
     {
         $this->form_header(_('Profile settings'), $msg, $success);
         $this->show_settings_form();
-        common_element('h2', null, _('Avatar'));
+        $this->element('h2', null, _('Avatar'));
         $this->show_avatar_form();
-        common_element('h2', null, _('Change password'));
+        $this->element('h2', null, _('Change password'));
         $this->show_password_form();
-//        common_element('h2', null, _('Delete my account'));
+//        $this->element('h2', null, _('Delete my account'));
 //        $this->show_delete_form();
         common_show_footer();
     }
@@ -74,46 +74,46 @@ class ProfilesettingsAction extends SettingsAction
         $user = common_current_user();
         $profile = $user->getProfile();
 
-        common_element_start('form', array('method' => 'POST',
+        $this->elementStart('form', array('method' => 'POST',
                                            'id' => 'profilesettings',
                                            'action' => common_local_url('profilesettings')));
-        common_hidden('token', common_session_token());
+        $this->hidden('token', common_session_token());
         
         # too much common patterns here... abstractable?
         
-        common_input('nickname', _('Nickname'),
+        $this->input('nickname', _('Nickname'),
                      ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
                      _('1-64 lowercase letters or numbers, no punctuation or spaces'));
-        common_input('fullname', _('Full name'),
+        $this->input('fullname', _('Full name'),
                      ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
-        common_input('homepage', _('Homepage'),
+        $this->input('homepage', _('Homepage'),
                      ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
                      _('URL of your homepage, blog, or profile on another site'));
-        common_textarea('bio', _('Bio'),
+        $this->textarea('bio', _('Bio'),
                         ($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
                         _('Describe yourself and your interests in 140 chars'));
-        common_input('location', _('Location'),
+        $this->input('location', _('Location'),
                      ($this->arg('location')) ? $this->arg('location') : $profile->location,
                      _('Where you are, like "City, State (or Region), Country"'));
-        common_input('tags', _('Tags'),
+        $this->input('tags', _('Tags'),
                      ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
                      _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
 
         $language = common_language();
-        common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), true, $language);
+        $this->dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), true, $language);
         $timezone = common_timezone();
         $timezones = array();
         foreach(DateTimeZone::listIdentifiers() as $k => $v) {
             $timezones[$v] = $v;
         }
-        common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), true, $timezone);
+        $this->dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), true, $timezone);
 
-        common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'),
+        $this->checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'),
                         ($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe);
 
-        common_submit('save', _('Save'));
+        $this->submit('save', _('Save'));
 
-        common_element_end('form');
+        $this->elementEnd('form');
 
     }
 
@@ -132,62 +132,62 @@ class ProfilesettingsAction extends SettingsAction
         $original = $profile->getOriginalAvatar();
 
 
-        common_element_start('form', array('enctype' => 'multipart/form-data',
+        $this->elementStart('form', array('enctype' => 'multipart/form-data',
                                            'method' => 'POST',
                                            'id' => 'avatar',
                                            'action' =>
                                            common_local_url('profilesettings')));
-        common_hidden('token', common_session_token());
+        $this->hidden('token', common_session_token());
 
         if ($original) {
-            common_element_start('div', array('id'=>'avatar_original', 'class'=>'avatar_view'));
-            common_element('h3', null, _("Original:"));
-            common_element_start('div', array('id'=>'avatar_original_view'));
-            common_element('img', array('src' => $original->url,
+            $this->elementStart('div', array('id'=>'avatar_original', 'class'=>'avatar_view'));
+            $this->element('h3', null, _("Original:"));
+            $this->elementStart('div', array('id'=>'avatar_original_view'));
+            $this->element('img', array('src' => $original->url,
                                         'class' => 'avatar original',
                                         'width' => $original->width,
                                         'height' => $original->height,
                                         'alt' => $user->nickname));
-            common_element_end('div');
-            common_element_end('div');
+            $this->elementEnd('div');
+            $this->elementEnd('div');
         }
 
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
 
         if ($avatar) {
-            common_element_start('div', array('id'=>'avatar_preview', 'class'=>'avatar_view'));
-            common_element('h3', null, _("Preview:"));
-            common_element_start('div', array('id'=>'avatar_preview_view'));
-            common_element('img', array('src' => $original->url,//$avatar->url,
+            $this->elementStart('div', array('id'=>'avatar_preview', 'class'=>'avatar_view'));
+            $this->element('h3', null, _("Preview:"));
+            $this->elementStart('div', array('id'=>'avatar_preview_view'));
+            $this->element('img', array('src' => $original->url,//$avatar->url,
                                         'class' => 'avatar profile',
                                         'width' => AVATAR_PROFILE_SIZE,
                                         'height' => AVATAR_PROFILE_SIZE,
                                         'alt' => $user->nickname));
-            common_element_end('div');
-            common_element_end('div');
+            $this->elementEnd('div');
+            $this->elementEnd('div');
 
             foreach(array('avatar_crop_x', 'avatar_crop_y', 'avatar_crop_w', 'avatar_crop_h') as $crop_info) {
-                common_element('input', array('name' => $crop_info,
+                $this->element('input', array('name' => $crop_info,
                                               'type' => 'hidden',
                                               'id' => $crop_info));
             }
-            common_submit('crop', _('Crop'));
+            $this->submit('crop', _('Crop'));
         }
 
-        common_element('input', array('name' => 'MAX_FILE_SIZE',
+        $this->element('input', array('name' => 'MAX_FILE_SIZE',
                                       'type' => 'hidden',
                                       'id' => 'MAX_FILE_SIZE',
                                       'value' => MAX_AVATAR_SIZE));
 
-        common_element_start('p');
+        $this->elementStart('p');
 
-        common_element('input', array('name' => 'avatarfile',
+        $this->element('input', array('name' => 'avatarfile',
                                       'type' => 'file',
                                       'id' => 'avatarfile'));
-        common_element_end('p');
+        $this->elementEnd('p');
 
-        common_submit('upload', _('Upload'));
-        common_element_end('form');
+        $this->submit('upload', _('Upload'));
+        $this->elementEnd('form');
 
     }
 
@@ -195,23 +195,23 @@ class ProfilesettingsAction extends SettingsAction
     {
 
         $user = common_current_user();
-        common_element_start('form', array('method' => 'POST',
+        $this->elementStart('form', array('method' => 'POST',
                                            'id' => 'password',
                                            'action' =>
                                            common_local_url('profilesettings')));
 
-        common_hidden('token', common_session_token());
+        $this->hidden('token', common_session_token());
 
         # Users who logged in with OpenID won't have a pwd
         if ($user->password) {
-            common_password('oldpassword', _('Old password'));
+            $this->password('oldpassword', _('Old password'));
         }
-        common_password('newpassword', _('New password'),
+        $this->password('newpassword', _('New password'),
                         _('6 or more characters'));
-        common_password('confirm', _('Confirm'),
+        $this->password('confirm', _('Confirm'),
                         _('same as password above'));
-        common_submit('changepass', _('Change'));
-        common_element_end('form');
+        $this->submit('changepass', _('Change'));
+        $this->elementEnd('form');
     }
 
     function save_profile()
diff --git a/actions/publicxrds.php b/actions/publicxrds.php
index 3d731d79f..f66e34533 100644
--- a/actions/publicxrds.php
+++ b/actions/publicxrds.php
@@ -39,45 +39,45 @@ class PublicxrdsAction extends Action
         header('Content-Type: application/xrds+xml');
 
         common_start_xml();
-        common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
+        $this->elementStart('XRDS', array('xmlns' => 'xri://$xrds'));
 
-        common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
+        $this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
 
-        common_element('Type', null, 'xri://$xrds*simple');
+        $this->element('Type', null, 'xri://$xrds*simple');
 
         foreach (array('finishopenidlogin', 'finishaddopenid', 'finishimmediate') as $finish) {
             $this->show_service(Auth_OpenID_RP_RETURN_TO_URL_TYPE,
                                 common_local_url($finish));
         }
 
-        common_element_end('XRD');
+        $this->elementEnd('XRD');
 
-        common_element_end('XRDS');
+        $this->elementEnd('XRDS');
         common_end_xml();
     }
 
     function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
     {
-        common_element_start('Service');
+        $this->elementStart('Service');
         if ($uri) {
-            common_element('URI', null, $uri);
+            $this->element('URI', null, $uri);
         }
-        common_element('Type', null, $type);
+        $this->element('Type', null, $type);
         if ($params) {
             foreach ($params as $param) {
-                common_element('Type', null, $param);
+                $this->element('Type', null, $param);
             }
         }
         if ($sigs) {
             foreach ($sigs as $sig) {
-                common_element('Type', null, $sig);
+                $this->element('Type', null, $sig);
             }
         }
         if ($localId) {
-            common_element('LocalID', null, $localId);
+            $this->element('LocalID', null, $localId);
         }
-        common_element_end('Service');
+        $this->elementEnd('Service');
     }
 }
\ No newline at end of file
diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php
index bb6ef81d6..3e6ecfb1f 100644
--- a/actions/recoverpassword.php
+++ b/actions/recoverpassword.php
@@ -141,24 +141,24 @@ class RecoverpasswordAction extends Action
     function show_top($msg=null)
     {
         if ($msg) {
-            common_element('div', 'error', $msg);
+            $this->element('div', 'error', $msg);
         } else {
-            common_element_start('div', 'instructions');
-            common_element('p', null, 
+            $this->elementStart('div', 'instructions');
+            $this->element('p', null, 
                            _('If you\'ve forgotten or lost your' .
                               ' password, you can get a new one sent to' .
                               ' the email address you have stored ' .
                               ' in your account.'));
-            common_element_end('div');
+            $this->elementEnd('div');
         }
     }
 
     function show_password_top($msg=null)
     {
         if ($msg) {
-            common_element('div', 'error', $msg);
+            $this->element('div', 'error', $msg);
         } else {
-            common_element('div', 'instructions',
+            $this->element('div', 'instructions',
                            _('You\'ve been identified. Enter a ' .
                               ' new password below. '));
         }
@@ -170,15 +170,15 @@ class RecoverpasswordAction extends Action
         common_show_header(_('Recover password'), null,
         $msg, array($this, 'show_top'));
 
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'recoverpassword',
                                            'action' => common_local_url('recoverpassword')));
-        common_input('nicknameoremail', _('Nickname or email'),
+        $this->input('nicknameoremail', _('Nickname or email'),
                      $this->trimmed('nicknameoremail'),
                      _('Your nickname on this server, ' .
                         'or your registered email address.'));
-        common_submit('recover', _('Recover'));
-        common_element_end('form');
+        $this->submit('recover', _('Recover'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 
@@ -188,16 +188,16 @@ class RecoverpasswordAction extends Action
         common_show_header(_('Reset password'), null,
         $msg, array($this, 'show_password_top'));
 
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'recoverpassword',
                                            'action' => common_local_url('recoverpassword')));
-        common_hidden('token', common_session_token());
-        common_password('newpassword', _('New password'),
+        $this->hidden('token', common_session_token());
+        $this->password('newpassword', _('New password'),
                         _('6 or more characters, and don\'t forget it!'));
-        common_password('confirm', _('Confirm'),
+        $this->password('confirm', _('Confirm'),
                         _('Same as password above'));
-        common_submit('reset', _('Reset'));
-        common_element_end('form');
+        $this->submit('reset', _('Reset'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 
@@ -278,7 +278,7 @@ class RecoverpasswordAction extends Action
         mail_to_user($user, _('Password recovery requested'), $body, $confirm->address);
 
         common_show_header(_('Password recovery requested'));
-        common_element('p', null,
+        $this->element('p', null,
                        _('Instructions for recovering your password ' .
                           'have been sent to the email address registered to your ' .
                           'account.'));
@@ -336,7 +336,7 @@ class RecoverpasswordAction extends Action
         common_real_login(true);
 
         common_show_header(_('Password saved.'));
-        common_element('p', null, _('New password successfully saved. ' .
+        $this->element('p', null, _('New password successfully saved. ' .
                                      'You are now logged in.'));
         common_show_footer();
     }
diff --git a/actions/register.php b/actions/register.php
index c479816ef..bac179687 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -155,16 +155,16 @@ class RegisterAction extends Action
     function show_top($error=null)
     {
         if ($error) {
-            common_element('p', 'error', $error);
+            $this->element('p', 'error', $error);
         } else {
             $instr = common_markup_to_html(_('With this form you can create a new account. ' .
                                              'You can then post notices and link up to friends and colleagues. '.
                                              '(Have an [OpenID](http://openid.net/)? ' .
                                              'Try our [OpenID registration](%%action.openidlogin%%)!)'));
 
-            common_element_start('div', 'instructions');
-            common_raw($instr);
-            common_element_end('div');
+            $this->elementStart('div', 'instructions');
+            $this->raw($instr);
+            $this->elementEnd('div');
         }
     }
 
@@ -184,45 +184,45 @@ class RegisterAction extends Action
         }
 
         common_show_header(_('Register'), null, $error, array($this, 'show_top'));
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'login',
                                            'action' => common_local_url('register')));
 
-        common_hidden('token', common_session_token());
+        $this->hidden('token', common_session_token());
 
         if ($code) {
-            common_hidden('code', $code);
+            $this->hidden('code', $code);
         }
 
-        common_input('nickname', _('Nickname'), $this->trimmed('nickname'),
+        $this->input('nickname', _('Nickname'), $this->trimmed('nickname'),
                      _('1-64 lowercase letters or numbers, no punctuation or spaces. Required.'));
-        common_password('password', _('Password'),
+        $this->password('password', _('Password'),
                         _('6 or more characters. Required.'));
-        common_password('confirm', _('Confirm'),
+        $this->password('confirm', _('Confirm'),
                         _('Same as password above. Required.'));
         if ($invite && $invite->address_type == 'email') {
-            common_input('email', _('Email'), $invite->address,
+            $this->input('email', _('Email'), $invite->address,
                      _('Used only for updates, announcements, and password recovery'));
         } else {
-            common_input('email', _('Email'), $this->trimmed('email'),
+            $this->input('email', _('Email'), $this->trimmed('email'),
                          _('Used only for updates, announcements, and password recovery'));
         }
-        common_input('fullname', _('Full name'),
+        $this->input('fullname', _('Full name'),
                      $this->trimmed('fullname'),
                       _('Longer name, preferably your "real" name'));
-        common_input('homepage', _('Homepage'),
+        $this->input('homepage', _('Homepage'),
                      $this->trimmed('homepage'),
                      _('URL of your homepage, blog, or profile on another site'));
-        common_textarea('bio', _('Bio'),
+        $this->textarea('bio', _('Bio'),
                         $this->trimmed('bio'),
                          _('Describe yourself and your interests in 140 chars'));
-        common_input('location', _('Location'),
+        $this->input('location', _('Location'),
                      $this->trimmed('location'),
                      _('Where you are, like "City, State (or Region), Country"'));
-        common_checkbox('rememberme', _('Remember me'),
+        $this->checkbox('rememberme', _('Remember me'),
                         $this->boolean('rememberme'),
                         _('Automatically login in the future; not for shared computers!'));
-        common_element_start('p');
+        $this->elementStart('p');
         $attrs = array('type' => 'checkbox',
                        'id' => 'license',
                        'name' => 'license',
@@ -230,14 +230,14 @@ class RegisterAction extends Action
         if ($this->boolean('license')) {
             $attrs['checked'] = 'checked';
         }
-        common_element('input', $attrs);
-        common_text(_('My text and files are available under '));
-        common_element('a', array('href' => $config['license']['url']),
+        $this->element('input', $attrs);
+        $this->text(_('My text and files are available under '));
+        $this->element('a', array('href' => $config['license']['url']),
                        $config['license']['title']);
-        common_text(_(' except this private data: password, email address, IM address, phone number.'));
-        common_element_end('p');
-        common_submit('submit', _('Register'));
-        common_element_end('form');
+        $this->text(_(' except this private data: password, email address, IM address, phone number.'));
+        $this->elementEnd('p');
+        $this->submit('submit', _('Register'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 
@@ -245,7 +245,7 @@ class RegisterAction extends Action
     {
         $nickname = $this->arg('nickname');
         common_show_header(_('Registration successful'));
-        common_element_start('div', 'success');
+        $this->elementStart('div', 'success');
         $instr = sprintf(_('Congratulations, %s! And welcome to %%%%site.name%%%%. From here, you may want to...'. "\n\n" .
                            '* Go to [your profile](%s) and post your first message.' .  "\n" .
                            '* Add a [Jabber/GTalk address](%%%%action.imsettings%%%%) so you can send notices through instant messages.' . "\n" .
@@ -254,14 +254,14 @@ class RegisterAction extends Action
                            '* Read over the [online docs](%%%%doc.help%%%%) for features you may have missed. ' . "\n\n" .
                            'Thanks for signing up and we hope you enjoy using this service.'),
                          $nickname, common_local_url('showstream', array('nickname' => $nickname)));
-        common_raw(common_markup_to_html($instr));
+        $this->raw(common_markup_to_html($instr));
         $have_email = $this->trimmed('email');
         if ($have_email) {
             $emailinstr = _('(You should receive a message by email momentarily, with ' .
                             'instructions on how to confirm your email address.)');
-            common_raw(common_markup_to_html($emailinstr));
+            $this->raw(common_markup_to_html($emailinstr));
         }
-        common_element_end('div');
+        $this->elementEnd('div');
         common_show_footer();
     }
 
diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php
index a9494772e..b9e29d645 100644
--- a/actions/remotesubscribe.php
+++ b/actions/remotesubscribe.php
@@ -61,13 +61,13 @@ class RemotesubscribeAction extends Action
     function show_top($err=null)
     {
         if ($err) {
-            common_element('div', 'error', $err);
+            $this->element('div', 'error', $err);
         } else {
             $instructions = $this->get_instructions();
             $output = common_markup_to_html($instructions);
-            common_element_start('div', 'instructions');
-            common_raw($output);
-            common_element_end('p');
+            $this->elementStart('div', 'instructions');
+            $this->raw($output);
+            $this->elementEnd('p');
         }
     }
 
@@ -79,15 +79,15 @@ class RemotesubscribeAction extends Action
                            array($this, 'show_top'));
         # id = remotesubscribe conflicts with the
         # button on profile page
-        common_element_start('form', array('id' => 'remsub', 'method' => 'post',
+        $this->elementStart('form', array('id' => 'remsub', 'method' => 'post',
                                            'action' => common_local_url('remotesubscribe')));
-        common_hidden('token', common_session_token());
-        common_input('nickname', _('User nickname'), $nickname,
+        $this->hidden('token', common_session_token());
+        $this->input('nickname', _('User nickname'), $nickname,
                      _('Nickname of the user you want to follow'));
-        common_input('profile_url', _('Profile URL'), $profile,
+        $this->input('profile_url', _('Profile URL'), $profile,
                      _('URL of your profile on another compatible microblogging service'));
-        common_submit('submit', _('Subscribe'));
-        common_element_end('form');
+        $this->submit('submit', _('Subscribe'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 
diff --git a/actions/replies.php b/actions/replies.php
index eceeb4d65..878550888 100644
--- a/actions/replies.php
+++ b/actions/replies.php
@@ -62,7 +62,7 @@ class RepliesAction extends StreamAction
 
     function show_header($user)
     {
-        common_element('link', array('rel' => 'alternate',
+        $this->element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('repliesrss', array('nickname' =>
                                                                                     $user->nickname)),
                                      'type' => 'application/rss+xml',
diff --git a/actions/showfavorites.php b/actions/showfavorites.php
index f4344833d..1dec3ba5b 100644
--- a/actions/showfavorites.php
+++ b/actions/showfavorites.php
@@ -57,7 +57,7 @@ class ShowfavoritesAction extends StreamAction
 
     function show_header($user)
     {
-        common_element('link', array('rel' => 'alternate',
+        $this->element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('favoritesrss', array('nickname' =>
                                                                                       $user->nickname)),
                                      'type' => 'application/rss+xml',
diff --git a/actions/shownotice.php b/actions/shownotice.php
index 2df09cb3f..c519af0ba 100644
--- a/actions/shownotice.php
+++ b/actions/shownotice.php
@@ -81,10 +81,10 @@ class ShownoticeAction extends StreamAction
                            array($this, 'show_header'), null,
                            array($this, 'show_top'));
 
-        common_element_start('ul', array('id' => 'notices'));
+        $this->elementStart('ul', array('id' => 'notices'));
         $nli = new NoticeListItem($this->notice);
         $nli->show();
-        common_element_end('ul');
+        $this->elementEnd('ul');
 
         common_show_footer();
     }
@@ -99,12 +99,12 @@ class ShownoticeAction extends StreamAction
         }
 
         if ($user->emailmicroid && $user->email && $this->notice->uri) {
-            common_element('meta', array('name' => 'microid',
+            $this->element('meta', array('name' => 'microid',
                                          'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($this->notice->uri))));
         }
 
         if ($user->jabbermicroid && $user->jabber && $this->notice->uri) {
-            common_element('meta', array('name' => 'microid',
+            $this->element('meta', array('name' => 'microid',
                                          'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($this->notice->uri))));
         }
     }
diff --git a/actions/showstream.php b/actions/showstream.php
index e4e5d96d1..9a59f7ae4 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -106,53 +106,53 @@ class ShowstreamAction extends StreamAction
     function show_header($user)
     {
         # Feeds
-        common_element('link', array('rel' => 'alternate',
+        $this->element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('api',
                                                                 array('apiaction' => 'statuses',
                                                                       'method' => 'user_timeline.rss',
                                                                       'argument' => $user->nickname)),
                                      'type' => 'application/rss+xml',
                                      'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
-        common_element('link', array('rel' => 'alternate feed',
+        $this->element('link', array('rel' => 'alternate feed',
                                      'href' => common_local_url('api',
                                                                 array('apiaction' => 'statuses',
                                                                       'method' => 'user_timeline.atom',
                                                                       'argument' => $user->nickname)),
                                      'type' => 'application/atom+xml',
                                      'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
-        common_element('link', array('rel' => 'alternate',
+        $this->element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('userrss', array('nickname' =>
                                                                                $user->nickname)),
                                      'type' => 'application/rdf+xml',
                                      'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
         # FOAF
-        common_element('link', array('rel' => 'meta',
+        $this->element('link', array('rel' => 'meta',
                                      'href' => common_local_url('foaf', array('nickname' =>
                                                                               $user->nickname)),
                                      'type' => 'application/rdf+xml',
                                      'title' => 'FOAF'));
         # for remote subscriptions etc.
-        common_element('meta', array('http-equiv' => 'X-XRDS-Location',
+        $this->element('meta', array('http-equiv' => 'X-XRDS-Location',
                                      'content' => common_local_url('xrds', array('nickname' =>
                                                                                $user->nickname))));
         $profile = $user->getProfile();
         if ($profile->bio) {
-            common_element('meta', array('name' => 'description',
+            $this->element('meta', array('name' => 'description',
                                          'content' => $profile->bio));
         }
 
         if ($user->emailmicroid && $user->email && $profile->profileurl) {
-            common_element('meta', array('name' => 'microid',
+            $this->element('meta', array('name' => 'microid',
                                          'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($profile->profileurl))));
         }
         if ($user->jabbermicroid && $user->jabber && $profile->profileurl) {
-            common_element('meta', array('name' => 'microid',
+            $this->element('meta', array('name' => 'microid',
                                          'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($profile->profileurl))));
         }
 
         # See https://wiki.mozilla.org/Microsummaries
 
-        common_element('link', array('rel' => 'microsummary',
+        $this->element('link', array('rel' => 'microsummary',
                                      'href' => common_local_url('microsummary',
                                                                 array('nickname' => $profile->nickname))));
     }
@@ -165,7 +165,7 @@ class ShowstreamAction extends StreamAction
     function show_profile($profile)
     {
 
-        common_element_start('div', array('id' => 'profile', 'class' => 'vcard'));
+        $this->elementStart('div', array('id' => 'profile', 'class' => 'vcard'));
 
         $this->show_personal($profile);
 
@@ -175,23 +175,23 @@ class ShowstreamAction extends StreamAction
 
         $this->show_subscriptions($profile);
 
-        common_element_end('div');
+        $this->elementEnd('div');
     }
 
     function show_personal($profile)
     {
 
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-        common_element_start('div', array('id' => 'profile_avatar'));
-        common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
+        $this->elementStart('div', array('id' => 'profile_avatar'));
+        $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
                                     'class' => 'avatar profile photo',
                                     'width' => AVATAR_PROFILE_SIZE,
                                     'height' => AVATAR_PROFILE_SIZE,
                                     'alt' => $profile->nickname));
 
-        common_element_start('ul', array('id' => 'profile_actions'));
+        $this->elementStart('ul', array('id' => 'profile_actions'));
 
-        common_element_start('li', array('id' => 'profile_subscribe'));
+        $this->elementStart('li', array('id' => 'profile_subscribe'));
         $cur = common_current_user();
         if ($cur) {
             if ($cur->id != $profile->id) {
@@ -204,14 +204,14 @@ class ShowstreamAction extends StreamAction
         } else {
             $this->show_remote_subscribe_link($profile);
         }
-        common_element_end('li');
+        $this->elementEnd('li');
 
         $user = User::staticGet('id', $profile->id);
         common_profile_new_message_nudge($cur, $user, $profile);
 
         if ($cur && $cur->id != $profile->id) {
             $blocked = $cur->hasBlocked($profile);
-            common_element_start('li', array('id' => 'profile_block'));
+            $this->elementStart('li', array('id' => 'profile_block'));
             if ($blocked) {
                 common_unblock_form($profile, array('action' => 'showstream',
                                                     'nickname' => $profile->nickname));
@@ -219,62 +219,62 @@ class ShowstreamAction extends StreamAction
                 common_block_form($profile, array('action' => 'showstream',
                                                   'nickname' => $profile->nickname));
             }
-            common_element_end('li');
+            $this->elementEnd('li');
         }
 
-        common_element_end('ul');
+        $this->elementEnd('ul');
 
-        common_element_end('div');
+        $this->elementEnd('div');
 
-        common_element_start('div', array('id' => 'profile_information'));
+        $this->elementStart('div', array('id' => 'profile_information'));
 
         if ($profile->fullname) {
-            common_element('h1', array('class' => 'fn'), $profile->fullname . ' (' . $profile->nickname . ')');
+            $this->element('h1', array('class' => 'fn'), $profile->fullname . ' (' . $profile->nickname . ')');
         } else {
-            common_element('h1', array('class' => 'fn nickname'), $profile->nickname);
+            $this->element('h1', array('class' => 'fn nickname'), $profile->nickname);
         }
 
         if ($profile->location) {
-            common_element('p', 'location', $profile->location);
+            $this->element('p', 'location', $profile->location);
         }
         if ($profile->bio) {
-            common_element('p', 'description note', $profile->bio);
+            $this->element('p', 'description note', $profile->bio);
         }
         if ($profile->homepage) {
-            common_element_start('p', 'website');
-            common_element('a', array('href' => $profile->homepage,
+            $this->elementStart('p', 'website');
+            $this->element('a', array('href' => $profile->homepage,
                                       'rel' => 'me', 'class' => 'url'),
                            $profile->homepage);
-            common_element_end('p');
+            $this->elementEnd('p');
         }
 
         $this->show_statistics($profile);
 
-        common_element_end('div');
+        $this->elementEnd('div');
     }
 
     function show_remote_subscribe_link($profile)
     {
         $url = common_local_url('remotesubscribe',
                                 array('nickname' => $profile->nickname));
-        common_element('a', array('href' => $url,
+        $this->element('a', array('href' => $url,
                                   'id' => 'remotesubscribe'),
                        _('Subscribe'));
     }
 
     function show_unsubscribe_form($profile)
     {
-        common_element_start('form', array('id' => 'unsubscribe', 'method' => 'post',
+        $this->elementStart('form', array('id' => 'unsubscribe', 'method' => 'post',
                                            'action' => common_local_url('unsubscribe')));
-        common_hidden('token', common_session_token());
-        common_element('input', array('id' => 'unsubscribeto',
+        $this->hidden('token', common_session_token());
+        $this->element('input', array('id' => 'unsubscribeto',
                                       'name' => 'unsubscribeto',
                                       'type' => 'hidden',
                                       'value' => $profile->nickname));
-        common_element('input', array('type' => 'submit',
+        $this->element('input', array('type' => 'submit',
                                       'class' => 'submit',
                                       'value' => _('Unsubscribe')));
-        common_element_end('form');
+        $this->elementEnd('form');
     }
 
     function show_subscriptions($profile)
@@ -293,13 +293,13 @@ class ShowstreamAction extends StreamAction
 
         $subs_count = $subs->find();
 
-        common_element_start('div', array('id' => 'subscriptions'));
+        $this->elementStart('div', array('id' => 'subscriptions'));
 
-        common_element('h2', null, _('Subscriptions'));
+        $this->element('h2', null, _('Subscriptions'));
 
         if ($subs_count > 0) {
 
-            common_element_start('ul', array('id' => 'subscriptions_avatars'));
+            $this->elementStart('ul', array('id' => 'subscriptions_avatars'));
 
             for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
 
@@ -315,39 +315,39 @@ class ShowstreamAction extends StreamAction
                     continue;
                 }
 
-                common_element_start('li', 'vcard');
-                common_element_start('a', array('title' => ($other->fullname) ?
+                $this->elementStart('li', 'vcard');
+                $this->elementStart('a', array('title' => ($other->fullname) ?
                                                 $other->fullname :
                                                 $other->nickname,
                                                 'href' => $other->profileurl,
                                                 'rel' => 'contact',
                                                  'class' => 'subscription fn url'));
                 $avatar = $other->getAvatar(AVATAR_MINI_SIZE);
-                common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) :  common_default_avatar(AVATAR_MINI_SIZE)),
+                $this->element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) :  common_default_avatar(AVATAR_MINI_SIZE)),
                                             'width' => AVATAR_MINI_SIZE,
                                             'height' => AVATAR_MINI_SIZE,
                                             'class' => 'avatar mini photo',
                                             'alt' =>  ($other->fullname) ?
                                             $other->fullname :
                                             $other->nickname));
-                common_element_end('a');
-                common_element_end('li');
+                $this->elementEnd('a');
+                $this->elementEnd('li');
             }
 
-            common_element_end('ul');
+            $this->elementEnd('ul');
         }
 
         if ($subs_count > SUBSCRIPTIONS) {
-            common_element_start('p', array('id' => 'subscriptions_viewall'));
+            $this->elementStart('p', array('id' => 'subscriptions_viewall'));
 
-            common_element('a', array('href' => common_local_url('subscriptions',
+            $this->element('a', array('href' => common_local_url('subscriptions',
                                                                  array('nickname' => $profile->nickname)),
                                       'class' => 'moresubscriptions'),
                            _('All subscriptions'));
-            common_element_end('p');
+            $this->elementEnd('p');
         }
 
-        common_element_end('div');
+        $this->elementEnd('div');
     }
 
     function show_statistics($profile)
@@ -366,49 +366,49 @@ class ShowstreamAction extends StreamAction
         $notices->profile_id = $profile->id;
         $notice_count = (int) $notices->count();
 
-        common_element_start('div', 'statistics');
-        common_element('h2', 'statistics', _('Statistics'));
+        $this->elementStart('div', 'statistics');
+        $this->element('h2', 'statistics', _('Statistics'));
 
         # Other stats...?
-        common_element_start('dl', 'statistics');
-        common_element('dt', 'membersince', _('Member since'));
-        common_element('dd', 'membersince', date('j M Y',
+        $this->elementStart('dl', 'statistics');
+        $this->element('dt', 'membersince', _('Member since'));
+        $this->element('dd', 'membersince', date('j M Y',
                                                  strtotime($profile->created)));
 
-        common_element_start('dt', 'subscriptions');
-        common_element('a', array('href' => common_local_url('subscriptions',
+        $this->elementStart('dt', 'subscriptions');
+        $this->element('a', array('href' => common_local_url('subscriptions',
                                                              array('nickname' => $profile->nickname))),
                        _('Subscriptions'));
-        common_element_end('dt');
-        common_element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0');
-        common_element_start('dt', 'subscribers');
-        common_element('a', array('href' => common_local_url('subscribers',
+        $this->elementEnd('dt');
+        $this->element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0');
+        $this->elementStart('dt', 'subscribers');
+        $this->element('a', array('href' => common_local_url('subscribers',
                                                              array('nickname' => $profile->nickname))),
                        _('Subscribers'));
-        common_element_end('dt');
-        common_element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
-        common_element('dt', 'notices', _('Notices'));
-        common_element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0');
+        $this->elementEnd('dt');
+        $this->element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
+        $this->element('dt', 'notices', _('Notices'));
+        $this->element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0');
         # XXX: link these to something
-        common_element('dt', 'tags', _('Tags'));
-        common_element_start('dd', 'tags');
+        $this->element('dt', 'tags', _('Tags'));
+        $this->elementStart('dd', 'tags');
         $tags = Profile_tag::getTags($profile->id, $profile->id);
 
-        common_element_start('ul', 'tags xoxo');
+        $this->elementStart('ul', 'tags xoxo');
         foreach ($tags as $tag) {
-            common_element_start('li');
-            common_element('a', array('rel' => 'bookmark tag',
+            $this->elementStart('li');
+            $this->element('a', array('rel' => 'bookmark tag',
                                       'href' => common_local_url('peopletag',
                                                                  array('tag' => $tag))),
                            $tag);
-            common_element_end('li');
+            $this->elementEnd('li');
         }
-        common_element_end('ul');
-        common_element_end('dd');
+        $this->elementEnd('ul');
+        $this->elementEnd('dd');
 
-        common_element_end('dl');
+        $this->elementEnd('dl');
 
-        common_element_end('div');
+        $this->elementEnd('div');
     }
 
     function show_notices($user)
@@ -428,22 +428,22 @@ class ShowstreamAction extends StreamAction
     function show_last_notice($profile)
     {
 
-        common_element('h2', null, _('Currently'));
+        $this->element('h2', null, _('Currently'));
 
         $notice = $profile->getCurrentNotice();
 
         if ($notice) {
             # FIXME: URL, image, video, audio
-            common_element_start('p', array('class' => 'notice_current'));
+            $this->elementStart('p', array('class' => 'notice_current'));
             if ($notice->rendered) {
-                common_raw($notice->rendered);
+                $this->raw($notice->rendered);
             } else {
                 # XXX: may be some uncooked notices in the DB,
                 # we cook them right now. This can probably disappear in future
                 # versions (>> 0.4.x)
-                common_raw(common_render_content($notice->content, $notice));
+                $this->raw(common_render_content($notice->content, $notice));
             }
-            common_element_end('p');
+            $this->elementEnd('p');
         }
     }
 }
diff --git a/actions/smssettings.php b/actions/smssettings.php
index fad71135c..1be45d1ce 100644
--- a/actions/smssettings.php
+++ b/actions/smssettings.php
@@ -34,75 +34,75 @@ class SmssettingsAction extends EmailsettingsAction
     {
         $user = common_current_user();
         $this->form_header(_('SMS Settings'), $msg, $success);
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'smssettings',
                                            'action' =>
                                            common_local_url('smssettings')));
-        common_hidden('token', common_session_token());
-        common_element('h2', null, _('Address'));
+        $this->hidden('token', common_session_token());
+        $this->element('h2', null, _('Address'));
 
         if ($user->sms) {
-            common_element_start('p');
+            $this->elementStart('p');
             $carrier = $user->getCarrier();
-            common_element('span', 'address confirmed', $user->sms . ' (' . $carrier->name . ')');
-            common_element('span', 'input_instructions',
+            $this->element('span', 'address confirmed', $user->sms . ' (' . $carrier->name . ')');
+            $this->element('span', 'input_instructions',
                            _('Current confirmed SMS-enabled phone number.'));
-            common_hidden('sms', $user->sms);
-            common_hidden('carrier', $user->carrier);
-            common_element_end('p');
-            common_submit('remove', _('Remove'));
+            $this->hidden('sms', $user->sms);
+            $this->hidden('carrier', $user->carrier);
+            $this->elementEnd('p');
+            $this->submit('remove', _('Remove'));
         } else {
             $confirm = $this->get_confirmation();
             if ($confirm) {
                 $carrier = Sms_carrier::staticGet($confirm->address_extra);
-                common_element_start('p');
-                common_element('span', 'address unconfirmed', $confirm->address . ' (' . $carrier->name . ')');
-                common_element('span', 'input_instructions',
+                $this->elementStart('p');
+                $this->element('span', 'address unconfirmed', $confirm->address . ' (' . $carrier->name . ')');
+                $this->element('span', 'input_instructions',
                                _('Awaiting confirmation on this phone number.'));
-                common_hidden('sms', $confirm->address);
-                common_hidden('carrier', $confirm->address_extra);
-                common_element_end('p');
-                common_submit('cancel', _('Cancel'));
-                common_input('code', _('Confirmation code'), null,
+                $this->hidden('sms', $confirm->address);
+                $this->hidden('carrier', $confirm->address_extra);
+                $this->elementEnd('p');
+                $this->submit('cancel', _('Cancel'));
+                $this->input('code', _('Confirmation code'), null,
                              _('Enter the code you received on your phone.'));
-                common_submit('confirm', _('Confirm'));
+                $this->submit('confirm', _('Confirm'));
             } else {
-                common_input('sms', _('SMS Phone number'),
+                $this->input('sms', _('SMS Phone number'),
                              ($this->arg('sms')) ? $this->arg('sms') : null,
                              _('Phone number, no punctuation or spaces, with area code'));
                 $this->carrier_select();
-                common_submit('add', _('Add'));
+                $this->submit('add', _('Add'));
             }
         }
 
         if ($user->sms) {
-            common_element('h2', null, _('Incoming email'));
+            $this->element('h2', null, _('Incoming email'));
             
             if ($user->incomingemail) {
-                common_element_start('p');
-                common_element('span', 'address', $user->incomingemail);
-                common_element('span', 'input_instructions',
+                $this->elementStart('p');
+                $this->element('span', 'address', $user->incomingemail);
+                $this->element('span', 'input_instructions',
                                _('Send email to this address to post new notices.'));
-                common_element_end('p');
-                common_submit('removeincoming', _('Remove'));
+                $this->elementEnd('p');
+                $this->submit('removeincoming', _('Remove'));
             }
             
-            common_element_start('p');
-            common_element('span', 'input_instructions',
+            $this->elementStart('p');
+            $this->element('span', 'input_instructions',
                            _('Make a new email address for posting to; cancels the old one.'));
-            common_element_end('p');
-            common_submit('newincoming', _('New'));
+            $this->elementEnd('p');
+            $this->submit('newincoming', _('New'));
         }
         
-        common_element('h2', null, _('Preferences'));
+        $this->element('h2', null, _('Preferences'));
         
-        common_checkbox('smsnotify',
+        $this->checkbox('smsnotify',
                         _('Send me notices through SMS; I understand I may incur exorbitant charges from my carrier.'),
                         $user->smsnotify);
             
-        common_submit('save', _('Save'));
+        $this->submit('save', _('Save'));
         
-        common_element_end('form');
+        $this->elementEnd('form');
         common_show_footer();
     }
 
@@ -307,19 +307,19 @@ class SmssettingsAction extends EmailsettingsAction
         $carrier = new Sms_carrier();
         $cnt = $carrier->find();
 
-        common_element_start('p');
-        common_element('label', array('for' => 'carrier'));
-        common_element_start('select', array('name' => 'carrier',
+        $this->elementStart('p');
+        $this->element('label', array('for' => 'carrier'));
+        $this->elementStart('select', array('name' => 'carrier',
                                              'id' => 'carrier'));
-        common_element('option', array('value' => 0),
+        $this->element('option', array('value' => 0),
                        _('Select a carrier'));
         while ($carrier->fetch()) {
-            common_element('option', array('value' => $carrier->id),
+            $this->element('option', array('value' => $carrier->id),
                            $carrier->name);
         }
-        common_element_end('select');
-        common_element_end('p');
-        common_element('span', 'input_instructions',
+        $this->elementEnd('select');
+        $this->elementEnd('p');
+        $this->element('span', 'input_instructions',
                        sprintf(_('Mobile carrier for your phone. '.
                                  'If you know a carrier that accepts ' . 
                                  'SMS over email but isn\'t listed here, ' .
diff --git a/actions/subscribe.php b/actions/subscribe.php
index f33d1d207..99f9acc24 100644
--- a/actions/subscribe.php
+++ b/actions/subscribe.php
@@ -65,13 +65,13 @@ class SubscribeAction extends Action
 
         if ($this->boolean('ajax')) {
             common_start_html('text/xml;charset=utf-8', true);
-            common_element_start('head');
-            common_element('title', null, _('Subscribed'));
-            common_element_end('head');
-            common_element_start('body');
+            $this->elementStart('head');
+            $this->element('title', null, _('Subscribed'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
             common_unsubscribe_form($other->getProfile());
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             common_redirect(common_local_url('subscriptions', array('nickname' =>
                                                                 $user->nickname)));
diff --git a/actions/subscriptions.php b/actions/subscriptions.php
index afe8fb260..7a87a144f 100644
--- a/actions/subscriptions.php
+++ b/actions/subscriptions.php
@@ -72,16 +72,16 @@ class SubscriptionsList extends ProfileList
             return;
         }
 
-        common_element_start('form', array('id' => 'subedit-' . $profile->id,
+        $this->elementStart('form', array('id' => 'subedit-' . $profile->id,
                                            'method' => 'post',
                                            'class' => 'subedit',
                                            'action' => common_local_url('subedit')));
-        common_hidden('token', common_session_token());
-        common_hidden('profile', $profile->id);
-        common_checkbox('jabber', _('Jabber'), $sub->jabber);
-        common_checkbox('sms', _('SMS'), $sub->sms);
-        common_submit('save', _('Save'));
-        common_element_end('form');
+        $this->hidden('token', common_session_token());
+        $this->hidden('profile', $profile->id);
+        $this->checkbox('jabber', _('Jabber'), $sub->jabber);
+        $this->checkbox('sms', _('SMS'), $sub->sms);
+        $this->submit('save', _('Save'));
+        $this->elementEnd('form');
         return;
     }
 }
diff --git a/actions/tag.php b/actions/tag.php
index 8a3f90c16..3096b75b3 100644
--- a/actions/tag.php
+++ b/actions/tag.php
@@ -51,7 +51,7 @@ class TagAction extends StreamAction
     function show_header($tag = false)
     {
         if ($tag) {
-            common_element('link', array('rel' => 'alternate',
+            $this->element('link', array('rel' => 'alternate',
                                          'href' => common_local_url('tagrss', array('tag' => $tag)),
                                          'type' => 'application/rss+xml',
                                          'title' => sprintf(_('Feed for tag %s'), $tag)));
@@ -68,9 +68,9 @@ class TagAction extends StreamAction
         if (!$tag) {
             $instr = $this->get_instructions();
             $output = common_markup_to_html($instr);
-            common_element_start('div', 'instructions');
-            common_raw($output);
-            common_element_end('div');
+            $this->elementStart('div', 'instructions');
+            $this->raw($output);
+            $this->elementEnd('div');
             $this->public_views_menu();
         }
         else {
@@ -110,7 +110,7 @@ class TagAction extends StreamAction
         $cnt = $tags->find();
 
         if ($cnt > 0) {
-            common_element_start('p', 'tagcloud');
+            $this->elementStart('p', 'tagcloud');
 
             $tw = array();
             $sum = 0;
@@ -125,7 +125,7 @@ class TagAction extends StreamAction
                 $this->show_tag($tag, $weight, $weight/$sum);
             }
 
-            common_element_end('p');
+            $this->elementEnd('p');
         }
     }
 
@@ -149,10 +149,10 @@ class TagAction extends StreamAction
             $cls = 'smallest';
         }
 
-        common_element('a', array('class' => "$cls weight-$weight relative-$relative",
+        $this->element('a', array('class' => "$cls weight-$weight relative-$relative",
                                   'href' => common_local_url('tag', array('tag' => $tag))),
                        $tag);
-        common_text(' ');
+        $this->text(' ');
     }
 
     function show_notices($tag)
diff --git a/actions/tagother.php b/actions/tagother.php
index ff6788cc6..f0105ec8b 100644
--- a/actions/tagother.php
+++ b/actions/tagother.php
@@ -61,7 +61,7 @@ class TagotherAction extends Action
 
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
 
-        common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
+        $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
                                     'class' => 'avatar stream',
                                     'width' => AVATAR_PROFILE_SIZE,
                                     'height' => AVATAR_PROFILE_SIZE,
@@ -69,39 +69,39 @@ class TagotherAction extends Action
                                     ($profile->fullname) ? $profile->fullname :
                                     $profile->nickname));
 
-        common_element('a', array('href' => $profile->profileurl,
+        $this->element('a', array('href' => $profile->profileurl,
                                   'class' => 'external profile nickname'),
                        $profile->nickname);
 
         if ($profile->fullname) {
-            common_element_start('div', 'fullname');
+            $this->elementStart('div', 'fullname');
             if ($profile->homepage) {
-                common_element('a', array('href' => $profile->homepage),
+                $this->element('a', array('href' => $profile->homepage),
                                $profile->fullname);
             } else {
-                common_text($profile->fullname);
+                $this->text($profile->fullname);
             }
-            common_element_end('div');
+            $this->elementEnd('div');
         }
         if ($profile->location) {
-            common_element('div', 'location', $profile->location);
+            $this->element('div', 'location', $profile->location);
         }
         if ($profile->bio) {
-            common_element('div', 'bio', $profile->bio);
+            $this->element('div', 'bio', $profile->bio);
         }
 
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'tag_user',
                                            'name' => 'tagother',
                                            'action' => $this->self_url()));
-        common_hidden('token', common_session_token());
-        common_hidden('id', $profile->id);
-        common_input('tags', _('Tags'),
+        $this->hidden('token', common_session_token());
+        $this->hidden('id', $profile->id);
+        $this->input('tags', _('Tags'),
                      ($this->arg('tags')) ? $this->arg('tags') : implode(' ', Profile_tag::getTags($user->id, $profile->id)),
                      _('Tags for this user (letters, numbers, -, ., and _), comma- or space- separated'));
 
-        common_submit('save', _('Save'));
-        common_element_end('form');
+        $this->submit('save', _('Save'));
+        $this->elementEnd('form');
         common_show_footer();
 
     }
@@ -162,20 +162,20 @@ class TagotherAction extends Action
 
         if ($this->boolean('ajax')) {
             common_start_html('text/xml');
-            common_element_start('head');
-            common_element('title', null, _('Tags'));
-            common_element_end('head');
-            common_element_start('body');
-            common_element_start('p', 'subtags');
+            $this->elementStart('head');
+            $this->element('title', null, _('Tags'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
+            $this->elementStart('p', 'subtags');
             foreach ($tags as $tag) {
-                common_element('a', array('href' => common_local_url($action,
+                $this->element('a', array('href' => common_local_url($action,
                                                                      array('nickname' => $user->nickname,
                                                                            'tag' => $tag))),
                                $tag);
             }
-            common_element_end('p');
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('p');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             common_redirect(common_local_url($action, array('nickname' =>
                                                             $user->nickname)));
@@ -186,12 +186,12 @@ class TagotherAction extends Action
     {
         list($profile, $error) = $arr;
         if ($error) {
-            common_element('p', 'error', $error);
+            $this->element('p', 'error', $error);
         } else {
-            common_element_start('div', 'instructions');
-            common_element('p', null,
+            $this->elementStart('div', 'instructions');
+            $this->element('p', null,
                            _('Use this form to add tags to your subscribers or subscriptions.'));
-            common_element_end('div');
+            $this->elementEnd('div');
         }
     }
 }
diff --git a/actions/twitapidirect_messages.php b/actions/twitapidirect_messages.php
index e0731f66f..36d2a7e09 100644
--- a/actions/twitapidirect_messages.php
+++ b/actions/twitapidirect_messages.php
@@ -188,7 +188,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
     {
 
         $this->init_document('xml');
-        common_element_start('direct-messages', array('type' => 'array'));
+        $this->elementStart('direct-messages', array('type' => 'array'));
 
         if (is_array($messages)) {
             foreach ($message as $m) {
@@ -202,7 +202,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
             }
         }
 
-        common_element_end('direct-messages');
+        $this->elementEnd('direct-messages');
         $this->end_document('xml');
 
     }
@@ -236,13 +236,13 @@ class Twitapidirect_messagesAction extends TwitterapiAction
 
         $this->init_document('rss');
 
-        common_element_start('channel');
-        common_element('title', null, $title);
+        $this->elementStart('channel');
+        $this->element('title', null, $title);
 
-        common_element('link', null, $link);
-        common_element('description', null, $subtitle);
-        common_element('language', null, 'en-us');
-        common_element('ttl', null, '40');
+        $this->element('link', null, $link);
+        $this->element('description', null, $subtitle);
+        $this->element('language', null, 'en-us');
+        $this->element('ttl', null, '40');
 
         if (is_array($message)) {
             foreach ($message as $m) {
@@ -256,7 +256,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
             }
         }
 
-        common_element_end('channel');
+        $this->elementEnd('channel');
         $this->end_twitter_rss();
 
     }
@@ -266,12 +266,12 @@ class Twitapidirect_messagesAction extends TwitterapiAction
 
         $this->init_document('atom');
 
-        common_element('title', null, $title);
+        $this->element('title', null, $title);
         $siteserver = common_config('site', 'server');
-        common_element('id', null, "tag:$siteserver,2008:DirectMessage");
-        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
-        common_element('updated', null, common_date_iso8601(strftime('%c')));
-        common_element('subtitle', null, $subtitle);
+        $this->element('id', null, "tag:$siteserver,2008:DirectMessage");
+        $this->element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
+        $this->element('updated', null, common_date_iso8601(strftime('%c')));
+        $this->element('subtitle', null, $subtitle);
 
         if (is_array($message)) {
             foreach ($message as $m) {
diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php
index ba4afe441..458ff48a5 100644
--- a/actions/twitapifriendships.php
+++ b/actions/twitapifriendships.php
@@ -142,7 +142,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
         switch ($apidata['content-type']) {
          case 'xml':
             $this->init_document('xml');
-            common_element('friends', null, $result);
+            $this->element('friends', null, $result);
             $this->end_document('xml');
             break;
          case 'json':
diff --git a/actions/twitapihelp.php b/actions/twitapihelp.php
index 1b84cb11b..531c6e9d3 100644
--- a/actions/twitapihelp.php
+++ b/actions/twitapihelp.php
@@ -34,7 +34,7 @@ class TwitapihelpAction extends TwitterapiAction
 
         if ($apidata['content-type'] == 'xml') {
             $this->init_document('xml');
-            common_element('ok', null, 'true');
+            $this->element('ok', null, 'true');
             $this->end_document('xml');
         } elseif ($apidata['content-type'] == 'json') {
             $this->init_document('json');
diff --git a/actions/twitapilaconica.php b/actions/twitapilaconica.php
index 722423fae..34c8f88fc 100644
--- a/actions/twitapilaconica.php
+++ b/actions/twitapilaconica.php
@@ -70,7 +70,7 @@ class TwitapilaconicaAction extends TwitterapiAction
         switch ($apidata['content-type']) {
          case 'xml':
             $this->init_document('xml');
-            common_element('version', null, LACONICA_VERSION);
+            $this->element('version', null, LACONICA_VERSION);
             $this->end_document('xml');
             break;
          case 'json':
@@ -115,10 +115,10 @@ class TwitapilaconicaAction extends TwitterapiAction
         switch ($apidata['content-type']) {
          case 'xml':
             $this->init_document('xml');
-            common_element_start('config');
+            $this->elementStart('config');
             // XXX: check that all sections and settings are legal XML elements
             foreach ($keys as $section => $settings) {
-                common_element_start($section);
+                $this->elementStart($section);
                 foreach ($settings as $setting) {
                     $value = common_config($section, $setting);
                     if (is_array($value)) {
@@ -128,11 +128,11 @@ class TwitapilaconicaAction extends TwitterapiAction
                     } else if ($value === true) {
                         $value = 'true';
                     }
-                    common_element($setting, null, $value);
+                    $this->element($setting, null, $value);
                 }
-                common_element_end($section);
+                $this->elementEnd($section);
             }
-            common_element_end('config');
+            $this->elementEnd('config');
             $this->end_document('xml');
             break;
          case 'json':
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index e629d5cc4..8d175ecab 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -538,11 +538,11 @@ class TwitapistatusesAction extends TwitterapiAction
     {
         switch ($type) {
          case 'xml':
-            common_element_start('users', array('type' => 'array'));
+            $this->elementStart('users', array('type' => 'array'));
             foreach ($profiles as $profile) {
                 $this->show_profile($profile);
             }
-            common_element_end('users');
+            $this->elementEnd('users');
             break;
          case 'json':
             $arrays = array();
diff --git a/actions/twittersettings.php b/actions/twittersettings.php
index 9e7e4cae8..663688037 100644
--- a/actions/twittersettings.php
+++ b/actions/twittersettings.php
@@ -44,52 +44,52 @@ class TwittersettingsAction extends SettingsAction
         }
 
         $this->form_header(_('Twitter settings'), $msg, $success);
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'twittersettings',
                                            'action' =>
                                            common_local_url('twittersettings')));
-        common_hidden('token', common_session_token());
+        $this->hidden('token', common_session_token());
 
-        common_element('h2', null, _('Twitter Account'));
+        $this->element('h2', null, _('Twitter Account'));
 
         if ($fuser) {
-            common_element_start('p');
+            $this->elementStart('p');
 
-            common_element('span', 'twitter_user', $fuser->nickname);
-            common_element('a', array('href' => $fuser->uri),  $fuser->uri);
-            common_element('span', 'input_instructions',
+            $this->element('span', 'twitter_user', $fuser->nickname);
+            $this->element('a', array('href' => $fuser->uri),  $fuser->uri);
+            $this->element('span', 'input_instructions',
                            _('Current verified Twitter account.'));
-            common_hidden('flink_foreign_id', $flink->foreign_id);
-            common_element_end('p');
-            common_submit('remove', _('Remove'));
+            $this->hidden('flink_foreign_id', $flink->foreign_id);
+            $this->elementEnd('p');
+            $this->submit('remove', _('Remove'));
         } else {
-            common_input('twitter_username', _('Twitter user name'),
+            $this->input('twitter_username', _('Twitter user name'),
                          ($this->arg('twitter_username')) ? $this->arg('twitter_username') : $profile->nickname,
                          _('No spaces, please.')); // hey, it's what Twitter says
 
-            common_password('twitter_password', _('Twitter password'));
+            $this->password('twitter_password', _('Twitter password'));
         }
 
-        common_element('h2', null, _('Preferences'));
+        $this->element('h2', null, _('Preferences'));
 
-        common_checkbox('noticesync', _('Automatically send my notices to Twitter.'),
+        $this->checkbox('noticesync', _('Automatically send my notices to Twitter.'),
                         ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
 
-        common_checkbox('replysync', _('Send local "@" replies to Twitter.'),
+        $this->checkbox('replysync', _('Send local "@" replies to Twitter.'),
                         ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
 
-        common_checkbox('friendsync', _('Subscribe to my Twitter friends here.'),
+        $this->checkbox('friendsync', _('Subscribe to my Twitter friends here.'),
                         ($flink) ? ($flink->friendsync & FOREIGN_FRIEND_RECV) : false);
 
         if ($flink) {
-            common_submit('save', _('Save'));
+            $this->submit('save', _('Save'));
         } else {
-            common_submit('add', _('Add'));
+            $this->submit('add', _('Add'));
         }
 
         $this->show_twitter_subscriptions();
 
-        common_element_end('form');
+        $this->elementEnd('form');
 
         common_show_footer();
     }
@@ -131,9 +131,9 @@ class TwittersettingsAction extends SettingsAction
 
         if ($friends_count > 0) {
 
-            common_element('h3', null, _('Twitter Friends'));
-            common_element_start('div', array('id' => 'subscriptions'));
-            common_element_start('ul', array('id' => 'subscriptions_avatars'));
+            $this->element('h3', null, _('Twitter Friends'));
+            $this->elementStart('div', array('id' => 'subscriptions'));
+            $this->elementStart('ul', array('id' => 'subscriptions_avatars'));
 
             for ($i = 0; $i < min($friends_count, SUBSCRIPTIONS); $i++) {
 
@@ -144,28 +144,28 @@ class TwittersettingsAction extends SettingsAction
                     continue;
                 }
 
-                common_element_start('li');
-                common_element_start('a', array('title' => ($other->fullname) ?
+                $this->elementStart('li');
+                $this->elementStart('a', array('title' => ($other->fullname) ?
                                                 $other->fullname :
                                                 $other->nickname,
                                                 'href' => $other->profileurl,
                                                 'rel' => 'contact',
                                                 'class' => 'subscription'));
                 $avatar = $other->getAvatar(AVATAR_MINI_SIZE);
-                common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) :  common_default_avatar(AVATAR_MINI_SIZE)),
+                $this->element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) :  common_default_avatar(AVATAR_MINI_SIZE)),
                                             'width' => AVATAR_MINI_SIZE,
                                             'height' => AVATAR_MINI_SIZE,
                                             'class' => 'avatar mini',
                                             'alt' =>  ($other->fullname) ?
                                             $other->fullname :
                                             $other->nickname));
-                common_element_end('a');
-                common_element_end('li');
+                $this->elementEnd('a');
+                $this->elementEnd('li');
 
             }
 
-            common_element_end('ul');
-            common_element_end('div');
+            $this->elementEnd('ul');
+            $this->elementEnd('div');
 
         }
 
@@ -173,13 +173,13 @@ class TwittersettingsAction extends SettingsAction
 
         /*
         if ($subs_count > SUBSCRIPTIONS) {
-            common_element_start('p', array('id' => 'subscriptions_viewall'));
+            $this->elementStart('p', array('id' => 'subscriptions_viewall'));
 
-            common_element('a', array('href' => common_local_url('subscriptions',
+            $this->element('a', array('href' => common_local_url('subscriptions',
                                                                  array('nickname' => $profile->nickname)),
                                       'class' => 'moresubscriptions'),
                            _('All subscriptions'));
-            common_element_end('p');
+            $this->elementEnd('p');
         }
         */
 
diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php
index 1c2e13635..455c5e28e 100644
--- a/actions/unsubscribe.php
+++ b/actions/unsubscribe.php
@@ -67,13 +67,13 @@ class UnsubscribeAction extends Action
 
         if ($this->boolean('ajax')) {
             common_start_html('text/xml;charset=utf-8', true);
-            common_element_start('head');
-            common_element('title', null, _('Unsubscribed'));
-            common_element_end('head');
-            common_element_start('body');
+            $this->elementStart('head');
+            $this->element('title', null, _('Unsubscribed'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
             common_subscribe_form($other);
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             common_redirect(common_local_url('subscriptions', array('nickname' =>
                                                                     $user->nickname)));
diff --git a/actions/userauthorization.php b/actions/userauthorization.php
index 05efbc16c..196fae9ad 100644
--- a/actions/userauthorization.php
+++ b/actions/userauthorization.php
@@ -84,51 +84,51 @@ class UserauthorizationAction extends Action
         $avatar = $req->get_parameter('omb_listenee_avatar');
 
         common_show_header(_('Authorize subscription'));
-        common_element('p', null, _('Please check these details to make sure '.
+        $this->element('p', null, _('Please check these details to make sure '.
                                      'that you want to subscribe to this user\'s notices. '.
                                      'If you didn\'t just ask to subscribe to someone\'s notices, '.
                                      'click "Cancel".'));
-        common_element_start('div', 'profile');
+        $this->elementStart('div', 'profile');
         if ($avatar) {
-            common_element('img', array('src' => $avatar,
+            $this->element('img', array('src' => $avatar,
                                         'class' => 'avatar profile',
                                         'width' => AVATAR_PROFILE_SIZE,
                                         'height' => AVATAR_PROFILE_SIZE,
                                         'alt' => $nickname));
         }
-        common_element('a', array('href' => $profile,
+        $this->element('a', array('href' => $profile,
                                   'class' => 'external profile nickname'),
                        $nickname);
         if ($fullname) {
-            common_element_start('div', 'fullname');
+            $this->elementStart('div', 'fullname');
             if ($homepage) {
-                common_element('a', array('href' => $homepage),
+                $this->element('a', array('href' => $homepage),
                                $fullname);
             } else {
-                common_text($fullname);
+                $this->text($fullname);
             }
-            common_element_end('div');
+            $this->elementEnd('div');
         }
         if ($location) {
-            common_element('div', 'location', $location);
+            $this->element('div', 'location', $location);
         }
         if ($bio) {
-            common_element('div', 'bio', $bio);
+            $this->element('div', 'bio', $bio);
         }
-        common_element_start('div', 'license');
-        common_element('a', array('href' => $license,
+        $this->elementStart('div', 'license');
+        $this->element('a', array('href' => $license,
                                   'class' => 'license'),
                        $license);
-        common_element_end('div');
-        common_element_end('div');
-        common_element_start('form', array('method' => 'post',
+        $this->elementEnd('div');
+        $this->elementEnd('div');
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'userauthorization',
                                            'name' => 'userauthorization',
                                            'action' => common_local_url('userauthorization')));
-        common_hidden('token', common_session_token());
-        common_submit('accept', _('Accept'));
-        common_submit('reject', _('Reject'));
-        common_element_end('form');
+        $this->hidden('token', common_session_token());
+        $this->submit('accept', _('Accept'));
+        $this->submit('reject', _('Reject'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 
@@ -328,18 +328,18 @@ class UserauthorizationAction extends Action
     function show_accept_message($tok)
     {
         common_show_header(_('Subscription authorized'));
-        common_element('p', null,
+        $this->element('p', null,
                        _('The subscription has been authorized, but no '.
                           'callback URL was passed. Check with the site\'s instructions for '.
                           'details on how to authorize the subscription. Your subscription token is:'));
-        common_element('blockquote', 'token', $tok);
+        $this->element('blockquote', 'token', $tok);
         common_show_footer();
     }
 
     function show_reject_message($tok)
     {
         common_show_header(_('Subscription rejected'));
-        common_element('p', null,
+        $this->element('p', null,
                        _('The subscription has been rejected, but no '.
                           'callback URL was passed. Check with the site\'s instructions for '.
                           'details on how to fully reject the subscription.'));
diff --git a/actions/xrds.php b/actions/xrds.php
index 7edc6aa39..9c51f1dd2 100644
--- a/actions/xrds.php
+++ b/actions/xrds.php
@@ -47,14 +47,14 @@ class XrdsAction extends Action
         header('Content-Type: application/xrds+xml');
 
         common_start_xml();
-        common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
+        $this->elementStart('XRDS', array('xmlns' => 'xri://$xrds'));
 
-        common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
+        $this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
                                           'xml:id' => 'oauth',
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
 
-        common_element('Type', null, 'xri://$xrds*simple');
+        $this->element('Type', null, 'xri://$xrds*simple');
 
         $this->show_service(OAUTH_ENDPOINT_REQUEST,
                             common_local_url('requesttoken'),
@@ -77,16 +77,16 @@ class XrdsAction extends Action
                             array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
                             array(OAUTH_HMAC_SHA1));
 
-        common_element_end('XRD');
+        $this->elementEnd('XRD');
 
         # XXX: decide whether to include user's ID/nickname in postNotice URL
 
-        common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
+        $this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
                                           'xml:id' => 'omb',
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
 
-        common_element('Type', null, 'xri://$xrds*simple');
+        $this->element('Type', null, 'xri://$xrds*simple');
 
         $this->show_service(OMB_ENDPOINT_POSTNOTICE,
                             common_local_url('postnotice'));
@@ -94,44 +94,44 @@ class XrdsAction extends Action
         $this->show_service(OMB_ENDPOINT_UPDATEPROFILE,
                             common_local_url('updateprofile'));
 
-        common_element_end('XRD');
+        $this->elementEnd('XRD');
 
-        common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
+        $this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
                                           'version' => '2.0'));
 
-        common_element('Type', null, 'xri://$xrds*simple');
+        $this->element('Type', null, 'xri://$xrds*simple');
 
         $this->show_service(OAUTH_DISCOVERY,
                             '#oauth');
         $this->show_service(OMB_NAMESPACE,
                             '#omb');
 
-        common_element_end('XRD');
+        $this->elementEnd('XRD');
 
-        common_element_end('XRDS');
+        $this->elementEnd('XRDS');
         common_end_xml();
     }
 
     function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
     {
-        common_element_start('Service');
+        $this->elementStart('Service');
         if ($uri) {
-            common_element('URI', null, $uri);
+            $this->element('URI', null, $uri);
         }
-        common_element('Type', null, $type);
+        $this->element('Type', null, $type);
         if ($params) {
             foreach ($params as $param) {
-                common_element('Type', null, $param);
+                $this->element('Type', null, $param);
             }
         }
         if ($sigs) {
             foreach ($sigs as $sig) {
-                common_element('Type', null, $sig);
+                $this->element('Type', null, $sig);
             }
         }
         if ($localId) {
-            common_element('LocalID', null, $localId);
+            $this->element('LocalID', null, $localId);
         }
-        common_element_end('Service');
+        $this->elementEnd('Service');
     }
 }
\ No newline at end of file
diff --git a/lib/action.php b/lib/action.php
index d5060758e..d02a1b709 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -314,7 +314,7 @@ class Action extends HTMLOutputter // lawsuit
     {
         $this->elementStart('div', array('id' => 'content'));
         $this->showPageTitle();
-        $this->showPageNotice();
+        $this->showPageNoticeBlock();
         $this->elementStart('div', array('id' => 'content_inner'));
         // show the actual content (forms, lists, whatever)
         $this->showContent();
@@ -326,19 +326,24 @@ class Action extends HTMLOutputter // lawsuit
         $this->element('h1', NULL, $this->title());
     }
 
+    function showPageNoticeBlock()
+    {
+	$this->elementStart('dl', array('id' => 'page_notice',
+					'class' => 'system_notice'));
+	$this->element('dt', null, _('Page notice'));
+	$this->elementStart('dd', null);
+	$this->showPageNotice();
+	$this->elementEnd('dd');
+	$this->elementEnd('dl');
+	}
+    }
+
     // SHOULD overload (unless there's not a notice)
 
     function showPageNotice()
     {
-        $this->elementStart('dl', array('id' => 'page_notice',
-                                        'class' => 'system_notice'));
-        $this->element('dt', null, _('Page notice'));
-        $this->elementStart('dd', null);
-        // Output a bunch of paragraphs here
-        $this->elementEnd('dd');
-        $this->elementEnd('dl');
     }
-
+    
     // MUST overload
 
     function showContent()
-- 
cgit v1.2.3-54-g00ecf


From 4b0cf99e56f965e10eeb8b8b19e7b405bda49eaf Mon Sep 17 00:00:00 2001
From: Evan Prodromou <evan@controlyourself.ca>
Date: Thu, 15 Jan 2009 23:03:38 +0000
Subject: Convert use of common_server_error and common_user_error to methods
 on Action

---
 actions/accesstoken.php            |  2 +-
 actions/all.php                    |  4 ++--
 actions/allrss.php                 |  2 +-
 actions/api.php                    |  4 ++--
 actions/avatarbynickname.php       | 10 ++++-----
 actions/block.php                  | 12 +++++------
 actions/confirmaddress.php         | 14 ++++++------
 actions/deleteprofile.php          |  2 +-
 actions/disfavor.php               |  8 +++----
 actions/doc.php                    |  2 +-
 actions/emailsettings.php          | 12 +++++------
 actions/facebookremove.php         |  2 +-
 actions/favor.php                  |  8 +++----
 actions/favoritesrss.php           |  2 +-
 actions/finishaddopenid.php        |  2 +-
 actions/finishopenidlogin.php      | 12 +++++------
 actions/finishremotesubscribe.php  | 34 ++++++++++++++---------------
 actions/foaf.php                   |  4 ++--
 actions/imsettings.php             |  8 +++----
 actions/invite.php                 |  2 +-
 actions/login.php                  |  8 +++----
 actions/logout.php                 |  2 +-
 actions/microsummary.php           |  4 ++--
 actions/newmessage.php             | 10 ++++-----
 actions/newnotice.php              |  4 ++--
 actions/noticesearch.php           |  2 +-
 actions/nudge.php                  |  6 +++---
 actions/openidlogin.php            |  2 +-
 actions/othersettings.php          |  2 +-
 actions/peopletag.php              |  2 +-
 actions/postnotice.php             | 14 ++++++------
 actions/profilesettings.php        | 12 +++++------
 actions/public.php                 |  2 +-
 actions/recoverpassword.php        | 26 +++++++++++-----------
 actions/register.php               | 10 ++++-----
 actions/remotesubscribe.php        |  4 ++--
 actions/replies.php                |  4 ++--
 actions/repliesrss.php             |  2 +-
 actions/requesttoken.php           |  2 +-
 actions/showfavorites.php          |  6 +++---
 actions/showmessage.php            |  4 ++--
 actions/shownotice.php             |  6 +++---
 actions/showstream.php             |  4 ++--
 actions/smssettings.php            |  8 +++----
 actions/subedit.php                | 12 +++++------
 actions/subscribe.php              |  8 +++----
 actions/tagother.php               | 12 +++++------
 actions/tagrss.php                 |  2 +-
 actions/twitapiaccount.php         | 16 +++++++-------
 actions/twitapiblocks.php          |  8 +++----
 actions/twitapidirect_messages.php | 18 ++++++++--------
 actions/twitapifavorites.php       | 20 ++++++++---------
 actions/twitapifriendships.php     | 16 +++++++-------
 actions/twitapihelp.php            |  4 ++--
 actions/twitapilaconica.php        |  6 +++---
 actions/twitapinotifications.php   |  4 ++--
 actions/twitapistatuses.php        | 44 +++++++++++++++++++-------------------
 actions/twitapiusers.php           |  4 ++--
 actions/twittersettings.php        |  2 +-
 actions/unblock.php                | 10 ++++-----
 actions/unsubscribe.php            | 10 ++++-----
 actions/updateprofile.php          | 36 +++++++++++++++----------------
 actions/userauthorization.php      | 12 +++++------
 actions/userbyid.php               |  4 ++--
 actions/userrss.php                |  4 ++--
 actions/xrds.php                   |  2 +-
 lib/action.php                     |  4 ++--
 67 files changed, 275 insertions(+), 275 deletions(-)

(limited to 'actions/twitapihelp.php')

diff --git a/actions/accesstoken.php b/actions/accesstoken.php
index 072ce27eb..ad03b7019 100644
--- a/actions/accesstoken.php
+++ b/actions/accesstoken.php
@@ -38,7 +38,7 @@ class AccesstokenAction extends Action
             common_debug('printing the access token', __FILE__);
             print $token;
         } catch (OAuthException $e) {
-            common_server_error($e->getMessage());
+            $this->serverError($e->getMessage());
         }
     }
 }
diff --git a/actions/all.php b/actions/all.php
index a8a74fb33..4ad7f12ae 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -33,14 +33,14 @@ class AllAction extends StreamAction
         $user = User::staticGet('nickname', $nickname);
 
         if (!$user) {
-            $this->client_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return;
         }
 
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
diff --git a/actions/allrss.php b/actions/allrss.php
index 660afb9e2..56818d605 100644
--- a/actions/allrss.php
+++ b/actions/allrss.php
@@ -34,7 +34,7 @@ class AllrssAction extends Rss10Action
         $this->user = User::staticGet('nickname', $nickname);
 
         if (!$this->user) {
-            common_user_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return false;
         } else {
             return true;
diff --git a/actions/api.php b/actions/api.php
index 9cbf9a468..64971774d 100644
--- a/actions/api.php
+++ b/actions/api.php
@@ -103,10 +103,10 @@ class ApiAction extends Action
 
                 call_user_func(array($action_obj, $this->api_method), $_REQUEST, $apidata);
             } else {
-                common_user_error("API method not found!", $code=404);
+                $this->clientError("API method not found!", $code=404);
             }
         } else {
-            common_user_error("API method not found!", $code=404);
+            $this->clientError("API method not found!", $code=404);
         }
     }
 
diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php
index 666f386f6..d2d078b61 100644
--- a/actions/avatarbynickname.php
+++ b/actions/avatarbynickname.php
@@ -26,28 +26,28 @@ class AvatarbynicknameAction extends Action
         parent::handle($args);
         $nickname = $this->trimmed('nickname');
         if (!$nickname) {
-            $this->client_error(_('No nickname.'));
+            $this->clientError(_('No nickname.'));
             return;
         }
         $size = $this->trimmed('size');
         if (!$size) {
-            $this->client_error(_('No size.'));
+            $this->clientError(_('No size.'));
             return;
         }
         $size = strtolower($size);
         if (!in_array($size, array('original', '96', '48', '24'))) {
-            $this->client_error(_('Invalid size.'));
+            $this->clientError(_('Invalid size.'));
             return;
         }
 
         $user = User::staticGet('nickname', $nickname);
         if (!$user) {
-            $this->client_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return;
         }
         $profile = $user->getProfile();
         if (!$profile) {
-            $this->client_error(_('User has no profile.'));
+            $this->clientError(_('User has no profile.'));
             return;
         }
         if ($size == 'original') {
diff --git a/actions/block.php b/actions/block.php
index f8f6f24fd..738cbfbf7 100644
--- a/actions/block.php
+++ b/actions/block.php
@@ -30,28 +30,28 @@ class BlockAction extends Action
         parent::prepare($args);
 
         if (!common_logged_in()) {
-            $this->client_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return false;
         }
 
         $token = $this->trimmed('token');
 
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
         $id = $this->trimmed('blockto');
 
         if (!$id) {
-            $this->client_error(_('No profile specified.'));
+            $this->clientError(_('No profile specified.'));
             return false;
         }
 
         $this->profile = Profile::staticGet('id', $id);
 
         if (!$this->profile) {
-            $this->client_error(_('No profile with that ID.'));
+            $this->clientError(_('No profile with that ID.'));
             return false;
         }
 
@@ -119,14 +119,14 @@ class BlockAction extends Action
         $cur = common_current_user();
 
         if ($cur->hasBlocked($this->profile)) {
-            $this->client_error(_('You have already blocked this user.'));
+            $this->clientError(_('You have already blocked this user.'));
             return;
         }
 
         $result = $cur->block($this->profile);
 
         if (!$result) {
-            $this->server_error(_('Failed to save block information.'));
+            $this->serverError(_('Failed to save block information.'));
             return;
         }
 
diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php
index 31a157768..53410fbe6 100644
--- a/actions/confirmaddress.php
+++ b/actions/confirmaddress.php
@@ -32,26 +32,26 @@ class ConfirmaddressAction extends Action
         }
         $code = $this->trimmed('code');
         if (!$code) {
-            $this->client_error(_('No confirmation code.'));
+            $this->clientError(_('No confirmation code.'));
             return;
         }
         $confirm = Confirm_address::staticGet('code', $code);
         if (!$confirm) {
-            $this->client_error(_('Confirmation code not found.'));
+            $this->clientError(_('Confirmation code not found.'));
             return;
         }
         $cur = common_current_user();
         if ($cur->id != $confirm->user_id) {
-            $this->client_error(_('That confirmation code is not for you!'));
+            $this->clientError(_('That confirmation code is not for you!'));
             return;
         }
         $type = $confirm->address_type;
         if (!in_array($type, array('email', 'jabber', 'sms'))) {
-            $this->server_error(sprintf(_('Unrecognized address type %s'), $type));
+            $this->serverError(sprintf(_('Unrecognized address type %s'), $type));
             return;
         }
         if ($cur->$type == $confirm->address) {
-            $this->client_error(_('That address has already been confirmed.'));
+            $this->clientError(_('That address has already been confirmed.'));
             return;
         }
 
@@ -71,7 +71,7 @@ class ConfirmaddressAction extends Action
 
         if (!$result) {
             common_log_db_error($cur, 'UPDATE', __FILE__);
-            $this->server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
 
@@ -83,7 +83,7 @@ class ConfirmaddressAction extends Action
 
         if (!$result) {
             common_log_db_error($confirm, 'DELETE', __FILE__);
-            $this->server_error(_('Couldn\'t delete email confirmation.'));
+            $this->serverError(_('Couldn\'t delete email confirmation.'));
             return;
         }
 
diff --git a/actions/deleteprofile.php b/actions/deleteprofile.php
index ef4687d5f..cc236f847 100644
--- a/actions/deleteprofile.php
+++ b/actions/deleteprofile.php
@@ -24,7 +24,7 @@ class DeleteprofileAction extends Action
     function handle($args)
     {
         parent::handle($args);
-        $this->server_error(_('Code not yet ready.'));
+        $this->serverError(_('Code not yet ready.'));
         return;
         if ('POST' === $_SERVER['REQUEST_METHOD']) {
             $this->handle_post();
diff --git a/actions/disfavor.php b/actions/disfavor.php
index 9a27f34b1..fc36f7c75 100644
--- a/actions/disfavor.php
+++ b/actions/disfavor.php
@@ -28,7 +28,7 @@ class DisfavorAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return;
         }
 
@@ -46,7 +46,7 @@ class DisfavorAction extends Action
         $token = $this->trimmed('token-'.$notice->id);
 
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_("There was a problem with your session token. Try again, please."));
+            $this->clientError(_("There was a problem with your session token. Try again, please."));
             return;
         }
 
@@ -54,7 +54,7 @@ class DisfavorAction extends Action
         $fave->user_id = $this->id;
         $fave->notice_id = $notice->id;
         if (!$fave->find(true)) {
-            $this->client_error(_('This notice is not a favorite!'));
+            $this->clientError(_('This notice is not a favorite!'));
             return;
         }
 
@@ -62,7 +62,7 @@ class DisfavorAction extends Action
 
         if (!$result) {
             common_log_db_error($fave, 'DELETE', __FILE__);
-            $this->server_error(_('Could not delete favorite.'));
+            $this->serverError(_('Could not delete favorite.'));
             return;
         }
         
diff --git a/actions/doc.php b/actions/doc.php
index 98da31267..3d14b25b8 100644
--- a/actions/doc.php
+++ b/actions/doc.php
@@ -28,7 +28,7 @@ class DocAction extends Action
         $title = $this->trimmed('title');
         $filename = INSTALLDIR.'/doc/'.$title;
         if (!file_exists($filename)) {
-            common_user_error(_('No such document.'));
+            $this->clientError(_('No such document.'));
             return;
         }
         $c = file_get_contents($filename);
diff --git a/actions/emailsettings.php b/actions/emailsettings.php
index 39f186bff..6210c07b4 100644
--- a/actions/emailsettings.php
+++ b/actions/emailsettings.php
@@ -182,7 +182,7 @@ class EmailsettingsAction extends SettingsAction
 
         if ($result === false) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
 
@@ -232,7 +232,7 @@ class EmailsettingsAction extends SettingsAction
 
         if ($result === false) {
             common_log_db_error($confirm, 'INSERT', __FILE__);
-            common_server_error(_('Couldn\'t insert confirmation code.'));
+            $this->serverError(_('Couldn\'t insert confirmation code.'));
             return;
         }
 
@@ -260,7 +260,7 @@ class EmailsettingsAction extends SettingsAction
 
         if (!$result) {
             common_log_db_error($confirm, 'DELETE', __FILE__);
-            $this->server_error(_('Couldn\'t delete email confirmation.'));
+            $this->serverError(_('Couldn\'t delete email confirmation.'));
             return;
         }
 
@@ -286,7 +286,7 @@ class EmailsettingsAction extends SettingsAction
         $result = $user->updateKeys($original);
         if (!$result) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
         $user->query('COMMIT');
@@ -308,7 +308,7 @@ class EmailsettingsAction extends SettingsAction
 
         if (!$user->updateKeys($orig)) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            $this->server_error(_("Couldn't update user record."));
+            $this->serverError(_("Couldn't update user record."));
         }
         
         $this->show_form(_('Incoming email address removed.'), true);
@@ -323,7 +323,7 @@ class EmailsettingsAction extends SettingsAction
         
         if (!$user->updateKeys($orig)) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            $this->server_error(_("Couldn't update user record."));
+            $this->serverError(_("Couldn't update user record."));
         }
 
         $this->show_form(_('New incoming email address added.'), true);
diff --git a/actions/facebookremove.php b/actions/facebookremove.php
index a200fefbf..d0a0dd951 100644
--- a/actions/facebookremove.php
+++ b/actions/facebookremove.php
@@ -53,7 +53,7 @@ class FacebookremoveAction extends FacebookAction
 
             if (!$result) {
                 common_log_db_error($flink, 'DELETE', __FILE__);
-                common_server_error(_('Couldn\'t remove Facebook user.'));
+                $this->serverError(_('Couldn\'t remove Facebook user.'));
                 return;
             }
 
diff --git a/actions/favor.php b/actions/favor.php
index 1dfef9bbb..8d751a7a9 100644
--- a/actions/favor.php
+++ b/actions/favor.php
@@ -29,7 +29,7 @@ class FavorAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return;
         }
 
@@ -48,19 +48,19 @@ class FavorAction extends Action
 
         $token = $this->trimmed('token-'.$notice->id);
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_("There was a problem with your session token. Try again, please."));
+            $this->clientError(_("There was a problem with your session token. Try again, please."));
             return;
         }
 
         if ($user->hasFave($notice)) {
-            $this->client_error(_('This notice is already a favorite!'));
+            $this->clientError(_('This notice is already a favorite!'));
             return;
         }
 
         $fave = Fave::addNew($user, $notice);
 
         if (!$fave) {
-            $this->server_error(_('Could not create favorite.'));
+            $this->serverError(_('Could not create favorite.'));
             return;
         }
 
diff --git a/actions/favoritesrss.php b/actions/favoritesrss.php
index 8c7ce52bf..3f4ffc63a 100644
--- a/actions/favoritesrss.php
+++ b/actions/favoritesrss.php
@@ -34,7 +34,7 @@ class FavoritesrssAction extends Rss10Action
         $this->user = User::staticGet('nickname', $nickname);
 
         if (!$this->user) {
-            common_user_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return false;
         } else {
             return true;
diff --git a/actions/finishaddopenid.php b/actions/finishaddopenid.php
index 7de631712..708e8d4bf 100644
--- a/actions/finishaddopenid.php
+++ b/actions/finishaddopenid.php
@@ -28,7 +28,7 @@ class FinishaddopenidAction extends Action
     {
         parent::handle($args);
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
         } else {
             $this->try_login();
         }
diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php
index 112429002..bc33ac330 100644
--- a/actions/finishopenidlogin.php
+++ b/actions/finishopenidlogin.php
@@ -28,7 +28,7 @@ class FinishopenidloginAction extends Action
     {
         parent::handle($args);
         if (common_logged_in()) {
-            common_user_error(_('Already logged in.'));
+            $this->clientError(_('Already logged in.'));
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $token = $this->trimmed('token');
             if (!$token || $token != common_session_token()) {
@@ -179,7 +179,7 @@ class FinishopenidloginAction extends Action
         # FIXME: save invite code before redirect, and check here
 
         if (common_config('site', 'closed') || common_config('site', 'inviteonly')) {
-            common_user_error(_('Registration not allowed.'));
+            $this->clientError(_('Registration not allowed.'));
             return;
         }
 
@@ -205,7 +205,7 @@ class FinishopenidloginAction extends Action
         list($display, $canonical, $sreg) = $this->get_saved_values();
 
         if (!$display || !$canonical) {
-            common_server_error(_('Stored OpenID not found.'));
+            $this->serverError(_('Stored OpenID not found.'));
             return;
         }
 
@@ -214,7 +214,7 @@ class FinishopenidloginAction extends Action
         $other = oid_get_user($canonical);
 
         if ($other) {
-            common_server_error(_('Creating new account for OpenID that already has a user.'));
+            $this->serverError(_('Creating new account for OpenID that already has a user.'));
             return;
         }
 
@@ -274,14 +274,14 @@ class FinishopenidloginAction extends Action
         list($display, $canonical, $sreg) = $this->get_saved_values();
 
         if (!$display || !$canonical) {
-            common_server_error(_('Stored OpenID not found.'));
+            $this->serverError(_('Stored OpenID not found.'));
             return;
         }
 
         $result = oid_link_user($user->id, $canonical, $display);
 
         if (!$result) {
-            common_server_error(_('Error connecting user to OpenID.'));
+            $this->serverError(_('Error connecting user to OpenID.'));
             return;
         }
 
diff --git a/actions/finishremotesubscribe.php b/actions/finishremotesubscribe.php
index cee3a1818..f9094a50c 100644
--- a/actions/finishremotesubscribe.php
+++ b/actions/finishremotesubscribe.php
@@ -30,14 +30,14 @@ class FinishremotesubscribeAction extends Action
         parent::handle($args);
 
         if (common_logged_in()) {
-            common_user_error(_('You can use the local subscription!'));
+            $this->clientError(_('You can use the local subscription!'));
             return;
         }
 
         $omb = $_SESSION['oauth_authorization_request'];
 
         if (!$omb) {
-            common_user_error(_('Not expecting this response!'));
+            $this->clientError(_('Not expecting this response!'));
             return;
         }
 
@@ -51,38 +51,38 @@ class FinishremotesubscribeAction extends Action
         # I think this is the success metric
 
         if ($token != $omb['token']) {
-            common_user_error(_('Not authorized.'));
+            $this->clientError(_('Not authorized.'));
             return;
         }
 
         $version = $req->get_parameter('omb_version');
 
         if ($version != OMB_VERSION_01) {
-            common_user_error(_('Unknown version of OMB protocol.'));
+            $this->clientError(_('Unknown version of OMB protocol.'));
             return;
         }
 
         $nickname = $req->get_parameter('omb_listener_nickname');
 
         if (!$nickname) {
-            common_user_error(_('No nickname provided by remote server.'));
+            $this->clientError(_('No nickname provided by remote server.'));
             return;
         }
 
         $profile_url = $req->get_parameter('omb_listener_profile');
 
         if (!$profile_url) {
-            common_user_error(_('No profile URL returned by server.'));
+            $this->clientError(_('No profile URL returned by server.'));
             return;
         }
 
         if (!Validate::uri($profile_url, array('allowed_schemes' => array('http', 'https')))) {
-            common_user_error(_('Invalid profile URL returned by server.'));
+            $this->clientError(_('Invalid profile URL returned by server.'));
             return;
         }
 
         if ($profile_url == common_local_url('showstream', array('nickname' => $nickname))) {
-            common_user_error(_('You can use the local subscription!'));
+            $this->clientError(_('You can use the local subscription!'));
             return;
         }
 
@@ -91,14 +91,14 @@ class FinishremotesubscribeAction extends Action
         $user = User::staticGet('nickname', $omb['listenee']);
 
         if (!$user) {
-            common_user_error(_('User being listened to doesn\'t exist.'));
+            $this->clientError(_('User being listened to doesn\'t exist.'));
             return;
         }
 
         $other = User::staticGet('uri', $omb['listener']);
 
         if ($other) {
-            common_user_error(_('You can use the local subscription!'));
+            $this->clientError(_('You can use the local subscription!'));
             return;
         }
 
@@ -111,7 +111,7 @@ class FinishremotesubscribeAction extends Action
         list($newtok, $newsecret) = $this->access_token($omb);
 
         if (!$newtok || !$newsecret) {
-            common_user_error(_('Couldn\'t convert request tokens to access tokens.'));
+            $this->clientError(_('Couldn\'t convert request tokens to access tokens.'));
             return;
         }
 
@@ -155,7 +155,7 @@ class FinishremotesubscribeAction extends Action
             $profile->created = DB_DataObject_Cast::dateTime(); # current time
             $id = $profile->insert();
             if (!$id) {
-                common_server_error(_('Error inserting new profile'));
+                $this->serverError(_('Error inserting new profile'));
                 return;
             }
             $remote->id = $id;
@@ -163,7 +163,7 @@ class FinishremotesubscribeAction extends Action
 
         if ($avatar_url) {
             if (!$this->add_avatar($profile, $avatar_url)) {
-                common_server_error(_('Error inserting avatar'));
+                $this->serverError(_('Error inserting avatar'));
                 return;
             }
         }
@@ -173,19 +173,19 @@ class FinishremotesubscribeAction extends Action
 
         if ($exists) {
             if (!$remote->update($orig_remote)) {
-                common_server_error(_('Error updating remote profile'));
+                $this->serverError(_('Error updating remote profile'));
                 return;
             }
         } else {
             $remote->created = DB_DataObject_Cast::dateTime(); # current time
             if (!$remote->insert()) {
-                common_server_error(_('Error inserting remote profile'));
+                $this->serverError(_('Error inserting remote profile'));
                 return;
             }
         }
 
         if ($user->hasBlocked($profile)) {
-            $this->client_error(_('That user has blocked you from subscribing.'));
+            $this->clientError(_('That user has blocked you from subscribing.'));
             return;
         }
 
@@ -215,7 +215,7 @@ class FinishremotesubscribeAction extends Action
 
         if (!$result) {
             common_log_db_error($sub, ($sub_exists) ? 'UPDATE' : 'INSERT', __FILE__);
-            common_user_error(_('Couldn\'t insert new subscription.'));
+            $this->clientError(_('Couldn\'t insert new subscription.'));
             return;
         }
 
diff --git a/actions/foaf.php b/actions/foaf.php
index 6f73ce505..a0f8a1ff3 100644
--- a/actions/foaf.php
+++ b/actions/foaf.php
@@ -40,14 +40,14 @@ class FoafAction extends Action
         $user = User::staticGet('nickname', $nickname);
 
         if (!$user) {
-            common_user_error(_('No such user.'), 404);
+            $this->clientError(_('No such user.'), 404);
             return;
         }
 
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'), 500);
+            $this->serverError(_('User has no profile.'), 500);
             return;
         }
 
diff --git a/actions/imsettings.php b/actions/imsettings.php
index 693f49efa..14df3451a 100644
--- a/actions/imsettings.php
+++ b/actions/imsettings.php
@@ -149,7 +149,7 @@ class ImsettingsAction extends SettingsAction
 
         if ($result === false) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
 
@@ -199,7 +199,7 @@ class ImsettingsAction extends SettingsAction
 
         if ($result === false) {
             common_log_db_error($confirm, 'INSERT', __FILE__);
-            common_server_error(_('Couldn\'t insert confirmation code.'));
+            $this->serverError(_('Couldn\'t insert confirmation code.'));
             return;
         }
 
@@ -231,7 +231,7 @@ class ImsettingsAction extends SettingsAction
 
         if (!$result) {
             common_log_db_error($confirm, 'DELETE', __FILE__);
-            $this->server_error(_('Couldn\'t delete email confirmation.'));
+            $this->serverError(_('Couldn\'t delete email confirmation.'));
             return;
         }
 
@@ -257,7 +257,7 @@ class ImsettingsAction extends SettingsAction
         $result = $user->updateKeys($original);
         if (!$result) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
         $user->query('COMMIT');
diff --git a/actions/invite.php b/actions/invite.php
index 15233602e..879264deb 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -31,7 +31,7 @@ class InviteAction extends Action
     {
         parent::handle($args);
         if (!common_logged_in()) {
-            $this->client_error(sprintf(_('You must be logged in to invite other users to use %s'),
+            $this->clientError(sprintf(_('You must be logged in to invite other users to use %s'),
                                         common_config('site', 'name')));
             return;
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
diff --git a/actions/login.php b/actions/login.php
index fd98e656d..060d16ad6 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -31,7 +31,7 @@ class LoginAction extends Action
     {
         parent::handle($args);
         if (common_is_real_login()) {
-            common_user_error(_('Already logged in.'));
+            $this->clientError(_('Already logged in.'));
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $this->check_login();
         } else {
@@ -46,7 +46,7 @@ class LoginAction extends Action
         # CSRF protection - token set in common_notice_form()
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
@@ -55,7 +55,7 @@ class LoginAction extends Action
         if (common_check_user($nickname, $password)) {
             # success!
             if (!common_set_user($nickname)) {
-                common_server_error(_('Error setting user.'));
+                $this->serverError(_('Error setting user.'));
                 return;
             }
             common_real_login(true);
@@ -81,7 +81,7 @@ class LoginAction extends Action
 
         # success!
         if (!common_set_user($user)) {
-            common_server_error(_('Error setting user.'));
+            $this->serverError(_('Error setting user.'));
             return;
         }
 
diff --git a/actions/logout.php b/actions/logout.php
index 201378730..3001f3613 100644
--- a/actions/logout.php
+++ b/actions/logout.php
@@ -33,7 +33,7 @@ class LogoutAction extends Action
     {
         parent::handle($args);
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
         } else {
             common_set_user(null);
             common_real_login(false); # not logged in
diff --git a/actions/microsummary.php b/actions/microsummary.php
index 13ddc4e3e..b46c5bee5 100644
--- a/actions/microsummary.php
+++ b/actions/microsummary.php
@@ -31,14 +31,14 @@ class MicrosummaryAction extends Action
         $user = User::staticGet('nickname', $nickname);
 
         if (!$user) {
-            $this->client_error(_('No such user'), 404);
+            $this->clientError(_('No such user'), 404);
             return;
         }
         
         $notice = $user->getCurrentNotice();
         
         if (!$notice) {
-            $this->client_error(_('No current status'), 404);
+            $this->clientError(_('No current status'), 404);
         }
         
         header('Content-Type: text/plain');
diff --git a/actions/newmessage.php b/actions/newmessage.php
index 6221b67e9..510a5f8f3 100644
--- a/actions/newmessage.php
+++ b/actions/newmessage.php
@@ -27,7 +27,7 @@ class NewmessageAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            $this->client_error(_('Not logged in.'), 403);
+            $this->clientError(_('Not logged in.'), 403);
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $this->save_new_message();
         } else {
@@ -71,10 +71,10 @@ class NewmessageAction extends Action
             $this->show_form(_('No recipient specified.'));
             return;
         } else if (!$user->mutuallySubscribed($other)) {
-            $this->client_error(_('You can\'t send a message to this user.'), 404);
+            $this->clientError(_('You can\'t send a message to this user.'), 404);
             return;
         } else if ($user->id == $other->id) {
-            $this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), 403);
+            $this->clientError(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), 403);
             return;
         }
         
@@ -113,12 +113,12 @@ class NewmessageAction extends Action
         $other = User::staticGet('id', $to);
 
         if (!$other) {
-            $this->client_error(_('No such user'), 404);
+            $this->clientError(_('No such user'), 404);
             return;
         }
 
         if (!$user->mutuallySubscribed($other)) {
-            $this->client_error(_('You can\'t send a message to this user.'), 404);
+            $this->clientError(_('You can\'t send a message to this user.'), 404);
             return;
         }
         
diff --git a/actions/newnotice.php b/actions/newnotice.php
index 89792d95a..cb02854a1 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -29,13 +29,13 @@ class NewnoticeAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
 
             # CSRF protection - token set in common_notice_form()
             $token = $this->trimmed('token');
             if (!$token || $token != common_session_token()) {
-                $this->client_error(_('There was a problem with your session token. Try again, please.'));
+                $this->clientError(_('There was a problem with your session token. Try again, please.'));
                 return;
             }
 
diff --git a/actions/noticesearch.php b/actions/noticesearch.php
index d998b9da8..336e39bd3 100644
--- a/actions/noticesearch.php
+++ b/actions/noticesearch.php
@@ -97,7 +97,7 @@ class NoticesearchAction extends SearchAction
         $profile = $notice->getProfile();
         if (!$profile) {
             common_log_db_error($notice, 'SELECT', __FILE__);
-            $this->server_error(_('Notice without matching profile'));
+            $this->serverError(_('Notice without matching profile'));
             return;
         }
         # XXX: RDFa
diff --git a/actions/nudge.php b/actions/nudge.php
index de930e462..49223d431 100644
--- a/actions/nudge.php
+++ b/actions/nudge.php
@@ -29,7 +29,7 @@ class NudgeAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            $this->client_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return;
         }
 
@@ -46,12 +46,12 @@ class NudgeAction extends Action
         $token = $this->trimmed('token');
         
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
         if (!$other->email || !$other->emailnotifynudge) {
-            $this->client_error(_('This user doesn\'t allow nudges or hasn\'t confirmed or set his email yet.'));
+            $this->clientError(_('This user doesn\'t allow nudges or hasn\'t confirmed or set his email yet.'));
             return;
         }
 
diff --git a/actions/openidlogin.php b/actions/openidlogin.php
index 82791af34..d1989e0de 100644
--- a/actions/openidlogin.php
+++ b/actions/openidlogin.php
@@ -28,7 +28,7 @@ class OpenidloginAction extends Action
     {
         parent::handle($args);
         if (common_logged_in()) {
-            common_user_error(_('Already logged in.'));
+            $this->clientError(_('Already logged in.'));
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $openid_url = $this->trimmed('openid_url');
 
diff --git a/actions/othersettings.php b/actions/othersettings.php
index 97cbd0094..51f6f8197 100644
--- a/actions/othersettings.php
+++ b/actions/othersettings.php
@@ -177,7 +177,7 @@ class OthersettingsAction extends SettingsAction
 
         if ($result === false) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
 
diff --git a/actions/peopletag.php b/actions/peopletag.php
index 2680638d7..7bcfcb93e 100644
--- a/actions/peopletag.php
+++ b/actions/peopletag.php
@@ -32,7 +32,7 @@ class PeopletagAction extends Action
         $tag = $this->trimmed('tag');
         
         if (!common_valid_profile_tag($tag)) {
-            $this->client_error(sprintf(_('Not a valid people tag: %s'), $tag));
+            $this->clientError(sprintf(_('Not a valid people tag: %s'), $tag));
             return;
         }
 
diff --git a/actions/postnotice.php b/actions/postnotice.php
index dec62a678..0b4735296 100644
--- a/actions/postnotice.php
+++ b/actions/postnotice.php
@@ -36,7 +36,7 @@ class PostnoticeAction extends Action
                 print "omb_version=".OMB_VERSION_01;
             }
         } catch (OAuthException $e) {
-            common_server_error($e->getMessage());
+            $this->serverError($e->getMessage());
             return;
         }
     }
@@ -45,36 +45,36 @@ class PostnoticeAction extends Action
     {
         $version = $req->get_parameter('omb_version');
         if ($version != OMB_VERSION_01) {
-            common_user_error(_('Unsupported OMB version'), 400);
+            $this->clientError(_('Unsupported OMB version'), 400);
             return false;
         }
         # First, check to see
         $listenee =  $req->get_parameter('omb_listenee');
         $remote_profile = Remote_profile::staticGet('uri', $listenee);
         if (!$remote_profile) {
-            common_user_error(_('Profile unknown'), 403);
+            $this->clientError(_('Profile unknown'), 403);
             return false;
         }
         $sub = Subscription::staticGet('token', $token->key);
         if (!$sub) {
-            common_user_error(_('No such subscription'), 403);
+            $this->clientError(_('No such subscription'), 403);
             return false;
         }
         $content = $req->get_parameter('omb_notice_content');
         $content_shortened = common_shorten_links($content);
         if (mb_strlen($content_shortened) > 140) {
-            common_user_error(_('Invalid notice content'), 400);
+            $this->clientError(_('Invalid notice content'), 400);
             return false;
         }
         $notice_uri = $req->get_parameter('omb_notice');
         if (!Validate::uri($notice_uri) &&
             !common_valid_tag($notice_uri)) {
-            common_user_error(_('Invalid notice uri'), 400);
+            $this->clientError(_('Invalid notice uri'), 400);
             return false;
         }
         $notice_url = $req->get_parameter('omb_notice_url');
         if ($notice_url && !common_valid_http_url($notice_url)) {
-            common_user_error(_('Invalid notice url'), 400);
+            $this->clientError(_('Invalid notice url'), 400);
             return false;
         }
         $notice = Notice::staticGet('uri', $notice_uri);
diff --git a/actions/profilesettings.php b/actions/profilesettings.php
index ef45fc1d9..6ad3f2ef5 100644
--- a/actions/profilesettings.php
+++ b/actions/profilesettings.php
@@ -125,7 +125,7 @@ class ProfilesettingsAction extends SettingsAction
 
         if (!$profile) {
             common_log_db_error($user, 'SELECT', __FILE__);
-            $this->server_error(_('User without matching profile'));
+            $this->serverError(_('User without matching profile'));
             return;
         }
         
@@ -298,7 +298,7 @@ class ProfilesettingsAction extends SettingsAction
 
             if ($result === false) {
                 common_log_db_error($user, 'UPDATE', __FILE__);
-                common_server_error(_('Couldn\'t update user.'));
+                $this->serverError(_('Couldn\'t update user.'));
                 return;
             } else {
                 # Re-initialize language environment if it changed
@@ -318,7 +318,7 @@ class ProfilesettingsAction extends SettingsAction
 
             if ($result === false) {
                 common_log_db_error($user, 'UPDATE', __FILE__);
-                common_server_error(_('Couldn\'t update user for autosubscribe.'));
+                $this->serverError(_('Couldn\'t update user for autosubscribe.'));
                 return;
             }
         }
@@ -341,7 +341,7 @@ class ProfilesettingsAction extends SettingsAction
 
         if (!$result) {
             common_log_db_error($profile, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t save profile.'));
+            $this->serverError(_('Couldn\'t save profile.'));
             return;
         }
 
@@ -350,7 +350,7 @@ class ProfilesettingsAction extends SettingsAction
         $result = $user->setSelfTags($tags);
 
         if (!$result) {
-            common_server_error(_('Couldn\'t save tags.'));
+            $this->serverError(_('Couldn\'t save tags.'));
             return;
         }
         
@@ -475,7 +475,7 @@ class ProfilesettingsAction extends SettingsAction
         }
 
         if (!$user->update($original)) {
-            common_server_error(_('Can\'t save new password.'));
+            $this->serverError(_('Can\'t save new password.'));
             return;
         }
 
diff --git a/actions/public.php b/actions/public.php
index 62071eccc..0ceeef98e 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -165,7 +165,7 @@ class PublicAction extends Action
                                        NOTICES_PER_PAGE + 1);
 
         if (!$notice) {
-            $this->server_error(_('Could not retrieve public stream.'));
+            $this->serverError(_('Could not retrieve public stream.'));
             return;
         }
 
diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php
index 3e6ecfb1f..3d839e751 100644
--- a/actions/recoverpassword.php
+++ b/actions/recoverpassword.php
@@ -30,7 +30,7 @@ class RecoverpasswordAction extends Action
     {
         parent::handle($args);
         if (common_logged_in()) {
-            $this->client_error(_('You are already logged in!'));
+            $this->clientError(_('You are already logged in!'));
             return;
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             if ($this->arg('recover')) {
@@ -38,7 +38,7 @@ class RecoverpasswordAction extends Action
             } else if ($this->arg('reset')) {
                 $this->reset_password();
             } else {
-                $this->client_error(_('Unexpected form submission.'));
+                $this->clientError(_('Unexpected form submission.'));
             }
         } else {
             if ($this->trimmed('code')) {
@@ -56,18 +56,18 @@ class RecoverpasswordAction extends Action
         $confirm = Confirm_address::staticGet('code', $code);
 
         if (!$confirm) {
-            $this->client_error(_('No such recovery code.'));
+            $this->clientError(_('No such recovery code.'));
             return;
         }
         if ($confirm->address_type != 'recover') {
-            $this->client_error(_('Not a recovery code.'));
+            $this->clientError(_('Not a recovery code.'));
             return;
         }
 
         $user = User::staticGet($confirm->user_id);
 
         if (!$user) {
-            $this->server_error(_('Recovery code for unknown user.'));
+            $this->serverError(_('Recovery code for unknown user.'));
             return;
         }
 
@@ -80,7 +80,7 @@ class RecoverpasswordAction extends Action
 
         if (!$result) {
             common_log_db_error($confirm, 'DELETE', __FILE__);
-            common_server_error(_('Error with confirmation code.'));
+            $this->serverError(_('Error with confirmation code.'));
             return;
         }
 
@@ -91,7 +91,7 @@ class RecoverpasswordAction extends Action
             common_log(LOG_WARNING, 
                        'Attempted redemption on recovery code ' .
                        'that is ' . $touched . ' seconds old. ');
-            $this->client_error(_('This confirmation code is too old. ' .
+            $this->clientError(_('This confirmation code is too old. ' .
                                    'Please start again.'));
             return;
         }
@@ -105,7 +105,7 @@ class RecoverpasswordAction extends Action
             $result = $user->updateKeys($orig);
             if (!$result) {
                 common_log_db_error($user, 'UPDATE', __FILE__);
-                $this->server_error(_('Could not update user with confirmed email address.'));
+                $this->serverError(_('Could not update user with confirmed email address.'));
                 return;
             }
         }
@@ -240,7 +240,7 @@ class RecoverpasswordAction extends Action
         }
 
         if (!$user->email && !$confirm_email) {
-            $this->client_error(_('No registered email address for that user.'));
+            $this->clientError(_('No registered email address for that user.'));
             return;
         }
 
@@ -254,7 +254,7 @@ class RecoverpasswordAction extends Action
 
         if (!$confirm->insert()) {
             common_log_db_error($confirm, 'INSERT', __FILE__);
-            $this->server_error(_('Error saving address confirmation.'));
+            $this->serverError(_('Error saving address confirmation.'));
             return;
         }
 
@@ -298,7 +298,7 @@ class RecoverpasswordAction extends Action
         $user = $this->get_temp_user();
 
         if (!$user) {
-            $this->client_error(_('Unexpected password reset.'));
+            $this->clientError(_('Unexpected password reset.'));
             return;
         }
 
@@ -322,14 +322,14 @@ class RecoverpasswordAction extends Action
 
         if (!$user->update($original)) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Can\'t save new password.'));
+            $this->serverError(_('Can\'t save new password.'));
             return;
         }
 
         $this->clear_temp_user();
 
         if (!common_set_user($user->nickname)) {
-            common_server_error(_('Error setting user.'));
+            $this->serverError(_('Error setting user.'));
             return;
         }
 
diff --git a/actions/register.php b/actions/register.php
index bac179687..b4d0d43fb 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -26,9 +26,9 @@ class RegisterAction extends Action
         parent::handle($args);
 
         if (common_config('site', 'closed')) {
-            common_user_error(_('Registration not allowed.'));
+            $this->clientError(_('Registration not allowed.'));
         } else if (common_logged_in()) {
-            common_user_error(_('Already logged in.'));
+            $this->clientError(_('Already logged in.'));
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $this->try_register();
         } else {
@@ -65,7 +65,7 @@ class RegisterAction extends Action
         }
 
         if (common_config('site', 'inviteonly') && !($code && $invite)) {
-            $this->client_error(_('Sorry, only invited people can register.'));
+            $this->clientError(_('Sorry, only invited people can register.'));
             return;
         }
 
@@ -115,7 +115,7 @@ class RegisterAction extends Action
             }
             # success!
             if (!common_set_user($user)) {
-                common_server_error(_('Error setting user.'));
+                $this->serverError(_('Error setting user.'));
                 return;
             }
             # this is a real login
@@ -179,7 +179,7 @@ class RegisterAction extends Action
         }
 
         if (common_config('site', 'inviteonly') && !($code && $invite)) {
-            $this->client_error(_('Sorry, only invited people can register.'));
+            $this->clientError(_('Sorry, only invited people can register.'));
             return;
         }
 
diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php
index b9e29d645..32e9bf3d3 100644
--- a/actions/remotesubscribe.php
+++ b/actions/remotesubscribe.php
@@ -30,7 +30,7 @@ class RemotesubscribeAction extends Action
         parent::handle($args);
 
         if (common_logged_in()) {
-            common_user_error(_('You can use the local subscription!'));
+            $this->clientError(_('You can use the local subscription!'));
             return;
         }
 
@@ -342,7 +342,7 @@ class RemotesubscribeAction extends Action
         $profile = $user->getProfile();
         if (!$profile) {
             common_log_db_error($user, 'SELECT', __FILE__);
-            $this->server_error(_('User without matching profile'));
+            $this->serverError(_('User without matching profile'));
             return;
         }
 
diff --git a/actions/replies.php b/actions/replies.php
index 878550888..84fd894ff 100644
--- a/actions/replies.php
+++ b/actions/replies.php
@@ -40,7 +40,7 @@ class RepliesAction extends StreamAction
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -57,7 +57,7 @@ class RepliesAction extends StreamAction
 
     function no_such_user()
     {
-        common_user_error(_('No such user.'));
+        $this->clientError(_('No such user.'));
     }
 
     function show_header($user)
diff --git a/actions/repliesrss.php b/actions/repliesrss.php
index 5f85f8d2e..43be133a4 100644
--- a/actions/repliesrss.php
+++ b/actions/repliesrss.php
@@ -34,7 +34,7 @@ class RepliesrssAction extends Rss10Action
         $this->user = User::staticGet('nickname', $nickname);
 
         if (!$this->user) {
-            common_user_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return false;
         } else {
             return true;
diff --git a/actions/requesttoken.php b/actions/requesttoken.php
index a74548739..378db4403 100644
--- a/actions/requesttoken.php
+++ b/actions/requesttoken.php
@@ -39,7 +39,7 @@ class RequesttokenAction extends Action
             $token = $server->fetch_request_token($req);
             print $token;
         } catch (OAuthException $e) {
-            common_server_error($e->getMessage());
+            $this->serverError($e->getMessage());
         }
     }
 }
diff --git a/actions/showfavorites.php b/actions/showfavorites.php
index 1dec3ba5b..caa823893 100644
--- a/actions/showfavorites.php
+++ b/actions/showfavorites.php
@@ -33,14 +33,14 @@ class ShowfavoritesAction extends StreamAction
         $user = User::staticGet('nickname', $nickname);
 
         if (!$user) {
-            $this->client_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return;
         }
 
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -90,7 +90,7 @@ class ShowfavoritesAction extends StreamAction
         $notice = $user->favoriteNotices(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
 
         if (!$notice) {
-            $this->server_error(_('Could not retrieve favorite notices.'));
+            $this->serverError(_('Could not retrieve favorite notices.'));
             return;
         }
 
diff --git a/actions/showmessage.php b/actions/showmessage.php
index 25330a568..d13e9f671 100644
--- a/actions/showmessage.php
+++ b/actions/showmessage.php
@@ -32,7 +32,7 @@ class ShowmessageAction extends MailboxAction
         $message = $this->get_message();
 
         if (!$message) {
-            $this->client_error(_('No such message.'), 404);
+            $this->clientError(_('No such message.'), 404);
             return;
         }
         
@@ -41,7 +41,7 @@ class ShowmessageAction extends MailboxAction
         if ($cur && ($cur->id == $message->from_profile || $cur->id == $message->to_profile)) {
             $this->show_page($cur, 1);
         } else {
-            $this->client_error(_('Only the sender and recipient may read this message.'), 403);
+            $this->clientError(_('Only the sender and recipient may read this message.'), 403);
             return;
         }
     }
diff --git a/actions/shownotice.php b/actions/shownotice.php
index c519af0ba..82d4bd270 100644
--- a/actions/shownotice.php
+++ b/actions/shownotice.php
@@ -37,14 +37,14 @@ class ShownoticeAction extends StreamAction
         $this->notice = Notice::staticGet($id);
 
         if (!$this->notice) {
-            $this->client_error(_('No such notice.'), 404);
+            $this->clientError(_('No such notice.'), 404);
             return false;
         }
 
         $this->profile = $this->notice->getProfile();
 
         if (!$this->profile) {
-            $this->server_error(_('Notice has no profile'), 500);
+            $this->serverError(_('Notice has no profile'), 500);
             return false;
         }
 
@@ -119,6 +119,6 @@ class ShownoticeAction extends StreamAction
 
     function no_such_notice()
     {
-        common_user_error(_('No such notice.'));
+        $this->clientError(_('No such notice.'));
     }
 }
diff --git a/actions/showstream.php b/actions/showstream.php
index 9a59f7ae4..ed38c67f9 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -56,7 +56,7 @@ class ShowstreamAction extends StreamAction
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -159,7 +159,7 @@ class ShowstreamAction extends StreamAction
 
     function no_such_user()
     {
-        $this->client_error(_('No such user.'), 404);
+        $this->clientError(_('No such user.'), 404);
     }
 
     function show_profile($profile)
diff --git a/actions/smssettings.php b/actions/smssettings.php
index 1be45d1ce..c5879e4d9 100644
--- a/actions/smssettings.php
+++ b/actions/smssettings.php
@@ -168,7 +168,7 @@ class SmssettingsAction extends EmailsettingsAction
 
         if ($result === false) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
 
@@ -218,7 +218,7 @@ class SmssettingsAction extends EmailsettingsAction
 
         if ($result === false) {
             common_log_db_error($confirm, 'INSERT', __FILE__);
-            common_server_error(_('Couldn\'t insert confirmation code.'));
+            $this->serverError(_('Couldn\'t insert confirmation code.'));
             return;
         }
 
@@ -254,7 +254,7 @@ class SmssettingsAction extends EmailsettingsAction
 
         if (!$result) {
             common_log_db_error($confirm, 'DELETE', __FILE__);
-            $this->server_error(_('Couldn\'t delete email confirmation.'));
+            $this->serverError(_('Couldn\'t delete email confirmation.'));
             return;
         }
 
@@ -283,7 +283,7 @@ class SmssettingsAction extends EmailsettingsAction
         $result = $user->updateKeys($original);
         if (!$result) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
         $user->query('COMMIT');
diff --git a/actions/subedit.php b/actions/subedit.php
index 1142b7a03..e22384869 100644
--- a/actions/subedit.php
+++ b/actions/subedit.php
@@ -30,28 +30,28 @@ class SubeditAction extends Action
         parent::prepare($args);
 
         if (!common_logged_in()) {
-            $this->client_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return false;
         }
 
         $token = $this->trimmed('token');
 
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
         $id = $this->trimmed('profile');
 
         if (!$id) {
-            $this->client_error(_('No profile specified.'));
+            $this->clientError(_('No profile specified.'));
             return false;
         }
 
         $this->profile = Profile::staticGet('id', $id);
 
         if (!$this->profile) {
-            $this->client_error(_('No profile with that ID.'));
+            $this->clientError(_('No profile with that ID.'));
             return false;
         }
 
@@ -68,7 +68,7 @@ class SubeditAction extends Action
                                                'subscribed' => $this->profile->id));
 
             if (!$sub) {
-                $this->client_error(_('You are not subscribed to that profile.'));
+                $this->clientError(_('You are not subscribed to that profile.'));
                 return false;
             }
 
@@ -81,7 +81,7 @@ class SubeditAction extends Action
 
             if (!$result) {
                 common_log_db_error($sub, 'UPDATE', __FILE__);
-                $this->server_error(_('Could not save subscription.'));
+                $this->serverError(_('Could not save subscription.'));
                 return false;
             }
 
diff --git a/actions/subscribe.php b/actions/subscribe.php
index 99f9acc24..b6f03f0f1 100644
--- a/actions/subscribe.php
+++ b/actions/subscribe.php
@@ -27,7 +27,7 @@ class SubscribeAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return;
         }
 
@@ -43,7 +43,7 @@ class SubscribeAction extends Action
         $token = $this->trimmed('token');
 
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
@@ -52,14 +52,14 @@ class SubscribeAction extends Action
         $other = User::staticGet('id', $other_id);
 
         if (!$other) {
-            $this->client_error(_('Not a local user.'));
+            $this->clientError(_('Not a local user.'));
             return;
         }
 
         $result = subs_subscribe_to($user, $other);
 
         if($result != true) {
-            common_user_error($result);
+            $this->clientError($result);
             return;
         }
 
diff --git a/actions/tagother.php b/actions/tagother.php
index f0105ec8b..e11e3a00d 100644
--- a/actions/tagother.php
+++ b/actions/tagother.php
@@ -30,7 +30,7 @@ class TagotherAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            $this->client_error(_('Not logged in'), 403);
+            $this->clientError(_('Not logged in'), 403);
             return;
         }
 
@@ -39,12 +39,12 @@ class TagotherAction extends Action
         } else {
             $id = $this->trimmed('id');
             if (!$id) {
-                $this->client_error(_('No id argument.'));
+                $this->clientError(_('No id argument.'));
                 return;
             }
             $profile = Profile::staticGet('id', $id);
             if (!$profile) {
-                $this->client_error(_('No profile with that ID.'));
+                $this->clientError(_('No profile with that ID.'));
                 return;
             }
             $this->show_form($profile);
@@ -121,7 +121,7 @@ class TagotherAction extends Action
         $profile = Profile::staticGet('id', $id);
 
         if (!$profile) {
-            $this->client_error(_('No such profile.'));
+            $this->clientError(_('No such profile.'));
             return;
         }
 
@@ -147,14 +147,14 @@ class TagotherAction extends Action
             !Subscription::pkeyGet(array('subscriber' => $profile->id,
                                          'subscribed' => $user->id)))
         {
-            $this->client_error(_('You can only tag people you are subscribed to or who are subscribed to you.'));
+            $this->clientError(_('You can only tag people you are subscribed to or who are subscribed to you.'));
             return;
         }
 
         $result = Profile_tag::setTags($user->id, $profile->id, $tags);
 
         if (!$result) {
-            $this->client_error(_('Could not save tags.'));
+            $this->clientError(_('Could not save tags.'));
             return;
         }
 
diff --git a/actions/tagrss.php b/actions/tagrss.php
index 912d71413..b0227ab39 100644
--- a/actions/tagrss.php
+++ b/actions/tagrss.php
@@ -32,7 +32,7 @@ class TagrssAction extends Rss10Action
         $this->tag = Notice_tag::staticGet('tag', $tag);
 
         if (!$this->tag) {
-            common_user_error(_('No such tag.'));
+            $this->clientError(_('No such tag.'));
             return false;
         } else {
             return true;
diff --git a/actions/twitapiaccount.php b/actions/twitapiaccount.php
index 79e1ed990..e51a29a2d 100644
--- a/actions/twitapiaccount.php
+++ b/actions/twitapiaccount.php
@@ -29,7 +29,7 @@ class TwitapiaccountAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
@@ -39,7 +39,7 @@ class TwitapiaccountAction extends TwitterapiAction
     function end_session($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     function update_location($args, $apidata)
@@ -47,7 +47,7 @@ class TwitapiaccountAction extends TwitterapiAction
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-            $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -56,7 +56,7 @@ class TwitapiaccountAction extends TwitterapiAction
         if (!is_null($location) && strlen($location) > 255) {
 
             // XXX: But Twitter just truncates and runs with it. -- Zach
-            $this->client_error(_('That\'s too long. Max notice size is 255 chars.'), 406, $apidate['content-type']);
+            $this->clientError(_('That\'s too long. Max notice size is 255 chars.'), 406, $apidate['content-type']);
             return;
         }
 
@@ -64,7 +64,7 @@ class TwitapiaccountAction extends TwitterapiAction
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -75,7 +75,7 @@ class TwitapiaccountAction extends TwitterapiAction
 
         if (!$result) {
             common_log_db_error($profile, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t save profile.'));
+            $this->serverError(_('Couldn\'t save profile.'));
             return;
         }
 
@@ -91,12 +91,12 @@ class TwitapiaccountAction extends TwitterapiAction
     function update_delivery_device($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     function rate_limit_status($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 }
\ No newline at end of file
diff --git a/actions/twitapiblocks.php b/actions/twitapiblocks.php
index 5d64f2f7d..8135adef3 100644
--- a/actions/twitapiblocks.php
+++ b/actions/twitapiblocks.php
@@ -32,7 +32,7 @@ class TwitapiblocksAction extends TwitterapiAction
         $blockee = $this->get_user($apidata['api_arg'], $apidata);
 
         if (!$blockee) {
-            $this->client_error('Not Found', 404, $apidata['content-type']);
+            $this->clientError('Not Found', 404, $apidata['content-type']);
             return;
         }
 
@@ -44,7 +44,7 @@ class TwitapiblocksAction extends TwitterapiAction
             $this->show_profile($blockee, $type);
             $this->end_document($type);
         } else {
-            common_server_error(_('Block user failed.'));
+            $this->serverError(_('Block user failed.'));
         }
     }
 
@@ -54,7 +54,7 @@ class TwitapiblocksAction extends TwitterapiAction
         $blockee = $this->get_user($apidata['api_arg'], $apidata);
 
         if (!$blockee) {
-            $this->client_error('Not Found', 404, $apidata['content-type']);
+            $this->clientError('Not Found', 404, $apidata['content-type']);
             return;
         }
 
@@ -66,7 +66,7 @@ class TwitapiblocksAction extends TwitterapiAction
             $this->show_profile($blockee, $type);
             $this->end_document($type);
         } else {
-            common_server_error(_('Unblock user failed.'));
+            $this->serverError(_('Unblock user failed.'));
         }
     }
 }
\ No newline at end of file
diff --git a/actions/twitapidirect_messages.php b/actions/twitapidirect_messages.php
index 36d2a7e09..db55e8cd0 100644
--- a/actions/twitapidirect_messages.php
+++ b/actions/twitapidirect_messages.php
@@ -108,7 +108,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
             $this->show_json_dmsgs($message);
             break;
          default:
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
         }
 
     }
@@ -119,7 +119,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-            $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -134,11 +134,11 @@ class Twitapidirect_messagesAction extends TwitterapiAction
         $content = $this->trimmed('text');
 
         if (!$content) {
-            $this->client_error(_('No message text!'), $code = 406, $apidata['content-type']);
+            $this->clientError(_('No message text!'), $code = 406, $apidata['content-type']);
         } else {
             $content_shortened = common_shorten_links($content);
             if (mb_strlen($content_shortened) > 140) {
-                $this->client_error(_('That\'s too long. Max message size is 140 chars.'),
+                $this->clientError(_('That\'s too long. Max message size is 140 chars.'),
                     $code = 406, $apidata['content-type']);
                 return;
             }
@@ -147,15 +147,15 @@ class Twitapidirect_messagesAction extends TwitterapiAction
         $other = $this->get_user($this->trimmed('user'));
 
         if (!$other) {
-            $this->client_error(_('Recipient user not found.'), $code = 403, $apidata['content-type']);
+            $this->clientError(_('Recipient user not found.'), $code = 403, $apidata['content-type']);
             return;
         } else if (!$user->mutuallySubscribed($other)) {
-            $this->client_error(_('Can\'t send direct messages to users who aren\'t your friend.'),
+            $this->clientError(_('Can\'t send direct messages to users who aren\'t your friend.'),
                 $code = 403, $apidata['content-type']);
             return;
         } else if ($user->id == $other->id) {
             // Sending msgs to yourself is allowed by Twitter
-            $this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'),
+            $this->clientError(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'),
                 $code = 403, $apidata['content-type']);
             return;
         }
@@ -164,7 +164,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
             html_entity_decode($content, ENT_NOQUOTES, 'UTF-8'), $source);
 
         if (is_string($message)) {
-            $this->server_error($message);
+            $this->serverError($message);
             return;
         }
 
@@ -181,7 +181,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
     function destroy($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     function show_xml_dmsgs($message)
diff --git a/actions/twitapifavorites.php b/actions/twitapifavorites.php
index 55e04732f..737b7229f 100644
--- a/actions/twitapifavorites.php
+++ b/actions/twitapifavorites.php
@@ -32,14 +32,14 @@ class TwitapifavoritesAction extends TwitterapiAction
         $user = $this->get_user($apidata['api_arg'], $apidata);
 
         if (!$user) {
-            $this->client_error('Not Found', 404, $apidata['content-type']);
+            $this->clientError('Not Found', 404, $apidata['content-type']);
             return;
         }
 
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -56,7 +56,7 @@ class TwitapifavoritesAction extends TwitterapiAction
         $notice = $user->favoriteNotices((($page-1)*20), $count);
 
         if (!$notice) {
-            common_server_error(_('Could not retrieve favorite notices.'));
+            $this->serverError(_('Could not retrieve favorite notices.'));
             return;
         }
 
@@ -82,7 +82,7 @@ class TwitapifavoritesAction extends TwitterapiAction
             $this->show_json_timeline($notice);
             break;
          default:
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
         }
 
     }
@@ -94,12 +94,12 @@ class TwitapifavoritesAction extends TwitterapiAction
         // Check for RESTfulness
         if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
             // XXX: Twitter just prints the err msg, no XML / JSON.
-            $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
             return;
         }
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
@@ -109,20 +109,20 @@ class TwitapifavoritesAction extends TwitterapiAction
         $notice = Notice::staticGet($notice_id);
 
         if (!$notice) {
-            $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
+            $this->clientError(_('No status found with that ID.'), 404, $apidata['content-type']);
             return;
         }
 
         // XXX: Twitter lets you fave things repeatedly via api.
         if ($user->hasFave($notice)) {
-            $this->client_error(_('This notice is already a favorite!'), 403, $apidata['content-type']);
+            $this->clientError(_('This notice is already a favorite!'), 403, $apidata['content-type']);
             return;
         }
 
         $fave = Fave::addNew($user, $notice);
 
         if (!$fave) {
-            common_server_error(_('Could not create favorite.'));
+            $this->serverError(_('Could not create favorite.'));
             return;
         }
 
@@ -140,7 +140,7 @@ class TwitapifavoritesAction extends TwitterapiAction
     function destroy($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     // XXX: these two funcs swiped from faves.  Maybe put in util.php, or some common base class?
diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php
index 458ff48a5..c50c5e84a 100644
--- a/actions/twitapifriendships.php
+++ b/actions/twitapifriendships.php
@@ -29,7 +29,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-            $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -38,7 +38,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
         $other = $this->get_user($id);
 
         if (!$other) {
-            $this->client_error(_('Could not follow user: User not found.'), 403, $apidata['content-type']);
+            $this->clientError(_('Could not follow user: User not found.'), 403, $apidata['content-type']);
             return;
         }
 
@@ -46,7 +46,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
 
         if ($user->isSubscribed($other)) {
             $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
-            $this->client_error($errmsg, 403, $apidata['content-type']);
+            $this->clientError($errmsg, 403, $apidata['content-type']);
             return;
         }
 
@@ -62,7 +62,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
 
         if (!$result) {
             $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
-            $this->client_error($errmsg, 400, $apidata['content-type']);
+            $this->clientError($errmsg, 400, $apidata['content-type']);
             return;
         }
 
@@ -82,7 +82,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
-            $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -102,7 +102,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
             $sub->delete();
             $sub->query('COMMIT');
         } else {
-            $this->client_error(_('You are not friends with the specified user.'), 403, $apidata['content-type']);
+            $this->clientError(_('You are not friends with the specified user.'), 403, $apidata['content-type']);
             return;
         }
 
@@ -118,7 +118,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
@@ -129,7 +129,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
         $user_b = $this->get_user($user_b_id);
 
         if (!$user_a || !$user_b) {
-            $this->client_error(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']);
+            $this->clientError(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']);
             return;
         }
 
diff --git a/actions/twitapihelp.php b/actions/twitapihelp.php
index 531c6e9d3..db5892baf 100644
--- a/actions/twitapihelp.php
+++ b/actions/twitapihelp.php
@@ -41,7 +41,7 @@ class TwitapihelpAction extends TwitterapiAction
             print '"ok"';
             $this->end_document('json');
         } else {
-            common_user_error(_('API method not found!'), $code=404);
+            $this->clientError(_('API method not found!'), $code=404);
         }
 
     }
@@ -49,7 +49,7 @@ class TwitapihelpAction extends TwitterapiAction
     function downtime_schedule($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
 }
\ No newline at end of file
diff --git a/actions/twitapilaconica.php b/actions/twitapilaconica.php
index 34c8f88fc..8cd7a64b9 100644
--- a/actions/twitapilaconica.php
+++ b/actions/twitapilaconica.php
@@ -79,7 +79,7 @@ class TwitapilaconicaAction extends TwitterapiAction
             $this->end_document('json');
             break;
          default:
-            $this->client_error(_('API method not found!'), $code=404);
+            $this->clientError(_('API method not found!'), $code=404);
         }
     }
 
@@ -148,7 +148,7 @@ class TwitapilaconicaAction extends TwitterapiAction
             $this->end_document('json');
             break;
          default:
-            $this->client_error(_('API method not found!'), $code=404);
+            $this->clientError(_('API method not found!'), $code=404);
         }
     }
 
@@ -169,6 +169,6 @@ class TwitapilaconicaAction extends TwitterapiAction
     function wadl($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), 501);
+        $this->serverError(_('API method under construction.'), 501);
     }
 }
diff --git a/actions/twitapinotifications.php b/actions/twitapinotifications.php
index a19d652c3..411971af1 100644
--- a/actions/twitapinotifications.php
+++ b/actions/twitapinotifications.php
@@ -28,13 +28,13 @@ class TwitapinotificationsAction extends TwitterapiAction
     function follow($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     function leave($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
 }
\ No newline at end of file
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index 8d175ecab..a35f4b12e 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -76,12 +76,12 @@ class TwitapistatusesAction extends TwitterapiAction
                     $this->show_json_timeline($notice);
                     break;
                 default:
-                    common_user_error(_('API method not found!'), $code = 404);
+                    $this->clientError(_('API method not found!'), $code = 404);
                     break;
             }
 
         } else {
-            common_server_error(_('Couldn\'t find any statuses.'), $code = 503);
+            $this->serverError(_('Couldn\'t find any statuses.'), $code = 503);
         }
 
     }
@@ -144,7 +144,7 @@ class TwitapistatusesAction extends TwitterapiAction
             $this->show_json_timeline($notice);
             break;
          default:
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
         }
 
     }
@@ -157,14 +157,14 @@ class TwitapistatusesAction extends TwitterapiAction
         $user = $this->get_user($apidata['api_arg'], $apidata);
 
         if (!$user) {
-            $this->client_error('Not Found', 404, $apidata['content-type']);
+            $this->clientError('Not Found', 404, $apidata['content-type']);
             return;
         }
 
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -225,7 +225,7 @@ class TwitapistatusesAction extends TwitterapiAction
             $this->show_json_timeline($notice);
             break;
          default:
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
         }
 
     }
@@ -236,12 +236,12 @@ class TwitapistatusesAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-            $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -273,7 +273,7 @@ class TwitapistatusesAction extends TwitterapiAction
                 // as "truncated." Sending this error may screw up some clients
                 // that assume Twitter will truncate for them.    Should we just
                 // truncate too? -- Zach
-                $this->client_error(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']);
+                $this->clientError(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']);
                 return;
 
             }
@@ -306,7 +306,7 @@ class TwitapistatusesAction extends TwitterapiAction
                 if ($reply) {
                     $reply_to = $in_reply_to_status_id;
                 } else {
-                    $this->client_error(_('Not found'), $code = 404, $apidata['content-type']);
+                    $this->clientError(_('Not found'), $code = 404, $apidata['content-type']);
                     return;
                 }
             }
@@ -315,7 +315,7 @@ class TwitapistatusesAction extends TwitterapiAction
                 $source, 1, $reply_to);
 
             if (is_string($notice)) {
-                $this->server_error($notice);
+                $this->serverError($notice);
                 return;
             }
 
@@ -389,7 +389,7 @@ class TwitapistatusesAction extends TwitterapiAction
             $this->show_json_timeline($notices);
             break;
          default:
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
         }
 
     }
@@ -399,7 +399,7 @@ class TwitapistatusesAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
@@ -415,7 +415,7 @@ class TwitapistatusesAction extends TwitterapiAction
             }
         } else {
             // XXX: Twitter just sets a 404 header and doens't bother to return an err msg
-            $this->client_error(_('No status with that ID found.'), 404, $apidata['content-type']);
+            $this->clientError(_('No status with that ID found.'), 404, $apidata['content-type']);
         }
 
     }
@@ -426,14 +426,14 @@ class TwitapistatusesAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
         // Check for RESTfulness
         if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
             // XXX: Twitter just prints the err msg, no XML / JSON.
-            $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -443,7 +443,7 @@ class TwitapistatusesAction extends TwitterapiAction
         $notice = Notice::staticGet($notice_id);
 
         if (!$notice) {
-            $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
+            $this->clientError(_('No status found with that ID.'), 404, $apidata['content-type']);
             return;
         }
 
@@ -460,7 +460,7 @@ class TwitapistatusesAction extends TwitterapiAction
                 $this->show_single_json_status($notice);
             }
         } else {
-            $this->client_error(_('You may not delete another user\'s status.'), 403, $apidata['content-type']);
+            $this->clientError(_('You may not delete another user\'s status.'), 403, $apidata['content-type']);
         }
 
     }
@@ -487,7 +487,7 @@ class TwitapistatusesAction extends TwitterapiAction
         $user = $this->get_user($apidata['api_arg'], $apidata);
 
         if (!$user) {
-            $this->client_error('Not Found', 404, $apidata['content-type']);
+            $this->clientError('Not Found', 404, $apidata['content-type']);
             return;
         }
 
@@ -500,7 +500,7 @@ class TwitapistatusesAction extends TwitterapiAction
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -552,14 +552,14 @@ class TwitapistatusesAction extends TwitterapiAction
             print json_encode($arrays);
             break;
          default:
-            $this->client_error(_('unsupported file type'));
+            $this->clientError(_('unsupported file type'));
         }
     }
 
     function featured($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     function supported($cmd)
diff --git a/actions/twitapiusers.php b/actions/twitapiusers.php
index 409986985..ed2417561 100644
--- a/actions/twitapiusers.php
+++ b/actions/twitapiusers.php
@@ -29,7 +29,7 @@ class TwitapiusersAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
@@ -44,7 +44,7 @@ class TwitapiusersAction extends TwitterapiAction
 
         if (!$user) {
             // XXX: Twitter returns a random(?) user instead of throwing and err! -- Zach
-            $this->client_error(_('Not found.'), 404, $apidata['content-type']);
+            $this->clientError(_('Not found.'), 404, $apidata['content-type']);
             return;
         }
 
diff --git a/actions/twittersettings.php b/actions/twittersettings.php
index 663688037..9c879c965 100644
--- a/actions/twittersettings.php
+++ b/actions/twittersettings.php
@@ -285,7 +285,7 @@ class TwittersettingsAction extends SettingsAction
 
         if (!$result) {
             common_log_db_error($flink, 'DELETE', __FILE__);
-            common_server_error(_('Couldn\'t remove Twitter user.'));
+            $this->serverError(_('Couldn\'t remove Twitter user.'));
             return;
         }
 
diff --git a/actions/unblock.php b/actions/unblock.php
index 112304f71..59270f882 100644
--- a/actions/unblock.php
+++ b/actions/unblock.php
@@ -30,28 +30,28 @@ class UnblockAction extends Action
         parent::prepare($args);
 
         if (!common_logged_in()) {
-            $this->client_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return false;
         }
 
         $token = $this->trimmed('token');
 
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
         $id = $this->trimmed('unblockto');
 
         if (!$id) {
-            $this->client_error(_('No profile specified.'));
+            $this->clientError(_('No profile specified.'));
             return false;
         }
 
         $this->profile = Profile::staticGet('id', $id);
 
         if (!$this->profile) {
-            $this->client_error(_('No profile with that ID.'));
+            $this->clientError(_('No profile with that ID.'));
             return false;
         }
 
@@ -74,7 +74,7 @@ class UnblockAction extends Action
         $result = $cur->unblock($this->profile);
 
         if (!$result) {
-            $this->server_error(_('Error removing the block.'));
+            $this->serverError(_('Error removing the block.'));
             return;
         }
 
diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php
index 455c5e28e..32511a4b4 100644
--- a/actions/unsubscribe.php
+++ b/actions/unsubscribe.php
@@ -24,7 +24,7 @@ class UnsubscribeAction extends Action
     {
         parent::handle($args);
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return;
         }
 
@@ -40,28 +40,28 @@ class UnsubscribeAction extends Action
         $token = $this->trimmed('token');
 
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
         $other_id = $this->arg('unsubscribeto');
 
         if (!$other_id) {
-            $this->client_error(_('No profile id in request.'));
+            $this->clientError(_('No profile id in request.'));
             return;
         }
 
         $other = Profile::staticGet('id', $other_id);
 
         if (!$other_id) {
-            $this->client_error(_('No profile with that id.'));
+            $this->clientError(_('No profile with that id.'));
             return;
         }
 
         $result = subs_unsubscribe_to($user, $other);
 
         if ($result != true) {
-            common_user_error($result);
+            $this->clientError($result);
             return;
         }
 
diff --git a/actions/updateprofile.php b/actions/updateprofile.php
index abb034c81..c79112dac 100644
--- a/actions/updateprofile.php
+++ b/actions/updateprofile.php
@@ -37,7 +37,7 @@ class UpdateprofileAction extends Action
                 print "omb_version=".OMB_VERSION_01;
             }
         } catch (OAuthException $e) {
-            $this->server_error($e->getMessage());
+            $this->serverError($e->getMessage());
             return;
         }
     }
@@ -46,14 +46,14 @@ class UpdateprofileAction extends Action
     {
         $version = $req->get_parameter('omb_version');
         if ($version != OMB_VERSION_01) {
-            $this->client_error(_('Unsupported OMB version'), 400);
+            $this->clientError(_('Unsupported OMB version'), 400);
             return false;
         }
         # First, check to see if listenee exists
         $listenee =  $req->get_parameter('omb_listenee');
         $remote = Remote_profile::staticGet('uri', $listenee);
         if (!$remote) {
-            $this->client_error(_('Profile unknown'), 404);
+            $this->clientError(_('Profile unknown'), 404);
             return false;
         }
         # Second, check to see if they should be able to post updates!
@@ -64,72 +64,72 @@ class UpdateprofileAction extends Action
         $sub->subscribed = $remote->id;
         $sub->token = $token->key;
         if (!$sub->find(true)) {
-            $this->client_error(_('You did not send us that profile'), 403);
+            $this->clientError(_('You did not send us that profile'), 403);
             return false;
         }
 
         $profile = Profile::staticGet('id', $remote->id);
         if (!$profile) {
             # This one is our fault
-            $this->server_error(_('Remote profile with no matching profile'), 500);
+            $this->serverError(_('Remote profile with no matching profile'), 500);
             return false;
         }
         $nickname = $req->get_parameter('omb_listenee_nickname');
         if ($nickname && !Validate::string($nickname, array('min_length' => 1,
                                                             'max_length' => 64,
                                                             'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
-            $this->client_error(_('Nickname must have only lowercase letters and numbers and no spaces.'));
+            $this->clientError(_('Nickname must have only lowercase letters and numbers and no spaces.'));
             return false;
         }
         $license = $req->get_parameter('omb_listenee_license');
         if ($license && !common_valid_http_url($license)) {
-            $this->client_error(sprintf(_("Invalid license URL '%s'"), $license));
+            $this->clientError(sprintf(_("Invalid license URL '%s'"), $license));
             return false;
         }
         $profile_url = $req->get_parameter('omb_listenee_profile');
         if ($profile_url && !common_valid_http_url($profile_url)) {
-            $this->client_error(sprintf(_("Invalid profile URL '%s'."), $profile_url));
+            $this->clientError(sprintf(_("Invalid profile URL '%s'."), $profile_url));
             return false;
         }
         # optional stuff
         $fullname = $req->get_parameter('omb_listenee_fullname');
         if ($fullname && strlen($fullname) > 255) {
-            $this->client_error(_("Full name is too long (max 255 chars)."));
+            $this->clientError(_("Full name is too long (max 255 chars)."));
             return false;
         }
         $homepage = $req->get_parameter('omb_listenee_homepage');
         if ($homepage && (!common_valid_http_url($homepage) || strlen($homepage) > 255)) {
-            $this->client_error(sprintf(_("Invalid homepage '%s'"), $homepage));
+            $this->clientError(sprintf(_("Invalid homepage '%s'"), $homepage));
             return false;
         }
         $bio = $req->get_parameter('omb_listenee_bio');
         if ($bio && strlen($bio) > 140) {
-            $this->client_error(_("Bio is too long (max 140 chars)."));
+            $this->clientError(_("Bio is too long (max 140 chars)."));
             return false;
         }
         $location = $req->get_parameter('omb_listenee_location');
         if ($location && strlen($location) > 255) {
-            $this->client_error(_("Location is too long (max 255 chars)."));
+            $this->clientError(_("Location is too long (max 255 chars)."));
             return false;
         }
         $avatar = $req->get_parameter('omb_listenee_avatar');
         if ($avatar) {
             if (!common_valid_http_url($avatar) || strlen($avatar) > 255) {
-                $this->client_error(sprintf(_("Invalid avatar URL '%s'"), $avatar));
+                $this->clientError(sprintf(_("Invalid avatar URL '%s'"), $avatar));
                 return false;
             }
             $size = @getimagesize($avatar);
             if (!$size) {
-                $this->client_error(sprintf(_("Can't read avatar URL '%s'"), $avatar));
+                $this->clientError(sprintf(_("Can't read avatar URL '%s'"), $avatar));
                 return false;
             }
             if ($size[0] != AVATAR_PROFILE_SIZE || $size[1] != AVATAR_PROFILE_SIZE) {
-                $this->client_error(sprintf(_("Wrong size image at '%s'"), $avatar));
+                $this->clientError(sprintf(_("Wrong size image at '%s'"), $avatar));
                 return false;
             }
             if (!in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG,
                                           IMAGETYPE_PNG))) {
-                $this->client_error(sprintf(_("Wrong image type for '%s'"), $avatar));
+                $this->clientError(sprintf(_("Wrong image type for '%s'"), $avatar));
                 return false;
             }
         }
@@ -156,14 +156,14 @@ class UpdateprofileAction extends Action
         }
 
         if (!$profile->update($orig_profile)) {
-            $this->server_error(_('Could not save new profile info'), 500);
+            $this->serverError(_('Could not save new profile info'), 500);
             return false;
         } else {
             if ($avatar) {
                 $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
                 copy($avatar, $temp_filename);
                 if (!$profile->setOriginal($temp_filename)) {
-                    $this->server_error(_('Could not save avatar info'), 500);
+                    $this->serverError(_('Could not save avatar info'), 500);
                     return false;
                 }
             }
diff --git a/actions/userauthorization.php b/actions/userauthorization.php
index 196fae9ad..838458932 100644
--- a/actions/userauthorization.php
+++ b/actions/userauthorization.php
@@ -54,7 +54,7 @@ class UserauthorizationAction extends Action
                 common_debug('getting new request', __FILE__);
                 $req = $this->get_new_request();
                 if (!$req) {
-                    $this->client_error(_('No request found!'));
+                    $this->clientError(_('No request found!'));
                 }
                 common_debug('validating request', __FILE__);
                 # XXX: only validate new requests, since nonce is one-time use
@@ -64,7 +64,7 @@ class UserauthorizationAction extends Action
                 $this->show_form($req);
             } catch (OAuthException $e) {
                 $this->clear_request();
-                $this->client_error($e->getMessage());
+                $this->clientError($e->getMessage());
                 return;
             }
 
@@ -137,7 +137,7 @@ class UserauthorizationAction extends Action
         $req = $this->get_stored_request();
 
         if (!$req) {
-            common_user_error(_('No authorization request!'));
+            $this->clientError(_('No authorization request!'));
             return;
         }
 
@@ -145,10 +145,10 @@ class UserauthorizationAction extends Action
 
         if ($this->arg('accept')) {
             if (!$this->authorize_token($req)) {
-                $this->client_error(_('Error authorizing token'));
+                $this->clientError(_('Error authorizing token'));
             }
             if (!$this->save_remote_profile($req)) {
-                $this->client_error(_('Error saving remote profile'));
+                $this->clientError(_('Error saving remote profile'));
             }
             if (!$callback) {
                 $this->show_accept_message($req->get_parameter('oauth_token'));
@@ -160,7 +160,7 @@ class UserauthorizationAction extends Action
                 $profile = $user->getProfile();
                 if (!$profile) {
                     common_log_db_error($user, 'SELECT', __FILE__);
-                    $this->server_error(_('User without matching profile'));
+                    $this->serverError(_('User without matching profile'));
                     return;
                 }
                 $params['omb_listener_nickname'] = $user->nickname;
diff --git a/actions/userbyid.php b/actions/userbyid.php
index d57ed21a5..3ff2c9c41 100644
--- a/actions/userbyid.php
+++ b/actions/userbyid.php
@@ -32,11 +32,11 @@ class UserbyidAction extends Action
         parent::handle($args);
         $id = $this->trimmed('id');
         if (!$id) {
-            $this->client_error(_('No id.'));
+            $this->clientError(_('No id.'));
         }
         $user =& User::staticGet($id);
         if (!$user) {
-            $this->client_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
         }
 
         // support redirecting to FOAF rdf/xml if the agent prefers it
diff --git a/actions/userrss.php b/actions/userrss.php
index 1e9fe121f..d14fc523e 100644
--- a/actions/userrss.php
+++ b/actions/userrss.php
@@ -34,7 +34,7 @@ class UserrssAction extends Rss10Action
         $this->user = User::staticGet('nickname', $nickname);
 
         if (!$this->user) {
-            common_user_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return false;
         } else {
             return true;
@@ -78,7 +78,7 @@ class UserrssAction extends Rss10Action
         $profile = $user->getProfile();
         if (!$profile) {
             common_log_db_error($user, 'SELECT', __FILE__);
-            $this->server_error(_('User without matching profile'));
+            $this->serverError(_('User without matching profile'));
             return null;
         }
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
diff --git a/actions/xrds.php b/actions/xrds.php
index 9c51f1dd2..7cb2cd210 100644
--- a/actions/xrds.php
+++ b/actions/xrds.php
@@ -35,7 +35,7 @@ class XrdsAction extends Action
         $nickname = $this->trimmed('nickname');
         $user = User::staticGet('nickname', $nickname);
         if (!$user) {
-            common_user_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return;
         }
         $this->show_xrds($user);
diff --git a/lib/action.php b/lib/action.php
index d02a1b709..207be3c82 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -529,14 +529,14 @@ class Action extends HTMLOutputter // lawsuit
         }
     }
 
-    function server_error($msg, $code=500)
+    function serverError($msg, $code=500)
     {
         $action = $this->trimmed('action');
         common_debug("Server error '$code' on '$action': $msg", __FILE__);
         common_server_error($msg, $code);
     }
 
-    function client_error($msg, $code=400)
+    function clientError($msg, $code=400)
     {
         $action = $this->trimmed('action');
         common_debug("User error '$code' on '$action': $msg", __FILE__);
-- 
cgit v1.2.3-54-g00ecf