]> git.mxchange.org Git - mailer.git/commitdiff
More fixes for 'theme vs. extensions'
authorRoland Häder <roland@mxchange.org>
Fri, 19 Dec 2008 18:36:23 +0000 (18:36 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 19 Dec 2008 18:36:23 +0000 (18:36 +0000)
inc/databases.php
inc/functions.php
inc/language/de.php
inc/libs/theme_functions.php
inc/mysql-connect.php
inc/theme-dummy.php

index b67e044421b60a77eef788f26e24a643b8b9effe..adaafd37fbf6da04752a01310a4c0f1503c4de22 100644 (file)
@@ -115,7 +115,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // Current SVN revision
-define('CURR_SVN_REVISION', "676");
+define('CURR_SVN_REVISION', "677");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index abf13e97a5f30eb50cbff208833ceb945a6d58c5..7a70b794c3ed6d46c04663a60e81fbd80143c3f1 100644 (file)
@@ -2887,6 +2887,98 @@ function getMessage ($messageId) {
        return $return;
 }
 
+// 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 (getConfig('default_theme') != "") $ret = getConfig('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", SQL_ESCAPE($_GET['theme']));
+               } elseif (FILE_READABLE(sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_POST['theme'])))) {
+                       // Set cookie from posted data
+                       set_session("mxchange_theme", SQL_ESCAPE($_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;
+}
+
+// Get id from theme
+function THEME_GET_ID ($name) {
+       global $cacheArray, $_CONFIG;
+
+       // Is the extension "theme" installed?
+       if (!EXT_IS_ACTIVE("theme")) {
+               // Then abort here
+               return 0;
+       } // END - if
+
+       // Default id
+       $id = 0;
+
+       // Is the cache entry there?
+       if (isset($cacheArray['themes']['id'][$name])) {
+               // Get the version from cache
+               $id = $cacheArray['themes']['id'][$name];
+
+               // Count up
+               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+       } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
+               // Check if current theme is already imported or not
+               $result = SQL_QUERY_ESC("SELECT id FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1",
+                       array($name), __FILE__, __LINE__);
+
+               // Entry found?
+               if (SQL_NUMROWS($result) == 1) {
+                       // Fetch data
+                       list($id) = SQL_FETCHROW($result);
+               } // END - if
+
+               // Free result
+               SQL_FREERESULT($result);
+       }
+
+       // Return id
+       return $id;
+}
+
 //////////////////////////////////////////////////
 //                                              //
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
index dda9ec3c9709bf7834c979109779c7e74657414f..b6284cfd5c9f1e949ae049476eef30acf02cf53c 100644 (file)
@@ -1195,7 +1195,7 @@ define('MOD_REWRITE_ERROR', "Sie m&uuml;ssen mod_rewrite in Apache aktiviert hab
 define('ADMIN_BUILD_STATUS_HANDLER', "Status-Handler");
 define('TASK_SUBJ_EXTENSION_DEACTIVATED', "Erweiterung deaktiviert");
 define('ADMIN_SUBJECT_EXTENSION_DEACTIVATED', "Automatische Deaktivierung einer Erweiterung");
-define('FATAL_EXTENSION_LOADED', "Erweiterung <u>%s/u> bereits geladen!");
+define('FATAL_EXTENSION_LOADED', "Erweiterung <u>%s</u> bereits geladen!");
 define('ADMIN_ACCESS_DENIED', "Zugriff auf diesen Adminmen&uuml;punkt nicht gestattet.");
 define('ADMIN_URL_BLACKLIST_DISABLED', "URL-Sperrliste ist deaktiviert.");
 
index ba09b55a20016e60416e1b19006699ba95ed2880..db1eb19ee1319380a08142022627c99ef93a9756 100644 (file)
@@ -37,65 +37,6 @@ if (!defined('__SECURITY')) {
        require($INC);
 }
 
-// Always make sure the session management is initialized first
-require_once(PATH."inc/session.php");
-
-// Dirty fix for dublicate function
-if (!function_exists('GET_CURR_THEME')) {
-// 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 (getConfig('default_theme') != "") $ret = getConfig('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", SQL_ESCAPE($_GET['theme']));
-               } elseif (FILE_READABLE(sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_POST['theme'])))) {
-                       // Set cookie from posted data
-                       set_session("mxchange_theme", SQL_ESCAPE($_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;
-}
-} // END - if
-
 function THEME_SELECTION_BOX($mod, $act, $wht, $result) {
        // Construction URL
        $FORM = URL."/modules.php?module=".$mod;
@@ -177,45 +118,6 @@ function THEME_GET_VERSION ($name) {
        return $cver;
 }
 
-// Get id from theme
-function THEME_GET_ID ($name) {
-       global $cacheArray, $_CONFIG;
-
-       // Is the extension "theme" installed?
-       if (!EXT_IS_ACTIVE("theme")) {
-               // Then abort here
-               return 0;
-       } // END - if
-
-       // Default id
-       $id = 0;
-
-       // Is the cache entry there?
-       if (isset($cacheArray['themes']['id'][$name])) {
-               // Get the version from cache
-               $id = $cacheArray['themes']['id'][$name];
-
-               // Count up
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
-       } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
-               // Check if current theme is already imported or not
-               $result = SQL_QUERY_ESC("SELECT id FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1",
-                       array($name), __FILE__, __LINE__);
-
-               // Entry found?
-               if (SQL_NUMROWS($result) == 1) {
-                       // Fetch data
-                       list($id) = SQL_FETCHROW($result);
-               } // END - if
-
-               // Free result
-               SQL_FREERESULT($result);
-       }
-
-       // Return id
-       return $id;
-}
-
 // Checks wether a theme is found in db
 function THEME_CHECK_EXIST ($name) {
        // Get theme and is it not nul?
index 62885d2e3127aed78c3055c2a7aa7fceede4c583..efe013a2784a79446800c94fe1d44809ae078720 100644 (file)
@@ -167,12 +167,6 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
                                // Run daily reset
                                require_once(PATH."inc/check-reset.php");
 
-                               // Create missing configuration file
-                               if (!function_exists('GET_CURR_THEME')) {
-                                       // Load dummy theme functions
-                                       require_once(PATH."inc/theme-dummy.php");
-                               } // END - if
-
                                // Load admin include file if he is admin
                                if (IS_ADMIN()) {
                                        // Administrative functions
@@ -269,12 +263,6 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
        require_once(PATH."inc/databases.php");
        require_once(PATH."inc/session.php");
 
-       // Create missing configuration file
-       if (!function_exists('GET_CURR_THEME')) {
-               // Load dummy theme functions
-               require_once(PATH."inc/theme-dummy.php");
-       } // END - if
-
        // Check if we are in installation routine
        $installPhp = basename($_SERVER['PHP_SELF']);
        if (($installPhp != "install.php") && ($CSS != "1") && ($CSS != -1)) {
index e4beb8778773f0b19a68b6c719bc26d8ef294cff..f87b68fd319130d505ca122256bd7490eb3d0a92 100644 (file)
@@ -1,50 +1,3 @@
 <?php
-/************************************************************************
- * MXChange v0.2.1                                    Start: 12/16/2008 *
- * ===============                              Last change: 12/16/2008 *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * File              : theme-dummy.php                                  *
- * -------------------------------------------------------------------- *
- * Short description : Dummy functions for theme manager                *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Platzhalter-Funktionen fuer Theme-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 (!defined('__SECURITY')) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
-       require($INC);
-} elseif (EXT_IS_ACTIVE("theme")) {
-       // Abort loading here
-       ADD_FATAL(sprintf(FATAL_EXTENSION_LOADED, "theme"));
-       return;
-}
-
-// Dummy getter for current theme
-function GET_CURR_THEME () {
-       return "default";
-}
-
-//
+// DEPRECATED!
 ?>