本文整理汇总了PHP中mcp_delete_post函数的典型用法代码示例。如果您正苦于以下问题:PHP mcp_delete_post函数的具体用法?PHP mcp_delete_post怎么用?PHP mcp_delete_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mcp_delete_post函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main($id, $mode)
{
global $auth, $db, $user, $template, $action;
global $config, $phpbb_root_path, $phpEx, $request;
global $phpbb_dispatcher;
$quickmod = $mode == 'quickmod' ? true : false;
switch ($action) {
case 'lock':
case 'unlock':
$topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
if (!sizeof($topic_ids)) {
trigger_error('NO_TOPIC_SELECTED');
}
lock_unlock($action, $topic_ids);
break;
case 'lock_post':
case 'unlock_post':
$post_ids = !$quickmod ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));
if (!sizeof($post_ids)) {
trigger_error('NO_POST_SELECTED');
}
lock_unlock($action, $post_ids);
break;
case 'make_announce':
case 'make_sticky':
case 'make_global':
case 'make_normal':
$topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
if (!sizeof($topic_ids)) {
trigger_error('NO_TOPIC_SELECTED');
}
change_topic_type($action, $topic_ids);
break;
case 'move':
$user->add_lang('viewtopic');
$topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
if (!sizeof($topic_ids)) {
trigger_error('NO_TOPIC_SELECTED');
}
mcp_move_topic($topic_ids);
break;
case 'fork':
$user->add_lang('viewtopic');
$topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
if (!sizeof($topic_ids)) {
trigger_error('NO_TOPIC_SELECTED');
}
mcp_fork_topic($topic_ids);
break;
case 'delete_topic':
$user->add_lang('viewtopic');
// f parameter is not reliable for permission usage, however we just use it to decide
// which permission we will check later on. So if it is manipulated, we will still catch it later on.
$forum_id = $request->variable('f', 0);
$topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
$soft_delete = $request->is_set_post('confirm') && !$request->is_set_post('delete_permanent') || !$auth->acl_get('m_delete', $forum_id) ? true : false;
if (!sizeof($topic_ids)) {
trigger_error('NO_TOPIC_SELECTED');
}
mcp_delete_topic($topic_ids, $soft_delete, $request->variable('delete_reason', '', true));
break;
case 'delete_post':
$user->add_lang('posting');
// f parameter is not reliable for permission usage, however we just use it to decide
// which permission we will check later on. So if it is manipulated, we will still catch it later on.
$forum_id = $request->variable('f', 0);
$post_ids = !$quickmod ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));
$soft_delete = $request->is_set_post('confirm') && !$request->is_set_post('delete_permanent') || !$auth->acl_get('m_delete', $forum_id) ? true : false;
if (!sizeof($post_ids)) {
trigger_error('NO_POST_SELECTED');
}
mcp_delete_post($post_ids, $soft_delete, $request->variable('delete_reason', '', true));
break;
case 'restore_topic':
$user->add_lang('posting');
$topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
if (!sizeof($topic_ids)) {
trigger_error('NO_TOPIC_SELECTED');
}
mcp_restore_topic($topic_ids);
break;
default:
/**
* This event allows you to handle custom quickmod options
*
* @event core.modify_quickmod_actions
* @var string action Topic quick moderation action name
* @var bool quickmod Flag indicating whether MCP is in quick moderation mode
* @since 3.1.0-a4
* @change 3.1.0-RC4 Added variables: action, quickmod
*/
$vars = array('action', 'quickmod');
extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars)));
break;
}
switch ($mode) {
case 'front':
include $phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx;
$user->add_lang('acp/common');
mcp_front_view($id, $mode, $action);
//.........这里部分代码省略.........
示例2: main
function main($id, $mode)
{
global $auth, $db, $user, $template, $action;
global $config, $phpbb_root_path, $phpEx;
$quickmod = $mode == 'quickmod' ? true : false;
switch ($action) {
case 'lock':
case 'unlock':
$topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
if (!sizeof($topic_ids)) {
trigger_error('NO_TOPIC_SELECTED');
}
lock_unlock($action, $topic_ids);
break;
case 'lock_post':
case 'unlock_post':
$post_ids = !$quickmod ? request_var('post_id_list', array(0)) : array(request_var('p', 0));
if (!sizeof($post_ids)) {
trigger_error('NO_POST_SELECTED');
}
lock_unlock($action, $post_ids);
break;
case 'make_announce':
case 'make_sticky':
case 'make_global':
case 'make_normal':
$topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
if (!sizeof($topic_ids)) {
trigger_error('NO_TOPIC_SELECTED');
}
change_topic_type($action, $topic_ids);
break;
case 'move':
$user->add_lang('viewtopic');
$topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
if (!sizeof($topic_ids)) {
trigger_error('NO_TOPIC_SELECTED');
}
mcp_move_topic($topic_ids);
break;
case 'fork':
$user->add_lang('viewtopic');
$topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
if (!sizeof($topic_ids)) {
trigger_error('NO_TOPIC_SELECTED');
}
mcp_fork_topic($topic_ids);
break;
case 'delete_topic':
$user->add_lang('viewtopic');
$topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
if (!sizeof($topic_ids)) {
trigger_error('NO_TOPIC_SELECTED');
}
mcp_delete_topic($topic_ids);
break;
case 'delete_post':
$user->add_lang('posting');
$post_ids = !$quickmod ? request_var('post_id_list', array(0)) : array(request_var('p', 0));
if (!sizeof($post_ids)) {
trigger_error('NO_POST_SELECTED');
}
mcp_delete_post($post_ids);
break;
}
switch ($mode) {
case 'front':
include $phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx;
$user->add_lang('acp/common');
mcp_front_view($id, $mode, $action);
$this->tpl_name = 'mcp_front';
$this->page_title = 'MCP_MAIN';
break;
case 'forum_view':
include $phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx;
$user->add_lang('viewforum');
$forum_id = request_var('f', 0);
$forum_info = get_forum_data($forum_id, 'm_', true);
if (!sizeof($forum_info)) {
$this->main('main', 'front');
return;
}
$forum_info = $forum_info[$forum_id];
mcp_forum_view($id, $mode, $action, $forum_info);
$this->tpl_name = 'mcp_forum';
$this->page_title = 'MCP_MAIN_FORUM_VIEW';
break;
case 'topic_view':
include $phpbb_root_path . 'includes/mcp/mcp_topic.' . $phpEx;
mcp_topic_view($id, $mode, $action);
$this->tpl_name = 'mcp_topic';
$this->page_title = 'MCP_MAIN_TOPIC_VIEW';
break;
case 'post_details':
include $phpbb_root_path . 'includes/mcp/mcp_post.' . $phpEx;
mcp_post_details($id, $mode, $action);
$this->tpl_name = $action == 'whois' ? 'mcp_whois' : 'mcp_post';
$this->page_title = 'MCP_MAIN_POST_DETAILS';
break;
default:
//.........这里部分代码省略.........
示例3: main
public function main($id, $mode)
{
global $auth, $db, $user, $template, $cache, $request;
global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container;
global $phpbb_dispatcher;
include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
$forum_id = $request->variable('f', 0);
$start = $request->variable('start', 0);
$this->page_title = 'MCP_QUEUE';
switch ($action) {
case 'approve':
case 'restore':
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$post_id_list = $request->variable('post_id_list', array(0));
$topic_id_list = $request->variable('topic_id_list', array(0));
if (!empty($post_id_list)) {
self::approve_posts($action, $post_id_list, 'queue', $mode);
} else {
if (!empty($topic_id_list)) {
self::approve_topics($action, $topic_id_list, 'queue', $mode);
} else {
trigger_error('NO_POST_SELECTED');
}
}
break;
case 'delete':
$post_id_list = $request->variable('post_id_list', array(0));
$topic_id_list = $request->variable('topic_id_list', array(0));
if (!empty($post_id_list)) {
if (!function_exists('mcp_delete_post')) {
global $phpbb_root_path, $phpEx;
include $phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx;
}
mcp_delete_post($post_id_list, false, '', $action);
} else {
if (!empty($topic_id_list)) {
if (!function_exists('mcp_delete_topic')) {
global $phpbb_root_path, $phpEx;
include $phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx;
}
mcp_delete_topic($topic_id_list, false, '', $action);
} else {
trigger_error('NO_POST_SELECTED');
}
}
break;
case 'disapprove':
$post_id_list = $request->variable('post_id_list', array(0));
$topic_id_list = $request->variable('topic_id_list', array(0));
if (!empty($topic_id_list) && $mode == 'deleted_topics') {
if (!function_exists('mcp_delete_topics')) {
global $phpbb_root_path, $phpEx;
include $phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx;
}
mcp_delete_topic($topic_id_list, false, '', 'disapprove');
return;
}
if (!class_exists('messenger')) {
include $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
}
if (!empty($topic_id_list)) {
$post_visibility = $mode == 'deleted_topics' ? ITEM_DELETED : array(ITEM_UNAPPROVED, ITEM_REAPPROVE);
$sql = 'SELECT post_id
FROM ' . POSTS_TABLE . '
WHERE ' . $db->sql_in_set('post_visibility', $post_visibility) . '
AND ' . $db->sql_in_set('topic_id', $topic_id_list);
$result = $db->sql_query($sql);
$post_id_list = array();
while ($row = $db->sql_fetchrow($result)) {
$post_id_list[] = (int) $row['post_id'];
}
$db->sql_freeresult($result);
}
if (!empty($post_id_list)) {
self::disapprove_posts($post_id_list, 'queue', $mode);
} else {
trigger_error('NO_POST_SELECTED');
}
break;
}
switch ($mode) {
case 'approve_details':
$this->tpl_name = 'mcp_post';
$user->add_lang(array('posting', 'viewtopic'));
$post_id = $request->variable('p', 0);
$topic_id = $request->variable('t', 0);
/* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
if ($topic_id) {
$topic_info = phpbb_get_topic_data(array($topic_id), 'm_approve');
if (isset($topic_info[$topic_id]['topic_first_post_id'])) {
$post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
$phpbb_notifications->mark_notifications('topic_in_queue', $topic_id, $user->data['user_id']);
} else {
$topic_id = 0;
}
}
$phpbb_notifications->mark_notifications('post_in_queue', $post_id, $user->data['user_id']);
$post_info = phpbb_get_post_data(array($post_id), 'm_approve', true);
if (!sizeof($post_info)) {
//.........这里部分代码省略.........
示例4: get_topic_ids
break;
case 'delete_topic':
$_CLASS['core_user']->add_lang('viewtopic');
$topic_ids = get_topic_ids($quick_mod);
if (empty($topic_ids)) {
trigger_error('NO_TOPIC_SELECTED');
}
mcp_delete_topic($topic_ids);
break;
case 'delete_post':
$_CLASS['core_user']->add_lang('posting');
$post_ids = get_post_ids($quick_mod);
if (empty($post_ids)) {
trigger_error('NO_POST_SELECTED');
}
mcp_delete_post($post_ids);
break;
default:
trigger_error("Unknown mode: {$mode}");
break;
}
script_close(false);
function get_topic_ids($quick_mod)
{
$topic_ids = array_unique(get_variable('topic_id_list', 'POST', array(), 'array:int'));
if (empty($topic_ids)) {
if ($topic_ids = get_variable('t', 'REQUEST', false, 'int')) {
$topic_ids = array($topic_ids);
}
}
return $topic_ids;