mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
- fixed move_pm and delete_pm
git-svn-id: file:///svn/phpbb/trunk@4997 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
2ac2d296e0
commit
3f85d01341
2 changed files with 27 additions and 14 deletions
|
@ -35,7 +35,7 @@ function generate_smilies($mode, $forum_id)
|
|||
$user->setup('posting');
|
||||
}
|
||||
|
||||
page_header($user->lang['SMILIES']);
|
||||
page_header($user->lang['EMOTICONS']);
|
||||
|
||||
$template->set_filenames(array(
|
||||
'body' => 'posting_smilies.html')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
//
|
||||
// -------------------------------------------------------------
|
||||
|
||||
// Define Rule processing scheme
|
||||
// Define Rule processing schema
|
||||
// NOTE: might change
|
||||
|
||||
/*
|
||||
|
@ -20,7 +20,7 @@
|
|||
2) Add a new check array to the global_privmsgs_rules variable and the condition array (if one is required)
|
||||
3) Add a new language variable to ucp.php
|
||||
|
||||
The user is then able to select the new rule. It will be checked agains and handled as specified.
|
||||
The user is then able to select the new rule. It will be checked against and handled as specified.
|
||||
To add new actions (yes, checks can be added here too) to the rule management, the core code has to be modified.
|
||||
*/
|
||||
|
||||
|
@ -70,7 +70,7 @@ $global_privmsgs_rules = array(
|
|||
RULE_IS_FRIEND => array('check0' => 'friend', 'function' => '{CHECK0} == 1'),
|
||||
RULE_IS_FOE => array('check0' => 'foe', 'function' => '{CHECK0} == 1'),
|
||||
RULE_IS_USER => array('check0' => 'author_id', 'function' => '{CHECK0} == {USER_ID}'),
|
||||
RULE_IS_GROUP => array('check0' => 'author_in_group', 'function' => '{CHECK0} == {GROUP_ID}')),
|
||||
RULE_IS_GROUP => array('check0' => 'author_in_group', 'function' => 'in_array({GROUP_ID}, {CHECK0})')),
|
||||
|
||||
CHECK_MESSAGE => array(
|
||||
RULE_IS_LIKE => array('check0' => 'message_text', 'function' => 'preg_match("/" . preg_quote({STRING}) . "/i", {CHECK0})'),
|
||||
|
@ -566,16 +566,17 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
|||
}
|
||||
|
||||
// Move PM from one to another folder
|
||||
function move_pm($user_id, $message_limit)
|
||||
function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_folder_id)
|
||||
{
|
||||
global $db, $user;
|
||||
global $_POST, $phpbb_root_path, $phpEx, $SID;
|
||||
global $phpbb_root_path, $phpEx, $SID;
|
||||
|
||||
$move_msg_ids = (isset($_POST['marked_msg_id'])) ? array_map('intval', $_POST['marked_msg_id']) : array();
|
||||
$dest_folder = request_var('dest_folder', PRIVMSGS_NO_BOX);
|
||||
$cur_folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX);
|
||||
$num_moved = 0;
|
||||
|
||||
$num_moved = 0;
|
||||
if (!is_array($move_msg_ids))
|
||||
{
|
||||
$move_msg_ids = array($move_msg_ids);
|
||||
}
|
||||
|
||||
if (sizeof($move_msg_ids) && !in_array($dest_folder, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) &&
|
||||
!in_array($cur_folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) && $cur_folder_id != $dest_folder)
|
||||
|
@ -804,11 +805,24 @@ function delete_pm($user_id, $msg_ids, $folder_id)
|
|||
// then mark the message as deleted...
|
||||
if ($folder_id == PRIVMSGS_OUTBOX)
|
||||
{
|
||||
// TODO: Recipients will see the message as deleted later
|
||||
// Remove PM from Outbox
|
||||
$sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . "
|
||||
WHERE user_id = $user_id AND folder_id = " . PRIVMSGS_OUTBOX . '
|
||||
AND msg_id IN (' . implode(', ', array_keys($delete_rows)) . ')';
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Update PM Information for safety
|
||||
$sql = 'UPDATE ' . PRIVMSGS_TABLE . " SET message_text = ''
|
||||
WHERE msg_id IN (" . implode(', ', array_keys($delete_rows)) . ')';
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Set delete flag for those intended to receive the PM
|
||||
// We do not remove the message actually, to retain some basic informations (sent time for example)
|
||||
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . '
|
||||
SET deleted = 1, msg_id = 0
|
||||
SET deleted = 1
|
||||
WHERE msg_id IN (' . implode(', ', array_keys($delete_rows)) . ')';
|
||||
$db->sql_query($sql);
|
||||
|
||||
$num_deleted = $db->sql_affectedrows();
|
||||
}
|
||||
else
|
||||
|
@ -856,7 +870,7 @@ function delete_pm($user_id, $msg_ids, $folder_id)
|
|||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$delete_ids = implode(', ', $delete_rows);
|
||||
$delete_ids = implode(', ', array_keys($delete_rows));
|
||||
|
||||
if ($delete_ids)
|
||||
{
|
||||
|
@ -1411,5 +1425,4 @@ function pm_notification($mode, $author, $recipients, $subject, $message)
|
|||
unset($messenger);
|
||||
}
|
||||
|
||||
|
||||
?>
|
Loading…
Add table
Reference in a new issue