More PEAR coding standards global changes. Here, I've changed all
instances of TRUE to true and FALSE to false.

darcs-hash:20081223194428-84dde-cb1a1e6f679acd68e864545c4d4dd8752d6a6257.gz
This commit is contained in:
Evan Prodromou 2008-12-23 14:44:28 -05:00
parent 04ef1ba8ee
commit 7ad2f2a371
43 changed files with 383 additions and 3815 deletions

View File

@ -79,3 +79,10 @@ Evan Prodromou <evan@prodromou.name>**20081223193323
indented... usually). indented... usually).
] ]
[TRUE => true, FALSE => false
Evan Prodromou <evan@prodromou.name>**20081223194428
More PEAR coding standards global changes. Here, I've changed all
instances of TRUE to true and FALSE to false.
]

View File

@ -33,7 +33,7 @@ class AccesstokenAction extends Action {
$server = omb_oauth_server(); $server = omb_oauth_server();
common_debug('fetching the access token', __FILE__); common_debug('fetching the access token', __FILE__);
$token = $server->fetch_access_token($req); $token = $server->fetch_access_token($req);
common_debug('got this token: "'.print_r($token,TRUE).'"', __FILE__); common_debug('got this token: "'.print_r($token,true).'"', __FILE__);
common_debug('printing the access token', __FILE__); common_debug('printing the access token', __FILE__);
print $token; print $token;
} catch (OAuthException $e) { } catch (OAuthException $e) {

View File

@ -118,7 +118,7 @@ class EmailsettingsAction extends SettingsAction {
$confirm = new Confirm_address(); $confirm = new Confirm_address();
$confirm->user_id = $user->id; $confirm->user_id = $user->id;
$confirm->address_type = 'email'; $confirm->address_type = 'email';
if ($confirm->find(TRUE)) { if ($confirm->find(true)) {
return $confirm; return $confirm;
} else { } else {
return null; return null;
@ -179,7 +179,7 @@ class EmailsettingsAction extends SettingsAction {
$result = $user->update($original); $result = $user->update($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
common_server_error(_('Couldn\'t update user.')); common_server_error(_('Couldn\'t update user.'));
return; return;
@ -229,7 +229,7 @@ class EmailsettingsAction extends SettingsAction {
$result = $confirm->insert(); $result = $confirm->insert();
if ($result === FALSE) { if ($result === false) {
common_log_db_error($confirm, 'INSERT', __FILE__); common_log_db_error($confirm, 'INSERT', __FILE__);
common_server_error(_('Couldn\'t insert confirmation code.')); common_server_error(_('Couldn\'t insert confirmation code.'));
return; return;
@ -239,7 +239,7 @@ class EmailsettingsAction extends SettingsAction {
$msg = _('A confirmation code was sent to the email address you added. Check your inbox (and spam box!) for the code and instructions on how to use it.'); $msg = _('A confirmation code was sent to the email address you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
$this->show_form($msg, TRUE); $this->show_form($msg, true);
} }
function cancel_confirmation() function cancel_confirmation()
@ -263,7 +263,7 @@ class EmailsettingsAction extends SettingsAction {
return; return;
} }
$this->show_form(_('Confirmation cancelled.'), TRUE); $this->show_form(_('Confirmation cancelled.'), true);
} }
function remove_address() function remove_address()
@ -290,7 +290,7 @@ class EmailsettingsAction extends SettingsAction {
} }
$user->query('COMMIT'); $user->query('COMMIT');
$this->show_form(_('The address was removed.'), TRUE); $this->show_form(_('The address was removed.'), true);
} }
function remove_incoming() function remove_incoming()
@ -310,7 +310,7 @@ class EmailsettingsAction extends SettingsAction {
$this->server_error(_("Couldn't update user record.")); $this->server_error(_("Couldn't update user record."));
} }
$this->show_form(_('Incoming email address removed.'), TRUE); $this->show_form(_('Incoming email address removed.'), true);
} }
function new_incoming() function new_incoming()
@ -325,7 +325,7 @@ class EmailsettingsAction extends SettingsAction {
$this->server_error(_("Couldn't update user record.")); $this->server_error(_("Couldn't update user record."));
} }
$this->show_form(_('New incoming email address added.'), TRUE); $this->show_form(_('New incoming email address added.'), true);
} }
function email_exists($email) function email_exists($email)

View File

