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: pm.php 3879 2008-06-01 15:48:47Z Tikitiki $
| * $Id: pm.php 4372 2009-05-15 16:13:13Z Tomm $
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 205 | Zeile 205 |
---|
// Check that this recipient actually exists $query = $db->simple_select("users", "*", "uid='".intval($uid)."'"); $user = $db->fetch_array($query);
|
// Check that this recipient actually exists $query = $db->simple_select("users", "*", "uid='".intval($uid)."'"); $user = $db->fetch_array($query);
|
if($recipient_type == "bcc")
| if($recipient_type == "bccid")
|
{ $user['bcc'] = 1; }
| { $user['bcc'] = 1; }
|
Zeile 225 | Zeile 225 |
---|
// If we have one or more invalid recipients and we're not saving a draft, error if(count($invalid_recipients) > 0) {
|
// If we have one or more invalid recipients and we're not saving a draft, error if(count($invalid_recipients) > 0) {
|
$invalid_recipients = implode(", ", $invalid_recipients);
| $invalid_recipients = implode(", ", array_map("htmlspecialchars_uni", $invalid_recipients));
|
$this->set_error("invalid_recipients", array($invalid_recipients)); return false; }
| $this->set_error("invalid_recipients", array($invalid_recipients)); return false; }
|
Zeile 257 | Zeile 257 |
---|
$this->set_error("recipient_is_ignoring", array($user['username'])); } }
|
$this->set_error("recipient_is_ignoring", array($user['username'])); } }
|
} // Can the recipient actually receive private messages based on their permissions or user setting? if($user['receivepms'] == 0 || $recipient_permissions['canusepms'] == 0 && !$pm['saveasdraft']) { $this->set_error("recipient_pms_disabled", array($user['username'])); return false;
| // Can the recipient actually receive private messages based on their permissions or user setting? if(($user['receivepms'] == 0 || $recipient_permissions['canusepms'] == 0) && !$pm['saveasdraft']) { $this->set_error("recipient_pms_disabled", array($user['username'])); return false; }
|
} // Check to see if the user has reached their private message quota - if they have, email them.
|
} // Check to see if the user has reached their private message quota - if they have, email them.
|
if($recipient_permissions['pmquota'] != "0" && $recipient['pms_total'] >= $recipient_permissions['pmquota'] && $recipient_permissions['cancp'] != 1 && $sender_permissions['cancp'] != 1 && !$pm['saveasdraft'] && !$this->admin_override)
| if($recipient_permissions['pmquota'] != "0" && $user['totalpms'] >= $recipient_permissions['pmquota'] && $recipient_permissions['cancp'] != 1 && $sender_permissions['cancp'] != 1 && !$pm['saveasdraft'] && !$this->admin_override)
|
{ if(trim($user['language']) != '' && $lang->language_exists($user['language'])) {
| { if(trim($user['language']) != '' && $lang->language_exists($user['language'])) {
|
Zeile 322 | Zeile 322 |
---|
$pm['recipients'][$user['uid']]['bcc'] = 1; } }
|
$pm['recipients'][$user['uid']]['bcc'] = 1; } }
|
| return true; } /** * Verify that the user is not flooding the system. * Temporary fix until a better one can be made for 1.6 * * @return boolean True */ function verify_pm_flooding() { global $mybb, $db;
$pm = &$this->data; // Check if post flooding is enabled within MyBB or if the admin override option is specified. if($mybb->settings['postfloodcheck'] == 1 && $pm['fromid'] != 0 && $this->admin_override == false) { // Fetch the senders profile data. $sender = get_user($pm['fromid']); // Calculate last post $query = $db->simple_select("privatemessages", "dateline", "fromid='".$db->escape_string($pm['fromid'])."'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit' => 1)); $sender['lastpm'] = $db->fetch_field($query, "dateline");
// A little bit of calculation magic and moderator status checking. if(TIME_NOW-$sender['lastpm'] <= $mybb->settings['postfloodsecs'] && !is_moderator("", "", $pm['fromid'])) { // Oops, user has been flooding - throw back error message. $time_to_wait = ($mybb->settings['postfloodsecs'] - (TIME_NOW-$sender['lastpm'])) + 1; if($time_to_wait == 1) { $this->set_error("pm_flooding_one_second"); } else { $this->set_error("pm_flooding", array($time_to_wait)); } return false; } } // All is well that ends well - return true.
|
return true; }
| return true; }
|
Zeile 427 | Zeile 469 |
---|
$uid = 0;
|
$uid = 0;
|
if(!is_array($pm['recipients'])) {
| if(!is_array($pm['recipients'])) {
|
$recipient_list = array(); }
|
$recipient_list = array(); }
|
else {
| else {
|
// Build recipient list foreach($pm['recipients'] as $recipient) {
| // Build recipient list foreach($pm['recipients'] as $recipient) {
|
Zeile 448 | Zeile 492 |
---|
$recipient_list = serialize($recipient_list);
$this->pm_insert_data = array(
|
$recipient_list = serialize($recipient_list);
$this->pm_insert_data = array(
|
'fromid' => $pm['sender']['uid'],
| 'fromid' => intval($pm['sender']['uid']),
|
'folder' => $pm['folder'], 'subject' => $db->escape_string($pm['subject']), 'icon' => intval($pm['icon']),
| 'folder' => $pm['folder'], 'subject' => $db->escape_string($pm['subject']), 'icon' => intval($pm['icon']),
|
Zeile 463 | Zeile 507 |
---|
);
// Check if we're updating a draft or not.
|
);
// Check if we're updating a draft or not.
|
$query = $db->simple_select("privatemessages", "pmid", "folder='3' AND uid='{$pm['sender']['uid']}' AND pmid='{$pm['pmid']}'");
| $query = $db->simple_select("privatemessages", "pmid", "folder='3' AND uid='".intval($pm['sender']['uid'])."' AND pmid='{$pm['pmid']}'");
|
$draftcheck = $db->fetch_array($query);
// This PM was previously a draft
| $draftcheck = $db->fetch_array($query);
// This PM was previously a draft
|
Zeile 506 | Zeile 550 |
---|
{ $uselang = "english"; }
|
{ $uselang = "english"; }
|
if($uselang == $mybb->settings['bblanguage'])
| if($uselang == $mybb->settings['bblanguage'] && !empty($lang->emailsubject_newpm))
|
{ $emailsubject = $lang->emailsubject_newpm; $emailmessage = $lang->email_newpm;
| { $emailsubject = $lang->emailsubject_newpm; $emailmessage = $lang->email_newpm;
|
Zeile 514 | Zeile 558 |
---|
else { $userlang = new MyLanguage;
|
else { $userlang = new MyLanguage;
|
$userlang->set_path("./inc/languages");
| $userlang->set_path(MYBB_ROOT."inc/languages");
|
$userlang->set_language($uselang); $userlang->load("messages"); $emailsubject = $userlang->emailsubject_newpm; $emailmessage = $userlang->email_newpm; }
|
$userlang->set_language($uselang); $userlang->load("messages"); $emailsubject = $userlang->emailsubject_newpm; $emailmessage = $userlang->email_newpm; }
|
| if(!$pm['sender']['username']) { $pm['sender']['username'] = 'MyBB Engine'; }
|
$emailmessage = $lang->sprintf($emailmessage, $recipient['username'], $pm['sender']['username'], $mybb->settings['bbname'], $mybb->settings['bburl']); $emailsubject = $lang->sprintf($emailsubject, $mybb->settings['bbname']); my_mail($recipient['email'], $emailsubject, $emailmessage); }
|
$emailmessage = $lang->sprintf($emailmessage, $recipient['username'], $pm['sender']['username'], $mybb->settings['bbname'], $mybb->settings['bburl']); $emailsubject = $lang->sprintf($emailsubject, $mybb->settings['bbname']); my_mail($recipient['email'], $emailsubject, $emailmessage); }
|
|
|
$this->pm_insert_data['uid'] = $recipient['uid']; $this->pm_insert_data['toid'] = $recipient['uid'];
|
$this->pm_insert_data['uid'] = $recipient['uid']; $this->pm_insert_data['toid'] = $recipient['uid'];
|
|
|
$plugins->run_hooks_by_ref("datahandler_pm_insert", $this); $this->pmid = $db->insert_query("privatemessages", $this->pm_insert_data);
| $plugins->run_hooks_by_ref("datahandler_pm_insert", $this); $this->pmid = $db->insert_query("privatemessages", $this->pm_insert_data);
|
Zeile 538 | Zeile 588 |
---|
"pmnotice" => 2 ); $db->update_query("users", $updated_user, "uid='{$recipient['uid']}'");
|
"pmnotice" => 2 ); $db->update_query("users", $updated_user, "uid='{$recipient['uid']}'");
|
}
| }
|
// Update private message count (total, new and unread) for recipient require_once MYBB_ROOT."/inc/functions_user.php"; update_pm_count($recipient['uid'], 7, $recipient['lastactive']);
|
// Update private message count (total, new and unread) for recipient require_once MYBB_ROOT."/inc/functions_user.php"; update_pm_count($recipient['uid'], 7, $recipient['lastactive']);
|
}
| }
|
// Are we replying or forwarding an existing PM? if($pm['pmid']) { if($pm['do'] == "reply")
|
// Are we replying or forwarding an existing PM? if($pm['pmid']) { if($pm['do'] == "reply")
|
{
| {
|
$sql_array = array( 'status' => 3,
|
$sql_array = array( 'status' => 3,
|
'statustime' => TIME_NOW ); $db->update_query("privatemessages", $sql_array, "pmid={$pm['pmid']} AND uid={$pm['sender']['uid']}");
| 'statustime' => TIME_NOW ); $db->update_query("privatemessages", $sql_array, "pmid={$pm['pmid']} AND uid={$pm['sender']['uid']}");
|
} elseif($pm['do'] == "forward") {
| } elseif($pm['do'] == "forward") {
|
Zeile 563 | Zeile 613 |
---|
'statustime' => TIME_NOW ); $db->update_query("privatemessages", $sql_array, "pmid={$pm['pmid']} AND uid={$pm['sender']['uid']}");
|
'statustime' => TIME_NOW ); $db->update_query("privatemessages", $sql_array, "pmid={$pm['pmid']} AND uid={$pm['sender']['uid']}");
|
}
| }
|
}
// If we're saving a copy
| }
// If we're saving a copy
|
Zeile 577 | Zeile 627 |
---|
{ $this->pm_insert_data['toid'] = 0; }
|
{ $this->pm_insert_data['toid'] = 0; }
|
$this->pm_insert_data['uid'] = $pm['sender']['uid'];
| $this->pm_insert_data['uid'] = intval($pm['sender']['uid']);
|
$this->pm_insert_data['folder'] = 2; $this->pm_insert_data['status'] = 1; $this->pm_insert_data['receipt'] = 0;
| $this->pm_insert_data['folder'] = 2; $this->pm_insert_data['status'] = 1; $this->pm_insert_data['receipt'] = 0;
|