X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Ftheme_functions.php;h=64dbda3d65b4058763a5f26b5be92403f0e144e2;hb=013448f0470ca36ab15b888928e2127e6da7d9b6;hp=db1eb19ee1319380a08142022627c99ef93a9756;hpb=b5e6a957d401a32612e9e12044c9a63ce99c56fc;p=mailer.git
diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php
index db1eb19ee1..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 .= "