Browse Source

! removed error suppression with proper check LogInOut.php
! very minor doc changes
! minor reverts to sync to 2.0 to improve compatibility

Spuds 13 năm trước cách đây
mục cha
commit
85f1a014eb

+ 3 - 3
Sources/Load.php

@@ -77,7 +77,7 @@ function reloadSettings()
 	 */
 	$smcFunc += array(
 		'entity_fix' => create_function('$string', '
-			$num = substr($string, 0, 1) === \'x\' ? hexdec(substr($string, 1)) : (int) $string;
+			$num = $string[0] === \'x\' ? hexdec(substr($string, 1)) : (int) $string;
 			return $num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num == 0x202E ? \'\' : \'&#\' . $num . \';\';'),
 		'htmlspecialchars' => create_function('$string, $quote_style = ENT_COMPAT, $charset = \'ISO-8859-1\'', '
 			global $smcFunc;
@@ -1914,7 +1914,7 @@ function loadTemplate($template_name, $style_sheets = array(), $fatal = true)
 			loadLanguage('Errors');
 			echo '
 <div class="alert errorbox">
-	<a href="', $scripturl, '?action=admin;area=theme;sa=settings;th=1;', $context['session_var'], '=' . $context['session_id'], '" class="alert">', $txt['theme_dir_wrong'], '</a>
+	<a href="', $scripturl . '?action=admin;area=theme;sa=settings;th=1;' . $context['session_var'] . '=' . $context['session_id'], '" class="alert">', $txt['theme_dir_wrong'], '</a>
 </div>';
 		}
 
@@ -2707,7 +2707,7 @@ function cache_get_data($key, $ttl = 120)
 		if (empty($memcached))
 			get_memcached_server();
 		if (!$memcached)
-			return;
+			return null;
 		
 		$value = (function_exists('memcache_get')) ? memcache_get($cache['connection'], $key) : memcached_get($cache['connection'], $key);
 	}

+ 2 - 2
Sources/LogInOut.php

@@ -257,7 +257,7 @@ function Login2()
 			// Don't allow this!
 			validatePasswordFlood($user_settings['id_member'], $user_settings['passwd_flood']);
 
-			$_SESSION['failed_login'] = @$_SESSION['failed_login'] + 1;
+			$_SESSION['failed_login'] = isset($_SESSION['failed_login']) ? ($_SESSION['failed_login'] + 1) : 1;
 
 			if ($_SESSION['failed_login'] >= $modSettings['failed_login_threshold'])
 				redirectexit('action=reminder');
@@ -364,7 +364,7 @@ function Login2()
 		else
 		{
 			// They've messed up again - keep a count to see if they need a hand.
-			$_SESSION['failed_login'] = @$_SESSION['failed_login'] + 1;
+			$_SESSION['failed_login'] = isset($_SESSION['failed_login']) ? ($_SESSION['failed_login'] + 1) : 1;
 
 			// Hmm... don't remember it, do you?  Here, try the password reminder ;).
 			if ($_SESSION['failed_login'] >= $modSettings['failed_login_threshold'])

+ 1 - 3
Sources/ManageAttachments.php

@@ -991,9 +991,7 @@ function RepairAttachments()
 				redirectexit('action=admin;area=manageattachments;sa=maintenance');
 
 			$_SESSION['attachments_to_fix'] = array();
-			/**
-			 * @todo No need to do this I think.
-			 */
+			// @todo No need to do this I think.
 			foreach ($_POST['to_fix'] as $key => $value)
 				$_SESSION['attachments_to_fix'][] = $value;
 		}

+ 1 - 1
Sources/ManageBoards.php

@@ -371,7 +371,7 @@ function EditCategory2()
  */
 function EditBoard()
 {
-	global $txt, $context, $cat_tree, $boards, $boardList, $smcFunc, $modSettings, $sourcedir;
+	global $txt, $context, $cat_tree, $boards, $boardList, $sourcedir, $smcFunc, $modSettings;
 
 	loadTemplate('ManageBoards');
 	require_once($sourcedir . '/Subs-Boards.php');

+ 1 - 3
Sources/Memberlist.php

@@ -501,9 +501,7 @@ function MLSearch()
 		$context['page_index'] = constructPageIndex($scripturl . '?action=mlist;sa=search;search=' . $_POST['search'] . ';fields=' . implode(',', $_POST['fields']), $_REQUEST['start'], $numResults, $modSettings['defaultMaxMembers']);
 
 		// Find the members from the database.
-		/**
-		 * @todo SLOW This query is slow.
-		 */
+		// @todo SLOW This query is slow.
 		$request = $smcFunc['db_query']('', '
 			SELECT mem.id_member
 			FROM {db_prefix}members AS mem

+ 1 - 0
Sources/ModerationCenter.php

@@ -174,6 +174,7 @@ function ModerationMain($dont_call = false)
 	// I don't know where we're going - I don't know where we've been...
 	$menuOptions = array(
 		'action' => 'moderate',
+		'disable_url_session_check' => true,
 	);
 	$mod_include_data = createMenu($moderation_areas, $menuOptions);
 	unset($moderation_areas);

+ 1 - 1
Sources/Packages.php

@@ -1244,7 +1244,7 @@ function PackageRemove()
 	$_GET['package'] = preg_replace('~[\.]+~', '.', strtr($_GET['package'], array('/' => '_', '\\' => '_')));
 
 	// Can't delete what's not there.
-	if (file_exists($boarddir . '/Packages/' . $_GET['package']) && (substr($_GET['package'], -4) == '.zip' || substr($_GET['package'], -4) == '.tgz' || substr($_GET['package'], -7) == '.tar.gz' || is_dir($boarddir . '/Packages/' . $_GET['package'])) && $_GET['package'] != 'backups' && strpos($_GET['package'], '.') !== 0)
+	if (file_exists($boarddir . '/Packages/' . $_GET['package']) && (substr($_GET['package'], -4) == '.zip' || substr($_GET['package'], -4) == '.tgz' || substr($_GET['package'], -7) == '.tar.gz' || is_dir($boarddir . '/Packages/' . $_GET['package'])) && $_GET['package'] != 'backups' && substr($_GET['package'], 0, 1) != '.')
 	{
 		create_chmod_control(array($boarddir . '/Packages/' . $_GET['package']), array('destination_url' => $scripturl . '?action=admin;area=packages;sa=remove;package=' . $_GET['package'], 'crash_on_error' => true));
 

+ 2 - 2
Sources/Subs.php

@@ -2368,7 +2368,7 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
 	else
 		$message = strtr($message, array("\n" => ''));
 
-	if (substr($message, 0, 1) === ' ')
+	if (substr($message, 0, 1) == ' ')
 		$message = '&nbsp;' . substr($message, 1);
 
 	// Cleanup whitespace.
@@ -2410,7 +2410,7 @@ function parsesmileys(&$message)
 	static $smileyPregSearch = null, $smileyPregReplacements = array();
 
 	// No smiley set at all?!
-	if ($user_info['smiley_set'] === 'none' || trim($message) === '')
+	if ($user_info['smiley_set'] == 'none' || trim($message) == '')
 		return;
 
 	// If smileyPregSearch hasn't been set, do it now.