Commit 49611af7 authored by Evan Prodromou's avatar Evan Prodromou

Merge branch '0.9.x'

parents 91f25ca8 d2ef0cf2
......@@ -1086,3 +1086,19 @@ StartDeleteOwnNotice: when a user starts to delete their own notice
EndDeleteOwnNotice: when a user has deleted their own notice
- $user: the user doing the delete
- $notice: the notice being deleted
StartShowFeedLinkList: before showing the feed list in the sidebar
- $action: action being executed
- $feeds: list of feeds to show
EndShowFeedLinkList: after showing the feed list in the sidebar
- $action: action being executed
- $feeds: list of feeds shown
StartShowFeedLink: before showing an individual feed item
- $action: action being executed
- $feed: feed to show
EndShowFeedLink: after showing an individual feed
- $action: action being executed
- $feed: feed to show
......@@ -42,8 +42,9 @@ class Avatar extends Memcached_DataObject
return Memcached_DataObject::pkeyGet('Avatar', $kv);
}
// where should the avatar go for this user?
/**
* Where should the avatar go for this user?
*/
static function filename($id, $extension, $size=null, $extra=null)
{
if ($size) {
......
......@@ -65,5 +65,4 @@ class Consumer extends Memcached_DataObject
$nonce->consumer_key = $this->consumer_key;
$nonce->delete();
}
}
......@@ -74,6 +74,4 @@ class Conversation extends Memcached_DataObject
return $conv;
}
}
......@@ -144,8 +144,11 @@ class Fave extends Memcached_DataObject
common_date_iso8601($this->modified));
$act->time = strtotime($this->modified);
// TRANS: Activity title when marking a notice as favorite.
$act->title = _("Favor");
$act->content = sprintf(_("%s marked notice %s as a favorite."),
// TRANS: Ntofication given when a user marks a notice as favorite.
// TRANS: %1$s is a user nickname or full name, %2$s is a notice URI.
$act->content = sprintf(_("%1$s marked notice %2$s as a favorite."),
$profile->getBestName(),
$notice->uri);
......
......@@ -29,7 +29,6 @@ require_once INSTALLDIR.'/classes/File_to_post.php';
/**
* Table Definition for file
*/
class File extends Memcached_DataObject
{
###START_AUTOCODE
......
......@@ -131,4 +131,3 @@ class File_oembed extends Memcached_DataObject
}
}
}
......@@ -281,4 +281,3 @@ class File_redirection extends Memcached_DataObject
$file_redir->insert();
}
}
......@@ -57,4 +57,3 @@ class File_thumbnail extends Memcached_DataObject
$tn->insert();
}
}
......@@ -67,4 +67,3 @@ class File_to_post extends Memcached_DataObject
return Memcached_DataObject::pkeyGet('File_to_post', $kv);
}
}
......@@ -44,7 +44,6 @@ class Foreign_link extends Memcached_DataObject
$result = $flink->find(true);
return empty($result) ? null : $flink;
}
static function getByForeignID($foreign_id, $service)
......@@ -129,5 +128,4 @@ class Foreign_link extends Memcached_DataObject
return false;
}
}
}
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Foreign_service extends Memcached_DataObject
class Foreign_service extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -12,7 +12,7 @@ class Foreign_service extends Memcached_DataObject
public $__table = 'foreign_service'; // table name
public $id; // int(4) primary_key not_null
public $name; // varchar(32) unique_key not_null
public $description; // varchar(255)
public $description; // varchar(255)
public $created; // datetime() not_null
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
......
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Foreign_subscription extends Memcached_DataObject
class Foreign_subscription extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......
......@@ -83,5 +83,4 @@ class Foreign_user extends Memcached_DataObject
}
return $result;
}
}
......@@ -111,5 +111,4 @@ class Group_block extends Memcached_DataObject
return true;
}
}
<?php
/**
* Table Definition for group_inbox
*/
class Group_inbox extends Memcached_DataObject
{
###START_AUTOCODE
......
......@@ -71,7 +71,9 @@ class Group_member extends Memcached_DataObject
$member = Profile::staticGet('id', $this->profile_id);
if (empty($member)) {
throw new Exception("Profile ID {$this->profile_id} invalid.");
// TRANS: Exception thrown providing an invalid profile ID.
// TRANS: %s is the invalid profile ID.
throw new Exception(sprintf(_("Profile ID %s is invalid."),$this->profile_id));
}
return $member;
......@@ -82,7 +84,9 @@ class Group_member extends Memcached_DataObject
$group = User_group::staticGet('id', $this->group_id);
if (empty($group)) {
throw new Exception("Group ID {$this->group_id} invalid.");
// TRANS: Exception thrown providing an invalid group ID.
// TRANS: %s is the invalid group ID.
throw new Exception(sprintf(_("Group ID %s is invalid."),$this->group_id));
}
return $group;
......@@ -105,6 +109,7 @@ class Group_member extends Memcached_DataObject
$act->objects[] = ActivityObject::fromGroup($group);
$act->time = strtotime($this->created);
// TRANS: Activity title.
$act->title = _("Join");
// TRANS: Success message for subscribe to group attempt through OStatus.
......
......@@ -55,7 +55,6 @@ class Inbox extends Memcached_DataObject
/**
* Create a new inbox from existing Notice_inbox stuff
*/
static function initialize($user_id)
{
$inbox = Inbox::fromNoticeInbox($user_id);
......@@ -115,10 +114,10 @@ class Inbox extends Memcached_DataObject
*/
static function insertNotice($user_id, $notice_id)
{
// Going straight to the DB rather than trusting our caching
// during an update. Note: not using DB_DataObject::staticGet,
// which is unsafe to use directly (in-process caching causes
// memory leaks, which accumulate in queue processes).
// Going straight to the DB rather than trusting our caching
// during an update. Note: not using DB_DataObject::staticGet,
// which is unsafe to use directly (in-process caching causes
// memory leaks, which accumulate in queue processes).
$inbox = new Inbox();
if (!$inbox->get('user_id', $user_id)) {
$inbox = Inbox::initialize($user_id);
......
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Invitation extends Memcached_DataObject
class Invitation extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......
......@@ -189,11 +189,11 @@ class Memcached_DataObject extends Safe_DataObject
str_replace("\n", " ", $e->getTraceAsString()));
return false;
} else {
$keys = $this->_allCacheKeys();
$keys = $this->_allCacheKeys();
foreach ($keys as $key) {
$c->set($key, $this);
}
foreach ($keys as $key) {
$c->set($key, $this);
}
}
}
......@@ -637,4 +637,3 @@ class Memcached_DataObject extends Safe_DataObject
return $vstr;
}
}
......@@ -38,7 +38,6 @@ class Message extends Memcached_DataObject
}
static function saveNew($from, $to, $content, $source) {
$sender = Profile::staticGet('id', $from);
if (!$sender->hasRight(Right::NEWMESSAGE)) {
......
......@@ -36,5 +36,4 @@ class Nonce extends Memcached_DataObject
{
return array('consumer_key,token' => 'token:consumer_key,token');
}
}
......@@ -745,6 +745,7 @@ class Notice extends Memcached_DataObject
1,
1
);
if ($conversation->N > 0) {
return true;
}
......@@ -1305,13 +1306,10 @@ class Notice extends Memcached_DataObject
}
if (Event::handle('StartActivitySource', array(&$this, &$xs))) {
if ($source) {
$atom_feed = $profile->getAtomFeed();
if (!empty($atom_feed)) {
$xs->elementStart('source');
// XXX: we should store the actual feed ID
......@@ -1899,7 +1897,6 @@ class Notice extends Memcached_DataObject
$options = array();
if (!empty($location_id) && !empty($location_ns)) {
$options['location_id'] = $location_id;
$options['location_ns'] = $location_ns;
......@@ -1911,7 +1908,6 @@ class Notice extends Memcached_DataObject
}
} else if (!empty($lat) && !empty($lon)) {
$options['lat'] = $lat;
$options['lon'] = $lon;
......@@ -1922,7 +1918,6 @@ class Notice extends Memcached_DataObject
$options['location_ns'] = $location->location_ns;
}
} else if (!empty($profile)) {
if (isset($profile->lat) && isset($profile->lon)) {
$options['lat'] = $profile->lat;
$options['lon'] = $profile->lon;
......
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Notice_source extends Memcached_DataObject
class Notice_source extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......
......@@ -110,7 +110,6 @@ class Oauth_application extends Memcached_DataObject
*
* @return void
*/
function uploadLogo()
{
if ($_FILES['app_icon']['error'] ==
......@@ -153,5 +152,4 @@ class Oauth_application extends Memcached_DataObject
$oauser->application_id = $this->id;
$oauser->delete();
}
}
......@@ -40,5 +40,4 @@ class Oauth_application_user extends Memcached_DataObject
return empty($result) ? null : $oau;
}
}
......@@ -103,7 +103,6 @@ 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
if (!($avatar->width == $size && $avatar->height == $size)) {
$scaled_filename = $imagefile->resize($size);
//$scaled = DB_DataObject::factory('avatar');
......@@ -790,13 +789,14 @@ class Profile extends Memcached_DataObject
* @param $right string Name of the right, usually a constant in class Right
* @return boolean whether the user has the right in question
*/
function hasRight($right)
{
$result = false;
if ($this->hasRole(Profile_role::DELETED)) {
return false;
}
if (Event::handle('UserRightsCheck', array($this, $right, &$result))) {
switch ($right)
{
......
......@@ -23,7 +23,6 @@ class Profile_tag extends Memcached_DataObject
###END_AUTOCODE
static function getTags($tagger, $tagged) {
$tags = array();
# XXX: store this in memcached
......@@ -44,7 +43,6 @@ class Profile_tag extends Memcached_DataObject
}
static function setTags($tagger, $tagged, $newtags) {
$newtags = array_unique($newtags);
$oldtags = Profile_tag::getTags($tagger, $tagged);
......
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Remember_me extends Memcached_DataObject
class Remember_me extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -16,11 +16,15 @@ class Remember_me extends Memcached_DataObject
/* Static get */
function staticGet($k,$v=null)
{ return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
{
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); }
{
return array(false, false);
}
}
......@@ -24,7 +24,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Remote_profile extends Memcached_DataObject
class Remote_profile extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -32,8 +32,8 @@ class Remote_profile extends Memcached_DataObject
public $__table = 'remote_profile'; // table name
public $id; // int(4) primary_key not_null
public $uri; // varchar(255) unique_key
public $postnoticeurl; // varchar(255)
public $updateprofileurl; // varchar(255)
public $postnoticeurl; // varchar(255)
public $updateprofileurl; // varchar(255)
public $created; // datetime() not_null
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
......@@ -43,7 +43,7 @@ class Remote_profile extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
function hasRight($right)
{
$profile = Profile::staticGet($this->id);
......
......@@ -287,4 +287,3 @@ class Safe_DataObject extends DB_DataObject
return Safe_DataObject::$iniCache[$key];
}
}
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Sms_carrier extends Memcached_DataObject
class Sms_carrier extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -22,7 +22,7 @@ class Sms_carrier extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
function toEmailAddress($sms)
{
return sprintf($this->email_pattern, $sms);
......
......@@ -168,16 +168,16 @@ class Status_network extends Safe_DataObject
$orig->decache();
$result = $this->query($qry);
$this->decache();
return $result;
}
function delete()
{
$this->decache(); # while we still have the values!
return parent::delete();
}
/**
* @param string $servername hostname
* @param string $wildcard hostname suffix to match wildcard config
......@@ -313,7 +313,7 @@ class Status_network extends Safe_DataObject
if (empty($result)) {
return explode('|', $this->tags);
}
return $result;
}
......@@ -331,7 +331,7 @@ class Status_network extends Safe_DataObject
$snt->site_id = $this->site_id;
$snt->tag = $tag;
$snt->created = common_sql_now();
$id = $snt->insert();
if (!$id) {
// TRANS: Exception thrown when a tag cannot be saved.
......@@ -356,7 +356,7 @@ class Status_network extends Safe_DataObject
$tag->free();
}
/**
* Check if this site record has a particular meta-info tag attached.
* @param string $tag
......
......@@ -26,7 +26,7 @@ class Status_network_tag extends Safe_DataObject
public $__table = 'status_network_tag'; // table name
public $site_id; // int(4) primary_key not_null
public $tag; // varchar(64) primary_key not_null
public $tag; // varchar(64) primary_key not_null
public $created; // datetime() not_null
......@@ -34,7 +34,7 @@ class Status_network_tag extends Safe_DataObject
{
global $config;
global $_DB_DATAOBJECT;
$sn = new Status_network();
$sn->_connect();
......
......@@ -251,8 +251,11 @@ class Subscription extends Memcached_DataObject
common_date_iso8601($this->created));
$act->time = strtotime($this->created);
// TRANS: Activity tile when subscribing to another person.
$act->title = _("Follow");
$act->content = sprintf(_("%s is now following %s."),
// TRANS: Notification given when one person starts following another.
// TRANS: %1$s is the subscriber, %2$s is the subscribed.
$act->content = sprintf(_("%1$s is now following %2$s."),
$subscriber->getBestName(),
$subscribed->getBestName());
......
......@@ -465,7 +465,6 @@ class User_group extends Memcached_DataObject
}
static function register($fields) {
// MAGICALLY put fields into current scope
extract($fields);
......
......@@ -18,7 +18,9 @@ class User_username extends Memcached_DataObject
/* Static get */
function staticGet($k,$v=null)
{ return Memcached_DataObject::staticGet('User_username',$k,$v); }
{
return Memcached_DataObject::staticGet('User_username',$k,$v);
}
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
......@@ -37,6 +39,7 @@ class User_username extends Memcached_DataObject
$user_username->provider_name = $provider_name;
$user_username->username = $username;
$user_username->created = DB_DataObject_Cast::dateTime();
if($user_username->insert()){
return $user_username;
}else{
......@@ -57,5 +60,4 @@ class User_username extends Memcached_DataObject
function keys() {
return array('provider_name' => 'K', 'username' => 'K');
}
}
......@@ -44,7 +44,6 @@ require_once INSTALLDIR.'/lib/settingsaction.php';
*
* @see Widget
*/
class AccountSettingsAction extends SettingsAction
{
/**
......@@ -54,7 +53,6 @@ class AccountSettingsAction extends SettingsAction
*
* @return void
*/
function showLocalNav()
{
$menu = new AccountSettingsNav($this);
......@@ -73,7 +71,6 @@ class AccountSettingsAction extends SettingsAction
*
* @see HTMLOutputter
*/
class AccountSettingsNav extends Widget
{
var $action = null;
......@@ -83,7 +80,6 @@ class AccountSettingsNav extends Widget
*
* @param Action $action current action, used for output
*/
function __construct($action=null)
{
parent::__construct($action);
......@@ -95,7 +91,6 @@ class AccountSettingsNav extends Widget
*
* @return void
*/
function show()
{
$action_name = $this->action->trimmed('action');
......
......@@ -314,7 +314,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return nothing
*/
function showFeeds()
{
$feeds = $this->getFeeds();
......@@ -710,7 +709,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return nothing
*/
function showAside()
{
$this->elementStart('div', array('id' => 'aside_primary',
......@@ -731,7 +729,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return void
*/
function showExportData()
{
$feeds = $this->getFeeds();
......@@ -807,6 +804,7 @@ class Action extends HTMLOutputter // lawsuit
// TRANS: Secondary navigation menu option leading to contact information on the StatusNet site.
_('Contact'));
$this->menuItem(common_local_url('doc', array('title' => 'badge')),
// TRANS: Secondary navigation menu option.
_('Badge'));
Event::handle('EndSecondaryNav', array($this));
}
......@@ -954,7 +952,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
return false;
......@@ -1053,7 +1050,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return boolean is read only action?
*/
function isCacheable()
{
return true;
......@@ -1067,7 +1063,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return boolean
*/
function _hasEtag($etag, $if_none_match)
{
$etags = explode(',', $if_none_match);
......@@ -1107,7 +1102,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return integer integer value
*/
function int($key, $defValue=null, $maxValue=null, $minValue=null)
{
$arg = strtolower($this->trimmed($key));
......@@ -1135,7 +1129,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return nothing
*/
function serverError($msg, $code=500)
{
$action = $this->trimmed('action');
......@@ -1151,7 +1144,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return nothing
*/
function clientError($msg, $code=400)
{
$action = $this->trimmed('action');
......@@ -1164,7 +1156,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return string current URL
*/
function selfUrl()
{
list($action, $args) = $this->returnToArgs();
......@@ -1176,7 +1167,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return array two elements: action, other args
*/
function returnToArgs()
{
$action = $this->trimmed('action');
......@@ -1283,7 +1273,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return array Feed object to show in head and links
*/
function getFeeds()
{
return null;
......@@ -1294,7 +1283,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return Design a design object to use
*/
function getDesign()
{
return Design::siteDesign();
......@@ -1308,7 +1296,6 @@ class Action extends HTMLOutputter // lawsuit
*
* @return void
*/
// XXX: Finding this type of check with the same message about 50 times.
// Possible to refactor?