Completed
Pull Request — master (#4584)
by Neil
05:43
created

html/pages/device/logs.inc.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
if (!isset($vars['section'])) {
4
    $vars['section'] = 'eventlog';
5
}
6
7
print_optionbar_start();
8
9
echo '<strong>Logging</strong>  &#187; ';
10
11
if ($vars['section'] == 'eventlog') {
12
    echo '<span class="pagemenu-selected">';
13
}
14
15
echo generate_link('Event Log', $vars, array('section' => 'eventlog'));
16
if ($vars['section'] == 'eventlog') {
17
    echo '</span>';
18
}
19
20 View Code Duplication
if (isset($config['enable_syslog']) && $config['enable_syslog'] == 1) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
    echo ' | ';
22
23
    if ($vars['section'] == 'syslog') {
24
        echo '<span class="pagemenu-selected">';
25
    }
26
27
    echo generate_link('Syslog', $vars, array('section' => 'syslog'));
28
    if ($vars['section'] == 'syslog') {
29
        echo '</span>';
30
    }
31
}
32
33 View Code Duplication
if (isset($config['graylog']['server']) && isset($config['graylog']['port'])) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
34
    echo ' | ';
35
    if ($vars['section'] == 'graylog') {
36
        echo '<span class="pagemenu-selected">';
37
    }
38
    echo generate_link('Graylog', $vars, array('section' => 'graylog'));
39
    if ($vars['section'] == 'graylog') {
40
        echo '</span>';
41
    }
42
}
43
44
switch ($vars['section']) {
45
    case 'syslog':
46
    case 'eventlog':
47
    case 'graylog':
48
        include 'pages/device/logs/'.$vars['section'].'.inc.php';
49
        break;
50
51
    default:
52
        print_optionbar_end();
53
        echo report_this('Unknown section '.$vars['section']);
54
        break;
55
}
56