Commit 0a17e7cf authored by Evan Prodromou's avatar Evan Prodromou

Merge remote-tracking branch 'gitorious/1.0.x' into 1.0.x

Conflicts:
	classes/Memcached_DataObject.php
parents ff656a8b 83c988e1
......@@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc.
*
* Show a stream of notices in a particular conversation
*
*
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
......@@ -46,12 +46,11 @@ require_once INSTALLDIR . '/lib/apiauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
class ApiconversationAction extends ApiAuthAction
{
protected $conversation = null;
protected $notices = null;
protected $conversation = null;
protected $notices = null;
/**
* For initializing members of the class.
*
......@@ -59,35 +58,36 @@ class ApiconversationAction extends ApiAuthAction
*
* @return boolean true
*/
function prepare($argarray)
{
parent::prepare($argarray);
$convId = $this->trimmed('id');
if (empty($convId)) {
throw new ClientException(_m('no conversation id'));
// TRANS: Client exception thrown when no conversation ID is given.
throw new ClientException(_('No conversation ID.'));
}
$this->conversation = Conversation::staticGet('id', $convId);
if (empty($this->conversation)) {
throw new ClientException(sprintf(_m('No conversation with id %d'), $convId),
404);
// TRANS: Client exception thrown when referring to a non-existing conversation ID (%d).
throw new ClientException(sprintf(_('No conversation with ID %d.'), $convId),
404);
}
$profile = Profile::current();
$stream = new ConversationNoticeStream($convId, $profile);
$notice = $stream->getNotices(($this->page-1) * $this->count,
$this->count,
$this->since_id,
$this->max_id);
$this->notices = $notice->fetchAll();
return true;
}
......@@ -98,17 +98,16 @@ class ApiconversationAction extends ApiAuthAction
*
* @return void
*/
function handle($argarray=null)
{
$sitename = common_config('site', 'name');
// TRANS: Timeline title for user and friends. %s is a user nickname.
$title = _("Conversation");
// TRANS: Title for conversion timeline.
$title = _m('TITLE', 'Conversation');
$id = common_local_url('apiconversation', array('id' => $this->conversation->id, 'format' => $this->format));
$link = common_local_url('conversation', array('id' => $this->conversation->id));
$self = $id;
switch($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
......@@ -168,7 +167,6 @@ class ApiconversationAction extends ApiAuthAction
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
......@@ -202,7 +200,6 @@ class ApiconversationAction extends ApiAuthAction
*
* @return string etag http header
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
......@@ -220,7 +217,7 @@ class ApiconversationAction extends ApiAuthAction
)
. '"';
}
return null;
}
......@@ -229,7 +226,6 @@ class ApiconversationAction extends ApiAuthAction
*
* @return boolean true if delete, else false
*/
function requiresAuth()
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
......@@ -239,4 +235,4 @@ class ApiconversationAction extends ApiAuthAction
return true;
}
}
}
\ No newline at end of file
}
......@@ -251,21 +251,24 @@ class ShowApplicationAction extends Action
$this->elementStart('div', 'entity_data');
// TRANS: Header on the OAuth application page.
$this->element('h2', null, _('Application info'));
$this->element('div',
'entity_consumer_key',
$consumer->consumer_key);
$this->element('div',
'entity_consumer_secret',
$consumer->consumer_secret);
$this->element('div',
'entity_request_token_url',
common_local_url('ApiOauthRequestToken'));
$this->element('div', 'entity_access_token_url', common_local_url('ApiOauthAccessToken'));
$this->element('div', 'entity_authorize_url', common_local_url('ApiOauthAuthorize'));
$this->elementStart('dl');
// TRANS: Field label on application page.
$this->element('dt', null, _('Consumer key'));
$this->element('dd', null, $consumer->consumer_key);
// TRANS: Field label on application page.
$this->element('dt', null, _('Consumer secret'));
$this->element('dd', null, $consumer->consumer_secret);
// TRANS: Field label on application page.
$this->element('dt', null, _('Request token URL'));
$this->element('dd', null, common_local_url('ApiOauthRequestToken'));
// TRANS: Field label on application page.
$this->element('dt', null, _('Access token URL'));
$this->element('dd', null, common_local_url('ApiOauthAccessToken'));
// TRANS: Field label on application page.
$this->element('dt', null, _('Authorize URL'));
$this->element('dd', null, common_local_url('ApiOauthAuthorize'));
$this->elementEnd('dl');
$this->element('p', 'note',
// TRANS: Note on the OAuth application page about signature support.
......
......@@ -63,44 +63,44 @@ class Memcached_DataObject extends Safe_DataObject
}
return $i;
}
/**
* Get multiple items from the database by key
*
*
* @param string $cls Class to fetch
* @param string $keyCol name of column for key
* @param array $keyVals key values to fetch
* @param boolean $skipNulls return only non-null results?
*
*
* @return array Array of objects, in order
*/
function multiGet($cls, $keyCol, $keyVals, $skipNulls=true)
{
$result = self::pivotGet($cls, $keyCol, $keyVals);
$values = array_values($result);
if ($skipNulls) {
$tmp = array();
foreach ($values as $value) {
if (!empty($value)) {
$tmp[] = $value;
}
}
$values = $tmp;
}
return new ArrayWrapper($values);
$result = self::pivotGet($cls, $keyCol, $keyVals);
$values = array_values($result);
if ($skipNulls) {
$tmp = array();
foreach ($values as $value) {
if (!empty($value)) {
$tmp[] = $value;
}
}
$values = $tmp;
}
return new ArrayWrapper($values);
}
/**
* Get multiple items from the database by key
*
*
* @param string $cls Class to fetch
* @param string $keyCol name of column for key
* @param array $keyVals key values to fetch
* @param boolean $otherCols Other columns to hold fixed
*
*
* @return array Array mapping $keyVals to objects, or null if not found
*/
static function pivotGet($cls, $keyCol, $keyVals, $otherCols = array())
......@@ -346,7 +346,7 @@ class Memcached_DataObject extends Safe_DataObject
}
/**
* @fixme Should this return false on lookup fail to match staticGet?
* @todo FIXME: Should this return false on lookup fail to match staticGet?
*/
function pkeyGet($cls, $kv)
{
......@@ -359,13 +359,13 @@ class Memcached_DataObject extends Safe_DataObject
return false;
}
foreach ($kv as $k => $v) {
if (is_null($v)) {
// XXX: possible SQL injection...? Don't
// pass keys from the browser, eh.
$i->whereAdd("$k is null");
} else {
$i->$k = $v;
}
if (is_null($v)) {
// XXX: possible SQL injection...? Don't
// pass keys from the browser, eh.
$i->whereAdd("$k is null");
} else {
$i->$k = $v;
}
}
if ($i->find(true)) {
$i->encache();
......@@ -696,7 +696,7 @@ class Memcached_DataObject extends Safe_DataObject
continue;
}
if (in_array($func, $ignoreStatic)) {
continue; // @fixme this shouldn't be needed?
continue; // @todo FIXME: This shouldn't be needed?
}
$here = get_class($frame['object']) . '->' . $func;
break;
......@@ -839,7 +839,7 @@ class Memcached_DataObject extends Safe_DataObject
if (!$dsn) {
// TRANS: Exception thrown when database name or Data Source Name could not be found.
throw new Exception(_("No database name or DSN found anywhere."));
throw new Exception(_('No database name or DSN found anywhere.'));
}
return $dsn;
......
......@@ -136,7 +136,7 @@ class FavorForm extends Form
'submit',
null,
// TRANS: Button title for adding the favourite status to a notice.
_('Add this notice to your list of favorite notices.');
_('Add this notice to your list of favorite notices.'));
}
/**
......
......@@ -84,8 +84,10 @@ class GroupsNav extends MoreMenu
function seeAllItem() {
return array('usergroups',
array('nickname' => $this->user->nickname),
// TRANS: Link description for seeing all groups.
_('See all'),
_('See all groups you belong to'));
// TRANS: Link title for seeing all groups.
_('See all groups you belong to.'));
}
}
......@@ -58,11 +58,11 @@ class ListsNav extends MoreMenu
{
return 'lists';
}
function getItems()
{
$items = array();
while ($this->lists->fetch()) {
$mode = $this->lists->private ? 'private' : 'public';
$items[] = array('showprofiletag',
......@@ -84,7 +84,9 @@ class ListsNav extends MoreMenu
{
return array('peopletagsbyuser',
array('nickname' => $this->profile->nickname),
// TRANS: Link description for seeing all lists.
_('See all'),
_('See all lists you have created'));
// TRANS: Link title for seeing all lists.
_('See all lists you have created.'));
}
}
......@@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc.
*
* A menu with a More... button to show more elements
*
*
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
......@@ -44,12 +44,11 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
class MoreMenu extends Menu
{
const SOFT_MAX = 5;
const HARD_MAX = 15;
/**
* Show a menu with a limited number of elements
*
......@@ -57,7 +56,6 @@ class MoreMenu extends Menu
*
* @return
*/
function show()
{
$items = $this->getItems();
......@@ -72,7 +70,6 @@ class MoreMenu extends Menu
}
if (Event::handle('StartNav', array($this, &$tag, &$items))) {
$this->out->elementStart('ul', $attrs);
$total = count($items);
......@@ -89,10 +86,10 @@ class MoreMenu extends Menu
}
if ($total > self::SOFT_MAX + 1) {
$this->out->elementStart('li', array('class' => 'more_link'));
$this->out->element('a', array('href' => '#',
'onclick' => 'SN.U.showMoreMenuItems("'.$menuID.'"); return false;'),
// TRANS: Link description to show more items in a list.
_('More ▼'));
$this->out->elementEnd('li');
......@@ -112,7 +109,7 @@ class MoreMenu extends Menu
}
}
}
$this->out->elementEnd('ul');
Event::handle('EndNav', array($this, $tag, $items));
......@@ -123,5 +120,4 @@ class MoreMenu extends Menu
{
return null;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-08-15 14:19+0000\n"
"POT-Creation-Date: 2011-08-20 18:34+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-08-15 14:19+0000\n"
"POT-Creation-Date: 2011-08-20 18:34+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-08-15 14:19+0000\n"
"POT-Creation-Date: 2011-08-20 18:34+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-08-15 14:19+0000\n"
"POT-Creation-Date: 2011-08-20 18:34+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.