SVN tag for release should only contain scripts in "docs" folder without "mods",...
[atutor.git] / docs / mods / _standard / rss_feeds / preview.php
1 <?php   \r
2 /************************************************************************/\r
3 /* ATutor                                                                                                                               */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2002-2010                                              */\r
6 /* Inclusive Design Institute                                           */\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 if (isset($_POST['back'])) {\r
21         header('Location: index.php');\r
22         exit;\r
23 }\r
24 \r
25 require (AT_INCLUDE_PATH.'header.inc.php');\r
26 \r
27 $feed_id    = intval($_GET['fid']);\r
28 $cache_file = AT_CONTENT_DIR.'feeds/'.$feed_id.'_rss.cache';\r
29 $title_file = AT_CONTENT_DIR.'feeds/'.$feed_id.'_rss_title.cache';\r
30 \r
31 if (!file_exists($cache_file) || ((time() - filemtime($cache_file)) > 21600) ) {\r
32         make_cache_file($feed_id);\r
33 }\r
34 ?>\r
35 \r
36 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">\r
37 \r
38 <div class="input-form">\r
39         <div class="row">\r
40                 <h3><?php if (file_exists($title_file)) { readfile($title_file); } ?></h3>\r
41         </div>\r
42 \r
43         <div class="row">\r
44                 <?php if (file_exists($cache_file) && filesize($cache_file) > 0) { \r
45                         readfile($cache_file); \r
46                         echo '<p><br /><small>'._AT('new_window').'</small></p>';\r
47                 } else {\r
48                         echo _AT('no_content_avail');\r
49                 }?>\r
50         </div>\r
51 \r
52         <div class="row buttons">\r
53                 <input type="submit" name="back" value="<?php echo _AT('back'); ?>" />\r
54         </div>\r
55 </div>\r
56 </form>\r
57 \r
58 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>