X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Ftheme_functions.php;h=5fbcfb2edd6f6ef4d396a519eedb2ebbf284ed98;hb=023d240bd9154811e5ebca23892ed06fefc72c08;hp=92a2a47ac49e215c9fa14b71f8e864c4acea331f;hpb=cca98f57dff720b174d21d071cee8303462485d7;p=mailer.git diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index 92a2a47ac4..5fbcfb2edd 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -1,19 +1,23 @@ 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()) { + // Then display all themes + $add = ''; + } // END - if + + // 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 ($row = SQL_FETCHARRAY($result)) { + // Construct relative include file name + $inc = sprintf("theme/%s/theme.php", secureString($row['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'], $row['theme_path']); + array_push($themesArray['theme_name'], $row['theme_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 .= "