remove old readme
[atutor.git] / admin / error_logging_view.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 define('AT_INCLUDE_PATH', '../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
17
18 if (isset($_POST['back'])) {
19         header('Location: error_logging.php');
20         exit;
21 }
22
23 $files = array();
24 if (isset($_POST['view'])) { // check if a bug was selected
25         foreach($_POST as $elem => $val) {
26                 $str_ = substr($elem, 0, 4);
27                 if ($str_  == 'file') {
28                         $files[] = $elem;
29                 }
30         }
31         if (empty($files)) {
32                 $msg->addError('NO_LOG_SELECTED');
33                 header('Location: error_logging.php');
34                 exit;
35         }
36 }
37
38 $back_ref = $_POST['profile_id'] . ':' . $_POST['profile_date'];
39
40 require(AT_INCLUDE_PATH.'header.inc.php');
41 ?>
42 <form name="form" method="post" action="<?php echo 'admin/error_logging_details.php'; ?>">
43 <input type="hidden" name="data" value="<?php echo $back_ref; ?>" />
44 <input type="hidden" name="view" value="<?php echo ''; ?>" />
45
46 <div class="input-form">
47         <div class="row">
48                 <h3><?php echo _AT('viewing_errors'); ?></h3>
49         </div><?php
50
51         foreach ($files as $file) {
52                 if (isset($_POST[$file])) {
53                         $dump = @file_get_contents(AT_CONTENT_DIR . 'logs/' . $_POST[$file]);   
54                         if ($dump !== false) { ?>
55
56                                 <div class="row">
57                                         <?php echo $dump; ?>
58                                 </div><?php
59
60                         } else {
61                                 $msg->printErrors(array('CANNOT_READ_FILE', AT_CONTENT_DIR . 'logs/' . $_POST[$file]));
62                         }
63                 }       
64         } ?>
65
66         <div class="row buttons">
67                 <input type="submit" name="back" value="<?php echo _AT('back_to_profile'); ?>" />  
68         </div>
69 </div>
70 </form>
71
72 <?php   require(AT_INCLUDE_PATH.'footer.inc.php'); ?>