* Completed "post" and "post html" stuffs
authorArt Cancro <ajc@citadel.org>
Tue, 25 Nov 2003 04:01:44 +0000 (04:01 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 25 Nov 2003 04:01:44 +0000 (04:01 +0000)
ctdlphp/ChangeLog
ctdlphp/ctdlelements.php
ctdlphp/ctdlprotocol.php
ctdlphp/postmsg.php

index 2156daf17a29efafa19bc3aa5a7ad587cd411bea..f9d3c3d2e7da08bce598fd06395f7b000ef91e3a 100644 (file)
@@ -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
+
index a60a7b8523e28864e484be3f223bacca5e7c60dc..31ab4d28d46bf1fd782b0febf9215cd3be60d418 100644 (file)
@@ -46,6 +46,13 @@ function display_message($msgnum) {
        }
        echo "</I></B><BR>\n" ;
 
+       // Subject
+       if (strlen($fields["subj"]) > 0) {
+               echo"<i>Subject: " .
+                       htmlspecialchars($fields["subj"]) .
+                       "</i><BR>\n" ;
+       }
+
        // Do message text
        echo $fields["text"] . "<BR>";
 
index 52e09f7c1da2c333c2c5968ec91440cdd4c1d394..49aa4e47e3787f53dc178b82e2469595e27a092f 100644 (file)
@@ -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 <BR>'s
+               $thetext = str_replace("\n", "<BR>\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() . "<BR>\n" ;
 
index 778d269d3c0bf418b7e8e8ca4506643b7cfe7da8..4d40d4d4ed9ba5d8af818752fae08bfb32113a26 100644 (file)
@@ -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)) . '<br>' ;
        }
        else {
+               serv_puts("Content-type: text/html");
+               serv_puts("");
                text_to_server($_REQUEST["msgtext"], TRUE);
        }