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;
10 use Friendica\Module\BaseAdminModule;
12 class Features extends BaseAdminModule
14 public static function post(array $parameters = [])
16 parent::post($parameters);
18 parent::checkFormSecurityTokenRedirectOnError('/admin/features', 'admin_manage_features');
20 $features = Feature::get(false);
22 foreach ($features as $fname => $fdata) {
23 foreach (array_slice($fdata, 1) as $f) {
25 $feature_state = 'feature_' . $feature;
26 $featurelock = 'featurelock_' . $feature;
28 if (!empty($_POST[$feature_state])) {
29 $val = intval($_POST[$feature_state]);
33 Config::set('feature', $feature, $val);
35 if (!empty($_POST[$featurelock])) {
36 Config::set('feature_lock', $feature, $val);
38 Config::delete('feature_lock', $feature);
43 DI::baseUrl()->redirect('admin/features');
46 public static function content(array $parameters = [])
48 parent::content($parameters);
51 $features = Feature::get(false);
53 foreach ($features as $fname => $fdata) {
55 $arr[$fname][0] = $fdata[0];
56 foreach (array_slice($fdata, 1) as $f) {
57 $set = Config::get('feature', $f[0], $f[3]);
59 ['feature_' . $f[0], $f[1], $set, $f[2], [L10n::t('Off'), L10n::t('On')]],
60 ['featurelock_' . $f[0], L10n::t('Lock feature %s', $f[1]), (($f[4] !== false) ? "1" : ''), '', [L10n::t('Off'), L10n::t('On')]]
65 $tpl = Renderer::getMarkupTemplate('admin/features.tpl');
66 $o = Renderer::replaceMacros($tpl, [
67 '$form_security_token' => parent::getFormSecurityToken("admin_manage_features"),
68 '$title' => L10n::t('Manage Additional Features'),
70 '$submit' => L10n::t('Save Settings'),