X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Flibs%2Ftheme_functions.php;h=01339ea1d06165f5cd149570d664086bdc6f0d05;hb=e8ca54fe91872ab95a6ffdc4f1268bf18889021d;hp=6289a3d5611ba6383827760dce749a1ca250e4b5;hpb=397eb5dee2611cfaa1ff494d73e6785b88109cd6;p=mailer.git diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index 6289a3d561..01339ea1d0 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -1,18 +1,22 @@ 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', __FUNCTION__, __LINE__); + // Load all themes - while (list($theme) = SQL_FETCHROW($result)) { - // Load it's theme.php file - $INC = sprintf("theme/%s/theme.php", 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 - LOAD_INC($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 .= "