-// Always make sure the session management is initialized first
-require_once(PATH."inc/session.php");
-
-// Get current theme name
-function GET_CURR_THEME() {
- global $INC_POOL, $_CONFIG, $CSS, $cacheArray;
-
- // The default theme is 'default'... ;-)
- $ret = "default";
-
- // Load default theme if not empty from configuration
- if (!empty($_CONFIG['default_theme'])) $ret = $_CONFIG['default_theme'];
-
- if (!isSessionVariableSet('mxchange_theme')) {
- // Set default theme
- set_session("mxchange_theme", $ret);
- } elseif ((isSessionVariableSet('mxchange_theme')) && (GET_EXT_VERSION("sql_patches") >= "0.1.4")) {
- //die("<pre>".print_r($cacheArray['themes'], true)."</pre>");
- // Get theme from cookie
- $ret = get_session('mxchange_theme');
-
- // Is it valid?
- if (THEME_GET_ID($ret) == 0) {
- // Fix it to default
- $ret = "default";
- } // END - if
- } 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, SQL_ESCAPE($_GET['theme']));
-
- // Installation mode active
- if ((!empty($_GET['theme'])) && (FILE_READABLE($theme))) {
- // Set cookie from URL data
- set_session("mxchange_theme", $_GET['theme']);
- } elseif (FILE_READABLE(sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_POST['theme'])))) {
- // Set cookie from posted data
- set_session("mxchange_theme", $_POST['theme']);
- }
-
- // Set return value
- $ret = get_session('mxchange_theme');
- } else {
- // Invalid design, reset cookie
- set_session("mxchange_theme", $ret);
- }
-
- // 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_READABLE($theme)) $INC_POOL[] = $theme;
-
- // Return theme value
- return $ret;
-}
-