git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 83fb5e60 authored by Evan Prodromou's avatar Evan Prodromou

Mass replacement of #-comments with //-comments

like leprous boils in our code. So, I've replaced all of them with //
comments instead. It's a massive, meaningless, and potentially buggy
change -- great one for the middle of a release cycle, eh?
parent 61960d36
......@@ -54,7 +54,7 @@ class InviteAction extends CurrentUserDesignAction
function sendInvitations()
{
# CSRF protection
// CSRF protection
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
$this->showForm(_('There was a problem with your session token. Try again, please.'));
......
......@@ -156,7 +156,7 @@ class PasswordsettingsAction extends SettingsAction
$newpassword = $this->arg('newpassword');
$confirm = $this->arg('confirm');
# Some validation
// Some validation
if (strlen($newpassword) < 6) {
// TRANS: Form validation error on page where to change password.
......
......@@ -100,7 +100,7 @@ class PublictagcloudAction extends Action
function showContent()
{
# This should probably be cached rather than recalculated
// This should probably be cached rather than recalculated
$tags = new Notice_tag();
#Need to clear the selection and then only re-add the field
......
......@@ -19,7 +19,7 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
# You have 24 hours to claim your password
// You have 24 hours to claim your password
define('MAX_RECOVERY_TIME', 24 * 60 * 60);
......@@ -81,7 +81,7 @@ class RecoverpasswordAction extends Action
$touched = strtotime($confirm->modified);
$email = $confirm->address;
# Burn this code
// Burn this code
$result = $confirm->delete();
......@@ -92,8 +92,8 @@ class RecoverpasswordAction extends Action
return;
}
# These should be reaped, but for now we just check mod time
# Note: it's still deleted; let's avoid a second attempt!
// These should be reaped, but for now we just check mod time
// Note: it's still deleted; let's avoid a second attempt!
if ((time() - $touched) > MAX_RECOVERY_TIME) {
common_log(LOG_WARNING,
......@@ -105,8 +105,8 @@ class RecoverpasswordAction extends Action
return;
}
# If we used an outstanding confirmation to send the email,
# it's been confirmed at this point.
// If we used an outstanding confirmation to send the email,
// it's been confirmed at this point.
if (!$user->email) {
$orig = clone($user);
......@@ -120,7 +120,7 @@ class RecoverpasswordAction extends Action
}
}
# Success!
// Success!
$this->setTempUser($user);
$this->showPasswordForm();
......@@ -289,7 +289,7 @@ class RecoverpasswordAction extends Action
}
}
# See if it's an unconfirmed email address
// See if it's an unconfirmed email address
if (!$user) {
// Warning: it may actually be legit to have multiple folks
......@@ -314,7 +314,7 @@ class RecoverpasswordAction extends Action
return;
}
# Try to get an unconfirmed email address if they used a user name
// Try to get an unconfirmed email address if they used a user name
if (!$user->email && !$confirm_email) {
$confirm_email = new Confirm_address();
......@@ -332,7 +332,7 @@ class RecoverpasswordAction extends Action
return;
}
# Success! We have a valid user and a confirmed or unconfirmed email address
// Success! We have a valid user and a confirmed or unconfirmed email address
$confirm = new Confirm_address();
$confirm->code = common_confirmation_code(128);
......@@ -380,7 +380,7 @@ class RecoverpasswordAction extends Action
function resetPassword()
{
# CSRF protection
// CSRF protection
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
// TRANS: Form validation error message.
......@@ -410,7 +410,7 @@ class RecoverpasswordAction extends Action
return;
}
# OK, we're ready to go
// OK, we're ready to go
$original = clone($user);
......
......@@ -61,8 +61,8 @@ class SupAction extends Action
{
$notice = new Notice();
# XXX: cache this. Depends on how big this protocol becomes;
# Re-doing this query every 15 seconds isn't the end of the world.
// XXX: cache this. Depends on how big this protocol becomes;
// Re-doing this query every 15 seconds isn't the end of the world.
$divider = common_sql_date(time() - $seconds);
......
......@@ -112,7 +112,7 @@ class UserrssAction extends Rss10Action
return ($avatar) ? $avatar->url : null;
}
# override parent to add X-SUP-ID URL
// override parent to add X-SUP-ID URL
function initRss($limit=0)
{
......
......@@ -27,7 +27,7 @@ class Avatar extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
# We clean up the file, too
// We clean up the file, too
function delete()
{
......
......@@ -91,7 +91,7 @@ class Foreign_link extends Memcached_DataObject
$this->profilesync = 0;
}
# Convenience methods
// Convenience methods
function getForeignUser()
{
$fuser = new Foreign_user();
......
......@@ -65,7 +65,7 @@ class Foreign_user extends Memcached_DataObject
}
}
if (count($parts) == 0) {
# No changes
// No changes
return true;
}
$toupdate = implode(', ', $parts);
......
......@@ -34,7 +34,7 @@ class Memcached_DataObject extends Safe_DataObject
{
if (is_null($v)) {
$v = $k;
# XXX: HACK!
// XXX: HACK!
$i = new $cls;
$keys = $i->keys();
$k = $keys[0];
......
......@@ -312,7 +312,7 @@ class Notice extends Memcached_DataObject
$autosource = common_config('public', 'autosource');
# Sandboxed are non-false, but not 1, either
// Sandboxed are non-false, but not 1, either
if (!$profile->hasRight(Right::PUBLICNOTICE) ||
($source && $autosource && in_array($source, $autosource))) {
......@@ -410,8 +410,8 @@ class Notice extends Memcached_DataObject
}
# Clear the cache for subscribed users, so they'll update at next request
# XXX: someone clever could prepend instead of clearing the cache
// Clear the cache for subscribed users, so they'll update at next request
// XXX: someone clever could prepend instead of clearing the cache
$notice->blowOnInsert();
......@@ -559,8 +559,8 @@ class Notice extends Memcached_DataObject
}
}
}
# If we get here, oldest item in cache window is not
# old enough for dupe limit; do direct check against DB
// If we get here, oldest item in cache window is not
// old enough for dupe limit; do direct check against DB
$notice = new Notice();
$notice->profile_id = $profile_id;
$notice->content = $content;
......@@ -576,16 +576,16 @@ class Notice extends Memcached_DataObject
if (empty($profile)) {
return false;
}
# Get the Nth notice
// Get the Nth notice
$notice = $profile->getNotices(common_config('throttle', 'count') - 1, 1);
if ($notice && $notice->fetch()) {
# If the Nth notice was posted less than timespan seconds ago
// If the Nth notice was posted less than timespan seconds ago
if (time() - strtotime($notice->created) <= common_config('throttle', 'timespan')) {
# Then we throttle
// Then we throttle
return false;
}
}
# Either not N notices in the stream, OR the Nth was not posted within timespan seconds
// Either not N notices in the stream, OR the Nth was not posted within timespan seconds
return true;
}
......@@ -695,7 +695,7 @@ class Notice extends Memcached_DataObject
if (common_config('public', 'localonly')) {
$notice->whereAdd('is_local = ' . Notice::LOCAL_PUBLIC);
} else {
# -1 == blacklisted, -2 == gateway (i.e. Twitter)
// -1 == blacklisted, -2 == gateway (i.e. Twitter)
$notice->whereAdd('is_local !='. Notice::LOCAL_NONPUBLIC);
$notice->whereAdd('is_local !='. Notice::GATEWAY);
}
......
......@@ -51,7 +51,7 @@ class Oauth_application_user extends Memcached_DataObject
}
}
if (count($parts) == 0) {
# No changes
// No changes
return true;
}
$toupdate = implode(', ', $parts);
......
......@@ -93,7 +93,7 @@ class Profile extends Memcached_DataObject
$avatar->url = Avatar::url($filename);
$avatar->created = DB_DataObject_Cast::dateTime(); # current time
# XXX: start a transaction here
// XXX: start a transaction here
if (!$this->delete_avatars() || !$avatar->insert()) {
@unlink(Avatar::path($filename));
......@@ -101,7 +101,7 @@ class Profile extends Memcached_DataObject
}
foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
# We don't do a scaled one if original is our scaled size
// We don't do a scaled one if original is our scaled size
if (!($avatar->width == $size && $avatar->height == $size)) {
$scaled_filename = $imagefile->resize($size);
......
......@@ -25,7 +25,7 @@ class Profile_tag extends Memcached_DataObject
static function getTags($tagger, $tagged) {
$tags = array();
# XXX: store this in memcached
// XXX: store this in memcached
$profile_tag = new Profile_tag();
$profile_tag->tagger = $tagger;
......@@ -46,11 +46,11 @@ class Profile_tag extends Memcached_DataObject
$newtags = array_unique($newtags);
$oldtags = Profile_tag::getTags($tagger, $tagged);
# Delete stuff that's old that not in new
// Delete stuff that's old that not in new
$to_delete = array_diff($oldtags, $newtags);
# Insert stuff that's in new and not in old
// Insert stuff that's in new and not in old
$to_insert = array_diff($newtags, $oldtags);
......@@ -84,7 +84,7 @@ class Profile_tag extends Memcached_DataObject
return true;
}
# Return profiles with a given tag
// Return profiles with a given tag
static function getTagged($tagger, $tag) {
$profile = new Profile();
$profile->query('SELECT profile.* ' .
......
......@@ -46,9 +46,9 @@ class Queue_item extends Memcached_DataObject
$cnt = $qi->find(true);
if ($cnt) {
# XXX: potential race condition
# can we force it to only update if claimed is still null
# (or old)?
// XXX: potential race condition
// can we force it to only update if claimed is still null
// (or old)?
common_log(LOG_INFO, 'claiming queue item id = ' . $qi->id .
' for transport ' . $qi->transport);
$orig = clone($qi);
......
......@@ -146,9 +146,9 @@ class Subscription extends Memcached_DataObject
function notify()
{
# XXX: add other notifications (Jabber, SMS) here
# XXX: queue this and handle it offline
# XXX: Whatever happens, do it in Twitter-like API, too
// XXX: add other notifications (Jabber, SMS) here
// XXX: queue this and handle it offline
// XXX: Whatever happens, do it in Twitter-like API, too
$this->notifyEmail();
}
......
......@@ -306,11 +306,11 @@ class User_group extends Memcached_DataObject
$oldaliases = $this->getAliases();
# Delete stuff that's old that not in new
// Delete stuff that's old that not in new
$to_delete = array_diff($oldaliases, $newaliases);
# Insert stuff that's in new and not in old
// Insert stuff that's in new and not in old
$to_insert = array_diff($newaliases, $oldaliases);
......
......@@ -292,7 +292,7 @@ class ApiAction extends Action
if ($get_notice) {
$notice = $profile->getCurrentNotice();
if ($notice) {
# don't get user!
// don't get user!
$twitter_user['status'] = $this->twitterStatusArray($notice, false);
}
}
......@@ -397,7 +397,7 @@ class ApiAction extends Action
}
if ($include_user && $profile) {
# Don't get notice (recursive!)
// Don't get notice (recursive!)
$twitter_user = $this->twitterUserArray($profile, false);
$twitter_status['user'] = $twitter_user;
}
......@@ -698,7 +698,7 @@ class ApiAction extends Action
$this->element('guid', null, $entry['guid']);
$this->element('link', null, $entry['link']);
# RSS only supports 1 enclosure per item
// RSS only supports 1 enclosure per item
if(array_key_exists('enclosures', $entry) and !empty($entry['enclosures'])){
$enclosure = $entry['enclosures'][0];
$this->element('enclosure', array('url'=>$enclosure['url'],'type'=>$enclosure['mimetype'],'length'=>$enclosure['size']), null);
......@@ -833,7 +833,7 @@ class ApiAction extends Action
}
if (!is_null($suplink)) {
# For FriendFeed's SUP protocol
// For FriendFeed's SUP protocol
$this->element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup',
'href' => $suplink,
'type' => 'application/json'));
......
......@@ -95,9 +95,9 @@ class WebChannel extends Channel
function output($user, $text)
{
# XXX: buffer all output and send it at the end
# XXX: even better, redirect to appropriate page
# depending on what command was run
// XXX: buffer all output and send it at the end
// XXX: even better, redirect to appropriate page
// depending on what command was run
$this->out->startHTML();
$this->out->elementStart('head');
// TRANS: Title for command results.
......
......@@ -48,7 +48,7 @@ define('NOTICE_INBOX_SOURCE_REPLY', 3);
define('NOTICE_INBOX_SOURCE_FORWARD', 4);
define('NOTICE_INBOX_SOURCE_GATEWAY', -1);
# append our extlib dir as the last-resort place to find libs
// append our extlib dir as the last-resort place to find libs
set_include_path(get_include_path() . PATH_SEPARATOR . INSTALLDIR . '/extlib/');
......@@ -69,7 +69,7 @@ if (!function_exists('dl')) {
}
}
# global configuration object
// global configuration object
require_once('PEAR.php');
require_once('PEAR/Exception.php');
......
......@@ -84,7 +84,7 @@ class GalleryAction extends OwnerDesignAction
{
parent::handle($args);
# Post from the tag dropdown; redirect to a GET
// Post from the tag dropdown; redirect to a GET
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
common_redirect($this->selfUrl(), 303);
......
......@@ -137,7 +137,7 @@ class GroupList extends Widget
$this->out->elementEnd('p');
}
# If we're on a list with an owner (subscriptions or subscribers)...
// If we're on a list with an owner (subscriptions or subscribers)...
if (!empty($user) && !empty($this->owner) && $user->id == $this->owner->id) {
$this->showOwnerControls();
......@@ -149,8 +149,8 @@ class GroupList extends Widget
$this->out->elementStart('div', 'entity_actions');
$this->out->elementStart('ul');
$this->out->elementStart('li', 'entity_subscribe');
# XXX: special-case for user looking at own
# subscriptions page
// XXX: special-case for user looking at own
// subscriptions page
if ($user->isMember($this->group)) {
$lf = new LeaveForm($this->out, $this->group);
$lf->show();
......
......@@ -21,8 +21,8 @@ require_once(INSTALLDIR . '/lib/mail.php');
require_once(INSTALLDIR . '/lib/mediafile.php');
require_once('Mail/mimeDecode.php');
# FIXME: we use both Mail_mimeDecode and mailparse
# Need to move everything to mailparse
// FIXME: we use both Mail_mimeDecode and mailparse
// Need to move everything to mailparse
class MailHandler
{
......
......@@ -264,8 +264,8 @@ class StatusNetOAuthDataStore extends OAuthDataStore
$profile = Profile::staticGet($remote->id);
$orig_remote = clone($remote);
$orig_profile = clone($profile);
# XXX: compare current postNotice and updateProfile URLs to the ones
# stored in the DB to avoid (possibly...) above attack
// XXX: compare current postNotice and updateProfile URLs to the ones
// stored in the DB to avoid (possibly...) above attack
} else {
$exists = false;
$remote = new Remote_profile();
......
......@@ -24,7 +24,7 @@ function ping_broadcast_notice($notice) {
return true;
}
# Array of servers, URL => type
// Array of servers, URL => type
$notify = common_config('ping', 'notify');
try {
$profile = $notice->getProfile();
......
......@@ -34,7 +34,7 @@ define('DEFAULT_RSS_LIMIT', 48);
class Rss10Action extends Action
{
# This will contain the details of each feed item's author and be used to generate SIOC data.
// This will contain the details of each feed item's author and be used to generate SIOC data.
var $creators = array();
var $limit = DEFAULT_RSS_LIMIT;
......@@ -88,10 +88,10 @@ class Rss10Action extends Action
if (common_config('site', 'private')) {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
# This header makes basic auth go
// This header makes basic auth go
header('WWW-Authenticate: Basic realm="StatusNet RSS"');
# If the user hits cancel -- bam!
// If the user hits cancel -- bam!
$this->show_basic_auth_error();
return;
} else {
......@@ -99,7 +99,7 @@ class Rss10Action extends Action
$password = $_SERVER['PHP_AUTH_PW'];
if (!common_check_user($nickname, $password)) {
# basic authentication failed
// basic authentication failed
list($proxy, $ip) = common_client_ip();
common_log(LOG_WARNING, "Failed RSS auth attempt, nickname = $nickname, proxy = $proxy, ip = $ip.");
......
......@@ -2137,7 +2137,7 @@ function common_url_to_nickname($url)
$parts = parse_url($url);
# If any of these parts exist, this won't work
// If any of these parts exist, this won't work
foreach ($bad as $badpart) {
if (array_key_exists($badpart, $parts)) {
......@@ -2145,15 +2145,15 @@ function common_url_to_nickname($url)
}
}
# We just have host and/or path
// We just have host and/or path
# If it's just a host...
// If it's just a host...
if (array_key_exists('host', $parts) &&
(!array_key_exists('path', $parts) || strcmp($parts['path'], '/') == 0))
{
$hostparts = explode('.', $parts['host']);
# Try to catch common idiom of nickname.service.tld
// Try to catch common idiom of nickname.service.tld
if ((count($hostparts) > 2) &&
(strlen($hostparts[count($hostparts) - 2]) > 3) && # try to skip .co.uk, .com.au
......@@ -2161,12 +2161,12 @@ function common_url_to_nickname($url)
{
return common_nicknamize($hostparts[0]);
} else {
# Do the whole hostname
// Do the whole hostname
return common_nicknamize($parts['host']);
}
} else {
if (array_key_exists('path', $parts)) {
# Strip starting, ending slashes
// Strip starting, ending slashes
$path = preg_replace('@/$@', '', $parts['path']);
$path = preg_replace('@^/@', '', $path);
$path = basename($path);
......
......@@ -45,7 +45,7 @@ class EnjitQueueHandler extends QueueHandler
}
#
# Build an Atom message from the notice
// Build an Atom message from the notice
#
$noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
$msg = $profile->nickname . ': ' . $notice->content;
......@@ -73,7 +73,7 @@ class EnjitQueueHandler extends QueueHandler
);
#
# POST the message to $config['enjit']['apiurl']
// POST the message to $config['enjit']['apiurl']
#
$request = HTTPClient::start();
$response = $request->post($url, null, $data);
......
......@@ -94,9 +94,9 @@ class Irc_waiting_message extends Memcached_DataObject {
$cnt = $wm->find(true);
if ($cnt) {
# XXX: potential race condition
# can we force it to only update if claimed is still null
# (or old)?
// XXX: potential race condition
// can we force it to only update if claimed is still null
// (or old)?
common_log(LOG_INFO, 'claiming IRC waiting message id = ' . $wm->id);
$orig = clone($wm);
$wm->claimed = common_sql_now();
......
......@@ -100,9 +100,9 @@ class Msn_waiting_message extends Memcached_DataObject {
$cnt = $wm->find(true);
if ($cnt) {
# XXX: potential race condition
# can we force it to only update if claimed is still null
# (or old)?
// XXX: potential race condition
// can we force it to only update if claimed is still null
// (or old)?
common_log(LOG_INFO, 'claiming msn waiting message id = ' . $wm->id);
$orig = clone($wm);
$wm->claimed = common_sql_now();
......
......@@ -266,9 +266,9 @@ class FinishopenidloginAction extends Action
if ($user) {
oid_set_last($display);
# XXX: commented out at @edd's request until better
# control over how data flows from OpenID provider.
# oid_update_user($user, $sreg);
// XXX: commented out at @edd's request until better
// control over how data flows from OpenID provider.
// oid_update_user($user, $sreg);
common_set_user($user);
common_real_login(true);
if (isset($_SESSION['openid_rememberme']) && $_SESSION['openid_rememberme']) {
......@@ -306,7 +306,7 @@ class FinishopenidloginAction extends Action
function createNewUser()
{
# FIXME: save invite code before redirect, and check here
// FIXME: save invite code before redirect, and check here
if (!Event::handle('StartRegistrationTry', array($this))) {
return;
......@@ -364,7 +364,7 @@ class FinishopenidloginAction extends Action
return;
}
# Possible race condition... let's be paranoid
// Possible race condition... let's be paranoid
$other = oid_get_user($canonical);
......@@ -379,8 +379,8 @@ class FinishopenidloginAction extends Action
$location = '';
if (!empty($sreg['country'])) {
if ($sreg['postcode']) {
# XXX: use postcode to get city and region
# XXX: also, store postcode somewhere -- it's valuable!
// XXX: use postcode to get city and region
// XXX: also, store postcode somewhere -- it's valuable!
$location = $sreg['postcode'] . ', ' . $sreg['country'];
} else {
$location = $sreg['country'];
......@@ -395,8 +395,8 @@ class FinishopenidloginAction extends Action
$email = $this->getEmail();
# XXX: add language
# XXX: add timezone
// XXX: add language
// XXX: add timezone
$args = array('nickname' => $nickname,
'email' => $email,
......@@ -438,7 +438,7 @@ class FinishopenidloginAction extends Action
return;
}
# They're legit!
// They're legit!
$user = User::staticGet('nickname', $nickname);
......@@ -477,7 +477,7 @@ class FinishopenidloginAction extends Action
{
$url = common_get_returnto();
if ($url) {
# We don't have to return to it again
// We don't have to return to it again
common_set_returnto(null);
$url = common_inject_session($url);
} else {
......@@ -491,7 +491,7 @@ class FinishopenidloginAction extends Action
function bestNewNickname($display, $sreg)
{
# Try the passed-in nickname
// Try the passed-in nickname
if (!empty($sreg['nickname'])) {
$nickname = $this->nicknamize($sreg['nickname']);
......@@ -500,7 +500,7 @@ class FinishopenidloginAction extends Action
}
}
# Try the full name
// Try the full name
if (!empty($sreg['fullname'])) {
$fullname = $this->nicknamize($sreg['fullname']);
......@@ -509,7 +509,7 @@ class FinishopenidloginAction extends Action
}
}
# Try the URL
// Try the URL
$from_url = $this->openidToNickname($display);
......@@ -517,7 +517,7 @@ class FinishopenidloginAction extends Action
return $from_url;
}
# XXX: others?
// XXX: others?
return null;
}
......@@ -545,10 +545,10 @@ class FinishopenidloginAction extends Action
}
}
# We try to use an OpenID URL as a legal StatusNet user name in this order
# 1. Plain hostname, like http://evanp.myopenid.com/
# 2. One element in path, like http://profile.typekey.com/EvanProdromou/
# or http://getopenid.com/evanprodromou
// We try to use an OpenID URL as a legal StatusNet user name in this order
// 1. Plain hostname, like http://evanp.myopenid.com/
// 2. One element in path, like http://profile.typekey.com/EvanProdromou/
// or http://getopenid.com/evanprodromou
function urlToNickname($openid)
{
......@@ -562,8 +562,8 @@ class FinishopenidloginAction extends Action
if (!$base) {
return null;
} else {
# =evan.prodromou
# or @gratis*evan.prodromou
// =evan.prodromou
// or @gratis*evan.prodromou
$parts = explode('*', substr($base, 1));
return $this->nicknamize(array_pop($parts));
}
......@@ -578,7 +578,7 @@ class FinishopenidloginAction extends Action
}
}
# Given a string, try to make it work as a nickname
// Given a string, try to make it work as a nickname
function nicknamize($str)
{
......
......@@ -27,7 +27,7 @@ require_once('Auth/OpenID/Server.php');
require_once('Auth/OpenID/SReg.php');
require_once('Auth/OpenID/MySQLStore.php');
# About one year cookie expiry
// About one year cookie expiry
define('OPENID_COOKIE_EXPIRY', round(365.25 * 24 * 60 * 60));
define('OPENID_COOKIE_KEY', 'lastusedopenid');
......@@ -36,7 +36,7 @@ function oid_store()
{
static $store = null;
if (!$store) {
# Can't be called statically
// Can't be called statically