Bladeren bron

! Some versions may not contain a minor type. (Subs-Package.php) [Bug 4775]
! Some versions may not contain a minor type. (Subs-Package.php)
! Don't allow empty bbc tags to follow the censor (ManagePost.php, Subs-Post.php) [Bug 4792]
! Added a hidden mod setting to enable deleting a members email upon member deletion (Subs-Members.php) [Bug 4795]
! In some rare cases, the cookie would still not be updated properly after the session changes (Subs-Auth.php) [Bug 4506]
! Fixed title tag in news readme.
! Don't pass global variables to hooks [Bug 4796]
! Substr is slow (Subs-Editor.php, Subs-Members.php, Load.php) [WIP 4176]
! Editing events wouldn't work properly if you couldn't modify the post. (Calendar.php) [Bug 4734] Thanks emanuele!

Spuds 13 jaren geleden
bovenliggende
commit
f430ae4072

+ 16 - 0
Sources/Calendar.php

@@ -210,6 +210,21 @@ function CalendarPost()
 		// ... or just update it?
 		else
 		{
+			// There could be already a topic you are not allowed to modify
+			if (!allowedTo('post_new') && empty($modSettings['disableNoPostingCalendarEdits']))
+			{
+				$request = $smcFunc['db_query']('', '
+					SELECT id_board, id_topic
+					FROM {db_prefix}calendar
+					WHERE id_event = {int:id_event}
+					LIMIT 1',
+					array(
+						'id_event' => $_REQUEST['eventid'],
+				));
+				list ($id_board, $id_topic) = $smcFunc['db_fetch_row']($request);
+				$smcFunc['db_free_result']($request);
+			}
+			
 			$eventOptions = array(
 				'title' => substr($_REQUEST['evtitle'], 0, 60),
 				'span' => empty($modSettings['cal_allowspan']) || empty($_POST['span']) || $_POST['span'] == 1 || empty($modSettings['cal_maxspan']) || $_POST['span'] > $modSettings['cal_maxspan'] ? 0 : min((int) $modSettings['cal_maxspan'], (int) $_POST['span'] - 1),
@@ -482,4 +497,5 @@ function clock()
 			}
 	}
 }
+
 ?>

+ 1 - 1
Sources/Post.php

@@ -277,7 +277,7 @@ function Post()
 		isAllowedTo('calendar_post');
 
 		// Editing an event?  (but NOT previewing!?)