@ -278,7 +278,7 @@ class FinishremotesubscribeAction extends Action {
$req->to_postdata(), $req->to_postdata(),
array('User-Agent' => 'Laconica/' . LACONICA_VERSION)); array('User-Agent' => 'Laconica/' . LACONICA_VERSION));
common_debug('got result: "'.print_r($result,TRUE).'"', __FILE__); common_debug('got result: "'.print_r($result,true).'"', __FILE__);
if ($result->status != 200) { if ($result->status != 200) {
return null; return null;

View File

@ -122,7 +122,7 @@ class FoafAction extends Action {
$other = User::staticGet('id', $sub->subscribed); $other = User::staticGet('id', $sub->subscribed);
} }
if (!$other) { if (!$other) {
common_debug('Got a bad subscription: '.print_r($sub,TRUE)); common_debug('Got a bad subscription: '.print_r($sub,true));
continue; continue;
} }
common_element('knows', array('rdf:resource' => $other->uri)); common_element('knows', array('rdf:resource' => $other->uri));
@ -144,7 +144,7 @@ class FoafAction extends Action {
$other = User::staticGet('id', $sub->subscriber); $other = User::staticGet('id', $sub->subscriber);
} }
if (!$other) { if (!$other) {
common_debug('Got a bad subscription: '.print_r($sub,TRUE)); common_debug('Got a bad subscription: '.print_r($sub,true));
continue; continue;
} }
if (array_key_exists($other->uri, $person)) { if (array_key_exists($other->uri, $person)) {

View File

@ -93,7 +93,7 @@ class ImsettingsAction extends SettingsAction {
$confirm = new Confirm_address(); $confirm = new Confirm_address();
$confirm->user_id = $user->id; $confirm->user_id = $user->id;
$confirm->address_type = 'jabber'; $confirm->address_type = 'jabber';
if ($confirm->find(TRUE)) { if ($confirm->find(true)) {
return $confirm; return $confirm;
} else { } else {
return null; return null;
@ -146,7 +146,7 @@ class ImsettingsAction extends SettingsAction {
$result = $user->update($original); $result = $user->update($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
common_server_error(_('Couldn\'t update user.')); common_server_error(_('Couldn\'t update user.'));
return; return;
@ -196,7 +196,7 @@ class ImsettingsAction extends SettingsAction {
$result = $confirm->insert(); $result = $confirm->insert();
if ($result === FALSE) { if ($result === false) {
common_log_db_error($confirm, 'INSERT', __FILE__); common_log_db_error($confirm, 'INSERT', __FILE__);
common_server_error(_('Couldn\'t insert confirmation code.')); common_server_error(_('Couldn\'t insert confirmation code.'));
return; return;
@ -210,7 +210,7 @@ class ImsettingsAction extends SettingsAction {
$msg = sprintf(_('A confirmation code was sent to the IM address you added. You must approve %s for sending messages to you.'), jabber_daemon_address()); $msg = sprintf(_('A confirmation code was sent to the IM address you added. You must approve %s for sending messages to you.'), jabber_daemon_address());
$this->show_form($msg, TRUE); $this->show_form($msg, true);
} }
function cancel_confirmation() function cancel_confirmation()
@ -234,7 +234,7 @@ class ImsettingsAction extends SettingsAction {
return; return;
} }
$this->show_form(_('Confirmation cancelled.'), TRUE); $this->show_form(_('Confirmation cancelled.'), true);
} }
function remove_address() function remove_address()
@ -263,7 +263,7 @@ class ImsettingsAction extends SettingsAction {
# XXX: unsubscribe to the old address # XXX: unsubscribe to the old address
$this->show_form(_('The address was removed.'), TRUE); $this->show_form(_('The address was removed.'), true);
} }
function jabber_exists($jabber) function jabber_exists($jabber)

View File

@ -53,7 +53,7 @@ class OthersettingsAction extends SettingsAction {
'metamark.net' => 'metamark.net' 'metamark.net' => 'metamark.net'
); );
common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), FALSE, $user->urlshorteningservice); common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), false, $user->urlshorteningservice);
common_submit('save', _('Save')); common_submit('save', _('Save'));
@ -174,7 +174,7 @@ class OthersettingsAction extends SettingsAction {
$result = $user->update($original); $result = $user->update($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
common_server_error(_('Couldn\'t update user.')); common_server_error(_('Couldn\'t update user.'));
return; return;

View File

@ -96,13 +96,13 @@ class ProfilesettingsAction extends SettingsAction {
_('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated')); _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
$language = common_language(); $language = common_language();
common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), TRUE, $language); common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), true, $language);
$timezone = common_timezone(); $timezone = common_timezone();
$timezones = array(); $timezones = array();
foreach(DateTimeZone::listIdentifiers() as $k => $v) { foreach(DateTimeZone::listIdentifiers() as $k => $v) {
$timezones[$v] = $v; $timezones[$v] = $v;
} }
common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), TRUE, $timezone); common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), true, $timezone);
common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'), common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'),
($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe); ($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe);
@ -278,7 +278,7 @@ class ProfilesettingsAction extends SettingsAction {
$result = $user->updateKeys($original); $result = $user->updateKeys($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
common_server_error(_('Couldn\'t update user.')); common_server_error(_('Couldn\'t update user.'));
return; return;
@ -298,7 +298,7 @@ class ProfilesettingsAction extends SettingsAction {
$result = $user->update($original); $result = $user->update($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
common_server_error(_('Couldn\'t update user for autosubscribe.')); common_server_error(_('Couldn\'t update user for autosubscribe.'));
return; return;
@ -340,7 +340,7 @@ class ProfilesettingsAction extends SettingsAction {
common_broadcast_profile($profile); common_broadcast_profile($profile);
$this->show_form(_('Settings saved.'), TRUE); $this->show_form(_('Settings saved.'), true);
} }
@ -434,7 +434,7 @@ class ProfilesettingsAction extends SettingsAction {
$user->password = common_munge_password($newpassword, $user->id); $user->password = common_munge_password($newpassword, $user->id);
$val = $user->validate(); $val = $user->validate();
if ($val !== TRUE) { if ($val !== true) {
$this->show_form(_('Error saving user; invalid.')); $this->show_form(_('Error saving user; invalid.'));
return; return;
} }

View File

@ -111,7 +111,7 @@ class SmssettingsAction extends EmailsettingsAction {
$confirm = new Confirm_address(); $confirm = new Confirm_address();
$confirm->user_id = $user->id; $confirm->user_id = $user->id;
$confirm->address_type = 'sms'; $confirm->address_type = 'sms';
if ($confirm->find(TRUE)) { if ($confirm->find(true)) {
return $confirm; return $confirm;
} else { } else {
return null; return null;
@ -165,7 +165,7 @@ class SmssettingsAction extends EmailsettingsAction {
$result = $user->update($original); $result = $user->update($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
common_server_error(_('Couldn\'t update user.')); common_server_error(_('Couldn\'t update user.'));
return; return;
@ -215,7 +215,7 @@ class SmssettingsAction extends EmailsettingsAction {
$result = $confirm->insert(); $result = $confirm->insert();
if ($result === FALSE) { if ($result === false) {
common_log_db_error($confirm, 'INSERT', __FILE__); common_log_db_error($confirm, 'INSERT', __FILE__);
common_server_error(_('Couldn\'t insert confirmation code.')); common_server_error(_('Couldn\'t insert confirmation code.'));
return; return;
@ -229,7 +229,7 @@ class SmssettingsAction extends EmailsettingsAction {
$msg = _('A confirmation code was sent to the phone number you added. Check your inbox (and spam box!) for the code and instructions on how to use it.'); $msg = _('A confirmation code was sent to the phone number you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
$this->show_form($msg, TRUE); $this->show_form($msg, true);
} }
function cancel_confirmation() function cancel_confirmation()
@ -257,7 +257,7 @@ class SmssettingsAction extends EmailsettingsAction {
return; return;
} }
$this->show_form(_('Confirmation cancelled.'), TRUE); $this->show_form(_('Confirmation cancelled.'), true);
} }
function remove_address() function remove_address()
@ -287,7 +287,7 @@ class SmssettingsAction extends EmailsettingsAction {
} }
$user->query('COMMIT'); $user->query('COMMIT');
$this->show_form(_('The address was removed.'), TRUE); $this->show_form(_('The address was removed.'), true);
} }
function sms_exists($sms) function sms_exists($sms)

View File

@ -96,7 +96,7 @@ class TwitapifriendshipsAction extends TwitterapiAction {
$sub->subscriber = $user->id; $sub->subscriber = $user->id;
$sub->subscribed = $other->id; $sub->subscribed = $other->id;
if ($sub->find(TRUE)) { if ($sub->find(true)) {
$sub->query('BEGIN'); $sub->query('BEGIN');
$sub->delete(); $sub->delete();
$sub->query('COMMIT'); $sub->query('COMMIT');

View File

@ -288,7 +288,7 @@ class TwittersettingsAction extends SettingsAction {
return; return;
} }
$this->show_form(_('Twitter account removed.'), TRUE); $this->show_form(_('Twitter account removed.'), true);
} }
function save_preferences() function save_preferences()
@ -325,7 +325,7 @@ class TwittersettingsAction extends SettingsAction {
$this->set_flags($flink, $noticesync, $replysync, $friendsync); $this->set_flags($flink, $noticesync, $replysync, $friendsync);
$result = $flink->update($original); $result = $flink->update($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($flink, 'UPDATE', __FILE__); common_log_db_error($flink, 'UPDATE', __FILE__);
$this->show_form(_('Couldn\'t save Twitter preferences.')); $this->show_form(_('Couldn\'t save Twitter preferences.'));
return; return;

View File

@ -211,7 +211,7 @@ class UserauthorizationAction extends Action {
$rt->tok = $token_field; $rt->tok = $token_field;
$rt->type = 0; $rt->type = 0;
$rt->state = 0; $rt->state = 0;
common_debug('request token to look up: "'.print_r($rt,TRUE).'"'); common_debug('request token to look up: "'.print_r($rt,true).'"');
if ($rt->find(true)) { if ($rt->find(true)) {
common_debug('found request token to authorize', __FILE__); common_debug('found request token to authorize', __FILE__);
$orig_rt = clone($rt); $orig_rt = clone($rt);
@ -221,7 +221,7 @@ class UserauthorizationAction extends Action {
return true; return true;
} }
} }
return FALSE; return false;
} }
# XXX: refactor with similar code in finishremotesubscribe.php # XXX: refactor with similar code in finishremotesubscribe.php
@ -277,25 +277,25 @@ class UserauthorizationAction extends Action {
$profile->created = DB_DataObject_Cast::dateTime(); # current time $profile->created = DB_DataObject_Cast::dateTime(); # current time
$id = $profile->insert(); $id = $profile->insert();
if (!$id) { if (!$id) {
return FALSE; return false;
} }
$remote->id = $id; $remote->id = $id;
} }
if ($exists) { if ($exists) {
if (!$remote->update($orig_remote)) { if (!$remote->update($orig_remote)) {
return FALSE; return false;
} }
} else { } else {
$remote->created = DB_DataObject_Cast::dateTime(); # current time $remote->created = DB_DataObject_Cast::dateTime(); # current time
if (!$remote->insert()) { if (!$remote->insert()) {
return FALSE; return false;
} }
} }
if ($avatar_url) { if ($avatar_url) {
if (!$this->add_avatar($profile, $avatar_url)) { if (!$this->add_avatar($profile, $avatar_url)) {
return FALSE; return false;
} }
} }
@ -311,10 +311,10 @@ class UserauthorizationAction extends Action {
$sub->created = DB_DataObject_Cast::dateTime(); # current time $sub->created = DB_DataObject_Cast::dateTime(); # current time
if (!$sub->insert()) { if (!$sub->insert()) {
return FALSE; return false;
} }
return TRUE; return true;
} }
function add_avatar($profile, $url) function add_avatar($profile, $url)
@ -440,7 +440,7 @@ class UserauthorizationAction extends Action {
$sub = new Subscription(); $sub = new Subscription();
$sub->subscriber = $user->id; $sub->subscriber = $user->id;
$sub->subscribed = $remote->id; $sub->subscribed = $remote->id;
if ($sub->find(TRUE)) { if ($sub->find(true)) {
throw new OAuthException("Already subscribed to user!"); throw new OAuthException("Already subscribed to user!");
} }
} }

View File

@ -35,7 +35,7 @@ class Foreign_link extends Memcached_DataObject
$flink->user_id = $user_id; $flink->user_id = $user_id;
$flink->limit(1); $flink->limit(1);
if ($flink->find(TRUE)) { if ($flink->find(true)) {
return $flink; return $flink;
} }
@ -48,7 +48,7 @@ class Foreign_link extends Memcached_DataObject
$flink->foreign_id = $foreign_id; $flink->foreign_id = $foreign_id;
$flink->limit(1); $flink->limit(1);
if ($flink->find(TRUE)) { if ($flink->find(true)) {
return $flink; return $flink;
} }
@ -64,7 +64,7 @@ class Foreign_link extends Memcached_DataObject
$fuser->limit(1); $fuser->limit(1);
if ($fuser->find(TRUE)) { if ($fuser->find(true)) {
return $fuser; return $fuser;
} }

View File

@ -321,19 +321,19 @@ class Notice extends Memcached_DataObject
static function getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since) { static function getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since) {
$needAnd = FALSE; $needAnd = false;
$needWhere = TRUE; $needWhere = true;
if (preg_match('/\bWHERE\b/i', $qry)) { if (preg_match('/\bWHERE\b/i', $qry)) {
$needWhere = FALSE; $needWhere = false;
$needAnd = TRUE; $needAnd = true;
} }
if ($since_id > 0) { if ($since_id > 0) {
if ($needWhere) { if ($needWhere) {
$qry .= ' WHERE '; $qry .= ' WHERE ';
$needWhere = FALSE; $needWhere = false;
} else { } else {
$qry .= ' AND '; $qry .= ' AND ';
} }
@ -345,7 +345,7 @@ class Notice extends Memcached_DataObject
if ($needWhere) { if ($needWhere) {
$qry .= ' WHERE '; $qry .= ' WHERE ';
$needWhere = FALSE; $needWhere = false;
} else { } else {
$qry .= ' AND '; $qry .= ' AND ';
} }
@ -357,7 +357,7 @@ class Notice extends Memcached_DataObject
if ($needWhere) { if ($needWhere) {
$qry .= ' WHERE '; $qry .= ' WHERE ';
$needWhere = FALSE; $needWhere = false;
} else { } else {
$qry .= ' AND '; $qry .= ' AND ';
} }
@ -411,7 +411,7 @@ class Notice extends Memcached_DataObject
# On a cache hit, return a DB-object-like wrapper # On a cache hit, return a DB-object-like wrapper
if ($notices !== FALSE) { if ($notices !== false) {
$wrapper = new NoticeWrapper(array_slice($notices, $offset, $limit)); $wrapper = new NoticeWrapper(array_slice($notices, $offset, $limit));
return $wrapper; return $wrapper;
} }

View File

@ -34,7 +34,7 @@ class Queue_item extends Memcached_DataObject
$qi->limit(1); $qi->limit(1);
$cnt = $qi->find(TRUE); $cnt = $qi->find(true);
if ($cnt) { if ($cnt) {
# XXX: potential race condition # XXX: potential race condition

View File

@ -199,7 +199,7 @@ class User extends Memcached_DataObject
if (!$id) { if (!$id) {
common_log_db_error($profile, 'INSERT', __FILE__); common_log_db_error($profile, 'INSERT', __FILE__);
return FALSE; return false;
} }
$user = new User(); $user = new User();
@ -233,7 +233,7 @@ class User extends Memcached_DataObject
if (!$result) { if (!$result) {
common_log_db_error($user, 'INSERT', __FILE__); common_log_db_error($user, 'INSERT', __FILE__);
return FALSE; return false;
} }
# Everyone is subscribed to themself # Everyone is subscribed to themself
@ -247,7 +247,7 @@ class User extends Memcached_DataObject
if (!$result) { if (!$result) {
common_log_db_error($subscription, 'INSERT', __FILE__); common_log_db_error($subscription, 'INSERT', __FILE__);
return FALSE; return false;
} }
if ($email && !$user->email) { if ($email && !$user->email) {
@ -261,7 +261,7 @@ class User extends Memcached_DataObject
$result = $confirm->insert(); $result = $confirm->insert();
if (!$result) { if (!$result) {
common_log_db_error($confirm, 'INSERT', __FILE__); common_log_db_error($confirm, 'INSERT', __FILE__);
return FALSE; return false;
} }
} }

View File

@ -59,13 +59,13 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
$n->consumer_key = $consumer->key; $n->consumer_key = $consumer->key;
$n->tok = $token->key; $n->tok = $token->key;
$n->nonce = $nonce; $n->nonce = $nonce;
if ($n->find(TRUE)) { if ($n->find(true)) {
return TRUE; return true;
} else { } else {
$n->timestamp = $timestamp; $n->timestamp = $timestamp;
$n->created = DB_DataObject_Cast::dateTime(); $n->created = DB_DataObject_Cast::dateTime();
$n->insert(); $n->insert();
return FALSE; return false;
} }
} }
@ -99,7 +99,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
$rt->consumer_key = $consumer->key; $rt->consumer_key = $consumer->key;
$rt->tok = $token->key; $rt->tok = $token->key;
$rt->type = 0; # request $rt->type = 0; # request
if ($rt->find(TRUE) && $rt->state == 1) { # authorized if ($rt->find(true) && $rt->state == 1) { # authorized
common_debug('request token found.', __FILE__); common_debug('request token found.', __FILE__);
$at = new Token(); $at = new Token();
$at->consumer_key = $consumer->key; $at->consumer_key = $consumer->key;

View File

@ -139,7 +139,7 @@ function omb_broadcast_remote_subscribers($notice)
common_log(LOG_DEBUG, 'Posting to ' . $rp->postnoticeurl); common_log(LOG_DEBUG, 'Posting to ' . $rp->postnoticeurl);
if (omb_post_notice_keys($notice, $rp->postnoticeurl, $rp->token, $rp->secret)) { if (omb_post_notice_keys($notice, $rp->postnoticeurl, $rp->token, $rp->secret)) {
common_log(LOG_DEBUG, 'Finished to ' . $rp->postnoticeurl); common_log(LOG_DEBUG, 'Finished to ' . $rp->postnoticeurl);
$posted[$rp->postnoticeurl] = TRUE; $posted[$rp->postnoticeurl] = true;
} else { } else {
common_log(LOG_DEBUG, 'Failed posting to ' . $rp->postnoticeurl); common_log(LOG_DEBUG, 'Failed posting to ' . $rp->postnoticeurl);
} }
@ -208,7 +208,7 @@ function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret)
$req->to_postdata(), $req->to_postdata(),
array('User-Agent' => 'Laconica/' . LACONICA_VERSION)); array('User-Agent' => 'Laconica/' . LACONICA_VERSION));
common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__); common_debug('Got HTTP result "'.print_r($result,true).'"', __FILE__);
if ($result->status == 403) { # not authorized, don't send again if ($result->status == 403) { # not authorized, don't send again
common_debug('403 result, deleting subscription', __FILE__); common_debug('403 result, deleting subscription', __FILE__);
@ -241,7 +241,7 @@ function omb_broadcast_profile($profile)
if ($rp) { if ($rp) {
if (!$updated[$rp->updateprofileurl]) { if (!$updated[$rp->updateprofileurl]) {
if (omb_update_profile($profile, $rp, $sub)) { if (omb_update_profile($profile, $rp, $sub)) {
$updated[$rp->updateprofileurl] = TRUE; $updated[$rp->updateprofileurl] = true;
} }
} }
} }
@ -293,7 +293,7 @@ function omb_update_profile($profile, $remote_profile, $subscription)
$req->to_postdata(), $req->to_postdata(),
array('User-Agent' => 'Laconica/' . LACONICA_VERSION)); array('User-Agent' => 'Laconica/' . LACONICA_VERSION));
common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__); common_debug('Got HTTP result "'.print_r($result,true).'"', __FILE__);
if ($result->status == 403) { # not authorized, don't send again if ($result->status == 403) { # not authorized, don't send again
common_debug('403 result, deleting subscription', __FILE__); common_debug('403 result, deleting subscription', __FILE__);

View File

@ -436,7 +436,7 @@ function common_checkbox($id, $label, $checked=false, $instructions=null, $value
common_element_end('p'); common_element_end('p');
} }
function common_dropdown($id, $label, $content, $instructions=null, $blank_select=FALSE, $selected=null) function common_dropdown($id, $label, $content, $instructions=null, $blank_select=false, $selected=null)
{ {
common_element_start('p'); common_element_start('p');
common_element('label', array('for' => $id), $label); common_element('label', array('for' => $id), $label);
@ -1018,7 +1018,7 @@ function common_relative_profile($sender, $nickname, $dt=null)
// XXX: use a join instead of a subquery // XXX: use a join instead of a subquery
$recipient->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = '.$sender->id.' and subscribed = id)', 'AND'); $recipient->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = '.$sender->id.' and subscribed = id)', 'AND');
$recipient->whereAdd('nickname = "' . trim($nickname) . '"', 'AND'); $recipient->whereAdd('nickname = "' . trim($nickname) . '"', 'AND');
if ($recipient->find(TRUE)) { if ($recipient->find(true)) {
// XXX: should probably differentiate between profiles with // XXX: should probably differentiate between profiles with
// the same name by date of most recent update // the same name by date of most recent update
return $recipient; return $recipient;
@ -1028,7 +1028,7 @@ function common_relative_profile($sender, $nickname, $dt=null)
// XXX: use a join instead of a subquery // XXX: use a join instead of a subquery
$recipient->whereAdd('EXISTS (SELECT subscriber from subscription where subscribed = '.$sender->id.' and subscriber = id)', 'AND'); $recipient->whereAdd('EXISTS (SELECT subscriber from subscription where subscribed = '.$sender->id.' and subscriber = id)', 'AND');
$recipient->whereAdd('nickname = "' . trim($nickname) . '"', 'AND'); $recipient->whereAdd('nickname = "' . trim($nickname) . '"', 'AND');
if ($recipient->find(TRUE)) { if ($recipient->find(true)) {
// XXX: should probably differentiate between profiles with // XXX: should probably differentiate between profiles with
// the same name by date of most recent update // the same name by date of most recent update
return $recipient; return $recipient;
@ -2258,7 +2258,7 @@ function common_message_form($content, $user, $to)
$mutual_users->free(); $mutual_users->free();
unset($mutual_users); unset($mutual_users);
common_dropdown('to', _('To'), $mutual, null, FALSE, $to->id); common_dropdown('to', _('To'), $mutual, null, false, $to->id);
common_element_start('p'); common_element_start('p');

View File

@ -331,7 +331,7 @@ function parse_args()
$output_url = $args[u]; $output_url = $args[u];
if (file_exists($output_dir)) { if (file_exists($output_dir)) {
if (is_writable($output_dir) === FALSE) { if (is_writable($output_dir) === false) {
error("$output_dir is not writable."); error("$output_dir is not writable.");
} }
} else { } else {
@ -366,11 +366,11 @@ function write_file($path, $data)
error('No data specified for writing.'); error('No data specified for writing.');
} }
if (($fh_out = fopen($path,'w')) === FALSE) { if (($fh_out = fopen($path,'w')) === false) {
error("couldn't open $path for writing."); error("couldn't open $path for writing.");
} }
if (fwrite($fh_out, $data) === FALSE) { if (fwrite($fh_out, $data) === false) {
error("couldn't write to $path."); error("couldn't write to $path.");
} }
} }

View File

@ -110,7 +110,7 @@ class XmppConfirmHandler extends XmppQueueHandler {
$confirm->address_type = 'jabber'; $confirm->address_type = 'jabber';
$confirm->orderBy('modified DESC'); $confirm->orderBy('modified DESC');
$confirm->limit(1); $confirm->limit(1);
if ($confirm->find(TRUE)) { if ($confirm->find(true)) {
$this->log(LOG_INFO, 'Claiming confirmation for ' . $confirm->address); $this->log(LOG_INFO, 'Claiming confirmation for ' . $confirm->address);
# working around some weird DB_DataObject behaviour # working around some weird DB_DataObject behaviour
$confirm->whereAdd(''); # clears where stuff $confirm->whereAdd(''); # clears where stuff

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@ class AccesstokenAction extends Action {
$server = omb_oauth_server(); $server = omb_oauth_server();
common_debug('fetching the access token', __FILE__); common_debug('fetching the access token', __FILE__);
$token = $server->fetch_access_token($req); $token = $server->fetch_access_token($req);
common_debug('got this token: "'.print_r($token,TRUE).'"', __FILE__); common_debug('got this token: "'.print_r($token,true).'"', __FILE__);
common_debug('printing the access token', __FILE__); common_debug('printing the access token', __FILE__);
print $token; print $token;
} catch (OAuthException $e) { } catch (OAuthException $e) {

View File

@ -118,7 +118,7 @@ class EmailsettingsAction extends SettingsAction {
$confirm = new Confirm_address(); $confirm = new Confirm_address();
$confirm->user_id = $user->id; $confirm->user_id = $user->id;
$confirm->address_type = 'email'; $confirm->address_type = 'email';
if ($confirm->find(TRUE)) { if ($confirm->find(true)) {
return $confirm; return $confirm;
} else { } else {
return null; return null;
@ -179,7 +179,7 @@ class EmailsettingsAction extends SettingsAction {
$result = $user->update($original); $result = $user->update($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
common_server_error(_('Couldn\'t update user.')); common_server_error(_('Couldn\'t update user.'));
return; return;
@ -229,7 +229,7 @@ class EmailsettingsAction extends SettingsAction {
$result = $confirm->insert(); $result = $confirm->insert();
if ($result === FALSE) { if ($result === false) {
common_log_db_error($confirm, 'INSERT', __FILE__); common_log_db_error($confirm, 'INSERT', __FILE__);
common_server_error(_('Couldn\'t insert confirmation code.')); common_server_error(_('Couldn\'t insert confirmation code.'));
return; return;
@ -239,7 +239,7 @@ class EmailsettingsAction extends SettingsAction {
$msg = _('A confirmation code was sent to the email address you added. Check your inbox (and spam box!) for the code and instructions on how to use it.'); $msg = _('A confirmation code was sent to the email address you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
$this->show_form($msg, TRUE); $this->show_form($msg, true);
} }
function cancel_confirmation() function cancel_confirmation()
@ -263,7 +263,7 @@ class EmailsettingsAction extends SettingsAction {
return; return;
} }
$this->show_form(_('Confirmation cancelled.'), TRUE); $this->show_form(_('Confirmation cancelled.'), true);
} }
function remove_address() function remove_address()
@ -290,7 +290,7 @@ class EmailsettingsAction extends SettingsAction {
} }
$user->query('COMMIT'); $user->query('COMMIT');
$this->show_form(_('The address was removed.'), TRUE); $this->show_form(_('The address was removed.'), true);
} }
function remove_incoming() function remove_incoming()
@ -310,7 +310,7 @@ class EmailsettingsAction extends SettingsAction {
$this->server_error(_("Couldn't update user record.")); $this->server_error(_("Couldn't update user record."));
} }
$this->show_form(_('Incoming email address removed.'), TRUE); $this->show_form(_('Incoming email address removed.'), true);
} }
function new_incoming() function new_incoming()
@ -325,7 +325,7 @@ class EmailsettingsAction extends SettingsAction {
$this->server_error(_("Couldn't update user record.")); $this->server_error(_("Couldn't update user record."));
} }
$this->show_form(_('New incoming email address added.'), TRUE); $this->show_form(_('New incoming email address added.'), true);
} }
function email_exists($email) function email_exists($email)

View File

@ -278,7 +278,7 @@ class FinishremotesubscribeAction extends Action {
$req->to_postdata(), $req->to_postdata(),
array('User-Agent' => 'Laconica/' . LACONICA_VERSION)); array('User-Agent' => 'Laconica/' . LACONICA_VERSION));
common_debug('got result: "'.print_r($result,TRUE).'"', __FILE__); common_debug('got result: "'.print_r($result,true).'"', __FILE__);
if ($result->status != 200) { if ($result->status != 200) {
return null; return null;

View File

@ -122,7 +122,7 @@ class FoafAction extends Action {
$other = User::staticGet('id', $sub->subscribed); $other = User::staticGet('id', $sub->subscribed);
} }
if (!$other) { if (!$other) {
common_debug('Got a bad subscription: '.print_r($sub,TRUE)); common_debug('Got a bad subscription: '.print_r($sub,true));
continue; continue;
} }
common_element('knows', array('rdf:resource' => $other->uri)); common_element('knows', array('rdf:resource' => $other->uri));
@ -144,7 +144,7 @@ class FoafAction extends Action {
$other = User::staticGet('id', $sub->subscriber); $other = User::staticGet('id', $sub->subscriber);
} }
if (!$other) { if (!$other) {
common_debug('Got a bad subscription: '.print_r($sub,TRUE)); common_debug('Got a bad subscription: '.print_r($sub,true));
continue; continue;
} }
if (array_key_exists($other->uri, $person)) { if (array_key_exists($other->uri, $person)) {

View File

@ -93,7 +93,7 @@ class ImsettingsAction extends SettingsAction {
$confirm = new Confirm_address(); $confirm = new Confirm_address();
$confirm->user_id = $user->id; $confirm->user_id = $user->id;
$confirm->address_type = 'jabber'; $confirm->address_type = 'jabber';
if ($confirm->find(TRUE)) { if ($confirm->find(true)) {
return $confirm; return $confirm;
} else { } else {
return null; return null;
@ -146,7 +146,7 @@ class ImsettingsAction extends SettingsAction {
$result = $user->update($original); $result = $user->update($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
common_server_error(_('Couldn\'t update user.')); common_server_error(_('Couldn\'t update user.'));
return; return;
@ -196,7 +196,7 @@ class ImsettingsAction extends SettingsAction {
$result = $confirm->insert(); $result = $confirm->insert();
if ($result === FALSE) { if ($result === false) {
common_log_db_error($confirm, 'INSERT', __FILE__); common_log_db_error($confirm, 'INSERT', __FILE__);
common_server_error(_('Couldn\'t insert confirmation code.')); common_server_error(_('Couldn\'t insert confirmation code.'));
return; return;
@ -210,7 +210,7 @@ class ImsettingsAction extends SettingsAction {
$msg = sprintf(_('A confirmation code was sent to the IM address you added. You must approve %s for sending messages to you.'), jabber_daemon_address()); $msg = sprintf(_('A confirmation code was sent to the IM address you added. You must approve %s for sending messages to you.'), jabber_daemon_address());
$this->show_form($msg, TRUE); $this->show_form($msg, true);
} }
function cancel_confirmation() function cancel_confirmation()
@ -234,7 +234,7 @@ class ImsettingsAction extends SettingsAction {
return; return;
} }
$this->show_form(_('Confirmation cancelled.'), TRUE); $this->show_form(_('Confirmation cancelled.'), true);
} }
function remove_address() function remove_address()
@ -263,7 +263,7 @@ class ImsettingsAction extends SettingsAction {
# XXX: unsubscribe to the old address # XXX: unsubscribe to the old address
$this->show_form(_('The address was removed.'), TRUE); $this->show_form(_('The address was removed.'), true);
} }
function jabber_exists($jabber) function jabber_exists($jabber)

View File

@ -53,7 +53,7 @@ class OthersettingsAction extends SettingsAction {
'metamark.net' => 'metamark.net' 'metamark.net' => 'metamark.net'
); );
common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), FALSE, $user->urlshorteningservice); common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), false, $user->urlshorteningservice);
common_submit('save', _('Save')); common_submit('save', _('Save'));
@ -174,7 +174,7 @@ class OthersettingsAction extends SettingsAction {
$result = $user->update($original); $result = $user->update($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
common_server_error(_('Couldn\'t update user.')); common_server_error(_('Couldn\'t update user.'));
return; return;

View File

@ -96,13 +96,13 @@ class ProfilesettingsAction extends SettingsAction {
_('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated')); _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
$language = common_language(); $language = common_language();
common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), TRUE, $language); common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), true, $language);
$timezone = common_timezone(); $timezone = common_timezone();
$timezones = array(); $timezones = array();
foreach(DateTimeZone::listIdentifiers() as $k => $v) { foreach(DateTimeZone::listIdentifiers() as $k => $v) {
$timezones[$v] = $v; $timezones[$v] = $v;
} }
common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), TRUE, $timezone); common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), true, $timezone);
common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'), common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'),
($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe); ($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe);
@ -278,7 +278,7 @@ class ProfilesettingsAction extends SettingsAction {
$result = $user->updateKeys($original); $result = $user->updateKeys($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
common_server_error(_('Couldn\'t update user.')); common_server_error(_('Couldn\'t update user.'));
return; return;
@ -298,7 +298,7 @@ class ProfilesettingsAction extends SettingsAction {
$result = $user->update($original); $result = $user->update($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
common_server_error(_('Couldn\'t update user for autosubscribe.')); common_server_error(_('Couldn\'t update user for autosubscribe.'));
return; return;
@ -340,7 +340,7 @@ class ProfilesettingsAction extends SettingsAction {
common_broadcast_profile($profile); common_broadcast_profile($profile);
$this->show_form(_('Settings saved.'), TRUE); $this->show_form(_('Settings saved.'), true);
} }
@ -434,7 +434,7 @@ class ProfilesettingsAction extends SettingsAction {
$user->password = common_munge_password($newpassword, $user->id); $user->password = common_munge_password($newpassword, $user->id);
$val = $user->validate(); $val = $user->validate();
if ($val !== TRUE) { if ($val !== true) {
$this->show_form(_('Error saving user; invalid.')); $this->show_form(_('Error saving user; invalid.'));
return; return;
} }

View File

@ -111,7 +111,7 @@ class SmssettingsAction extends EmailsettingsAction {
$confirm = new Confirm_address(); $confirm = new Confirm_address();
$confirm->user_id = $user->id; $confirm->user_id = $user->id;
$confirm->address_type = 'sms'; $confirm->address_type = 'sms';
if ($confirm->find(TRUE)) { if ($confirm->find(true)) {
return $confirm; return $confirm;
} else { } else {
return null; return null;
@ -165,7 +165,7 @@ class SmssettingsAction extends EmailsettingsAction {
$result = $user->update($original); $result = $user->update($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
common_server_error(_('Couldn\'t update user.')); common_server_error(_('Couldn\'t update user.'));
return; return;
@ -215,7 +215,7 @@ class SmssettingsAction extends EmailsettingsAction {
$result = $confirm->insert(); $result = $confirm->insert();
if ($result === FALSE) { if ($result === false) {
common_log_db_error($confirm, 'INSERT', __FILE__); common_log_db_error($confirm, 'INSERT', __FILE__);
common_server_error(_('Couldn\'t insert confirmation code.')); common_server_error(_('Couldn\'t insert confirmation code.'));
return; return;
@ -229,7 +229,7 @@ class SmssettingsAction extends EmailsettingsAction {
$msg = _('A confirmation code was sent to the phone number you added. Check your inbox (and spam box!) for the code and instructions on how to use it.'); $msg = _('A confirmation code was sent to the phone number you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
$this->show_form($msg, TRUE); $this->show_form($msg, true);
} }
function cancel_confirmation() function cancel_confirmation()
@ -257,7 +257,7 @@ class SmssettingsAction extends EmailsettingsAction {
return; return;
} }
$this->show_form(_('Confirmation cancelled.'), TRUE); $this->show_form(_('Confirmation cancelled.'), true);
} }
function remove_address() function remove_address()
@ -287,7 +287,7 @@ class SmssettingsAction extends EmailsettingsAction {
} }
$user->query('COMMIT'); $user->query('COMMIT');
$this->show_form(_('The address was removed.'), TRUE); $this->show_form(_('The address was removed.'), true);
} }
function sms_exists($sms) function sms_exists($sms)

View File

@ -96,7 +96,7 @@ class TwitapifriendshipsAction extends TwitterapiAction {
$sub->subscriber = $user->id; $sub->subscriber = $user->id;
$sub->subscribed = $other->id; $sub->subscribed = $other->id;
if ($sub->find(TRUE)) { if ($sub->find(true)) {
$sub->query('BEGIN'); $sub->query('BEGIN');
$sub->delete(); $sub->delete();
$sub->query('COMMIT'); $sub->query('COMMIT');

View File

@ -288,7 +288,7 @@ class TwittersettingsAction extends SettingsAction {
return; return;
} }
$this->show_form(_('Twitter account removed.'), TRUE); $this->show_form(_('Twitter account removed.'), true);
} }
function save_preferences() function save_preferences()
@ -325,7 +325,7 @@ class TwittersettingsAction extends SettingsAction {
$this->set_flags($flink, $noticesync, $replysync, $friendsync); $this->set_flags($flink, $noticesync, $replysync, $friendsync);
$result = $flink->update($original); $result = $flink->update($original);
if ($result === FALSE) { if ($result === false) {
common_log_db_error($flink, 'UPDATE', __FILE__); common_log_db_error($flink, 'UPDATE', __FILE__);
$this->show_form(_('Couldn\'t save Twitter preferences.')); $this->show_form(_('Couldn\'t save Twitter preferences.'));
return; return;

View File

@ -211,7 +211,7 @@ class UserauthorizationAction extends Action {
$rt->tok = $token_field; $rt->tok = $token_field;
$rt->type = 0; $rt->type = 0;
$rt->state = 0; $rt->state = 0;
common_debug('request token to look up: "'.print_r($rt,TRUE).'"'); common_debug('request token to look up: "'.print_r($rt,true).'"');
if ($rt->find(true)) { if ($rt->find(true)) {
common_debug('found request token to authorize', __FILE__); common_debug('found request token to authorize', __FILE__);
$orig_rt = clone($rt); $orig_rt = clone($rt);
@ -221,7 +221,7 @@ class UserauthorizationAction extends Action {
return true; return true;
} }
} }
return FALSE; return false;
} }
# XXX: refactor with similar code in finishremotesubscribe.php # XXX: refactor with similar code in finishremotesubscribe.php
@ -277,25 +277,25 @@ class UserauthorizationAction extends Action {
$profile->created = DB_DataObject_Cast::dateTime(); # current time $profile->created = DB_DataObject_Cast::dateTime(); # current time
$id = $profile->insert(); $id = $profile->insert();
if (!$id) { if (!$id) {
return FALSE; return false;
} }
$remote->id = $id; $remote->id = $id;
} }
if ($exists) { if ($exists) {
if (!$remote->update($orig_remote)) { if (!$remote->update($orig_remote)) {
return FALSE; return false;
} }
} else { } else {
$remote->created = DB_DataObject_Cast::dateTime(); # current time $remote->created = DB_DataObject_Cast::dateTime(); # current time
if (!$remote->insert()) { if (!$remote->insert()) {
return FALSE; return false;
} }
} }
if ($avatar_url) { if ($avatar_url) {
if (!$this->add_avatar($profile, $avatar_url)) { if (!$this->add_avatar($profile, $avatar_url)) {
return FALSE; return false;
} }
} }
@ -311,10 +311,10 @@ class UserauthorizationAction extends Action {
$sub->created = DB_DataObject_Cast::dateTime(); # current time $sub->created = DB_DataObject_Cast::dateTime(); # current time
if (!$sub->insert()) { if (!$sub->insert()) {
return FALSE; return false;
} }
return TRUE; return true;
} }
function add_avatar($profile, $url) function add_avatar($profile, $url)
@ -440,7 +440,7 @@ class UserauthorizationAction extends Action {
$sub = new Subscription(); $sub = new Subscription();
$sub->subscriber = $user->id; $sub->subscriber = $user->id;
$sub->subscribed = $remote->id; $sub->subscribed = $remote->id;
if ($sub->find(TRUE)) { if ($sub->find(true)) {
throw new OAuthException("Already subscribed to user!"); throw new OAuthException("Already subscribed to user!");
} }
} }

View File

@ -35,7 +35,7 @@ class Foreign_link extends Memcached_DataObject
$flink->user_id = $user_id; $flink->user_id = $user_id;
$flink->limit(1); $flink->limit(1);
if ($flink->find(TRUE)) { if ($flink->find(true)) {
return $flink; return $flink;
} }
@ -48,7 +48,7 @@ class Foreign_link extends Memcached_DataObject
$flink->foreign_id = $foreign_id; $flink->foreign_id = $foreign_id;
$flink->limit(1); $flink->limit(1);
if ($flink->find(TRUE)) { if ($flink->find(true)) {
return $flink; return $flink;
} }
@ -64,7 +64,7 @@ class Foreign_link extends Memcached_DataObject
$fuser->limit(1); $fuser->limit(1);
if ($fuser->find(TRUE)) { if ($fuser->find(true)) {
return $fuser; return $fuser;
} }

View File

@ -321,19 +321,19 @@ class Notice extends Memcached_DataObject
static function getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since) { static function getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since) {
$needAnd = FALSE; $needAnd = false;
$needWhere = TRUE; $needWhere = true;
if (preg_match('/\bWHERE\b/i', $qry)) { if (preg_match('/\bWHERE\b/i', $qry)) {
$needWhere = FALSE; $needWhere = false;
$needAnd = TRUE; $needAnd = true;
} }
if ($since_id > 0) { if ($since_id > 0) {
if ($needWhere) { if ($needWhere) {
$qry .= ' WHERE '; $qry .= ' WHERE ';
$needWhere = FALSE; $needWhere = false;
} else { } else {
$qry .= ' AND '; $qry .= ' AND ';
} }
@ -345,7 +345,7 @@ class Notice extends Memcached_DataObject
if ($needWhere) { if ($needWhere) {
$qry .= ' WHERE '; $qry .= ' WHERE ';
$needWhere = FALSE; $needWhere = false;
} else { } else {
$qry .= ' AND '; $qry .= ' AND ';
} }
@ -357,7 +357,7 @@ class Notice extends Memcached_DataObject
if ($needWhere) { if ($needWhere) {
$qry .= ' WHERE '; $qry .= ' WHERE ';
$needWhere = FALSE; $needWhere = false;
} else { } else {
$qry .= ' AND '; $qry .= ' AND ';
} }
@ -411,7 +411,7 @@ class Notice extends Memcached_DataObject
# On a cache hit, return a DB-object-like wrapper # On a cache hit, return a DB-object-like wrapper
if ($notices !== FALSE) { if ($notices !== false) {
$wrapper = new NoticeWrapper(array_slice($notices, $offset, $limit)); $wrapper = new NoticeWrapper(array_slice($notices, $offset, $limit));
return $wrapper; return $wrapper;
} }

View File

@ -34,7 +34,7 @@ class Queue_item extends Memcached_DataObject
$qi->limit(1); $qi->limit(1);
$cnt = $qi->find(TRUE); $cnt = $qi->find(true);
if ($cnt) { if ($cnt) {
# XXX: potential race condition # XXX: potential race condition

View File

@ -199,7 +199,7 @@ class User extends Memcached_DataObject
if (!$id) { if (!$id) {
common_log_db_error($profile, 'INSERT', __FILE__); common_log_db_error($profile, 'INSERT', __FILE__);
return FALSE; return false;
} }
$user = new User(); $user = new User();
@ -233,7 +233,7 @@ class User extends Memcached_DataObject
if (!$result) { if (!$result) {
common_log_db_error($user, 'INSERT', __FILE__); common_log_db_error($user, 'INSERT', __FILE__);
return FALSE; return false;
} }
# Everyone is subscribed to themself # Everyone is subscribed to themself
@ -247,7 +247,7 @@ class User extends Memcached_DataObject
if (!$result) { if (!$result) {
common_log_db_error($subscription, 'INSERT', __FILE__); common_log_db_error($subscription, 'INSERT', __FILE__);
return FALSE; return false;
} }
if ($email && !$user->email) { if ($email && !$user->email) {
@ -261,7 +261,7 @@ class User extends Memcached_DataObject
$result = $confirm->insert(); $result = $confirm->insert();
if (!$result) { if (!$result) {
common_log_db_error($confirm, 'INSERT', __FILE__); common_log_db_error($confirm, 'INSERT', __FILE__);
return FALSE; return false;
} }
} }

View File

@ -59,13 +59,13 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
$n->consumer_key = $consumer->key; $n->consumer_key = $consumer->key;
$n->tok = $token->key; $n->tok = $token->key;
$n->nonce = $nonce; $n->nonce = $nonce;
if ($n->find(TRUE)) { if ($n->find(true)) {
return TRUE; return true;
} else { } else {
$n->timestamp = $timestamp; $n->timestamp = $timestamp;
$n->created = DB_DataObject_Cast::dateTime(); $n->created = DB_DataObject_Cast::dateTime();
$n->insert(); $n->insert();
return FALSE; return false;
} }
} }
@ -99,7 +99,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
$rt->consumer_key = $consumer->key; $rt->consumer_key = $consumer->key;
$rt->tok = $token->key; $rt->tok = $token->key;
$rt->type = 0; # request $rt->type = 0; # request
if ($rt->find(TRUE) && $rt->state == 1) { # authorized if ($rt->find(true) && $rt->state == 1) { # authorized
common_debug('request token found.', __FILE__); common_debug('request token found.', __FILE__);
$at = new Token(); $at = new Token();
$at->consumer_key = $consumer->key; $at->consumer_key = $consumer->key;

View File

@ -139,7 +139,7 @@ function omb_broadcast_remote_subscribers($notice)
common_log(LOG_DEBUG, 'Posting to ' . $rp->postnoticeurl); common_log(LOG_DEBUG, 'Posting to ' . $rp->postnoticeurl);
if (omb_post_notice_keys($notice, $rp->postnoticeurl, $rp->token, $rp->secret)) { if (omb_post_notice_keys($notice, $rp->postnoticeurl, $rp->token, $rp->secret)) {
common_log(LOG_DEBUG, 'Finished to ' . $rp->postnoticeurl); common_log(LOG_DEBUG, 'Finished to ' . $rp->postnoticeurl);
$posted[$rp->postnoticeurl] = TRUE; $posted[$rp->postnoticeurl] = true;
} else { } else {
common_log(LOG_DEBUG, 'Failed posting to ' . $rp->postnoticeurl); common_log(LOG_DEBUG, 'Failed posting to ' . $rp->postnoticeurl);
} }
@ -208,7 +208,7 @@ function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret)
$req->to_postdata(), $req->to_postdata(),
array('User-Agent' => 'Laconica/' . LACONICA_VERSION)); array('User-Agent' => 'Laconica/' . LACONICA_VERSION));
common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__); common_debug('Got HTTP result "'.print_r($result,true).'"', __FILE__);
if ($result->status == 403) { # not authorized, don't send again if ($result->status == 403) { # not authorized, don't send again
common_debug('403 result, deleting subscription', __FILE__); common_debug('403 result, deleting subscription', __FILE__);
@ -241,7 +241,7 @@ function omb_broadcast_profile($profile)
if ($rp) { if ($rp) {
if (!$updated[$rp->updateprofileurl]) { if (!$updated[$rp->updateprofileurl]) {
if (omb_update_profile($profile, $rp, $sub)) { if (omb_update_profile($profile, $rp, $sub)) {
$updated[$rp->updateprofileurl] = TRUE; $updated[$rp->updateprofileurl] = true;
} }
} }
} }
@ -293,7 +293,7 @@ function omb_update_profile($profile, $remote_profile, $subscription)
$req->to_postdata(), $req->to_postdata(),
array('User-Agent' => 'Laconica/' . LACONICA_VERSION)); array('User-Agent' => 'Laconica/' . LACONICA_VERSION));
common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__); common_debug('Got HTTP result "'.print_r($result,true).'"', __FILE__);
if ($result->status == 403) { # not authorized, don't send again if ($result->status == 403) { # not authorized, don't send again
common_debug('403 result, deleting subscription', __FILE__); common_debug('403 result, deleting subscription', __FILE__);

View File

@ -436,7 +436,7 @@ function common_checkbox($id, $label, $checked=false, $instructions=null, $value
common_element_end('p'); common_element_end('p');
} }
function common_dropdown($id, $label, $content, $instructions=null, $blank_select=FALSE, $selected=null) function common_dropdown($id, $label, $content, $instructions=null, $blank_select=false, $selected=null)
{ {
common_element_start('p'); common_element_start('p');
common_element('label', array('for' => $id), $label); common_element('label', array('for' => $id), $label);
@ -1018,7 +1018,7 @@ function common_relative_profile($sender, $nickname, $dt=null)
// XXX: use a join instead of a subquery // XXX: use a join instead of a subquery
$recipient->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = '.$sender->id.' and subscribed = id)', 'AND'); $recipient->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = '.$sender->id.' and subscribed = id)', 'AND');
$recipient->whereAdd('nickname = "' . trim($nickname) . '"', 'AND'); $recipient->whereAdd('nickname = "' . trim($nickname) . '"', 'AND');
if ($recipient->find(TRUE)) { if ($recipient->find(true)) {
// XXX: should probably differentiate between profiles with // XXX: should probably differentiate between profiles with
// the same name by date of most recent update // the same name by date of most recent update
return $recipient; return $recipient;
@ -1028,7 +1028,7 @@ function common_relative_profile($sender, $nickname, $dt=null)
// XXX: use a join instead of a subquery // XXX: use a join instead of a subquery
$recipient->whereAdd('EXISTS (SELECT subscriber from subscription where subscribed = '.$sender->id.' and subscriber = id)', 'AND'); $recipient->whereAdd('EXISTS (SELECT subscriber from subscription where subscribed = '.$sender->id.' and subscriber = id)', 'AND');
$recipient->whereAdd('nickname = "' . trim($nickname) . '"', 'AND'); $recipient->whereAdd('nickname = "' . trim($nickname) . '"', 'AND');
if ($recipient->find(TRUE)) { if ($recipient->find(true)) {
// XXX: should probably differentiate between profiles with // XXX: should probably differentiate between profiles with
// the same name by date of most recent update // the same name by date of most recent update
return $recipient; return $recipient;
@ -2258,7 +2258,7 @@ function common_message_form($content, $user, $to)
$mutual_users->free(); $mutual_users->free();
unset($mutual_users); unset($mutual_users);
common_dropdown('to', _('To'), $mutual, null, FALSE, $to->id); common_dropdown('to', _('To'), $mutual, null, false, $to->id);
common_element_start('p'); common_element_start('p');

View File

@ -331,7 +331,7 @@ function parse_args()
$output_url = $args[u]; $output_url = $args[u];
if (file_exists($output_dir)) { if (file_exists($output_dir)) {
if (is_writable($output_dir) === FALSE) { if (is_writable($output_dir) === false) {
error("$output_dir is not writable."); error("$output_dir is not writable.");
} }
} else { } else {
@ -366,11 +366,11 @@ function write_file($path, $data)
error('No data specified for writing.'); error('No data specified for writing.');
} }
if (($fh_out = fopen($path,'w')) === FALSE) { if (($fh_out = fopen($path,'w')) === false) {
error("couldn't open $path for writing."); error("couldn't open $path for writing.");
} }
if (fwrite($fh_out, $data) === FALSE) { if (fwrite($fh_out, $data) === false) {
error("couldn't write to $path."); error("couldn't write to $path.");
} }
} }

View File

@ -110,7 +110,7 @@ class XmppConfirmHandler extends XmppQueueHandler {
$confirm->address_type = 'jabber'; $confirm->address_type = 'jabber';
$confirm->orderBy('modified DESC'); $confirm->orderBy('modified DESC');
$confirm->limit(1); $confirm->limit(1);
if ($confirm->find(TRUE)) { if ($confirm->find(true)) {
$this->log(LOG_INFO, 'Claiming confirmation for ' . $confirm->address); $this->log(LOG_INFO, 'Claiming confirmation for ' . $confirm->address);
# working around some weird DB_DataObject behaviour # working around some weird DB_DataObject behaviour
$confirm->whereAdd(''); # clears where stuff $confirm->whereAdd(''); # clears where stuff