X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Ftheme_functions.php;h=64dbda3d65b4058763a5f26b5be92403f0e144e2;hb=013448f0470ca36ab15b888928e2127e6da7d9b6;hp=aceabd4ff581da8d445c8aee1907ec215e170026;hpb=e01fcf1ca8ddeb72af76465df3ef72301a1cdae7;p=mailer.git diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index aceabd4ff5..64dbda3d65 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -10,14 +10,14 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Themen-Manager * * -------------------------------------------------------------------- * - * $Revision:: 856 $ * - * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. March 2009) $ * + * $Revision:: $ * + * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * - * $Author:: stelzi $ * + * $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 * + * Copyright (c) 2003 - 2009 by Roland Haeder * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -38,16 +38,21 @@ // Some security stuff... if (!defined('__SECURITY')) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; - require($INC); + die(); } -// Create a selection box with installed and activated themes -function THEME_SELECTION_BOX ($mod, $act, $wht, $result) { +// Create a selection box with installed and activated themes or all if admin +function generateThemeSelectionBox () { + // Init variables and fill them if set + $what = ''; + $mod = getModule(); + if (isWhatSet()) { + $what = getWhat(); + } // END - if + // Construction URL - $formAction = "{!URL!}/modules.php?module=".$mod; - if (!empty($act)) $formAction .= "&action=".$act; - if (!empty($wht)) $formAction .= "&what=".$wht; + $formAction = "{?URL?}/modules.php?module=" . $mod; + if (!empty($what)) $formAction .= "&what=" . $what; // Initialize array $themesArray = array( @@ -55,26 +60,37 @@ function THEME_SELECTION_BOX ($mod, $act, $wht, $result) { 'theme_name' => array() // Title ); + // Only activated themes for the user + $add = " WHERE `theme_active`='Y'"; + + // Do we have admin? + if (isAdmin()) $add = ''; + + // Select all themes we want + $result = SQL_QUERY("SELECT `theme_path`, `theme_name` FROM `{?_MYSQL_PREFIX?}_themes`".$add." ORDER BY `theme_name` ASC", __FILE__, __LINE__); + // Load all themes while ($content = SQL_FETCHARRAY($result)) { - // Load it's theme.php file - $INC = sprintf("theme/%s/theme.php", SQL_ESCAPE($content['theme_path'])); - if (INCLUDE_READABLE($INC)) { + // Construct relative include file name + $inc = sprintf("theme/%s/theme.php", SQL_ESCAPE($content['theme_path'])); + + // Load it's theme.php file if found + if (isIncludeReadable($inc)) { // And save all data in array - LOAD_INC($INC); + loadInclude($inc); $themesArray['theme_unix'][] = $content['theme_path']; - $themesArray['theme_name'][] = $THEME_NAME; + $themesArray['theme_name'][] = $GLOBALS['theme_data']['name']; } // END - if } // END - while - // Sort whole array by title - array_pk_sort($themesArray, array("theme_name")); + // Free the result + SQL_FREERESULT($result); // Construct selection form for the box template - $OUT = ""; + $OUT = ''; foreach ($themesArray['theme_unix'] as $key => $theme) { $OUT .= "