Browse Source

Token admin-tm could not be verifeied.

This just moves code.

Signed-off-by: John Rayes <[email protected]>
John Rayes 10 years ago
parent
commit
ee5fc8f413
1 changed files with 26 additions and 26 deletions
  1. 26 26
      Sources/Themes.php

+ 26 - 26
Sources/Themes.php

@@ -117,31 +117,6 @@ function ThemeAdmin()
 {
 	global $context, $boarddir, $modSettings, $smcFunc;
 
-	loadLanguage('Admin');
-	isAllowedTo('admin_forum');
-	loadTemplate('Themes');
-
-	// List all installed and enabled themes.
-	get_all_themes(true);
-
-	// Can we create a new theme?
-	$context['can_create_new'] = is_writable($boarddir . '/Themes');
-	$context['new_theme_dir'] = substr(realpath($boarddir . '/Themes/default'), 0, -7);
-
-	// Look for a non existent theme directory. (ie theme87.)
-	$theme_dir = $boarddir . '/Themes/theme';
-	$i = 1;
-	while (file_exists($theme_dir . $i))
-		$i++;
-
-	$context['new_theme_name'] = 'theme' . $i;
-
-	// A bunch of tokens for a bunch of forms.
-	createToken('admin-tm');
-	createToken('admin-t-file');
-	createToken('admin-t-copy');
-	createToken('admin-t-dir');
-
 	// Are handling any settings?
 	if (isset($_POST['save']))
 	{
@@ -156,7 +131,7 @@ function ThemeAdmin()
 			fatal_lang_error('themes_none_selectable', false);
 
 		if (!in_array($_POST['options']['theme_guests'], $_POST['options']['known_themes']))
-				fatal_lang_error('themes_default_selectable', false);
+			fatal_lang_error('themes_default_selectable', false);
 
 		// Commit the new settings.
 		updateSettings(array(
@@ -169,6 +144,31 @@ function ThemeAdmin()
 
 		redirectexit('action=admin;area=theme;' . $context['session_var'] . '=' . $context['session_id'] . ';sa=admin');
 	}
+
+	loadLanguage('Admin');
+	isAllowedTo('admin_forum');
+	loadTemplate('Themes');
+
+	// List all installed and enabled themes.
+	get_all_themes(true);
+
+	// Can we create a new theme?
+	$context['can_create_new'] = is_writable($boarddir . '/Themes');
+	$context['new_theme_dir'] = substr(realpath($boarddir . '/Themes/default'), 0, -7);
+
+	// Look for a non existent theme directory. (ie theme87.)
+	$theme_dir = $boarddir . '/Themes/theme';
+	$i = 1;
+	while (file_exists($theme_dir . $i))
+		$i++;
+
+	$context['new_theme_name'] = 'theme' . $i;
+
+	// A bunch of tokens for a bunch of forms.
+	createToken('admin-tm');
+	createToken('admin-t-file');
+	createToken('admin-t-copy');
+	createToken('admin-t-dir');
 }
 
 /**