From dbb4ccbcc02325c79c1b660d4d636f8638e35e06 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 5 Sep 2016 21:00:00 -0700 Subject: move the rest of mod_admin to sub modules --- Zotlabs/Module/Admin/Features.php | 74 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Zotlabs/Module/Admin/Features.php (limited to 'Zotlabs/Module/Admin/Features.php') diff --git a/Zotlabs/Module/Admin/Features.php b/Zotlabs/Module/Admin/Features.php new file mode 100644 index 000000000..504caae79 --- /dev/null +++ b/Zotlabs/Module/Admin/Features.php @@ -0,0 +1,74 @@ + $fdata) { + foreach(array_slice($fdata,1) as $f) { + $feature = $f[0]; + + if(array_key_exists('feature_' . $feature,$_POST)) + $val = intval($_POST['feature_' . $feature]); + else + $val = 0; + set_config('feature',$feature,$val); + + if(array_key_exists('featurelock_' . $feature,$_POST)) + set_config('feature_lock',$feature,$val); + else + del_config('feature_lock',$feature); + } + } + + goaway(z_root() . '/admin/features' ); + + } + + function get() { + + if((argc() > 1) && (argv(1) === 'features')) { + $arr = array(); + $features = get_features(false); + + foreach($features as $fname => $fdata) { + $arr[$fname] = array(); + $arr[$fname][0] = $fdata[0]; + foreach(array_slice($fdata,1) as $f) { + + $set = get_config('feature',$f[0]); + if($set === false) + $set = $f[3]; + $arr[$fname][1][] = array( + array('feature_' .$f[0],$f[1],$set,$f[2],array(t('Off'),t('On'))), + array('featurelock_' .$f[0],sprintf( t('Lock feature %s'),$f[1]),(($f[4] !== false) ? 1 : 0),'',array(t('Off'),t('On'))) + ); + } + } + + $tpl = get_markup_template("admin_settings_features.tpl"); + $o .= replace_macros($tpl, array( + '$form_security_token' => get_form_security_token("admin_manage_features"), + '$title' => t('Manage Additional Features'), + '$features' => $arr, + '$submit' => t('Submit'), + )); + + return $o; + } + } + + +} \ No newline at end of file -- cgit v1.2.3