$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>');
writeln('<img alt="Pipecode" src="/images/logo-top.png" style="margin-bottom: 8px"/>'); writeln('<form method="post">'); beg_tab(); print_row(array("caption" => "Server Name", "text_key" => "server_name", "text_value" => "example.com")); print_row(array("caption" => "Server Title", "text_key" => "server_title", "text_value" => "Example Site")); print_row(array("caption" => "Server Slogan", "text_key" => "server_slogan", "text_value" => "Nerd News Network")); end_tab(); beg_tab(); print_row(array("caption" => "SMTP Server", "text_key" => "smtp_server", "text_value" => "mail.example.com")); print_row(array("caption" => "SMTP Port", "text_key" => "smtp_port", "text_value" => "587")); print_row(array("caption" => "SMTP Address", "text_key" => "smtp_address", "text_value" => "*****@*****.**")); print_row(array("caption" => "SMTP Username", "text_key" => "smtp_username", "text_value" => "mailuser")); print_row(array("caption" => "SMTP Password", "text_key" => "smtp_password", "text_value" => "password")); end_tab(); beg_tab(); print_row(array("caption" => "SQL Server", "text_key" => "sql_server", "text_value" => "127.0.0.1")); print_row(array("caption" => "SQL Username", "text_key" => "sql_user", "text_value" => "sql")); print_row(array("caption" => "SQL Password", "text_key" => "sql_pass", "text_value" => "password")); print_row(array("caption" => "SQL Database", "text_key" => "sql_database", "text_value" => "pipecode")); end_tab(); beg_tab(); print_row(array("caption" => "CAPTCHA API Key", "text_key" => "captcha_key", "text_value" => "")); end_tab(); beg_tab(); print_row(array("caption" => "Admin Username", "text_key" => "admin_username", "text_value" => "myname")); print_row(array("caption" => "Admin Password", "text_key" => "admin_password", "text_value" => "crunchyfrog")); end_tab(); right_box("Save"); writeln('</form>'); writeln('</body>'); writeln('</html>');
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(); }
writeln(' </tr>'); writeln(' <tr>'); writeln(' <td style="width: 140px">Date:</td>'); writeln(' <td>' . date("Y-m-d H:i", $message["received_time"]) . '</td>'); writeln(' </tr>'); end_tab(); $body = htmlentities(trim(substr($message["body"], strpos($message["body"], "\r\n\r\n") + 4))); $body = format_text_mail($body); beg_tab(); writeln('<tr>'); writeln('<td>'); writeln($body); writeln('</td>'); writeln('</tr>'); end_tab(); writeln('<form method="post">'); if ($message["location"] == "Junk") { right_box("Restore,Delete,Expunge"); } else { if ($message["location"] == "Trash") { right_box("Restore,Junk,Expunge"); } else { if ($message["location"] == "Sent") { right_box("Delete"); } else { right_box("Junk,Delete"); } } } writeln('</form>'); print_footer();