GitHost.io will be shut down on June 1, 2019. At that point this instance will be unreachable and all data will be irrevocably deleted. More details at https://about.gitlab.com/gitlab-hosted/#githost-is-shutting-down-on-june-1st-2019

Commit 04ef1ba8 authored by Evan Prodromou's avatar Evan Prodromou

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
parent eb2f9c98
......@@ -67,4 +67,15 @@ Evan Prodromou <evan@prodromou.name>**20081223192129
keyword 'NULL' with its lowercase version. This is another PEAR code
standards change.
]
[change function headers to K&R style
Evan Prodromou <evan@prodromou.name>**20081223193323
Another huge change, for PEAR code standards compliance. Function
headers have to be in K&R style (opening brace on its own line),
instead of having the opening brace on the same line as the function
and parameters. So, a little perl magic found all the function
definitions and move the opening brace to the next line (properly
indented... usually).
]
\ No newline at end of file
......@@ -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__);
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -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'];
......
......@@ -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) {
......
......@@ -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();
......
......@@ -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());
......
......@@ -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()) {
......
......@@ -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' =>
......
......@@ -21,7 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
class DisfavorAction extends Action {
function handle($args) {
function handle($args)
{
parent::handle($args);
......
......@@ -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;
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -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();
......
......@@ -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');
......
......@@ -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();
......
......@@ -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) {
......
......@@ -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() {