* Replaced the two-second sleep (and associated race condition) for the
[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                 strftime("%b %d %Y %I:%M%p ", $fields["time"]) .
31                 " from " . htmlspecialchars($fields["from"]) .
32                 "</I></B><BR>\n" ;
33
34         // Do message text
35         echo $fields["text"] . "<BR>";
36
37         echo '</TD></TR></TABLE><BR>' ;
38 }
39
40
41
42 ?>