From 884196868debedf3c15141a5bb885d1b05fa1473 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 25 Nov 2003 04:01:44 +0000 Subject: [PATCH] * Completed "post" and "post html" stuffs --- ctdlphp/ChangeLog | 4 ++++ ctdlphp/ctdlelements.php | 7 +++++++ ctdlphp/ctdlprotocol.php | 15 +++++++++++++-- ctdlphp/postmsg.php | 4 +++- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ctdlphp/ChangeLog b/ctdlphp/ChangeLog index 2156daf17..f9d3c3d2e 100644 --- a/ctdlphp/ChangeLog +++ b/ctdlphp/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 1.21 2003/11/25 04:01:44 ajc + * Completed "post" and "post html" stuffs + Revision 1.20 2003/11/22 04:33:22 ajc * fleshed out the message headers a bit @@ -86,3 +89,4 @@ Revision 1.1 2003/10/31 03:47:13 ajc * Initial CVS import + diff --git a/ctdlphp/ctdlelements.php b/ctdlphp/ctdlelements.php index a60a7b852..31ab4d28d 100644 --- a/ctdlphp/ctdlelements.php +++ b/ctdlphp/ctdlelements.php @@ -46,6 +46,13 @@ function display_message($msgnum) { } echo "
\n" ; + // Subject + if (strlen($fields["subj"]) > 0) { + echo"Subject: " . + htmlspecialchars($fields["subj"]) . + "
\n" ; + } + // Do message text echo $fields["text"] . "
"; diff --git a/ctdlphp/ctdlprotocol.php b/ctdlphp/ctdlprotocol.php index 52e09f7c1..49aa4e47e 100644 --- a/ctdlphp/ctdlprotocol.php +++ b/ctdlphp/ctdlprotocol.php @@ -40,9 +40,19 @@ function serv_puts($buf) { // function text_to_server($thetext, $convert_to_html) { + // HTML mode + if ($convert_to_html) { - $this_line = strtok($thetext, "\n"); + // Strip CR's; we only want the LF's + $thetext = trim($thetext, "\r"); + + // Replace hard line breaks with
's + $thetext = str_replace("\n", "
\n", $thetext); + + } + // Either mode ... send it to the server now + $this_line = strtok($thetext, "\n"); while ($this_line !== FALSE) { $this_line = trim($this_line, "\n\r"); if ($this_line == "000") $this_line = "-000" ; @@ -50,7 +60,8 @@ function text_to_server($thetext, $convert_to_html) { $this_line = strtok("\n"); } - serv_puts("000"); + serv_puts("000"); // Tell the server we're done... + serv_puts("ECHO echo test."); // FIXME echo "Echo test: " . serv_gets() . "
\n" ; diff --git a/ctdlphp/postmsg.php b/ctdlphp/postmsg.php index 778d269d3..4d40d4d4e 100644 --- a/ctdlphp/postmsg.php +++ b/ctdlphp/postmsg.php @@ -3,13 +3,15 @@ include "ctdlheader.php"; bbs_page_header(); - serv_puts("ENT0 1"); + serv_puts("ENT0 1||0|4|"); $response = serv_gets(); if (substr($response, 0, 1) != '4') { echo htmlspecialchars(substr($response, 3)) . '
' ; } else { + serv_puts("Content-type: text/html"); + serv_puts(""); text_to_server($_REQUEST["msgtext"], TRUE); } -- 2.39.2