From 04ef1ba8eee7a9e2a565d7b4b747ef607665d562 Mon Sep 17 00:00:00 2001 From: Evan Prodromou 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 --- 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 +++++--- 82 files changed, 816 insertions(+), 408 deletions(-) (limited to 'actions') 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, '\\1', $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, '\\1', 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); -- cgit v1.2.3-54-g00ecf