function delete_action($id) { delete_post($id); $posts = get_all_posts(); $html = render_template("view/templates/admin.php", array('posts' => $posts)); return new Response($html); }
function mod($no, $action = 'none') { global $mysql; switch ($action) { case 'eventsticky': $sqlValue = "sticky"; $rootnum = "2027-07-07 00:00:00"; $sqlBool = "'2', root='" . $rootnum . "'"; $verb = "Stuck (event mode) "; break; case 'sticky': $sqlValue = "sticky"; $rootnum = "2027-07-07 00:00:00"; $sqlBool = "'1', root='" . $rootnum . "'"; $verb = "Stuck"; break; case 'unsticky': $sqlValue = "sticky"; $rootnum = date('Y-m-d G:i:s'); $sqlBool = "'0', root='" . $rootnum . "'"; $verb = "Unstuck"; break; case 'lock': $sqlValue = "locked"; $sqlBool = "'1', root=root "; $verb = "Locked"; break; case 'unlock': $sqlValue = "locked"; $sqlBool = "'0', root=root "; $verb = "Unlocked"; break; case 'permasage': $sqlValue = "permasage"; $sqlBool = "'1', root=root "; $verb = "Autosaging"; break; case 'nopermasage': $sqlValue = "permasage"; $sqlBool = "'0', root=root "; $verb = "Normally bumping"; break; case 'delete': delete_post($resno, $pwd, $imgonly = 0, $automatic = 1, $children = 1, $die = 1); break; case 'deleteallbyip': delete_post($resno, $pwd, $imgonly = 0, $automatic = 1, $children = 1, $die = 1, $allbyip = 1); break; case 'deleteimgonly': delete_post($resno, $pwd, $imgonly = 1, $automatic = 1, $children = 0, $die = 1); break; default: break; } $mysql->query('UPDATE ' . SQLLOG . " SET {$sqlValue}={$sqlBool} WHERE no='" . (int) $no . "' LIMIT 1"); $temp = head($dat); $temp .= $verb . " thread {$no}. Redirecting...<META HTTP-EQUIV=\"refresh\" content=\"1;URL=" . PHP_ASELF_ABS . "\">"; return $temp; }
function pruneThread($no) { global $my_log, $mysql; $my_log->update_cache(); $maxreplies = EVENT_STICKY_RES; $result = $mysql->query("SELECT no FROM " . SQLLOG . " WHERE resto='{$no}' ORDER BY time ASC"); $repcount = $mysql->num_rows($result); while ($row = $mysql->fetch_array($result) and $repcount >= $maxreplies) { delete_post($row['no'], 'trim', 0, 1, 0, 0); // imgonly=0, automatic=1, children=1 $repcount--; } $mysql->free_result($result); }
public function handle_deletion($is_topic_post, $id, $tid, $fid) { global $lang_delete; require FEATHER_ROOT . 'include/search_idx.php'; if ($is_topic_post) { // Delete the topic and all of its posts delete_topic($tid); update_forum($fid); redirect(get_link('forum/' . $fid . '/'), $lang_delete['Topic del redirect']); } else { // Delete just this one post delete_post($id, $tid); update_forum($fid); // Redirect towards the previous post $post = DB::for_table('posts')->select('id')->where('topic_id', $tid)->where_lt('id', $id)->order_by_desc('id')->find_one(); redirect(get_link('post/' . $post['id'] . '/#p' . $post['id']), $lang_delete['Post del redirect']); } }
/** * @dataProvider delete_post_data */ public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum, $expected_user) { global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx; $config = new \phpbb\config\config(array('num_posts' => 3, 'num_topics' => 1, 'search_type' => 'phpbb_mock_search')); $cache = new phpbb_mock_cache(); $db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); // Create auth mock $auth = $this->getMock('\\phpbb\\auth\\auth'); $auth->expects($this->any())->method('acl_get')->with($this->stringContains('_'), $this->anything())->will($this->returnValueMap(array(array('m_approve', 1, true)))); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\\phpbb\\datetime'); $attachment_delete = new \phpbb\attachment\delete($config, $db, new \phpbb_mock_event_dispatcher(), new \phpbb\filesystem\filesystem(), new \phpbb\attachment\resync($db), $phpbb_root_path); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_container = new phpbb_mock_container_builder(); $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager()); $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); // Works as a workaround for tests $phpbb_container->set('attachment.manager', $attachment_delete); delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason); $result = $db->sql_query('SELECT post_id, post_visibility, post_delete_reason FROM phpbb_posts WHERE topic_id = ' . $topic_id . ' ORDER BY post_id ASC'); $this->assertEquals($expected_posts, $db->sql_fetchrowset($result)); $db->sql_freeresult($result); $result = $db->sql_query('SELECT topic_visibility, topic_first_post_id, topic_last_post_id, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_delete_reason FROM phpbb_topics WHERE topic_id = ' . $topic_id); $this->assertEquals($expected_topic, $db->sql_fetchrowset($result)); $db->sql_freeresult($result); $result = $db->sql_query('SELECT forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id FROM phpbb_forums WHERE forum_id = ' . $forum_id); $this->assertEquals($expected_forum, $db->sql_fetchrowset($result)); $db->sql_freeresult($result); $sql = 'SELECT user_posts FROM ' . USERS_TABLE . ' WHERE user_id = ' . (int) $data['poster_id']; $result = $db->sql_query($sql); $this->assertEquals($expected_user, $db->sql_fetchrowset($result)); $db->sql_freeresult($result); }
/** * Deletes a post * * @param boolean Whether to consider updating post counts, regardless of forum's settings * @param integer Thread that this post belongs to * @param boolean Whether to physically remove the thread from the database * @param array Array of information for a soft delete * * @return mixed The number of affected rows */ function delete($countposts = true, $threadid = 0, $physicaldel = true, $delinfo = NULL, $dolog = true) { if ($postid = $this->existing['postid']) { require_once DIR . '/includes/functions_databuild.php'; // note: the skip_moderator_log is the inverse of the $dolog argument ($hook = vBulletinHook::fetch_hook('postdata_delete')) ? eval($hook) : false; return delete_post($postid, $countposts, $threadid, $physicaldel, $delinfo, $this->info['skip_moderator_log'] !== null ? !$this->info['skip_moderator_log'] : $dolog); } return false; }
/** * Do the various checks required for removing posts as well as removing it */ function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $delete_reason = '') { global $user, $auth, $config, $request; global $phpbb_root_path, $phpEx, $phpbb_log; $perm_check = $is_soft ? 'softdelete' : 'delete'; // If moderator removing post or user itself removing post, present a confirmation screen if ($auth->acl_get("m_{$perm_check}", $forum_id) || $post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_{$perm_check}", $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - $config['delete_time'] * 60 || !$config['delete_time'])) { $s_hidden_fields = array('p' => $post_id, 'f' => $forum_id, 'mode' => $is_soft ? 'soft_delete' : 'delete'); if (confirm_box(true)) { $data = array('topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'], 'topic_posts_approved' => $post_data['topic_posts_approved'], 'topic_posts_unapproved' => $post_data['topic_posts_unapproved'], 'topic_posts_softdeleted' => $post_data['topic_posts_softdeleted'], 'topic_visibility' => $post_data['topic_visibility'], 'topic_type' => $post_data['topic_type'], 'post_visibility' => $post_data['post_visibility'], 'post_reported' => $post_data['post_reported'], 'post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id'], 'post_postcount' => $post_data['post_postcount']); $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $delete_reason); $post_username = $post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username']) ? $post_data['post_username'] : $post_data['username']; if ($next_post_id === false) { $phpbb_log->add('mod', $user->data['user_id'], $user->ip, $is_soft ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC', false, array('forum_id' => $forum_id, 'topic_id' => $topic_id, $post_data['topic_title'], $post_username, $delete_reason)); $meta_info = append_sid("{$phpbb_root_path}viewforum.{$phpEx}", "f={$forum_id}"); $message = $user->lang['POST_DELETED']; } else { $phpbb_log->add('mod', $user->data['user_id'], $user->ip, $is_soft ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST', false, array('forum_id' => $forum_id, 'topic_id' => $topic_id, 'post_id' => $post_id, $post_data['post_subject'], $post_username, $delete_reason)); $meta_info = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&t={$topic_id}&p={$next_post_id}") . "#p{$next_post_id}"; $message = $user->lang['POST_DELETED']; if (!$request->is_ajax()) { $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $meta_info . '">', '</a>'); } } meta_refresh(3, $meta_info); if (!$request->is_ajax()) { $message .= '<br /><br />' . $user->lang('RETURN_FORUM', '<a href="' . append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id) . '">', '</a>'); } trigger_error($message); } else { global $user, $template, $request; $can_delete = $auth->acl_get('m_delete', $forum_id) || $post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id); $can_softdelete = $auth->acl_get('m_softdelete', $forum_id) || $post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id); $template->assign_vars(array('S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED, 'S_CHECKED_PERMANENT' => $request->is_set_post('delete_permanent') ? ' checked="checked"' : '', 'S_ALLOWED_DELETE' => $can_delete, 'S_ALLOWED_SOFTDELETE' => $can_softdelete)); $l_confirm = 'DELETE_POST'; if ($post_data['post_visibility'] == ITEM_DELETED) { $l_confirm .= '_PERMANENTLY'; $s_hidden_fields['delete_permanent'] = '1'; } else { if (!$can_softdelete) { $s_hidden_fields['delete_permanent'] = '1'; } } confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html'); } } // If we are here the user is not able to delete - present the correct error message if ($post_data['poster_id'] != $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) { trigger_error('DELETE_OWN_POSTS'); } if ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && $post_id != $post_data['topic_last_post_id']) { trigger_error('CANNOT_DELETE_REPLIED'); } trigger_error('USER_CANNOT_DELETE'); }
} // Load the delete.php language file require PUN_ROOT . 'lang/' . $pun_user['language'] . '/delete.php'; if (isset($_POST['delete'])) { if ($is_admmod) { confirm_referrer('delete.php'); } require PUN_ROOT . 'include/search_idx.php'; if ($is_topic_post) { // Delete the topic and all of it's posts delete_topic($cur_post['tid']); update_forum($cur_post['fid']); redirect('viewforum.php?id=' . $cur_post['fid'], $lang_delete['Topic del redirect']); } else { // Delete just this one post delete_post($id, $cur_post['tid']); update_forum($cur_post['fid']); redirect('viewtopic.php?id=' . $cur_post['tid'], $lang_delete['Post del redirect']); } } $page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / ' . $lang_delete['Delete post']; require PUN_ROOT . 'header.php'; require PUN_ROOT . 'include/parser.php'; $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); ?> <div class="linkst"> <div class="inbox"> <ul><li><a href="index.php"><?php echo $lang_common['Index']; ?> </a></li><li> » <a href="viewforum.php?id=<?php
<?php // connection to the database include "connect_db.php"; include "functions.php"; delete_post($con); // header redirect index with a flag for delete and userpost header('Location: http://localhost/nextK/index.php?deleted=1&userpost=1');
} else { $action = get_str('action'); } } else { $action = post_str('action'); } $explanation = null; if ($action == "hide") { $result = hide_post($post, $thread, $forum); $action_name = "hidden"; $explanation = hide_explanation(); } elseif ($action == "unhide") { $result = unhide_post($post, $thread, $forum); $action_name = "unhidden"; } elseif ($action == "delete") { $result = delete_post($post, $thread, $forum); if (!$result) { error_page("Can't delete post"); } page_head("Post deleted"); if (BoincThread::lookup_id($thread->id)) { echo "Post successfully deleted.\n <p>\n <a href=forum_thread.php?id={$thread->id}>Return to thread</a>\n "; } else { echo "Post and thread successfully deleted.\n <p>\n <a href=forum_forum.php?id={$forum->id}>Return to forum</a>\n "; } page_tail(); exit; } elseif ($action == "move") { $destid = post_int('threadid'); $new_thread = BoincThread::lookup_id($destid); if (!$new_thread) {
Display::display_header(''); } } /* Is the user allowed here? */ // If the user is not a course administrator and the forum is hidden // then the user is not allowed here. if (!api_is_allowed_to_edit(false, true) && ($current_forum['visibility'] == 0 || $current_thread['visibility'] == 0)) { $forum_allow = forum_not_allowed_here(); if ($forum_allow === false) { exit; } } /* Actions */ $my_action = isset($_GET['action']) ? $_GET['action'] : ''; if ($my_action == 'delete' && isset($_GET['content']) && isset($_GET['id']) && (api_is_allowed_to_edit(false, true) || GroupManager::is_tutor_of_group(api_get_user_id(), $groupId))) { $message = delete_post($_GET['id']); } if (($my_action == 'invisible' || $my_action == 'visible') && isset($_GET['id']) && (api_is_allowed_to_edit(false, true) || GroupManager::is_tutor_of_group(api_get_user_id(), $groupId))) { $message = approve_post($_GET['id'], $_GET['action']); } if ($my_action == 'move' && isset($_GET['post'])) { $message = move_post_form(); } /* Display the action messages */ $my_message = isset($message) ? $message : ''; if ($my_message) { Display::display_confirmation_message(get_lang($my_message)); } if ($my_message != 'PostDeletedSpecial') { // in this case the first and only post of the thread is removed // this increases the number of times the thread has been viewed
|************************************************************************************************** | | By using this software you agree that you have read and acknowledged our End-User License | Agreement available at http://www.gagclonescript.com/eula.html and to be bound by it. | | Copyright (c) GagCloneScript.com. All rights reserved. |**************************************************************************************************/ include "../include/config.php"; include_once "../include/functions/import.php"; verify_login_admin(); $adminurl = $config['adminurl']; // DELETE if ($_REQUEST[delete] == "1") { $DPID = intval($_REQUEST['PID']); if ($DPID > 0) { delete_post($DPID); $message = "Gag Successfully Deleted."; Stemplate::assign('message', $message); } } // DELETE //ACTIVE if ($_POST['asub'] == "1") { $APID = $_POST['APID']; $aval = $_POST['aval']; if ($aval == "0") { $aval2 = "1"; $message = "Gag Successfully Activated."; Stemplate::assign('message', $message); } else { $aval2 = "0";
} if (!$error) { print_out(lang('success_deleted_topic'), lang('redirecting')); } } } else { print_out(lang_parse('error_invalid_given', array(lang('id'))), lang('redirecting')); } } else { if (isset($_GET['delete'])) { if (alpha($_GET['delete'], 'numeric')) { // Try getting that data! $delete_data = topic($_GET['delete']); // Is it their topic? if ($delete_data['starter_id'] == $user_data['id']) { $result = delete_post($_GET['delete']); // User data if ($result === "ID_INVALID") { print_out(lang_parse('error_invalid_given', array(lang('id'))), lang('redirecting')); } else { if ($result === "DELETING_POST") { print_out(lang('error_deleting_post'), lang('redirecting')); } } if (!$error) { if ($delete_data['reply']) { // How many replies? $replies = intval(forum_count(false, $delete_data['reply'], false)); // Woooo~ Last id for redirecting~ if ($config['show_first_post']) { $page_numbers = ($replies - 2) / $config['messages_per_topic'] - 1;
function m_delete_post_func($xmlrpc_params) { global $input, $post, $thread, $forum, $pid, $tid, $fid, $modlogdata, $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $moderation, $parser; $input = Tapatalk_Input::filterXmlInput(array('post_id' => Tapatalk_Input::INT, 'mode' => Tapatalk_Input::INT, 'reason_text' => Tapatalk_Input::STRING), $xmlrpc_params); // Load global language phrases $lang->load("editpost"); $plugins->run_hooks("editpost_start"); // No permission for guests if (!$mybb->user['uid']) { error_no_permission(); } // Get post info $pid = intval($input['post_id']); $query = $db->simple_select("posts", "*", "pid='{$pid}'"); $post = $db->fetch_array($query); if (!$post['pid']) { error($lang->error_invalidpost); } // Get thread info $tid = $post['tid']; $thread = get_thread($tid); if (!$thread['tid']) { error($lang->error_invalidthread); } // Get forum info $fid = $post['fid']; $forum = get_forum($fid); if (!$forum || $forum['type'] != "f") { error($lang->error_closedinvalidforum); } if ($forum['open'] == 0 || $mybb->user['suspendposting'] == 1) { error_no_permission(); } $forumpermissions = forum_permissions($fid); if (!is_moderator($fid, "candeleteposts")) { if ($thread['closed'] == 1) { error($lang->redirect_threadclosed); } if ($forumpermissions['candeleteposts'] == 0) { error_no_permission(); } if ($mybb->user['uid'] != $post['uid']) { error_no_permission(); } } // Check if this forum is password protected and we have a valid password check_forum_password($forum['fid']); $plugins->run_hooks("editpost_deletepost"); $modlogdata['fid'] = $fid; $modlogdata['tid'] = $tid; $query = $db->simple_select("posts", "pid", "tid='{$tid}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "asc")); $firstcheck = $db->fetch_array($query); if ($firstcheck['pid'] == $pid) { if ($forumpermissions['candeletethreads'] == 1 || is_moderator($fid, "candeletethreads")) { delete_thread($tid); mark_reports($tid, "thread"); log_moderator_action($modlogdata, $lang->thread_deleted); } else { error_no_permission(); } } else { if ($forumpermissions['candeleteposts'] == 1 || is_moderator($fid, "candeleteposts")) { // Select the first post before this delete_post($pid, $tid); mark_reports($pid, "post"); log_moderator_action($modlogdata, $lang->post_deleted); } else { error_no_permission(); } } $response = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'is_login_mod' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval("", 'base64')), 'struct'); return new xmlrpcresp($response); }
case "update_post": $update_post = $_POST['updatePost']; $update_post = addslashes($update_post); $update_post = strip_tags($update_post); $update_post_length = strlen($update_post); if ($update_post_length < 1 || $update_post_length > 1000) { echo FALSE; break; } $postUid = $_POST['postUid']; $postUid = addslashes($postUid); $postUid = strip_tags($postUid); $postUid_length = strlen($postUid); if ($postUid_length < 10) { echo FALSE; break; } echo update_post($update_post, $postUid); break; case "delete_post": $postUid = $_POST['postUid']; $postUid = addslashes($postUid); $postUid = strip_tags($postUid); $postUid_length = strlen($postUid); if ($postUid_length < 10) { echo FALSE; break; } echo delete_post($postUid); break; }
/** * Do the various checks required for removing posts as well as removing it */ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) { global $user, $db, $auth, $_RESULT; global $phpbb_root_path, $phpEx; include "{$phpbb_root_path}/includes/functions_posting.{$phpEx}"; // If moderator removing post or user itself removing post, present a confirmation screen if ($auth->acl_get('m_delete', $forum_id) || $post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id']) { $data = array('topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'], 'topic_approved' => $post_data['topic_approved'], 'topic_type' => $post_data['topic_type'], 'post_approved' => $post_data['post_approved'], 'post_reported' => $post_data['post_reported'], 'post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id'], 'post_postcount' => $post_data['post_postcount']); if ($post_data['topic_first_post_id'] == $post_data['topic_last_post_id']) { $_RESULT['success'] = false; exit($user->lang['CANNOT_DELETE_SINGLE_POST']); } else { $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data); add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_POST', $post_data['post_subject']); } exit($user->lang['POST_DELETED'] . "({$post_data['topic_first_post_id']};{$post_data['topic_last_post_id']})"); } // If we are here the user is not able to delete - present the correct error message if ($post_data['poster_id'] != $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) { $_RESULT['success'] = false; exit($user->lang['DELETE_OWN_POSTS']); } if ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && $post_id != $post_data['topic_last_post_id']) { $_RESULT['success'] = false; exit($user->lang['CANNOT_DELETE_REPLIED']); } $_RESULT['success'] = false; exit($user->lang['USER_CANNOT_DELETE']); }
if ($action == 'get_draft') { $post_id = get_var('post_id'); echo get_draft_json($post_id); } else { if ($action == 'get_latest_post') { echo get_latest_post(); } else { if ($action == 'get_recent_post_listing') { if (!isset($_GET['num_posts'])) { $num_posts = $DEFAULT_NUM_POSTS; } else { $num_posts = (int) $_GET['num_posts']; if ($num_posts < 1) { $num_posts = $DEFAULT_NUM_POSTS; } } echo get_recent_post_listing($num_posts); } else { if ($action == 'delete_post') { $post_id = get_var('post_id'); echo delete_post($post_id); } else { $err_msg = 'invalid action specified in $_GET[\'action\']'; throw new Exception($err_msg); } } } } } } }
$add_signature = post_str('add_signature', true) == "1" ? 1 : 0; $content = substr($content, 0, 64000); $content = trim($content); if (strlen($content)) { $content = BoincDb::escape_string($content); $now = time(); $post->update("signature={$add_signature}, content='{$content}', modified={$now}"); if ($can_edit_title) { $title = trim($title); $title = sanitize_tags($title); $title = BoincDb::escape_string($title); $thread->update("title='{$title}'"); } header("Location: forum_thread.php?id={$thread->id}&postid={$postid}"); } else { delete_post($post, $thread, $forum); header("Location: forum_forum.php?id={$forum->id}"); } } page_head(tra("Forum"), '', '', '', $bbcode_js); show_forum_header($logged_in_user); switch ($forum->parent_type) { case 0: $category = BoincCategory::lookup_id($forum->category); show_forum_title($category, $forum, $thread); break; case 1: show_team_forum_title($forum, $thread); break; } if ($preview == tra("Preview")) {
} else { $anonymityStatus = 'forbidden'; } //check access rights $is_postAllowed = !claro_is_current_user_enrolment_pending() && claro_is_course_member() && $forumSettingList['forum_access'] != 0 && (!$topicId || !$topicSettingList['topic_status']) || claro_is_allowed_to_edit() ? true : false; $is_viewAllowed = !is_null($forumSettingList['idGroup']) && !($forumSettingList['idGroup'] == claro_get_current_group_id() || claro_is_in_a_group() || claro_is_group_allowed()) && !claro_is_allowed_to_edit() ? false : true; // NOTE : $forumSettingList['idGroup'] != claro_get_current_group_id() is necessary to prevent any hacking // attempt like rewriting the request without $cidReq. If we are in group // forum and the group of the concerned forum isn't the same as the session // one, something weird is happening, indeed ... if (!isset($_REQUEST['submit']) && !$is_postAllowed && 'show' != $cmd || !$is_viewAllowed) { $dialogBox->error(get_lang('Not allowed')); } else { //handle user commands if ('exDelete' == $cmd) { if (delete_post($postId, $topicSettingList['topic_id'], $forumSettingList['forum_id'])) { $dialogBox->success('Post successfully deleted'); } else { $dialogBox->error('Error while deleting post'); } $cmd = 'show'; } elseif ('exSavePost' == $cmd) { $error = false; //this test should be handled by a "html not empty" validator if (trim(strip_tags($message, '<img><audio><video><embed><object><canvas><iframe>')) == '') { $dialogBox->error(get_lang('You cannot post an empty message')); $error = true; } else { // USER $userLastname = $is_post_anonymous ? 'anonymous' : claro_get_current_user_data('lastName'); $userFirstname = $is_post_anonymous ? '' : claro_get_current_user_data('firstName');
$message_parser->bbcode_uid = $bbcode_uid; } // should we alow ip no user deletion ? // Delete triggered ? if ($mode == 'delete') { if ($_CLASS['auth']->acl_get('f_delete', $forum_id) && $post_id == $topic_last_post_id && (!$_CLASS['core_user']->is_user && $posting_data['poster_id'] == ANONYMOUS && $poster_ip && $poster_ip == $_CLASS['core_user']->ip || $_CLASS['core_user']->is_user && $posting_data['poster_id'] == $_CLASS['core_user']->data['user_id'])) { $user_deletable = true; } else { $user_deletable = false; } } if ($mode == 'delete' && ($user_deletable || $_CLASS['auth']->acl_get('m_delete', $forum_id))) { $s_hidden_fields = '<input type="hidden" name="p" value="' . $post_id . '" /><input type="hidden" name="f" value="' . $forum_id . '" /><input type="hidden" name="mode" value="delete" />'; if (display_confirmation(false, $s_hidden_fields)) { $data = array('topic_first_post_id' => $topic_first_post_id, 'topic_last_post_id' => $topic_last_post_id, 'topic_approved' => $topic_approved, 'topic_type' => $posting_data['topic_type'], 'post_approved' => $post_approved, 'post_time' => $posting_data['post_time'], 'poster_id' => $posting_data['poster_id']); $next_post_id = delete_post($mode, $post_id, $topic_id, $forum_id, $data); if ($topic_first_post_id == $topic_last_post_id) { if (!$user_deletable) { add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_TOPIC', $posting_data['topic_title']); } $meta_info = generate_link('Forums&file=viewforum&f=' . $forum_id); $message = $_CLASS['core_user']->lang['POST_DELETED']; } else { if (!$user_deletable) { add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_POST', $post_subject); } $meta_info = generate_link("Forums&file=viewtopic&f={$forum_id}&t={$topic_id}&p={$next_post_id}#{$next_post_id}"); $message = $_CLASS['core_user']->lang['POST_DELETED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_TOPIC'], '<a href="' . generate_link("Forums&file=viewtopic&f={$forum_id}&t={$topic_id}&p={$next_post_id}#{$next_post_id}") . '">', '</a>'); } $_CLASS['core_display']->meta_refresh(3, $meta_info); $message .= '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_FORUM'], '<a href="' . generate_link('Forums&file=viewforum&f=' . $forum_id) . '">', '</a>');
error(S_NOPERM); } require_once CORE_DIR . "/admin/staff.php"; $staff = new Staff(); echo $staff->getStaff(); if (isset($_POST['user']) && isset($_POST['pwd1']) && isset($_POST['pwd2']) && isset($_POST['action'])) { $staff->addStaff($_POST['user'], $_POST['pwd1'], $_POST['pwd2'], $_POST['action']); } break; case 'adel': if (!valid('janitor')) { error(S_NOPERM); } $no = $mysql->escape_string($_GET['no']); $imonly = $_GET['imgonly'] == '1' ? 0 : 1; delete_post($no, 0, $imonly, 0, 1, 1); echo '<meta http-equiv="refresh" content="0; url=' . PHP_ASELF_ABS . '?mode=' . $_GET['refer'] . '" />'; break; case 'ban': if (!valid('moderator')) { error(S_NOPERM); } require_once CORE_DIR . "/admin/bans.php"; $banish = new Banish(); if (isset($no)) { } $banish->postOptions($no, $ip, $banlength, $banType, $perma, $pubreason, $staffnote, $custmess, $showbanmess, $afterban); $banish->form($_GET['no']); break; case 'more': echo $table->moreInfo($_GET['no']);
function delete_user($user_id, $delete_posts = false) { global $forum_db, $db_type, $forum_config; $return = ($hook = get_hook('fn_delete_user_start')) ? eval($hook) : null; if ($return != null) { return; } // First we need to get some data on the user $query = array('SELECT' => 'u.username, u.group_id, g.g_moderator', 'FROM' => 'users AS u', 'JOINS' => array(array('INNER JOIN' => 'groups AS g', 'ON' => 'g.g_id=u.group_id')), 'WHERE' => 'u.id=' . $user_id); ($hook = get_hook('fn_delete_user_qr_get_user_data')) ? eval($hook) : null; $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); $user = $forum_db->fetch_assoc($result); // Delete any subscriptions $query = array('DELETE' => 'subscriptions', 'WHERE' => 'user_id=' . $user_id); ($hook = get_hook('fn_delete_user_qr_delete_subscriptions')) ? eval($hook) : null; $forum_db->query_build($query) or error(__FILE__, __LINE__); // Delete any subscriptions forum $query = array('DELETE' => 'forum_subscriptions', 'WHERE' => 'user_id=' . $user_id); ($hook = get_hook('fn_delete_user_qr_delete_forum_subscriptions')) ? eval($hook) : null; $forum_db->query_build($query) or error(__FILE__, __LINE__); // Remove him/her from the online list (if they happen to be logged in) $query = array('DELETE' => 'online', 'WHERE' => 'user_id=' . $user_id); ($hook = get_hook('fn_delete_user_qr_delete_online')) ? eval($hook) : null; $forum_db->query_build($query) or error(__FILE__, __LINE__); // Should we delete all posts made by this user? if ($delete_posts) { @set_time_limit(0); // Find all posts made by this user $query = array('SELECT' => 'p.id, p.topic_id, t.forum_id, t.first_post_id', 'FROM' => 'posts AS p', 'JOINS' => array(array('INNER JOIN' => 'topics AS t', 'ON' => 't.id=p.topic_id')), 'WHERE' => 'p.poster_id=' . $user_id); ($hook = get_hook('fn_delete_user_qr_get_user_posts')) ? eval($hook) : null; $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); while ($cur_post = $forum_db->fetch_assoc($result)) { if ($cur_post['first_post_id'] == $cur_post['id']) { delete_topic($cur_post['topic_id'], $cur_post['forum_id']); } else { delete_post($cur_post['id'], $cur_post['topic_id'], $cur_post['forum_id']); } } } else { // Set all his/her posts to guest $query = array('UPDATE' => 'posts', 'SET' => 'poster_id=1', 'WHERE' => 'poster_id=' . $user_id); ($hook = get_hook('fn_delete_user_qr_reset_user_posts')) ? eval($hook) : null; $forum_db->query_build($query) or error(__FILE__, __LINE__); } // Delete the user $query = array('DELETE' => 'users', 'WHERE' => 'id=' . $user_id); ($hook = get_hook('fn_delete_user_qr_delete_user')) ? eval($hook) : null; $forum_db->query_build($query) or error(__FILE__, __LINE__); // Delete user avatar delete_avatar($user_id); // If the user is a moderator or an administrator, we remove him/her from the moderator list in all forums // and regenerate the bans cache (in case he/she created any bans) if ($user['group_id'] == FORUM_ADMIN || $user['g_moderator'] == '1') { clean_forum_moderators(); // Regenerate the bans cache if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) { require FORUM_ROOT . 'include/cache.php'; } generate_bans_cache(); } ($hook = get_hook('fn_delete_user_end')) ? eval($hook) : null; }
// Remove him/her from the online list (if they happen to be logged in) $db->query('DELETE FROM ' . $db->prefix . 'online WHERE user_id=' . $id) or error('Unable to remove user from online list', __FILE__, __LINE__, $db->error()); // Should we delete all posts made by this user? if (isset($_POST['delete_posts'])) { require PUN_ROOT . 'include/search_idx.php'; @set_time_limit(0); // Find all posts made by this user $result = $db->query('SELECT p.id, p.topic_id, t.forum_id FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'topics AS t ON t.id=p.topic_id INNER JOIN ' . $db->prefix . 'forums AS f ON f.id=t.forum_id WHERE p.poster_id=' . $id) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error()); if ($db->num_rows($result)) { while ($cur_post = $db->fetch_assoc($result)) { // Determine whether this post is the "topic post" or not $result2 = $db->query('SELECT id FROM ' . $db->prefix . 'posts WHERE topic_id=' . $cur_post['topic_id'] . ' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); if ($db->result($result2) == $cur_post['id']) { delete_topic($cur_post['topic_id']); } else { delete_post($cur_post['id'], $cur_post['topic_id']); } update_forum($cur_post['forum_id']); } } } else { // Set all his/her posts to guest $db->query('UPDATE ' . $db->prefix . 'posts SET poster_id=1 WHERE poster_id=' . $id) or error('Unable to update posts', __FILE__, __LINE__, $db->error()); } // Delete the user $db->query('DELETE FROM ' . $db->prefix . 'users WHERE id=' . $id) or error('Unable to delete user', __FILE__, __LINE__, $db->error()); // Delete user avatar delete_avatar($id); redirect('index.php', $lang_profile['User delete redirect']); } $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Profile'], $lang_profile['Confirm delete user']);
} function dislike_post($post_id) { global $conn; $sql = "update posts set dislikes = dislikes +1 where id = {$post_id}"; $result = mysqli_query($conn, $sql); } switch ($do) { case "follow": follow_user($_SESSION['userid'], $id); $msg = "You have followed a user!"; break; case "unfollow": unfollow_user($_SESSION['userid'], $id); $msg = "You have unfollowed a user!"; break; case "like": like_post($id); $msg = "You have liked a post!"; break; case "dislike": dislike_post($id); $msg = "You have disliked a post!"; break; case "delete": delete_post($id); $msg = "You have deleted that post!"; break; } $_SESSION['message'] = $msg; header('Location: /02_welcome.php');
uasort($mc_posts, "post_sort"); file_put_contents($index_file2, "<?php\n\$mc_posts=" . var_export($mc_posts, true) . "\n?>"); } load_posts(); if (isset($_GET['delete']) || isset($_GET['apply']) && $_GET['apply'] == 'delete') { if (isset($_GET['apply']) && $_GET['apply'] == 'delete') { $ids = explode(',', $_GET['ids']); foreach ($ids as $id) { if (trim($id) == '') { continue; } delete_post($id); load_posts(); } } else { delete_post($_GET['delete']); } //load_posts(); Header('Location:post.php?done=true&state=' . $state); exit; } if (isset($_GET['revert']) || isset($_GET['apply']) && $_GET['apply'] == 'revert') { if (isset($_GET['apply']) && $_GET['apply'] == 'revert') { $ids = explode(',', $_GET['ids']); foreach ($ids as $id) { if (trim($id) == '') { continue; } revert_post($id); load_posts(); }
$poll_title = isset($HTTP_POST_VARS['poll_title']) && $is_auth['auth_pollcreate'] ? $HTTP_POST_VARS['poll_title'] : ''; $poll_options = isset($HTTP_POST_VARS['poll_option_text']) && $is_auth['auth_pollcreate'] ? $HTTP_POST_VARS['poll_option_text'] : ''; $poll_length = isset($HTTP_POST_VARS['poll_length']) && $is_auth['auth_pollcreate'] ? $HTTP_POST_VARS['poll_length'] : ''; $bbcode_uid = ''; prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $bbcode_uid, $subject, $message, $poll_title, $poll_options, $poll_length); if ($error_msg == '') { $topic_type = $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ? $post_data['topic_type'] : $topic_type; submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\\'", "''", $username), str_replace("\\'", "''", $subject), str_replace("\\'", "''", $message), str_replace("\\'", "''", $poll_title), $poll_options, $poll_length); } break; case 'delete': case 'poll_delete': if ($error_msg != '') { message_die(GENERAL_MESSAGE, $error_msg); } delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id); break; } if ($error_msg == '') { if ($mode != 'editpost') { $user_id = $mode == 'reply' || $mode == 'newtopic' ? $userdata['user_id'] : $post_data['poster_id']; update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id); } if ($error_msg == '' && $mode != 'poll_delete') { user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $post_id, $notify_user); } if ($mode == 'newtopic' || $mode == 'reply') { $tracking_topics = !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array(); $tracking_forums = !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array(); if (count($tracking_topics) + count($tracking_forums) == 100 && empty($tracking_topics[$topic_id])) { asort($tracking_topics);
/** * Do the various checks required for removing posts as well as removing it */ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) { global $user, $db, $auth, $config; global $phpbb_root_path, $phpEx; // If moderator removing post or user itself removing post, present a confirmation screen if ($auth->acl_get('m_delete', $forum_id) || $post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - $config['delete_time'] * 60 || !$config['delete_time'])) { $s_hidden_fields = build_hidden_fields(array('p' => $post_id, 'f' => $forum_id, 'mode' => 'delete')); if (confirm_box(true)) { $data = array('topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'], 'topic_replies_real' => $post_data['topic_replies_real'], 'topic_approved' => $post_data['topic_approved'], 'topic_type' => $post_data['topic_type'], 'post_approved' => $post_data['post_approved'], 'post_reported' => $post_data['post_reported'], 'post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id'], 'post_postcount' => $post_data['post_postcount']); $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data); $post_username = $post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username']) ? $post_data['post_username'] : $post_data['username']; if ($next_post_id === false) { add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_TOPIC', $post_data['topic_title'], $post_username); $meta_info = append_sid("{$phpbb_root_path}viewforum.{$phpEx}", "f={$forum_id}"); $message = $user->lang['POST_DELETED']; } else { add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_POST', $post_data['post_subject'], $post_username); $meta_info = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&t={$topic_id}&p={$next_post_id}") . "#p{$next_post_id}"; $message = $user->lang['POST_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $meta_info . '">', '</a>'); } meta_refresh(3, $meta_info); $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id) . '">', '</a>'); trigger_error($message); } else { confirm_box(false, 'DELETE_POST', $s_hidden_fields); } } // If we are here the user is not able to delete - present the correct error message if ($post_data['poster_id'] != $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) { trigger_error('DELETE_OWN_POSTS'); } if ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && $post_id != $post_data['topic_last_post_id']) { trigger_error('CANNOT_DELETE_REPLIED'); } trigger_error('USER_CANNOT_DELETE'); }
show_404(); } // získame dáta o článku $post = get_post($post_id); // ak sme nezískali žiadne dáta, článok neexistuje a zobrazíme 404 stránku if (!$post) { show_404(); } // ak prihlásený užívateľ nie je majteľom článku, zobrazíme 404 stránku if (!is_owner($post)) { show_404(); } // ak bol na túto stránku odoslaný formulár... if (is_post()) { // ... vymažeme článok ... if (delete_post($post_id)) { // ... a ak sa úspešne vymazal, presmerujeme na úvodnú stránku redirect(); } } include_header(array("title" => "Vymazanie článku")); ?> <h1 class="text-center">Vymazanie článku</h1> <h2><?php echo $post["title"]; ?> </h2> <p><?php echo $post["teaser"];
<?php /** * Template created by Gregory Chris */ load_model('admin/tutorials'); if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Save') { if (array_key_exists('post_id', $_POST) && is_numeric($_POST['post_id']) && $_POST['post_id'] > 0) { update_post($_POST['post_id'], $_POST); } } if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Delete') { if (array_key_exists('post_id', $_POST) && is_numeric($_POST['post_id']) && $_POST['post_id'] > 0) { delete_post($_POST['post_id']); } } if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Add') { add_post($_POST); } header('Location: ' . _HTTP_ROOT . '/admin/tutorials/'); die;
if (!$post) { not_found(); } } $current = $post['current']; if ($user === $current->author || $role === 'admin') { render('delete-post', array('title' => 'Delete post - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'p' => $current, 'bodyclass' => 'deletepost', 'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> » ' . $current->tagb . ' » ' . $current->title)); } else { render('denied', array('title' => 'Delete post - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'p' => $current, 'bodyclass' => 'deletepost', 'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> » ' . $current->tagb . ' » ' . $current->title)); } } else { $login = site_url() . 'login'; header("location: {$login}"); } }); // Get deleted data from blog post post('/:year/:month/:name/delete', function () { $proper = is_csrf_proper(from($_REQUEST, 'csrf_token')); if ($proper && login()) { $file = from($_REQUEST, 'file'); $destination = from($_GET, 'destination'); delete_post($file, $destination); } }); // If we get here, it means that // nothing has been matched above get('.*', function () { not_found(); }); // Serve the blog dispatch();