Skip to content

Commit

Permalink
! Some versions may not contain a minor type. (Subs-Package.php) [Bug…
Browse files Browse the repository at this point in the history
… 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!
  • Loading branch information
Spuds committed Jan 25, 2012
1 parent f438dca commit f430ae4
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 8 deletions.
16 changes: 16 additions & 0 deletions Sources/Calendar.php
Expand Up @@ -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);

This comment has been minimized.

Copy link
@joshuaadickerson

joshuaadickerson May 17, 2013

Contributor

What were you trying to do here? $id_board and $id_topic aren't used anywhere

This comment has been minimized.

Copy link
@norv
$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),
Expand Down Expand Up @@ -482,4 +497,5 @@ function clock()
}
}
}

?>
2 changes: 1 addition & 1 deletion Sources/Post.php
Expand Up @@ -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'))
Expand Down
1 change: 1 addition & 0 deletions Sources/Profile-Modify.php
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion Sources/Subs-Auth.php
Expand Up @@ -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']));
Expand Down
2 changes: 1 addition & 1 deletion Sources/Subs-Editor.php
Expand Up @@ -1708,7 +1708,7 @@ function spellCheckDone()
);

// 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']))
Expand Down
3 changes: 2 additions & 1 deletion Sources/Subs-Members.php
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions Sources/Subs-Package.php
Expand Up @@ -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]),
);
}
Expand Down
3 changes: 3 additions & 0 deletions Sources/Subs-Post.php
Expand Up @@ -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);
}

/**
Expand Down
27 changes: 27 additions & 0 deletions Sources/Subs.php
Expand Up @@ -202,6 +202,25 @@
*/

// 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;
Expand Down Expand Up @@ -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']))
{
Expand Down Expand Up @@ -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']))
Expand Down

0 comments on commit f430ae4

Please sign in to comment.