Bladeren bron

Merge pull request #816 from Arantor/release-2.1

! Make the maintenance mode warning more obvious and show it everywhere ...
Arantor 10 jaren geleden
bovenliggende
commit
c5fe0e0a62

+ 1 - 4
Sources/Admin.php

@@ -25,16 +25,13 @@ if (!defined('SMF'))
  */
 function AdminMain()
 {
-	global $txt, $context, $scripturl, $modSettings, $settings, $sourcedir, $options, $boarddir, $maintenance;
+	global $txt, $context, $scripturl, $modSettings, $settings, $sourcedir, $options, $boarddir;
 
 	// Load the language and templates....
 	loadLanguage('Admin');
 	loadTemplate('Admin', 'admin');
 	loadJavascriptFile('admin.js', array('default_theme' => true), 'admin.js');
 
-	if (!empty($maintenance))
-		$context['template_layers'][] = 'maint_warning';
-
 	// No indexing evil stuff.
 	$context['robot_no_index'] = true;
 

+ 15 - 0
Sources/Subs.php

@@ -3097,6 +3097,21 @@ function template_header()
 
 	header('Content-Type: text/' . (isset($_REQUEST['xml']) ? 'xml' : 'html') . '; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
 
+	// We need to splice this in after the body layer, or after the main layer for older stuff.
+	if ($context['in_maintenance'] && $context['user']['is_admin'])
+	{
+		$position = array_search('body', $context['template_layers']);
+		if ($position === false)
+			$position = array_search('main', $context['template_layers']);
+
+		if ($position !== false)
+		{
+			$before = array_slice($context['template_layers'], 0, $position + 1);
+			$after = array_slice($context['template_layers'], $position + 1);
+			$context['template_layers'] = array_merge($before, array('maint_warning'), $after);
+		}
+	}
+
 	$checked_securityFiles = false;
 	$showed_banned = false;
 	foreach ($context['template_layers'] as $layer)

+ 0 - 22
Themes/default/Admin.template.php

@@ -10,28 +10,6 @@
  * @version 2.1 Alpha 1
  */
 
-function template_maint_warning_above()
-{
-	global $txt, $context, $scripturl;
-
-	echo '
-	<div class="errorbox" id="errors">
-		<dl>
-			<dt>
-				<strong id="error_serious">', $txt['forum_in_maintainence'], '</strong>
-			</dt>
-			<dd class="error" id="error_list">
-				', sprintf($txt['maintenance_page'], $scripturl . '?action=admin;area=serversettings;' . $context['session_var'] . '=' . $context['session_id']), '
-			</dd>
-		</dl>
-	</div>';
-}
-
-function template_maint_warning_below()
-{
-
-}
-
 /**
  * This is the administration center home.
  */

+ 24 - 5
Themes/default/index.template.php

@@ -181,13 +181,10 @@ function template_body_above()
 		<div class="frame">
 			<ul class="floatleft">';
 
-	// If the user is logged in, display the time, or a maintenance warning for admins.
+	// If the user is logged in, display some things that might be useful.
 	if ($context['user']['is_logged'])
 	{
-		// Is the forum in maintenance mode?
-		if ($context['in_maintenance'] && $context['user']['is_admin'])
-			echo '
-				<li class="notice">', $txt['maintain_mode_on'], '<br /></li>';
+		// @todo There needs to be something else here.
 
 		if (!empty($context['open_mod_reports']) && $context['show_open_reports'])
 			echo '
@@ -553,4 +550,26 @@ function template_button_strip($button_strip, $direction = '', $strip_options =
 		</div>';
 }
 
+function template_maint_warning_above()
+{
+	global $txt, $context, $scripturl;
+
+	echo '
+	<div class="errorbox" id="errors">
+		<dl>
+			<dt>
+				<strong id="error_serious">', $txt['forum_in_maintainence'], '</strong>
+			</dt>
+			<dd class="error" id="error_list">
+				', sprintf($txt['maintenance_page'], $scripturl . '?action=admin;area=serversettings;' . $context['session_var'] . '=' . $context['session_id']), '
+			</dd>
+		</dl>
+	</div>';
+}
+
+function template_maint_warning_below()
+{
+
+}
+
 ?>

+ 0 - 3
Themes/default/languages/Admin.english.php

@@ -3,9 +3,6 @@
 
 global $settings, $scripturl;
 
-$txt['forum_in_maintainence'] = 'Your forum is in Maintenance Mode. Only administrators can currently log in.';
-$txt['maintenance_page'] = 'You can turn off Maintenance Mode from the <a href="%1$s">Server Settings</a> area.';
-
 $txt['settings_saved'] = 'The settings were successfully saved';
 $txt['settings_not_saved'] = 'Your changes were not saved because: %1$s';
 

+ 2 - 1
Themes/default/languages/index.english.php

@@ -342,7 +342,8 @@ $txt['yim_title'] = 'Yahoo Instant Messenger';
 
 $txt['skype'] = 'Skype';
 
-$txt['maintain_mode_on'] = 'Remember, this forum is in \'Maintenance Mode\'.';
+$txt['forum_in_maintainence'] = 'Your forum is in Maintenance Mode. Only administrators can currently log in.';
+$txt['maintenance_page'] = 'You can turn off Maintenance Mode from the <a href="%1$s">Server Settings</a> area.';
 
 $txt['read_one_time'] = 'Read 1 time';
 $txt['read_many_times'] = 'Read %1$d times';