Issues (2963)

includes/html/pages/search/ipv6.inc.php (1 issue)

1
<div class="panel panel-default panel-condensed">
2
    <div class="panel-heading">
3
        <strong>IPv6 Addresses</strong>
4
    </div>
5
    <table id="ipv6-search" class="table table-hover table-condensed table-striped">
6
        <thead>
7
            <tr>
8
                <th data-column-id="hostname">Device</th>
9
                <th data-column-id="interface">Interface</th>
10
                <th data-column-id="address" data-sortable="false" data-formatter="tooltip">Address</th>
11
                <th data-column-id="description" data-sortable="false" data-formatter="tooltip">Description</th>
12
            </tr>
13
        <thead>
14
    </table>
15
</div>
16
17
<script>
18
var grid = $("#ipv6-search").bootgrid({
19
    ajax: true,
20
    rowCount: [50, 100, 250, -1],
21
    templates: {
22
        header: "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\"><div class=\"row\">"+
23
                "<div class=\"col-sm-9 actionBar\"><span class=\"pull-left\">"+
24
                "<form method=\"post\" action=\"\" class=\"form-inline\" role=\"form\">"+
25
                "<?php echo addslashes(csrf_field()) ?>"+
26
                "<div class=\"form-group\">"+
27
                "<select name=\"device_id\" id=\"device_id\" class=\"form-control input-sm\">"+
28
                "<option value=\"\">All Devices</option>"+
29
<?php
30
31
$sql = 'SELECT `devices`.`device_id`,`hostname`, `sysName` FROM `devices`';
32
$param = [];
33
34
if (! Auth::user()->hasGlobalRead()) {
35
    $device_ids = Permissions::devicesForUser()->toArray() ?: [0];
0 ignored issues
show
The method devicesForUser() does not exist on App\Facades\Permissions. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
    $device_ids = Permissions::/** @scrutinizer ignore-call */ devicesForUser()->toArray() ?: [0];
Loading history...
36
    $where .= ' WHERE `devices`.`device_id` IN ' . dbGenPlaceholders(count($device_ids));
37
    $param = array_merge($param, $device_ids);
38
}
39
40
$sql .= " $where ORDER BY `hostname`";
41
42
foreach (dbFetchRows($sql, $param) as $data) {
43
    echo '"<option value=\"' . $data['device_id'] . '\""+';
44
    if ($data['device_id'] == $_POST['device_id']) {
45
        echo '" selected"+';
46
    }
47
48
    echo '">' . format_hostname($data, $data['hostname']) . '</option>"+';
49
}
50
?>
51
                "</select>"+
52
                "</div>"+
53
                "<div class=\"form-group\">"+
54
                "<select name=\"interface\" id=\"interface\" class=\"form-control input-sm\">"+
55
                "<option value=\"\">All Interfaces</option>"+
56
                "<option value=\"Loopback%\""+
57
<?php
58
if ($_POST['interface'] == 'Loopback%') {
59
    echo '" selected "+';
60
}
61
62
?>
63
64
                ">Loopbacks</option>"+
65
                "<option value=\"Vlan%\""+
66
<?php
67
if ($_POST['interface'] == 'Vlan%') {
68
    echo '" selected "+';
69
}
70
71
?>
72
73
                ">VLANs</option>"+
74
                "</select>"+
75
                "</div>"+
76
                "<div class=\"form-group\">"+
77
                "<input type=\"text\" name=\"address\" id=\"address\" size=40 value=\"<?php echo $_POST['address']; ?>\" class=\"form-control input-sm\" placeholder=\"IPv6 Address\"/>"+
78
                "</div>"+
79
                "<button type=\"submit\" class=\"btn btn-default input-sm\">Search</button>"+
80
                "</form></span></div>"+
81
                  "<div class=\"col-sm-3 actionBar\"><p class=\"{{css.actions}}\"></p></div></div></div>"
82
    },
83
    post: function ()
84
    {
85
        return {
86
            id: "address-search",
87
            search_type: "ipv6",
88
            device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
89
            interface: '<?php echo $_POST['interface']; ?>',
90
            address: '<?php echo $_POST['address']; ?>'
91
        };
92
    },
93
    url: "ajax_table.php",
94
    formatters: {
95
        "tooltip": function (column, row) {
96
                var value = row[column.id];
97
                return "<span title=\'" + value + "\' data-toggle=\'tooltip\'>" + value + "</span>";
98
            },
99
    },
100
});
101
102
</script>
103