* Reduced iconbar button size to 90% because it looked obtuse on a smaller screen
[citadel.git] / ctdlphp / ctdlelements.php
blobe03b0783213f78398b89fe7c1e4dec4b0547a1d5
1 <?PHP
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.
13 // Fetch and display a message.
15 function display_message($msgnum) {
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);
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;
28 // Begin header
29 echo "<B><I>" ;
30 echo strftime("%b %d %Y %I:%M%p ", $fields["time"]) ;
31 echo " from " . htmlspecialchars($fields["from"]) ;
33 if (isset($fields["rfca"]) && strlen($fields["rfca"]) > 0) {
34 echo " &lt;" . htmlspecialchars($fields["rfca"]) . "&gt;" ;
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"]) . ")" ;
44 if (isset($fields["rcpt"]) && strlen($fields["rcpt"]) > 0) {
45 echo " to " . htmlspecialchars($fields["rcpt"]) ;
47 echo "</I></B><BR>\n" ;
49 // Subject
50 if (strlen($fields["subj"]) > 0) {
51 echo"<i>Subject: " .
52 htmlspecialchars($fields["subj"]) .
53 "</i><BR>\n" ;
56 // Do message text
57 if ($fields['formatet_text'] != "")
58 echo $fields['formatet_text'] . "<BR>";
59 else
60 echo $fields["text"] . "<BR>";
62 echo '</TD></TR></TABLE><BR>' ;
65 function get_message_partlist($msgnum) {
67 // Fetch the message from the server
68 list($ok, $response, $fields) = ctdl_fetch_message($msgnum);
70 // Bail out gracefully if the message isn't there.
71 if (!$ok) {
72 echo "Error: " . htmlspecialchars($response) . "<BR>" ;
73 return false;
75 if (isset($fields['part']))
77 $parts = explode('|', $fields['part']);
78 print_r($parts);
79 return $parts;
82 return false;