浏览代码

! Even more doc stuff.
! Port the correction of the user to email in personal message template from 2.0.
! update core template files for isBrowser
! Reverting 10753, which would cause a security weakness.

Spuds 12 年之前
父节点
当前提交
3c431b6cf9

+ 2 - 2
Sources/Display.php

@@ -1359,8 +1359,8 @@ function Download()
 
 	// Different browsers like different standards...
 	if ($context['browser']['is_firefox'])
-		header('Content-Disposition: ' . $disposition . '; filename*="UTF-8\'\'' . preg_replace('~&#(\d{3,8});~e', '$fixchar(\'$1\')', $utf8name) . '"');
-
+		header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace('~&#(\d{3,8});~e', '$fixchar(\'$1\')', $utf8name)));
+	
 	elseif ($context['browser']['is_opera'])
 		header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace('~&#(\d{3,8});~e', '$fixchar(\'$1\')', $utf8name) . '"');
 

+ 3 - 0
Sources/Load.php

@@ -1560,6 +1560,9 @@ function loadTheme($id_theme = 0, $initialize = true)
 		'spellcheck',
 	);
 
+	$context['javascript_files'] = array();
+	$context['css_files'] = array();
+
 	// Wireless mode?  Load up the wireless stuff.
 	if (WIRELESS)
 	{

+ 2 - 1
Sources/ScheduledTasks.php

@@ -278,6 +278,7 @@ function scheduled_approval_notification()
 	// Need the below for loadLanguage to work!
 	loadEssentialThemeData();
 
+	$current_language = '';
 	// Finally, loop through each member, work out what they can do, and send it.
 	foreach ($members as $id => $member)
 	{
@@ -502,7 +503,7 @@ function scheduled_auto_optimize()
 
 	// Actually do the optimisation.
 	if ($db_type == 'sqlite')
-		$smcFunc['db_optimize_table']($table[0]);
+		$smcFunc['db_optimize_table']($tables[0]);
 	else
 		foreach ($tables as $table)
 			$smcFunc['db_optimize_table']($table);

+ 5 - 3
Sources/Subs-Auth.php

@@ -52,11 +52,11 @@ function setLoginCookie($cookie_length, $id, $password = '')
 	$cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
 
 	// Set the cookie, $_COOKIE, and session variable.
-	setcookie($cookiename, $data, time() + $cookie_length, $cookie_url[1], $cookie_url[0], !empty($modSettings['secureCookies']));
+	smf_setcookie($modSettings['cookie_name'], $data, time() + $cookie_length, $cookie_url[1], $cookie_url[0]);
 
 	// If subdomain-independent cookies are on, unset the subdomain-dependent cookie too.
 	if (empty($id) && !empty($modSettings['globalCookies']))
-		setcookie($cookiename, $data, time() + $cookie_length, $cookie_url[1], '', !empty($modSettings['secureCookies']));
+		smf_setcookie($modSettings['cookie_name'], $data, time() + $cookie_length, $cookie_url[1], '');
 
 	// Any alias URLs?  This is mainly for use with frames, etc.
 	if (!empty($modSettings['forum_alias_urls']))
@@ -100,8 +100,10 @@ function setLoginCookie($cookie_length, $id, $password = '')
 		$_SESSION = $oldSessionData;
 
 		// Version 4.3.2 didn't store the cookie of the new session.
-		if (version_compare(PHP_VERSION, '4.3.2', '==') || !isset($_COOKIE[session_name()]) || $_COOKIE[session_name()] != session_id())
+		if (version_compare(PHP_VERSION, '4.3.2', '=='))
 		{
+			// Do not check $_COOKIE here, PHP only updates it at the next page load,
+			// therefore here it will always be unset for the session just created.
 			$sessionCookieLifetime = ini_get('session.cookie_lifetime');
 			smf_setcookie(session_name(), session_id(), time() + (empty($sessionCookieLifetime) ? $cookie_length : $sessionCookieLifetime), $cookie_url[1], $cookie_url[0]);
 		}

+ 2 - 2
Themes/core/Display.template.php

@@ -465,7 +465,7 @@ function template_main()
 		echo '
 						<div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>
 					</div>', $message['can_modify'] ? '
-					<img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="'. $txt['modify_msg']. '" title="' . $txt['modify_msg'] . '" class="modifybutton" id="modify_button_' . $message['id'] . '" style="cursor: ' . ($context['browser']['is_ie5'] || $context['browser']['is_ie5.5'] ? 'hand' : 'pointer') . '; display: none;" onclick="oQuickModify.modifyMsg(\'' . $message['id'] . '\')" />' : '';
+					<img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="'. $txt['modify_msg']. '" title="' . $txt['modify_msg'] . '" class="modifybutton" id="modify_button_' . $message['id'] . '" style="cursor: ' . (isBrowser('is_ie5') || isBrowser('is_ie5.5') ? 'hand' : 'pointer') . '; display: none;" onclick="oQuickModify.modifyMsg(\'' . $message['id'] . '\')" />' : '';
 
 		// Assuming there are attachments...
 		if (!empty($message['attachment']))
@@ -754,7 +754,7 @@ function template_main()
 			sTemplateBodyEdit: ', JavaScriptEscape('
 				<div id="quick_edit_body_container" style="width: 90%">
 					<div id="error_box" style="padding: 4px;" class="error"></div>
-					<textarea class="editor" name="message" rows="12" style="' . ($context['browser']['is_ie8'] ? 'width: 635px; max-width: 100%; min-width: 100%' : 'width: 100%') . ';  margin-bottom: 10px;" tabindex="' . $context['tabindex']++ . '">%body%</textarea><br />
+					<textarea class="editor" name="message" rows="12" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 100%; min-width: 100%' : 'width: 100%') . ';  margin-bottom: 10px;" tabindex="' . $context['tabindex']++ . '">%body%</textarea><br />
 					<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
 					<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />
 					<input type="hidden" name="msg" value="%msg_id%" />

+ 3 - 3
Themes/core/PersonalMessage.template.php

@@ -327,7 +327,7 @@ function template_folder()
 				// Don't show the email address if they want it hidden.
 				if (in_array($message['member']['show_email'], array('yes', 'yes_permission_override', 'no_through_forum')))
 					echo '
-								<li><a href="', $scripturl, '?action=emailuser;sa=email;msg=', $message['id'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email']), '</a></li>';
+								<li><a href="', $scripturl, '?action=emailuser;sa=email;uid=', $message['member']['id'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email']), '</a></li>';
 
 				// Since we know this person isn't a guest, you *can* message them.
 				if ($context['can_send_pm'])
@@ -1066,7 +1066,7 @@ function template_send()
 	echo '
 				<p><label for="outbox"><input type="checkbox" name="outbox" id="outbox" value="1" tabindex="', $context['tabindex']++, '"', $context['copy_to_outbox'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['pm_save_outbox'], '</label></p>
 				<p id="shortcuts" class="smalltext">
-					', $context['browser']['is_firefox'] ? $txt['shortcuts_firefox'] : $txt['shortcuts'], '
+					', isBrowser('is_firefox') ? $txt['shortcuts_firefox'] : $txt['shortcuts'], '
 				</p>
 				<p id="post_confirm_strip" class="righttext">
 					', template_control_richedit_buttons($context['post_box_name']), '
@@ -1322,7 +1322,7 @@ function template_report_message()
 						<strong>', $txt['pm_report_reason'], ':</strong>
 					</dt>
 					<dd>
-						<textarea name="reason" rows="4" cols="70" style="' . ($context['browser']['is_ie8'] ? 'width: 635px; max-width: 80%; min-width: 80%' : 'width: 80%') . ';"></textarea>
+						<textarea name="reason" rows="4" cols="70" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 80%; min-width: 80%' : 'width: 80%') . ';"></textarea>
 					</dd>
 				</dl>
 				<input type="submit" name="report" value="', $txt['pm_report_message'], '" class="button_submit" />

+ 0 - 9
Themes/core/Settings.template.php

@@ -40,11 +40,6 @@ function template_options()
 			'label' => $txt['show_no_signatures'],
 			'default' => true,
 		),
-		array(
-			'id' => 'show_no_censored',
-			'label' => $txt['show_no_censored'],
-			'default' => true,
-		),
 		array(
 			'id' => 'return_to_post',
 			'label' => $txt['return_to_post'],
@@ -181,10 +176,6 @@ function template_settings()
 			'id' => 'show_mark_read',
 			'label' => $txt['enable_mark_as_read'],
 		),
-		array(
-			'id' => 'allow_no_censored',
-			'label' => $txt['allow_no_censored'],
-		),
 		array(
 			'id' => 'enable_news',
 			'label' => $txt['enable_random_news'],

+ 3 - 3
Themes/core/index.template.php

@@ -89,7 +89,7 @@ function template_html_above()
 
 	// Some browsers need an extra stylesheet due to bugs/compatibility issues.
 	foreach (array('ie7', 'ie6', 'webkit') as $cssfix)
-		if ($context['browser']['is_' . $cssfix])
+		if (isBrowser('is_' . $cssfix))
 			echo '
 	<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/', $cssfix, '.css" />';
 
@@ -269,7 +269,7 @@ function template_body_above()
 		echo '
 				<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
 				<form class="windowbg" id="guest_form" action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
-					', $txt['login_or_register'], '<br />
+					', $context['can_register'] ? $txt['login_or_register'] : $txt['please_login'], '<br />
 					<input type="text" name="user" size="10" class="input_text" />
 					<input type="password" name="passwrd" size="10" class="input_password" />
 					<select name="cookielength">
@@ -464,7 +464,7 @@ function template_menu()
 		if (!empty($button['is_last']))
 			$classes[] = 'last';
 		/* IE6 can't do multiple class selectors */
-		if ($context['browser']['is_ie6'] && !empty($button['active_button']) && !empty($button['is_last']))
+		if (isBrowser('is_ie6') && !empty($button['active_button']) && !empty($button['is_last']))
 			$classes[] = 'lastactive';
 
 		$classes = implode(' ', $classes);

+ 28 - 10
Themes/default/index.template.php

@@ -53,27 +53,45 @@ function template_init()
 		'html' for an HTML 4.01 document type definition. */
 	$settings['doctype'] = 'xhtml';
 
-	/* The version this template/theme is for.
-		This should probably be the version of SMF it was created for. */
+	// The version this template/theme is for. This should probably be the version of SMF it was created for.
 	$settings['theme_version'] = '2.0';
 
-	/* Set a setting that tells the theme that it can render the tabs. */
+	// Set a setting that tells the theme that it can render the tabs.
 	$settings['use_tabs'] = true;
 
-	/* Use plain buttons - as opposed to text buttons? */
+	// Use plain buttons - as opposed to text buttons?
 	$settings['use_buttons'] = true;
 
-	/* Show sticky and lock status separate from topic icons? */
+	// Show sticky and lock status separate from topic icons?
 	$settings['separate_sticky_lock'] = true;
 
-	/* Does this theme use the strict doctype? */
+	// Does this theme use the strict doctype?
 	$settings['strict_doctype'] = false;
 
-	/* Does this theme use post previews on the message index? */
+	// Does this theme use post previews on the message index?
 	$settings['message_index_preview'] = false;
 
-	/* Set the following variable to true if this theme requires the optional theme strings file to be loaded. */
+	// Set the following variable to true if this theme requires the optional theme strings file to be loaded.
 	$settings['require_theme_strings'] = false;
+
+	// Load the CSS
+	loadCSSFile($settings['theme_url'], '/css/index', $context['theme_variant'], '.css?fin20');
+
+	// Some browsers need an extra stylesheet due to bugs/compatibility issues.
+	foreach (array('ie7', 'ie6', 'webkit') as $cssfix)
+		if (isBrowser('is_' . $cssfix))
+			loadCSSFile($settings['default_theme_url'], '/css/', $cssfix, '.css');
+
+	// RTL languages require an additional stylesheet.
+	if ($context['right_to_left'])
+		loadCSSFile($settings['theme_url'], '/css/rtl.css');
+
+	// Now load the JS
+	loadJavascriptFile($settings['theme_url'], '/scripts/jquery-1.6.4.min.js');
+	loadJavascriptFile($settings['theme_url'], '/scripts/hoverIntent.js');
+	loadJavascriptFile($settings['theme_url'], '/scripts/superfish.js');
+	loadJavascriptFile($settings['default_theme_url'], '/scripts/script.js?fin20');
+	loadJavascriptFile($settings['theme_url'], '/scripts/theme.js?fin20');
 }
 
 /**
@@ -112,6 +130,8 @@ function template_html_above()
 	<script type="text/javascript" src="', $settings['theme_url'], '/scripts/jquery-1.6.4.min.js"></script>
 	<script type="text/javascript" src="', $settings['theme_url'], '/scripts/hoverIntent.js"></script>
 	<script type="text/javascript" src="', $settings['theme_url'], '/scripts/superfish.js"></script>
+	<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js?fin20"></script>
+	<script type="text/javascript" src="', $settings['theme_url'], '/scripts/theme.js?fin20"></script>
 	<script type="text/javascript">
 
 			$(document).ready(function() { 
@@ -119,8 +139,6 @@ function template_html_above()
 			});
 
 	</script>
-	<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js?fin20"></script>
-	<script type="text/javascript" src="', $settings['theme_url'], '/scripts/theme.js?fin20"></script>
 	<script type="text/javascript"><!-- // --><![CDATA[
 		var smf_theme_url = "', $settings['theme_url'], '";
 		var smf_default_theme_url = "', $settings['default_theme_url'], '";

+ 1 - 0
index.php

@@ -130,6 +130,7 @@ if (WIRELESS)
 	define('WIRELESS_PROTOCOL', isset($_REQUEST['wap']) ? 'wap' : (isset($_REQUEST['wap2']) ? 'wap2' : (isset($_REQUEST['imode']) ? 'imode' : '')));
 
 	// Some cellphones can't handle output compression...
+	// @todo shouldn't the phone handle that?
 	$modSettings['enableCompressedOutput'] = '0';
 	// @todo Do we want these hard coded?
 	$modSettings['defaultMaxMessages'] = 5;