// Can we edit this post ... if we're a moderator with rights then always yes // else it depends on editing times, lock status and if we're the correct user if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id)) { if ($user->data['user_id'] != $post_data['poster_id']) { trigger_error('USER_CANNOT_EDIT'); } if (!($post_data['post_time'] > time() - $config['edit_time'] * 60 || !$config['edit_time'])) { trigger_error('CANNOT_EDIT_TIME'); } if ($post_data['post_edit_locked']) { trigger_error('CANNOT_EDIT_POST_LOCKED'); } } // Handle delete mode... if ($mode == 'delete') { handle_post_delete($forum_id, $topic_id, $post_id, $post_data); return; } // Handle bump mode... if ($mode == 'bump') { if ($bump_time = bump_topic_allowed($forum_id, $post_data['topic_bumped'], $post_data['topic_last_post_time'], $post_data['topic_poster'], $post_data['topic_last_poster_id']) && check_link_hash(request_var('hash', ''), "topic_{$post_data['topic_id']}")) { $meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time); meta_refresh(3, $meta_url); $message = $user->lang['TOPIC_BUMPED'] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="' . $meta_url . '">', '</a>'); $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id) . '">', '</a>'); trigger_error($message); } trigger_error('BUMP_ERROR'); } // Subject length limiting to 60 characters if first post... if ($mode == 'post' || $mode == 'edit' && $post_data['topic_first_post_id'] == $post_data['post_id']) {
$sql = "SELECT COUNT(*) AS tp_count FROM " . POSTS_TABLE . " p WHERE p.poster_id = '" . $ban_userid . "'"; $result = $db->sql_query($sql); $countRow = $db->sql_fetchrow($result); $db->sql_freeresult($result); if ($countRow['tp_count'] > 50) { trigger_error('USER_POSTS_NUM GERATER THAN 50'); } else { $sql = "SELECT post_id,topic_id,forum_id FROM " . POSTS_TABLE . " p WHERE p.poster_id = '" . $ban_userid . "'"; $result1 = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result1)) { $sql = 'SELECT f.*, t.*, p.*, u.username, u.username_clean, u.user_sig, u.user_sig_bbcode_uid, u.user_sig_bbcode_bitfield FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . " u\r\r\n\t\t\t\tWHERE p.post_id = '" . $row['post_id'] . "'\r\r\n\t\t\t\t\tAND t.topic_id = p.topic_id\r\r\n\t\t\t\t\tAND u.user_id = p.poster_id\r\r\n\t\t\t\t\tAND (f.forum_id = t.forum_id\r\r\n\t\t\t\t\t\tOR f.forum_id = '" . $row['forum_id'] . "')" . ($auth->acl_get('m_approve', $row['forum_id']) ? '' : 'AND p.post_approved = 1'); $result2 = $db->sql_query($sql); $post_data = $db->sql_fetchrow($result2); $db->sql_freeresult($result2); handle_post_delete($row['forum_id'], $row['topic_id'], $row['post_id'], $post_data); } unset($row); $db->sql_freeresult($result1); } } // If the user doesn't have any moderator powers (globally or locally) he can't access the mcp if (!$auth->acl_getf_global('m_')) { // Except he is using one of the quickmod tools for users $user_quickmod_actions = array('lock' => 'f_user_lock', 'make_sticky' => 'f_sticky', 'make_announce' => 'f_announce', 'make_global' => 'f_announce', 'make_normal' => array('f_announce', 'f_sticky')); $allow_user = false; if ($quickmod && isset($user_quickmod_actions[$action]) && $user->data['is_registered'] && $auth->acl_gets($user_quickmod_actions[$action], $forum_id)) { $topic_info = get_topic_data(array($topic_id)); if ($topic_info[$topic_id]['topic_poster'] == $user->data['user_id']) { $allow_user = true; }