summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/accessadminpanel.php192
-rw-r--r--actions/apioauthaccesstoken.php2
-rw-r--r--actions/apioauthauthorize.php4
-rw-r--r--actions/apioauthrequesttoken.php2
-rw-r--r--actions/apistatusesupdate.php18
-rw-r--r--actions/avatarsettings.php4
-rw-r--r--actions/designadminpanel.php4
-rw-r--r--actions/editapplication.php2
-rw-r--r--actions/grouplogo.php4
-rw-r--r--actions/inbox.php4
-rw-r--r--actions/newapplication.php2
-rw-r--r--actions/outbox.php4
-rw-r--r--actions/pathsadminpanel.php33
-rw-r--r--actions/replies.php2
-rw-r--r--actions/showfavorites.php4
-rw-r--r--actions/showgroup.php4
-rw-r--r--actions/showstream.php2
-rw-r--r--actions/siteadminpanel.php54
-rw-r--r--actions/tag.php6
-rw-r--r--actions/usergroups.php4
20 files changed, 258 insertions, 93 deletions
diff --git a/actions/accessadminpanel.php b/actions/accessadminpanel.php
new file mode 100644
index 000000000..4768e2faf
--- /dev/null
+++ b/actions/accessadminpanel.php
@@ -0,0 +1,192 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Site access administration panel
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (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.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Settings
+ * @package StatusNet
+ * @author Zach Copley <zach@status.net>
+ * @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);
+}
+
+/**
+ * Administer site access settings
+ *
+ * @category Admin
+ * @package StatusNet
+ * @author Zach Copley <zach@status.net>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ */
+
+class AccessadminpanelAction extends AdminPanelAction
+{
+ /**
+ * Returns the page title
+ *
+ * @return string page title
+ */
+
+ function title()
+ {
+ return _('Access');
+ }
+
+ /**
+ * Instructions for using this form.
+ *
+ * @return string instructions
+ */
+
+ function getInstructions()
+ {
+ return _('Site access settings');
+ }
+
+ /**
+ * Show the site admin panel form
+ *
+ * @return void
+ */
+
+ function showForm()
+ {
+ $form = new AccessAdminPanelForm($this);
+ $form->show();
+ return;
+ }
+
+ /**
+ * Save settings from the form
+ *
+ * @return void
+ */
+
+ function saveSettings()
+ {
+ static $booleans = array('site' => array('private', 'inviteonly', 'closed'));
+
+ foreach ($booleans as $section => $parts) {
+ foreach ($parts as $setting) {
+ $values[$section][$setting] = ($this->boolean($setting)) ? 1 : 0;
+ }
+ }
+
+ $config = new Config();
+
+ $config->query('BEGIN');
+
+ foreach ($booleans as $section => $parts) {
+ foreach ($parts as $setting) {
+ Config::save($section, $setting, $values[$section][$setting]);
+ }
+ }
+
+ $config->query('COMMIT');
+
+ return;
+ }
+
+}
+
+class AccessAdminPanelForm extends AdminForm
+{
+ /**
+ * ID of the form
+ *
+ * @return int ID of the form
+ */
+
+ function id()
+ {
+ return 'form_site_admin_panel';
+ }
+
+ /**
+ * 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('accessadminpanel');
+ }
+
+ /**
+ * Data elements of the form
+ *
+ * @return void
+ */
+
+ function formData()
+ {
+ $this->out->elementStart('fieldset', array('id' => 'settings_admin_access'));
+ $this->out->element('legend', null, _('Registration'));
+ $this->out->elementStart('ul', 'form_data');
+ $this->li();
+ $this->out->checkbox('private', _('Private'),
+ (bool) $this->value('private'),
+ _('Prohibit anonymous users (not logged in) from viewing site?'));
+ $this->unli();
+
+ $this->li();
+ $this->out->checkbox('inviteonly', _('Invite only'),
+ (bool) $this->value('inviteonly'),
+ _('Make registration invitation only.'));
+ $this->unli();
+
+ $this->li();
+ $this->out->checkbox('closed', _('Closed'),
+ (bool) $this->value('closed'),
+ _('Disable new registrations.'));
+ $this->unli();
+ $this->out->elementEnd('ul');
+ $this->out->elementEnd('fieldset');
+ }
+
+ /**
+ * Action elements
+ *
+ * @return void
+ */
+
+ function formActions()
+ {
+ $this->out->submit('submit', _('Save'), 'submit', null, _('Save access settings'));
+ }
+
+}
diff --git a/actions/apioauthaccesstoken.php b/actions/apioauthaccesstoken.php
index 085ef6f0b..887df4c20 100644
--- a/actions/apioauthaccesstoken.php
+++ b/actions/apioauthaccesstoken.php
@@ -70,7 +70,7 @@ class ApiOauthAccessTokenAction extends ApiOauthAction
$atok = $server->fetch_access_token($req);
} catch (OAuthException $e) {
- common_log(LOG_WARN, 'API OAuthException - ' . $e->getMessage());
+ common_log(LOG_WARNING, 'API OAuthException - ' . $e->getMessage());
common_debug(var_export($req, true));
$this->outputError($e->getMessage());
return;
diff --git a/actions/apioauthauthorize.php b/actions/apioauthauthorize.php
index 19128bdce..fa074c4e7 100644
--- a/actions/apioauthauthorize.php
+++ b/actions/apioauthauthorize.php
@@ -303,8 +303,8 @@ class ApiOauthAuthorizeAction extends ApiOauthAction
$access = ($this->app->access_type & Oauth_application::$writeAccess) ?
'access and update' : 'access';
- $msg = _("The application <strong>%1$s</strong> by <strong>%2$s</strong> would like " .
- "the ability to <strong>%3$s</strong> your account data.");
+ $msg = _("The application <strong>%s</strong> by <strong>%s</strong> would like " .
+ "the ability to <strong>%s</strong> your account data.");
$this->raw(sprintf($msg,
$this->app->name,
diff --git a/actions/apioauthrequesttoken.php b/actions/apioauthrequesttoken.php
index 467640b9a..4fa626d86 100644
--- a/actions/apioauthrequesttoken.php
+++ b/actions/apioauthrequesttoken.php
@@ -89,7 +89,7 @@ class ApiOauthRequestTokenAction extends ApiOauthAction
$token = $server->fetch_request_token($req);
print $token;
} catch (OAuthException $e) {
- common_log(LOG_WARN, 'API OAuthException - ' . $e->getMessage());
+ common_log(LOG_WARNING, 'API OAuthException - ' . $e->getMessage());
header('HTTP/1.1 401 Unauthorized');
header('Content-Type: text/html; charset=utf-8');
print $e->getMessage() . "\n";
diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php
index 31c9b20ce..bf367e1e1 100644
--- a/actions/apistatusesupdate.php
+++ b/actions/apistatusesupdate.php
@@ -28,7 +28,7 @@
* @author Mike Cochrane <mikec@mikenz.geek.nz>
* @author Robin Millette <robin@millette.info>
* @author Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-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/
*/
@@ -79,7 +79,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction
{
parent::prepare($args);
- $this->user = $this->auth_user;
$this->status = $this->trimmed('status');
$this->source = $this->trimmed('source');
$this->lat = $this->trimmed('lat');
@@ -145,7 +144,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
return;
}
- if (empty($this->user)) {
+ if (empty($this->auth_user)) {
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
@@ -172,7 +171,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
// Check for commands
$inter = new CommandInterpreter();
- $cmd = $inter->handle_command($this->user, $status_shortened);
+ $cmd = $inter->handle_command($this->auth_user, $status_shortened);
if ($cmd) {
@@ -184,7 +183,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
// And, it returns your last status whether the cmd was successful
// or not!
- $this->notice = $this->user->getCurrentNotice();
+ $this->notice = $this->auth_user->getCurrentNotice();
} else {
@@ -211,7 +210,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$upload = null;
try {
- $upload = MediaFile::fromUpload('media', $this->user);
+ $upload = MediaFile::fromUpload('media', $this->auth_user);
} catch (ClientException $ce) {
$this->clientError($ce->getMessage());
return;
@@ -234,19 +233,19 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$options = array('reply_to' => $reply_to);
- if ($this->user->shareLocation()) {
+ if ($this->auth_user->shareLocation()) {
$locOptions = Notice::locationOptions($this->lat,
$this->lon,
null,
null,
- $this->user->getProfile());
+ $this->auth_user->getProfile());
$options = array_merge($options, $locOptions);
}
$this->notice =
- Notice::saveNew($this->user->id,
+ Notice::saveNew($this->auth_user->id,
$content,
$this->source,
$options);
@@ -255,7 +254,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$upload->attachToNotice($this->notice);
}
-
}
$this->showNotice();
diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php
index cf4525552..6a7398746 100644
--- a/actions/avatarsettings.php
+++ b/actions/avatarsettings.php
@@ -416,8 +416,8 @@ class AvatarsettingsAction extends AccountSettingsAction
parent::showScripts();
if ($this->mode == 'crop') {
- $this->script('js/jcrop/jquery.Jcrop.min.js');
- $this->script('js/jcrop/jquery.Jcrop.go.js');
+ $this->script('jcrop/jquery.Jcrop.min.js');
+ $this->script('jcrop/jquery.Jcrop.go.js');
}
$this->autofocus('avatarfile');
diff --git a/actions/designadminpanel.php b/actions/designadminpanel.php
index 72ad6ade2..30e8bde1a 100644
--- a/actions/designadminpanel.php
+++ b/actions/designadminpanel.php
@@ -302,8 +302,8 @@ class DesignadminpanelAction extends AdminPanelAction
{
parent::showScripts();
- $this->script('js/farbtastic/farbtastic.js');
- $this->script('js/userdesign.go.js');
+ $this->script('farbtastic/farbtastic.js');
+ $this->script('userdesign.go.js');
$this->autofocus('design_background-image_file');
}
diff --git a/actions/editapplication.php b/actions/editapplication.php
index 3b120259a..9cc3e3cea 100644
--- a/actions/editapplication.php
+++ b/actions/editapplication.php
@@ -51,7 +51,7 @@ class EditApplicationAction extends OwnerDesignAction
function title()
{
- return _('Edit application');
+ return _('Edit Application');
}
/**
diff --git a/actions/grouplogo.php b/actions/grouplogo.php
index f197aef33..3c9b56296 100644
--- a/actions/grouplogo.php
+++ b/actions/grouplogo.php
@@ -437,8 +437,8 @@ class GrouplogoAction extends GroupDesignAction
parent::showScripts();
if ($this->mode == 'crop') {
- $this->script('js/jcrop/jquery.Jcrop.min.js');
- $this->script('js/jcrop/jquery.Jcrop.go.js');
+ $this->script('jcrop/jquery.Jcrop.min.js');
+ $this->script('jcrop/jquery.Jcrop.go.js');
}
$this->autofocus('avatarfile');
diff --git a/actions/inbox.php b/actions/inbox.php
index f605cc9e8..8330f753f 100644
--- a/actions/inbox.php
+++ b/actions/inbox.php
@@ -56,10 +56,10 @@ class InboxAction extends MailboxAction
function title()
{
if ($this->page > 1) {
- return sprintf(_("Inbox for %1$s - page %2$d"), $this->user->nickname,
+ return sprintf(_('Inbox for %1$s - page %2$d'), $this->user->nickname,
$this->page);
} else {
- return sprintf(_("Inbox for %s"), $this->user->nickname);
+ return sprintf(_('Inbox for %s'), $this->user->nickname);
}
}
diff --git a/actions/newapplication.php b/actions/newapplication.php
index bc5b4edaf..c499fe7c7 100644
--- a/actions/newapplication.php
+++ b/actions/newapplication.php
@@ -49,7 +49,7 @@ class NewApplicationAction extends OwnerDesignAction
function title()
{
- return _('New application');
+ return _('New Application');
}
/**
diff --git a/actions/outbox.php b/actions/outbox.php
index de30de018..b81d4b9d0 100644
--- a/actions/outbox.php
+++ b/actions/outbox.php
@@ -55,10 +55,10 @@ class OutboxAction extends MailboxAction
function title()
{
if ($this->page > 1) {
- return sprintf(_("Outbox for %1$s - page %2$d"),
+ return sprintf(_('Outbox for %1$s - page %2$d'),
$this->user->nickname, $page);
} else {
- return sprintf(_("Outbox for %s"), $this->user->nickname);
+ return sprintf(_('Outbox for %s'), $this->user->nickname);
}
}
diff --git a/actions/pathsadminpanel.php b/actions/pathsadminpanel.php
index 3779fcfaa..9155a7e42 100644
--- a/actions/pathsadminpanel.php
+++ b/actions/pathsadminpanel.php
@@ -24,7 +24,7 @@
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
* @author Sarven Capadisli <csarven@status.net>
- * @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/
*/
@@ -98,6 +98,11 @@ class PathsadminpanelAction extends AdminPanelAction
'background' => array('server', 'dir', 'path')
);
+ // XXX: If we're only going to have one boolean on thi page we
+ // can remove some of the boolean processing code --Z
+
+ static $booleans = array('site' => array('fancy'));
+
$values = array();
foreach ($settings as $section => $parts) {
@@ -106,6 +111,12 @@ class PathsadminpanelAction extends AdminPanelAction
}
}
+ foreach ($booleans as $section => $parts) {
+ foreach ($parts as $setting) {
+ $values[$section][$setting] = ($this->boolean($setting)) ? 1 : 0;
+ }
+ }
+
$this->validate($values);
// assert(all values are valid);
@@ -120,7 +131,13 @@ class PathsadminpanelAction extends AdminPanelAction
}
}
- $config->query('COMMIT');
+ foreach ($booleans as $section => $parts) {
+ foreach ($parts as $setting) {
+ Config::save($section, $setting, $values[$section][$setting]);
+ }
+ }
+
+ $config->query('COMMIT');
return;
}
@@ -213,10 +230,14 @@ class PathsAdminPanelForm extends AdminForm
function formData()
{
- $this->out->elementStart('fieldset', array('id' => 'settings_paths_locale'));
+ $this->out->elementStart('fieldset', array('id' => 'settings_paths_locale'));
$this->out->element('legend', null, _('Site'), 'site');
$this->out->elementStart('ul', 'form_data');
+ $this->li();
+ $this->input('server', _('Server'), _('Site\'s server hostname.'));
+ $this->unli();
+
$this->li();
$this->input('path', _('Path'), _('Site path'));
$this->unli();
@@ -225,6 +246,12 @@ class PathsAdminPanelForm extends AdminForm
$this->input('locale_path', _('Path to locales'), _('Directory path to locales'), 'site');
$this->unli();
+ $this->li();
+ $this->out->checkbox('fancy', _('Fancy URLs'),
+ (bool) $this->value('fancy'),
+ _('Use fancy (more readable and memorable) URLs?'));
+ $this->unli();
+
$this->out->elementEnd('ul');
$this->out->elementEnd('fieldset');
diff --git a/actions/replies.php b/actions/replies.php
index 2e50f1c3c..164c328db 100644
--- a/actions/replies.php
+++ b/actions/replies.php
@@ -124,7 +124,7 @@ class RepliesAction extends OwnerDesignAction
if ($this->page == 1) {
return sprintf(_("Replies to %s"), $this->user->nickname);
} else {
- return sprintf(_("Replies to %1$s, page %2$d"),
+ return sprintf(_('Replies to %1$s, page %2$d'),
$this->user->nickname,
$this->page);
}
diff --git a/actions/showfavorites.php b/actions/showfavorites.php
index 6023f0156..f2d082293 100644
--- a/actions/showfavorites.php
+++ b/actions/showfavorites.php
@@ -74,9 +74,9 @@ class ShowfavoritesAction extends OwnerDesignAction
function title()
{
if ($this->page == 1) {
- return sprintf(_("%s's favorite notices"), $this->user->nickname);
+ return sprintf(_('%s\'s favorite notices'), $this->user->nickname);
} else {
- return sprintf(_("%1$s's favorite notices, page %2$d"),
+ return sprintf(_('%1$s\'s favorite notices, page %2$d'),
$this->user->nickname,
$this->page);
}
diff --git a/actions/showgroup.php b/actions/showgroup.php
index 06ae572e8..8042a4951 100644
--- a/actions/showgroup.php
+++ b/actions/showgroup.php
@@ -79,9 +79,9 @@ class ShowgroupAction extends GroupDesignAction
}
if ($this->page == 1) {
- return sprintf(_("%s group"), $base);
+ return sprintf(_('%s group'), $base);
} else {
- return sprintf(_("%1$s group, page %2$d"),
+ return sprintf(_('%1$s group, page %2$d'),
$base,
$this->page);
}
diff --git a/actions/showstream.php b/actions/showstream.php
index 75e10858d..90ff67073 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -76,7 +76,7 @@ class ShowstreamAction extends ProfileAction
if ($this->page == 1) {
return $base;
} else {
- return sprintf(_("%1$s, page %2$d"),
+ return sprintf(_('%1$s, page %2$d'),
$base,
$this->page);
}
diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php
index dd388a18a..8c8f8b374 100644
--- a/actions/siteadminpanel.php
+++ b/actions/siteadminpanel.php
@@ -24,7 +24,7 @@
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
* @author Sarven Capadisli <csarven@status.net>
- * @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/
*/
@@ -95,8 +95,6 @@ class SiteadminpanelAction extends AdminPanelAction
'site', 'textlimit', 'dupelimit'),
'snapshot' => array('run', 'reporturl', 'frequency'));
- static $booleans = array('site' => array('private', 'inviteonly', 'closed', 'fancy'));
-
$values = array();
foreach ($settings as $section => $parts) {
@@ -105,12 +103,6 @@ class SiteadminpanelAction extends AdminPanelAction
}
}
- foreach ($booleans as $section => $parts) {
- foreach ($parts as $setting) {
- $values[$section][$setting] = ($this->boolean($setting)) ? 1 : 0;
- }
- }
-
// This throws an exception on validation errors
$this->validate($values);
@@ -127,12 +119,6 @@ class SiteadminpanelAction extends AdminPanelAction
}
}
- foreach ($booleans as $section => $parts) {
- foreach ($parts as $setting) {
- Config::save($section, $setting, $values[$section][$setting]);
- }
- }
-
$config->query('COMMIT');
return;
@@ -299,44 +285,6 @@ class SiteAdminPanelForm extends AdminForm
$this->out->elementEnd('ul');
$this->out->elementEnd('fieldset');
- $this->out->elementStart('fieldset', array('id' => 'settings_admin_urls'));
- $this->out->element('legend', null, _('URLs'));
- $this->out->elementStart('ul', 'form_data');
- $this->li();
- $this->input('server', _('Server'), _('Site\'s server hostname.'));
- $this->unli();
-
- $this->li();
- $this->out->checkbox('fancy', _('Fancy URLs'),
- (bool) $this->value('fancy'),
- _('Use fancy (more readable and memorable) URLs?'));
- $this->unli();
- $this->out->elementEnd('ul');
- $this->out->elementEnd('fieldset');
-
- $this->out->elementStart('fieldset', array('id' => 'settings_admin_access'));
- $this->out->element('legend', null, _('Access'));
- $this->out->elementStart('ul', 'form_data');
- $this->li();
- $this->out->checkbox('private', _('Private'),
- (bool) $this->value('private'),
- _('Prohibit anonymous users (not logged in) from viewing site?'));
- $this->unli();
-
- $this->li();
- $this->out->checkbox('inviteonly', _('Invite only'),
- (bool) $this->value('inviteonly'),
- _('Make registration invitation only.'));
- $this->unli();
-
- $this->li();
- $this->out->checkbox('closed', _('Closed'),
- (bool) $this->value('closed'),
- _('Disable new registrations.'));
- $this->unli();
- $this->out->elementEnd('ul');
- $this->out->elementEnd('fieldset');
-
$this->out->elementStart('fieldset', array('id' => 'settings_admin_snapshots'));
$this->out->element('legend', null, _('Snapshots'));
$this->out->elementStart('ul', 'form_data');
diff --git a/actions/tag.php b/actions/tag.php
index 12857236e..e91df6ea9 100644
--- a/actions/tag.php
+++ b/actions/tag.php
@@ -63,9 +63,9 @@ class TagAction extends Action
function title()
{
if ($this->page == 1) {
- return sprintf(_("Notices tagged with %s"), $this->tag);
+ return sprintf(_('Notices tagged with %s'), $this->tag);
} else {
- return sprintf(_("Notices tagged with %1$s, page %2$d"),
+ return sprintf(_('Notices tagged with %1$s, page %2$d'),
$this->tag,
$this->page);
}
@@ -85,7 +85,7 @@ class TagAction extends Action
array('tag' => $this->tag)),
sprintf(_('Notice feed for tag %s (RSS 1.0)'),
$this->tag)),
- new Feed(Feed::RSS2,
+ new Feed(Feed::RSS2,
common_local_url('ApiTimelineTag',
array('format' => 'rss',
'tag' => $this->tag)),
diff --git a/actions/usergroups.php b/actions/usergroups.php
index 504226143..97faabae6 100644
--- a/actions/usergroups.php
+++ b/actions/usergroups.php
@@ -59,9 +59,9 @@ class UsergroupsAction extends OwnerDesignAction
function title()
{
if ($this->page == 1) {
- return sprintf(_("%s groups"), $this->user->nickname);
+ return sprintf(_('%s groups'), $this->user->nickname);
} else {
- return sprintf(_("%1$s groups, page %2$d"),
+ return sprintf(_('%1$s groups, page %2$d'),
$this->user->nickname,
$this->page);
}