X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=0.2.1%2Finc%2Ftheme-manager.php;fp=0.2.1%2Finc%2Ftheme-manager.php;h=8e573ff37a9ec21f537447c6b2cd18a3e1c9dce8;hp=58e059157f85e74e168cfa7c5b3fae6024acc770;hb=7bc25dd08431c94ce9edca131d56c1a36b13c28a;hpb=157ee010917df5ca07e6d31b42f67417b2516d74 diff --git a/0.2.1/inc/theme-manager.php b/0.2.1/inc/theme-manager.php index 58e059157f..8e573ff37a 100644 --- a/0.2.1/inc/theme-manager.php +++ b/0.2.1/inc/theme-manager.php @@ -1,172 +1,172 @@ -= "0.1.4")) - { - // Get theme from cookie - $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1", array($_COOKIE['mxchange_theme']), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { - // Design is valid! - $ret = $_COOKIE['mxchange_theme']; - } - - // Free memory - SQL_FREERESULT($result); - } - elseif ((!mxchange_installed) && ((mxchange_installing) || ($CSS == true)) && ((!empty($_GET['theme'])) || (!empty($_POST['theme'])))) - { - // Installation mode active - if ((!empty($_GET['theme'])) && (file_exists(PATH."theme/".$_GET['theme']."/theme.php"))) - { - // Set cookie from URL data - @setcookie("mxchange_theme", $_GET['theme'], (time() + 60*60*24*365), COOKIE_PATH); - $_COOKIE['mxchange_theme'] = $_GET['theme']; - } - elseif (file_exists(PATH."theme/".$_POST['theme']."/theme.php")) - { - // Set cookie from posted data - @setcookie("mxchange_theme", $_POST['theme'], (time() + 60*60*24*365), COOKIE_PATH); - $_COOKIE['mxchange_theme'] = $_POST['theme']; - } - - // Set return value - $ret = $_COOKIE['mxchange_theme']; - } - else - { - // Invalid design, reset cookie - @setcookie("mxchange_theme", $ret, (time() + 60*60*24*365), COOKIE_PATH); - } - - // Add (maybe) found theme.php file to inclusion list - $theme = PATH."theme/".$ret."/theme.php"; - if (@file_exists($theme)) $INC_POOL[] = $theme; - - // Return theme value - return $ret; -} - -function THEME_SELECTION_BOX($mod, $act, $wht, $result) -{ - // Construction URL - global $CurrTheme; - $FORM = URL."/modules.php?module=".$mod; - if (!empty($act)) $FORM .= "&action=".$act; - if (!empty($wht)) $FORM .= "&what=".$wht; - define('__FORM_VALUE', $FORM); - - // Initialize array - $THEMES = array( - 'theme_unix' => array(), // Unix name from filesystem - 'theme_name' => array() // Title - ); - - // Load all themes - while(list($theme) = SQL_FETCHROW($result)) - { - // Load it's theme.php file - $INC = PATH."theme/".$theme."/theme.php"; - if (file_exists($INC)) - { - // And save all data in array - include($INC); - $THEMES['theme_unix'][] = $theme; - $THEMES['theme_name'][] = $THEME_NAME; - } - } - - // Sort whole array by title - array_pk_sort($THEMES, array("theme_name")); - - // Construct selection form for the box template - $OUT = ""; - foreach ($THEMES['theme_unix'] as $key=>$theme) - { - $OUT .= "