X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Ftheme_functions.php;h=64dbda3d65b4058763a5f26b5be92403f0e144e2;hb=26ea563a90454a2cde58f8cd134542a0d8f14780;hp=31ec274cca32e60bd48b8738b12f12416b06f066;hpb=27f65d023a3388a8bd85be8ee5991f776f541847;p=mailer.git diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index 31ec274cca..64dbda3d65 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -10,9 +10,14 @@ * -------------------------------------------------------------------- * * 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 * + * 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 * @@ -33,76 +38,94 @@ // Some security stuff... if (!defined('__SECURITY')) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; - require($INC); + die(); } -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 - $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($what)) $formAction .= "&what=" . $what; // Initialize array - $THEMES = array( + $themesArray = array( 'theme_unix' => array(), // Unix name from filesystem '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(list($theme) = SQL_FETCHROW($result)) { - // Load it's theme.php file - $INC = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($theme)); - if (FILE_READABLE($INC)) { + while ($content = SQL_FETCHARRAY($result)) { + // 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 - 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")); + // Free the result + SQL_FREERESULT($result); // Construct selection form for the box template - $OUT = ""; - foreach ($THEMES['theme_unix'] as $key => $theme) { - $OUT .= "