-		if (!$context['event']['new'] && !isset($_REQUEST['subject']))
+		if (empty($context['event']['new']) && !isset($_REQUEST['subject']))
 		{
 			// If the user doesn't have permission to edit the post in this topic, redirect them.
 			if ((empty($id_member_poster) || $id_member_poster != $user_info['id'] || !allowedTo('modify_own')) && !allowedTo('modify_any'))

+ 1 - 0
Sources/Profile-Modify.php

@@ -2725,6 +2725,7 @@ function profileSaveAvatarData(&$value)
 					// Attempt to chmod it.
 					@chmod($uploadDir . '/avatar_tmp_' . $memID, 0644);
 
+					// @todo remove this require when appropriate
 					require_once($sourcedir . '/Subs-Graphics.php');
 					if (!downloadAvatar($uploadDir . '/avatar_tmp_' . $memID, $memID, $modSettings['avatar_max_width_upload'], $modSettings['avatar_max_height_upload']))
 						return 'bad_avatar';

+ 1 - 1
Sources/Subs-Auth.php

@@ -174,7 +174,7 @@ 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', '=='))
+		if (version_compare(PHP_VERSION, '4.3.2', '==') || !isset($_COOKIE[session_name()]) || $_COOKIE[session_name()] != session_id())
 		{
 			$sessionCookieLifetime = ini_get('session.cookie_lifetime');
 			setcookie(session_name(), session_id(), time() + (empty($sessionCookieLifetime) ? $cookie_length : $sessionCookieLifetime), $cookie_url[1], $cookie_url[0], !empty($modSettings['secureCookies']));

+ 1 - 1
Sources/Subs-Editor.php

@@ -1708,7 +1708,7 @@ function create_control_richedit($editorOptions)
 		);
 
 		// Allow mods to modify BBC buttons.
-		call_integration_hook('integrate_bbc_buttons', array(&$context['bbc_tags']));
+		call_integration_hook('integrate_bbc_buttons');
 
 		// Show the toggle?
 		if (empty($modSettings['disable_wysiwyg']))

+ 2 - 1
Sources/Subs-Members.php

@@ -142,7 +142,8 @@ function deleteMembers($users, $check_not_admin = false)
 	// Make these peoples' posts guest posts.
 	$smcFunc['db_query']('', '
 		UPDATE {db_prefix}messages
-		SET id_member = {int:guest_id}, poster_email = {string:blank_email}
+		SET id_member = {int:guest_id}, ', !empty($modSettings['deleteMembersRemovesEmail']) ? '
+		poster_email = {string:blank_email}' : '', '
 		WHERE id_member IN ({array_int:users})',
 		array(
 			'guest_id' => 0,

+ 4 - 4
Sources/Subs-Package.php

@@ -1479,11 +1479,11 @@ function compareVersions($version1, $version2)
 		// Build an array of parts.
 		$versions[$id] = array(
 			'major' => (int) $parts[1],
-			'minor' => (int) $parts[2],
-			'patch' => (int) $parts[3],
+			'minor' => !empty($parts[2]) ? (int) $parts[2] : 0,
+			'patch' => !empty($parts[3]) ? (int) $parts[3] : 0,
 			'type' => empty($parts[4]) ? 'stable' : $parts[4],
-			'type_major' => (int) $parts[5],
-			'type_minor' => (int) $parts[6],
+			'type_major' => !empty($parts[6]) ? (int) $parts[5] : 0,
+			'type_minor' => !empty($parts[6]) ? (int) $parts[6] : 0,
 			'dev' => !empty($parts[7]),
 		);
 	}

+ 3 - 0
Sources/Subs-Post.php

@@ -243,6 +243,9 @@ function preparsecode(&$message, $previewing = false)
 
 	// Now let's quickly clean up things that will slow our parser (which are common in posted code.)
 	$message = strtr($message, array('[]' => '[]', '['' => '[''));
+
+	// Remove empty bbc.
+	$message = preg_replace('~\[([^\]]+)\]\[/\1\]~i', '', $message);
 }
 
 /**

+ 27 - 0
Sources/Subs.php

@@ -202,6 +202,25 @@ if (!defined('SMF'))
 */
 
 // Update some basic statistics...
+/**
+ * Update some basic statistics.
+ * 
+ * The 'member' statistic updates the latest member, the total member
+ *  count, and the number of unapproved members.
+ * 'member' also only counts approved members when approval is on, but
+ *  is much more efficient with it off.
+ * updating 'message' changes the total number of messages, and the
+ *  highest message id by id_msg - which can be parameters 1 and 2,
+ *  respectively.
+ * 'topic' updates the total number of topics, or if parameter1 is true
+ *  simply increments them.
+ * the 'postgroups' case updates those members who match condition's
+ *  post-based membergroups in the database (restricted by parameter1).
+ * 
+ * @param string $type Stat type - can be 'member', 'message', 'topic', or 'postgroups'
+ * @param mixed $parameter1 = null
+ * @param mixed $parameter2 = null
+ */
 function updateStats($type, $parameter1 = null, $parameter2 = null)
 {
 	global $sourcedir, $modSettings, $smcFunc;
@@ -3633,6 +3652,10 @@ function setupMenuContext()
 			{
 				$button['active_button'] = false;
 
+				// This button needs some action.
+				if (isset($button['action_hook']))
+					$needs_action_hook = true;
+
 				// Make sure the last button truely is the last button.
 				if (!empty($button['is_last']))
 				{
@@ -3689,6 +3712,10 @@ function setupMenuContext()
 	elseif ($context['current_action'] == 'groups' && $context['allow_moderation_center'])
 		$current_action = 'moderate';
 
+	// Not all actions are simple.
+	if (!empty($needs_action_hook))
+		call_integration_hook('integrate_current_action', array(&$current_action));
+
 	$context['menu_buttons'][$current_action]['active_button'] = true;
 
 	if (!$user_info['is_guest'] && $context['user']['unread_messages'] > 0 && isset($context['menu_buttons']['pm']))