| 1 |
2
|
Manuela
|
<?php
|
| 2 |
|
|
/**
|
| 3 |
|
|
* LoadErrorlog.php
|
| 4 |
|
|
*/
|
| 5 |
|
|
$sAppPath = dirname(dirname(__DIR__));
|
| 6 |
|
|
if (is_readable($sAppPath.'/config.php')) {require ($sAppPath.'/config.php');}
|
| 7 |
|
|
if (!class_exists('admin', false)) {require (WB_PATH.'/framework/class.admin.php');}
|
| 8 |
|
|
// An associative array that by default contains the contents of $_GET, $_POST and $_COOKIE.
|
| 9 |
|
|
$aRequestVars = $_REQUEST;
|
| 10 |
|
|
$sErrorlogFile = WB_PATH.'/var/logs/php_error.log.php';
|
| 11 |
|
|
$sErrorlogUrl = WB_URL .'/var/logs/php_error.log.php';
|
| 12 |
|
|
$aJsonRespond['url'] = $sErrorlogUrl;
|
| 13 |
|
|
// initialize json_respond array (will be sent back)
|
| 14 |
|
|
$aJsonRespond = array();
|
| 15 |
|
|
$aJsonRespond['content'] = array();
|
| 16 |
|
|
$aJsonRespond['message'] = 'Load operation failed';
|
| 17 |
|
|
$aJsonRespond['success'] = false;
|
| 18 |
|
|
$admin = new admin('##skip##', false, false);
|
| 19 |
|
|
if ( (int)$admin->get_user_id() != 1){
|
| 20 |
|
|
$aJsonRespond['message'] = 'illegal file access';
|
| 21 |
|
|
exit(json_encode($aJsonRespond));
|
| 22 |
|
|
}
|
| 23 |
|
|
if (!($aJsonRespond['content'] = file($sErrorlogFile, FILE_SKIP_EMPTY_LINES|FILE_IGNORE_NEW_LINES|FILE_TEXT))){
|
| 24 |
|
|
exit(json_encode($aJsonRespond));
|
| 25 |
|
|
}
|
| 26 |
|
|
$output = implode('<br />',$aJsonRespond['content']);
|
| 27 |
|
|
|
| 28 |
|
|
// If the script is still running, set success to true
|
| 29 |
|
|
$aJsonRespond['success'] = 'true';
|
| 30 |
|
|
// and echo the answer as json to the ajax function
|
| 31 |
|
|
$output = json_encode ($output, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
| 32 |
|
|
echo stripslashes($output);
|