-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors.php
More file actions
59 lines (49 loc) · 1.85 KB
/
errors.php
File metadata and controls
59 lines (49 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require 'poof.php';
// post func is global to avoid error due to elements being deleted
function DeleteButton($data)
{
$file=$data['file'];
if (file_exists($file) && unlink($file))
echo uiAlert('success',"Deleted")->RemoveAfter(3);
else
echo uiAlert('error',"file not found");
return(true);
};
$content=uiDiv()->Add(uiHeading(3,"POOF Error Log"));
foreach (arDir("errlog")->Match('*.txt')->SortNewest() as $errfile)
{
$mtime=filemtime($errfile);
$text=file_get_contents($errfile);
/*
[message:protected] => MatchWhere field 'noexist' does not exist in record
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /var/www/poof.stg.net/class/sierror.php
[line:protected] => 181
*/
$type='unknown';
if (preg_match('_(\S+)\s+Object_',$text,$match) && !empty($match[1]))
$type=$match[1];
$message='unknown';
if (preg_match('_\[message.*\] => (.*)\n_',$text,$match) && !empty($match[1]))
$message=$match[1];
$file='unknown';
if (preg_match('_\[file.*\] => (.*)\n_',$text,$match) && !empty($match[1]))
$file=$match[1];
$line='unknown';
if (preg_match('_\[line.*\] => (.*)\n_',$text,$match) && !empty($match[1]))
$line=$match[1];
$date=date('Y/m/d H:i:s',$mtime);
$error="[$date] $type: $message in $file at $line";
$p=uiParagraph($error);
$p->Add(
uiButton("Details",$errfile)->AddClass('btn-small')->NewTab(),
uiButton("Delete")->AddClass('btn-small')
->Post('DeleteButton',array('file'=>$errfile))->Target($p)
);
$content->Add($p);
}
echo uiPage("POOF Error List")->Add(
$content
);