branched
[mailer.git] / 0.2.1 / inc / theme-manager.php
diff --git a/0.2.1/inc/theme-manager.php b/0.2.1/inc/theme-manager.php
deleted file mode 100644 (file)
index 8e573ff..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-<?php
-/************************************************************************
- * MXChange v0.2.1                                    Start: 12/03/2004 *
- * ===============                              Last change: 12/13/2004 *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * File              : theme-manager.php                                *
- * -------------------------------------------------------------------- *
- * Short description : Theme manager                                    *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Themen-Manager                                   *
- * -------------------------------------------------------------------- *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
- * For more information visit: http://www.mxchange.org                  *
- *                                                                      *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or    *
- * (at your option) any later version.                                  *
- *                                                                      *
- * This program is distributed in the hope that it will be useful,      *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
- * GNU General Public License for more details.                         *
- *                                                                      *
- * You should have received a copy of the GNU General Public License    *
- * along with this program; if not, write to the Free Software          *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
- * MA  02110-1301  USA                                                  *
- ************************************************************************/
-
-// Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
-       require($INC);
-}
-
-//
-function GET_CURR_THEME()
-{
-       global $_COOKIE, $INC_POOL, $CONFIG, $_GET, $_POST, $CSS;
-       // 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 (empty($_COOKIE['mxchange_theme']))
-       {
-               // Set default theme
-               @setcookie("mxchange_theme", $ret, (time() + 60*60*24*365), COOKIE_PATH);
-       }
-        elseif ((!empty($_COOKIE['mxchange_theme'])) && (GET_EXT_VERSION("sql_patches") >= "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 .= "&amp;action=".$act;
-       if (!empty($wht))   $FORM .= "&amp;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 .= "  <OPTION value=\"".$theme."\"";
-               if ($theme == $CurrTheme) $OUT .= " selected=\"selected\"";
-               $OUT .= ">".$THEMES['theme_name'][$key]."</OPTION>\n";
-       }
-
-       // Return generated selection
-       define('__THEME_SELECTION_OPTIONS', $OUT);
-       $OUT = LOAD_TEMPLATE("theme_select_form", true);
-       return $OUT;
-}
-
-// Initialize variables
-$CurrTheme = GET_CURR_THEME();
-if (empty($_POST['new_theme'])) $_POST['new_theme'] = "";
-
-// Check if new theme is selcted
-if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $CurrTheme))
-{
-       // Set new theme for guests
-       $NewTheme = $_POST['new_theme'];
-
-       // Change to new theme
-       @setcookie("mxchange_theme", $NewTheme, (time() + 60*60*24*365), COOKIE_PATH);
-
-       // Remove current from array and set new
-       $theme = PATH."theme/".$CurrTheme."/theme.php";
-       unset($INC_POOL[array_search($theme, $INC_POOL)]);
-       $INC_POOL[] = PATH."theme/".$NewTheme."/theme.php";
-}
-
-// Remove variable again
-unset($_POST['new_theme']);
-
-//
-?>