本文整理汇总了PHP中delete_pm函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_pm函数的具体用法?PHP delete_pm怎么用?PHP delete_pm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_pm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_message_func
function delete_message_func($xmlrpc_params)
{
global $db, $user, $config, $phpbb_root_path, $phpEx;
$user->setup('ucp');
$params = php_xmlrpc_decode($xmlrpc_params);
// get folder id from parameters
$msg_id = intval($params[0]);
$user_id = $user->data['user_id'];
if (!$msg_id) {
trigger_error('NO_MESSAGE');
}
if (!$user->data['is_registered']) {
trigger_error('LOGIN_EXPLAIN_UCP');
}
// Is PM disabled?
if (!$config['allow_privmsg']) {
trigger_error('Module not accessible');
}
$sql = 'SELECT folder_id
FROM ' . PRIVMSGS_TO_TABLE . "\r\r\n WHERE user_id = {$user_id}\r\r\n AND msg_id = {$msg_id}";
$result = $db->sql_query_limit($sql, 1);
$folder_id = (int) $db->sql_fetchfield('folder_id');
$db->sql_freeresult($result);
include_once $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
$result = delete_pm($user_id, $msg_id, $folder_id);
$response = new xmlrpcval(array('result' => new xmlrpcval($result, 'boolean'), 'result_text' => new xmlrpcval($result ? '' : 'Delete message failed', 'base64')), 'struct');
return new xmlrpcresp($response);
}
示例2: display_output
/**
* Display the output for this extension
*
* @return null
* @access public
*/
public function display_output()
{
// Add the language file
$this->language->add_lang('acp_pmmonitor', 'david63/pmmonitor');
// Check that the user has permission to access here
if (!$this->auth->acl_get('a_comms_pm_manage')) {
trigger_error('NOT_AUTHORISED', E_USER_WARNING);
}
// Get message count
$sql = 'SELECT COUNT(msg_id) AS total_msg
FROM ' . PRIVMSGS_TO_TABLE;
$result = $this->db->sql_query($sql);
$total_msg = (int) $this->db->sql_fetchfield('total_msg');
$this->db->sql_freeresult($result);
// If no data then no point going any further
if ($total_msg == 0) {
trigger_error($this->language->lang('NO_PM_DATA'));
}
// Start initial var setup
$start = $this->request->variable('start', 0);
$sort_key = $this->request->variable('sk', 'd');
$sd = $sort_dir = $this->request->variable('sd', 'd');
if ($this->request->is_set_post('delete')) {
$pm_monitor_list = $this->request->variable('mark', array(''));
if (!sizeof($pm_monitor_list)) {
trigger_error($this->language->lang('NO_PM_SELECTED') . adm_back_link($this->u_action));
}
if (confirm_box(true)) {
// Restore the array to its correct format
$pm_monitor_list = str_replace("'", '"', $pm_monitor_list);
foreach ($pm_monitor_list as $pm_msg_list) {
$pm_list[] = json_decode($pm_msg_list);
}
if (!function_exists('delete_pm')) {
include $this->phpbb_root_path . 'includes/functions_privmsgs.' . $this->phpEx;
}
foreach ($pm_list as $row) {
delete_pm($row['user_id'], $row['msg_ids'], $row['folder_id']);
}
// Add option settings change action to the admin log
$phpbb_log = $this->container->get('log');
$phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_PM_MONITOR');
} else {
confirm_box(false, $this->language->lang('CONFIRM_DELETE'), build_hidden_fields(array('mark' => $pm_monitor_list, 'delete' => 'delete')));
}
}
$sort_dir = $sort_dir == 'd' ? ' DESC' : ' ASC';
switch ($sort_key) {
case 'b':
$order_by = 'u.username_clean' . $sort_dir;
$order_sql = ' AND t.user_id = u.user_id ';
break;
case 'd':
$order_by = 'p.message_time' . $sort_dir;
$order_sql = ' AND t.user_id = u.user_id ';
break;
case 'f':
$order_by = 'u.username_clean' . $sort_dir;
$order_sql = ' AND t.author_id = u.user_id ';
break;
case 'i':
$order_by = 'p.author_ip' . $sort_dir . ', u.username_clean ASC';
$order_sql = ' AND t.user_id = u.user_id ';
break;
case 'p':
$order_by = 't.folder_id' . $sort_dir . ', u.username_clean ASC';
$order_sql = ' AND t.user_id = u.user_id ';
break;
case 't':
$order_by = 'to_username' . $sort_dir;
$order_sql = ' AND t.user_id = u.user_id ';
break;
}
$pm_box_ary = array(PRIVMSGS_HOLD_BOX => $this->language->lang('PM_HOLDBOX'), PRIVMSGS_NO_BOX => $this->language->lang('PM_NOBOX'), PRIVMSGS_OUTBOX => $this->language->lang('PM_OUTBOX'), PRIVMSGS_SENTBOX => $this->language->lang('PM_SENTBOX'), PRIVMSGS_INBOX => $this->language->lang('PM_INBOX'));
$flags = ($this->config['auth_bbcode_pm'] ? OPTION_FLAG_BBCODE : 0) + ($this->config['auth_smilies_pm'] ? OPTION_FLAG_SMILIES : 0) + ($this->config['allow_post_links'] ? OPTION_FLAG_LINKS : 0);
$sql = 'SELECT p.msg_id, p.message_subject, p.message_text, p.bbcode_uid, p.bbcode_bitfield, p.message_time, p.bcc_address, p.to_address, p.author_ip, t.user_id, t.author_id, t.folder_id, LOWER(u.username) AS to_username
FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u
WHERE p.msg_id = t.msg_id ' . $order_sql . '
ORDER BY ' . $order_by;
$result = $this->db->sql_query_limit($sql, $this->config['topics_per_page'], $start);
while ($row = $this->db->sql_fetchrow($result)) {
$this->template->assign_block_vars('pm_row', array('AUTHOR_IP' => $row['author_ip'], 'BCC' => $row['bcc_address'] ? $this->get_msg_user_data($row['user_id'], $row['author_id']) : '', 'DATE' => $this->user->format_date($row['message_time']), 'FOLDER' => $row['folder_id'] > PRIVMSGS_INBOX ? $this->language->lang('PM_SAVED') : $pm_box_ary[$row['folder_id']], 'FROM' => $this->get_msg_user_data($row['author_id']), 'IS_GROUP' => strstr($row['to_address'], 'g') ? $this->language->lang('IS_GROUP') : '', 'LAST_VISIT_FROM' => $this->get_last_visit($row['author_id']), 'LAST_VISIT_TO' => $row['to_address'] ? $this->get_last_visit($row['user_id'], $row['author_id']) : '', 'PM_ID' => str_replace('"', "'", json_encode(array('msg_ids' => $row['msg_id'], 'user_id' => $row['user_id'], 'folder_id' => $row['folder_id']))), 'PM_KEY' => $row['msg_id'] . $row['user_id'], 'PM_SUBJECT' => $row['message_subject'], 'PM_TEXT' => generate_text_for_display($row['message_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $flags), 'TO' => $row['to_address'] ? $this->get_msg_user_data($row['user_id'], $row['author_id']) : ''));
}
$this->db->sql_freeresult($result);
$sort_by_text = array('f' => $this->language->lang('SORT_FROM'), 't' => $this->language->lang('SORT_TO'), 'b' => $this->language->lang('SORT_BCC'), 'p' => $this->language->lang('SORT_PM_BOX'), 'i' => $this->language->lang('SORT_IP'), 'd' => $this->language->lang('SORT_DATE'));
$limit_days = array();
$s_sort_key = $s_limit_days = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
$action = $this->u_action . '&sk=' . $sort_key . '&sd=' . $sd;
$this->pagination->generate_template_pagination($action, 'pagination', 'start', $total_msg, $this->config['topics_per_page'], $start);
$this->template->assign_vars(array('MESSAGE_COUNT' => $total_msg, 'PM_MONITOR_VERSION' => ext::PM_MONITOR_VERSION, 'S_CAN_READ' => $this->auth->acl_get('a_comms_pm_manage') ? true : false, 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, 'U_ACTION' => $this->u_action . '&action=delete'));
}
示例3: compose_pm
//.........这里部分代码省略.........
if ($to_group_id && $action == 'post') {
$address_list['g'][$to_group_id] = 'to';
}
}
$check_value = 0;
}
if (($to_group_id || isset($address_list['g'])) && (!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group'))) {
trigger_error('NO_AUTH_GROUP_MESSAGE');
}
if ($action == 'edit' && !$refresh && !$preview && !$submit) {
if (!($message_time > time() - $config['pm_edit_time'] * 60 || !$config['pm_edit_time'])) {
trigger_error('CANNOT_EDIT_MESSAGE_TIME');
}
}
if ($action == 'post') {
$template->assign_var('S_NEW_MESSAGE', true);
}
if (!isset($icon_id)) {
$icon_id = 0;
}
$message_parser = new parse_message();
$plupload = $phpbb_container->get('plupload');
$message_parser->set_plupload($plupload);
$message_parser->message = $action == 'reply' ? '' : $message_text;
unset($message_text);
$s_action = append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i={$id}&mode={$mode}&action={$action}", true, $user->session_id);
$s_action .= ($folder_id ? "&f={$folder_id}" : '') . ($msg_id ? "&p={$msg_id}" : '');
// Delete triggered ?
if ($action == 'delete') {
// Folder id has been determined by the SQL Statement
// $folder_id = request_var('f', PRIVMSGS_NO_BOX);
// Do we need to confirm ?
if (confirm_box(true)) {
delete_pm($user->data['user_id'], $msg_id, $folder_id);
// jump to next message in "history"? nope, not for the moment. But able to be included later.
$meta_info = append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i=pm&folder={$folder_id}");
$message = $user->lang['MESSAGE_DELETED'];
meta_refresh(3, $meta_info);
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>');
trigger_error($message);
} else {
$s_hidden_fields = array('p' => $msg_id, 'f' => $folder_id, 'action' => 'delete');
// "{$phpbb_root_path}ucp.$phpEx?i=pm&mode=compose"
confirm_box(false, 'DELETE_MESSAGE', build_hidden_fields($s_hidden_fields));
}
redirect(append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&mode=view&action=view_message&p=' . $msg_id));
}
// Get maximum number of allowed recipients
$sql = 'SELECT MAX(g.group_max_recipients) as max_recipients
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
WHERE ug.user_id = ' . $user->data['user_id'] . '
AND ug.user_pending = 0
AND ug.group_id = g.group_id';
$result = $db->sql_query($sql);
$max_recipients = (int) $db->sql_fetchfield('max_recipients');
$db->sql_freeresult($result);
$max_recipients = !$max_recipients ? $config['pm_max_recipients'] : $max_recipients;
// If this is a quote/reply "to all"... we may increase the max_recpients to the number of original recipients
if (($action == 'reply' || $action == 'quote') && $max_recipients && $reply_to_all) {
// We try to include every previously listed member from the TO Header
$list = rebuild_header(array('to' => $post['to_address']));
// Can be an empty array too ;)
$list = !empty($list['u']) ? $list['u'] : array();
$list[$post['author_id']] = 'to';
if (isset($list[$user->data['user_id']])) {
unset($list[$user->data['user_id']]);
示例4: handle_mark_actions
function handle_mark_actions($user_id, $mark_action, $msg_ids, $cur_folder_id)
{
global $_CLASS;
if (empty($msg_ids)) {
return;
}
switch ($mark_action) {
case 'mark_important':
$mark_list = array();
$sql = 'SELECT msg_id, marked FROM ' . FORUMS_PRIVMSGS_TO_TABLE . "\n\t\t\t\tWHERE folder_id = {$cur_folder_id}\n\t\t\t\t\tAND user_id = {$user_id}\n\t\t\t\t\tAND msg_id IN (" . implode(', ', $msg_ids) . ')';
$result = $_CLASS['core_db']->query($sql);
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$row['marked'] = $row['marked'] ? 0 : 1;
$mark_list[$row['marked']][] = $row['msg_id'];
}
$_CLASS['core_db']->free_result($result);
if (empty($mark_list)) {
break;
}
$_CLASS['core_db']->transaction();
foreach ($mark_list as $mark => $ids) {
$sql = 'UPDATE ' . FORUMS_PRIVMSGS_TO_TABLE . "\n\t\t\t\t\tSET marked = {$mark}\n\t\t\t\t\tWHERE msg_id IN (" . implode(', ', $ids) . ')';
$_CLASS['core_db']->query($sql);
}
$_CLASS['core_db']->transaction('commit');
break;
case 'delete_marked':
$hidden_fields = array('marked_msg_id' => $msg_ids, 'cur_folder_id' => $cur_folder_id, 'mark_option' => 'delete_marked', 'submit_mark' => true);
if (display_confirmation($_CLASS['core_user']->get_lang('DELETE_MARKED_PM'), generate_hidden_fields($hidden_fields))) {
$_CLASS['core_db']->transaction();
delete_pm($user_id, $msg_ids, $cur_folder_id);
$_CLASS['core_db']->transaction('commit');
$success_msg = count($msg_ids) === 1 ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED';
$redirect = generate_link('Control_Panel&i=pm&folder=' . $cur_folder_id);
$_CLASS['core_display']->meta_refresh(3, $redirect);
trigger_error($_CLASS['core_user']->lang[$success_msg] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_FOLDER'], '<a href="' . $redirect . '">', '</a>'));
}
break;
/*
case 'export_as_xml':
case 'export_as_csv':
case 'export_as_txt':
$export_as = str_replace('export_as_', '', $mark_action);
break;
*/
/*
case 'export_as_xml':
case 'export_as_csv':
case 'export_as_txt':
$export_as = str_replace('export_as_', '', $mark_action);
break;
*/
default:
return false;
break;
}
return true;
}
示例5: array
}
// Clear the user's outbox
if ($config['asacp_ocban_clear_outbox']) {
$msg_ids = array();
$sql = 'SELECT msg_id
FROM ' . PRIVMSGS_TO_TABLE . "\n\t\t\t\t\tWHERE author_id = {$user_id}\n\t\t\t\t\t\tAND folder_id = " . PRIVMSGS_OUTBOX;
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result)) {
if (!function_exists('delete_pm')) {
include $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
}
do {
$msg_ids[] = (int) $row['msg_id'];
} while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
delete_pm($user_id, $msg_ids, PRIVMSGS_OUTBOX);
add_log('admin', 'LOG_USER_DEL_OUTBOX', $user_row['username']);
}
$db->sql_freeresult($result);
}
// Empty the user's profile fields
if ($config['asacp_ocban_delete_profile_fields']) {
$sql_ary = array('user_birthday' => '', 'user_from' => '', 'user_icq' => '', 'user_aim' => '', 'user_yim' => '', 'user_msnm' => '', 'user_jabber' => '', 'user_website' => '', 'user_occ' => '', 'user_interests' => '');
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user_id;
$db->sql_query($sql);
}
// Submit the information to Stop Forum Spam
if (isset($_POST['sfs_submit']) && $config['asacp_sfs_key']) {
$data = array('username' => $user_row['username'], 'email' => $user_row['user_email'], 'ip_addr' => $user_row['user_ip'], 'evidence' => substr(utf8_normalize_nfc(request_var('sfs_evidence', '', true)), 0, 7999), 'api_key' => $config['asacp_sfs_key']);
示例6: handle_mark_actions
function handle_mark_actions($user_id, $mark_action)
{
global $_CLASS;
$msg_ids = isset($_POST['marked_msg_id']) ? array_map('intval', $_POST['marked_msg_id']) : array();
$cur_folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX);
$confirm = isset($_POST['confirm']) ? true : false;
if (!sizeof($msg_ids)) {
return;
}
switch ($mark_action) {
case 'mark_important':
$sql = 'UPDATE ' . FORUMS_PRIVMSGS_TO_TABLE . "\r\n\t\t\t\tSET marked = !marked\r\n\t\t\t\tWHERE folder_id = {$cur_folder_id}\r\n\t\t\t\t\tAND user_id = {$user_id}\r\n\t\t\t\t\tAND msg_id IN (" . implode(', ', $msg_ids) . ')';
$_CLASS['core_db']->query($sql);
break;
case 'delete_marked':
$hidden_fields = array('cur_folder_id' => $cur_folder_id, 'mark_option' => 'delete_marked', 'submit_mark' => true);
$hidden_fields['marked_msg_id'] = $msg_ids;
$s_hidden_fields = '';
foreach ($hidden_fields as $key => $var) {
if (is_array($var)) {
foreach ($var as $_key => $_var) {
$s_hidden_fields .= '<input type="hidden" name="' . $key . '[' . $_key . ']" value="' . $_var . '" />';
}
} else {
$s_hidden_fields .= '<input type="hidden" name="' . $key . '" value="' . $var . '" />';
}
}
unset($hidden_fields);
if (confirm_box(true)) {
delete_pm($user_id, $msg_ids, $cur_folder_id);
$success_msg = sizeof($msg_ids) == 1 ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED';
$redirect = generate_link('Control_Panel&i=pm&folder=' . $cur_folder_id);
$_CLASS['core_display']->meta_refresh(3, $redirect);
trigger_error($_CLASS['core_user']->lang[$success_msg] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_FOLDER'], '<a href="' . $redirect . '">', '</a>'));
} else {
confirm_box(false, 'DELETE_MARKED_PM', $s_hidden_fields);
}
break;
case 'export_as_xml':
case 'export_as_csv':
case 'export_as_txt':
$export_as = str_replace('export_as_', '', $mark_action);
break;
default:
return false;
}
return true;
}
示例7: main
//.........这里部分代码省略.........
$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_AVATAR_USER', false, array('reportee_id' => $user_id));
trigger_error($user->lang['USER_ADMIN_AVATAR_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));
break;
case 'delposts':
if (confirm_box(true)) {
// Delete posts, attachments, etc.
delete_posts('poster_id', $user_id);
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_POSTS', false, array($user_row['username']));
trigger_error($user->lang['USER_POSTS_DELETED'] . adm_back_link($this->u_action . '&u=' . $user_id));
} else {
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('u' => $user_id, 'i' => $id, 'mode' => $mode, 'action' => $action, 'update' => true)));
}
break;
case 'delattach':
if (confirm_box(true)) {
/** @var \phpbb\attachment\manager $attachment_manager */
$attachment_manager = $phpbb_container->get('attachment.manager');
$attachment_manager->delete('user', $user_id);
unset($attachment_manager);
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_ATTACH', false, array($user_row['username']));
trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));
} else {
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('u' => $user_id, 'i' => $id, 'mode' => $mode, 'action' => $action, 'update' => true)));
}
break;
case 'deloutbox':
if (confirm_box(true)) {
$msg_ids = array();
$lang = 'EMPTY';
$sql = 'SELECT msg_id
FROM ' . PRIVMSGS_TO_TABLE . "\n\t\t\t\t\t\t\t\t\tWHERE author_id = {$user_id}\n\t\t\t\t\t\t\t\t\t\tAND folder_id = " . PRIVMSGS_OUTBOX;
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result)) {
if (!function_exists('delete_pm')) {
include $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
}
do {
$msg_ids[] = (int) $row['msg_id'];
} while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
delete_pm($user_id, $msg_ids, PRIVMSGS_OUTBOX);
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_OUTBOX', false, array($user_row['username']));
$lang = 'EMPTIED';
}
$db->sql_freeresult($result);
trigger_error($user->lang['USER_OUTBOX_' . $lang] . adm_back_link($this->u_action . '&u=' . $user_id));
} else {
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('u' => $user_id, 'i' => $id, 'mode' => $mode, 'action' => $action, 'update' => true)));
}
break;
case 'moveposts':
if (!check_form_key($form_name)) {
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
$user->add_lang('acp/forums');
$new_forum_id = $request->variable('new_f', 0);
if (!$new_forum_id) {
$this->page_title = 'USER_ADMIN_MOVE_POSTS';
$template->assign_vars(array('S_SELECT_FORUM' => true, 'U_ACTION' => $this->u_action . "&action={$action}&u={$user_id}", 'U_BACK' => $this->u_action . "&u={$user_id}", 'S_FORUM_OPTIONS' => make_forum_select(false, false, false, true)));
return;
}
// Is the new forum postable to?
$sql = 'SELECT forum_name, forum_type
FROM ' . FORUMS_TABLE . "\n\t\t\t\t\t\t\t\tWHERE forum_id = {$new_forum_id}";
$result = $db->sql_query($sql);
$forum_info = $db->sql_fetchrow($result);
示例8: message_die
// get the pm recipient data for the user_id we are deleting
$sql = "SELECT pr.* FROM " . PRIVMSGA_RECIPS_TABLE . " AS pr\n \t\tWHERE pr.privmsg_user_id = " . $to_userdata;
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Can\'t read pms selected', '', __LINE__, __FILE__, $sql);
}
// run a loop to delete the pm's this user has recieved and sent
while ($row = $db->sql_fetchrow($result)) {
// get all the privmsg_ids of the private messages for deletion
$sql2 = "SELECT pr.* FROM " . PRIVMSGA_RECIPS_TABLE . " AS pr\n \t\tWHERE pr.privmsg_id = " . $row['privmsg_id'];
if (!($result2 = $db->sql_query($sql2))) {
message_die(GENERAL_ERROR, 'Can\'t read pms selected', '', __LINE__, __FILE__, $sql2);
}
// build an array of the privmsg_recip_ids we are going to delete
$recip_ids = array();
while ($row2 = $db->sql_fetchrow($result2)) {
$recip_ids[] = $row2['privmsg_recip_id'];
}
// delete 'em
delete_pm($recip_ids, $to_userdata);
}
}
$message = $lang['UI_Deleted_Users'] . "." . "<br /><br />" . sprintf($lang['UI_return'], "<a href=\"" . append_sid("admin_users_inactive.{$phpEx}?mode=modify") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.{$phpEx}?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
} else {
$message = $lang['UI_select_user_first'] . "." . "<br /><br />" . sprintf($lang['UI_return'], "<a href=\"" . append_sid("admin_users_inactive.{$phpEx}?mode=modify") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.{$phpEx}?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
break;
}
}
include './page_footer_admin.' . $phpEx;
示例9: message_options
//.........这里部分代码省略.........
$result = $_CLASS['core_db']->query($sql);
$folder_row = $_CLASS['core_db']->fetch_row_assoc($result);
$_CLASS['core_db']->free_result($result);
if (!$folder_row) {
trigger_error('CANNOT_REMOVE_FOLDER');
}
$hidden_fields = array('remove_folder_id' => $remove_folder_id, 'remove_folder' => 1, 'remove_action' => $remove_action, 'move_to' => $move_to);
// Do we need to confirm?
if (display_confirmation($_CLASS['core_user']->get_lang('REMOVE_FOLDER'), generate_hidden_fields($hidden_fields))) {
// Gather message ids
$sql = 'SELECT msg_id
FROM ' . FORUMS_PRIVMSGS_TO_TABLE . '
WHERE user_id = ' . $_CLASS['core_user']->data['user_id'] . "\n\t\t\t\t\tAND folder_id = {$remove_folder_id}";
$result = $_CLASS['core_db']->query($sql);
$msg_ids = array();
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$msg_ids[] = (int) $row['msg_id'];
}
$_CLASS['core_db']->free_result($result);
// First of all, copy all messages to another folder... or delete all messages
switch ($remove_action) {
// Move Messages
case 1:
$message_limit = $_CLASS['core_user']->data['user_message_limit'] ? $_CLASS['core_user']->data['user_message_limit'] : $config['pm_max_msgs'];
$num_moved = move_pm($_CLASS['core_user']->data['user_id'], $message_limit, $msg_ids, $move_to, $remove_folder_id);
// Something went wrong, only partially moved?
if ($num_moved != $folder_row['pm_count']) {
trigger_error(sprintf($_CLASS['core_user']->lang['MOVE_PM_ERROR'], $num_moved, $folder_row['pm_count']));
}
break;
// Remove Messages
// Remove Messages
case 2:
delete_pm($_CLASS['core_user']->data['user_id'], $msg_ids, $remove_folder_id);
break;
}
// Remove folder
$sql = 'DELETE FROM ' . FORUMS_PRIVMSGS_FOLDER_TABLE . '
WHERE user_id = ' . $_CLASS['core_user']->data['user_id'] . "\n\t\t\t\t\tAND folder_id = {$remove_folder_id}";
$_CLASS['core_db']->query($sql);
// Check full folder option. If the removed folder has been specified as destination switch back to inbox
if ($_CLASS['core_user']->data['user_full_folder'] == $remove_folder_id) {
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_full_folder = ' . PRIVMSGS_INBOX . '
WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
$_CLASS['core_db']->query($sql);
$_CLASS['core_user']->data['user_full_folder'] = PRIVMSGS_INBOX;
}
$meta_info = generate_link('Control_Panel&i=pm&mode=' . $mode);
$message = $_CLASS['core_user']->lang['FOLDER_REMOVED'];
$_CLASS['core_display']->meta_refresh(3, $meta_info);
$message .= '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_UCP'], '<a href="' . $meta_info . '">', '</a>');
trigger_error($message);
}
}
// Add Rule
if (isset($_POST['add_rule'])) {
$check_option = request_var('check_option', 0);
$rule_option = request_var('rule_option', 0);
$cond_option = request_var('cond_option', '');
$action_option = explode('|', request_var('action_option', ''));
$rule_string = $cond_option != 'none' ? request_var('rule_string', '') : '';
$rule_user_id = $cond_option != 'none' ? request_var('rule_user_id', 0) : 0;
$rule_group_id = $cond_option != 'none' ? request_var('rule_group_id', 0) : 0;
$action = (int) $action_option[0];
$folder_id = (int) $action_option[1];
示例10: main
function main($id, $mode)
{
global $config, $db, $user, $request, $template, $phpbb_container, $phpbb_root_path, $phpEx;
$this->config = $config;
$this->db = $db;
$this->user = $user;
$this->request = $request;
$this->template = $template;
$this->pagination = $phpbb_container->get('pagination');
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
$this->tpl_name = 'acp_pm_spy';
$this->page_title = 'ACP_PM_SPY';
if ($this->request->variable('action', '') == 'details') {
$this->user->add_lang_ext('forumhulp/pmspy', 'info_acp_pmspy');
$phpbb_container->get('forumhulp.helper')->detail('forumhulp/pmspy');
$this->tpl_name = 'acp_ext_details';
} else {
// Start initial var setup
$start = $this->request->variable('start', 0);
$sk = $this->request->variable('sk', 'd');
$sd = $this->request->variable('sd', 'd');
$delete = $this->request->is_set_post('delete');
if ($delete) {
$pm_spy_list = $this->request->variable('mark', array(''));
// Restore the array to its correct format
$pm_spy_list = str_replace('#', '"', $pm_spy_list);
foreach ($pm_spy_list as $pm_msg_list) {
$pm_list[] = unserialize($pm_msg_list);
}
if (!sizeof($pm_spy_list)) {
trigger_error('NO_PM_SELECTED');
}
if (!function_exists('delete_pm')) {
include $this->phpbb_root_path . 'includes/functions_privmsgs.' . $this->php_ext;
}
foreach ($pm_list as $row) {
delete_pm($row['user_id'], $row['msg_ids'], $row['folder_id']);
}
add_log('admin', 'LOG_PM_SPY');
}
$sort_dir = $sd == 'd' ? ' DESC' : ' ASC';
switch ($sk) {
case 'b':
$order_by = 'u.username_clean' . $sort_dir;
$order_sql = ' AND t.user_id = u.user_id ';
break;
case 'd':
$order_by = 'p.message_time' . $sort_dir;
$order_sql = ' AND t.user_id = u.user_id ';
break;
case 'f':
$order_by = 'u.username_clean' . $sort_dir;
$order_sql = ' AND t.author_id = u.user_id ';
break;
case 'i':
$order_by = 'p.author_ip' . $sort_dir . ', u.username_clean ASC';
$order_sql = ' AND t.user_id = u.user_id ';
break;
case 'p':
$order_by = 't.folder_id' . $sort_dir . ', u.username_clean ASC';
$order_sql = ' AND t.user_id = u.user_id ';
break;
case 't':
$order_by = 'to_username' . $sort_dir;
$order_sql = ' AND t.user_id = u.user_id ';
break;
}
// Get PM count for pagination
$sql = 'SELECT COUNT(msg_id) AS total_pm FROM ' . PRIVMSGS_TO_TABLE;
$result = $this->db->sql_query($sql);
$total_pm = (int) $this->db->sql_fetchfield('total_pm');
$this->db->sql_freeresult($result);
if ($total_pm == 0) {
trigger_error($this->user->lang['NO_PM_DATA']);
}
$pm_box_ary = array(PRIVMSGS_HOLD_BOX => $this->user->lang['PM_HOLDBOX'], PRIVMSGS_NO_BOX => $this->user->lang['PM_NOBOX'], PRIVMSGS_OUTBOX => $this->user->lang['PM_OUTBOX'], PRIVMSGS_SENTBOX => $this->user->lang['PM_SENTBOX'], PRIVMSGS_INBOX => $this->user->lang['PM_INBOX']);
$flags = ($this->config['auth_bbcode_pm'] ? OPTION_FLAG_BBCODE : 0) + ($this->config['auth_smilies_pm'] ? OPTION_FLAG_SMILIES : 0) + ($this->config['allow_post_links'] ? OPTION_FLAG_LINKS : 0);
$sql = 'SELECT p.msg_id, p.message_subject, p.message_text, p.bbcode_uid, p.bbcode_bitfield, p.message_time, p.bcc_address, p.to_address, p.author_ip, t.user_id,
t.author_id, t.folder_id, LOWER(u.username) AS to_username
FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u
WHERE p.msg_id = t.msg_id ' . $order_sql . '
ORDER BY ' . $order_by;
$result = $this->db->sql_query_limit($sql, $this->config['topics_per_page'], $start);
while ($row = $this->db->sql_fetchrow($result)) {
$this->template->assign_block_vars('pm_row', array('AUTHOR_IP' => $row['author_ip'], 'FROM' => $this->get_pm_user_data($row['author_id']), 'TO' => $row['to_address'] && ($row['folder_id'] < PRIVMSGS_OUTBOX || !$row['folder_id']) ? $this->get_pm_user_data($row['user_id']) : '', 'BCC' => $row['bcc_address'] && ($row['folder_id'] < PRIVMSGS_OUTBOX || !$row['folder_id']) ? $this->get_pm_user_data($row['user_id']) : '', 'DATE' => $this->user->format_date($row['message_time']), 'FOLDER' => $row['folder_id'] > PRIVMSGS_INBOX ? $this->user->lang['PM_SAVED'] : $pm_box_ary[$row['folder_id']], 'IS_GROUP' => strstr($row['to_address'], 'g') ? $this->get_pm_group($row['to_address']) : '', 'PM_ID' => str_replace('"', '#', serialize(array('msg_ids' => $row['msg_id'], 'user_id' => $row['user_id'], 'folder_id' => $row['folder_id']))), 'PM_KEY' => $row['msg_id'] . $row['user_id'], 'PM_SUBJECT' => $row['message_subject'], 'PM_TEXT' => generate_text_for_display($row['message_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $flags)));
}
$this->db->sql_freeresult($result);
$base_url = $this->u_action . '&sk=' . $sk . '&sd=' . $sd;
$start = $this->pagination->validate_start($start, 1, $total_pm);
$this->pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_pm, $config['topics_per_page'], $start);
$this->template->assign_vars(array('MESSAGE_COUNT' => $total_pm, 'U_NAME' => $sk, 'U_SORT' => $sd, 'U_ACTION' => $this->u_action));
}
}
示例11: message_die
message_die(GENERAL_ERROR, _lang('No_post_id'));
}
if ($cancel) {
$cancel = false;
$pmmode = 'post';
redirect(append_sid("{$main_pgm}&folder={$folder_id}&" . POST_POST_URL . "={$privmsg_recip_id}&" . POST_USERS_URL . "={$view_user_id}"));
} else {
if ($confirm) {
// perform some checks
$error = false;
$error_msg = '';
if ($error) {
message_die(GENERAL_ERROR, $error_msg);
}
// perform the delete
delete_pm($privmsg_recip_id, $view_user_id);
redirect(append_sid("{$main_pgm}&folder={$folder_id}&" . POST_USERS_URL . "={$view_user_id}"));
} else {
// set the page title and include the page header
$page_title = _lang('Private_Messaging');
if (!defined('IN_PCP')) {
include $phpbb_root_path . 'includes/page_header.' . $phpEx;
}
privmsg_header($view_user_id, $folder_id, $privmsg_recip_id);
// template name
$template->set_filenames(array('body' => 'confirm_body.tpl'));
$template->assign_vars(array('MESSAGE_TITLE' => _lang('Information'), 'MESSAGE_TEXT' => _lang('Confirm_delete_pm'), 'L_YES' => _lang('Yes'), 'L_NO' => _lang('No')));
// system
_hide(POST_POST_URL, $privmsg_recip_id);
_hide(POST_USERS_URL, $view_user_id);
_hide('pmmode', $pmmode);
示例12: main
//.........这里部分代码省略.........
delete_attachments('user', $user_id);
add_log('admin', 'LOG_USER_DEL_ATTACH', $user_row['username']);
trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));
}
else
{
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
'u' => $user_id,
'i' => $id,
'mode' => $mode,
'action' => $action,
'update' => true))
);
}
break;
case 'deloutbox':
if (confirm_box(true))
{
$msg_ids = array();
$lang = 'EMPTY';
$sql = 'SELECT msg_id
FROM ' . PRIVMSGS_TO_TABLE . "
WHERE author_id = $user_id
AND folder_id = " . PRIVMSGS_OUTBOX;
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
if (!function_exists('delete_pm'))
{
include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
}
do
{
$msg_ids[] = (int) $row['msg_id'];
}
while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
delete_pm($user_id, $msg_ids, PRIVMSGS_OUTBOX);
add_log('admin', 'LOG_USER_DEL_OUTBOX', $user_row['username']);
$lang = 'EMPTIED';
}
$db->sql_freeresult($result);
trigger_error($user->lang['USER_OUTBOX_' . $lang] . adm_back_link($this->u_action . '&u=' . $user_id));
}
else
{
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
'u' => $user_id,
'i' => $id,
'mode' => $mode,
'action' => $action,
'update' => true))
);
}
示例13: compose_pm
//.........这里部分代码省略.........
$address_list['g'][$to_group_id] = 'to';
}
}
$check_value = 0;
}
if (($to_group_id || isset($address_list['g'])) && !$config['allow_mass_pm']) {
trigger_error('NO_AUTH_GROUP_MESSAGE');
}
if ($action == 'edit' && !$refresh && !$preview && !$submit) {
if (!($message_time > time() - $config['pm_edit_time'] || !$config['pm_edit_time'])) {
trigger_error('CANNOT_EDIT_MESSAGE_TIME');
}
}
if (!isset($icon_id)) {
$icon_id = 0;
}
require_once $site_file_root . 'includes/forums/functions_admin.php';
require_once $site_file_root . 'includes/forums/functions_posting.php';
require_once $site_file_root . 'includes/forums/message_parser.php';
$message_parser = new parse_message();
$message_subject = isset($message_subject) ? $message_subject : '';
$message_parser->message = $action == 'reply' ? '' : (isset($message_text) ? $message_text : '');
unset($message_text);
$s_action = "Control_Panel&i={$id}&mode={$mode}&action={$action}";
$s_action .= $msg_id ? "&p={$msg_id}" : '';
$s_action .= $quote_post ? "&q=1" : '';
// Delete triggered ?
if ($action == 'delete') {
// Folder id has been determined by the SQL Statement
// $folder_id = request_var('f', PRIVMSGS_NO_BOX);
$s_hidden_fields = '<input type="hidden" name="p" value="' . $msg_id . '" /><input type="hidden" name="f" value="' . $folder_id . '" /><input type="hidden" name="action" value="delete" />';
// Do we need to confirm ?
if (confirm_box(true)) {
delete_pm($_CLASS['core_user']->data['user_id'], $msg_id, $folder_id);
// TODO - jump to next message in "history"?
$meta_info = generate_link('Control_Panel&i=pm&folder=' . $folder_id);
$message = $_CLASS['core_user']->lang['MESSAGE_DELETED'];
meta_refresh(3, $meta_info);
$message .= '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>');
trigger_error($message);
} else {
confirm_box(false, 'DELETE_MESSAGE', $s_hidden_fields);
}
}
// Handle User/Group adding/removing
handle_message_list_actions($address_list, $remove_u, $remove_g, $add_to, $add_bcc);
// Check for too many recipients
if (!$config['allow_mass_pm'] && num_recipients($address_list) > 1) {
$address_list = get_recipient_pos($address_list, 1);
$error[] = $_CLASS['core_user']->lang['TOO_MANY_RECIPIENTS'];
}
$message_parser->get_submitted_attachment_data();
if ($message_attachment && !$submit && !$refresh && !$preview && $action == 'edit') {
$sql = 'SELECT attach_id, physical_filename, comment, real_filename, extension, mimetype, filesize, filetime, thumbnail
FROM ' . FORUMS_ATTACHMENTS_TABLE . "\n\t\t\tWHERE post_msg_id = {$msg_id}\n\t\t\t\tAND in_message = 1\n\t\t\t\tORDER BY filetime " . (!$config['display_order'] ? 'DESC' : 'ASC');
$result = $_CLASS['core_db']->query($sql);
$message_parser->attachment_data = array_merge($message_parser->attachment_data, $_CLASS['core_db']->fetch_row_assocset($result));
$_CLASS['core_db']->free_result($result);
}
if (!in_array($action, array('quote', 'edit', 'delete', 'forward'))) {
$enable_sig = $config['allow_sig'] && $_CLASS['auth']->acl_get('u_sig') && $_CLASS['core_user']->optionget('attachsig');
$enable_smilies = $config['allow_smilies'] && $_CLASS['auth']->acl_get('u_pm_smilies') && $_CLASS['core_user']->optionget('smilies');
$enable_bbcode = $config['allow_bbcode'] && $_CLASS['auth']->acl_get('u_pm_bbcode') && $_CLASS['core_user']->optionget('bbcode');
$enable_urls = true;
}
$enable_magic_url = $drafts = false;
示例14: compose_pm
//.........这里部分代码省略.........
if (!($message_time > time() - ($config['pm_edit_time'] * 60) || !$config['pm_edit_time']))
{
trigger_error('CANNOT_EDIT_MESSAGE_TIME');
}
}
if ($action == 'post')
{
$template->assign_var('S_NEW_MESSAGE', true);
}
if (!isset($icon_id))
{
$icon_id = 0;
}
$message_parser = new parse_message();
$message_parser->message = ($action == 'reply') ? '' : $message_text;
unset($message_text);
$s_action = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=$mode&action=$action", true, $user->session_id);
$s_action .= ($msg_id) ? "&p=$msg_id" : '';
// Delete triggered ?
if ($action == 'delete')
{
// Folder id has been determined by the SQL Statement
// $folder_id = request_var('f', PRIVMSGS_NO_BOX);
// Do we need to confirm ?
if (confirm_box(true))
{
delete_pm($user->data['user_id'], $msg_id, $folder_id);
// jump to next message in "history"? nope, not for the moment. But able to be included later.
$meta_info = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&folder=$folder_id");
$message = $user->lang['MESSAGE_DELETED'];
meta_refresh(3, $meta_info);
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>');
trigger_error($message);
}
else
{
$s_hidden_fields = array(
'p' => $msg_id,
'f' => $folder_id,
'action' => 'delete'
);
// "{$phpbb_root_path}ucp.$phpEx?i=pm&mode=compose"
confirm_box(false, 'DELETE_MESSAGE', build_hidden_fields($s_hidden_fields));
}
redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&action=view_message&p=' . $msg_id));
}
// Handle User/Group adding/removing
handle_message_list_actions($address_list, $error, $remove_u, $remove_g, $add_to, $add_bcc);
// Check for too many recipients
if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')) && num_recipients($address_list) > 1)
{
$address_list = get_recipient_pos($address_list, 1);
$error[] = $user->lang['TOO_MANY_RECIPIENTS'];
示例15: handle_mark_actions
/**
* Handle all actions possible with marked messages
*/
function handle_mark_actions($user_id, $mark_action)
{
global $db, $user, $phpbb_root_path, $phpEx;
$msg_ids = request_var('marked_msg_id', array(0));
$cur_folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX);
$confirm = isset($_POST['confirm']) ? true : false;
if (!sizeof($msg_ids)) {
return false;
}
switch ($mark_action) {
case 'mark_important':
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . "\n\t\t\t\tSET pm_marked = 1 - pm_marked\n\t\t\t\tWHERE folder_id = {$cur_folder_id}\n\t\t\t\t\tAND user_id = {$user_id}\n\t\t\t\t\tAND " . $db->sql_in_set('msg_id', $msg_ids);
$db->sql_query($sql);
break;
case 'delete_marked':
if (confirm_box(true)) {
delete_pm($user_id, $msg_ids, $cur_folder_id);
$success_msg = sizeof($msg_ids) == 1 ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED';
$redirect = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&folder=' . $cur_folder_id);
meta_refresh(3, $redirect);
trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $redirect . '">', '</a>'));
} else {
$s_hidden_fields = array('cur_folder_id' => $cur_folder_id, 'mark_option' => 'delete_marked', 'submit_mark' => true, 'marked_msg_id' => $msg_ids);
confirm_box(false, 'DELETE_MARKED_PM', build_hidden_fields($s_hidden_fields));
}
break;
default:
return false;
}
return true;
}