本文整理汇总了PHP中remove_search_post函数的典型用法代码示例。如果您正苦于以下问题:PHP remove_search_post函数的具体用法?PHP remove_search_post怎么用?PHP remove_search_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove_search_post函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prune
function prune($forum_id, $prune_date, $prune_all = false)
{
global $db, $lang;
$prune_all = $prune_all ? '' : 'AND t.topic_vote = 0 AND t.topic_type <> ' . POST_ANNOUNCE;
//
// Those without polls and announcements ... unless told otherwise!
//
$sql = "SELECT t.topic_id \n\t\tFROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t\n\t\tWHERE t.forum_id = {$forum_id}\n\t\t\t{$prune_all} \n\t\t\tAND ( p.post_id = t.topic_last_post_id \n\t\t\t\tOR t.topic_last_post_id = 0 )";
if ($prune_date != '') {
$sql .= " AND p.post_time < {$prune_date}";
}
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain lists of topics to prune', '', __LINE__, __FILE__, $sql);
}
$sql_topics = '';
while ($row = $db->sql_fetchrow($result)) {
$sql_topics .= ($sql_topics != '' ? ', ' : '') . $row['topic_id'];
}
$db->sql_freeresult($result);
if ($sql_topics != '') {
$sql = "SELECT post_id\n\t\t\tFROM " . POSTS_TABLE . " \n\t\t\tWHERE forum_id = {$forum_id} \n\t\t\t\tAND topic_id IN ({$sql_topics})";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain list of posts to prune', '', __LINE__, __FILE__, $sql);
}
$sql_post = '';
while ($row = $db->sql_fetchrow($result)) {
$sql_post .= ($sql_post != '' ? ', ' : '') . $row['post_id'];
}
$db->sql_freeresult($result);
if ($sql_post != '') {
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " \n\t\t\t\tWHERE topic_id IN ({$sql_topics})";
if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
message_die(GENERAL_ERROR, 'Could not delete watched topics during prune', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . TOPICS_TABLE . " \n\t\t\t\tWHERE topic_id IN ({$sql_topics})";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete topics during prune', '', __LINE__, __FILE__, $sql);
}
$pruned_topics = $db->sql_affectedrows();
$sql = "DELETE FROM " . POSTS_TABLE . " \n\t\t\t\tWHERE post_id IN ({$sql_post})";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete post_text during prune', '', __LINE__, __FILE__, $sql);
}
$pruned_posts = $db->sql_affectedrows();
$sql = "DELETE FROM " . POSTS_TEXT_TABLE . " \n\t\t\t\tWHERE post_id IN ({$sql_post})";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete post during prune', '', __LINE__, __FILE__, $sql);
}
remove_search_post($sql_post);
prune_attachments($sql_post);
return array('topics' => $pruned_topics, 'posts' => $pruned_posts);
}
}
return array('topics' => 0, 'posts' => 0);
}
示例2: prune
function prune($forum_id, $prune_date, $prune_all = false)
{
global $db, $lang;
$prune_all = $prune_all ? '' : 'AND t.topic_vote = 0 AND t.topic_type <> ' . POST_ANNOUNCE;
//
// Those without polls and announcements ... unless told otherwise!
//
$sql = "SELECT t.topic_id FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t\n\t\tWHERE t.forum_id = {$forum_id}\n\t\t\t{$prune_all}\n\t\t\tAND ( p.post_id = t.topic_last_post_id OR t.topic_last_post_id = 0 )";
if ($prune_date != '') {
$sql .= " AND p.post_time < {$prune_date}";
}
$result = $db->sql_query($sql);
$sql_topics = '';
while ($row = $db->sql_fetchrow($result)) {
$sql_topics .= ($sql_topics != '' ? ', ' : '') . $row['topic_id'];
}
$db->sql_freeresult($result);
if ($sql_topics != '') {
$sql = "SELECT post_id FROM " . POSTS_TABLE . "\n\t\t\tWHERE forum_id = {$forum_id} AND topic_id IN ({$sql_topics})";
$result = $db->sql_query($sql);
$sql_post = '';
while ($row = $db->sql_fetchrow($result)) {
$sql_post .= ($sql_post != '' ? ', ' : '') . $row['post_id'];
}
$db->sql_freeresult($result);
if ($sql_post != '') {
$db->sql_query("DELETE FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id IN ({$sql_topics})");
$db->sql_query("DELETE FROM " . TOPICS_TABLE . " WHERE topic_id IN ({$sql_topics})");
$pruned_topics = $db->sql_affectedrows();
$db->sql_query("DELETE FROM " . POSTS_TABLE . " WHERE post_id IN ({$sql_post})");
$pruned_posts = $db->sql_affectedrows();
$db->sql_query("DELETE FROM " . POSTS_TEXT_TABLE . " WHERE post_id IN ({$sql_post})");
remove_search_post($sql_post);
// if (defined('BBAttach_mod')) {
delete_attachment($sql_post);
return array('topics' => $pruned_topics, 'posts' => $pruned_posts);
}
}
return array('topics' => 0, 'posts' => 0);
}
示例3: delete_post
function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id)
{
global $board_config, $lang, $db, $phpbb_root_path, $phpEx;
global $userdata, $user_ip;
if ($mode != 'poll_delete') {
include $phpbb_root_path . 'includes/functions_search.' . $phpEx;
$sql = "DELETE FROM " . POSTS_TABLE . " \r\n\t\t\tWHERE post_id = {$post_id}";
if (!$db->sql_query($sql)) {
$db->clear_cache('posts_');
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . POSTS_TEXT_TABLE . " \r\n\t\t\tWHERE post_id = {$post_id}";
if (!$db->sql_query($sql)) {
$db->clear_cache('posts_');
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
if ($post_data['last_post']) {
if ($post_data['first_post']) {
$forum_update_sql .= ', forum_topics = forum_topics - 1';
$sql = "DELETE FROM " . TOPICS_TABLE . " \r\n\t\t\t\t\tWHERE topic_id = {$topic_id} \r\n\t\t\t\t\t\tOR topic_moved_id = {$topic_id}";
if (!$db->sql_query($sql)) {
$db->clear_cache('posts_');
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\t\tWHERE topic_id = {$topic_id}";
if (!$db->sql_query($sql)) {
$db->clear_cache('posts_');
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
}
}
remove_search_post($post_id);
}
if ($mode == 'poll_delete' || $mode == 'delete' && $post_data['first_post'] && $post_data['last_post'] && $post_data['has_poll'] && $post_data['edit_poll']) {
$sql = "DELETE FROM " . VOTE_DESC_TABLE . " \r\n\t\t\tWHERE topic_id = {$topic_id}";
if (!$db->sql_query($sql)) {
$db->clear_cache('posts_');
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . " \r\n\t\t\tWHERE vote_id = {$poll_id}";
if (!$db->sql_query($sql)) {
$db->clear_cache('posts_');
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . VOTE_USERS_TABLE . " \r\n\t\t\tWHERE vote_id = {$poll_id}";
if (!$db->sql_query($sql)) {
$db->clear_cache('posts_');
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
}
}
if ($mode == 'delete' && $post_data['first_post'] && $post_data['last_post']) {
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.{$phpEx}?" . POST_FORUM_URL . '=' . $forum_id) . '">';
$message = $lang['Deleted'];
} else {
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . '=' . $topic_id) . '">';
$message = ($mode == 'poll_delete' ? $lang['Poll_delete'] : $lang['Deleted']) . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}") . '">', '</a>');
}
if ($board_config['points_post'] && !$post_info['points_disabled'] && ($mode == 'delete' || $mode == 'poll_delete')) {
if ($userdata['user_id'] == $post_data['first_post'] && ($userdata['user_id'] != ANONYMOUS && $userdata['admin_allow_points'])) {
subtract_points($userdata['user_id'], $board_config['points_topic']);
} else {
if ($userdata['user_id'] != ANONYMOUS && $userdata['admin_allow_points']) {
subtract_points($userdata['user_id'], $board_config['points_reply']);
}
}
}
$message .= '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}") . '">', '</a>');
$db->clear_cache('posts_');
$db->clear_cache('topics_recent_');
return;
}
示例4: delete_post
function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id)
{
global $board_config, $lang, $db, $phpbb_root_path, $phpEx;
global $userdata, $user_ip;
if ($mode != 'poll_delete') {
include "includes/functions_search.php";
$sql = "DELETE FROM " . POSTS_TABLE . "\r\n WHERE post_id = '{$post_id}'";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . POSTS_TEXT_TABLE . "\r\n WHERE post_id = '{$post_id}'";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
if ($post_data['last_post']) {
if ($post_data['first_post']) {
$forum_update_sql .= ', forum_topics = forum_topics - 1';
$sql = "DELETE FROM " . TOPICS_TABLE . "\r\n WHERE topic_id = '{$topic_id}'\r\n OR topic_moved_id = '{$topic_id}'";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "\r\n WHERE topic_id = '{$topic_id}'";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
}
}
remove_search_post($post_id);
}
if ($mode == 'poll_delete' || $mode == 'delete' && $post_data['first_post'] && $post_data['last_post'] && $post_data['has_poll'] && $post_data['edit_poll']) {
$sql = "DELETE FROM " . VOTE_DESC_TABLE . "\r\n WHERE topic_id = '{$topic_id}'";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "\r\n WHERE vote_id = '{$poll_id}'";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . VOTE_USERS_TABLE . "\r\n WHERE vote_id = '{$poll_id}'";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
}
}
if ($mode == 'delete' && $post_data['first_post'] && $post_data['last_post']) {
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.{$phpEx}?" . POST_FORUM_URL . '=' . $forum_id) . '">';
$message = $lang['Deleted'];
} else {
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . '=' . $topic_id) . '">';
$message = ($mode == 'poll_delete' ? $lang['Poll_delete'] : $lang['Deleted']) . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}") . '">', '</a>');
}
$message .= '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}") . '">', '</a>');
return;
}
示例5: IN
// Got all required info so go ahead and start deleting everything
//
$sql = "DELETE \n\t\t\t\tFROM " . TOPICS_TABLE . " \n\t\t\t\tWHERE topic_id IN ({$topic_id_sql}) \n\t\t\t\t\tOR topic_moved_id IN ({$topic_id_sql})";
if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
message_die(GENERAL_ERROR, 'Could not delete topics', '', __LINE__, __FILE__, $sql);
}
if ($post_id_sql != '') {
$sql = "DELETE \n\t\t\t\t\tFROM " . POSTS_TABLE . " \n\t\t\t\t\tWHERE post_id IN ({$post_id_sql})";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete posts', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE \n\t\t\t\t\tFROM " . POSTS_TEXT_TABLE . " \n\t\t\t\t\tWHERE post_id IN ({$post_id_sql})";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete posts text', '', __LINE__, __FILE__, $sql);
}
remove_search_post($post_id_sql);
}
if ($vote_id_sql != '') {
$sql = "DELETE \n\t\t\t\t\tFROM " . VOTE_DESC_TABLE . " \n\t\t\t\t\tWHERE vote_id IN ({$vote_id_sql})";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete vote descriptions', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE \n\t\t\t\t\tFROM " . VOTE_RESULTS_TABLE . " \n\t\t\t\t\tWHERE vote_id IN ({$vote_id_sql})";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete vote results', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE \n\t\t\t\t\tFROM " . VOTE_USERS_TABLE . " \n\t\t\t\t\tWHERE vote_id IN ({$vote_id_sql})";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete vote users', '', __LINE__, __FILE__, $sql);
}
}
示例6: phpbb_edit_post
function phpbb_edit_post($post_id = null, $subject = null, $message = null)
{
global $CFG, $userdata, $phpbb_root_path, $phpEx;
include_once $phpbb_root_path . 'includes/functions_post.' . $phpEx;
include_once $phpbb_root_path . 'includes/functions_search.' . $phpEx;
if (empty($subject)) {
phpbb_raise_error('Subject must not be empty.');
}
if (empty($message)) {
phpbb_raise_error('Message must not be empty.');
}
if (empty($post_id)) {
phpbb_raise_error('Post does not exists.');
}
$sql = 'SELECT *
FROM ' . POSTS_TABLE . '
WHERE post_id = ' . $post_id;
$result = phpbb_fetch_row($sql);
if ($result) {
$topic_id = $result['topic_id'];
} else {
phpbb_raise_error('Post does not exists.', __FILE__, __LINE__, $sql);
}
$sql = 'SELECT *
FROM ' . TOPICS_TABLE . '
WHERE topic_id = ' . $topic_id;
$topic_info = phpbb_fetch_row($sql);
remove_search_post($post_id);
if ($post_id == $topic_info['topic_first_post_id']) {
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_title = \'' . str_replace("\\'", "''", $subject) . '\'
WHERE topic_id = ' . $topic_id;
phpbb_query($sql);
}
$sql = 'UPDATE ' . POSTS_TEXT_TABLE . '
SET post_text = \'' . str_replace("\\'", "''", $message) . '\',
post_subject = \'' . str_replace("\\'", "''", $subject) . '\'
WHERE post_id = ' . $post_id;
phpbb_query($sql);
add_search_words('single', $post_id, stripslashes($message), stripslashes($subject));
}
示例7: post_delete
function post_delete($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id)
{
global $db, $cache, $config, $lang, $user;
$poll_deleted = false;
$bin_mode = false;
$bin_forum_id = intval($config['bin_forum']);
if ($mode == 'delete' && !empty($bin_forum_id) && $bin_forum_id != $forum_id) {
$bin_mode = true;
}
if ($mode != 'poll_delete') {
// MG Cash MOD For IP - BEGIN
if (!empty($config['plugins']['cash']['enabled'])) {
$GLOBALS['cm_posting']->update_delete($mode, $post_data, $forum_id, $topic_id, $post_id);
}
// MG Cash MOD For IP - END
if ($post_data['first_post'] && $post_data['last_post']) {
if (!empty($bin_mode)) {
$this->topic_recycle(array($topic_id), $forum_id);
} else {
$this->topic_delete($topic_id, $forum_id);
$poll_deleted = true;
}
} else {
if (!empty($bin_mode)) {
$new_topic_id = $this->post_recycle($post_id, $forum_id, $topic_id, $post_data['topic_title'], false);
} else {
$sql = "DELETE FROM " . POSTS_TABLE . " WHERE post_id = {$post_id}";
$db->sql_query($sql);
// Event Registration - BEGIN
if ($post_data['first_post']) {
$sql = "DELETE FROM " . REGISTRATION_TABLE . " WHERE topic_id = {$topic_id}";
$db->sql_query($sql);
$sql = "DELETE FROM " . REGISTRATION_DESC_TABLE . " WHERE topic_id = {$topic_id}";
$db->sql_query($sql);
}
// Event Registration - END
// UPI2DB - BEGIN
$sql = "DELETE FROM " . UPI2DB_LAST_POSTS_TABLE . " WHERE post_id = {$post_id}";
$db->sql_query($sql);
$sql = "DELETE FROM " . UPI2DB_UNREAD_POSTS_TABLE . " WHERE post_id = {$post_id}";
$db->sql_query($sql);
// UPI2DB - END
$sql = "DELETE FROM " . POSTS_LIKES_TABLE . " WHERE post_id = {$post_id}";
$db->sql_query($sql);
if (!function_exists('remove_search_post')) {
include IP_ROOT_PATH . 'includes/functions_search.' . PHP_EXT;
}
remove_search_post($post_id);
}
}
}
if ($post_data['has_poll'] && $post_data['edit_poll'] && ($mode == 'poll_delete' || $mode == 'delete' && $post_data['first_post'] && $post_data['last_post'])) {
if (empty($bin_mode) && empty($poll_deleted)) {
$this->topic_poll_delete($topic_id);
}
}
if ($mode == 'delete' && $post_data['first_post'] && $post_data['last_post']) {
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid(CMS_PAGE_VIEWFORUM . '?' . POST_FORUM_URL . '=' . $forum_id) . '">';
$message = $lang['Deleted'];
} else {
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $topic_id) . '">';
$message = ($mode == 'poll_delete' ? $lang['Poll_delete'] : $lang['Deleted']) . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $topic_id) . '">', '</a>');
}
$message .= '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid(CMS_PAGE_VIEWFORUM . '?' . POST_FORUM_URL . '=' . $forum_id) . '">', '</a>');
if (!empty($forum_id)) {
$this->sync('forum', $forum_id);
}
// LIKES - BEGIN
@(include_once IP_ROOT_PATH . 'includes/class_topics.' . PHP_EXT);
$class_topics = new class_topics();
$class_topics->topics_posts_likes_resync();
// LIKES - END
$this->sync_cache(0, 0);
board_stats();
cache_tree(true);
return true;
}
示例8: delete_post
function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id)
{
global $ft_cfg, $lang;
global $userdata, $user_ip;
if ($mode != 'poll_delete') {
require FT_ROOT . 'includes/functions_search.php';
$sql = "DELETE FROM " . POSTS_TABLE . "\n\t\t\tWHERE post_id = {$post_id}";
if (!DB()->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . POSTS_TEXT_TABLE . "\n\t\t\tWHERE post_id = {$post_id}";
if (!DB()->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
if ($post_data['last_post']) {
if ($post_data['first_post']) {
$forum_update_sql .= ', forum_topics = forum_topics - 1';
$sql = "DELETE FROM " . TOPICS_TABLE . "\n\t\t\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\t\t\tOR topic_moved_id = {$topic_id}";
if (!DB()->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "\n\t\t\t\t\tWHERE topic_id = {$topic_id}";
if (!DB()->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
//bt
$sql = 'DELETE FROM ' . BT_USR_DL_STAT_TABLE . "\n\t\t\t\t\tWHERE topic_id = {$topic_id}";
if (!DB()->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
//bt end
}
}
remove_search_post($post_id);
}
if ($mode == 'poll_delete' || $mode == 'delete' && $post_data['first_post'] && $post_data['last_post'] && $post_data['has_poll'] && $post_data['edit_poll']) {
$sql = "DELETE FROM " . VOTE_DESC_TABLE . "\n\t\t\tWHERE topic_id = {$topic_id}";
if (!DB()->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "\n\t\t\tWHERE vote_id = {$poll_id}";
if (!DB()->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . VOTE_USERS_TABLE . "\n\t\t\tWHERE vote_id = {$poll_id}";
if (!DB()->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
}
}
if ($mode == 'delete' && $post_data['first_post'] && $post_data['last_post']) {
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.php?" . POST_FORUM_URL . '=' . $forum_id) . '">';
$message = $lang['Deleted'];
} else {
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.php?" . POST_TOPIC_URL . '=' . $topic_id) . '">';
$message = ($mode == 'poll_delete' ? $lang['Poll_delete'] : $lang['Deleted']) . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.php?" . POST_TOPIC_URL . "={$topic_id}") . '">', '</a>');
}
$message .= '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.php?" . POST_FORUM_URL . "={$forum_id}") . '">', '</a>');
return;
}
示例9: prune
function prune($forum_id, $prune_date, $prune_all = false)
{
global $db, $lang, $class_mcp;
if (!class_exists('class_mcp')) {
include IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT;
}
if (empty($class_mcp)) {
$class_mcp = new class_mcp();
}
// Before pruning, lets try to clean up the invalid topic entries
$sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
WHERE topic_last_post_id = 0';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$class_mcp->sync('topic', $row['topic_id']);
}
$db->sql_freeresult($result);
$prune_all = $prune_all ? '' : 'AND t.poll_start = 0 AND t.topic_type <> ' . POST_ANNOUNCE;
// Those without polls and announcements... unless told otherwise!
$sql = "SELECT t.topic_id\n\t\tFROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t\n\t\tWHERE t.forum_id = {$forum_id}\n\t\t\t{$prune_all}\n\t\t\tAND p.post_id = t.topic_last_post_id";
if ($prune_date != '') {
$sql .= " AND p.post_time < {$prune_date}";
}
$result = $db->sql_query($sql);
$sql_topics = '';
while ($row = $db->sql_fetchrow($result)) {
$sql_topics .= ($sql_topics != '' ? ', ' : '') . $row['topic_id'];
}
$db->sql_freeresult($result);
if ($sql_topics != '') {
$sql = "SELECT post_id\n\t\t\tFROM " . POSTS_TABLE . "\n\t\t\tWHERE forum_id = {$forum_id}\n\t\t\t\tAND topic_id IN ({$sql_topics})";
$result = $db->sql_query($sql);
$sql_post = '';
while ($row = $db->sql_fetchrow($result)) {
$sql_post .= ($sql_post != '' ? ', ' : '') . $row['post_id'];
}
$db->sql_freeresult($result);
if ($sql_post != '') {
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id IN ({$sql_topics})";
$db->sql_transaction('begin');
$db->sql_query($sql);
$sql = "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id IN ({$sql_topics})";
$db->sql_query($sql);
$pruned_topics = $db->sql_affectedrows();
// Event Registration - BEGIN
$sql = "DELETE FROM " . REGISTRATION_TABLE . " WHERE topic_id IN ({$sql_topics})";
$db->sql_query($sql);
// Event Registration - END
$sql = "DELETE FROM " . BOOKMARK_TABLE . " WHERE topic_id IN ({$sql_topics})";
$db->sql_query($sql);
$sql = "DELETE FROM " . POSTS_TABLE . " WHERE post_id IN ({$sql_post})";
$db->sql_query($sql);
$pruned_posts = $db->sql_affectedrows();
$db->sql_transaction('commit');
remove_search_post($sql_post);
// UPI2DB - BEGIN
prune_upi2db($sql_post);
// UPI2DB - END
prune_attachments($sql_post);
return array('topics' => $pruned_topics, 'posts' => $pruned_posts);
}
}
return array('topics' => 0, 'posts' => 0);
}
示例10: prune
function prune($forum_id, $prune_date, $prune_all = false)
{
global $db, $lang;
// Before pruning, lets try to clean up the invalid topic entries
$sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
WHERE topic_last_post_id = 0';
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain lists of topics to sync', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result)) {
sync('topic', $row['topic_id']);
}
$db->sql_freeresult($result);
$prune_all = $prune_all ? '' : 'AND t.topic_vote = 0 AND t.topic_type <> ' . POST_ANNOUNCE;
//
// Those without polls and announcements ... unless told otherwise!
//
$sql = "SELECT t.topic_id \n\t\tFROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t\n\t\tWHERE t.forum_id = {$forum_id}\n\t\t\t{$prune_all} \n\t\t\tAND p.post_id = t.topic_last_post_id";
if ($prune_date != '') {
$sql .= " AND p.post_time < {$prune_date}";
}
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain lists of topics to prune', '', __LINE__, __FILE__, $sql);
}
$sql_topics = '';
while ($row = $db->sql_fetchrow($result)) {
$sql_topics .= ($sql_topics != '' ? ', ' : '') . $row['topic_id'];
}
$db->sql_freeresult($result);
if ($sql_topics != '') {
$sql = "SELECT post_id\n\t\t\tFROM " . POSTS_TABLE . " \n\t\t\tWHERE forum_id = {$forum_id} \n\t\t\t\tAND topic_id IN ({$sql_topics})";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain list of posts to prune', '', __LINE__, __FILE__, $sql);
}
$sql_post = '';
while ($row = $db->sql_fetchrow($result)) {
$sql_post .= ($sql_post != '' ? ', ' : '') . $row['post_id'];
}
$db->sql_freeresult($result);
if ($sql_post != '') {
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " \n\t\t\t\tWHERE topic_id IN ({$sql_topics})";
if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
message_die(GENERAL_ERROR, 'Could not delete watched topics during prune', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . TOPICS_TABLE . " \n\t\t\t\tWHERE topic_id IN ({$sql_topics})";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete topics during prune', '', __LINE__, __FILE__, $sql);
}
$pruned_topics = $db->sql_affectedrows();
$sql = "DELETE FROM " . POSTS_TABLE . " \n\t\t\t\tWHERE post_id IN ({$sql_post})";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete post_text during prune', '', __LINE__, __FILE__, $sql);
}
$pruned_posts = $db->sql_affectedrows();
$sql = "DELETE FROM " . POSTS_TEXT_TABLE . " \n\t\t\t\tWHERE post_id IN ({$sql_post})";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete post during prune', '', __LINE__, __FILE__, $sql);
}
remove_search_post($sql_post);
/* -- mod : File Attachment Mod v2 Version 2.4.3 ---------------------------------------------------- */
if (!intval($attach_config['disable_mod'])) {
prune_attachments($sql_post);
}
/* -- fin : File Attachment Mod v2 Version 2.4.3 ---------------------------------------------------- */
return array('topics' => $pruned_topics, 'posts' => $pruned_posts);
}
}
return array('topics' => 0, 'posts' => 0);
}
示例11: submit_post
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$topic_type, &$bbcode_on, &$html_on, &$acro_auto_on, &$smilies_on, &$attach_sig, $post_username, $post_subject, $topic_title_clean, $topic_tags, $post_message, $poll_title, &$poll_options, &$poll_data, &$reg_active, &$reg_reset, &$reg_max_option1, &$reg_max_option2, &$reg_max_option3, &$reg_length, &$news_category, &$topic_show_portal, &$mark_edit, &$topic_desc, $topic_calendar_time = 0, $topic_calendar_duration = 0)
{
global $db, $cache, $config, $user, $lang;
// CrackerTracker v5.x
if (($mode == 'newtopic' || $mode == 'reply') && ($config['ctracker_spammer_blockmode'] > 0 || $config['ctracker_spam_attack_boost'] == 1) && $user->data['user_level'] != ANONYMOUS) {
include_once IP_ROOT_PATH . 'includes/ctracker/classes/class_ct_userfunctions.' . PHP_EXT;
$login_functions = new ct_userfunctions();
$login_functions->handle_postings();
unset($login_functions);
}
// CrackerTracker v5.x
// BEGIN cmx_slash_news_mod
if (isset($news_category) && is_numeric($news_category)) {
$news_id = intval($news_category);
//$topic_type = POST_NEWS;
} else {
$news_id = 0;
}
// END cmx_slash_news_mod
include IP_ROOT_PATH . 'includes/functions_search.' . PHP_EXT;
$current_time = time();
if ($user->data['user_level'] != ADMIN && (!empty($config['force_large_caps_mods']) || $user->data['user_level'] != MOD)) {
//$post_subject = strtolower($post_subject);
$post_subject = ucwords($post_subject);
}
// Flood control
if ($user->data['user_level'] != ADMIN && $user->data['user_level'] != MOD) {
if (!function_exists('check_flood_posting')) {
include_once IP_ROOT_PATH . 'includes/functions_flood.' . PHP_EXT;
}
check_flood_posting(false);
}
if ($mode == 'editpost') {
remove_search_post($post_id);
}
if ($mode == 'newtopic' || $mode == 'editpost' && $post_data['first_post']) {
$topic_vote = !empty($poll_title) && sizeof($poll_options) >= 2 ? 1 : 0;
$topic_show_portal = $topic_show_portal == true ? 1 : 0;
$topic_calendar_duration = $topic_calendar_duration == '' ? 0 : $topic_calendar_duration;
// Event Registration - BEGIN
$topic_reg = 0;
if ($reg_active == 1) {
$topic_reg = 1;
}
// Event Registration - END
$sql = $mode != 'editpost' ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_desc, topic_tags, topic_poster, topic_time, forum_id, news_id, topic_status, topic_type, topic_calendar_time, topic_calendar_duration, topic_reg, topic_show_portal) VALUES ('" . $db->sql_escape($post_subject) . "', '" . $db->sql_escape($topic_desc) . "', " . $db->sql_validate_value($topic_tags) . ", " . $user->data['user_id'] . ", {$current_time}, {$forum_id}, {$news_id}, " . TOPIC_UNLOCKED . ", {$topic_type}, {$topic_calendar_time}, {$topic_calendar_duration}, {$topic_reg}, {$topic_show_portal})" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '" . $db->sql_escape($post_subject) . "', news_id = {$news_id}, topic_desc = '" . $db->sql_escape($topic_desc) . "', topic_tags = " . $db->sql_validate_value($topic_tags) . ", topic_type = {$topic_type}, topic_calendar_time = {$topic_calendar_time}, topic_calendar_duration = {$topic_calendar_duration}, topic_reg = {$topic_reg}" . ", topic_show_portal = {$topic_show_portal}\n\t\tWHERE topic_id = {$topic_id}";
$db->sql_query($sql);
if ($mode == 'newtopic') {
$topic_id = $db->sql_nextid();
} else {
// Event Registration - BEGIN
if ($reg_reset) {
$sql = "DELETE FROM " . REGISTRATION_TABLE . " WHERE topic_id = " . $topic_id;
$db->sql_query($sql);
}
// Event Registration - END
}
if (!function_exists('create_clean_topic_title')) {
@(include_once IP_ROOT_PATH . 'includes/functions_topics.' . PHP_EXT);
}
create_clean_topic_title($topic_id, $forum_id, $topic_title_clean, '');
@(include_once IP_ROOT_PATH . 'includes/class_topics_tags.' . PHP_EXT);
$class_topics_tags = new class_topics_tags();
$topic_tags_array = $class_topics_tags->create_tags_array($topic_tags);
$update_tags = $mode == 'editpost' ? true : false;
$class_topics_tags->submit_tags($topic_id, $forum_id, $topic_tags_array, $update_tags);
unset($class_topics_tags);
// Empty the similar id cache for guests every time we create a new topic or edit the first post in a topic
if ($config['similar_topics']) {
$clear_result = clear_similar_topics();
}
}
// Poll management - BEGIN
if (($mode == 'newtopic' || $mode == 'editpost' && $post_data['edit_poll']) && !empty($poll_title) && sizeof($poll_options) >= 2) {
$poll_title = !empty($poll_title) ? trim($poll_title) : (isset($poll_data['title']) ? trim($poll_data['title']) : '');
$poll_start = !empty($poll_data['start']) ? $poll_data['start'] : $current_time;
$poll_length = isset($poll_data['length']) ? max(0, intval($poll_data['length'])) : 0;
$poll_max_options = isset($poll_data['max_options']) ? max(1, intval($poll_data['max_options'])) : 1;
$poll_last_vote = !empty($post_data['poll_last_vote']) ? $post_data['poll_last_vote'] : 0;
$poll_change = !empty($poll_data['change']) ? 1 : 0;
$sql_ary = array('poll_title' => $poll_title, 'poll_start' => $poll_start, 'poll_length' => $poll_length, 'poll_max_options' => $poll_max_options, 'poll_last_vote' => $poll_last_vote, 'poll_vote_change' => $poll_change);
$sql_poll_update = $db->sql_build_insert_update($sql_ary, false);
$sql = "UPDATE " . TOPICS_TABLE . " SET " . $sql_poll_update . " WHERE topic_id = " . $topic_id;
$db->sql_query($sql);
$delete_option_sql = '';
$old_poll_result = array();
if ($mode == 'editpost' && $post_data['has_poll']) {
$sql = "SELECT *\n\t\t\t\tFROM " . POLL_OPTIONS_TABLE . "\n\t\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\tORDER BY poll_option_id ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$old_poll_result[$row['poll_option_id']] = $row['poll_option_total'];
if (!isset($poll_options[$row['poll_option_id']])) {
$delete_option_sql .= ($delete_option_sql != '' ? ', ' : '') . $row['poll_option_id'];
}
}
}
$poll_option_id = 1;
@reset($poll_options);
while (list($option_id, $option_text) = each($poll_options)) {
if (!empty($option_text)) {
//.........这里部分代码省略.........
示例12: delete_post
function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id)
{
global $board_config, $lang, $db, $phpbb_root_path;
global $userdata;
if ($mode != 'poll_delete') {
include "includes/phpBB/functions_search.php";
$db->sql_query("DELETE FROM " . POSTS_TABLE . " WHERE post_id = {$post_id}");
$db->sql_query("DELETE FROM " . POSTS_TEXT_TABLE . " WHERE post_id = {$post_id}");
if ($post_data['last_post']) {
if ($post_data['first_post']) {
$forum_update_sql .= ', forum_topics = forum_topics - 1';
$sql = "DELETE FROM " . TOPICS_TABLE . "\n\t\t\t\t WHERE topic_id = {$topic_id} OR topic_moved_id = {$topic_id}";
$db->sql_query($sql);
$db->sql_query("DELETE FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = {$topic_id}");
}
}
remove_search_post($post_id);
}
if ($mode == 'poll_delete' || $mode == 'delete' && $post_data['first_post'] && $post_data['last_post'] && $post_data['has_poll'] && $post_data['edit_poll']) {
$db->sql_query("DELETE FROM " . VOTE_DESC_TABLE . " WHERE topic_id = {$topic_id}");
$db->sql_query("DELETE FROM " . VOTE_RESULTS_TABLE . " WHERE vote_id = {$poll_id}");
$db->sql_query("DELETE FROM " . VOTE_USERS_TABLE . " WHERE vote_id = {$poll_id}");
}
if ($mode == 'delete' && $post_data['first_post'] && $post_data['last_post']) {
URL::refresh(URL::index("&file=viewforum&" . POST_FORUM_URL . "={$forum_id}"));
$message = $lang['Deleted'];
} else {
URL::refresh(URL::index("&file=viewtopic&" . POST_TOPIC_URL . "={$topic_id}"));
$message = ($mode == 'poll_delete' ? $lang['Poll_delete'] : $lang['Deleted']) . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . URL::index("&file=viewtopic&" . POST_TOPIC_URL . "={$topic_id}") . '">', '</a>');
}
$message .= '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . URL::index("&file=viewforum&" . POST_FORUM_URL . "={$forum_id}") . '">', '</a>');
return;
}