From 2c24099e934fcf577b9a38b3446c5ab0ab1b63bd Mon Sep 17 00:00:00 2001 From: iAmShorty Date: Mon, 5 May 2014 14:27:38 +0200 Subject: [PATCH 1/2] [UPDATE] alert styles --- include/config/admin_settings.inc.php | 7 +++++++ include/smarty_globals.inc.php | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/config/admin_settings.inc.php b/include/config/admin_settings.inc.php index b5839ef7..2d8b0f6a 100644 --- a/include/config/admin_settings.inc.php +++ b/include/config/admin_settings.inc.php @@ -20,6 +20,13 @@ $aSettings['website'][] = array( 'name' => 'system_motd', 'value' => $setting->getValue('system_motd'), 'tooltip' => 'Display a message of the day as information popup if set.' ); +$aSettings['website'][] = array( + 'display' => 'MOTD Style', 'type' => 'select', + 'options' => array( 0 => 'Success', 1 => 'Information', 2 => 'Warning', 3 => 'Danger' ), + 'default' => 0, + 'name' => 'motd_style', 'value' => $setting->getValue('motd_style'), + 'tooltip' => 'Set the Style what MOTD looks like.' +); $aSettings['website'][] = array( 'display' => 'Website Name', 'type' => 'text', 'size' => 25, diff --git a/include/smarty_globals.inc.php b/include/smarty_globals.inc.php index 68e920b5..82207e97 100644 --- a/include/smarty_globals.inc.php +++ b/include/smarty_globals.inc.php @@ -188,7 +188,18 @@ if (@$_SESSION['USERDATA']['id']) { if ($setting->getValue('maintenance')) $_SESSION['POPUP'][] = array('CONTENT' => 'This pool is currently in maintenance mode.', 'TYPE' => 'alert alert-warning'); if ($motd = $setting->getValue('system_motd')) - $_SESSION['POPUP'][] = array('CONTENT' => $motd, 'DISMISS' => 'yes', 'ID' => 'motd', 'TYPE' => 'alert alert-info'); + if ($setting->getValue('motd_style') == 0) { + $motd_style = "alert-success"; + } else if ($setting->getValue('motd_style') == 1) { + $motd_style = "alert-info"; + } else if ($setting->getValue('motd_style') == 2) { + $motd_style = "alert-warning"; + } else if ($setting->getValue('motd_style') == 3) { + $motd_style = "alert-danger"; + } else { + $motd_style = "alert-info"; + } + $_SESSION['POPUP'][] = array('CONTENT' => $motd, 'DISMISS' => 'yes', 'ID' => 'motd', 'TYPE' => 'alert ' . $motd_style . ''); // check for deprecated theme if ($setting->getValue('website_theme') == "mpos") From 7358b420f115b76ec76fac58426df4a031cef3e6 Mon Sep 17 00:00:00 2001 From: iAmShorty Date: Mon, 5 May 2014 14:35:05 +0200 Subject: [PATCH 2/2] [UPDATE] switch instead of if --- include/config/admin_settings.inc.php | 2 +- include/smarty_globals.inc.php | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/config/admin_settings.inc.php b/include/config/admin_settings.inc.php index 2d8b0f6a..c26e314c 100644 --- a/include/config/admin_settings.inc.php +++ b/include/config/admin_settings.inc.php @@ -24,7 +24,7 @@ $aSettings['website'][] = array( 'display' => 'MOTD Style', 'type' => 'select', 'options' => array( 0 => 'Success', 1 => 'Information', 2 => 'Warning', 3 => 'Danger' ), 'default' => 0, - 'name' => 'motd_style', 'value' => $setting->getValue('motd_style'), + 'name' => 'system_motd_style', 'value' => $setting->getValue('system_motd_style'), 'tooltip' => 'Set the Style what MOTD looks like.' ); $aSettings['website'][] = array( diff --git a/include/smarty_globals.inc.php b/include/smarty_globals.inc.php index 82207e97..839c6543 100644 --- a/include/smarty_globals.inc.php +++ b/include/smarty_globals.inc.php @@ -188,16 +188,21 @@ if (@$_SESSION['USERDATA']['id']) { if ($setting->getValue('maintenance')) $_SESSION['POPUP'][] = array('CONTENT' => 'This pool is currently in maintenance mode.', 'TYPE' => 'alert alert-warning'); if ($motd = $setting->getValue('system_motd')) - if ($setting->getValue('motd_style') == 0) { - $motd_style = "alert-success"; - } else if ($setting->getValue('motd_style') == 1) { - $motd_style = "alert-info"; - } else if ($setting->getValue('motd_style') == 2) { - $motd_style = "alert-warning"; - } else if ($setting->getValue('motd_style') == 3) { - $motd_style = "alert-danger"; - } else { - $motd_style = "alert-info"; + switch ($setting->getValue('system_motd_style')) { + case 0: + $motd_style = "alert-success"; + break; + case 1: + $motd_style = "alert-info"; + break; + case 2: + $motd_style = "alert-warning"; + break; + case 3: + $motd_style = "alert-danger"; + break; + default: + $motd_style = "alert-info"; } $_SESSION['POPUP'][] = array('CONTENT' => $motd, 'DISMISS' => 'yes', 'ID' => 'motd', 'TYPE' => 'alert ' . $motd_style . '');