3 namespace Friendica\Module\Admin;
5 use Friendica\Content\Feature;
6 use Friendica\Core\Config;
7 use Friendica\Core\L10n;
8 use Friendica\Core\Renderer;
9 use Friendica\Module\BaseAdminModule;
11 class Features extends BaseAdminModule
13 public static function post(array $parameters = [])
15 parent::post($parameters);
17 parent::checkFormSecurityTokenRedirectOnError('/admin/features', 'admin_manage_features');
19 $features = Feature::get(false);
21 foreach ($features as $fname => $fdata) {
22 foreach (array_slice($fdata, 1) as $f) {
24 $feature_state = 'feature_' . $feature;
25 $featurelock = 'featurelock_' . $feature;
27 if (!empty($_POST[$feature_state])) {
28 $val = intval($_POST[$feature_state]);
32 Config::set('feature', $feature, $val);
34 if (!empty($_POST[$featurelock])) {
35 Config::set('feature_lock', $feature, $val);
37 Config::delete('feature_lock', $feature);
42 self::getApp()->internalRedirect('admin/features');
45 public static function content(array $parameters = [])
47 parent::content($parameters);
50 $features = Feature::get(false);
52 foreach ($features as $fname => $fdata) {
54 $arr[$fname][0] = $fdata[0];
55 foreach (array_slice($fdata, 1) as $f) {
56 $set = Config::get('feature', $f[0], $f[3]);
58 ['feature_' . $f[0], $f[1], $set, $f[2], [L10n::t('Off'), L10n::t('On')]],
59 ['featurelock_' . $f[0], L10n::t('Lock feature %s', $f[1]), (($f[4] !== false) ? "1" : ''), '', [L10n::t('Off'), L10n::t('On')]]
64 $tpl = Renderer::getMarkupTemplate('admin/features.tpl');
65 $o = Renderer::replaceMacros($tpl, [
66 '$form_security_token' => parent::getFormSecurityToken("admin_manage_features"),
67 '$title' => L10n::t('Manage Additional Features'),
69 '$submit' => L10n::t('Save Settings'),