summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/accountsettingsaction.php30
-rw-r--r--lib/action.php54
-rw-r--r--lib/activity.php3
-rw-r--r--lib/adminpanelaction.php11
-rw-r--r--lib/apiaction.php66
-rw-r--r--lib/apiauth.php24
-rw-r--r--lib/apibareauth.php3
-rw-r--r--lib/apiprivateauth.php1
-rw-r--r--lib/applicationeditform.php41
-rw-r--r--lib/applicationlist.php17
-rw-r--r--lib/atomgroupnoticefeed.php3
-rw-r--r--lib/atomusernoticefeed.php3
-rw-r--r--lib/attachmentlist.php3
-rw-r--r--lib/authenticationplugin.php1
-rw-r--r--lib/authorizationplugin.php5
-rw-r--r--lib/command.php36
-rw-r--r--lib/htmloutputter.php1
-rw-r--r--lib/installer.php1
-rw-r--r--lib/language.php6
-rw-r--r--lib/mailhandler.php4
-rw-r--r--lib/mediafile.php2
-rw-r--r--lib/noticeform.php4
-rw-r--r--lib/noticelist.php12
-rw-r--r--lib/pgsqlschema.php55
-rw-r--r--lib/popularnoticesection.php2
-rw-r--r--lib/profileaction.php12
-rw-r--r--lib/themeuploader.php4
-rw-r--r--lib/util.php20
-rw-r--r--lib/xrdsoutputter.php1
29 files changed, 343 insertions, 82 deletions
diff --git a/lib/accountsettingsaction.php b/lib/accountsettingsaction.php
index c79a1f5d7..57740f8b8 100644
--- a/lib/accountsettingsaction.php
+++ b/lib/accountsettingsaction.php
@@ -105,27 +105,45 @@ class AccountSettingsNav extends Widget
$user = common_current_user();
if(Event::handle('StartAccountSettingsProfileMenuItem', array($this, &$menu))){
- $this->showMenuItem('profilesettings',_('Profile'),_('Change your profile settings'));
+ // TRANS: Link title attribute in user account settings menu.
+ $title = _('Change your profile settings');
+ // TRANS: Link description in user account settings menu.
+ $this->showMenuItem('profilesettings',_('Profile'),$title);
Event::handle('EndAccountSettingsProfileMenuItem', array($this, &$menu));
}
if(Event::handle('StartAccountSettingsAvatarMenuItem', array($this, &$menu))){
- $this->showMenuItem('avatarsettings',_('Avatar'),_('Upload an avatar'));
+ // TRANS: Link title attribute in user account settings menu.
+ $title = _('Upload an avatar');
+ // TRANS: Link description in user account settings menu.
+ $this->showMenuItem('avatarsettings',_('Avatar'),$title);
Event::handle('EndAccountSettingsAvatarMenuItem', array($this, &$menu));
}
if(Event::handle('StartAccountSettingsPasswordMenuItem', array($this, &$menu))){
- $this->showMenuItem('passwordsettings',_('Password'),_('Change your password'));
+ // TRANS: Link title attribute in user account settings menu.
+ $title = _('Change your password');
+ // TRANS: Link description in user account settings menu.
+ $this->showMenuItem('passwordsettings',_('Password'),$title);
Event::handle('EndAccountSettingsPasswordMenuItem', array($this, &$menu));
}
if(Event::handle('StartAccountSettingsEmailMenuItem', array($this, &$menu))){
- $this->showMenuItem('emailsettings',_('Email'),_('Change email handling'));
+ // TRANS: Link title attribute in user account settings menu.
+ $title = _('Change email handling');
+ // TRANS: Link description in user account settings menu.
+ $this->showMenuItem('emailsettings',_('Email'),$title);
Event::handle('EndAccountSettingsEmailMenuItem', array($this, &$menu));
}
if(Event::handle('StartAccountSettingsDesignMenuItem', array($this, &$menu))){
- $this->showMenuItem('userdesignsettings',_('Design'),_('Design your profile'));
+ // TRANS: Link title attribute in user account settings menu.
+ $title = _('Design your profile');
+ // TRANS: Link description in user account settings menu.
+ $this->showMenuItem('userdesignsettings',_('Design'),$title);
Event::handle('EndAccountSettingsDesignMenuItem', array($this, &$menu));
}
if(Event::handle('StartAccountSettingsOtherMenuItem', array($this, &$menu))){
- $this->showMenuItem('othersettings',_('Other'),_('Other options'));
+ // TRANS: Link title attribute in user account settings menu.
+ $title = _('Other options');
+ // TRANS: Link description in user account settings menu.
+ $this->showMenuItem('othersettings',_('Other'),$title);
Event::handle('EndAccountSettingsOtherMenuItem', array($this, &$menu));
}
diff --git a/lib/action.php b/lib/action.php
index 22ea4f275..2b3b707c5 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -141,6 +141,7 @@ class Action extends HTMLOutputter // lawsuit
function showTitle()
{
$this->element('title', null,
+ // TRANS: Page title. %1$s is the title, %2$s is the site name.
sprintf(_("%1\$s - %2\$s"),
$this->title(),
common_config('site', 'name')));
@@ -156,6 +157,7 @@ class Action extends HTMLOutputter // lawsuit
function title()
{
+ // TRANS: Page title for a page without a title set.
return _("Untitled page");
}
@@ -430,6 +432,7 @@ class Action extends HTMLOutputter // lawsuit
{
$user = common_current_user();
$this->elementStart('dl', array('id' => 'site_nav_global_primary'));
+ // TRANS: DT element for primary navigation menu. String is hidden in default CSS.
$this->element('dt', null, _('Primary site navigation'));
$this->elementStart('dd');
$this->elementStart('ul', array('class' => 'nav'));
@@ -437,31 +440,31 @@ class Action extends HTMLOutputter // lawsuit
if ($user) {
// TRANS: Tooltip for main menu option "Personal"
$tooltip = _m('TOOLTIP', 'Personal profile and friends timeline');
- // TRANS: Main menu option when logged in for access to personal profile and friends timeline
$this->menuItem(common_local_url('all', array('nickname' => $user->nickname)),
+ // TRANS: Main menu option when logged in for access to personal profile and friends timeline
_m('MENU', 'Personal'), $tooltip, false, 'nav_home');
// TRANS: Tooltip for main menu option "Account"
$tooltip = _m('TOOLTIP', 'Change your email, avatar, password, profile');
- // TRANS: Main menu option when logged in for access to user settings
$this->menuItem(common_local_url('profilesettings'),
+ // TRANS: Main menu option when logged in for access to user settings
_('Account'), $tooltip, false, 'nav_account');
// TRANS: Tooltip for main menu option "Services"
$tooltip = _m('TOOLTIP', 'Connect to services');
- // TRANS: Main menu option when logged in and connection are possible for access to options to connect to other services
$this->menuItem(common_local_url('oauthconnectionssettings'),
+ // TRANS: Main menu option when logged in and connection are possible for access to options to connect to other services
_('Connect'), $tooltip, false, 'nav_connect');
if ($user->hasRight(Right::CONFIGURESITE)) {
// TRANS: Tooltip for menu option "Admin"
$tooltip = _m('TOOLTIP', 'Change site configuration');
- // TRANS: Main menu option when logged in and site admin for access to site configuration
$this->menuItem(common_local_url('siteadminpanel'),
+ // TRANS: Main menu option when logged in and site admin for access to site configuration
_m('MENU', 'Admin'), $tooltip, false, 'nav_admin');
}
if (common_config('invite', 'enabled')) {
// TRANS: Tooltip for main menu option "Invite"
$tooltip = _m('TOOLTIP', 'Invite friends and colleagues to join you on %s');
- // TRANS: Main menu option when logged in and invitations are allowed for inviting new users
$this->menuItem(common_local_url('invite'),
+ // TRANS: Main menu option when logged in and invitations are allowed for inviting new users
_m('MENU', 'Invite'),
sprintf($tooltip,
common_config('site', 'name')),
@@ -469,16 +472,16 @@ class Action extends HTMLOutputter // lawsuit
}
// TRANS: Tooltip for main menu option "Logout"
$tooltip = _m('TOOLTIP', 'Logout from the site');
- // TRANS: Main menu option when logged in to log out the current user
$this->menuItem(common_local_url('logout'),
+ // TRANS: Main menu option when logged in to log out the current user
_m('MENU', 'Logout'), $tooltip, false, 'nav_logout');
}
else {
if (!common_config('site', 'closed') && !common_config('site', 'inviteonly')) {
// TRANS: Tooltip for main menu option "Register"
$tooltip = _m('TOOLTIP', 'Create an account');
- // TRANS: Main menu option when not logged in to register a new account
$this->menuItem(common_local_url('register'),
+ // TRANS: Main menu option when not logged in to register a new account
_m('MENU', 'Register'), $tooltip, false, 'nav_register');
}
// TRANS: Tooltip for main menu option "Login"
@@ -585,6 +588,7 @@ class Action extends HTMLOutputter // lawsuit
function showLocalNavBlock()
{
$this->elementStart('dl', array('id' => 'site_nav_local_views'));
+ // TRANS: DT element for local views block. String is hidden in default CSS.
$this->element('dt', null, _('Local views'));
$this->elementStart('dd');
$this->showLocalNav();
@@ -651,6 +655,7 @@ class Action extends HTMLOutputter // lawsuit
$this->elementStart('dl', array('id' => 'page_notice',
'class' => 'system_notice'));
+ // TRANS: DT element for page notice. String is hidden in default CSS.
$this->element('dt', null, _('Page notice'));
$this->elementStart('dd');
if (Event::handle('StartShowPageNotice', array($this))) {
@@ -753,28 +758,37 @@ class Action extends HTMLOutputter // lawsuit
function showSecondaryNav()
{
$this->elementStart('dl', array('id' => 'site_nav_global_secondary'));
+ // TRANS: DT element for secondary navigation menu. String is hidden in default CSS.
$this->element('dt', null, _('Secondary site navigation'));
$this->elementStart('dd', null);
$this->elementStart('ul', array('class' => 'nav'));
if (Event::handle('StartSecondaryNav', array($this))) {
$this->menuItem(common_local_url('doc', array('title' => 'help')),
+ // TRANS: Secondary navigation menu option leading to help on StatusNet.
_('Help'));
$this->menuItem(common_local_url('doc', array('title' => 'about')),
+ // TRANS: Secondary navigation menu option leading to text about StatusNet site.
_('About'));
$this->menuItem(common_local_url('doc', array('title' => 'faq')),
+ // TRANS: Secondary navigation menu option leading to Frequently Asked Questions.
_('FAQ'));
$bb = common_config('site', 'broughtby');
if (!empty($bb)) {
$this->menuItem(common_local_url('doc', array('title' => 'tos')),
+ // TRANS: Secondary navigation menu option leading to Terms of Service.
_('TOS'));
}
$this->menuItem(common_local_url('doc', array('title' => 'privacy')),
+ // TRANS: Secondary navigation menu option leading to privacy policy.
_('Privacy'));
$this->menuItem(common_local_url('doc', array('title' => 'source')),
+ // TRANS: Secondary navigation menu option.
_('Source'));
$this->menuItem(common_local_url('version'),
+ // TRANS: Secondary navigation menu option leading to version information on the StatusNet site.
_('Version'));
$this->menuItem(common_local_url('doc', array('title' => 'contact')),
+ // TRANS: Secondary navigation menu option leading to contact information on the StatusNet site.
_('Contact'));
$this->menuItem(common_local_url('doc', array('title' => 'badge')),
_('Badge'));
@@ -805,16 +819,18 @@ class Action extends HTMLOutputter // lawsuit
*/
function showStatusNetLicense()
{
+ // TRANS: DT element for StatusNet software license.
$this->element('dt', array('id' => 'site_statusnet_license'), _('StatusNet software license'));
$this->elementStart('dd', null);
- // @fixme drop the final spaces in the messages when at good spot
- // to let translations get updated.
if (common_config('site', 'broughtby')) {
- $instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%). ');
+ // TRANS: First sentence of the StatusNet site license. Used if 'broughtby' is set.
+ $instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%).');
} else {
- $instr = _('**%%site.name%%** is a microblogging service. ');
+ // TRANS: First sentence of the StatusNet site license. Used if 'broughtby' is not set.
+ $instr = _('**%%site.name%%** is a microblogging service.');
}
$instr .= ' ';
+ // TRANS: Second sentence of the StatusNet site license. Mentions the StatusNet source code license.
$instr .= sprintf(_('It runs the [StatusNet](http://status.net/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), STATUSNET_VERSION);
$output = common_markup_to_html($instr);
$this->raw($output);
@@ -830,19 +846,25 @@ class Action extends HTMLOutputter // lawsuit
function showContentLicense()
{
if (Event::handle('StartShowContentLicense', array($this))) {
+ // TRANS: DT element for StatusNet site content license.
$this->element('dt', array('id' => 'site_content_license'), _('Site content license'));
$this->elementStart('dd', array('id' => 'site_content_license_cc'));
switch (common_config('license', 'type')) {
case 'private':
+ // TRANS: Content license displayed when license is set to 'private'.
+ // TRANS: %1$s is the site name.
$this->element('p', null, sprintf(_('Content and data of %1$s are private and confidential.'),
common_config('site', 'name')));
// fall through
case 'allrightsreserved':
if (common_config('license', 'owner')) {
+ // TRANS: Content license displayed when license is set to 'allrightsreserved'.
+ // TRANS: %1$s is the copyright owner.
$this->element('p', null, sprintf(_('Content and data copyright by %1$s. All rights reserved.'),
common_config('license', 'owner')));
} else {
+ // TRANS: Content license displayed when license is set to 'allrightsreserved' and no owner is set.
$this->element('p', null, _('Content and data copyright by contributors. All rights reserved.'));
}
break;
@@ -1158,11 +1180,15 @@ class Action extends HTMLOutputter // lawsuit
*
* @return nothing
*/
+ // XXX: The messages in this pagination method only tailor to navigating
+ // notices. In other lists, "Previous"/"Next" type navigation is
+ // desirable, but not available.
function pagination($have_before, $have_after, $page, $action, $args=null)
{
// Does a little before-after block for next/prev page
if ($have_before || $have_after) {
$this->elementStart('dl', 'pagination');
+ // TRANS: DT element for pagination (previous/next, etc.).
$this->element('dt', null, _('Pagination'));
$this->elementStart('dd', null);
$this->elementStart('ul', array('class' => 'nav'));
@@ -1172,6 +1198,8 @@ class Action extends HTMLOutputter // lawsuit
$this->elementStart('li', array('class' => 'nav_prev'));
$this->element('a', array('href' => common_local_url($action, $args, $pargs),
'rel' => 'prev'),
+ // TRANS: Pagination message to go to a page displaying information more in the
+ // TRANS: present than the currently displayed information.
_('After'));
$this->elementEnd('li');
}
@@ -1180,6 +1208,8 @@ class Action extends HTMLOutputter // lawsuit
$this->elementStart('li', array('class' => 'nav_next'));
$this->element('a', array('href' => common_local_url($action, $args, $pargs),
'rel' => 'next'),
+ // TRANS: Pagination message to go to a page displaying information more in the
+ // TRANS: past than the currently displayed information.
_('Before'));
$this->elementEnd('li');
}
@@ -1223,6 +1253,8 @@ class Action extends HTMLOutputter // lawsuit
* @return void
*/
+ // XXX: Finding this type of check with the same message about 50 times.
+ // Possible to refactor?
function checkSessionToken()
{
// CSRF protection
diff --git a/lib/activity.php b/lib/activity.php
index 27f09ab4d..8e2da99bb 100644
--- a/lib/activity.php
+++ b/lib/activity.php
@@ -118,7 +118,8 @@ class Activity
// Insist on a feed's root DOMElement; don't allow a DOMDocument
if ($feed instanceof DOMDocument) {
throw new ClientException(
- _("Expecting a root feed element but got a whole XML document.")
+ // TRANS: Client exception thrown when a feed instance is a DOMDocument.
+ _('Expecting a root feed element but got a whole XML document.')
);
}
diff --git a/lib/adminpanelaction.php b/lib/adminpanelaction.php
index 7d6a616eb..41cfe5851 100644
--- a/lib/adminpanelaction.php
+++ b/lib/adminpanelaction.php
@@ -69,7 +69,7 @@ class AdminPanelAction extends Action
// User must be logged in.
if (!common_logged_in()) {
- // TRANS: Client error message
+ // TRANS: Client error message thrown when trying to access the admin panel while not logged in.
$this->clientError(_('Not logged in.'));
return false;
}
@@ -94,7 +94,7 @@ class AdminPanelAction extends Action
// User must have the right to change admin settings
if (!$user->hasRight(Right::CONFIGURESITE)) {
- // TRANS: Client error message
+ // TRANS: Client error message thrown when a user tries to change admin settings but has no access rights.
$this->clientError(_('You cannot make changes to this site.'));
return false;
}
@@ -106,7 +106,7 @@ class AdminPanelAction extends Action
$name = mb_substr($name, 0, -10);
if (!self::canAdmin($name)) {
- // TRANS: Client error message
+ // TRANS: Client error message throw when a certain panel's settings cannot be changed.
$this->clientError(_('Changes to that panel are not allowed.'), 403);
return false;
}
@@ -225,7 +225,7 @@ class AdminPanelAction extends Action
function showForm()
{
- // TRANS: Client error message
+ // TRANS: Client error message.
$this->clientError(_('showForm() not implemented.'));
return;
}
@@ -279,7 +279,8 @@ class AdminPanelAction extends Action
$result = $config->delete();
if (!$result) {
common_log_db_error($config, 'DELETE', __FILE__);
- // TRANS: Client error message
+ // TRANS: Client error message thrown if design settings could not be deleted in
+ // TRANS: the admin panel Design.
$this->clientError(_("Unable to delete design setting."));
return null;
}
diff --git a/lib/apiaction.php b/lib/apiaction.php
index 226481778..89a487102 100644
--- a/lib/apiaction.php
+++ b/lib/apiaction.php
@@ -28,10 +28,72 @@
* @author Toby Inkster <mail@tobyinkster.co.uk>
* @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
+ * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
+/* External API usage documentation. Please update when you change how the API works. */
+
+/*! @mainpage StatusNet REST API
+
+ @section Introduction
+
+ Some explanatory text about the API would be nice.
+
+ @section API Methods
+
+ @subsection timelinesmethods_sec Timeline Methods
+
+ @li @ref publictimeline
+ @li @ref friendstimeline
+
+ @subsection statusmethods_sec Status Methods
+
+ @li @ref statusesupdate
+
+ @subsection usermethods_sec User Methods
+
+ @subsection directmessagemethods_sec Direct Message Methods
+
+ @subsection friendshipmethods_sec Friendship Methods
+
+ @subsection socialgraphmethods_sec Social Graph Methods
+
+ @subsection accountmethods_sec Account Methods
+
+ @subsection favoritesmethods_sec Favorites Methods
+
+ @subsection blockmethods_sec Block Methods
+
+ @subsection oauthmethods_sec OAuth Methods
+
+ @subsection helpmethods_sec Help Methods
+
+ @subsection groupmethods_sec Group Methods
+
+ @page apiroot API Root
+
+ The URLs for methods referred to in this API documentation are
+ relative to the StatusNet API root. The API root is determined by the
+ site's @b server and @b path variables, which are generally specified
+ in config.php. For example:
+
+ @code
+ $config['site']['server'] = 'example.org';
+ $config['site']['path'] = 'statusnet'
+ @endcode
+
+ The pattern for a site's API root is: @c protocol://server/path/api E.g:
+
+ @c http://example.org/statusnet/api
+
+ The @b path can be empty. In that case the API root would simply be:
+
+ @c http://example.org/api
+
+*/
+
if (!defined('STATUSNET')) {
exit(1);
}
@@ -111,6 +173,7 @@ class ApiAction extends Action
function handle($args)
{
+ header('Access-Control-Allow-Origin: *');
parent::handle($args);
}
@@ -1126,6 +1189,7 @@ class ApiAction extends Action
$this->initTwitterAtom();
break;
default:
+ // TRANS: Client error on an API request with an unsupported data format.
$this->clientError(_('Not a supported data format.'));
break;
}
@@ -1154,6 +1218,7 @@ class ApiAction extends Action
$this->endTwitterRss();
break;
default:
+ // TRANS: Client error on an API request with an unsupported data format.
$this->clientError(_('Not a supported data format.'));
break;
}
@@ -1270,6 +1335,7 @@ class ApiAction extends Action
$this->showJsonObjects($profile_array);
break;
default:
+ // TRANS: Client error on an API request with an unsupported data format.
$this->clientError(_('Not a supported data format.'));
return;
}
diff --git a/lib/apiauth.php b/lib/apiauth.php
index 95acbbd7b..91cb64262 100644
--- a/lib/apiauth.php
+++ b/lib/apiauth.php
@@ -30,10 +30,29 @@
* @author Sarven Capadisli <csarven@status.net>
* @author Zach Copley <zach@status.net>
* @copyright 2009-2010 StatusNet, Inc.
+ * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
+/* External API usage documentation. Please update when you change how this method works. */
+
+/*! @page authentication Authentication
+
+ StatusNet supports HTTP Basic Authentication and OAuth for API calls.
+
+ @warning Currently, users who have created accounts without setting a
+ password via OpenID, Facebook Connect, etc., cannot use the API until
+ they set a password with their account settings panel.
+
+ @section HTTP Basic Auth
+
+
+
+ @section OAuth
+
+*/
+
if (!defined('STATUSNET')) {
exit(1);
}
@@ -90,6 +109,7 @@ class ApiAuthAction extends ApiAction
if ($this->isReadOnly($args) == false) {
if ($this->access != self::READ_WRITE) {
+ // TRANS: Client error 401.
$msg = _('API resource requires read-write access, ' .
'but you only have read access.');
$this->clientError($msg, 401, $this->format);
@@ -272,8 +292,8 @@ class ApiAuthAction extends ApiAction
list($proxy, $ip) = common_client_ip();
- $msg = sprintf(_('Failed API auth attempt, nickname = %1$s, ' .
- 'proxy = %2$s, ip = %3$s'),
+ $msg = sprintf( 'Failed API auth attempt, nickname = %1$s, ' .
+ 'proxy = %2$s, ip = %3$s',
$this->auth_user_nickname,
$proxy,
$ip);
diff --git a/lib/apibareauth.php b/lib/apibareauth.php
index 2d29c1ddd..da7af1261 100644
--- a/lib/apibareauth.php
+++ b/lib/apibareauth.php
@@ -32,6 +32,7 @@
* @author Sarven Capadisli <csarven@status.net>
* @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
+ * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -106,4 +107,4 @@ class ApiBareAuthAction extends ApiAuthAction
return false;
}
-} \ No newline at end of file
+}
diff --git a/lib/apiprivateauth.php b/lib/apiprivateauth.php
index 5d0033005..5e78c65a1 100644
--- a/lib/apiprivateauth.php
+++ b/lib/apiprivateauth.php
@@ -31,6 +31,7 @@
* @author Sarven Capadisli <csarven@status.net>
* @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
+ * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
diff --git a/lib/applicationeditform.php b/lib/applicationeditform.php
index 9b7d05861..81c8fb018 100644
--- a/lib/applicationeditform.php
+++ b/lib/applicationeditform.php
@@ -133,6 +133,7 @@ class ApplicationEditForm extends Form
function formLegend()
{
+ // TRANS: Form legend.
$this->out->element('legend', null, _('Edit application'));
}
@@ -177,10 +178,12 @@ class ApplicationEditForm extends Form
}
$this->out->element('label', array('for' => 'app_icon'),
+ // TRANS: Form input field label for application icon.
_('Icon'));
$this->out->element('input', array('name' => 'app_icon',
'type' => 'file',
'id' => 'app_icon'));
+ // TRANS: Form guide.
$this->out->element('p', 'form_guide', _('Icon for this application'));
$this->out->element('input', array('name' => 'MAX_FILE_SIZE',
'type' => 'hidden',
@@ -192,6 +195,7 @@ class ApplicationEditForm extends Form
$this->out->hidden('application_id', $id);
+ // TRANS: Form input field label for application name.
$this->out->input('name', _('Name'),
($this->out->arg('name')) ? $this->out->arg('name') : $name);
@@ -201,11 +205,14 @@ class ApplicationEditForm extends Form
$maxDesc = Oauth_application::maxDesc();
if ($maxDesc > 0) {
+ // TRANS: Form input field instructions.
$descInstr = sprintf(_('Describe your application in %d characters'),
$maxDesc);
} else {
+ // TRANS: Form input field instructions.
$descInstr = _('Describe your application');
}
+ // TRANS: Form input field label.
$this->out->textarea('description', _('Description'),
($this->out->arg('description')) ? $this->out->arg('description') : $description,
$descInstr);
@@ -213,27 +220,39 @@ class ApplicationEditForm extends Form
$this->out->elementEnd('li');
$this->out->elementStart('li');
+ // TRANS: Form input field instructions.
+ $instruction = _('URL of the homepage of this application');
+ // TRANS: Form input field label.
$this->out->input('source_url', _('Source URL'),
($this->out->arg('source_url')) ? $this->out->arg('source_url') : $source_url,
- _('URL of the homepage of this application'));
+ $instruction);
$this->out->elementEnd('li');
$this->out->elementStart('li');
+ // TRANS: Form input field instructions.
+ $instruction = _('Organization responsible for this application');
+ // TRANS: Form input field label.
$this->out->input('organization', _('Organization'),
($this->out->arg('organization')) ? $this->out->arg('organization') : $organization,
- _('Organization responsible for this application'));
+ $instruction);
$this->out->elementEnd('li');
$this->out->elementStart('li');
+ // TRANS: Form input field instructions.
+ $instruction = _('URL for the homepage of the organization');
+ // TRANS: Form input field label.
$this->out->input('homepage', _('Homepage'),
($this->out->arg('homepage')) ? $this->out->arg('homepage') : $homepage,
- _('URL for the homepage of the organization'));
+ $instruction);
$this->out->elementEnd('li');
$this->out->elementStart('li');
+ // TRANS: Form input field instructions.
+ $instruction = _('URL to redirect to after authentication');
+ // TRANS: Form input field label.
$this->out->input('callback_url', ('Callback URL'),
($this->out->arg('callback_url')) ? $this->out->arg('callback_url') : $callback_url,
- _('URL to redirect to after authentication'));
+ $instruction);
$this->out->elementEnd('li');
$this->out->elementStart('li', array('id' => 'application_types'));
@@ -255,6 +274,7 @@ class ApplicationEditForm extends Form
$this->out->element('label', array('for' => 'app_type-browser',
'class' => 'radio'),
+ // TRANS: Radio button label for application type
_('Browser'));
$attrs = array('name' => 'app_type',
@@ -271,7 +291,9 @@ class ApplicationEditForm extends Form
$this->out->element('label', array('for' => 'app_type-desktop',
'class' => 'radio'),
+ // TRANS: Radio button label for application type
_('Desktop'));
+ // TRANS: Form guide.
$this->out->element('p', 'form_guide', _('Type of application, browser or desktop'));
$this->out->elementEnd('li');
@@ -294,6 +316,7 @@ class ApplicationEditForm extends Form
$this->out->element('label', array('for' => 'default_access_type-ro',
'class' => 'radio'),
+ // TRANS: Radio button label for access type.
_('Read-only'));
$attrs = array('name' => 'default_access_type',
@@ -312,7 +335,9 @@ class ApplicationEditForm extends Form
$this->out->element('label', array('for' => 'default_access_type-rw',
'class' => 'radio'),
+ // TRANS: Radio button label for access type.
_('Read-write'));
+ // TRANS: Form guide.
$this->out->element('p', 'form_guide', _('Default access for this application: read-only, or read-write'));
$this->out->elementEnd('li');
@@ -328,9 +353,13 @@ class ApplicationEditForm extends Form
function formActions()
{
- $this->out->submit('cancel', _('Cancel'), 'submit form_action-primary',
+ // TRANS: Button label
+ $this->out->submit('cancel', _m('BUTTON','Cancel'), 'submit form_action-primary',
+ // TRANS: Submit button title
'cancel', _('Cancel'));
- $this->out->submit('save', _('Save'), 'submit form_action-secondary',
+ // TRANS: Button label
+ $this->out->submit('save', _m('BUTTON','Save'), 'submit form_action-secondary',
+ // TRANS: Submit button title
'save', _('Save'));
}
}
diff --git a/lib/applicationlist.php b/lib/applicationlist.php
index 3abb1f8aa..904f8981d 100644
--- a/lib/applicationlist.php
+++ b/lib/applicationlist.php
@@ -88,7 +88,6 @@ class ApplicationList extends Widget
function showApplication()
{
-
$user = common_current_user();
$this->out->elementStart('li', array('class' => 'application',
@@ -133,11 +132,16 @@ class ApplicationList extends Widget
$this->out->elementStart('li');
- $access = ($this->application->access_type & Oauth_application::$writeAccess)
- ? 'read-write' : 'read-only';
+ // TRANS: Application access type
+ $readWriteText = _('read-write');
+ // TRANS: Application access type
+ $readOnlyText = _('read-only');
- $txt = 'Approved ' . common_date_string($appUser->modified) .
- " - $access access.";
+ $access = ($this->application->access_type & Oauth_application::$writeAccess)
+ ? $readWriteText : $readOnlyText;
+ $modifiedDate = common_date_string($appUser->modified);
+ // TRANS: Used in application list. %1$s is a modified date, %2$s is access type (read-write or read-only)
+ $txt = sprintf(_('Approved %1$s - "%2$s" access.'),$modifiedDate,$access);
$this->out->raw($txt);
$this->out->elementEnd('li');
@@ -151,7 +155,8 @@ class ApplicationList extends Widget
$this->out->elementStart('fieldset');
$this->out->hidden('id', $this->application->id);
$this->out->hidden('token', common_session_token());
- $this->out->submit('revoke', _('Revoke'));
+ // TRANS: Button label
+ $this->out->submit('revoke', _m('BUTTON','Revoke'));
$this->out->elementEnd('fieldset');
$this->out->elementEnd('form');
$this->out->elementEnd('li');
diff --git a/lib/atomgroupnoticefeed.php b/lib/atomgroupnoticefeed.php
index 761df587c..39a1fd456 100644
--- a/lib/atomgroupnoticefeed.php
+++ b/lib/atomgroupnoticefeed.php
@@ -59,11 +59,14 @@ class AtomGroupNoticeFeed extends AtomNoticeFeed
parent::__construct($cur, $indent);
$this->group = $group;
+ // TRANS: Title in atom group notice feed. %s is a group name.
$title = sprintf(_("%s timeline"), $group->nickname);
$this->setTitle($title);
$sitename = common_config('site', 'name');
$subtitle = sprintf(
+ // TRANS: Message is used as a subtitle in atom group notice feed.
+ // TRANS: %1$s is a group name, %2$s is a site name.
_('Updates from %1$s on %2$s!'),
$group->nickname,
$sitename
diff --git a/lib/atomusernoticefeed.php b/lib/atomusernoticefeed.php
index b569d9379..785db4915 100644
--- a/lib/atomusernoticefeed.php
+++ b/lib/atomusernoticefeed.php
@@ -65,11 +65,14 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
$this->setActivitySubject($profile->asActivityNoun('subject'));
}
+ // TRANS: Title in atom user notice feed. %s is a user name.
$title = sprintf(_("%s timeline"), $user->nickname);
$this->setTitle($title);
$sitename = common_config('site', 'name');
$subtitle = sprintf(
+ // TRANS: Message is used as a subtitle in atom user notice feed.
+ // TRANS: %1$s is a user name, %2$s is a site name.
_('Updates from %1$s on %2$s!'),
$user->nickname, $sitename
);
diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php
index 43f836e15..59cab9532 100644
--- a/lib/attachmentlist.php
+++ b/lib/attachmentlist.php
@@ -84,6 +84,7 @@ class AttachmentList extends Widget
if (empty($att)) return 0;
$this->out->elementStart('dl', array('id' =>'attachments',
'class' => 'entry-content'));
+ // TRANS: DT element label in attachment list.
$this->out->element('dt', null, _('Attachments'));
$this->out->elementStart('dd');
$this->out->elementStart('ol', array('class' => 'attachments'));
@@ -260,6 +261,7 @@ class Attachment extends AttachmentListItem
'class' => 'entry-content'));
if (!empty($this->oembed->author_name)) {
$this->out->elementStart('dl', 'vcard author');
+ // TRANS: DT element label in attachment list item.
$this->out->element('dt', null, _('Author'));
$this->out->elementStart('dd', 'fn');
if (empty($this->oembed->author_url)) {
@@ -273,6 +275,7 @@ class Attachment extends AttachmentListItem
}
if (!empty($this->oembed->provider)) {
$this->out->elementStart('dl', 'vcard');
+ // TRANS: DT element label in attachment list item.
$this->out->element('dt', null, _('Provider'));
$this->out->elementStart('dd', 'fn');
if (empty($this->oembed->provider_url)) {
diff --git a/lib/authenticationplugin.php b/lib/authenticationplugin.php
index 0a3763e2e..dbdf20629 100644
--- a/lib/authenticationplugin.php
+++ b/lib/authenticationplugin.php
@@ -22,6 +22,7 @@
* @category Plugin
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
+ * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
diff --git a/lib/authorizationplugin.php b/lib/authorizationplugin.php
index 07da9b2d1..d71f77243 100644
--- a/lib/authorizationplugin.php
+++ b/lib/authorizationplugin.php
@@ -22,6 +22,7 @@
* @category Plugin
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
+ * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -67,7 +68,7 @@ abstract class AuthorizationPlugin extends Plugin
//------------Below are the methods that connect StatusNet to the implementing Auth plugin------------\\
- function onStartSetUser(&$user) {
+ function onStartSetUser($user) {
$loginAllowed = $this->loginAllowed($user);
if($loginAllowed === true){
return;
@@ -84,7 +85,7 @@ abstract class AuthorizationPlugin extends Plugin
}
}
- function onStartSetApiUser(&$user) {
+ function onStartSetApiUser($user) {
return $this->onStartSetUser($user);
}
diff --git a/lib/command.php b/lib/command.php
index 216f9e649..a769dc1fc 100644
--- a/lib/command.php
+++ b/lib/command.php
@@ -122,6 +122,8 @@ class Command
}
Event::handle('EndCommandGetProfile', array($this, $arg, &$profile));
if (!$profile) {
+ // TRANS: Message given requesting a profile for a non-existing user.
+ // TRANS: %s is the nickname of the user for which the profile could not be found.
throw new CommandException(sprintf(_('Could not find a user with nickname %s'), $arg));
}
return $profile;
@@ -140,6 +142,8 @@ class Command
}
Event::handle('EndCommandGetUser', array($this, $arg, &$user));
if (!$user){
+ // TRANS: Message given getting a non-existing user.
+ // TRANS: %s is the nickname of the user that could not be found.
throw new CommandException(sprintf(_('Could not find a local user with nickname %s'),
$arg));
}
@@ -225,6 +229,8 @@ class NudgeCommand extends Command
}
// XXX: notify by IM
// XXX: notify by SMS
+ // TRANS: Message given having nudged another user.
+ // TRANS: %s is the nickname of the user that was nudged.
$channel->output($this->user, sprintf(_('Nudge sent to %s'),
$recipient->nickname));
}
@@ -328,12 +334,16 @@ class JoinCommand extends Command
Event::handle('EndJoinGroup', array($group, $cur));
}
} catch (Exception $e) {
- $channel->error($cur, sprintf(_('Could not join user %s to group %s'),
+ // TRANS: Message given having failed to add a user to a group.
+ // TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
+ $channel->error($cur, sprintf(_('Could not join user %1$s to group %2$s'),
$cur->nickname, $group->nickname));
return;
}
- $channel->output($cur, sprintf(_('%s joined group %s'),
+ // TRANS: Message given having added a user to a group.
+ // TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
+ $channel->output($cur, sprintf(_('%1$s joined group %2$s'),
$cur->nickname,
$group->nickname));
}
@@ -370,12 +380,16 @@ class DropCommand extends Command
Event::handle('EndLeaveGroup', array($group, $cur));
}
} catch (Exception $e) {
- $channel->error($cur, sprintf(_('Could not remove user %s to group %s'),
+ // TRANS: Message given having failed to remove a user from a group.
+ // TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
+ $channel->error($cur, sprintf(_('Could not remove user %1$s from group %2$s'),
$cur->nickname, $group->nickname));
return;
}
- $channel->output($cur, sprintf(_('%s left group %s'),
+ // TRANS: Message given having removed a user from a group.
+ // TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
+ $channel->output($cur, sprintf(_('%1$s left group %2$s'),
$cur->nickname,
$group->nickname));
}
@@ -395,18 +409,24 @@ class WhoisCommand extends Command
{
$recipient = $this->getProfile($this->other);
+ // TRANS: Whois output.
+ // TRANS: %1$s nickname of the queried user, %2$s is their profile URL.
$whois = sprintf(_("%1\$s (%2\$s)"), $recipient->nickname,
$recipient->profileurl);
if ($recipient->fullname) {
+ // TRANS: Whois output. %s is the full name of the queried user.
$whois .= "\n" . sprintf(_('Fullname: %s'), $recipient->fullname);
}
if ($recipient->location) {
+ // TRANS: Whois output. %s is the location of the queried user.
$whois .= "\n" . sprintf(_('Location: %s'), $recipient->location);
}
if ($recipient->homepage) {
+ // TRANS: Whois output. %s is the homepage of the queried user.
$whois .= "\n" . sprintf(_('Homepage: %s'), $recipient->homepage);
}
if ($recipient->bio) {
+ // TRANS: Whois output. %s is the bio information of the queried user.
$whois .= "\n" . sprintf(_('About: %s'), $recipient->bio);
}
$channel->output($this->user, $whois);
@@ -447,7 +467,9 @@ class MessageCommand extends Command
$this->text = common_shorten_links($this->text);
if (Message::contentTooLong($this->text)) {
- $channel->error($this->user, sprintf(_('Message too long - maximum is %d characters, you sent %d'),
+ // TRANS: Message given if content is too long.
+ // TRANS: %1$d is the maximum number of characters, %2$d is the number of submitted characters.
+ $channel->error($this->user, sprintf(_('Message too long - maximum is %1$d characters, you sent %2$d'),
Message::maxContent(), mb_strlen($this->text)));
return;
}
@@ -465,6 +487,8 @@ class MessageCommand extends Command
$message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source());
if ($message) {
$message->notify();
+ // TRANS: Message given have sent a direct message to another user.
+ // TRANS: %s is the name of the other user.
$channel->output($this->user, sprintf(_('Direct message to %s sent'), $this->other));
} else {
$channel->error($this->user, _('Error sending direct message.'));
@@ -500,6 +524,8 @@ class RepeatCommand extends Command
if ($repeat) {
+ // TRANS: Message given having repeated a notice from another user.
+ // TRANS: %s is the name of the user for which the notice was repeated.
$channel->output($this->user, sprintf(_('Notice from %s repeated'), $recipient->nickname));
} else {
$channel->error($this->user, _('Error repeating notice.'));
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php
index 7786b5941..5dc2b38da 100644
--- a/lib/htmloutputter.php
+++ b/lib/htmloutputter.php
@@ -100,6 +100,7 @@ class HTMLOutputter extends XMLOutputter
$type = common_negotiate_type($cp, $sp);
if (!$type) {
+ // TRANS: Client exception 406
throw new ClientException(_('This page is not available in a '.
'media type you accept'), 406);
}
diff --git a/lib/installer.php b/lib/installer.php
index 78461efb7..bd9d69cd4 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -32,6 +32,7 @@
* @author Sarven Capadisli <csarven@status.net>
* @author Tom Adams <tom@holizz.com>
* @author Zach Copley <zach@status.net>
+ * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license GNU Affero General Public License http://www.gnu.org/licenses/
* @version 0.9.x
* @link http://status.net
diff --git a/lib/language.php b/lib/language.php
index cb12cca69..1805707ad 100644
--- a/lib/language.php
+++ b/lib/language.php
@@ -206,6 +206,7 @@ function _mdomain($backtrace)
static $cached;
$path = $backtrace[0]['file'];
if (!isset($cached[$path])) {
+ $final = 'statusnet'; // assume default domain
if (DIRECTORY_SEPARATOR !== '/') {
$path = strtr($path, DIRECTORY_SEPARATOR, '/');
}
@@ -224,6 +225,7 @@ function _mdomain($backtrace)
return 'statusnet';
}
}
+ $cached[$path] = $final;
}
return $cached[$path];
}
@@ -298,6 +300,7 @@ function get_nice_language_list()
*/
function get_all_languages() {
return array(
+ 'af' => array('q' => 0.8, 'lang' => 'af', 'name' => 'Afrikaans', 'direction' => 'ltr'),
'ar' => array('q' => 0.8, 'lang' => 'ar', 'name' => 'Arabic', 'direction' => 'rtl'),
'arz' => array('q' => 0.8, 'lang' => 'arz', 'name' => 'Egyptian Spoken Arabic', 'direction' => 'rtl'),
'bg' => array('q' => 0.8, 'lang' => 'bg', 'name' => 'Bulgarian', 'direction' => 'ltr'),
@@ -313,7 +316,8 @@ function get_all_languages() {
'fi' => array('q' => 1, 'lang' => 'fi', 'name' => 'Finnish', 'direction' => 'ltr'),
'fa' => array('q' => 1, 'lang' => 'fa', 'name' => 'Persian', 'direction' => 'rtl'),
'fr-fr' => array('q' => 1, 'lang' => 'fr', 'name' => 'French', 'direction' => 'ltr'),
- 'ga' => array('q' => 0.5, 'lang' => 'ga', 'name' => 'Galician', 'direction' => 'ltr'),
+ 'ga' => array('q' => 0.5, 'lang' => 'ga', 'name' => 'Irish', 'direction' => 'ltr'),
+ 'gl' => array('q' => 0.8, 'lang' => 'gl', 'name' => 'Galician', 'direction' => 'ltr'),
'he' => array('q' => 0.5, 'lang' => 'he', 'name' => 'Hebrew', 'direction' => 'rtl'),
'hsb' => array('q' => 0.8, 'lang' => 'hsb', 'name' => 'Upper Sorbian', 'direction' => 'ltr'),
'ia' => array('q' => 0.8, 'lang' => 'ia', 'name' => 'Interlingua', 'direction' => 'ltr'),
diff --git a/lib/mailhandler.php b/lib/mailhandler.php
index 890f6d5b4..e9ba41839 100644
--- a/lib/mailhandler.php
+++ b/lib/mailhandler.php
@@ -265,6 +265,10 @@ class MailHandler
if (preg_match('/^\s*Begin\s+forward/', $line)) {
break;
}
+ // skip everything after a blank line if we already have content
+ if ($output !== '' && $line === '') {
+ break;
+ }
$output .= ' ' . $line;
}
diff --git a/lib/mediafile.php b/lib/mediafile.php
index 10d90d008..1c96c42d7 100644
--- a/lib/mediafile.php
+++ b/lib/mediafile.php
@@ -171,7 +171,7 @@ class MediaFile
return;
}
- if (!MediaFile::respectsQuota($user, $_FILES['attach']['size'])) {
+ if (!MediaFile::respectsQuota($user, $_FILES[$param]['size'])) {
// Should never actually get here
diff --git a/lib/noticeform.php b/lib/noticeform.php
index 7278c41a9..84c20a5b3 100644
--- a/lib/noticeform.php
+++ b/lib/noticeform.php
@@ -212,8 +212,8 @@ class NoticeForm extends Form
$this->out->checkbox('notice_data-geo', _('Share my location'), true);
$this->out->elementEnd('div');
$this->out->inlineScript(' var NoticeDataGeo_text = {'.
- 'ShareDisable: "'._('Do not share my location').'",'.
- 'ErrorTimeout: "'._('Sorry, retrieving your geo location is taking longer than expected, please try again later').'"'.
+ 'ShareDisable: ' .json_encode(_('Do not share my location')).','.
+ 'ErrorTimeout: ' .json_encode(_('Sorry, retrieving your geo location is taking longer than expected, please try again later')).
'}');
}
diff --git a/lib/noticelist.php b/lib/noticelist.php
index 81da9edc0..432ea78d5 100644
--- a/lib/noticelist.php
+++ b/lib/noticelist.php
@@ -426,10 +426,18 @@ class NoticeListItem extends Widget
if (empty($name)) {
$latdms = $this->decimalDegreesToDMS(abs($lat));
$londms = $this->decimalDegreesToDMS(abs($lon));
+ // TRANS: Used in coordinates as abbreviation of north
+ $north = _('N');
+ // TRANS: Used in coordinates as abbreviation of south
+ $south = _('S');
+ // TRANS: Used in coordinates as abbreviation of east
+ $east = _('E');
+ // TRANS: Used in coordinates as abbreviation of west
+ $west = _('W');
$name = sprintf(
_('%1$u°%2$u\'%3$u"%4$s %5$u°%6$u\'%7$u"%8$s'),
- $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0?_('N'):_('S')),
- $londms['deg'],$londms['min'], $londms['sec'],($lon>0?_('E'):_('W')));
+ $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0? $north:$south),
+ $londms['deg'],$londms['min'], $londms['sec'],($lon>0? $east:$west));
}
$url = $location->getUrl();
diff --git a/lib/pgsqlschema.php b/lib/pgsqlschema.php
index 715065d77..272f7eff6 100644
--- a/lib/pgsqlschema.php
+++ b/lib/pgsqlschema.php
@@ -41,6 +41,7 @@ if (!defined('STATUSNET')) {
* @category Database
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
+ * @author Brenda Wallace <shiny@cpan.org>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -79,7 +80,6 @@ class PgsqlSchema extends Schema
$row = array();
while ($res->fetchInto($row, DB_FETCHMODE_ASSOC)) {
-// var_dump($row);
$cd = new ColumnDef();
$cd->name = $row['field'];
@@ -143,6 +143,7 @@ class PgsqlSchema extends Schema
$uniques = array();
$primary = array();
$indices = array();
+ $onupdate = array();
$sql = "CREATE TABLE $name (\n";
@@ -155,7 +156,6 @@ class PgsqlSchema extends Schema
}
$sql .= $this->_columnSql($cd);
-
switch ($cd->key) {
case 'UNI':
$uniques[] = $cd->name;
@@ -170,13 +170,7 @@ class PgsqlSchema extends Schema
}
if (count($primary) > 0) { // it really should be...
- $sql .= ",\n primary key (" . implode(',', $primary) . ")";
- }
-
-
-
- foreach ($indices as $i) {
- $sql .= ",\nindex {$name}_{$i}_idx ($i)";
+ $sql .= ",\n PRIMARY KEY (" . implode(',', $primary) . ")";
}
$sql .= "); ";
@@ -185,10 +179,14 @@ class PgsqlSchema extends Schema
foreach ($uniques as $u) {
$sql .= "\n CREATE index {$name}_{$u}_idx ON {$name} ($u); ";
}
+
+ foreach ($indices as $i) {
+ $sql .= "CREATE index {$name}_{$i}_idx ON {$name} ($i)";
+ }
$res = $this->conn->query($sql);
if (PEAR::isError($res)) {
- throw new Exception($res->getMessage());
+ throw new Exception($res->getMessage(). ' SQL was '. $sql);
}
return true;
@@ -223,7 +221,7 @@ class PgsqlSchema extends Schema
*/
private function _columnTypeTranslation($type) {
$map = array(
- 'datetime' => 'timestamp'
+ 'datetime' => 'timestamp',
);
if(!empty($map[$type])) {
return $map[$type];
@@ -324,7 +322,7 @@ class PgsqlSchema extends Schema
public function modifyColumn($table, $columndef)
{
- $sql = "ALTER TABLE $table MODIFY COLUMN " .
+ $sql = "ALTER TABLE $table ALTER COLUMN TYPE " .
$this->_columnSql($columndef);
$res = $this->conn->query($sql);
@@ -397,16 +395,17 @@ class PgsqlSchema extends Schema
$todrop = array_diff($cur, $new);
$same = array_intersect($new, $cur);
$tomod = array();
-
foreach ($same as $m) {
$curCol = $this->_byName($td->columns, $m);
$newCol = $this->_byName($columns, $m);
+
if (!$newCol->equals($curCol)) {
- $tomod[] = $newCol->name;
+ // BIG GIANT TODO!
+ // stop it detecting different types and trying to modify on every page request
+// $tomod[] = $newCol->name;
}
}
-
if (count($toadd) + count($todrop) + count($tomod) == 0) {
// nothing to do
return true;
@@ -430,11 +429,12 @@ class PgsqlSchema extends Schema
foreach ($tomod as $columnName) {
$cd = $this->_byName($columns, $columnName);
- $phrase[] = 'MODIFY COLUMN ' . $this->_columnSql($cd);
+ /* brute force */
+ $phrase[] = 'DROP COLUMN ' . $columnName;
+ $phrase[] = 'ADD COLUMN ' . $this->_columnSql($cd);
}
$sql = 'ALTER TABLE ' . $tableName . ' ' . implode(', ', $phrase);
-
$res = $this->conn->query($sql);
if (PEAR::isError($res)) {
@@ -496,12 +496,21 @@ class PgsqlSchema extends Schema
*
* @return string correct SQL for that column
*/
-
private function _columnSql($cd)
{
$sql = "{$cd->name} ";
$type = $this->_columnTypeTranslation($cd->type);
+ //handle those mysql enum fields that postgres doesn't support
+ if (preg_match('!^enum!', $type)) {
+ $allowed_values = preg_replace('!^enum!', '', $type);
+ $sql .= " text check ({$cd->name} in $allowed_values)";
+ return $sql;
+ }
+ if (!empty($cd->auto_increment)) {
+ $type = "bigserial"; // FIXME: creates the wrong name for the sequence for some internal sequence-lookup function, so better fix this to do the real 'create sequence' dance.
+ }
+
if (!empty($cd->size)) {
$sql .= "{$type}({$cd->size}) ";
} else {
@@ -513,14 +522,10 @@ class PgsqlSchema extends Schema
} else {
$sql .= ($cd->nullable) ? "null " : "not null ";
}
-
- if (!empty($cd->auto_increment)) {
- $sql .= " auto_increment ";
- }
- if (!empty($cd->extra)) {
- $sql .= "{$cd->extra} ";
- }
+// if (!empty($cd->extra)) {
+// $sql .= "{$cd->extra} ";
+// }
return $sql;
}
diff --git a/lib/popularnoticesection.php b/lib/popularnoticesection.php
index 296ddbbb5..f70a972ef 100644
--- a/lib/popularnoticesection.php
+++ b/lib/popularnoticesection.php
@@ -72,7 +72,7 @@ class PopularNoticeSection extends NoticeSection
$qry .= ' GROUP BY notice.id,notice.profile_id,notice.content,notice.uri,' .
'notice.rendered,notice.url,notice.created,notice.modified,' .
'notice.reply_to,notice.is_local,notice.source,notice.conversation, ' .
- 'notice.lat,notice.lon,location_id,location_ns' .
+ 'notice.lat,notice.lon,location_id,location_ns,notice.repeat_of' .
' ORDER BY weight DESC';
$offset = 0;
diff --git a/lib/profileaction.php b/lib/profileaction.php
index 82e0224af..504b77566 100644
--- a/lib/profileaction.php
+++ b/lib/profileaction.php
@@ -174,6 +174,12 @@ class ProfileAction extends OwnerDesignAction
$subbed_count = $this->profile->subscriberCount();
$notice_count = $this->profile->noticeCount();
$group_count = $this->user->getGroups()->N;
+ $age_days = (time() - strtotime($this->profile->created)) / 86400;
+ if ($age_days < 1) {
+ // Rather than extrapolating out to a bajillion...
+ $age_days = 1;
+ }
+ $daily_count = round($notice_count / $age_days);
$this->elementStart('div', array('id' => 'entity_statistics',
'class' => 'section'));
@@ -224,6 +230,12 @@ class ProfileAction extends OwnerDesignAction
$this->element('dd', null, $notice_count);
$this->elementEnd('dl');
+ $this->elementStart('dl', 'entity_daily_notices');
+ // TRANS: Average count of posts made per day since account registration
+ $this->element('dt', null, _('Daily average'));
+ $this->element('dd', null, $daily_count);
+ $this->elementEnd('dl');
+
$this->elementEnd('div');
}
diff --git a/lib/themeuploader.php b/lib/themeuploader.php
index 18ef8c4d1..370965db0 100644
--- a/lib/themeuploader.php
+++ b/lib/themeuploader.php
@@ -55,10 +55,10 @@ class ThemeUploader
public static function fromUpload($name)
{
if (!isset($_FILES[$name]['error'])) {
- throw new ServerException(_("Theme upload missing or failed."));
+ throw new ServerException(_("The theme file is missing or the upload failed."));
}
if ($_FILES[$name]['error'] != UPLOAD_ERR_OK) {
- throw new ServerException(_("Theme upload missing or failed."));
+ throw new ServerException(_("The theme file is missing or the upload failed."));
}
return new ThemeUploader($_FILES[$name]['tmp_name']);
}
diff --git a/lib/util.php b/lib/util.php
index 049001aba..2a90b56a9 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -849,7 +849,7 @@ function common_linkify($url) {
}
if (!empty($f)) {
- if ($f->getEnclosure()) {
+ if ($f->getEnclosure() || File_oembed::staticGet('file_id',$f->id)) {
$is_attachment = true;
$attachment_id = $f->id;
@@ -872,10 +872,10 @@ function common_linkify($url) {
return XMLStringer::estring('a', $attrs, $url);
}
-function common_shorten_links($text)
+function common_shorten_links($text, $always = false)
{
$maxLength = Notice::maxContent();
- if ($maxLength == 0 || mb_strlen($text) <= $maxLength) return $text;
+ if (!$always && ($maxLength == 0 || mb_strlen($text) <= $maxLength)) return $text;
return common_replace_urls_callback($text, array('File_redirection', 'makeShort'));
}
@@ -1096,24 +1096,38 @@ function common_date_string($dt)
if ($now < $t) { // that shouldn't happen!
return common_exact_date($dt);
} else if ($diff < 60) {
+ // TRANS: Used in notices to indicate when the notice was made compared to now.
return _('a few seconds ago');
} else if ($diff < 92) {
+ // TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about a minute ago');
} else if ($diff < 3300) {
+ // XXX: should support plural.
+ // TRANS: Used in notices to indicate when the notice was made compared to now.
return sprintf(_('about %d minutes ago'), round($diff/60));
} else if ($diff < 5400) {
+ // TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about an hour ago');
} else if ($diff < 22 * 3600) {
+ // XXX: should support plural.
+ // TRANS: Used in notices to indicate when the notice was made compared to now.
return sprintf(_('about %d hours ago'), round($diff/3600));
} else if ($diff < 37 * 3600) {
+ // TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about a day ago');
} else if ($diff < 24 * 24 * 3600) {
+ // XXX: should support plural.
+ // TRANS: Used in notices to indicate when the notice was made compared to now.
return sprintf(_('about %d days ago'), round($diff/(24*3600)));
} else if ($diff < 46 * 24 * 3600) {
+ // TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about a month ago');
} else if ($diff < 330 * 24 * 3600) {
+ // XXX: should support plural.
+ // TRANS: Used in notices to indicate when the notice was made compared to now.
return sprintf(_('about %d months ago'), round($diff/(30*24*3600)));
} else if ($diff < 480 * 24 * 3600) {
+ // TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about a year ago');
} else {
return common_exact_date($dt);
diff --git a/lib/xrdsoutputter.php b/lib/xrdsoutputter.php
index 4b77ed5a3..95dc73300 100644
--- a/lib/xrdsoutputter.php
+++ b/lib/xrdsoutputter.php
@@ -23,6 +23,7 @@
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @copyright 2008 StatusNet, Inc.
+ * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/