From a9fad9a7ac85270e2a45cfad28c6017b200496eb Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 12 Sep 2010 17:08:49 +0200 Subject: Add translator hint. --- actions/apiaccountupdatedeliverydevice.php | 1 + actions/apiaccountupdateprofile.php | 1 + actions/apiaccountupdateprofilebackgroundimage.php | 1 + actions/apiaccountupdateprofilecolors.php | 1 + actions/apiaccountupdateprofileimage.php | 1 + actions/apiblockcreate.php | 1 + actions/apiblockdestroy.php | 1 + actions/apidirectmessagenew.php | 1 + actions/apifavoritecreate.php | 1 + actions/apifavoritedestroy.php | 1 + actions/apifriendshipscreate.php | 1 + actions/apifriendshipsdestroy.php | 1 + actions/apigroupcreate.php | 1 + actions/apigroupjoin.php | 1 + actions/apigroupleave.php | 1 + actions/apimediaupload.php | 1 + actions/apistatusesretweet.php | 1 + actions/apistatusesupdate.php | 1 + 18 files changed, 18 insertions(+) (limited to 'actions') diff --git a/actions/apiaccountupdatedeliverydevice.php b/actions/apiaccountupdatedeliverydevice.php index 295378aa6..2d903cb46 100644 --- a/actions/apiaccountupdatedeliverydevice.php +++ b/actions/apiaccountupdatedeliverydevice.php @@ -83,6 +83,7 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error message. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format ); diff --git a/actions/apiaccountupdateprofile.php b/actions/apiaccountupdateprofile.php index 9b371ea95..92d0f6b77 100644 --- a/actions/apiaccountupdateprofile.php +++ b/actions/apiaccountupdateprofile.php @@ -86,6 +86,7 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format ); diff --git a/actions/apiaccountupdateprofilebackgroundimage.php b/actions/apiaccountupdateprofilebackgroundimage.php index 3537b9f97..923fb1d11 100644 --- a/actions/apiaccountupdateprofilebackgroundimage.php +++ b/actions/apiaccountupdateprofilebackgroundimage.php @@ -83,6 +83,7 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format ); diff --git a/actions/apiaccountupdateprofilecolors.php b/actions/apiaccountupdateprofilecolors.php index c666f9d75..9e07d80de 100644 --- a/actions/apiaccountupdateprofilecolors.php +++ b/actions/apiaccountupdateprofilecolors.php @@ -107,6 +107,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format ); diff --git a/actions/apiaccountupdateprofileimage.php b/actions/apiaccountupdateprofileimage.php index 153ef7818..7f868a6eb 100644 --- a/actions/apiaccountupdateprofileimage.php +++ b/actions/apiaccountupdateprofileimage.php @@ -81,6 +81,7 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format ); diff --git a/actions/apiblockcreate.php b/actions/apiblockcreate.php index b355cd1c7..53844cd2f 100644 --- a/actions/apiblockcreate.php +++ b/actions/apiblockcreate.php @@ -86,6 +86,7 @@ class ApiBlockCreateAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format diff --git a/actions/apiblockdestroy.php b/actions/apiblockdestroy.php index 7ea201677..871ce66c7 100644 --- a/actions/apiblockdestroy.php +++ b/actions/apiblockdestroy.php @@ -85,6 +85,7 @@ class ApiBlockDestroyAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format diff --git a/actions/apidirectmessagenew.php b/actions/apidirectmessagenew.php index 65d065648..44e205ebb 100644 --- a/actions/apidirectmessagenew.php +++ b/actions/apidirectmessagenew.php @@ -106,6 +106,7 @@ class ApiDirectMessageNewAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format diff --git a/actions/apifavoritecreate.php b/actions/apifavoritecreate.php index 0447a92ba..15da01013 100644 --- a/actions/apifavoritecreate.php +++ b/actions/apifavoritecreate.php @@ -88,6 +88,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format diff --git a/actions/apifavoritedestroy.php b/actions/apifavoritedestroy.php index 9f2efdd00..c2e1ebafc 100644 --- a/actions/apifavoritedestroy.php +++ b/actions/apifavoritedestroy.php @@ -89,6 +89,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format diff --git a/actions/apifriendshipscreate.php b/actions/apifriendshipscreate.php index a7ec5b28a..64c857c70 100644 --- a/actions/apifriendshipscreate.php +++ b/actions/apifriendshipscreate.php @@ -88,6 +88,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format diff --git a/actions/apifriendshipsdestroy.php b/actions/apifriendshipsdestroy.php index 551d01682..21da23ef7 100644 --- a/actions/apifriendshipsdestroy.php +++ b/actions/apifriendshipsdestroy.php @@ -88,6 +88,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format diff --git a/actions/apigroupcreate.php b/actions/apigroupcreate.php index d216c15cd..fa443573d 100644 --- a/actions/apigroupcreate.php +++ b/actions/apigroupcreate.php @@ -102,6 +102,7 @@ class ApiGroupCreateAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format diff --git a/actions/apigroupjoin.php b/actions/apigroupjoin.php index 5265ec629..a0c069974 100644 --- a/actions/apigroupjoin.php +++ b/actions/apigroupjoin.php @@ -89,6 +89,7 @@ class ApiGroupJoinAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format diff --git a/actions/apigroupleave.php b/actions/apigroupleave.php index 8c100d58a..c838f6c87 100644 --- a/actions/apigroupleave.php +++ b/actions/apigroupleave.php @@ -89,6 +89,7 @@ class ApiGroupLeaveAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format diff --git a/actions/apimediaupload.php b/actions/apimediaupload.php index 7aa88c186..54d7fda68 100644 --- a/actions/apimediaupload.php +++ b/actions/apimediaupload.php @@ -64,6 +64,7 @@ class ApiMediaUploadAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format ); diff --git a/actions/apistatusesretweet.php b/actions/apistatusesretweet.php index 9aa337485..aae98f637 100644 --- a/actions/apistatusesretweet.php +++ b/actions/apistatusesretweet.php @@ -62,6 +62,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction parent::prepare($args); if ($_SERVER['REQUEST_METHOD'] != 'POST') { + // TRANS: Client error. POST is a HTTP command. It should not be translated. $this->clientError(_('This method requires a POST.'), 400, $this->format); return false; diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index fa3f611c0..4715f7002 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -195,6 +195,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format -- cgit v1.2.3-54-g00ecf From 6b010ac79c75978f6782c3058d4453e4230ec2b6 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 12 Sep 2010 17:27:38 +0200 Subject: Update/add translator documentation. --- actions/emailsettings.php | 6 +++++- actions/groupmembers.php | 22 ++++++++++++++++++++-- lib/blockform.php | 2 ++ lib/unblockform.php | 2 ++ 4 files changed, 29 insertions(+), 3 deletions(-) (limited to 'actions') diff --git a/actions/emailsettings.php b/actions/emailsettings.php index 6138a88f9..9c250fc8a 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -131,7 +131,11 @@ class EmailsettingsAction extends AccountSettingsAction // TRANS: Field label for e-mail address input in e-mail settings form. $this->input('email', _('Email address'), ($this->arg('email')) ? $this->arg('email') : null, - // TRANS: Instructions for e-mail address input form. + // TRANS: Instructions for e-mail address input form. Do not translate + // TRANS: "example.org". It is one of the domain names reserved for + // TRANS: use in examples by http://www.rfc-editor.org/rfc/rfc2606.txt. + // TRANS: Any other domain may be owned by a legitimate person or + // TRANS: organization. _('Email address, like "UserName@example.org"')); $this->elementEnd('li'); $this->elementEnd('ul'); diff --git a/actions/groupmembers.php b/actions/groupmembers.php index 54f1d8dcd..038d1db68 100644 --- a/actions/groupmembers.php +++ b/actions/groupmembers.php @@ -97,9 +97,13 @@ class GroupmembersAction extends GroupDesignAction function title() { if ($this->page == 1) { + // TRANS: Title of the page showing group members. + // TRANS: %s is the name of the group. return sprintf(_('%s group members'), $this->group->nickname); } else { + // TRANS: Title of the page showing group members. + // TRANS: %1$s is the name of the group, %2$d is the page number of the members list. return sprintf(_('%1$s group members, page %2$d'), $this->group->nickname, $this->page); @@ -389,7 +393,14 @@ class GroupBlockForm extends Form function formActions() { - $this->out->submit('submit', _('Block'), 'submit', null, _('Block this user')); + $this->out->submit( + 'submit', + // TRANS: Button text for the form that will block a user from a group. + _m('BUTTON','Block'), + 'submit', + null, + // TRANS: Submit button title. + _m('TOOLTIP',_('Block this user')); } } @@ -516,6 +527,13 @@ class MakeAdminForm extends Form function formActions() { - $this->out->submit('submit', _('Make Admin'), 'submit', null, _('Make this user an admin')); + $this->out->submit( + 'submit', + // TRANS: Button text for the form that will make a user administrator. + _m('BUTTON','Make Admin'), + 'submit', + null, + // TRANS: Submit button title. + _m('TOOLTIP','Make this user an admin')); } } diff --git a/lib/blockform.php b/lib/blockform.php index b6652b1f6..54552b3e5 100644 --- a/lib/blockform.php +++ b/lib/blockform.php @@ -66,6 +66,7 @@ class BlockForm extends ProfileActionForm function title() { + // TRANS: Title for the form to block a user. return _('Block'); } @@ -77,6 +78,7 @@ class BlockForm extends ProfileActionForm function description() { + // TRANS: Description of the form to block a user. return _('Block this user'); } } diff --git a/lib/unblockform.php b/lib/unblockform.php index 2a444f7cd..b89d7ff78 100644 --- a/lib/unblockform.php +++ b/lib/unblockform.php @@ -66,6 +66,7 @@ class UnblockForm extends ProfileActionForm function title() { + // TRANS: Title for the form to unblock a user. return _('Unblock'); } @@ -77,6 +78,7 @@ class UnblockForm extends ProfileActionForm function description() { + // TRANS: Description of the form to unblock a user. return _('Unblock this user'); } } -- cgit v1.2.3-54-g00ecf From bb2a4e7aacfd4e3308ad71c21b19be47ba879735 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 12 Sep 2010 17:43:43 +0200 Subject: Update translator documentation. --- actions/imsettings.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actions') diff --git a/actions/imsettings.php b/actions/imsettings.php index 6691c8dad..29cbeb82e 100644 --- a/actions/imsettings.php +++ b/actions/imsettings.php @@ -137,6 +137,9 @@ class ImsettingsAction extends ConnectSettingsAction ($this->arg('jabber')) ? $this->arg('jabber') : null, // TRANS: IM address input field instructions in IM settings form. // TRANS: %s is the IM address set for the site. + // TRANS: Do not translate "example.org". It is one of the domain names reserved for use in examples by + // TRANS: http://www.rfc-editor.org/rfc/rfc2606.txt. Any other domain may be owned by a legitimate + // TRANS: person or organization. sprintf(_('Jabber or GTalk address, '. 'like "UserName@example.org". '. 'First, make sure to add %s to your '. -- cgit v1.2.3-54-g00ecf From ead2f3375ad8f623b6b15aa4c7194224575b3c41 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 13 Sep 2010 13:37:13 -0700 Subject: Ticket #2701: old color settings now get reset when changing themes, so you don't end up with the previous theme's colors. --- actions/designadminpanel.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'actions') diff --git a/actions/designadminpanel.php b/actions/designadminpanel.php index 763737175..e3d772f7d 100644 --- a/actions/designadminpanel.php +++ b/actions/designadminpanel.php @@ -154,9 +154,22 @@ class DesignadminpanelAction extends AdminPanelAction $config->query('BEGIN'); - // Only update colors if the theme has not changed. - - if (!$themeChanged) { + if ($themeChanged) { + // If the theme has changed, reset custom colors and let them pick + // up the new theme's defaults. + $colors = array('background', 'content', 'sidebar', 'text', 'link'); + foreach ($colors as $colorKey) { + // Clear from global config so we see defaults on this page... + $GLOBALS['config']['design'][$colorKey . 'color'] = false; + + // And remove old settings from DB... + $this->deleteSetting('design', $colorKey . 'color'); + } + } else { + // Only save colors from the form if the theme has not changed. + // + // @fixme a future more ajaxy form should allow theme switch + // and color customization in one step. $bgcolor = new WebColor($this->trimmed('design_background')); $ccolor = new WebColor($this->trimmed('design_content')); -- cgit v1.2.3-54-g00ecf From f4a1858b3327b2b0d9920d01ccae9b3e7148d3ec Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 17 Sep 2010 14:20:05 -0700 Subject: Fixed typo, and updated copyright dates while I was there --- actions/useradminpanel.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'actions') diff --git a/actions/useradminpanel.php b/actions/useradminpanel.php index ee9c23076..7823a370b 100644 --- a/actions/useradminpanel.php +++ b/actions/useradminpanel.php @@ -12,6 +12,7 @@ * (at your option) any later version. * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. @@ -24,7 +25,7 @@ * @author Evan Prodromou * @author Zach Copley * @author Sarven Capadisli - * @copyright 2008-2009 StatusNet, Inc. + * @copyright 2008-2010 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -291,6 +292,6 @@ class UserAdminPanelForm extends AdminForm function formActions() { - $this->out->submit('submit', _('Save'), 'submit', null, _('Save site settings')); + $this->out->submit('submit', _('Save'), 'submit', null, _('Save user settings')); } } -- cgit v1.2.3-54-g00ecf From afc799ddf8ded2de063f7d6340a38c3ab3dd315e Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 17 Sep 2010 14:32:18 -0700 Subject: Removed periods from instructions on some admin panels for consistency --- actions/designadminpanel.php | 2 +- actions/pathsadminpanel.php | 2 +- actions/sessionsadminpanel.php | 2 +- actions/useradminpanel.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'actions') diff --git a/actions/designadminpanel.php b/actions/designadminpanel.php index e3d772f7d..4285f7d73 100644 --- a/actions/designadminpanel.php +++ b/actions/designadminpanel.php @@ -71,7 +71,7 @@ class DesignadminpanelAction extends AdminPanelAction function getInstructions() { - return _('Design settings for this StatusNet site.'); + return _('Design settings for this StatusNet site'); } /** diff --git a/actions/pathsadminpanel.php b/actions/pathsadminpanel.php index 7ff3c2583..0c83aa29e 100644 --- a/actions/pathsadminpanel.php +++ b/actions/pathsadminpanel.php @@ -67,7 +67,7 @@ class PathsadminpanelAction extends AdminPanelAction function getInstructions() { - return _('Path and server settings for this StatusNet site.'); + return _('Path and server settings for this StatusNet site'); } /** diff --git a/actions/sessionsadminpanel.php b/actions/sessionsadminpanel.php index 4386ef844..e9bd1719f 100644 --- a/actions/sessionsadminpanel.php +++ b/actions/sessionsadminpanel.php @@ -62,7 +62,7 @@ class SessionsadminpanelAction extends AdminPanelAction function getInstructions() { - return _('Session settings for this StatusNet site.'); + return _('Session settings for this StatusNet site'); } /** diff --git a/actions/useradminpanel.php b/actions/useradminpanel.php index 7823a370b..04e0ca3e7 100644 --- a/actions/useradminpanel.php +++ b/actions/useradminpanel.php @@ -68,7 +68,7 @@ class UseradminpanelAction extends AdminPanelAction function getInstructions() { - return _('User settings for this StatusNet site.'); + return _('User settings for this StatusNet site'); } /** -- cgit v1.2.3-54-g00ecf From 55ad954b15d0d2d855c4cb8db5da95d3c2d0dbfb Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 17 Sep 2010 16:38:12 -0700 Subject: Basic license admin panel (maybe we can make it fancier later) --- actions/licenseadminpanel.php | 303 ++++++++++++++++++++++++++++++++++++++++++ lib/adminpanelaction.php | 8 ++ lib/default.php | 2 +- lib/router.php | 2 + 4 files changed, 314 insertions(+), 1 deletion(-) create mode 100644 actions/licenseadminpanel.php (limited to 'actions') diff --git a/actions/licenseadminpanel.php b/actions/licenseadminpanel.php new file mode 100644 index 000000000..c9aad5c4f --- /dev/null +++ b/actions/licenseadminpanel.php @@ -0,0 +1,303 @@ +. + * + * @category Settings + * @package StatusNet + * @author Zach Copley + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * License settings + * + * @category Admin + * @package StatusNet + * @author Zach Copley + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class LicenseadminpanelAction extends AdminPanelAction +{ + + /** + * Returns the page title + * + * @return string page title + */ + + function title() + { + // TRANS: User admin panel title + return _m('TITLE', 'License'); + } + + /** + * Instructions for using this form. + * + * @return string instructions + */ + + function getInstructions() + { + return _('License for this StatusNet site'); + } + + /** + * Show the site admin panel form + * + * @return void + */ + + function showForm() + { + $form = new LicenseAdminPanelForm($this); + $form->show(); + return; + } + + /** + * Save settings from the form + * + * @return void + */ + + function saveSettings() + { + static $settings = array( + 'license' => array('type', 'owner', 'url', 'title', 'image') + ); + + $values = array(); + + foreach ($settings as $section => $parts) { + foreach ($parts as $setting) { + $values[$section][$setting] = $this->trimmed($setting); + } + } + + // This throws an exception on validation errors + + $this->validate($values); + + // assert(all values are valid); + + $config = new Config(); + + $config->query('BEGIN'); + + foreach ($settings as $section => $parts) { + foreach ($parts as $setting) { + Config::save($section, $setting, $values[$section][$setting]); + } + } + + $config->query('COMMIT'); + + return; + } + + /** + * Validate License admin form values + * + * @param array &$values from the form + * + * @return nothing + */ + + function validate(&$values) + { + // Validate license type (shouldn't have to do it, but just in case) + + $types = array('private', 'allrightsreserved', 'cc'); + + if (!in_array($values['license']['type'], $types)) { + $this->clientError(_("Invalid license selection.")); + } + + // Make sure the user has set an owner if the site has a private + // license + + if ($values['license']['type'] == 'allrightsreserved' + && empty($values['license']['owner']) + ) { + $this->clientError( + _("You must specify the owner of the content when using the All Rights Reserved license.") + ); + } + + // Make sure the license title is not too long + if (mb_strlen($values['license']['type']) > 255) { + $this->clientError( + _("Invalid license title. Max length is 255 characters.") + ); + } + + // make sure the license URL and license image URL are valid URLs + + $options = array('allowed_schemes' => array('http', 'https')); + + if (!Validate::uri($values['license']['url'], $options)) { + $this->clientError(_("Invalid license URL.")); + } + + if (!Validate::uri($values['license']['image'], $options)) { + $this->clientError(_("Invalid license image URL.")); + } + } +} + +class LicenseAdminPanelForm extends AdminForm +{ + /** + * ID of the form + * + * @return int ID of the form + */ + + function id() + { + return 'licenseadminpanel'; + } + + /** + * class of the form + * + * @return string class of the form + */ + + function formClass() + { + return 'form_settings'; + } + + /** + * Action of the form + * + * @return string URL of the action + */ + + function action() + { + return common_local_url('licenseadminpanel'); + } + + /** + * Data elements of the form + * + * @return void + */ + + function formData() + { + $this->out->elementStart( + 'fieldset', array('id' => 'settings_license-selection') + ); + $this->out->element('legend', null, _('License selection')); + $this->out->elementStart('ul', 'form_data'); + + $this->li(); + + $types = array( + 'private' => _('Private'), + 'allrightsreserved' => _('All Rights Reserved'), + 'cc' => _('Creative Commons') + ); + + $this->out->dropdown( + 'type', + _('Type'), + $types, + _('Select license'), + false, + $this->value('type', 'license') + ); + + $this->unli(); + + $this->out->elementEnd('ul'); + $this->out->elementEnd('fieldset'); + + $this->out->elementStart( + 'fieldset', + array('id' => 'settings_license-details') + ); + $this->out->element('legend', null, _('License details')); + $this->out->elementStart('ul', 'form_data'); + + $this->li(); + $this->input( + 'owner', + _('Owner'), + _('Name of the owner of the site\'s content (if applicable).'), + 'license' + ); + $this->unli(); + + $this->li(); + $this->input( + 'title', + _('License Title'), + _('The title of the license.'), + 'license' + ); + $this->unli(); + + $this->li(); + $this->input( + 'url', + _('License URL'), + _('URL for more information about the license.'), + 'license' + ); + $this->unli(); + + $this->li(); + $this->input( + 'image', _('License Image URL'), + _('URL for an image to display with the license.'), + 'license' + ); + $this->unli(); + + $this->out->elementEnd('ul'); + $this->out->elementEnd('fieldset'); + } + + /** + * Action elements + * + * @return void + */ + + function formActions() + { + $this->out->submit( + 'submit', _('Save'), 'submit', null, _('Save license settings') + ); + } +} diff --git a/lib/adminpanelaction.php b/lib/adminpanelaction.php index 41cfe5851..043219a1f 100644 --- a/lib/adminpanelaction.php +++ b/lib/adminpanelaction.php @@ -409,6 +409,14 @@ class AdminPanelNav extends Widget $menu_title, $action_name == 'snapshotadminpanel', 'nav_snapshot_admin_panel'); } + if (AdminPanelAction::canAdmin('license')) { + // TRANS: Menu item title/tooltip + $menu_title = _('Set site license'); + // TRANS: Menu item for site administration + $this->out->menuItem(common_local_url('licenseadminpanel'), _('License'), + $menu_title, $action_name == 'licenseadminpanel', 'nav_license_admin_panel'); + } + Event::handle('EndAdminPanelNav', array($this)); } $this->action->elementEnd('ul'); diff --git a/lib/default.php b/lib/default.php index 45a4560ff..6200abada 100644 --- a/lib/default.php +++ b/lib/default.php @@ -300,7 +300,7 @@ $default = 'OpenID' => null), ), 'admin' => - array('panels' => array('design', 'site', 'user', 'paths', 'access', 'sessions', 'sitenotice')), + array('panels' => array('design', 'site', 'user', 'paths', 'access', 'sessions', 'sitenotice', 'license')), 'singleuser' => array('enabled' => false, 'nickname' => null), diff --git a/lib/router.php b/lib/router.php index 7e1e6a2a4..fb5a3c7c3 100644 --- a/lib/router.php +++ b/lib/router.php @@ -690,6 +690,8 @@ class Router $m->connect('admin/sessions', array('action' => 'sessionsadminpanel')); $m->connect('admin/sitenotice', array('action' => 'sitenoticeadminpanel')); $m->connect('admin/snapshot', array('action' => 'snapshotadminpanel')); + $m->connect('admin/license', array('action' => 'licenseadminpanel')); + $m->connect('getfile/:filename', array('action' => 'getfile'), -- cgit v1.2.3-54-g00ecf From 64cdbe6c5578df1dc49d8e3dd72451ab0ac96bd2 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 20 Sep 2010 13:42:58 -0700 Subject: Ticket #2750: fixes to HTTP caching behavior across login/logout boundaries * now ignoring if-modified-since if we failed an etag if-none-match comparison, per spec * now including a hash of user id/nickname in most etags, so we'll update the view properly after login/logout For API methods, checking the API-auth'ed user. (Many change results to include things like 'you're subscribed to this user' or 'this is one of your favorites', so user info is again needed) There'll still be some last-modified stamps that aren't including user info properly, probably. --- actions/apidirectmessage.php | 1 + actions/apigrouplist.php | 1 + actions/apigrouplistall.php | 1 + actions/apigroupmembership.php | 1 + actions/apigroupshow.php | 1 + actions/apistatusesshow.php | 1 + actions/apisubscriptions.php | 1 + actions/apitimelinefavorites.php | 1 + actions/apitimelinefriends.php | 1 + actions/apitimelinegroup.php | 1 + actions/apitimelinehome.php | 1 + actions/apitimelinementions.php | 1 + actions/apitimelinepublic.php | 1 + actions/apitimelinetag.php | 1 + actions/apitimelineuser.php | 1 + actions/shownotice.php | 1 + lib/action.php | 15 ++++++++++----- lib/util.php | 23 +++++++++++++++++++++++ plugins/Autocomplete/autocomplete.php | 1 + 19 files changed, 50 insertions(+), 5 deletions(-) (limited to 'actions') diff --git a/actions/apidirectmessage.php b/actions/apidirectmessage.php index 7a0f46274..e7ea38dfa 100644 --- a/actions/apidirectmessage.php +++ b/actions/apidirectmessage.php @@ -357,6 +357,7 @@ class ApiDirectMessageAction extends ApiAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), strtotime($this->messages[0]->created), strtotime($this->messages[$last]->created) diff --git a/actions/apigrouplist.php b/actions/apigrouplist.php index 148c802f4..319a1e424 100644 --- a/actions/apigrouplist.php +++ b/actions/apigrouplist.php @@ -213,6 +213,7 @@ class ApiGroupListAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->groups[0]->created), diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php index a8317608d..cc7cd901d 100644 --- a/actions/apigrouplistall.php +++ b/actions/apigrouplistall.php @@ -204,6 +204,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), strtotime($this->groups[0]->created), strtotime($this->groups[$last]->created)) diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index ffd5c7c7d..b7f3064b5 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.php @@ -183,6 +183,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->group->id, strtotime($this->profiles[0]->created), diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index 2998e505e..9b90e6b38 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -149,6 +149,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->group->id, strtotime($this->group->modified)) diff --git a/actions/apistatusesshow.php b/actions/apistatusesshow.php index 476820a43..84f8079db 100644 --- a/actions/apistatusesshow.php +++ b/actions/apistatusesshow.php @@ -194,6 +194,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->notice->id, strtotime($this->notice->created)) diff --git a/actions/apisubscriptions.php b/actions/apisubscriptions.php index 63d65f289..749d16f06 100644 --- a/actions/apisubscriptions.php +++ b/actions/apisubscriptions.php @@ -181,6 +181,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, isset($this->ids_only) ? 'IDs' : 'Profiles', diff --git a/actions/apitimelinefavorites.php b/actions/apitimelinefavorites.php index 7228960c0..f5ce5d2fd 100644 --- a/actions/apitimelinefavorites.php +++ b/actions/apitimelinefavorites.php @@ -259,6 +259,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->notices[0]->created), diff --git a/actions/apitimelinefriends.php b/actions/apitimelinefriends.php index 40ce35979..c96391c12 100644 --- a/actions/apitimelinefriends.php +++ b/actions/apitimelinefriends.php @@ -346,6 +346,7 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->notices[0]->created), diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php index 7a40fd808..5138a4b5e 100644 --- a/actions/apitimelinegroup.php +++ b/actions/apitimelinegroup.php @@ -229,6 +229,7 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->group->id, strtotime($this->notices[0]->created), diff --git a/actions/apitimelinehome.php b/actions/apitimelinehome.php index 27eb74169..1ceb3d902 100644 --- a/actions/apitimelinehome.php +++ b/actions/apitimelinehome.php @@ -254,6 +254,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->notices[0]->created), diff --git a/actions/apitimelinementions.php b/actions/apitimelinementions.php index ed1ad20e3..354dc58b6 100644 --- a/actions/apitimelinementions.php +++ b/actions/apitimelinementions.php @@ -244,6 +244,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->notices[0]->created), diff --git a/actions/apitimelinepublic.php b/actions/apitimelinepublic.php index f90164288..0119b504a 100644 --- a/actions/apitimelinepublic.php +++ b/actions/apitimelinepublic.php @@ -311,6 +311,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), strtotime($this->notices[0]->created), strtotime($this->notices[$last]->created)) diff --git a/actions/apitimelinetag.php b/actions/apitimelinetag.php index c7ec172ae..712703694 100644 --- a/actions/apitimelinetag.php +++ b/actions/apitimelinetag.php @@ -232,6 +232,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->tag, strtotime($this->notices[0]->created), diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index 17a283663..0c97aad21 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -234,6 +234,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->notices[0]->created), diff --git a/actions/shownotice.php b/actions/shownotice.php index 9c5d83441..86df5f9f3 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -151,6 +151,7 @@ class ShownoticeAction extends OwnerDesignAction strtotime($this->avatar->modified) : 0; return 'W/"' . implode(':', array($this->arg('action'), + common_user_cache_hash(), common_language(), $this->notice->id, strtotime($this->notice->created), diff --git a/lib/action.php b/lib/action.php index 5c4b4a7b7..5dcf78dcc 100644 --- a/lib/action.php +++ b/lib/action.php @@ -1018,17 +1018,22 @@ class Action extends HTMLOutputter // lawsuit } } + $checked = false; if ($etag) { $if_none_match = (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER)) ? $_SERVER['HTTP_IF_NONE_MATCH'] : null; - if ($if_none_match && $this->_hasEtag($etag, $if_none_match)) { - header('HTTP/1.1 304 Not Modified'); - // Better way to do this? - exit(0); + if ($if_none_match) { + // If this check fails, ignore the if-modified-since below. + $checked = true; + if ($this->_hasEtag($etag, $if_none_match)) { + header('HTTP/1.1 304 Not Modified'); + // Better way to do this? + exit(0); + } } } - if ($lm && array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) { + if (!$checked && $lm && array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) { $if_modified_since = $_SERVER['HTTP_IF_MODIFIED_SINCE']; $ims = strtotime($if_modified_since); if ($lm <= $ims) { diff --git a/lib/util.php b/lib/util.php index 6d2e99b2a..e0457140e 100644 --- a/lib/util.php +++ b/lib/util.php @@ -494,6 +494,29 @@ function common_is_real_login() return common_logged_in() && $_SESSION['real_login']; } +/** + * Get a hash portion for HTTP caching Etags and such including + * info on the current user's session. If login/logout state changes, + * or we've changed accounts, or we've renamed the current user, + * we'll get a new hash value. + * + * This should not be considered secure information. + * + * @param User $user (optional; uses common_current_user() if left out) + * @return string + */ +function common_user_cache_hash($user=false) +{ + if ($user === false) { + $user = common_current_user(); + } + if ($user) { + return crc32($user->id . ':' . $user->nickname); + } else { + return '0'; + } +} + // get canonical version of nickname for comparison function common_canonical_nickname($nickname) { diff --git a/plugins/Autocomplete/autocomplete.php b/plugins/Autocomplete/autocomplete.php index 5a010572f..a4e2d9baa 100644 --- a/plugins/Autocomplete/autocomplete.php +++ b/plugins/Autocomplete/autocomplete.php @@ -79,6 +79,7 @@ class AutocompleteAction extends Action function etag() { return '"' . implode(':', array($this->arg('action'), + common_user_cache_hash(), crc32($this->arg('q')), //the actual string can have funny characters in we don't want showing up in the etag $this->arg('limit'), $this->lastModified())) . '"'; -- cgit v1.2.3-54-g00ecf From a47e66409488dac8ff3e59f97a5b0fb496ec4115 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 20 Sep 2010 16:43:00 -0700 Subject: Fix for #2419: There is no function maxDescription in Oauth_application class (broke the 'description too long' error message when editing oauth app registrations) --- actions/editapplication.php | 2 +- actions/newapplication.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'actions') diff --git a/actions/editapplication.php b/actions/editapplication.php index 64cf0a574..b25457069 100644 --- a/actions/editapplication.php +++ b/actions/editapplication.php @@ -188,7 +188,7 @@ class EditApplicationAction extends OwnerDesignAction } elseif (Oauth_application::descriptionTooLong($description)) { $this->showForm(sprintf( _('Description is too long (max %d chars).'), - Oauth_application::maxDescription())); + Oauth_application::maxDesc())); return; } elseif (mb_strlen($source_url) > 255) { $this->showForm(_('Source URL is too long.')); diff --git a/actions/newapplication.php b/actions/newapplication.php index 0f819b349..8b150c315 100644 --- a/actions/newapplication.php +++ b/actions/newapplication.php @@ -170,7 +170,7 @@ class NewApplicationAction extends OwnerDesignAction } elseif (Oauth_application::descriptionTooLong($description)) { $this->showForm(sprintf( _('Description is too long (max %d chars).'), - Oauth_application::maxDescription())); + Oauth_application::maxDesc())); return; } elseif (empty($source_url)) { $this->showForm(_('Source URL is required.')); -- cgit v1.2.3-54-g00ecf From 85bf20d95afeadd682584e595df9157ad853a3ed Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 20 Sep 2010 16:57:07 -0700 Subject: Fix error when editing OAuth app registration and only changing the icon. --- actions/editapplication.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/editapplication.php b/actions/editapplication.php index b25457069..477bcd6f0 100644 --- a/actions/editapplication.php +++ b/actions/editapplication.php @@ -253,7 +253,10 @@ class EditApplicationAction extends OwnerDesignAction $result = $this->app->update($orig); - if (!$result) { + // Note: 0 means no rows changed, which can happen if the only + // thing we changed was the icon, since it's not altered until + // the next step. + if ($result === false) { common_log_db_error($this->app, 'UPDATE', __FILE__); $this->serverError(_('Could not update application.')); } -- cgit v1.2.3-54-g00ecf From d342899677d208d7e300b29ad3a8d053e4c6f704 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 20 Sep 2010 18:07:19 -0700 Subject: Fix #2323: typo on oauth connections page --- actions/oauthconnectionssettings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/oauthconnectionssettings.php b/actions/oauthconnectionssettings.php index 8a206d710..1fa70662f 100644 --- a/actions/oauthconnectionssettings.php +++ b/actions/oauthconnectionssettings.php @@ -80,7 +80,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction function getInstructions() { - return _('You have allowed the following applications to access you account.'); + return _('You have allowed the following applications to access your account.'); } /** -- cgit v1.2.3-54-g00ecf From da4463cb765937190e8a202d20ca5d33ecd46beb Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 21 Sep 2010 13:06:23 -0700 Subject: License admin panel should allow empty or valid URLs for (license URL and license image URL) when selecting private or allrightsreserved licenses. --- actions/licenseadminpanel.php | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'actions') diff --git a/actions/licenseadminpanel.php b/actions/licenseadminpanel.php index c9aad5c4f..9165ca19d 100644 --- a/actions/licenseadminpanel.php +++ b/actions/licenseadminpanel.php @@ -161,12 +161,31 @@ class LicenseadminpanelAction extends AdminPanelAction $options = array('allowed_schemes' => array('http', 'https')); - if (!Validate::uri($values['license']['url'], $options)) { - $this->clientError(_("Invalid license URL.")); + // URLs should be set for cc license + + if ($values['license']['type'] == 'cc') { + if (!Validate::uri($values['license']['url'], $options)) { + $this->clientError(_("Invalid license URL.")); + } + if (!Validate::uri($values['license']['image'], $options)) { + $this->clientError(_("Invalid license image URL.")); + } } - if (!Validate::uri($values['license']['image'], $options)) { - $this->clientError(_("Invalid license image URL.")); + // can be either blank or a valid URL for private & allrightsreserved + + if (!empty($values['license']['url'])) { + if (!Validate::uri($values['license']['url'], $options)) { + $this->clientError(_("License URL must be blank or a valid URL.")); + } + } + + // can be either blank or a valid URL for private & allrightsreserved + + if (!empty($values['license']['image'])) { + if (!Validate::uri($values['license']['image'], $options)) { + $this->clientError(_("License image must be blank or valid URL.")); + } } } } -- cgit v1.2.3-54-g00ecf From 77609e0c4a1b76748ab320027b0696aced92b52c Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 22 Sep 2010 23:30:50 +0000 Subject: Fix for ticket 2756 - Calls to OAuth endpoints are redirected to the login page when a site is in private mode --- actions/apioauthauthorize.php | 2 +- lib/router.php | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'actions') diff --git a/actions/apioauthauthorize.php b/actions/apioauthauthorize.php index e7c6f3761..c2fbbcdd8 100644 --- a/actions/apioauthauthorize.php +++ b/actions/apioauthauthorize.php @@ -270,7 +270,7 @@ class ApiOauthAuthorizeAction extends ApiOauthAction $this->elementStart('form', array('method' => 'post', 'id' => 'form_apioauthauthorize', 'class' => 'form_settings', - 'action' => common_local_url('apioauthauthorize'))); + 'action' => common_local_url('ApiOauthAuthorize'))); $this->elementStart('fieldset'); $this->element('legend', array('id' => 'apioauthauthorize_allowdeny'), _('Allow or deny access')); diff --git a/lib/router.php b/lib/router.php index fb5a3c7c3..00b299373 100644 --- a/lib/router.php +++ b/lib/router.php @@ -488,19 +488,19 @@ class Router // Social graph $m->connect('api/friends/ids/:id.:format', - array('action' => 'apiuserfriends', + array('action' => 'ApiUserFriends', 'ids_only' => true)); $m->connect('api/followers/ids/:id.:format', - array('action' => 'apiuserfollowers', + array('action' => 'ApiUserFollowers', 'ids_only' => true)); $m->connect('api/friends/ids.:format', - array('action' => 'apiuserfriends', + array('action' => 'ApiUserFriends', 'ids_only' => true)); $m->connect('api/followers/ids.:format', - array('action' => 'apiuserfollowers', + array('action' => 'ApiUserFollowers', 'ids_only' => true)); // account @@ -672,13 +672,13 @@ class Router $m->connect('api/trends.json', array('action' => 'ApiTrends')); $m->connect('api/oauth/request_token', - array('action' => 'apioauthrequesttoken')); + array('action' => 'ApiOauthRequestToken')); $m->connect('api/oauth/access_token', - array('action' => 'apioauthaccesstoken')); + array('action' => 'ApiOauthAccessToken')); $m->connect('api/oauth/authorize', - array('action' => 'apioauthauthorize')); + array('action' => 'ApiOauthAuthorize')); // Admin -- cgit v1.2.3-54-g00ecf From 84331ca7bd2a93283762b638eb25bbbd7d5e36f7 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 22 Sep 2010 23:30:50 +0000 Subject: Fix for ticket 2756 - Calls to OAuth endpoints are redirected to the login page when a site is in private mode --- actions/apioauthauthorize.php | 2 +- lib/router.php | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'actions') diff --git a/actions/apioauthauthorize.php b/actions/apioauthauthorize.php index e7c6f3761..c2fbbcdd8 100644 --- a/actions/apioauthauthorize.php +++ b/actions/apioauthauthorize.php @@ -270,7 +270,7 @@ class ApiOauthAuthorizeAction extends ApiOauthAction $this->elementStart('form', array('method' => 'post', 'id' => 'form_apioauthauthorize', 'class' => 'form_settings', - 'action' => common_local_url('apioauthauthorize'))); + 'action' => common_local_url('ApiOauthAuthorize'))); $this->elementStart('fieldset'); $this->element('legend', array('id' => 'apioauthauthorize_allowdeny'), _('Allow or deny access')); diff --git a/lib/router.php b/lib/router.php index fb5a3c7c3..00b299373 100644 --- a/lib/router.php +++ b/lib/router.php @@ -488,19 +488,19 @@ class Router // Social graph $m->connect('api/friends/ids/:id.:format', - array('action' => 'apiuserfriends', + array('action' => 'ApiUserFriends', 'ids_only' => true)); $m->connect('api/followers/ids/:id.:format', - array('action' => 'apiuserfollowers', + array('action' => 'ApiUserFollowers', 'ids_only' => true)); $m->connect('api/friends/ids.:format', - array('action' => 'apiuserfriends', + array('action' => 'ApiUserFriends', 'ids_only' => true)); $m->connect('api/followers/ids.:format', - array('action' => 'apiuserfollowers', + array('action' => 'ApiUserFollowers', 'ids_only' => true)); // account @@ -672,13 +672,13 @@ class Router $m->connect('api/trends.json', array('action' => 'ApiTrends')); $m->connect('api/oauth/request_token', - array('action' => 'apioauthrequesttoken')); + array('action' => 'ApiOauthRequestToken')); $m->connect('api/oauth/access_token', - array('action' => 'apioauthaccesstoken')); + array('action' => 'ApiOauthAccessToken')); $m->connect('api/oauth/authorize', - array('action' => 'apioauthauthorize')); + array('action' => 'ApiOauthAuthorize')); // Admin -- cgit v1.2.3-54-g00ecf From da048589021b59e9165529567b9b018290432c72 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 23 Sep 2010 16:16:32 -0700 Subject: Update OAuth actions in show application page so it will display the right endpoint URLs --- actions/showapplication.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actions') diff --git a/actions/showapplication.php b/actions/showapplication.php index fa4484481..10aaff538 100644 --- a/actions/showapplication.php +++ b/actions/showapplication.php @@ -271,17 +271,17 @@ class ShowApplicationAction extends OwnerDesignAction $this->elementStart('dl', 'entity_request_token_url'); $this->element('dt', null, _('Request token URL')); - $this->element('dd', null, common_local_url('apioauthrequesttoken')); + $this->element('dd', null, common_local_url('ApiOauthRequestToken')); $this->elementEnd('dl'); $this->elementStart('dl', 'entity_access_token_url'); $this->element('dt', null, _('Access token URL')); - $this->element('dd', null, common_local_url('apioauthaccesstoken')); + $this->element('dd', null, common_local_url('ApiOauthAccessToken')); $this->elementEnd('dl'); $this->elementStart('dl', 'entity_authorize_url'); $this->element('dt', null, _('Authorize URL')); - $this->element('dd', null, common_local_url('apioauthauthorize')); + $this->element('dd', null, common_local_url('ApiOauthAuthorize')); $this->elementEnd('dl'); $this->element('p', 'note', -- cgit v1.2.3-54-g00ecf From a6469aeed88a400d5d38d75a210417de4af4eea7 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 25 Sep 2010 12:10:36 -0700 Subject: Fix PHP syntax errors introduced during localization fixups in a few files. --- actions/groupmembers.php | 2 +- plugins/CasAuthentication/CasAuthenticationPlugin.php | 6 +++--- plugins/Imap/ImapPlugin.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'actions') diff --git a/actions/groupmembers.php b/actions/groupmembers.php index 038d1db68..d03d0b5a3 100644 --- a/actions/groupmembers.php +++ b/actions/groupmembers.php @@ -400,7 +400,7 @@ class GroupBlockForm extends Form 'submit', null, // TRANS: Submit button title. - _m('TOOLTIP',_('Block this user')); + _m('TOOLTIP', 'Block this user')); } } diff --git a/plugins/CasAuthentication/CasAuthenticationPlugin.php b/plugins/CasAuthentication/CasAuthenticationPlugin.php index 6b751a0aa..71e54d41f 100644 --- a/plugins/CasAuthentication/CasAuthenticationPlugin.php +++ b/plugins/CasAuthentication/CasAuthenticationPlugin.php @@ -125,13 +125,13 @@ class CasAuthenticationPlugin extends AuthenticationPlugin function onInitializePlugin(){ parent::onInitializePlugin(); if(!isset($this->server)){ - throw new Exception(_m("Specifying a server is required."); + throw new Exception(_m("Specifying a server is required.")); } if(!isset($this->port)){ - throw new Exception(_m("Specifying a port is required."); + throw new Exception(_m("Specifying a port is required.")); } if(!isset($this->path)){ - throw new Exception(_m("Specifying a path is required."); + throw new Exception(_m("Specifying a path is required.")); } //These values need to be accessible to a action object //I can't think of any other way than global variables diff --git a/plugins/Imap/ImapPlugin.php b/plugins/Imap/ImapPlugin.php index 1661ed86e..8d8dbf223 100644 --- a/plugins/Imap/ImapPlugin.php +++ b/plugins/Imap/ImapPlugin.php @@ -54,7 +54,7 @@ class ImapPlugin extends Plugin throw new Exception(_m("A mailbox must be specified.")); } if(!isset($this->user)){ - throw new Exception(_m("A user must be specified."); + throw new Exception(_m("A user must be specified.")); } if(!isset($this->password)){ throw new Exception(_m("A password must be specified.")); -- cgit v1.2.3-54-g00ecf From fd779009b8636399472d74e86531ba9bc86cfb59 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 28 Sep 2010 15:56:11 -0700 Subject: Add Start/EndShowNoticeItem event hooks to single notice page --- actions/shownotice.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'actions') diff --git a/actions/shownotice.php b/actions/shownotice.php index 86df5f9f3..c8e9cfe66 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -314,10 +314,14 @@ class SingleNoticeItem extends NoticeListItem function show() { $this->showStart(); - $this->showNotice(); - $this->showNoticeAttachments(); - $this->showNoticeInfo(); - $this->showNoticeOptions(); + if (Event::handle('StartShowNoticeItem', array($this))) { + $this->showNotice(); + $this->showNoticeAttachments(); + $this->showNoticeInfo(); + $this->showNoticeOptions(); + Event::handle('EndShowNoticeItem', array($this)); + } + $this->showEnd(); } -- cgit v1.2.3-54-g00ecf From 8b8450f9ad96c1ca267e5362457b0200429bf42b Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 30 Sep 2010 18:21:38 -0700 Subject: Add helper metadata on individual notice pages to aid sharing to Facebook (use poster's avatar as image, indicate the text content) --- actions/shownotice.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'actions') diff --git a/actions/shownotice.php b/actions/shownotice.php index c8e9cfe66..005335e3b 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -298,6 +298,16 @@ class ShownoticeAction extends OwnerDesignAction array(), array('format'=>'xml','url'=>$this->notice->uri)), 'title'=>'oEmbed'),null); + + // Extras to aid in sharing notices to Facebook + $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE); + $avatarUrl = ($avatar) ? + $avatar->displayUrl() : + Avatar::defaultImage($avatar_size); + $this->element('meta', array('property' => 'og:image', + 'content' => $avatarUrl)); + $this->element('meta', array('property' => 'og:description', + 'content' => $this->notice->content)); } } -- cgit v1.2.3-54-g00ecf From 12f68c4ff243829a435f774e4d486ccfb381a11d Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 1 Oct 2010 11:05:15 -0700 Subject: Throw in a quick event hook to override the profile list type on showstream (should be made more general in future). Replace with a NoticeList to have output include avatar and username -- but CSS still hides them in default theme. Event::addHandler('ShowStreamNoticeList', 'awesome'); function awesome($notice, $action, &$pnl) { $pnl = new NoticeList($notice, $action); return false; } --- actions/showstream.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/showstream.php b/actions/showstream.php index 2476f19fa..e9f117afc 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -222,7 +222,10 @@ class ShowstreamAction extends ProfileAction ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1) : $this->user->getTaggedNotices($this->tag, ($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null); - $pnl = new ProfileNoticeList($notice, $this); + $pnl = null; + if (Event::handle('ShowStreamNoticeList', array($notice, $this, &$pnl))) { + $pnl = new ProfileNoticeList($notice, $this); + } $cnt = $pnl->show(); if (0 == $cnt) { $this->showEmptyListMessage(); -- cgit v1.2.3-54-g00ecf From 5c19d33b27e44449e72e5c4b8f3d21c98b31f63a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 1 Oct 2010 14:42:12 -0700 Subject: Bugfix in FB-sharing header for empty profile avatar --- actions/shownotice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/shownotice.php b/actions/shownotice.php index 005335e3b..c5180568b 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -303,7 +303,7 @@ class ShownoticeAction extends OwnerDesignAction $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE); $avatarUrl = ($avatar) ? $avatar->displayUrl() : - Avatar::defaultImage($avatar_size); + Avatar::defaultImage(AVATAR_PROFILE_SIZE); $this->element('meta', array('property' => 'og:image', 'content' => $avatarUrl)); $this->element('meta', array('property' => 'og:description', -- cgit v1.2.3-54-g00ecf