made a copy
[atutor.git] / admin / rss_feeds / index.php
1 <?php   \r
2 /************************************************************************/\r
3 /* ATutor                                                                                                                               */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/\r
6 /* Adaptive Technology Resource Centre / University of Toronto                  */\r
7 /* http://atutor.ca                                                                                                             */\r
8 /*                                                                                                                                              */\r
9 /* This program is free software. You can redistribute it and/or                */\r
10 /* modify it under the terms of the GNU General Public License                  */\r
11 /* as published by the Free Software Foundation.                                                */\r
12 /************************************************************************/\r
13 // $Id$\r
14 \r
15 define('AT_INCLUDE_PATH', '../../include/');\r
16 require(AT_INCLUDE_PATH . 'vitals.inc.php');\r
17 \r
18 admin_authenticate(AT_ADMIN_PRIV_RSS);\r
19 \r
20 \r
21 if ((isset($_GET['preview']) || isset($_GET['edit']) || isset($_GET['delete'])) && !isset($_GET['fid'])) {\r
22         $msg->addError('NO_ITEM_SELECTED');\r
23 } else if (isset($_GET['edit'])) {\r
24         header("Location:edit_feed.php?fid=".intval($_GET['fid']));\r
25         exit;\r
26 } else if (isset($_GET['delete'])) {\r
27         header("Location:delete_feed.php?fid=".intval($_GET['fid']));\r
28         exit;\r
29 } else if (isset($_GET['preview'])) {\r
30         header("Location:preview.php?fid=".intval($_GET['fid']));\r
31         exit;\r
32 }\r
33 \r
34 require (AT_INCLUDE_PATH.'header.inc.php');\r
35 ?>\r
36 \r
37 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get" name="form">\r
38 \r
39 <table class="data" summary="" rules="cols">\r
40 <thead>\r
41 <tr>\r
42         <th scope="col">&nbsp;</th>\r
43         <th scope="col"><?php echo _AT('title'); ?></th>\r
44         <th scope="col"><?php echo _AT('url'); ?></th>\r
45 </tr>\r
46 </thead>\r
47 <tfoot>\r
48 <tr>\r
49         <td colspan="3">\r
50                 <input type="submit" name="preview" value="<?php echo _AT('preview'); ?>" />\r
51                 <input type="submit" name="edit"    value="<?php echo _AT('edit'); ?>" />\r
52                 <input type="submit" name="delete"  value="<?php echo _AT('delete'); ?>" />\r
53         </td>\r
54 </tr>\r
55 </tfoot>\r
56 <tbody>\r
57 <?php \r
58 $sql    = "SELECT * FROM ".TABLE_PREFIX."feeds ORDER BY feed_id";\r
59 $result = mysql_query($sql, $db);\r
60 \r
61 if (!($row = mysql_fetch_assoc($result))) { \r
62 ?>\r
63 \r
64         <tr>\r
65                 <td colspan="3"><?php echo _AT('none_found'); ?></td>\r
66         </tr>\r
67 <?php } else { ?>\r
68         <?php do { \r
69                 $title_file = AT_CONTENT_DIR.'feeds/'.$row['feed_id'].'_rss_title.cache'; ?>\r
70                 <tr onmousedown="document.form['f_<?php echo $row['feed_id']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $row['feed_id']; ?>">\r
71                         <td valign="top"><input type="radio" id="f_<?php echo $row['feed_id']; ?>" name="fid" value="<?php echo $row['feed_id']; ?>" /></td>\r
72                         <td><label for="f_<?php echo $row['feed_id']; ?>"><?php if (file_exists($title_file)) { readfile($title_file); } ?></label></td>\r
73                         <td><?php echo $row['url']; ?></td>\r
74                 </tr>\r
75         <?php } while ($row = mysql_fetch_assoc($result)); ?>\r
76 \r
77 <?php } ?>\r
78 </tbody>\r
79 </table>\r
80 </form>\r
81 \r
82 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>