diff --git a/public/include/config/admin_settings.inc.php b/public/include/config/admin_settings.inc.php new file mode 100644 index 00000000..bd6ece0f --- /dev/null +++ b/public/include/config/admin_settings.inc.php @@ -0,0 +1,68 @@ +isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) { + header("HTTP/1.1 404 Page not found"); + die("404 Page not found"); +} + +if (@$_REQUEST['do'] == 'save' && !empty($_REQUEST['data'])) { + foreach($_REQUEST['data'] as $var => $value) { + $setting->setValue($var, $value); + } + $_SESSION['POPUP'][] = array('CONTENT' => 'Settings updated'); +} + +// Load the settings available in this system +$aSettings['system'][] = array( + 'display' => 'Maintenance Mode', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'name' => 'maintenance', 'value' => $setting->getValue('maintenance'), + 'tooltip' => 'Enable or Disable maintenance mode. Only admins can still login.' +); +$aSettings['system'][] = array( + 'display' => 'Disable registrations', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'name' => 'lock_registration', 'value' => $setting->getValue('lock_registration'), + 'tooltip' => 'Enable or Disable registrations. Useful to create an invitation only pool.' +); +$aSettings['system'][] = array( + 'display' => 'Disable Invitations', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'name' => 'disable_invitations', 'value' => $setting->getValue('disable_invitations'), + 'tooltip' => 'Enable or Disable invitations. Users will not be able to invite new users via email if disabled.' +); +$aSettings['system'][] = array( + 'display' => 'Disable Manual Payouts', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'name' => 'disable_mp', 'value' => $setting->getValue('disable_mp'), + 'tooltip' => 'Enable or Disable the manual payout processing. Users will not be able to withdraw any funds if disabled.' +); +$aSettings['system'][] = array( + 'display' => 'Disable Automatic Payouts', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'name' => 'disable_ap', 'value' => $setting->getValue('disable_ap'), + 'tooltip' => 'Enable or Disable the automatic payout processing. Users exceeding their thresholds will not be paid out if disabled.' +); +$aSettings['system'][] = array( + 'display' => 'Disable notifications', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'name' => 'disable_notifications', 'value' => $setting->getValue('disable_notifications'), + 'tooltip' => 'Enable or Disable system notifications. This includes new found blocks, monitoring and all other notifications.' +); +$aSettings['other'][] = array( + 'display' => 'Message of the Day', 'type' => 'text', + 'size' => 25, + 'name' => 'system_motd', 'value' => $setting->getValue('system_motd'), + 'tooltip' => 'Display a message of the day as information popup if set.' +); + +// Load onto the template +$smarty->assign("SETTINGS", $aSettings); + +// Tempalte specifics +$smarty->assign("CONTENT", "default.tpl"); +?> diff --git a/public/include/pages/admin/settings.inc.php b/public/include/pages/admin/settings.inc.php index dca050f0..e5dc124e 100644 --- a/public/include/pages/admin/settings.inc.php +++ b/public/include/pages/admin/settings.inc.php @@ -16,14 +16,11 @@ if (@$_REQUEST['do'] == 'save' && !empty($_REQUEST['data'])) { $_SESSION['POPUP'][] = array('CONTENT' => 'Settings updated'); } -// Fetch settings to propagate to template -$smarty->assign("MAINTENANCE", $setting->getValue('maintenance')); -$smarty->assign("LOCKREGISTRATION", $setting->getValue('lock_registration')); -$smarty->assign("DISABLEINVITATIONS", $setting->getValue('disable_invitations')); -$smarty->assign("DISABLEAP", $setting->getValue('disable_ap')); -$smarty->assign("DISABLEMP", $setting->getValue('disable_mp')); -$smarty->assign("DISABLENOTIFICATIONS", $setting->getValue('disable_notifications')); -$smarty->assign("MOTD", $setting->getValue('system_motd')); +// Load our available settings from configuration +require_once(INCLUDE_DIR . '/config/admin_settings.inc.php'); + +// Load onto the template +$smarty->assign("SETTINGS", $aSettings); // Tempalte specifics $smarty->assign("CONTENT", "default.tpl"); diff --git a/public/templates/mmcFE/admin/settings/default.tpl b/public/templates/mmcFE/admin/settings/default.tpl index eb0b7bc0..dd5c5a09 100644 --- a/public/templates/mmcFE/admin/settings/default.tpl +++ b/public/templates/mmcFE/admin/settings/default.tpl @@ -1,4 +1,6 @@ -{include file="global/block_header.tpl" BLOCK_HEADER="Admin Settings"} +{include file="global/block_header.tpl" BLOCK_HEADER="Admin Settings" BUTTONS=array_keys($SETTINGS)} +{foreach item=TAB from=array_keys($SETTINGS)} +