Chat window now opens with no messages inside.
[Assignment-Trapper.git] / comment_feed.php
blob3423cd19dc4cc77fe33c8d00c467246f847ea29c
1 <?php
3 include_once("auth_root.php");
4 //include_once("conn.php");
6 /* TODO: Lock out account if this user keeps hitting this page. */
8 //if($role != 0) { die("Account \"".$user_name."\" Is Not Authorized To View This Page.<br><br>This Event Will Be Logged And Reported."); }
10 if($role == 0) {
12 $sql = 'select txt, name, email, title, type_name, DATE_FORMAT(comments.timeposted,"%a, %d %b %Y %T CST") AS timeposted, comments.sub_id from comments, users, schedule, types where (schedule.assign_type = types.assign_type) and (schedule.sched_id = comments.sub_id) and (comments.user_id = users.user_id) order by timeposted limit 30';
14 } else {
15 $sql = 'select txt, name, email, title, type_name, DATE_FORMAT(comments.timeposted,"%a, %d %b %Y %T CST") AS timeposted, comments.sub_id from comments, users, schedule, types where (schedule.assign_type = types.assign_type) and (schedule.sched_id = comments.sub_id) and (comments.user_id = users.user_id) and users.user_id='.$user_id.' order by timeposted limit 30';
19 //echo $sql;
21 $result = mysql_query($sql);
23 $server_url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
24 $server_url_base = "http://".$_SERVER['SERVER_NAME'];
25 //echo $server_url;
27 if (!$result) { die("SQL ERROR"); }
29 $i = 0;
30 while($row = mysql_fetch_array($result))
32 $row['txt'] = htmlspecialchars($row['txt']);
33 $items .= '
34 <item>
35 <title>'.$row['name'].' - '.$row['title'].' - '.$row['type_name'].'</title>
36 <description>'.$row['txt'].'</description>
37 <link>'.$server_url_base.'/at/detail_root.php?sched='.$row['sub_id'].'</link>
38 <author>'.$row['email'].' ('.$row['name'].')</author>
39 <category domain="comment feed">comments</category>
40 <guid>'.$server_url_base.'/at/detail_root.php?sched='.$row['sub_id'].'random='.$i.'</guid>
41 <pubDate>'.$row['timeposted'].'</pubDate>
42 </item>
45 $i++;
48 $now = date("D, d M Y H:i:s T");
50 //echo $now;
52 echo '<?xml version="1.0" encoding="UTF-8" ?>';
56 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
57 <channel>
58 <title>Assignment Trapper - Comment Feed</title>
59 <description>Latest comments listed by date.</description>
60 <link><?php echo $server_url; ?></link>
61 <lastBuildDate>Fri, 31 Dec 1999 23:59:59 EST</lastBuildDate>
62 <pubDate>Fri, 31 Dec 1999 23:59:59 EST</pubDate>
63 <language>en-US</language>
64 <copyright>Copyright 2011 Steven Schronk</copyright>
65 <managingEditor>steven@schronk.com (Steven Schronk)</managingEditor>
66 <webMaster>steven@schronk.com (Steven Schronk)</webMaster>
67 <ttl>10</ttl>
68 <atom:link href="http://www.opentextbook.info/at/comment_feed.php" rel="self" type="application/rss+xml" />
69 <image>
70 <title>Assignment Trapper - Comment Feed</title>
71 <url><?php echo $server_url_base; ?>/at/gfx/bricks.png</url>
72 <link><?php echo $server_url_base; ?>/at/comment_feed.php</link>
73 <width>32</width>
74 <height>32</height>
75 </image>
77 <?php echo $items; ?>
79 </channel>
80 </rss>