X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=inc%2Flibs%2Ftheme_functions.php;h=1a8e05bba28b6aa0656cfaa46313db2c1d1c577d;hb=f2edf32502b2774dc17ef419a2e6a1c60e361c0a;hp=5fff9d70642ae01cd8c18a3cb5fe9166eb120b14;hpb=001e43c93664d89ffc23aa4452aac8520279086d;p=mailer.git
diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php
index 5fff9d7064..1a8e05bba2 100644
--- a/inc/libs/theme_functions.php
+++ b/inc/libs/theme_functions.php
@@ -1,19 +1,23 @@
= "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;
+ die();
+} // END - if
- // Return theme value
- return $ret;
-}
+// Create a selection box with installed and activated themes or all if admin
+function generateThemeSelectionBox () {
+ // Init variables and fill them if set
+ $what = getWhat();
+ $mod = getModule();
-function THEME_SELECTION_BOX($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($what)) $formAction .= '&what=' . $what;
+ $formAction .= '%}';
// 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'";
+
+ // Is there 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', __FUNCTION__, __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", secureString($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);
+ array_push($themesArray['theme_unix'], $content['theme_path']);
+ array_push($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 .= "