Example #1
0
if ($valid && isset($_POST['send'])) {
    if (post_check_ddkey($t_dedupe)) {
        if (isset($to_radio) && $to_radio == 'friends') {
            if ($new_mid = pm_send_message($t_to_uid, $uid, $t_subject, $t_content, $aid)) {
                email_send_pm_notification($t_to_uid, $new_mid, $uid);
            } else {
                $error_msg_array[] = gettext("Error creating PM! Please try again in a few minutes");
                $valid = false;
            }
            if (isset($t_edit_mid) && is_numeric($t_edit_mid)) {
                pm_delete_message($t_edit_mid);
            }
        } else {
            foreach ($t_new_recipient_array['TO_UID'] as $t_to_uid) {
                if ($new_mid = pm_send_message($t_to_uid, $uid, $t_subject, $t_content, $aid)) {
                    email_send_pm_notification($t_to_uid, $new_mid, $uid);
                } else {
                    $error_msg_array[] = gettext("Error creating PM! Please try again in a few minutes");
                    $valid = false;
                }
            }
            if (isset($t_edit_mid) && is_numeric($t_edit_mid)) {
                pm_delete_message($t_edit_mid);
            }
        }
    }
    if ($valid) {
        header_redirect("lpm.php?webtag={$webtag}&message_sent=true");
        exit;
    }
} else {
Example #2
0
    $valid = false;
}
if (isset($_POST['dedupe']) && is_numeric($_POST['dedupe'])) {
    $dedupe = $_POST['dedupe'];
} else {
    $dedupe = time();
}
if ($valid && isset($_POST['send'])) {
    if (post_check_ddkey($dedupe)) {
        if (isset($edit_mid)) {
            $new_mid = pm_send_saved_message($edit_mid, $_SESSION['UID'], $to_logon_array, $subject, $content, $reply_mid);
        } else {
            $new_mid = pm_send_message($_SESSION['UID'], $to_logon_array, $subject, $content, $reply_mid);
        }
        if ($new_mid !== false) {
            email_send_pm_notification($new_mid);
            if (sizeof($attachments) > 0 && ($attachments_array = attachments_get($_SESSION['UID'], $attachments))) {
                foreach ($attachments_array as $attachment) {
                    pm_add_attachment($new_mid, $attachment['aid']);
                }
            }
        } else {
            $error_msg_array[] = gettext("Error creating PM! Please try again in a few minutes");
            $valid = false;
        }
    }
    if ($valid) {
        if (isset($return_msg)) {
            header_redirect("discussion.php?webtag={$webtag}&msg={$return_msg}&message_sent=true");
            exit;
        } else {