diff options
Diffstat (limited to '_darcs/pristine/classes')
32 files changed, 298 insertions, 149 deletions
diff --git a/_darcs/pristine/classes/Avatar.php b/_darcs/pristine/classes/Avatar.php index bde983d79..3c754ec2d 100644 --- a/_darcs/pristine/classes/Avatar.php +++ b/_darcs/pristine/classes/Avatar.php @@ -21,14 +21,16 @@ class Avatar extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Avatar',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Avatar',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE # We clean up the file, too - function delete() { + function delete() + { $filename = $this->filename; if (parent::delete()) { @unlink(common_avatar_path($filename)); @@ -38,7 +40,8 @@ class Avatar extends Memcached_DataObject # Create and save scaled version of this avatar # XXX: maybe break into different methods - function scale($size) { + function scale($size) + { $image_s = imagecreatetruecolor($size, $size); $image_a = $this->to_image(); @@ -76,7 +79,8 @@ class Avatar extends Memcached_DataObject } } - function to_image() { + function to_image() + { $filepath = common_avatar_path($this->filename); if ($this->mediatype == 'image/gif') { return imagecreatefromgif($filepath); @@ -89,7 +93,8 @@ class Avatar extends Memcached_DataObject } } - function &pkeyGet($kv) { + function &pkeyGet($kv) + { return Memcached_DataObject::pkeyGet('Avatar', $kv); } } diff --git a/_darcs/pristine/classes/Channel.php b/_darcs/pristine/classes/Channel.php index ea3530406..02ece9c0f 100644 --- a/_darcs/pristine/classes/Channel.php +++ b/_darcs/pristine/classes/Channel.php @@ -21,23 +21,28 @@ if (!defined('LACONICA')) { exit(1); } class Channel { - function on($user) { + function on($user) + { return false; } - function off($user) { + function off($user) + { return false; } - function output($user, $text) { + function output($user, $text) + { return false; } - function error($user, $text) { + function error($user, $text) + { return false; } - function source() { + function source() + { return null; } } @@ -46,33 +51,40 @@ class XMPPChannel extends Channel { var $conn = null; - function source() { + function source() + { return 'xmpp'; } - function __construct($conn) { + function __construct($conn) + { $this->conn = $conn; } - function on($user) { + function on($user) + { return $this->set_notify($user, 1); } - function off($user) { + function off($user) + { return $this->set_notify($user, 0); } - function output($user, $text) { + function output($user, $text) + { $text = '['.common_config('site', 'name') . '] ' . $text; jabber_send_message($user->jabber, $text); } - function error($user, $text) { + function error($user, $text) + { $text = '['.common_config('site', 'name') . '] ' . $text; jabber_send_message($user->jabber, $text); } - function set_notify(&$user, $notify) { + function set_notify(&$user, $notify) + { $orig = clone($user); $user->jabbernotify = $notify; $result = $user->update($orig); @@ -94,19 +106,23 @@ class XMPPChannel extends Channel { class WebChannel extends Channel { - function source() { + function source() + { return 'web'; } - function on($user) { + function on($user) + { return false; } - function off($user) { + function off($user) + { return false; } - function output($user, $text) { + function output($user, $text) + { # XXX: buffer all output and send it at the end # XXX: even better, redirect to appropriate page # depending on what command was run @@ -115,7 +131,8 @@ class WebChannel extends Channel { common_show_footer(); } - function error($user, $text) { + function error($user, $text) + { common_user_error($text); } } @@ -123,7 +140,8 @@ class WebChannel extends Channel { class AjaxWebChannel extends WebChannel { - function output($user, $text) { + function output($user, $text) + { common_start_html('text/xml;charset=utf-8', true); common_element_start('head'); common_element('title', null, _('Command results')); @@ -134,7 +152,8 @@ class AjaxWebChannel extends WebChannel { common_element_end('html'); } - function error($user, $text) { + function error($user, $text) + { common_start_html('text/xml;charset=utf-8', true); common_element_start('head'); common_element('title', null, _('Ajax Error')); @@ -151,23 +170,28 @@ class MailChannel extends Channel { var $addr = null; - function source() { + function source() + { return 'mail'; } - function __construct($addr=null) { + function __construct($addr=null) + { $this->addr = $addr; } - function on($user) { + function on($user) + { return $this->set_notify($user, 1); } - function off($user) { + function off($user) + { return $this->set_notify($user, 0); } - function output($user, $text) { + function output($user, $text) + { $headers['From'] = $user->incomingemail; $headers['To'] = $this->addr; @@ -177,7 +201,8 @@ class MailChannel extends Channel { return mail_send(array($this->addr), $headers, $text); } - function error($user, $text) { + function error($user, $text) + { $headers['From'] = $user->incomingemail; $headers['To'] = $this->addr; @@ -187,7 +212,8 @@ class MailChannel extends Channel { return mail_send(array($this->addr), $headers, $text); } - function set_notify($user, $value) { + function set_notify($user, $value) + { $orig = clone($user); $user->smsnotify = $value; $result = $user->update($orig); diff --git a/_darcs/pristine/classes/Command.php b/_darcs/pristine/classes/Command.php index b146005a7..407a6ecba 100644 --- a/_darcs/pristine/classes/Command.php +++ b/_darcs/pristine/classes/Command.php @@ -25,17 +25,20 @@ class Command { var $user = null; - function __construct($user=null) { + function __construct($user=null) + { $this->user = $user; } - function execute($channel) { + function execute($channel) + { return false; } } class UnimplementedCommand extends Command { - function execute($channel) { + function execute($channel) + { $channel->error($this->user, _("Sorry, this command is not yet implemented.")); } } @@ -48,7 +51,8 @@ class TrackOffCommand extends UnimplementedCommand { class TrackCommand extends UnimplementedCommand { var $word = null; - function __construct($user, $word) { + function __construct($user, $word) + { parent::__construct($user); $this->word = $word; } @@ -56,7 +60,8 @@ class TrackCommand extends UnimplementedCommand { class UntrackCommand extends UnimplementedCommand { var $word = null; - function __construct($user, $word) { + function __construct($user, $word) + { parent::__construct($user); $this->word = $word; } @@ -64,7 +69,8 @@ class UntrackCommand extends UnimplementedCommand { class NudgeCommand extends UnimplementedCommand { var $other = null; - function __construct($user, $other) { + function __construct($user, $other) + { parent::__construct($user); $this->other = $other; } @@ -72,14 +78,16 @@ class NudgeCommand extends UnimplementedCommand { class InviteCommand extends UnimplementedCommand { var $other = null; - function __construct($user, $other) { + function __construct($user, $other) + { parent::__construct($user); $this->other = $other; } } class StatsCommand extends Command { - function execute($channel) { + function execute($channel) + { $subs = new Subscription(); $subs->subscriber = $this->user->id; @@ -106,12 +114,14 @@ class FavCommand extends Command { var $other = null; - function __construct($user, $other) { + function __construct($user, $other) + { parent::__construct($user); $this->other = $other; } - function execute($channel) { + function execute($channel) + { $recipient = common_relative_profile($this->user, common_canonical_nickname($this->other)); @@ -149,12 +159,14 @@ class FavCommand extends Command { class WhoisCommand extends Command { var $other = null; - function __construct($user, $other) { + function __construct($user, $other) + { parent::__construct($user); $this->other = $other; } - function execute($channel) { + function execute($channel) + { $recipient = common_relative_profile($this->user, common_canonical_nickname($this->other)); @@ -184,13 +196,15 @@ class WhoisCommand extends Command { class MessageCommand extends Command { var $other = null; var $text = null; - function __construct($user, $other, $text) { + function __construct($user, $other, $text) + { parent::__construct($user); $this->other = $other; $this->text = $text; } - function execute($channel) { + function execute($channel) + { $other = User::staticGet('nickname', common_canonical_nickname($this->other)); $len = mb_strlen($this->text); if ($len == 0) { @@ -227,12 +241,14 @@ class GetCommand extends Command { var $other = null; - function __construct($user, $other) { + function __construct($user, $other) + { parent::__construct($user); $this->other = $other; } - function execute($channel) { + function execute($channel) + { $target_nickname = common_canonical_nickname($this->other); $target = @@ -257,12 +273,14 @@ class SubCommand extends Command { var $other = null; - function __construct($user, $other) { + function __construct($user, $other) + { parent::__construct($user); $this->other = $other; } - function execute($channel) { + function execute($channel) + { if (!$this->other) { $channel->error($this->user, _('Specify the name of the user to subscribe to')); @@ -283,12 +301,14 @@ class UnsubCommand extends Command { var $other = null; - function __construct($user, $other) { + function __construct($user, $other) + { parent::__construct($user); $this->other = $other; } - function execute($channel) { + function execute($channel) + { if(!$this->other) { $channel->error($this->user, _('Specify the name of the user to unsubscribe from')); return; @@ -306,11 +326,13 @@ class UnsubCommand extends Command { class OffCommand extends Command { var $other = null; - function __construct($user, $other=null) { + function __construct($user, $other=null) + { parent::__construct($user); $this->other = $other; } - function execute($channel) { + function execute($channel) + { if ($other) { $channel->error($this->user, _("Command not yet implemented.")); } else { @@ -325,12 +347,14 @@ class OffCommand extends Command { class OnCommand extends Command { var $other = null; - function __construct($user, $other=null) { + function __construct($user, $other=null) + { parent::__construct($user); $this->other = $other; } - function execute($channel) { + function execute($channel) + { if ($other) { $channel->error($this->user, _("Command not yet implemented.")); } else { @@ -344,7 +368,8 @@ class OnCommand extends Command { } class HelpCommand extends Command { - function execute($channel) { + function execute($channel) + { $channel->output($this->user, _("Commands:\n". "on - turn on notifications\n". diff --git a/_darcs/pristine/classes/CommandInterpreter.php b/_darcs/pristine/classes/CommandInterpreter.php index db02ce541..ff078bb05 100644 --- a/_darcs/pristine/classes/CommandInterpreter.php +++ b/_darcs/pristine/classes/CommandInterpreter.php @@ -23,7 +23,8 @@ require_once(INSTALLDIR.'/classes/Command.php'); class CommandInterpreter { - function handle_command($user, $text) { + function handle_command($user, $text) + { # XXX: localise $text = preg_replace('/\s+/', ' ', trim($text)); diff --git a/_darcs/pristine/classes/Confirm_address.php b/_darcs/pristine/classes/Confirm_address.php index 71f2d0c72..ed3875d22 100644 --- a/_darcs/pristine/classes/Confirm_address.php +++ b/_darcs/pristine/classes/Confirm_address.php @@ -20,10 +20,12 @@ class Confirm_address extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function sequenceKey() { return array(false, false); } + function sequenceKey() + { return array(false, false); } } diff --git a/_darcs/pristine/classes/Consumer.php b/_darcs/pristine/classes/Consumer.php index c598312aa..d5b7b7e33 100644 --- a/_darcs/pristine/classes/Consumer.php +++ b/_darcs/pristine/classes/Consumer.php @@ -16,7 +16,8 @@ class Consumer extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Consumer',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Consumer',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/_darcs/pristine/classes/Fave.php b/_darcs/pristine/classes/Fave.php index 5d938d149..24df5938c 100644 --- a/_darcs/pristine/classes/Fave.php +++ b/_darcs/pristine/classes/Fave.php @@ -15,7 +15,8 @@ class Fave extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Fave',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Fave',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE @@ -31,7 +32,8 @@ class Fave extends Memcached_DataObject return $fave; } - function &pkeyGet($kv) { + function &pkeyGet($kv) + { return Memcached_DataObject::pkeyGet('Fave', $kv); } } diff --git a/_darcs/pristine/classes/Foreign_link.php b/_darcs/pristine/classes/Foreign_link.php index 41a95e641..79a4d262d 100644 --- a/_darcs/pristine/classes/Foreign_link.php +++ b/_darcs/pristine/classes/Foreign_link.php @@ -21,7 +21,8 @@ class Foreign_link extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE @@ -55,7 +56,8 @@ class Foreign_link extends Memcached_DataObject } # Convenience methods - function getForeignUser() { + function getForeignUser() + { $fuser = new Foreign_user(); $fuser->service = $this->service; $fuser->id = $this->foreign_id; @@ -69,7 +71,8 @@ class Foreign_link extends Memcached_DataObject return null; } - function getUser() { + function getUser() + { return User::staticGet($this->user_id); } diff --git a/_darcs/pristine/classes/Foreign_service.php b/_darcs/pristine/classes/Foreign_service.php index 128411b71..ef614dbd6 100644 --- a/_darcs/pristine/classes/Foreign_service.php +++ b/_darcs/pristine/classes/Foreign_service.php @@ -17,7 +17,8 @@ class Foreign_service extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/_darcs/pristine/classes/Foreign_subscription.php b/_darcs/pristine/classes/Foreign_subscription.php index d8e8569fb..d50860621 100644 --- a/_darcs/pristine/classes/Foreign_subscription.php +++ b/_darcs/pristine/classes/Foreign_subscription.php @@ -16,7 +16,8 @@ class Foreign_subscription extends Memcached_DataObject public $created; // datetime() not_null /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/_darcs/pristine/classes/Foreign_user.php b/_darcs/pristine/classes/Foreign_user.php index f8a980884..61727abe5 100644 --- a/_darcs/pristine/classes/Foreign_user.php +++ b/_darcs/pristine/classes/Foreign_user.php @@ -18,7 +18,8 @@ class Foreign_user extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE @@ -39,7 +40,8 @@ class Foreign_user extends Memcached_DataObject return null; } - function updateKeys(&$orig) { + function updateKeys(&$orig) + { $parts = array(); foreach (array('id', 'service', 'uri', 'nickname') as $k) { if (strcmp($this->$k, $orig->$k) != 0) { diff --git a/_darcs/pristine/classes/Invitation.php b/_darcs/pristine/classes/Invitation.php index ff6456445..8a36fd8df 100644 --- a/_darcs/pristine/classes/Invitation.php +++ b/_darcs/pristine/classes/Invitation.php @@ -17,7 +17,8 @@ class Invitation extends Memcached_DataObject public $created; // datetime() not_null /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Invitation',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Invitation',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/_darcs/pristine/classes/Memcached_DataObject.php b/_darcs/pristine/classes/Memcached_DataObject.php index 1d12730c9..b9f599dbc 100644 --- a/_darcs/pristine/classes/Memcached_DataObject.php +++ b/_darcs/pristine/classes/Memcached_DataObject.php @@ -23,7 +23,8 @@ require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; class Memcached_DataObject extends DB_DataObject { - function &staticGet($cls, $k, $v=null) { + function &staticGet($cls, $k, $v=null) + { if (is_null($v)) { $v = $k; # XXX: HACK! @@ -44,7 +45,8 @@ class Memcached_DataObject extends DB_DataObject } } - function &pkeyGet($cls, $kv) { + function &pkeyGet($cls, $kv) + { $i = Memcached_DataObject::multicache($cls, $kv); if ($i) { return $i; @@ -62,12 +64,14 @@ class Memcached_DataObject extends DB_DataObject } } - function insert() { + function insert() + { $result = parent::insert(); return $result; } - function update($orig=null) { + function update($orig=null) + { if (is_object($orig) && $orig instanceof Memcached_DataObject) { $orig->decache(); # might be different keys } @@ -78,7 +82,8 @@ class Memcached_DataObject extends DB_DataObject return $result; } - function delete() { + function delete() + { $this->decache(); # while we still have the values! return parent::delete(); } @@ -100,7 +105,8 @@ class Memcached_DataObject extends DB_DataObject } } - function keyTypes() { + function keyTypes() + { global $_DB_DATAOBJECT; if (!isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"])) { $this->databaseStructure(); @@ -109,7 +115,8 @@ class Memcached_DataObject extends DB_DataObject return $_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"]; } - function encache() { + function encache() + { $c = $this->memcache(); if (!$c) { return false; @@ -133,7 +140,8 @@ class Memcached_DataObject extends DB_DataObject } } - function decache() { + function decache() + { $c = $this->memcache(); if (!$c) { return false; @@ -158,7 +166,8 @@ class Memcached_DataObject extends DB_DataObject } } - function multicache($cls, $kv) { + function multicache($cls, $kv) + { ksort($kv); $c = Memcached_DataObject::memcache(); if (!$c) { @@ -170,7 +179,8 @@ class Memcached_DataObject extends DB_DataObject } } - function getSearchEngine($table) { + function getSearchEngine($table) + { require_once INSTALLDIR.'/lib/search_engines.php'; static $search_engine; if (!isset($search_engine)) { diff --git a/_darcs/pristine/classes/Message.php b/_darcs/pristine/classes/Message.php index e04fbb3c0..4806057b4 100644 --- a/_darcs/pristine/classes/Message.php +++ b/_darcs/pristine/classes/Message.php @@ -22,16 +22,19 @@ class Message extends Memcached_DataObject public $source; // varchar(32) /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Message',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Message',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function getFrom() { + function getFrom() + { return Profile::staticGet('id', $this->from_profile); } - function getTo() { + function getTo() + { return Profile::staticGet('id', $this->to_profile); } diff --git a/_darcs/pristine/classes/Nonce.php b/_darcs/pristine/classes/Nonce.php index 54d20de9c..2c0edfa14 100644 --- a/_darcs/pristine/classes/Nonce.php +++ b/_darcs/pristine/classes/Nonce.php @@ -18,7 +18,8 @@ class Nonce extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Nonce',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Nonce',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/_darcs/pristine/classes/Notice.php b/_darcs/pristine/classes/Notice.php index e6152812c..d3aa4e828 100644 --- a/_darcs/pristine/classes/Notice.php +++ b/_darcs/pristine/classes/Notice.php @@ -48,23 +48,27 @@ class Notice extends Memcached_DataObject public $source; // varchar(32) /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Notice',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function getProfile() { + function getProfile() + { return Profile::staticGet('id', $this->profile_id); } - function delete() { + function delete() + { $this->blowCaches(true); $this->blowFavesCache(true); $this->blowInboxes(); return parent::delete(); } - function saveTags() { + function saveTags() + { /* extract all #hastags */ $count = preg_match_all('/(?:^|\s)#([A-Za-z0-9_\-\.]{1,64})/', strtolower($this->content), $match); if (!$count) { @@ -184,7 +188,8 @@ class Notice extends Memcached_DataObject return true; } - function blowCaches($blowLast=false) { + function blowCaches($blowLast=false) + { $this->blowSubsCache($blowLast); $this->blowNoticeCache($blowLast); $this->blowRepliesCache($blowLast); @@ -192,7 +197,8 @@ class Notice extends Memcached_DataObject $this->blowTagCache($blowLast); } - function blowTagCache($blowLast=false) { + function blowTagCache($blowLast=false) + { $cache = common_memcache(); if ($cache) { $tag = new Notice_tag(); @@ -210,7 +216,8 @@ class Notice extends Memcached_DataObject } } - function blowSubsCache($blowLast=false) { + function blowSubsCache($blowLast=false) + { $cache = common_memcache(); if ($cache) { $user = new User(); @@ -230,7 +237,8 @@ class Notice extends Memcached_DataObject } } - function blowNoticeCache($blowLast=false) { + function blowNoticeCache($blowLast=false) + { if ($this->is_local) { $cache = common_memcache(); if ($cache) { @@ -242,7 +250,8 @@ class Notice extends Memcached_DataObject } } - function blowRepliesCache($blowLast=false) { + function blowRepliesCache($blowLast=false) + { $cache = common_memcache(); if ($cache) { $reply = new Reply(); @@ -260,7 +269,8 @@ class Notice extends Memcached_DataObject } } - function blowPublicCache($blowLast=false) { + function blowPublicCache($blowLast=false) + { if ($this->is_local == 1) { $cache = common_memcache(); if ($cache) { @@ -272,7 +282,8 @@ class Notice extends Memcached_DataObject } } - function blowFavesCache($blowLast=false) { + function blowFavesCache($blowLast=false) + { $cache = common_memcache(); if ($cache) { $fave = new Fave(); @@ -477,7 +488,8 @@ class Notice extends Memcached_DataObject return $wrapper; } - function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null) { + function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null) + { $parts = array(); @@ -499,7 +511,8 @@ class Notice extends Memcached_DataObject $offset, $limit, $since_id, $before_id, null, $since); } - function addToInboxes() { + function addToInboxes() + { $enabled = common_config('inboxes', 'enabled'); if ($enabled === true || $enabled === 'transitional') { @@ -522,7 +535,8 @@ class Notice extends Memcached_DataObject # Delete from inboxes if we're deleted. - function blowInboxes() { + function blowInboxes() + { $enabled = common_config('inboxes', 'enabled'); diff --git a/_darcs/pristine/classes/NoticeWrapper.php b/_darcs/pristine/classes/NoticeWrapper.php index 19ae37c1b..e1b27c2f7 100644 --- a/_darcs/pristine/classes/NoticeWrapper.php +++ b/_darcs/pristine/classes/NoticeWrapper.php @@ -38,11 +38,13 @@ class NoticeWrapper extends Notice { var $notices = null; var $i = -1; - function __construct($arr) { + function __construct($arr) + { $this->notices = $arr; } - function fetch() { + function fetch() + { static $fields = array('id', 'profile_id', 'uri', 'content', 'rendered', 'url', 'created', 'modified', 'reply_to', 'is_local', 'source'); $this->i++; diff --git a/_darcs/pristine/classes/Notice_inbox.php b/_darcs/pristine/classes/Notice_inbox.php index 922ba2660..81ddb4538 100644 --- a/_darcs/pristine/classes/Notice_inbox.php +++ b/_darcs/pristine/classes/Notice_inbox.php @@ -33,7 +33,8 @@ class Notice_inbox extends Memcached_DataObject public $source; // tinyint(1) default_1 /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/_darcs/pristine/classes/Notice_source.php b/_darcs/pristine/classes/Notice_source.php index a12397b0b..e7568bbca 100644 --- a/_darcs/pristine/classes/Notice_source.php +++ b/_darcs/pristine/classes/Notice_source.php @@ -17,7 +17,8 @@ class Notice_source extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Notice_source',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/_darcs/pristine/classes/Notice_tag.php b/_darcs/pristine/classes/Notice_tag.php index 8c3911f76..94f9296d6 100644 --- a/_darcs/pristine/classes/Notice_tag.php +++ b/_darcs/pristine/classes/Notice_tag.php @@ -30,7 +30,8 @@ class Notice_tag extends Memcached_DataObject public $created; // datetime() not_null /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE @@ -46,7 +47,8 @@ class Notice_tag extends Memcached_DataObject $offset, $limit); } - function blowCache() { + function blowCache() + { $cache = common_memcache(); if ($cache) { $cache->delete(common_cache_key('notice_tag:notice_stream:' . $this->tag)); diff --git a/_darcs/pristine/classes/Profile.php b/_darcs/pristine/classes/Profile.php index b95cbf993..fb6ff90f1 100644 --- a/_darcs/pristine/classes/Profile.php +++ b/_darcs/pristine/classes/Profile.php @@ -41,12 +41,14 @@ class Profile extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Profile',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function getAvatar($width, $height=null) { + function getAvatar($width, $height=null) + { if (is_null($height)) { $height = $width; } @@ -55,7 +57,8 @@ class Profile extends Memcached_DataObject 'height' => $height)); } - function getOriginalAvatar() { + function getOriginalAvatar() + { $avatar = DB_DataObject::factory('avatar'); $avatar->profile_id = $this->id; $avatar->original = true; @@ -66,7 +69,8 @@ class Profile extends Memcached_DataObject } } - function setOriginal($source) { + function setOriginal($source) + { $info = @getimagesize($source); @@ -117,7 +121,8 @@ class Profile extends Memcached_DataObject return $avatar; } - function delete_avatars() { + function delete_avatars() + { $avatar = new Avatar(); $avatar->profile_id = $this->id; $avatar->find(); @@ -127,12 +132,14 @@ class Profile extends Memcached_DataObject return true; } - function getBestName() { + function getBestName() + { return ($this->fullname) ? $this->fullname : $this->nickname; } # Get latest notice on or before date; default now - function getCurrentNotice($dt=null) { + function getCurrentNotice($dt=null) + { $notice = new Notice(); $notice->profile_id = $this->id; if ($dt) { @@ -146,7 +153,8 @@ class Profile extends Memcached_DataObject return null; } - function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) { + function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) + { $qry = 'SELECT * ' . 'FROM notice ' . diff --git a/_darcs/pristine/classes/Profile_block.php b/_darcs/pristine/classes/Profile_block.php index 41d6701eb..551e690e2 100644 --- a/_darcs/pristine/classes/Profile_block.php +++ b/_darcs/pristine/classes/Profile_block.php @@ -36,12 +36,14 @@ class Profile_block extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_block',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Profile_block',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function get($blocker, $blocked) { + function get($blocker, $blocked) + { return Memcached_DataObject::pkeyGet('Profile_block', array('blocker' => $blocker, 'blocked' => $blocked)); diff --git a/_darcs/pristine/classes/Profile_tag.php b/_darcs/pristine/classes/Profile_tag.php index 5c508c84f..cb60cbaec 100644 --- a/_darcs/pristine/classes/Profile_tag.php +++ b/_darcs/pristine/classes/Profile_tag.php @@ -16,7 +16,8 @@ class Profile_tag extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/_darcs/pristine/classes/Queue_item.php b/_darcs/pristine/classes/Queue_item.php index f2fc0be03..1b34d8ab4 100644 --- a/_darcs/pristine/classes/Queue_item.php +++ b/_darcs/pristine/classes/Queue_item.php @@ -16,12 +16,14 @@ class Queue_item extends Memcached_DataObject public $claimed; // datetime() /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Queue_item',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function sequenceKey() { return array(false, false); } + function sequenceKey() + { return array(false, false); } static function top($transport) { diff --git a/_darcs/pristine/classes/Remember_me.php b/_darcs/pristine/classes/Remember_me.php index 9d3f9378f..8dc29bfa3 100644 --- a/_darcs/pristine/classes/Remember_me.php +++ b/_darcs/pristine/classes/Remember_me.php @@ -15,10 +15,12 @@ class Remember_me extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Remember_me',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function sequenceKey() { return array(false, false); } + function sequenceKey() + { return array(false, false); } } diff --git a/_darcs/pristine/classes/Remote_profile.php b/_darcs/pristine/classes/Remote_profile.php index 66b0f3a5c..5aa6d913e 100644 --- a/_darcs/pristine/classes/Remote_profile.php +++ b/_darcs/pristine/classes/Remote_profile.php @@ -38,7 +38,8 @@ class Remote_profile extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/_darcs/pristine/classes/Reply.php b/_darcs/pristine/classes/Reply.php index 10d6ced5b..af86aaf87 100644 --- a/_darcs/pristine/classes/Reply.php +++ b/_darcs/pristine/classes/Reply.php @@ -16,7 +16,8 @@ class Reply extends Memcached_DataObject public $replied_id; // int(4) /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Reply',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Reply',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/_darcs/pristine/classes/Sms_carrier.php b/_darcs/pristine/classes/Sms_carrier.php index b4a9d8655..ffa12de29 100644 --- a/_darcs/pristine/classes/Sms_carrier.php +++ b/_darcs/pristine/classes/Sms_carrier.php @@ -17,12 +17,14 @@ class Sms_carrier extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function toEmailAddress($sms) { + function toEmailAddress($sms) + { return sprintf($this->email_pattern, $sms); } } diff --git a/_darcs/pristine/classes/Subscription.php b/_darcs/pristine/classes/Subscription.php index d70f99550..3fe0d167f 100644 --- a/_darcs/pristine/classes/Subscription.php +++ b/_darcs/pristine/classes/Subscription.php @@ -40,12 +40,14 @@ class Subscription extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Subscription',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Subscription',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function &pkeyGet($kv) { + function &pkeyGet($kv) + { return Memcached_DataObject::pkeyGet('Subscription', $kv); } } diff --git a/_darcs/pristine/classes/Token.php b/_darcs/pristine/classes/Token.php index 3c88444c8..1fabd72f1 100644 --- a/_darcs/pristine/classes/Token.php +++ b/_darcs/pristine/classes/Token.php @@ -19,7 +19,8 @@ class Token extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('Token',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Token',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/_darcs/pristine/classes/User.php b/_darcs/pristine/classes/User.php index 29e6a86e9..90d0ccfe0 100644 --- a/_darcs/pristine/classes/User.php +++ b/_darcs/pristine/classes/User.php @@ -62,16 +62,19 @@ class User extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('User',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function getProfile() { + function getProfile() + { return Profile::staticGet('id', $this->id); } - function isSubscribed($other) { + function isSubscribed($other) + { assert(!is_null($other)); # XXX: cache results of this query $sub = Subscription::pkeyGet(array('subscriber' => $this->id, @@ -81,7 +84,8 @@ class User extends Memcached_DataObject # 'update' won't write key columns, so we have to do it ourselves. - function updateKeys(&$orig) { + function updateKeys(&$orig) + { $parts = array(); foreach (array('nickname', 'email', 'jabber', 'incomingemail', 'sms', 'carrier', 'smsemail', 'language', 'timezone') as $k) { if (strcmp($this->$k, $orig->$k) != 0) { @@ -108,7 +112,8 @@ class User extends Memcached_DataObject return $result; } - function allowed_nickname($nickname) { + function allowed_nickname($nickname) + { # XXX: should already be validated for size, content, etc. static $blacklist = array('rss', 'xrds', 'doc', 'main', 'settings', 'notice', 'user', @@ -118,7 +123,8 @@ class User extends Memcached_DataObject return !in_array($nickname, $merged); } - function getCurrentNotice($dt=null) { + function getCurrentNotice($dt=null) + { $profile = $this->getProfile(); if (!$profile) { return null; @@ -126,11 +132,13 @@ class User extends Memcached_DataObject return $profile->getCurrentNotice($dt); } - function getCarrier() { + function getCarrier() + { return Sms_carrier::staticGet('id', $this->carrier); } - function subscribeTo($other) { + function subscribeTo($other) + { $sub = new Subscription(); $sub->subscriber = $this->id; $sub->subscribed = $other->id; @@ -144,7 +152,8 @@ class User extends Memcached_DataObject return true; } - function hasBlocked($other) { + function hasBlocked($other) + { $block = Profile_block::get($this->id, $other->id); @@ -271,7 +280,8 @@ class User extends Memcached_DataObject # Things we do when the email changes - function emailChanged() { + function emailChanged() + { $invites = new Invitation(); $invites->address = $this->email; @@ -285,7 +295,8 @@ class User extends Memcached_DataObject } } - function hasFave($notice) { + function hasFave($notice) + { $cache = common_memcache(); # XXX: Kind of a hack. @@ -317,12 +328,14 @@ class User extends Memcached_DataObject 'notice_id' => $notice->id)); return ((is_null($fave)) ? false : true); } - function mutuallySubscribed($other) { + function mutuallySubscribed($other) + { return $this->isSubscribed($other) && $other->isSubscribed($this); } - function mutuallySubscribedUsers() { + function mutuallySubscribedUsers() + { # 3-way join; probably should get cached $qry = 'SELECT user.* ' . @@ -336,7 +349,8 @@ class User extends Memcached_DataObject return $user; } - function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) { + function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) + { $qry = 'SELECT notice.* ' . 'FROM notice JOIN reply ON notice.id = reply.notice_id ' . @@ -346,7 +360,8 @@ class User extends Memcached_DataObject $offset, $limit, $since_id, $before_id, null, $since); } - function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) { + function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) + { $profile = $this->getProfile(); if (!$profile) { return null; @@ -355,7 +370,8 @@ class User extends Memcached_DataObject } } - function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE) { + function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE) + { $qry = 'SELECT notice.* ' . 'FROM notice JOIN fave ON notice.id = fave.notice_id ' . @@ -365,7 +381,8 @@ class User extends Memcached_DataObject $offset, $limit); } - function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) { + function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) + { $enabled = common_config('inboxes', 'enabled'); # Complicated code, depending on whether we support inboxes yet @@ -394,7 +411,8 @@ class User extends Memcached_DataObject $order, $since); } - function blowFavesCache() { + function blowFavesCache() + { $cache = common_memcache(); if ($cache) { # Faves don't happen chronologically, so we need to blow @@ -404,15 +422,18 @@ class User extends Memcached_DataObject } } - function getSelfTags() { + function getSelfTags() + { return Profile_tag::getTags($this->id, $this->id); } - function setSelfTags($newtags) { + function setSelfTags($newtags) + { return Profile_tag::setTags($this->id, $this->id, $newtags); } - function block($other) { + function block($other) + { # Add a new block record @@ -450,7 +471,8 @@ class User extends Memcached_DataObject return true; } - function unblock($other) { + function unblock($other) + { # Get the block record diff --git a/_darcs/pristine/classes/User_openid.php b/_darcs/pristine/classes/User_openid.php index 7dc476dc4..f4fda1c72 100644 --- a/_darcs/pristine/classes/User_openid.php +++ b/_darcs/pristine/classes/User_openid.php @@ -17,7 +17,8 @@ class User_openid extends Memcached_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=null) { return Memcached_DataObject::staticGet('User_openid',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('User_openid',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE |