tagging as ATutor 1.5.4-release
[atutor.git] / get_acheck.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2006 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
6 /* Adaptive Technology Resource Centre / University of Toronto                  */
7 /* http://atutor.ca                                                                                                             */
8 /*                                                                                                                                              */
9 /* This program is free software. You can redistribute it and/or                */
10 /* modify it under the terms of the GNU General Public License                  */
11 /* as published by the Free Software Foundation.                                                */
12 /************************************************************************/
13 // $Id$
14
15 /* this file simply gets the AT_CONTENT_DIR/CID.html file that was generated
16  * by the AChecker page of the content editor.
17  * there is no authentication on this page. either the file exists (in which
18  * case it is then quickly deleted after), or it doesn't.
19  */
20
21 $_user_location = 'public';
22
23 define('AT_INCLUDE_PATH', 'include/');
24 require(AT_INCLUDE_PATH . '/vitals.inc.php');
25
26 //get path to file
27 $args = substr($_SERVER['PHP_SELF'], strlen($_SERVER['SCRIPT_NAME']));
28 $file = AT_CONTENT_DIR . $args;
29
30 //check that this file is within the content directory & exists
31
32 $real = realpath($file);
33
34 if (substr($real, 0, strlen(AT_CONTENT_DIR)) == AT_CONTENT_DIR) {
35         header('Content-Type: text/html');
36         echo file_get_contents($real);
37         exit;
38 } else {
39         header('HTTP/1.1 404 Not Found');
40         exit;
41 }
42
43
44 ?>