Ver Fonte

Merge pull request #1 from emanuele45/master

! $board not reassigned in MEssageIndex.php [Bug 4929]
! Fatal error accessing stat page if stats are disabled [Bug 4742] + typo in Profile-Actions.php
! No more errors when pruning attachments without notice [Bug 4818]
! When pacakges are uninstalled, the time_removed field is updated only for the uninstalled package [topic 453027]
Spuds há 13 anos atrás
pai
commit
a480c2dc53

+ 6 - 6
Sources/ManageAttachments.php

@@ -704,14 +704,14 @@ function RemoveAttachmentByAge()
 		$messages = removeAttachments(array('attachment_type' => 0, 'poster_time' => (time() - 24 * 60 * 60 * $_POST['age'])), 'messages', true);
 
 		// Update the messages to reflect the change.
-		if (!empty($messages))
+		if (!empty($messages) && !empty($_POST['notice']))
 			$smcFunc['db_query']('', '
 				UPDATE {db_prefix}messages
-				SET body = CONCAT(body, ' . (!empty($_POST['notice']) ? '{string:notice}' : '') . ')
+				SET body = CONCAT(body, {string:notice})
 				WHERE id_msg IN ({array_int:messages})',
 				array(
 					'messages' => $messages,
-					'notice' => empty($_POST['notice']) ? '' : '<br /><br />' . $_POST['notice'],
+					'notice' => '<br /><br />' . $_POST['notice'],
 				)
 			);
 	}
@@ -740,14 +740,14 @@ function RemoveAttachmentBySize()
 	$messages = removeAttachments(array('attachment_type' => 0, 'size' => 1024 * $_POST['size']), 'messages', true);
 
 	// And make a note on the post.
-	if (!empty($messages))
+	if (!empty($messages) && !empty($_POST['notice']))
 		$smcFunc['db_query']('', '
 			UPDATE {db_prefix}messages
-			SET body = CONCAT(body, ' . (!empty($_POST['notice']) ? '{string:notice}' : '') . ')
+			SET body = CONCAT(body, {string:notice})
 			WHERE id_msg IN ({array_int:messages})',
 			array(
 				'messages' => $messages,
-				'notice' => empty($_POST['notice']) ? '' : '<br /><br />' . $_POST['notice'],
+				'notice' => '<br /><br />' . $_POST['notice'],
 			)
 		);
 

+ 2 - 2
Sources/MessageIndex.php

@@ -611,8 +611,8 @@ function MessageIndex()
 			foreach ($context['move_to_boards'] as $id_cat => $cat)
 			{
 				$context['move_to_boards'][$id_cat]['name'] = strip_tags($cat['name']);
-				foreach ($cat['boards'] as $id_board => $board)
-					$context['move_to_boards'][$id_cat]['boards'][$id_board]['name'] = strip_tags($board['name']);
+				foreach ($cat['boards'] as $id_board => $aboard)
+					$context['move_to_boards'][$id_cat]['boards'][$id_board]['name'] = strip_tags($aboard['name']);
 			}
 
 			// With no other boards to see, it's useless to move.

+ 3 - 1
Sources/Packages.php

@@ -1002,13 +1002,15 @@ function PackageInstall()
 					UPDATE {db_prefix}log_packages
 					SET install_state = {int:not_installed}, member_removed = {string:member_name}, id_member_removed = {int:current_member},
 						time_removed = {int:current_time}
-					WHERE package_id = {string:package_id}',
+					WHERE package_id = {string:package_id}
+						AND id_install = {int:install_id}',
 					array(
 						'current_member' => $user_info['id'],
 						'not_installed' => 0,
 						'current_time' => time(),
 						'package_id' => $row['package_id'],
 						'member_name' => $user_info['name'],
+						'install_id' => $context['install_id'],
 					)
 				);
 			}

+ 1 - 1
Sources/Profile-Actions.php

@@ -548,7 +548,7 @@ function deleteAccount2($profile_vars, $post_errors, $memID)
 		require_once($sourcedir . '/LogInOut.php');
 		LogOut(true);
 
-		redirectExit();
+		redirectexit();
 	}
 }
 

+ 3 - 0
Sources/Stats.php

@@ -29,6 +29,9 @@ function DisplayStats()
 	global $txt, $scripturl, $modSettings, $user_info, $context, $smcFunc;
 
 	isAllowedTo('view_stats');
+	// Page disabled - redirect them out
+	if (empty($modSettings['trackStats']))
+		fatal_lang_error('feature_disabled', true);
 
 	if (!empty($_REQUEST['expand']))
 	{