本文整理汇总了PHP中move_pm函数的典型用法代码示例。如果您正苦于以下问题:PHP move_pm函数的具体用法?PHP move_pm怎么用?PHP move_pm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了move_pm函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main($id, $mode)
{
global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $config;
if (!$user->data['is_registered']) {
trigger_error('NO_MESSAGE');
}
// Is PM disabled?
if (!$config['allow_privmsg']) {
trigger_error('PM_DISABLED');
}
$user->add_lang('posting');
$template->assign_var('S_PRIVMSGS', true);
// Folder directly specified?
$folder_specified = request_var('folder', '');
if (!in_array($folder_specified, array('inbox', 'outbox', 'sentbox'))) {
$folder_specified = (int) $folder_specified;
} else {
$folder_specified = $folder_specified == 'inbox' ? PRIVMSGS_INBOX : ($folder_specified == 'outbox' ? PRIVMSGS_OUTBOX : PRIVMSGS_SENTBOX);
}
if (!$folder_specified) {
$mode = !$mode ? request_var('mode', 'view') : $mode;
} else {
$mode = 'view';
}
include $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
switch ($mode) {
// New private messages popup
case 'popup':
$l_new_message = '';
if ($user->data['is_registered']) {
if ($user->data['user_new_privmsg']) {
$l_new_message = $user->data['user_new_privmsg'] == 1 ? $user->lang['YOU_NEW_PM'] : $user->lang['YOU_NEW_PMS'];
} else {
$l_new_message = $user->lang['YOU_NO_NEW_PM'];
}
}
$template->assign_vars(array('MESSAGE' => $l_new_message, 'S_NOT_LOGGED_IN' => $user->data['user_id'] == ANONYMOUS ? true : false, 'CLICK_TO_VIEW' => sprintf($user->lang['CLICK_VIEW_PRIVMSG'], '<a href="' . append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&folder=inbox') . '" onclick="jump_to_inbox(this.href); return false;">', '</a>'), 'U_INBOX' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&folder=inbox'), 'UA_INBOX' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&folder=inbox', false)));
$tpl_file = 'ucp_pm_popup';
break;
// Compose message
// Compose message
case 'compose':
$action = request_var('action', 'post');
get_folder($user->data['user_id']);
if (!$auth->acl_get('u_sendpm')) {
// trigger_error('NO_AUTH_SEND_MESSAGE');
$template->assign_vars(array('S_NO_AUTH_SEND_MESSAGE' => true, 'S_COMPOSE_PM_VIEW' => true));
$tpl_file = 'ucp_pm_viewfolder';
break;
}
include $phpbb_root_path . 'includes/ucp/ucp_pm_compose.' . $phpEx;
compose_pm($id, $mode, $action);
$tpl_file = 'posting_body';
break;
case 'options':
set_user_message_limit();
get_folder($user->data['user_id']);
include $phpbb_root_path . 'includes/ucp/ucp_pm_options.' . $phpEx;
message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions);
$tpl_file = 'ucp_pm_options';
break;
case 'drafts':
get_folder($user->data['user_id']);
$this->p_name = 'pm';
// Call another module... please do not try this at home... Hoochie Coochie Man
include $phpbb_root_path . 'includes/ucp/ucp_main.' . $phpEx;
$module = new ucp_main($this);
$module->u_action = $this->u_action;
$module->main($id, $mode);
$this->tpl_name = $module->tpl_name;
$this->page_title = 'UCP_PM_DRAFTS';
unset($module);
return;
break;
case 'view':
set_user_message_limit();
if ($folder_specified) {
$folder_id = $folder_specified;
$action = 'view_folder';
} else {
$folder_id = request_var('f', PRIVMSGS_NO_BOX);
$action = request_var('action', 'view_folder');
}
$msg_id = request_var('p', 0);
$view = request_var('view', '');
// View message if specified
if ($msg_id) {
$action = 'view_message';
}
if (!$auth->acl_get('u_readpm')) {
trigger_error('NO_AUTH_READ_MESSAGE');
}
// Do not allow hold messages to be seen
if ($folder_id == PRIVMSGS_HOLD_BOX) {
trigger_error('NO_AUTH_READ_HOLD_MESSAGE');
}
// First Handle Mark actions and moving messages
$submit_mark = isset($_POST['submit_mark']) ? true : false;
$move_pm = isset($_POST['move_pm']) ? true : false;
$mark_option = request_var('mark_option', '');
//.........这里部分代码省略.........
示例2: isset
// First Handle Mark actions and moving messages
$submit_mark = isset($_POST['submit_mark']);
$move_pm = isset($_POST['move_pm']);
$mark_option = get_variable('mark_option', 'REQUEST', '');
$dest_folder = get_variable('dest_folder', 'REQUEST', PRIVMSGS_NO_BOX);
// Is moving PM triggered through mark options?
if (!in_array($mark_option, array('mark_important', 'delete_marked')) && $submit_mark) {
$move_pm = true;
$dest_folder = (int) $mark_option;
$submit_mark = false;
}
// Move PM
if ($move_pm) {
$msg_ids = isset($_POST['marked_msg_id']) ? array_unique(array_map('intval', $_POST['marked_msg_id'])) : array();
$cur_folder_id = get_variable('cur_folder_id', 'POST', PRIVMSGS_NO_BOX, 'int');
if (move_pm($_CLASS['core_user']->data['user_id'], $_CLASS['core_user']->data['user_message_limit'], $msg_ids, $dest_folder, $cur_folder_id)) {
// Return to folder view if single message moved
if ($action === 'view_message') {
$msg_id = 0;
$folder_id = $cur_folder_id;
$action = 'view_folder';
}
}
}
// Message Mark Options
if ($submit_mark) {
$mark_option = get_variable('mark_option', 'POST');
$msg_ids = isset($_POST['marked_msg_id']) ? array_unique(array_map('intval', $_POST['marked_msg_id'])) : array();
$cur_folder_id = get_variable('cur_folder_id', 'POST', PRIVMSGS_INBOX, 'int');
switch ($mark_option) {
case 'mark_read':
示例3: ucp_pm
function ucp_pm($id, $mode)
{
global $_CLASS, $site_file_root, $config;
$action = '';
if ($_CLASS['core_user']->data['user_id'] == ANONYMOUS) {
trigger_error('NO_MESSAGE');
}
// Is PM disabled?
if (!$config['allow_privmsg']) {
trigger_error('PM_DISABLED');
}
// This is loaded 2x with drafts
$_CLASS['core_user']->add_lang('posting', 'Forums');
$_CLASS['core_template']->assign('S_PRIVMSGS', true);
// Folder directly specified?
$folder_specified = request_var('folder', '');
if (!in_array($folder_specified, array('inbox', 'outbox', 'sentbox'))) {
$folder_specified = (int) $folder_specified;
} else {
$folder_specified = $folder_specified == 'inbox' ? PRIVMSGS_INBOX : ($folder_specified == 'outbox' ? PRIVMSGS_OUTBOX : PRIVMSGS_SENTBOX);
}
if (!$folder_specified) {
$mode = !$mode ? request_var('mode', 'view_messages') : $mode;
} else {
$mode = 'view_messages';
}
require $site_file_root . 'includes/forums/functions_privmsgs.php';
$tpl_file = 'ucp_pm_' . $mode . '.html';
switch ($mode) {
// New private messages popup
case 'popup':
$indox_link = generate_link('Control_Panel&i=pm&folder=inbox');
if ($_CLASS['core_user']->data['user_id'] != ANONYMOUS) {
if ($_CLASS['core_user']->data['user_new_privmsg']) {
$l_new_message = $_CLASS['core_user']->data['user_new_privmsg'] == 1 ? $_CLASS['core_user']->lang['YOU_NEW_PM'] : $_CLASS['core_user']->lang['YOU_NEW_PMS'];
} else {
$l_new_message = $_CLASS['core_user']->lang['YOU_NO_NEW_PM'];
}
}
$_CLASS['core_template']->assign(array('MESSAGE' => $l_new_message, 'U_JS_RETURN_INBOX' => $indox_link, 'S_NOT_LOGGED_IN' => $_CLASS['core_user']->data['user_id'] == ANONYMOUS ? true : false, 'CLICK_TO_VIEW' => sprintf($_CLASS['core_user']->lang['CLICK_VIEW_PRIVMSG'], '<a href="' . $indox_link . '" onclick="jump_to_inbox();return false;" target="_new">', '</a>'), 'U_INBOX' => $indox_link));
break;
// Compose message
// Compose message
case 'compose':
$action = request_var('action', 'post');
get_folder($_CLASS['core_user']->data['user_id'], $folder);
if (!$_CLASS['auth']->acl_get('u_sendpm')) {
trigger_error('NO_AUTH_SEND_MESSAGE');
}
require $site_file_root . 'modules/Control_Panel/ucp/ucp_pm_compose.php';
compose_pm($id, $mode, $action);
$tpl_file = 'ucp_posting_body.html';
break;
case 'options':
$sql = 'SELECT group_message_limit
FROM ' . GROUPS_TABLE . '
WHERE group_id = ' . $_CLASS['core_user']->data['user_group'];
$result = $_CLASS['core_db']->query($sql);
list($message_limit) = $_CLASS['core_db']->fetch_row_num($result);
$_CLASS['core_db']->free_result($result);
(int) ($_CLASS['core_user']->data['message_limit'] = !$message_limit ? $config['pm_max_msgs'] : $message_limit);
get_folder($_CLASS['core_user']->data['user_id'], $folder);
require $site_file_root . 'modules/Control_Panel/ucp/ucp_pm_options.php';
message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions);
break;
case 'drafts':
get_folder($_CLASS['core_user']->data['user_id'], $folder);
require $site_file_root . 'modules/Control_Panel/ucp/ucp_main.php';
$module = new ucp_main($id, $mode);
unset($module);
exit;
break;
case 'unread':
case 'view_messages':
$sql = 'SELECT group_message_limit
FROM ' . GROUPS_TABLE . '
WHERE group_id = ' . $_CLASS['core_user']->data['user_group'];
$result = $_CLASS['core_db']->query($sql);
list($message_limit) = $_CLASS['core_db']->fetch_row_num($result);
$_CLASS['core_db']->free_result($result);
$_CLASS['core_user']->data['message_limit'] = !$message_limit ? $config['pm_max_msgs'] : $message_limit;
if ($folder_specified) {
$folder_id = $folder_specified;
$action = 'view_folder';
} else {
$folder_id = request_var('f', PRIVMSGS_INBOX);
$action = request_var('action', 'view_folder');
}
$msg_id = request_var('p', 0);
$view = request_var('view', '');
if ($msg_id && $action == 'view_folder') {
$action = 'view_message';
}
if (!$_CLASS['auth']->acl_get('u_readpm')) {
trigger_error('NO_AUTH_READ_MESSAGE');
}
// First Handle Mark actions and moving messages
// Move PM
if (isset($_REQUEST['move_pm'])) {
$move_msg_ids = isset($_POST['marked_msg_id']) ? array_map('intval', $_POST['marked_msg_id']) : array();
//.........这里部分代码省略.........
示例4: move_pm
}
if ($delete) {
$pmmode = 'delete_pms';
$delete = false;
}
if ($savemails) {
$pmmode = 'savemails';
}
//---------------------------------
//
// save marked
//
//---------------------------------
if ($pmmode == 'move_pms') {
// move pm to save folder
move_pm($mark_ids, $view_user_id, $folder_id, $to_folder);
// return to box display
if (!defined('IN_PCP')) {
$return_path = append_sid("{$main_pgm}&folder={$to_folder}&sid=" . $userdata['session_id']);
redirect($return_path);
exit;
} else {
$folder_id = $to_folder;
$folder_main = $folder_id;
if (!empty($folders['main'][$folder_id])) {
$folder_main = $folders['main'][$folder_id];
}
$pmmode = '';
// rebuild the request
switch ($folder_main) {
case INBOX:
示例5: message_options
//.........这里部分代码省略.........
$move_to = request_var('move_to', PRIVMSGS_INBOX);
// Move to same folder?
if ($remove_action == 1 && $remove_folder_id === $move_to) {
trigger_error('CANNOT_MOVE_TO_SAME_FOLDER');
}
// Select custom folder
$sql = 'SELECT folder_name, pm_count
FROM ' . FORUMS_PRIVMSGS_FOLDER_TABLE . '
WHERE user_id = ' . $_CLASS['core_user']->data['user_id'] . "\n\t\t\t\tAND folder_id = {$remove_folder_id}";
$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'])) {
示例6: array
}
$recips = array();
while ($row = $db->sql_fetchrow($result)) {
$recips[] = $row;
}
if (empty($recips)) {
message_die(GENERAL_ERROR, _lang('No_post_id'));
}
//---------------------------------
//
// move
//
//---------------------------------
if ($pmmode == 'move_pm') {
// move pm to save folder
move_pm($privmsg_recip_id, $view_user_id, $folder_id, $to_folder);
// return to box display
if (!defined('IN_PCP')) {
$return_path = append_sid("{$main_pgm}&folder={$to_folder}");
redirect($return_path);
exit;
} else {
$pmmode = 'view';
$folder_id = $to_folder;
$folder_main = $folder_id;
if (!empty($folders['main'][$folder_id])) {
$folder_main = $folders['main'][$folder_id];
}
}
}
//---------------------------------