X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-theme_import.php;h=0e91fc4cf76706253e1c342fc67639700d8fc1a1;hb=96dfdd6b8e6a56d6594c3525e5fd2a066697a6de;hp=775f6f493f5b6f48ed51af0fce29b9639601ea4d;hpb=cddcc697721ff6fd726b1dce851cc514b95c0201;p=mailer.git diff --git a/inc/modules/admin/what-theme_import.php b/inc/modules/admin/what-theme_import.php index 775f6f493f..0e91fc4cf7 100644 --- a/inc/modules/admin/what-theme_import.php +++ b/inc/modules/admin/what-theme_import.php @@ -1,7 +1,7 @@ "); -} + loadTemplate('admin_settings_saved', false, $message); +} // END - if // Initialize array $THEMES = array( @@ -90,80 +102,67 @@ $THEMES = array( ); // Read directory "themes" -$handle = opendir(PATH."theme/") or mxchange_die("Cannot read themes dir!"); -while ($dir = readdir($handle)) { - // Construct absolute theme.php file name - $theme = sprintf("%stheme/%s/theme.php", PATH, $dir); - - // Test it... - if (($dir != ".") && ($dir != "..") && (file_exists($theme)) && (is_readable($theme))) { - // Found a valid directory so let's load it's theme.php file - include($theme); - - // Add found theme to array - $THEMES['theme_unix'][] = $dir; - $THEMES['theme_name'][] = $THEME_NAME; - $THEMES['theme_author'][] = $THEME_AUTHOR; - $THEMES['theme_email'][] = $THEME_EMAIL; - $THEMES['theme_url'][] = $THEME_URL; - $THEMES['theme_ver'][] = $THEME_VERSION; - } -} -closedir($handle); +$includes = getArrayFromDirectory('theme/', '', false, true, array('css', 'images')); + +// Walk through all entries and add it +foreach ($includes as $inc) { + // Get directory from it + $dir = basename(dirname($inc)); + + // Load include file + loadInclude($inc); + + // Add found theme to array + $THEMES['theme_unix'][] = $dir; + $THEMES['theme_name'][] = $GLOBALS['theme_data']['name']; + $THEMES['theme_author'][] = $GLOBALS['theme_data']['author']; + $THEMES['theme_email'][] = $GLOBALS['theme_data']['email']; + $THEMES['theme_url'][] = $GLOBALS['theme_data']['url']; + $THEMES['theme_ver'][] = $GLOBALS['theme_data']['version']; +} // END - while // Sort array by Uni* name -array_pk_sort($THEMES, array("theme_name")); +array_pk_sort($THEMES, array('theme_name')); // Generate output lines for the template -$OUT = ""; $SW = 2; -foreach ($THEMES['theme_unix'] as $key=>$unix) { +$OUT = ''; $SW = 2; +foreach ($THEMES['theme_unix'] as $key => $unix) { + // Already installed is default + $formContent = '