= "0.1.4")) { // Get theme from cookie $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1", array(get_session('mxchange_theme')), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Design is valid! $ret = get_session('mxchange_theme'); } // Free memory SQL_FREERESULT($result); } elseif ((!isBooleanConstantAndTrue('mxchange_installed')) && ((isBooleanConstantAndTrue('mxchange_installing')) || ($CSS == true)) && ((!empty($_GET['theme'])) || (!empty($_POST['theme'])))) { // Prepare FQFN for checking $theme = sprintf("%stheme/%s/theme.php", PATH, $_GET['theme']); // Installation mode active if ((!empty($_GET['theme'])) && (file_exists($theme)) && (is_readable($theme))) { // Set cookie from URL data set_session("mxchange_theme", $_GET['theme'], (time() + 60*60*24*365), COOKIE_PATH); } elseif (file_exists(PATH."theme/".$_POST['theme']."/theme.php")) { // Set cookie from posted data set_session("mxchange_theme", $_POST['theme'], (time() + 60*60*24*365), COOKIE_PATH); } // Set return value $ret = get_session('mxchange_theme'); } else { // Invalid design, reset cookie set_session("mxchange_theme", $ret, (time() + 60*60*24*365), COOKIE_PATH); } // Add (maybe) found theme.php file to inclusion list $theme = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($ret)); // Try to load the requested include file if ((@file_exists($theme)) && (is_readable($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 .= "