X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-themes.php;h=4995716159eaaaba921c858f5e9fd7a407cc658b;hp=0e25541d34489d4bbc2ed20f58bfde34ea1140e5;hb=19b197c32c96ce8eea26561fb7b40e87c57716ae;hpb=b5912168d72ae511eb623c3d92540c82d31b93c5 diff --git a/inc/modules/member/what-themes.php b/inc/modules/member/what-themes.php index 0e25541d34..4995716159 100644 --- a/inc/modules/member/what-themes.php +++ b/inc/modules/member/what-themes.php @@ -1,7 +1,7 @@ array(), // Theme author's name 'theme_email' => array(), // Author's email address 'theme_url' => array(), // URL were you can download it from - 'theme_ver' => array(), // Version number of theme + 'theme_version' => array(), // Version number of theme ); // 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 = PATH."theme/".$dir."/"."theme.php"; - - // Test it... - $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' AND theme_active='Y' LIMIT 1", - array($dir), __FILE__, __LINE__); +$includes = getArrayFromDirectory('theme/', '', false, true, array('css', 'images')); - if (($dir != ".") && ($dir != "..") && (file_exists($theme)) && (is_readable($theme)) && (SQL_NUMROWS($result) == 1)) - { - // Free memory - SQL_FREERESULT($result); +// Walk through all entries and add it +foreach ($includes as $inc) { + // Get directory from it + $dir = basename(dirname($inc)); + // Is the theme active, then include it + if (isThemeActive($dir)) { // Found a valid directory so let's load it's theme.php file - include($theme); + loadInclude($inc); // 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); + $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_version'][] = $GLOBALS['theme_data']['version']; + } // END - if +} // END - while + +// Remove last theme data +unset($GLOBALS['theme_data']); // 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) -{ - $default = ""; - if ($_SESSION['mxchange_theme'] == $unix) $default = " checked selected"; +$OUT = ''; $SW = 2; +foreach ($THEMES['theme_unix'] as $key => $unix) { + $default = ''; + if (getCurrentTheme() == $unix) $default = ' selected="selected"'; // Add row - $OUT .= " - - - - ".$THEMES['theme_name'][$key]." - - ".$THEMES['theme_author'][$key]." - - - ".$THEMES['theme_url'][$key]." - - v".$THEMES['theme_ver'][$key]." -\n"; + $OUT .= " + + + + ".$THEMES['theme_name'][$key]." + + ".$THEMES['theme_author'][$key]." + + + ".$THEMES['theme_url'][$key]." + + v".$THEMES['theme_version'][$key]." +\n"; $SW = 3 - $SW; -} -if (empty($OUT)) -{ - // No themes found??? - $OUT = " - - ".LOAD_TEMPLATE("admin_settings_saved", true, MEMBER_NO_THEMES_FOUND)." - -\n"; -} -define('__THEME_LIST', $OUT); +} // END - foreach + +if (empty($OUT)) { + // No themes found??? + $OUT = " + + ".loadTemplate('admin_settings_saved', true, getMessage('MEMBER_NO_THEMES_FOUND'))." + +\n"; +} // END - if // Load template -LOAD_TEMPLATE("member_themes"); +loadTemplate('member_themes', false, $OUT); -// +// [EOF] ?>