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