X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Flibs%2Ftheme_functions.php;h=ff9e5e3497297cb6348b51c708204abd1b3f3da5;hb=98077af43126dd7c274fe57f6ea0494e906e8943;hp=5fff9d70642ae01cd8c18a3cb5fe9166eb120b14;hpb=f9a9c09e1ae257449bfd98f8854e321efba1dc3c;p=mailer.git
diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php
index 5fff9d7064..ff9e5e3497 100644
--- a/inc/libs/theme_functions.php
+++ b/inc/libs/theme_functions.php
@@ -10,7 +10,12 @@
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Themen-Manager *
* -------------------------------------------------------------------- *
- * *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
+ * Needs to be in all Files and every File needs "svn propset *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2008 by Roland Haeder *
* For more information visit: http://www.mxchange.org *
@@ -33,132 +38,78 @@
// Some security stuff...
if (!defined('__SECURITY')) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
}
-// 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 (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("
".print_r($cacheArray['themes'], true)."
");
- // 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;
-}
-
-function THEME_SELECTION_BOX($mod, $act, $wht, $result) {
+// Create a selection box with installed and activated themes
+function generateThemeSelectionBox ($mod, $act, $wht, $result) {
// Construction URL
- $FORM = URL."/modules.php?module=".$mod;
- if (!empty($act)) $FORM .= "&action=".$act;
- if (!empty($wht)) $FORM .= "&what=".$wht;
- define('__FORM_VALUE', $FORM);
+ $formAction = "{!URL!}/modules.php?module=".$mod;
+ if (!empty($act)) $formAction .= "&action=".$act;
+ if (!empty($wht)) $formAction .= "&what=".$wht;
// Initialize array
- $THEMES = array(
+ $themesArray = array(
'theme_unix' => array(), // Unix name from filesystem
'theme_name' => array() // Title
);
// Load all themes
- while(list($theme) = SQL_FETCHROW($result)) {
+ while ($content = SQL_FETCHARRAY($result)) {
// Load it's theme.php file
- $INC = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($theme));
- if (FILE_READABLE($INC)) {
+ $INC = sprintf("theme/%s/theme.php", SQL_ESCAPE($content['theme_path']));
+ if (isIncludeReadable($INC)) {
// And save all data in array
- require($INC);
- $THEMES['theme_unix'][] = $theme;
- $THEMES['theme_name'][] = $THEME_NAME;
+ loadInclude($INC);
+ $themesArray['theme_unix'][] = $content['theme_path'];
+ $themesArray['theme_name'][] = $GLOBALS['theme_data']['name'];
} // END - if
} // END - while
// Sort whole array by title
- array_pk_sort($THEMES, array("theme_name"));
+ array_pk_sort($themesArray, array("theme_name"));
// Construct selection form for the box template
- $OUT = "";
- foreach ($THEMES['theme_unix'] as $key => $theme) {
- $OUT .= "