Browse Source

Do a redirect and set a nice updated message.

Signed-off-by: Suki <[email protected]>
Suki 11 years ago
parent
commit
e7a32c4c58

+ 5 - 1
Sources/Themes.php

@@ -1551,10 +1551,11 @@ function ThemeInstall()
 
 				// Got something, lets figure it out what to do next.
 				if (!empty($to_update) && !empty($to_update['version']))
-					switch (compareVersions($install_info['version'], $to_update['version'])) 
+					switch (compareVersions($install_info['version'], $to_update['version']))
 					{
 						case 0: // This is exactly the same theme.
 						case -1: // The one being installed is older than the one already installed.
+						default: // Any other possible result.
 							fatal_lang_error('package_get_error_theme_no_new_version', false, array($install_info['version'], $to_update['version']))
 							break;
 						case 1: // Got a newer version, update the old entry.
@@ -1569,6 +1570,9 @@ function ThemeInstall()
 									'id_theme' => $to_update['id_theme'],
 								)
 							);
+
+							// Do a redirect and set a nice updated message.
+							redirectexit('action=admin;area=theme;sa=install;theme_id=' . $id_theme . ';updated;' . $context['session_var'] . '=' . $context['session_id']);
 							break;
 					}
 			}

+ 1 - 1
Themes/default/Themes.template.php

@@ -745,7 +745,7 @@ function template_installed()
 		<div class="windowbg">
 			<div class="content">
 				<p>
-					<a href="', $scripturl, '?action=admin;area=theme;sa=list;th=', $context['installed_theme']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $context['installed_theme']['name'], '</a> ', $txt['theme_installed_message'], '
+					<a href="', $scripturl, '?action=admin;area=theme;sa=list;th=', $context['installed_theme']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $context['installed_theme']['name'], '</a> ', $txt['theme_'. (isset($_GET['updated']) ? 'updated' : 'installed') .'_message'], '
 				</p>
 				<p>
 					<a href="', $scripturl, '?action=admin;area=theme;sa=admin;', $context['session_var'], '=', $context['session_id'], '">', $txt['back'], '</a>

+ 1 - 0
Themes/default/languages/Themes.english.php

@@ -24,6 +24,7 @@ $txt['theme_install_new_confirm'] = 'Are you sure you want to install this new t
 $txt['theme_install_writable'] = 'Warning - you cannot create or install a new theme as your themes directory is not currently writable.';
 $txt['theme_installed'] = 'Installed Successfully';
 $txt['theme_installed_message'] = 'was installed successfully.';
+$txt['theme_updated_message'] = 'was updated successfully.';
 
 $txt['theme_latest'] = 'Latest and Greatest Themes';
 $txt['theme_latest_fetch'] = 'Fetching latest themes from www.simplemachines.org...';