2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
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 /************************************************************************/
14 define('AT_INCLUDE_PATH', '../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
18 if (!isset($_POST['data'])) {
19 $msg->addError('NO_PROFILE_SELECTED');
20 header('Location: error_logging.php');
22 } // else we have a profile we can work with
24 if (isset($_POST['delete'])) {
26 $key = substr($_POST['data'], 0, strpos($_POST['data'], ':'));
27 $date = substr($_POST['data'], strpos($_POST['data'], ':') + 1);
28 $dir_ = AT_CONTENT_DIR . 'logs/' . $date;
31 if (!($dir = opendir($dir_))) {
32 $msg->printNoLookupFeedback('Could not access /content/logs/' . $date . '. Check that the permission for the <strong>Server</string> user are r+w to it');
33 require(AT_INCLUDE_PATH.'footer.inc.php');
39 // Open a read pointer to run through each log date directory getting all the profiles
40 while (($file = readdir($dir)) !== false) {
42 if (($file == '.') || ($file == '..') || is_dir($file)) {
46 if (strpos($file, $key) !== false) { // found a bug associated with our profile key
47 $delete_store{$file} = $file;
53 closedir($dir); // clean it up
55 if (count($delete_store) > 0) {
56 // Now run through the files and unlink them all
57 foreach($delete_store as $elem => $val)
58 unlink($dir_ . '/' . $elem);
61 // remove the directory as well if there are no oother profiles in it
66 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
67 header('Location: error_logging.php');
71 require(AT_INCLUDE_PATH.'header.inc.php');
73 if (isset($_POST['view'])) {
74 // Grab all the bugs associated with this $_POST['data'] corresponding md5 key
75 $key = substr($_POST['data'], 0, strpos($_POST['data'], ':'));
76 $date = substr($_POST['data'], strpos($_POST['data'], ':') + 1);
77 $dir_ = AT_CONTENT_DIR . 'logs/' . $date;
82 <form name="form" method="post" action="<?php echo 'admin/error_logging_view.php'; ?>">
84 <table class="data" summary="" rules="cols">
87 <th scope="col"><?php echo _AT('bug_identifier'); ?></th>
88 <th scope="col"><?php echo _AT('timestamp'); ?></th>
94 <input type="hidden" name="profile_id" value="<?php echo $key; ?>"/>
95 <input type="hidden" name="profile_date" value="<?php echo $date; ?>"/>
96 <input type="submit" name="view" value="<?php echo _AT('view_selected_bugs'); ?>" />
97 <input type="submit" name="back" value="<?php echo _AT('back_to_main'); ?>" />
103 if (!($dir = opendir($dir_))) {
104 $msg->printNoLookupFeedback('Could not access /content/logs/' . $date . '. Check that the permission for the <strong>Server</string> user are r+w to it');
105 require(AT_INCLUDE_PATH.'footer.inc.php');
110 // Open a read pointer to run through each log date directory getting all the profiles
111 while (($file = readdir($dir)) !== false) {
113 if (($file == '.') || ($file == '..') || is_dir($file) || (strpos($file, 'profile') !== false)) {
117 if (strpos($file, $key) !== false) { // found a bug associated with our profile key
118 $log_profile_bugs{$file} = $file;
122 closedir($dir); // clean it up
124 if (empty($log_profile_bugs)) { ?>
126 <td align="center" colspan="2"><small><?php echo _AT('none_found'); ?></small></td>
128 <tr><td height="1" class="row2" colspan="2"></td></tr>
133 $id_cnt = 1; // give each bug an easier to understand id onscreen
134 foreach ($log_profile_bugs as $elem => $lm) {
135 // construct timestamp from millis since epoch in bug identifier
136 $timestamp = substr($lm, strpos($lm, '_') + 1);
137 $timestamp = substr($timestamp, 0, strpos($lm, '_') + 2);
139 $timestamp = AT_Date(_AT('inbox_date_format'), $timestamp, AT_DATE_UNIX_TIMESTAMP);
141 $str_prefix = substr($lm, 0, strpos($lm, '_'));
143 <tr onmousedown="document.form['q<?php echo $lm; ?>'].checked = !document.form['q<?php echo $lm; ?>'].checked;">
144 <td><input type="checkbox" value="<?php echo $date . '/' . $lm; ?>" name="file<?php echo $count; ?>" id="q<?php echo $lm; ?>" onmouseup="this.checked=!this.checked" /><?php echo $id_cnt . '_' . $str_prefix; ?></td>
145 <td><?php echo $timestamp; ?></td>
147 <?php $count++; $id_cnt++;
156 require(AT_INCLUDE_PATH.'footer.inc.php');
159 } else if (isset($_POST['delete'])) {
160 $key = substr($_POST['data'], 0, strpos($_POST['data'], ':'));
161 $date = substr($_POST['data'], strpos($_POST['data'], ':') + 1);
162 $dir_ = AT_CONTENT_DIR . 'logs/' . $date;
165 if (!($dir = opendir($dir_))) {
166 $msg->printNoLookupFeedback('Could not access /content/logs/' . $date . '. Check that the permission for the <strong>Server</string> user are r+w to it');
167 require(AT_INCLUDE_PATH.'footer.inc.php');
172 // Open a read pointer to run through each log date directory getting all the profiles
173 while (($file = readdir($dir)) !== false) {
175 if (($file == '.') || ($file == '..') || is_dir($file)) {
179 if (strpos($file, $key) !== false) { // found a bug associated with our profile key
180 $delete_store{$file} = $file;
184 closedir($dir); // clean it up
186 // Now run through the files and unlink them all
187 foreach($delete_store as $elem => $val)
188 unlink($dir_ . '/' . $elem);
190 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
191 header('Location: ' . $_SERVER['PHP_SELF']);