- ksort($theme_values);
- $theme_values = array_flip($theme_values);
- $optvals[SMOPT_GRP_GENERAL][] = array(
- 'name' => 'chosen_theme',
- 'caption' => _("Theme"),
- 'type' => SMOPT_TYPE_STRLIST,
- 'refresh' => SMOPT_REFRESH_ALL,
- 'posvals' => $theme_values,
- 'save' => 'save_option_theme'
- );
-
- $css_values = array( 'none' => _("Default" ) );
- $handle=opendir('../themes/css/');
- while ($file = readdir($handle) ) {
- if ( substr( $file, -4 ) == '.css' ) {
- $css_values[$file] = substr( $file, 0, strlen( $file ) - 4 );
+ // Next, list user-provided styles
+ asort($user_themes);
+ foreach ($user_themes as $style) {
+ if ($style['PATH'] == 'none')
+ continue;
+ $theme_values[$style['PATH']] = 'User Theme - '.htmlspecialchars($style['NAME']);
+ }
+
+ if (count($user_themes) + count($template_themes) > 1) {
+ $optvals[SMOPT_GRP_GENERAL][] = array(
+ 'name' => 'chosen_theme',
+ 'caption' => _("Theme"),
+ 'type' => SMOPT_TYPE_STRLIST,
+ 'refresh' => SMOPT_REFRESH_ALL,
+ 'posvals' => $theme_values,
+ 'save' => 'css_theme_save'
+ );
+ }
+
+ /* Icon theme selection */
+ if ($use_icons) {
+ global $icon_themes, $icon_theme;
+
+ $temp = array();
+ $value = 0;
+ for ($count = 0; $count < sizeof($icon_themes); $count++) {
+ $temp[$icon_themes[$count]['PATH']] = $icon_themes[$count]['NAME'];
+ }
+ if (sizeof($icon_themes) > 0) {
+ $optvals[SMOPT_GRP_GENERAL][] = array(
+ 'name' => 'icon_theme',
+ 'caption' => _("Icon Theme"),
+ 'type' => SMOPT_TYPE_STRLIST,
+ 'refresh' => SMOPT_REFRESH_NONE,
+ 'posvals' => $temp,
+ 'save' => 'icon_theme_save'
+ );