Added a comma after each msgnum exported. The parser was globbing them all together...
[citadel.git] / ctdlphp / ctdlelements.php
1 <?PHP
2
3 // $Id$
4 // 
5 // Translates Citadel protocol data to insertable HTML snippets.  You can
6 // use these directly, or you can bypass them completely.
7 //
8 // Copyright (c) 2003 by Art Cancro <ajc@uncensored.citadel.org>
9 // This program is released under the terms of the GNU General Public License.
10
11
12 //
13 // Fetch and display a message.
14 //
15 function display_message($msgnum) {
16
17         echo '<TABLE border=0 width=100% bgcolor="#DDDDDD"><TR><TD>' ;
18         // Fetch the message from the server
19         list($ok, $response, $fields) = ctdl_fetch_message($msgnum);
20
21         // Bail out gracefully if the message isn't there.
22         if (!$ok) {
23                 echo "Error: " . htmlspecialchars($response) . "<BR>" ;
24                 echo '</TD></TR></TABLE>' ;
25                 return;
26         }
27
28         // Begin header
29         echo "<B><I>" ;
30         echo strftime("%b %d %Y %I:%M%p ", $fields["time"]) ;
31         echo " from " . htmlspecialchars($fields["from"]) ;
32         
33         if (isset($fields["rfca"]) && strlen($fields["rfca"]) > 0) {
34                 echo " &lt;" . htmlspecialchars($fields["rfca"]) . "&gt;" ;
35         }
36         else if ( (strlen($fields["node"]) > 0) 
37              && (strcasecmp($fields["node"], $_SESSION["serv_nodename"])) ) {
38                 echo " @" . htmlspecialchars($fields["node"]) ;
39                 if (strlen($fields["hnod"]) > 0) {
40                         echo " (" . htmlspecialchars($fields["hnod"]) . ")" ;
41                 }
42         }
43
44         if (isset($fields["rcpt"]) && strlen($fields["rcpt"]) > 0) {
45                 echo " to " . htmlspecialchars($fields["rcpt"]) ;
46         }
47         echo "</I></B><BR>\n" ;
48
49         // Subject
50         if (strlen($fields["subj"]) > 0) {
51                 echo"<i>Subject: " .
52                         htmlspecialchars($fields["subj"]) .
53                         "</i><BR>\n" ;
54         }
55
56         // Do message text
57         if ($fields['formatet_text'] != "")
58                 echo $fields['formatet_text'] . "<BR>";
59         else 
60                 echo $fields["text"] . "<BR>";
61
62         echo '</TD></TR></TABLE><BR>' ;
63 }
64
65 function get_message_partlist($msgnum) {
66
67         // Fetch the message from the server
68         list($ok, $response, $fields) = ctdl_fetch_message($msgnum);
69
70         // Bail out gracefully if the message isn't there.
71         if (!$ok) {
72                 echo "Error: " . htmlspecialchars($response) . "<BR>" ;
73                 return false;
74         }
75         if (isset($fields['part']))
76         {
77                 $parts = explode('|', $fields['part']);
78                 print_r($parts);
79                 return $parts;
80
81         }
82         return false;
83 }
84
85
86
87 ?>