X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Flibs%2Ftheme_functions.php;h=1cac6e877e81a1032208233916d35cfd88170e14;hp=640dd0b1f3be961dbb33a192acc9fce490a73659;hb=64c8349613addc3da2242c5cd6b99d64e3fb5f8e;hpb=fad1ea280c27f9ba8ae818b87b0ba29d2c113b1b diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index 640dd0b1f3..1cac6e877e 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -17,7 +17,7 @@ * 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'][] = $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 .= "