本文整理汇总了PHP中delete_post函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_post函数的具体用法?PHP delete_post怎么用?PHP delete_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_post函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_action
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);
}
示例2: mod
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;
}
示例3: pruneThread
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);
}
示例4: handle_deletion
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']);
}
}
示例5: test_delete_post
/**
* @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);
}
示例6: delete
/**
* 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;
}
示例7: phpbb_handle_post_delete
/**
* 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');
}
示例8: confirm_referrer
}
// 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
示例9: delete_post
<?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');
示例10: get_str
} 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) {
示例11: forum_not_allowed_here
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
示例12: Copyright
|**************************************************************************************************
|
| 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";
示例13: print_out
}
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;
示例14: m_delete_post_func
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);
}
示例15: addslashes
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;
}