Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: private.php 4188 2008-09-14 05:05:26Z Tikitiki $
| * $Id: private.php 4330 2009-03-16 02:17:06Z Tikitiki $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 347 | Zeile 347 |
---|
// Get list of recipients $recipients = unserialize($pm['recipients']); $comma = '';
|
// Get list of recipients $recipients = unserialize($pm['recipients']); $comma = '';
|
$recipientids = $pm['fromid'];
| |
if(isset($recipients['to']) && is_array($recipients['to'])) { foreach($recipients['to'] as $recipient)
| if(isset($recipients['to']) && is_array($recipients['to'])) { foreach($recipients['to'] as $recipient)
|
Zeile 357 | Zeile 356 |
---|
$comma = ','; } }
|
$comma = ','; } }
|
|
|
if(isset($recipients['bcc']) && is_array($recipients['bcc']))
|
if(isset($recipients['bcc']) && is_array($recipients['bcc']))
|
{
| {
|
foreach($recipients['bcc'] as $recipient)
|
foreach($recipients['bcc'] as $recipient)
|
{
| {
|
$recipient_list['bcc'][] = $recipient; $recipientids .= $comma.$recipient; $comma = ','; } }
|
$recipient_list['bcc'][] = $recipient; $recipientids .= $comma.$recipient; $comma = ','; } }
|
$query = $db->simple_select("users", "uid, username", "uid IN ({$recipientids})"); while($user = $db->fetch_array($query)) { if(isset($recipients['bcc']) && is_array($recipients['bcc']) && in_array($user['uid'], $recipient_list['bcc'])) { $bcc .= htmlspecialchars_uni($user['username']).', '; } else { $to .= htmlspecialchars_uni($user['username']).', ';
| if(!empty($recipientids)) { $query = $db->simple_select("users", "uid, username", "uid IN ({$recipientids})"); while($user = $db->fetch_array($query)) { if(isset($recipients['bcc']) && is_array($recipients['bcc']) && in_array($user['uid'], $recipient_list['bcc'])) { $bcc .= htmlspecialchars_uni($user['username']).', '; } else { $to .= htmlspecialchars_uni($user['username']).', '; }
|
}
|
}
|
}
| }
|
} else { // forward/reply
| } else { // forward/reply
|
Zeile 387 | Zeile 389 |
---|
$postdate = my_date($mybb->settings['dateformat'], $pm['dateline']); $posttime = my_date($mybb->settings['timeformat'], $pm['dateline']); $message = "[quote={$pm['quotename']}]\n$message\n[/quote]";
|
$postdate = my_date($mybb->settings['dateformat'], $pm['dateline']); $posttime = my_date($mybb->settings['timeformat'], $pm['dateline']); $message = "[quote={$pm['quotename']}]\n$message\n[/quote]";
|
$pm['message'] = preg_replace('#^/me (.*)$#im', "* ".$pm['quotename']." \\1", $pm['message']);
| $message = preg_replace('#^/me (.*)$#im', "* ".$pm['quotename']." \\1", $message);
|
if($mybb->input['do'] == 'forward') { $subject = "Fw: $subject"; } elseif($mybb->input['do'] == 'reply')
|
if($mybb->input['do'] == 'forward') { $subject = "Fw: $subject"; } elseif($mybb->input['do'] == 'reply')
|
{
| {
|
$subject = "Re: $subject"; $uid = $pm['fromid']; if($mybb->user['uid'] == $uid)
| $subject = "Re: $subject"; $uid = $pm['fromid']; if($mybb->user['uid'] == $uid)
|
Zeile 442 | Zeile 444 |
---|
{ $query = $db->simple_select('users', 'username', "uid='".$db->escape_string($mybb->input['uid'])."'"); $to = htmlspecialchars_uni($db->fetch_field($query, 'username')).', ';
|
{ $query = $db->simple_select('users', 'username', "uid='".$db->escape_string($mybb->input['uid'])."'"); $to = htmlspecialchars_uni($db->fetch_field($query, 'username')).', ';
|
}
| }
|
$max_recipients = ''; if($mybb->usergroup['maxpmrecipients'] > 0)
|
$max_recipients = ''; if($mybb->usergroup['maxpmrecipients'] > 0)
|
{
| {
|
$max_recipients = $lang->sprintf($lang->max_recipients, $mybb->usergroup['maxpmrecipients']);
|
$max_recipients = $lang->sprintf($lang->max_recipients, $mybb->usergroup['maxpmrecipients']);
|
}
| }
|
if($send_errors) {
| if($send_errors) {
|
Zeile 458 | Zeile 460 |
---|
// Load the auto complete javascript if it is enabled. eval("\$autocompletejs = \"".$templates->get("private_send_autocomplete")."\";");
|
// Load the auto complete javascript if it is enabled. eval("\$autocompletejs = \"".$templates->get("private_send_autocomplete")."\";");
|
|
|
$pmid = $mybb->input['pmid']; $do = $mybb->input['do']; if($do != "forward" && $do != "reply")
|
$pmid = $mybb->input['pmid']; $do = $mybb->input['do']; if($do != "forward" && $do != "reply")
|
{
| {
|
$do = '';
|
$do = '';
|
}
| }
|
// See if it's actually worth showing the buddylist icon. if($mybb->user['buddylist'] != '')
| // See if it's actually worth showing the buddylist icon. if($mybb->user['buddylist'] != '')
|
Zeile 474 | Zeile 476 |
---|
$buddy_select = 'bcc'; eval("\$buddy_select_bcc = \"".$templates->get("private_send_buddyselect")."\";"); }
|
$buddy_select = 'bcc'; eval("\$buddy_select_bcc = \"".$templates->get("private_send_buddyselect")."\";"); }
|
|
|
eval("\$send = \"".$templates->get("private_send")."\";"); $plugins->run_hooks("private_send_end"); output_page($send); }
|
eval("\$send = \"".$templates->get("private_send")."\";"); $plugins->run_hooks("private_send_end"); output_page($send); }
|
|
|
if($mybb->input['action'] == "read") { $plugins->run_hooks("private_read");
|
if($mybb->input['action'] == "read") { $plugins->run_hooks("private_read");
|
|
|
$pmid = intval($mybb->input['pmid']);
$query = $db->query(" SELECT pm.*, u.*, f.*, g.title AS grouptitle, g.usertitle AS groupusertitle, g.stars AS groupstars, g.starimage AS groupstarimage, g.image AS groupimage, g.namestyle
|
$pmid = intval($mybb->input['pmid']);
$query = $db->query(" SELECT pm.*, u.*, f.*, g.title AS grouptitle, g.usertitle AS groupusertitle, g.stars AS groupstars, g.starimage AS groupstarimage, g.image AS groupimage, g.namestyle
|
FROM ".TABLE_PREFIX."privatemessages pm
| FROM ".TABLE_PREFIX."privatemessages pm
|
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=pm.fromid) LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid) LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup)
| LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=pm.fromid) LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid) LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup)
|
Zeile 497 | Zeile 499 |
---|
"); $pm = $db->fetch_array($query); if($pm['folder'] == 3)
|
"); $pm = $db->fetch_array($query); if($pm['folder'] == 3)
|
{
| {
|
header("Location: private.php?action=send&pmid={$pm['pmid']}"); exit; }
| header("Location: private.php?action=send&pmid={$pm['pmid']}"); exit; }
|
Zeile 505 | Zeile 507 |
---|
if(!$pm['pmid']) { error($lang->error_invalidpm);
|
if(!$pm['pmid']) { error($lang->error_invalidpm);
|
}
| }
|
if($pm['receipt'] == 1) {
| if($pm['receipt'] == 1) {
|
Zeile 552 | Zeile 554 |
---|
$reply_date = my_date($mybb->settings['dateformat'], $pm['statustime']); if($reply_date == $lang->today || $reply_date == $lang->yesterday)
|
$reply_date = my_date($mybb->settings['dateformat'], $pm['statustime']); if($reply_date == $lang->today || $reply_date == $lang->yesterday)
|
{
| {
|
$reply_date .= ', '.my_date($mybb->settings['timeformat'], $pm['statustime']); $actioned_on = $lang->sprintf($lang->you_replied, $reply_date); }
| $reply_date .= ', '.my_date($mybb->settings['timeformat'], $pm['statustime']); $actioned_on = $lang->sprintf($lang->you_replied, $reply_date); }
|
Zeile 600 | Zeile 602 |
---|
{ $uid_sql = $pm['toid']; $pm['recipients']['to'] = array($pm['toid']);
|
{ $uid_sql = $pm['toid']; $pm['recipients']['to'] = array($pm['toid']);
|
}
| }
|
$show_bcc = 0;
| $show_bcc = 0;
|
Zeile 615 | Zeile 617 |
---|
$bcc_recipients = $to_recipients = array(); $query = $db->simple_select('users', 'uid, username', "uid IN ({$uid_sql})"); while($recipient = $db->fetch_array($query))
|
$bcc_recipients = $to_recipients = array(); $query = $db->simple_select('users', 'uid, username', "uid IN ({$uid_sql})"); while($recipient = $db->fetch_array($query))
|
{
| {
|
// User is a BCC recipient if($show_bcc && in_array($recipient['uid'], $pm['recipients']['bcc'])) {
| // User is a BCC recipient if($show_bcc && in_array($recipient['uid'], $pm['recipients']['bcc'])) {
|
Zeile 868 | Zeile 870 |
---|
$val = ''; } break;
|
$val = ''; } break;
|
}
| }
|
} if($val != '' && trim($val) == '' && !($key >= 1 && $key <= 4))
| } if($val != '' && trim($val) == '' && !($key >= 1 && $key <= 4))
|
Zeile 898 | Zeile 900 |
---|
} } else
|
} } else
|
{
| {
|
// Delete PMs from the folder $db->delete_query("privatemessages", "folder='$fid' AND uid='".$mybb->user['uid']."'"); }
| // Delete PMs from the folder $db->delete_query("privatemessages", "folder='$fid' AND uid='".$mybb->user['uid']."'"); }
|
Zeile 909 | Zeile 911 |
---|
"pmfolders" => $folders ); $db->update_query("users", $sql_array, "uid='".$mybb->user['uid']."'");
|
"pmfolders" => $folders ); $db->update_query("users", $sql_array, "uid='".$mybb->user['uid']."'");
|
// Update PM count update_pm_count(); $plugins->run_hooks("private_do_folders_end");
| // Update PM count update_pm_count(); $plugins->run_hooks("private_do_folders_end");
|
redirect("private.php", $lang->redirect_pmfoldersupdated); }
| redirect("private.php", $lang->redirect_pmfoldersupdated); }
|
Zeile 960 | Zeile 962 |
---|
$emptyq .= " OR "; } $emptyq .= "folder='$key'";
|
$emptyq .= " OR "; } $emptyq .= "folder='$key'";
|
}
| }
|
} if($emptyq != '')
| } if($emptyq != '')
|
Zeile 992 | Zeile 994 |
---|
header("Location: private.php?fid=".intval($mybb->input['jumpto'])); } elseif($mybb->input['moveto'])
|
header("Location: private.php?fid=".intval($mybb->input['jumpto'])); } elseif($mybb->input['moveto'])
|
{ if(is_array($mybb->input['check'])) {
| { if(is_array($mybb->input['check'])) {
|
foreach($mybb->input['check'] as $key => $val) { $sql_array = array(
| foreach($mybb->input['check'] as $key => $val) { $sql_array = array(
|
Zeile 1042 | Zeile 1044 |
---|
if($deletepms[$key]) { $db->delete_query("privatemessages", "pmid='$key' AND uid='".$mybb->user['uid']."'");
|
if($deletepms[$key]) { $db->delete_query("privatemessages", "pmid='$key' AND uid='".$mybb->user['uid']."'");
|
}
| }
|
else { $sql_array = array(
| else { $sql_array = array(
|
Zeile 1057 | Zeile 1059 |
---|
update_pm_count();
redirect("private.php", $lang->redirect_pmsdeleted);
|
update_pm_count();
redirect("private.php", $lang->redirect_pmsdeleted);
|
} }
| } }
|
if($mybb->input['action'] == "delete") {
| if($mybb->input['action'] == "delete") {
|
Zeile 1086 | Zeile 1088 |
---|
$folderlist = "<select name=\"exportfolders[]\" multiple=\"multiple\">\n"; $folderlist .= "<option value=\"all\" selected=\"selected\">$lang->all_folders</option>";
|
$folderlist = "<select name=\"exportfolders[]\" multiple=\"multiple\">\n"; $folderlist .= "<option value=\"all\" selected=\"selected\">$lang->all_folders</option>";
|
$foldersexploded = explode("$%%$", $mybb->user['pmfolders']); foreach($foldersexploded as $key => $folders) { $folderinfo = explode("**", $folders, 2); $folderinfo[1] = get_pm_folder_name($folderinfo[0], $folderinfo[1]);
| $foldersexploded = explode("$%%$", $mybb->user['pmfolders']); foreach($foldersexploded as $key => $folders) { $folderinfo = explode("**", $folders, 2); $folderinfo[1] = get_pm_folder_name($folderinfo[0], $folderinfo[1]);
|
$folderlist .= "<option value=\"$folderinfo[0]\">$folderinfo[1]</option>\n"; } $folderlist .= "</select>\n";
| $folderlist .= "<option value=\"$folderinfo[0]\">$folderinfo[1]</option>\n"; } $folderlist .= "</select>\n";
|
Zeile 1121 | Zeile 1123 |
---|
} if($mybb->input['pmid'])
|
} if($mybb->input['pmid'])
|
{
| {
|
$wsql = "pmid='".intval($mybb->input['pmid'])."' AND uid='".$mybb->user['uid']."'"; } else
| $wsql = "pmid='".intval($mybb->input['pmid'])."' AND uid='".$mybb->user['uid']."'"; } else
|
Zeile 1131 | Zeile 1133 |
---|
$datecut = TIME_NOW-($mybb->input['daycut'] * 86400); $wsql = "pm.dateline"; if($mybb->input['dayway'] == "older")
|
$datecut = TIME_NOW-($mybb->input['daycut'] * 86400); $wsql = "pm.dateline"; if($mybb->input['dayway'] == "older")
|
{
| {
|
$wsql .= "<="; } else { $wsql .= ">=";
|
$wsql .= "<="; } else { $wsql .= ">=";
|
}
| }
|
$wsql .= "'$datecut'";
|
$wsql .= "'$datecut'";
|
}
| }
|
else
|
else
|
{
| {
|
$wsql = "1=1"; }
| $wsql = "1=1"; }
|
Zeile 1153 | Zeile 1155 |
---|
{ $val = $db->escape_string($val); if($val == "all")
|
{ $val = $db->escape_string($val); if($val == "all")
|
{
| {
|
$folderlst = ''; break; }
| $folderlst = ''; break; }
|
Zeile 1183 | Zeile 1185 |
---|
if($mybb->input['exportunread'] != 1) { $wsql .= " AND pm.status!='0'";
|
if($mybb->input['exportunread'] != 1) { $wsql .= " AND pm.status!='0'";
|
} }
| } }
|
$query = $db->query(" SELECT pm.*, fu.username AS fromusername, tu.username AS tousername FROM ".TABLE_PREFIX."privatemessages pm
| $query = $db->query(" SELECT pm.*, fu.username AS fromusername, tu.username AS tousername FROM ".TABLE_PREFIX."privatemessages pm
|
Zeile 1215 | Zeile 1217 |
---|
{ $tofromusername = build_profile_link($message['tousername'], $tofromuid); }
|
{ $tofromusername = build_profile_link($message['tousername'], $tofromuid); }
|
} else
| } else
|
{ $tofromusername = $lang->not_sent; }
| { $tofromusername = $lang->not_sent; }
|
Zeile 1226 | Zeile 1228 |
---|
{ $tofromuid = $message['fromid']; if($mybb->input['exporttype'] == "txt")
|
{ $tofromuid = $message['fromid']; if($mybb->input['exporttype'] == "txt")
|
{
| {
|
$tofromusername = $message['fromusername']; } else { $tofromusername = build_profile_link($message['fromusername'], $tofromuid);
|
$tofromusername = $message['fromusername']; } else { $tofromusername = build_profile_link($message['fromusername'], $tofromuid);
|
}
| }
|
if($tofromuid == 0) { $tofromusername = "MyBB Engine"; } $tofrom = $lang->from;
|
if($tofromuid == 0) { $tofromusername = "MyBB Engine"; } $tofrom = $lang->from;
|
}
| }
|
if($tofromuid == 0) { $message['fromusername'] = "MyBB Engine"; } if(!$message['toid'] && $message['folder'] == 3)
|
if($tofromuid == 0) { $message['fromusername'] = "MyBB Engine"; } if(!$message['toid'] && $message['folder'] == 3)
|
{
| {
|
$message['tousername'] = $lang->not_sent; }
| $message['tousername'] = $lang->not_sent; }
|
Zeile 1279 | Zeile 1281 |
---|
} if($mybb->input['exporttype'] == "txt" || $mybb->input['exporttype'] == "csv")
|
} if($mybb->input['exporttype'] == "txt" || $mybb->input['exporttype'] == "csv")
|
{
| {
|
$message['message'] = str_replace("\r\n", "\n", $message['message']); $message['message'] = str_replace("\n", "\r\n", $message['message']); }
| $message['message'] = str_replace("\r\n", "\n", $message['message']); $message['message'] = str_replace("\n", "\r\n", $message['message']); }
|
Zeile 1329 | Zeile 1331 |
---|
eval("\$archived = \"".$templates->get("private_archive_".$mybb->input['exporttype'], 1, 0)."\";"); if($mybb->input['deletepms'] == 1) { // delete the archived pms
|
eval("\$archived = \"".$templates->get("private_archive_".$mybb->input['exporttype'], 1, 0)."\";"); if($mybb->input['deletepms'] == 1) { // delete the archived pms
|
$db->delete_query("privatemessages", "pmid IN (''$ids)");
| $db->delete_query("privatemessages", "pmid IN ('0'$ids)");
|
// Update PM count update_pm_count(); }
| // Update PM count update_pm_count(); }
|
Zeile 1343 | Zeile 1345 |
---|
{ $filename = "pm-archive.csv"; $contenttype = "application/octet-stream";
|
{ $filename = "pm-archive.csv"; $contenttype = "application/octet-stream";
|
}
| }
|
else
|
else
|
{
| {
|
$filename = "pm-archive.txt"; $contenttype = "text/plain"; }
|
$filename = "pm-archive.txt"; $contenttype = "text/plain"; }
|
|
|
$archived = str_replace("\\\'","'",$archived); header("Content-disposition: filename=$filename"); header("Content-type: ".$contenttype);
|
$archived = str_replace("\\\'","'",$archived); header("Content-disposition: filename=$filename"); header("Content-type: ".$contenttype);
|
|
|
$plugins->run_hooks("private_do_export_end"); if($mybb->input['exporttype'] == "html") { output_page($archived);
|
$plugins->run_hooks("private_do_export_end"); if($mybb->input['exporttype'] == "html") { output_page($archived);
|
}
| }
|
else
|
else
|
{
| {
|
echo $archived;
|
echo $archived;
|
}
| }
|
}
if(!$mybb->input['action']) { $plugins->run_hooks("private_start");
|
}
if(!$mybb->input['action']) { $plugins->run_hooks("private_start");
|
|
|
if(!$mybb->input['fid']) { $mybb->input['fid'] = 1; }
|
if(!$mybb->input['fid']) { $mybb->input['fid'] = 1; }
|
| $folder = '';
|
$foldersexploded = explode("$%%$", $mybb->user['pmfolders']); foreach($foldersexploded as $key => $folders) {
| $foldersexploded = explode("$%%$", $mybb->user['pmfolders']); foreach($foldersexploded as $key => $folders) {
|
Zeile 1436 | Zeile 1439 |
---|
{ // Get all recipients into an array $cached_users = $get_users = array();
|
{ // Get all recipients into an array $cached_users = $get_users = array();
|
$users_query = $db->simple_select("privatemessages", "recipients", "folder='$folder' AND uid='{$mybb->user['uid']}'", array('limit_start' => $start, 'limit' => $perpage));
| $users_query = $db->simple_select("privatemessages", "recipients", "folder='$folder' AND uid='{$mybb->user['uid']}'", array('limit_start' => $start, 'limit' => $perpage, 'order_by' => 'dateline', 'order_dir' => 'DESC'));
|
while($row = $db->fetch_array($users_query)) { $recipients = unserialize($row['recipients']);
| while($row = $db->fetch_array($users_query)) { $recipients = unserialize($row['recipients']);
|
Zeile 1564 | Zeile 1567 |
---|
if($message['icon'] > 0 && $icon_cache[$message['icon']]) { $icon = $icon_cache[$message['icon']];
|
if($message['icon'] > 0 && $icon_cache[$message['icon']]) { $icon = $icon_cache[$message['icon']];
|
$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" valign=\"middle\" align=\"center\" /> ";
| $icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" align=\"center\" valign=\"middle\" />";
|
} else {
|
} else {
|
$icon = '';
| $icon = ' ';
|
} if(!trim($message['subject']))
| } if(!trim($message['subject']))
|