X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Flibs%2Ftheme_functions.php;h=9fc37f2872ce444e10442f1d655fad44b77d2416;hb=49acdb7a7adbcf25a8e8683b5581bfcec72b23bd;hp=3a7c791673e67d66ba9a50b5ff863991ad2c29f5;hpb=a090e351c49fe021fb3064325694da03402332e0;p=mailer.git diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index 3a7c791673..9fc37f2872 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -1,10 +1,10 @@ array() // Title ); + // Only activated themes for the user + $add = " WHERE `theme_active`='Y'"; + + // Is there admin? + if (isAdmin()) { + // Then display all themes + $add = ''; + } // END - if + + // Select all themes we want + $result = sqlQuery('SELECT + `theme_path`, + `theme_name` +FROM + `{?_MYSQL_PREFIX?}_themes` +' . $add . ' +ORDER BY + `theme_name` ASC', __FUNCTION__, __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)) { + while ($row = sqlFetchArray($result)) { + // Load it's theme.php file if found + if (isThemeReadable($row['theme_path'])) { // And save all data in array - LOAD_INC($INC); - $themesArray['theme_unix'][] = $content['theme_path']; - $themesArray['theme_name'][] = $GLOBALS['theme_data']['name']; + loadInclude(sprintf('theme/%s/theme.php', secureString($row['theme_path']))); + array_push($themesArray['theme_unix'], $row['theme_path']); + array_push($themesArray['theme_name'], $row['theme_name']); } // END - if } // END - while - // Sort whole array by title - array_pk_sort($themesArray, array("theme_name")); + // Free the result + sqlFreeResult($result); // Construct selection form for the box template + // @TODO Can't this be rewritten to an API function? $OUT = ''; foreach ($themesArray['theme_unix'] as $key => $theme) { - $OUT .= "