summaryrefslogtreecommitdiff
path: root/details.php
blob: faf666d58c15b15beebaa94bc0a392bdd95aa8d7 (plain)
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
<?php

$filename = 'dri-devel-'.$date.'.log';

$pattern = '#(^|[^\"=]{1})(http://|ftp://|https://|mailto:|news:)([^\s<>]+)([\s\n<>]|$)#sm';

$timehashes = array();
$lines = file(LOG_DIR.$filename);
$anything_displayed = false;
foreach ($lines as $line_num => $line) {
    if (is_from_selected_channel($line, $channel)) {
        if (!filter_join($line)) {
            $user = get_user($line);
            $user_clean = substr($user, 2, -1);
            if (in_array($user_clean, $ignore)) {
                continue;
            }
            $anything_displayed = true;
            $user = htmlentities($user, ENT_QUOTES);
            $time = get_time($line);
            if (isset($last_visit) && $last_visit < $time) {
                echo '<hr/>';
                unset($last_visit);
            }
            echo '<span class="user_'.$user_clean.'">';
            $line = htmlentities($line, ENT_QUOTES);
            if ($show_html == 'true') {
                $line = preg_replace($pattern, "\\1<a href=\"\\2\\3\">\\2\\3</a>\\4", $line);
            }
            $user_link = '<a style="color: inherit;" href="javascript:addUser(\''.$user_clean.'\');"';
            if (isset($realname[$user_clean])) {
                $user_link .= ' title="'.$realname[$user_clean].'"';
            }
            $user_link .= '>'.str_replace('<', '&lt;', str_replace('>', '&gt;', $user)).'</a>';
            if (!in_array($time, $timehashes)) {
                $time_link = '<a class="inherit" name="t-'.str_replace(':', '', $time).'">'.$time.'</a>';
                $line = str_replace($time, $time_link, $line);
                array_push($timehashes, $time);
            }
            echo str_replace($user, $user_link, $line),'<br/>';
            echo '</span>';
        }
    }
}

if (!$anything_displayed) {
    echo 'No logs found';
}