aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/configureController.php
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <github@ainw.org> 2015-08-22 09:33:58 -0400
committerGravatar Alexis Degrugillier <github@ainw.org> 2015-08-22 09:33:58 -0400
commit269c6b88c4486a0ae1a92df65578ee6ab6f0bbca (patch)
treed8771ef8e7c2c128b81a4187cb6d8b728421e7f9 /app/Controllers/configureController.php
parenta63dadd91bcb23f2b9d2ecac9bef76265b8d9f48 (diff)
Add a system configuration page
It allows to modify system configuration from the interface. At the moment, only limits are modifiable. The user limit was removed from the user page and added here along with categories and feeds limits.
Diffstat (limited to 'app/Controllers/configureController.php')
-rwxr-xr-xapp/Controllers/configureController.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php
index 248a3edcc..7a4d0ecd7 100755
--- a/app/Controllers/configureController.php
+++ b/app/Controllers/configureController.php
@@ -293,4 +293,37 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
Minz_Request::good(_t('feedback.conf.query_created', $query['name']),
array('c' => 'configure', 'a' => 'queries'));
}
+
+ /**
+ * This action handles the system configuration page.
+ *
+ * It displays the system configuration page.
+ * If this action is reach through a POST request, it stores all new
+ * configuration values then sends a notification to the user.
+ *
+ * The options available on the page are:
+ * - user limit (default: 1)
+ * - user category limit (default: 16384)
+ * - user feed limit (default: 16384)
+ */
+ public function systemAction() {
+ if (!FreshRSS_Auth::hasAccess('admin')) {
+ Minz_Error::error(403);
+ }
+ if (Minz_Request::isPost()) {
+ $limits = FreshRSS_Context::$system_conf->limits;
+ $limits['max_registrations'] = Minz_Request::param('max-registrations', 1);
+ $limits['max_feeds'] = Minz_Request::param('max-feeds', 16384);
+ $limits['max_categories'] = Minz_Request::param('max-categories', 16384);
+ FreshRSS_Context::$system_conf->limits = $limits;
+ FreshRSS_Context::$system_conf->save();
+
+ invalidateHttpCache();
+
+ Minz_Session::_param('notification', array(
+ 'type' => 'good',
+ 'content' => _t('feedback.conf.updated')
+ ));
+ }
+ }
}