-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathChannelLog2.php
More file actions
76 lines (73 loc) · 5.51 KB
/
ChannelLog2.php
File metadata and controls
76 lines (73 loc) · 5.51 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
###Set these 2 variables.
$channel='#channel'; #Change this to the channel name that will be displayed in the header.
$logpath='http://example.com/path/to/file.log'; #Change this to your raw log file path. Can be http(s) URL or absolute/relative file path on system (i.e. /path/to/file.log)
echo '<html><head>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.css"/>
<script src="//code.jquery.com/jquery.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
div#header {position:fixed; top:0px; margin:auto; z-index:100000; width:85%; background:white;}
body {margin-top:65px;}
</style>
</head>' . "\n";
echo '<body class="container">';
echo '<div id="header">
Channel log for ' . "$channel" . '<hr></div>'; #Change channel name
echo '
<pre style="background-color: #f9f9f9">
'; #Enter any HTML code you want displayed before the log between the single quotes. This could be useful for a header.
$file=file_get_contents("$logpath"); #Change this to the path of the raw output
$file=explode("\n", $file);
foreach ($file as $line){
if($line==""){
} else {
$line=explode(' ', $line, 3);
$nick=explode(">", $line['1']);
$nick['0']=str_replace("\x0302", '<span class="nick" style="color:navy;">', $nick['0']);
$nick['0']=str_replace("\x0303", '<span class="nick" style="color:green;">', $nick['0']);
$nick['0']=str_replace("\x0304", '<span class="nick" style="color:red;">', $nick['0']);
$nick['0']=str_replace("\x0306", '<span class="nick" style="color:purple;">', $nick['0']);
$nick['0']=str_replace("\x0310", '<span class="nick" style="color:teal;">', $nick['0']);
$nick['0']=str_replace("\x0313", '<span class="nick" style="color:fuchsia;">', $nick['0']);
$nick['0']=str_replace("\x0314", '<span class="nick" style="color:grey;">', $nick['0']);
$line['2']=htmlentities($line['2']);
$line['2']=str_replace("\x0301", '</span><span class="body" style="color:black;">', $line['2']);
$line['2']=str_replace("\x0302", '</span><span class="body" style="color:navy;">', $line['2']);
$line['2']=str_replace("\x032", '</span><span class="body" style="color:navy;">', $line['2']);
$line['2']=str_replace("\x0303", '</span><span class="body" style="color:green;">', $line['2']);
$line['2']=str_replace("\x033", '</span><span class="body" style="color:green;">', $line['2']);
$line['2']=str_replace("\x0304", '</span><span class="body" style="color:red;">', $line['2']);
$line['2']=str_replace("\x034", '</span><span class="body" style="color:red;">', $line['2']);
$line['2']=str_replace("\x0305", '</span><span class="body" style="color:maroon;">', $line['2']);
$line['2']=str_replace("\x035", '</span><span class="body" style="color:maroon;">', $line['2']);
$line['2']=str_replace("\x0306", '</span><span class="body" style="color:purple;">', $line['2']);
$line['2']=str_replace("\x036", '</span><span class="body" style="color:purple;">', $line['2']);
$line['2']=str_replace("\x0307", '</span><span class="body" style="color:orangered;">', $line['2']);
$line['2']=str_replace("\x037", '</span><span class="body" style="color:orangered;">', $line['2']);
$line['2']=str_replace("\x0308", '</span><span class="body" style="color:yellow;">', $line['2']);
$line['2']=str_replace("\x038", '</span><span class="body" style="color:yellow;">', $line['2']);
$line['2']=str_replace("\x0309", '</span><span class="body" style="color:lime;">', $line['2']);
$line['2']=str_replace("\x039", '</span><span class="body" style="color:lime;">', $line['2']);
$line['2']=str_replace("\x0310", '</span><span class="body" style="color:teal;">', $line['2']);
$line['2']=str_replace("\x0311", '</span><span class="body" style="color:cyan;">', $line['2']);
$line['2']=str_replace("\x0312", '</span><span class="body" style="color:royalblue;">', $line['2']);
$line['2']=str_replace("\x0313", '</span><span class="body" style="color:fuschia;">', $line['2']);
$line['2']=str_replace("\x0314", '</span><span class="body" style="color:grey;">', $line['2']);
$line['2']=str_replace("\x0315", '</span><span class="body" style="color:silver;">', $line['2']);
$line['2']=str_replace("\x031", '</span><span class="body" style="color:black;">', $line['2']);
$line['2']=str_replace("\u000F", '</span><span class="body" style="color:black;">', $line['2']);
$line['2']=str_replace("\x03", '</span><span class="body" style="color:black;">', $line['2']);
if(substr($line['1'], -1, 1)==">"){
echo '<span class="timestamp">' . $line['0'] . '</span>';
echo " " . $nick['0'] . '</span>>';
echo " " . $line['2'] . '</span>';
} else {
echo '<span class="timestamp">' . $line['0'] . '</span>';
echo " " . $nick['0'] . " " . $line['2'] . '</span>';
}
echo "\n";
}
}
?>