mirror of
https://github.com/moparisthebest/moparscape.org-smf
synced 2024-11-21 08:15:09 -05:00
Use max of modified_time or poster_time when determining if a post is editable
This commit is contained in:
parent
25cc5c42df
commit
3530a8b58b
@ -1139,7 +1139,7 @@ function prepareDisplayContext($reset = false)
|
||||
$message['subject'] = $message['subject'] != '' ? $message['subject'] : $txt['no_subject'];
|
||||
|
||||
// Are you allowed to remove at least a single reply?
|
||||
$context['can_remove_post'] |= allowedTo('delete_own') && (empty($modSettings['edit_disable_time']) || $message['modified_time'] + $modSettings['edit_disable_time'] * 60 >= time()) && $message['id_member'] == $user_info['id'];
|
||||
$context['can_remove_post'] |= allowedTo('delete_own') && (empty($modSettings['edit_disable_time']) || max($message['modified_time'], $message['poster_time']) + $modSettings['edit_disable_time'] * 60 >= time()) && $message['id_member'] == $user_info['id'];
|
||||
|
||||
// If it couldn't load, or the user was a guest.... someday may be done with a guest table.
|
||||
if (!loadMemberContext($message['id_member'], true))
|
||||
@ -1195,8 +1195,8 @@ function prepareDisplayContext($reset = false)
|
||||
'is_ignored' => !empty($modSettings['enable_buddylist']) && !empty($options['posts_apply_ignore_list']) && in_array($message['id_member'], $context['user']['ignoreusers']),
|
||||
'can_approve' => !$message['approved'] && $context['can_approve'],
|
||||
'can_unapprove' => $message['approved'] && $context['can_approve'],
|
||||
'can_modify' => (!$context['is_locked'] || allowedTo('moderate_board')) && (allowedTo('modify_any') || (allowedTo('modify_replies') && $context['user']['started']) || (allowedTo('modify_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || !$message['approved'] || $message['modified_time'] + $modSettings['edit_disable_time'] * 60 > time()))),
|
||||
'can_remove' => allowedTo('delete_any') || (allowedTo('delete_replies') && $context['user']['started']) || (allowedTo('delete_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || $message['modified_time'] + $modSettings['edit_disable_time'] * 60 > time())),
|
||||
'can_modify' => (!$context['is_locked'] || allowedTo('moderate_board')) && (allowedTo('modify_any') || (allowedTo('modify_replies') && $context['user']['started']) || (allowedTo('modify_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || !$message['approved'] || max($message['modified_time'], $message['poster_time']) + $modSettings['edit_disable_time'] * 60 > time()))),
|
||||
'can_remove' => allowedTo('delete_any') || (allowedTo('delete_replies') && $context['user']['started']) || (allowedTo('delete_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || max($message['modified_time'], $message['poster_time']) + $modSettings['edit_disable_time'] * 60 > time())),
|
||||
'can_see_ip' => allowedTo('moderate_forum') || ($message['id_member'] == $user_info['id'] && !empty($user_info['id'])),
|
||||
);
|
||||
|
||||
@ -1669,7 +1669,7 @@ function QuickInTopicModeration()
|
||||
|
||||
// Allowed to remove which messages?
|
||||
$request = $smcFunc['db_query']('', '
|
||||
SELECT id_msg, subject, id_member, poster_time, modified_time
|
||||
SELECT id_msg, subject, id_member, poster_time, GREATEST(poster_time, modified_time) AS last_modified_time
|
||||
FROM {db_prefix}messages
|
||||
WHERE id_msg IN ({array_int:message_list})
|
||||
AND id_topic = {int:current_topic}' . (!$allowed_all ? '
|
||||
@ -1684,7 +1684,7 @@ function QuickInTopicModeration()
|
||||
$messages = array();
|
||||
while ($row = $smcFunc['db_fetch_assoc']($request))
|
||||
{
|
||||
if (!$allowed_all && !empty($modSettings['edit_disable_time']) && $row['modified_time'] + $modSettings['edit_disable_time'] * 60 < time())
|
||||
if (!$allowed_all && !empty($modSettings['edit_disable_time']) && $row['last_modified_time'] + $modSettings['edit_disable_time'] * 60 < time())
|
||||
continue;
|
||||
|
||||
$messages[$row['id_msg']] = array($row['subject'], $row['id_member']);
|
||||
|
@ -646,7 +646,7 @@ function Post()
|
||||
if ($row['id_member'] == $user_info['id'] && !allowedTo('modify_any'))
|
||||
{
|
||||
// Give an extra five minutes over the disable time threshold, so they can type - assuming the post is public.
|
||||
if ($row['approved'] && !empty($modSettings['edit_disable_time']) && $row['modified_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
|
||||
if ($row['approved'] && !empty($modSettings['edit_disable_time']) && max($row['modified_time'], $row['poster_time']) + ($modSettings['edit_disable_time'] + 5) * 60 < time())
|
||||
fatal_lang_error('modify_post_time_passed', false);
|
||||
elseif ($row['id_member_poster'] == $user_info['id'] && !allowedTo('modify_own'))
|
||||
isAllowedTo('modify_replies');
|
||||
@ -749,7 +749,7 @@ function Post()
|
||||
if ($row['id_member'] == $user_info['id'] && !allowedTo('modify_any'))
|
||||
{
|
||||
// Give an extra five minutes over the disable time threshold, so they can type - assuming the post is public.
|
||||
if ($row['approved'] && !empty($modSettings['edit_disable_time']) && $row['modified_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
|
||||
if ($row['approved'] && !empty($modSettings['edit_disable_time']) && max($row['modified_time'], $row['poster_time']) + ($modSettings['edit_disable_time'] + 5) * 60 < time())
|
||||
fatal_lang_error('modify_post_time_passed', false);
|
||||
elseif ($row['id_member_poster'] == $user_info['id'] && !allowedTo('modify_own'))
|
||||
isAllowedTo('modify_replies');
|
||||
@ -1397,7 +1397,7 @@ function Post2()
|
||||
$_REQUEST['msg'] = (int) $_REQUEST['msg'];
|
||||
|
||||
$request = $smcFunc['db_query']('', '
|
||||
SELECT id_member, poster_name, poster_email, poster_time, modified_time, approved
|
||||
SELECT id_member, poster_name, poster_email, poster_time, GREATEST(poster_time, modified_time) AS last_modified_time, approved
|
||||
FROM {db_prefix}messages
|
||||
WHERE id_msg = {int:id_msg}
|
||||
LIMIT 1',
|
||||
@ -1442,7 +1442,7 @@ function Post2()
|
||||
|
||||
if ($row['id_member'] == $user_info['id'] && !allowedTo('modify_any'))
|
||||
{
|
||||
if ((!$modSettings['postmod_active'] || $row['approved']) && !empty($modSettings['edit_disable_time']) && $row['modified_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
|
||||
if ((!$modSettings['postmod_active'] || $row['approved']) && !empty($modSettings['edit_disable_time']) && $row['last_modified_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
|
||||
fatal_lang_error('modify_post_time_passed', false);
|
||||
elseif ($topic_info['id_member_started'] == $user_info['id'] && !allowedTo('modify_own'))
|
||||
isAllowedTo('modify_replies');
|
||||
@ -2688,7 +2688,7 @@ function JavaScriptModify()
|
||||
|
||||
if ($row['id_member'] == $user_info['id'] && !allowedTo('modify_any'))
|
||||
{
|
||||
if ((!$modSettings['postmod_active'] || $row['approved']) && !empty($modSettings['edit_disable_time']) && $row['modified_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
|
||||
if ((!$modSettings['postmod_active'] || $row['approved']) && !empty($modSettings['edit_disable_time']) && max($row['modified_time'], $row['poster_time']) + ($modSettings['edit_disable_time'] + 5) * 60 < time())
|
||||
fatal_lang_error('modify_post_time_passed', false);
|
||||
elseif ($row['id_member_started'] == $user_info['id'] && !allowedTo('modify_own'))
|
||||
isAllowedTo('modify_replies');
|
||||
|
@ -431,7 +431,7 @@ function showPosts($memID)
|
||||
SELECT
|
||||
b.id_board, b.name AS bname, c.id_cat, c.name AS cname, m.id_topic, m.id_msg,
|
||||
t.id_member_started, t.id_first_msg, t.id_last_msg, m.body, m.smileys_enabled,
|
||||
m.subject, m.poster_time, m.modified_time, m.approved
|
||||
m.subject, m.poster_time, GREATEST(m.poster_time, m.modified_time) AS last_modified_time, m.approved
|
||||
FROM {db_prefix}messages AS m
|
||||
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
|
||||
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
|
||||
@ -493,7 +493,7 @@ function showPosts($memID)
|
||||
'can_reply' => false,
|
||||
'can_mark_notify' => false,
|
||||
'can_delete' => false,
|
||||
'delete_possible' => ($row['id_first_msg'] != $row['id_msg'] || $row['id_last_msg'] == $row['id_msg']) && (empty($modSettings['edit_disable_time']) || $row['modified_time'] + $modSettings['edit_disable_time'] * 60 >= time()),
|
||||
'delete_possible' => ($row['id_first_msg'] != $row['id_msg'] || $row['id_last_msg'] == $row['id_msg']) && (empty($modSettings['edit_disable_time']) || $row['last_modified_time'] + $modSettings['edit_disable_time'] * 60 >= time()),
|
||||
'approved' => $row['approved'],
|
||||
);
|
||||
|
||||
|
@ -289,7 +289,7 @@ function RecentPosts()
|
||||
// Get all the most recent posts.
|
||||
$request = $smcFunc['db_query']('', '
|
||||
SELECT
|
||||
m.id_msg, m.subject, m.smileys_enabled, m.poster_time, m.modified_time, m.body, m.id_topic, t.id_board, b.id_cat,
|
||||
m.id_msg, m.subject, m.smileys_enabled, m.poster_time, GREATEST(m.poster_time, m.modified_time) AS last_modified_time, m.body, m.id_topic, t.id_board, b.id_cat,
|
||||
b.name AS bname, c.name AS cname, t.num_replies, m.id_member, m2.id_member AS id_first_member,
|
||||
IFNULL(mem2.real_name, m2.poster_name) AS first_poster_name, t.id_first_msg,
|
||||
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_last_msg
|
||||
@ -359,7 +359,7 @@ function RecentPosts()
|
||||
'can_reply' => false,
|
||||
'can_mark_notify' => false,
|
||||
'can_delete' => false,
|
||||
'delete_possible' => ($row['id_first_msg'] != $row['id_msg'] || $row['id_last_msg'] == $row['id_msg']) && (empty($modSettings['edit_disable_time']) || $row['modified_time'] + $modSettings['edit_disable_time'] * 60 >= time()),
|
||||
'delete_possible' => ($row['id_first_msg'] != $row['id_msg'] || $row['id_last_msg'] == $row['id_msg']) && (empty($modSettings['edit_disable_time']) || $row['last_modified_time'] + $modSettings['edit_disable_time'] * 60 >= time()),
|
||||
);
|
||||
|
||||
if ($user_info['id'] == $row['id_first_member'])
|
||||
|
@ -96,7 +96,7 @@ function DeleteMessage()
|
||||
$topic = (int) $_REQUEST['topic'];
|
||||
|
||||
$request = $smcFunc['db_query']('', '
|
||||
SELECT t.id_member_started, m.id_member, m.subject, m.poster_time, m.modified_time, m.approved
|
||||
SELECT t.id_member_started, m.id_member, m.subject, m.poster_time, GREATEST(m.poster_time, m.modified_time) AS last_modified_time, m.approved
|
||||
FROM {db_prefix}topics AS t
|
||||
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = {int:id_msg} AND m.id_topic = {int:current_topic})
|
||||
WHERE t.id_topic = {int:current_topic}
|
||||
@ -106,7 +106,7 @@ function DeleteMessage()
|
||||
'id_msg' => $_REQUEST['msg'],
|
||||
)
|
||||
);
|
||||
list ($starter, $poster, $subject, $post_time, $modified_time, $approved) = $smcFunc['db_fetch_row']($request);
|
||||
list ($starter, $poster, $subject, $post_time, $last_modified_time, $approved) = $smcFunc['db_fetch_row']($request);
|
||||
$smcFunc['db_free_result']($request);
|
||||
|
||||
// Verify they can see this!
|
||||
@ -122,7 +122,7 @@ function DeleteMessage()
|
||||
elseif (!allowedTo('delete_any'))
|
||||
isAllowedTo('delete_own');
|
||||
}
|
||||
elseif (!allowedTo('delete_any') && ($starter != $user_info['id'] || !allowedTo('delete_replies')) && !empty($modSettings['edit_disable_time']) && $modified_time + $modSettings['edit_disable_time'] * 60 < time())
|
||||
elseif (!allowedTo('delete_any') && ($starter != $user_info['id'] || !allowedTo('delete_replies')) && !empty($modSettings['edit_disable_time']) && $last_modified_time + $modSettings['edit_disable_time'] * 60 < time())
|
||||
fatal_lang_error('modify_post_time_passed', false);
|
||||
}
|
||||
elseif ($starter == $user_info['id'] && !allowedTo('delete_any'))
|
||||
@ -554,7 +554,7 @@ function removeMessage($message, $decreasePostCount = true)
|
||||
|
||||
$request = $smcFunc['db_query']('', '
|
||||
SELECT
|
||||
m.id_member, m.icon, m.poster_time, m.modified_time, m.subject,' . (empty($modSettings['search_custom_index_config']) ? '' : ' m.body,') . '
|
||||
m.id_member, m.icon, m.poster_time, GREATEST(m.poster_time, m.modified_time) AS last_modified_time, m.subject,' . (empty($modSettings['search_custom_index_config']) ? '' : ' m.body,') . '
|
||||
m.approved, t.id_topic, t.id_first_msg, t.id_last_msg, t.num_replies, t.id_board,
|
||||
t.id_member_started AS id_member_poster,
|
||||
b.count_posts
|
||||
@ -595,7 +595,7 @@ function removeMessage($message, $decreasePostCount = true)
|
||||
else
|
||||
fatal_lang_error('cannot_delete_own', 'permission');
|
||||
}
|
||||
elseif (($row['id_member_poster'] != $user_info['id'] || !$delete_replies) && !empty($modSettings['edit_disable_time']) && $row['modified_time'] + $modSettings['edit_disable_time'] * 60 < time())
|
||||
elseif (($row['id_member_poster'] != $user_info['id'] || !$delete_replies) && !empty($modSettings['edit_disable_time']) && $row['last_modified_time'] + $modSettings['edit_disable_time'] * 60 < time())
|
||||
fatal_lang_error('modify_post_time_passed', false);
|
||||
}
|
||||
elseif ($row['id_member_poster'] == $user_info['id'])
|
||||
@ -627,7 +627,7 @@ function removeMessage($message, $decreasePostCount = true)
|
||||
elseif (!allowedTo('delete_any'))
|
||||
isAllowedTo('delete_own');
|
||||
}
|
||||
elseif (!allowedTo('delete_any') && ($row['id_member_poster'] != $user_info['id'] || !allowedTo('delete_replies')) && !empty($modSettings['edit_disable_time']) && $row['modified_time'] + $modSettings['edit_disable_time'] * 60 < time())
|
||||
elseif (!allowedTo('delete_any') && ($row['id_member_poster'] != $user_info['id'] || !allowedTo('delete_replies')) && !empty($modSettings['edit_disable_time']) && $row['last_modified_time'] + $modSettings['edit_disable_time'] * 60 < time())
|
||||
fatal_lang_error('modify_post_time_passed', false);
|
||||
}
|
||||
elseif ($row['id_member_poster'] == $user_info['id'] && !allowedTo('delete_any'))
|
||||
|
Loading…
Reference in New Issue
Block a user