= "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 .= "