コード例 #1
0
ファイル: compose.php プロジェクト: scarnago/pipecode
    $subject = http_post_string("subject", array("len" => 250, "valid" => "[ALL]"));
    $body = http_post_string("body", array("len" => 64000, "valid" => "[ALL]"));
    $in_reply_to = http_post_string("in_reply_to", array("required" => false, "len" => 250, "valid" => "[a-z][A-Z][0-9]-_.@+-"));
    send_web_mail($to, $subject, $body, $in_reply_to);
    header("Location: /mail/");
    die;
}
$to = http_get_string("to", array("required" => false, "len" => 250, "valid" => "[a-z][A-Z][0-9]-_.<>@+ "));
$mid = http_get_int("mid", array("required" => false));
if ($mid > 0) {
    $message = db_get_rec("mail", $mid);
    $in_reply_to = $message["message_id"];
    $to = $message["mail_from"];
    $subject = $message["subject"];
    if (substr($subject, 0, 4) != "Re: ") {
        $subject = "Re: {$subject}";
    }
} else {
    $in_reply_to = "";
    $subject = "";
}
print_header("Mail", array("Inbox"), array("inbox"), array("/mail/"));
writeln('<form method="post">');
writeln('<input name="in_reply_to" type="hidden" value="' . $in_reply_to . '"/>');
beg_tab();
print_row(array("caption" => "To", "text_key" => "to", "text_value" => $to));
print_row(array("caption" => "Subject", "text_key" => "subject", "text_value" => $subject));
print_row(array("caption" => "Body", "textarea_key" => "body", "textarea_height" => 500));
end_tab();
right_box("Send");
writeln('</form>');
コード例 #2
0
ファイル: mail.php プロジェクト: scarnago/pipecode
function print_mail_dir($location)
{
    global $auth_zid;
    print_header($location, array("Compose"), array("mail-compose"), array("/mail/compose"));
    writeln('<table class="fill">');
    writeln('<tr>');
    writeln('<td style="vertical-align: top">');
    beg_tab();
    writeln('	<tr>');
    writeln('		<td><a href="/mail/" class="icon_16" style="background-image: url(/images/inbox-16.png)">Inbox</a></td>');
    writeln('	</tr>');
    writeln('	<tr>');
    writeln('		<td><a href="/mail/sent" class="icon_16" style="background-image: url(/images/sent-16.png)">Sent</a></td>');
    writeln('	</tr>');
    writeln('	<tr>');
    writeln('		<td><a href="/mail/junk" class="icon_16" style="background-image: url(/images/junk-16.png)">Junk</a></td>');
    writeln('	</tr>');
    writeln('	<tr>');
    writeln('		<td><a href="/mail/trash" class="icon_16" style="background-image: url(/images/trash-16.png)">Trash</a></td>');
    writeln('	</tr>');
    end_tab();
    writeln('</td>');
    writeln('<td class="fill" style="padding-left: 8px">');
    beg_tab();
    $list = db_get_list("mail", "received_time", array("zid" => $auth_zid, "location" => $location));
    $keys = array_keys($list);
    if (count($list) == 0) {
        writeln('<tr><td>(no messages)</td></tr>');
    }
    for ($i = 0; $i < count($list); $i++) {
        $message = $list[$keys[$i]];
        if ($location == "Sent") {
            $address = parse_mail_address($message["rcpt_to"]);
        } else {
            $address = parse_mail_address($message["mail_from"]);
        }
        if ($message["subject"] == "") {
            $subject = "(no subject)";
        } else {
            $subject = $message["subject"];
        }
        writeln('	<tr>');
        writeln('		<td><a href="view?mid=' . $message["mail_id"] . '" class="icon_16" style="background-image: url(/images/mail-16.png)">' . $message["subject"] . '</a></td>');
        if (string_has($address["email"], "no-reply@")) {
            writeln('		<td class="center">' . $address["email"] . '</td>');
        } else {
            writeln('		<td class="center"><a href="compose?to=' . $address["email"] . '">' . $address["email"] . '</a></td>');
        }
        writeln('		<td class="right">' . date("Y-m-d H:i", $message["received_time"]) . '</td>');
        writeln('	</tr>');
    }
    end_tab();
    writeln('</td>');
    writeln('</tr>');
    writeln('</table>');
    if (count($list) > 0) {
        writeln('<form method="post">');
        if ($location == "Junk" || $location == "Trash") {
            right_box("Empty");
        } else {
            right_box("Delete All");
        }
        writeln('</form>');
    }
    print_footer();
}