3 namespace Friendica\Module\Admin;
5 use Friendica\Content\Feature;
6 use Friendica\Core\Renderer;
8 use Friendica\Module\BaseAdminModule;
10 class Features extends BaseAdminModule
12 public static function post(array $parameters = [])
14 parent::post($parameters);
16 parent::checkFormSecurityTokenRedirectOnError('/admin/features', 'admin_manage_features');
18 $features = Feature::get(false);
20 foreach ($features as $fname => $fdata) {
21 foreach (array_slice($fdata, 1) as $f) {
23 $feature_state = 'feature_' . $feature;
24 $featurelock = 'featurelock_' . $feature;
26 if (!empty($_POST[$feature_state])) {
27 $val = intval($_POST[$feature_state]);
31 DI::config()->set('feature', $feature, $val);
33 if (!empty($_POST[$featurelock])) {
34 DI::config()->set('feature_lock', $feature, $val);
36 DI::config()->delete('feature_lock', $feature);
41 DI::baseUrl()->redirect('admin/features');
44 public static function content(array $parameters = [])
46 parent::content($parameters);
49 $features = Feature::get(false);
51 foreach ($features as $fname => $fdata) {
53 $arr[$fname][0] = $fdata[0];
54 foreach (array_slice($fdata, 1) as $f) {
55 $set = DI::config()->get('feature', $f[0], $f[3]);
57 ['feature_' . $f[0], $f[1], $set, $f[2], [DI::l10n()->t('Off'), DI::l10n()->t('On')]],
58 ['featurelock_' . $f[0], DI::l10n()->t('Lock feature %s', $f[1]), (($f[4] !== false) ? "1" : ''), '', [DI::l10n()->t('Off'), DI::l10n()->t('On')]]
63 $tpl = Renderer::getMarkupTemplate('admin/features.tpl');
64 $o = Renderer::replaceMacros($tpl, [
65 '$form_security_token' => parent::getFormSecurityToken("admin_manage_features"),
66 '$title' => DI::l10n()->t('Manage Additional Features'),
68 '$submit' => DI::l10n()->t('Save Settings'),