예제 #1
0
}
if (!isset($t_content)) {
    $t_content = "";
}
if ($valid && isset($_POST['preview'])) {
    if ($pm_message_array = pm_message_get($mid)) {
        $pm_message_array['CONTENT'] = $t_content;
        $pm_message_array['SUBJECT'] = $t_subject;
        $pm_message_array['FOLDER'] = PM_FOLDER_OUTBOX;
    } else {
        pm_edit_refuse();
    }
} else {
    if ($valid && isset($_POST['apply'])) {
        if ($pm_message_array = pm_message_get($mid)) {
            pm_save_attachment_id($mid, $aid);
            if (pm_edit_message($mid, $t_subject, $t_content)) {
                header_redirect("lpm.php?webtag={$webtag}&mid={$mid}");
                exit;
            } else {
                $error_msg_array[] = gettext("Error creating PM! Please try again in a few minutes");
                $valid = false;
            }
        } else {
            pm_edit_refuse();
        }
    } else {
        if (isset($_POST['emots_toggle'])) {
            if (isset($_POST['t_subject']) && strlen(trim($_POST['t_subject'])) > 0) {
                $t_subject = trim($_POST['t_subject']);
            }
예제 #2
0
        header_redirect("lpm.php?webtag={$webtag}&message_sent=true");
        exit;
    }
} else {
    if ($valid && isset($_POST['save'])) {
        if (isset($t_edit_mid) && is_numeric($t_edit_mid)) {
            if (pm_update_saved_message($t_edit_mid, $t_subject, $t_content, $t_to_uid, $t_to_uid_others)) {
                header_redirect("lpm.php?webtag={$webtag}&mid={$t_edit_mid}&message_saved=true");
                exit;
            } else {
                $error_msg_array[] = gettext("Could not save message. Make sure you have enough available free space.");
                $valid = false;
            }
        } else {
            if ($saved_mid = pm_save_message($t_subject, $t_content, $t_to_uid, $t_to_uid_others)) {
                pm_save_attachment_id($saved_mid, $aid);
                header_redirect("lpm.php?webtag={$webtag}&mid={$saved_mid}&message_saved=true");
                exit;
            } else {
                $error_msg_array[] = gettext("Could not save message. Make sure you have enough available free space.");
                $valid = false;
            }
        }
    }
}
light_html_draw_top(sprintf("title=%s", gettext("Send New PM")), "robots=noindex,nofollow");
// preview message
if ($valid && isset($_POST['preview'])) {
    echo "<h3>", gettext("Message Preview"), "</h3>\n";
    $pm_preview_array['TLOGON'] = $t_new_recipient_array['LOGON'];
    $pm_preview_array['TNICK'] = $t_new_recipient_array['NICK'];
예제 #3
0
function pm_add_sent_item($sent_item_mid, $to_uid, $from_uid, $subject, $content, $aid)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($sent_item_mid)) {
        return false;
    }
    if (!is_numeric($to_uid)) {
        return false;
    }
    if (!is_numeric($from_uid)) {
        return false;
    }
    if (!is_md5($aid)) {
        return false;
    }
    // Escape the subject and content for insertion into database.
    $subject_escaped = $db->escape($subject);
    $content_escaped = $db->escape($content);
    // PM_SENT constant.
    $pm_sent = PM_SENT;
    // Current datetime
    $current_datetime = date(MYSQL_DATETIME, time());
    // Insert the main PM Data into the database
    $sql = "INSERT INTO PM (TYPE, TO_UID, FROM_UID, SUBJECT, RECIPIENTS, ";
    $sql .= "CREATED, NOTIFIED, SMID) VALUES ('{$pm_sent}', '{$to_uid}', '{$from_uid}', ";
    $sql .= "'{$subject_escaped}', '', CAST('{$current_datetime}' AS DATETIME), ";
    $sql .= "1, '{$sent_item_mid}')";
    if ($db->query($sql)) {
        $new_mid = $db->insert_id;
        // Insert the PM Content into the database
        $sql = "INSERT INTO PM_CONTENT (MID, CONTENT) ";
        $sql .= "VALUES ('{$new_mid}', '{$content_escaped}')";
        if (!$db->query($sql)) {
            return false;
        }
        // Save the attachment ID.
        pm_save_attachment_id($new_mid, $aid);
        return $new_mid;
    }
    return false;
}