当前位置: 首页>>代码示例>>PHP>>正文


PHP device_permitted函数代码示例

本文整理汇总了PHP中device_permitted函数的典型用法代码示例。如果您正苦于以下问题:PHP device_permitted函数的具体用法?PHP device_permitted怎么用?PHP device_permitted使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了device_permitted函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: htmlspecialchars

<?php

if (device_permitted($entry['device_id'])) {
    echo '<tr>';
    // Stop shortening hostname. Issue #61
    // $entry['hostname'] = shorthost($entry['hostname'], 20);
    if ($vars['page'] != 'device') {
        echo '<td>' . $entry['date'] . '</td>';
        echo '<td><strong>' . generate_device_link($entry) . '</strong></td>';
        echo '<td><strong>' . $entry['program'] . ' : </strong> ' . htmlspecialchars($entry['msg']) . '</td>';
    } else {
        echo '<td><i>' . $entry['date'] . '</i>&nbsp;&nbsp;&nbsp;<strong>' . $entry['program'] . '</strong>&nbsp;&nbsp;&nbsp;' . htmlspecialchars($entry['msg']) . '</td>';
    }
    echo '</tr>';
}
开发者ID:rasssta,项目名称:librenms,代码行数:15,代码来源:print-syslog.inc.php

示例2: print_optionbar_start

print_optionbar_start();
?>


<div id="{{ctx.id}}" class="{{css.header}}">
    <div class="row">
        <div class="col-sm-9 actionBar">
            <div class="pull-left">
                <form method="post" action="" class="form-inline" role="form" id="result_form">
                    <div class="form-group">
                        <select name="device" id="device" class="form-control input-sm">
                            <option value="">All Devices</option>
                                <?php 
foreach (get_all_devices() as $hostname) {
    $device_id = getidbyname($hostname);
    if (device_permitted($device_id)) {
        echo '"<option value="' . $device_id . '"';
        if ($device_id == $vars['device']) {
            echo ' selected';
        }
        echo '>' . $hostname . '</option>';
    }
}
?>
                        </select>
                    </div>
                    <div class="form-group">
                        <select name="program" id="program" class="form-control input-sm">
                            <option value="">All Programs</option>
                                <?php 
foreach (dbFetchRows('SELECT DISTINCT `program` FROM `syslog` ORDER BY `program`') as $data) {
开发者ID:ekoyle,项目名称:librenms,代码行数:31,代码来源:syslog.inc.php

示例3: dbFetchRow

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage graphs
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
if (is_numeric($vars['id'])) {
    $sensor = dbFetchRow("SELECT * FROM `sensors` WHERE `sensor_id` = ?", array($vars['id']));
    if (is_numeric($sensor['device_id']) && ($auth || is_entity_permitted($sensor['sensor_id'], 'sensor') || device_permitted($sensor['device_id']))) {
        $device = device_by_id_cache($sensor['device_id']);
        $rrd_filename = get_rrd_path($device, get_sensor_rrd($device, $sensor));
        $title = generate_device_link($device);
        $title .= " :: Sensors :: ";
        $auth = TRUE;
    }
}
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:23,代码来源:auth.inc.php

示例4: foreach

<?php

$graph_type = "processor_usage";
echo "<div style='margin-top: 5px; padding: 0px;'>";
echo "  <table class='table table-condensed'>";
echo "<tr>\n        <th>Device</th>\n        <th>Processor</th>\n        <th></th>\n        <th>Usage</th>\n      </tr>";
foreach (dbFetchRows("SELECT * FROM `processors` AS P, `devices` AS D WHERE D.device_id = P.device_id ORDER BY D.hostname") as $proc) {
    if (device_permitted($proc['device_id'])) {
        $device = $proc;
        // FIXME should that really be done here? :-)
        $text_descr = $proc['processor_descr'];
        $text_descr = str_replace("Routing Processor", "RP", $text_descr);
        $text_descr = str_replace("Switching Processor", "SP", $text_descr);
        $text_descr = str_replace("Sub-Module", "Module ", $text_descr);
        $text_descr = str_replace("DFC Card", "DFC", $text_descr);
        $proc_url = "device/" . $device['device_id'] . "/health/processor/";
        $mini_url = "graph.php?id=" . $proc['processor_id'] . "&amp;type=" . $graph_type . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=80&amp;height=20&amp;bg=f4f4f400";
        $proc_popup = "onmouseover=\"return overlib('<div class=list-large>" . $device['hostname'] . " - " . $text_descr;
        $proc_popup .= "</div><img src=\\'graph.php?id=" . $proc['processor_id'] . "&amp;type=" . $graph_type . "&amp;from=" . $config['month'] . "&amp;to=" . $config['time']['now'] . "&amp;width=400&amp;height=125\\'>";
        $proc_popup .= "', RIGHT" . $config['overlib_defaults'] . ");\" onmouseout=\"return nd();\"";
        $perc = round($proc['processor_usage']);
        $background = get_percentage_colours($perc);
        echo "    <tr class=\"health\">\n               <td>" . generate_device_link($proc) . "</td>\n               <td class=\"tablehead\"><a href='" . $proc_url . "' {$proc_popup}>" . $text_descr . "</a></td>\n               <td width=\"90\"><a href=\"" . $proc_url . "\"  {$proc_popup}><img src=\"{$mini_url}\" /></a></td>\n               <td width=\"200\"><a href=\"" . $proc_url . "\" {$proc_popup}>\n           " . print_percentage_bar(400, 20, $perc, $perc . "%", "ffffff", $background['left'], 100 - $perc . "%", "ffffff", $background['right']);
        echo '</a></td>
             </tr>';
        if ($vars['view'] == "graphs") {
            echo '    <tr></tr><tr class="health"><td colspan="5">';
            $daily_graph = "graph.php?id=" . $proc['processor_id'] . "&amp;type=" . $graph_type . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=211&amp;height=100";
            $daily_url = "graph.php?id=" . $proc['processor_id'] . "&amp;type=" . $graph_type . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=400&amp;height=150";
            $weekly_graph = "graph.php?id=" . $proc['processor_id'] . "&amp;type=" . $graph_type . "&amp;from=" . $config['time']['week'] . "&amp;to=" . $config['time']['now'] . "&amp;width=211&amp;height=100";
            $weekly_url = "graph.php?id=" . $proc['processor_id'] . "&amp;type=" . $graph_type . "&amp;from=" . $config['time']['week'] . "&amp;to=" . $config['time']['now'] . "&amp;width=400&amp;height=150";
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:31,代码来源:processor.inc.php

示例5: dbFetchRows

<?php

$i = 0;
$query = "SELECT * FROM `devices`";
$devices = dbFetchRows($query, $sql_param);
foreach ($devices as $device) {
    $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/perf-poller.rrd";
    if (device_permitted($device) && is_file($rrd_filename)) {
        $rrd_list[$i]['filename'] = $rrd_filename;
        $rrd_list[$i]['descr'] = str_pad($device['hostname'], 25) . " (" . $device['os'] . ")";
        $rrd_list[$i]['ds'] = "val";
        $i++;
    }
}
$unit_text = "负载 %";
$units = '秒';
$total_units = 'Sec';
$colours = 'mixed-q12';
#$scale_min = "0";
#$scale_max = "100";
#$divider = $i;
#$text_orig = 1;
$nototal = 1;
include "includes/graphs/generic_multi_simplex_separated.inc.php";
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:24,代码来源:poller_time_separate.inc.php

示例6: dbFetchRow

<?php

if (is_numeric($vars['id'])) {
    $storage = dbFetchRow('SELECT * FROM `storage` WHERE `storage_id` = ?', array($vars['id']));
    if (is_numeric($storage['device_id']) && ($auth || device_permitted($storage['device_id']))) {
        $device = device_by_id_cache($storage['device_id']);
        $rrd_filename = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('storage-' . $storage['storage_mib'] . '-' . $storage['storage_descr'] . '.rrd');
        $title = generate_device_link($device);
        $title .= ' :: Storage :: ' . htmlentities($storage['storage_descr']);
        $auth = true;
    }
}
开发者ID:samyscoub,项目名称:librenms,代码行数:12,代码来源:auth.inc.php

示例7: dbFetchRow

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage graphs
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// $cbqos = dbFetchRows("SELECT * FROM `ports_cbqos` WHERE `port_id` = ?", array($port['port_id']));
if (is_numeric($vars['id'])) {
    $cbqos = dbFetchRow("SELECT * FROM `ports_cbqos` WHERE `cbqos_id` = ?", array($vars['id']));
    if (is_numeric($cbqos['device_id']) && ($auth || device_permitted($cbqos['device_id']))) {
        $device = device_by_id_cache($cbqos['device_id']);
        $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cbqos-" . $cbqos['policy_index'] . "-" . $cbqos['object_index'] . ".rrd");
        $title = generate_device_link($device);
        $title .= " :: CBQoS :: " . $cbqos['policy_index'] . "-" . $cbqos['object_index'];
        $auth = TRUE;
        $graph_return['rrds'][] = $rrd_filename;
    }
}
开发者ID:skive,项目名称:observium,代码行数:24,代码来源:auth.inc.php

示例8: foreach

<?php

$graph_type = "toner_usage";
echo "<div style='padding: 5px;'>\n        <table width=100% cellspacing=0 cellpadding=6 class='sortable'>";
echo "<tr class=tablehead>\n        <th width=280>Device</th>\n        <th>Toner</th>\n        <th width=100></th>\n        <th width=280>Usage</th>\n        <th width=50>Used</th>\n      </tr>";
foreach (dbFetchRows("SELECT * FROM `toner` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY D.hostname, S.toner_descr") as $toner) {
    if (device_permitted($toner['device_id'])) {
        $total = $toner['toner_capacity'];
        $perc = $toner['toner_current'];
        $graph_array['type'] = $graph_type;
        $graph_array['id'] = $toner['toner_id'];
        $graph_array['from'] = $config['time']['day'];
        $graph_array['to'] = $config['time']['now'];
        $graph_array['height'] = "20";
        $graph_array['width'] = "80";
        $graph_array_zoom = $graph_array;
        $graph_array_zoom['height'] = "150";
        $graph_array_zoom['width'] = "400";
        $link = "graphs/id=" . $graph_array['id'] . "/type=" . $graph_array['type'] . "/from=" . $graph_array['from'] . "/to=" . $graph_array['to'] . "/";
        $mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
        $background = get_percentage_colours(100 - $perc);
        echo "<tr class='health'><td>" . generate_device_link($toner) . "</td><td class=tablehead>" . $toner['toner_descr'] . "</td>\n         <td>{$mini_graph}</td>\n         <td>\n          <a href='#' {$store_popup}>" . print_percentage_bar(400, 20, $perc, "{$perc}%", "ffffff", $background['left'], $free, "ffffff", $background['right']) . "</a>\n          </td><td>{$perc}" . "%</td></tr>";
        if ($vars['view'] == "graphs") {
            echo "<tr></tr><tr class='health'><td colspan=5>";
            $graph_array['height'] = "100";
            $graph_array['width'] = "216";
            $graph_array['to'] = $config['time']['now'];
            $graph_array['id'] = $toner['toner_id'];
            $graph_array['type'] = $graph_type;
            include "includes/print-graphrow.inc.php";
            echo "</td></tr>";
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:toner.inc.php

示例9: foreach

?>
                 "</select>"+
                 "</div>"+
                 "<div class=\"form-group\">"+
                 "<input type=\"text\" name=\"serial\" id=\"serial\" value=\"<?php 
echo $_POST['serial'];
?>
\" placeholder=\"Serial\" class=\"form-control input-sm\"/>"+
                 "</div>"+
                 "<div class=\"form-group\">"+
                 "<strong>&nbsp;Device&nbsp;</strong>"+
                 "<select name=\"device\" id=\"device\" class=\"form-control input-sm\">"+
                 "<option value=\"\">All Devices</option>"+
<?php 
foreach (dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $data) {
    if (device_permitted($data['device_id'])) {
        echo '"<option value=\\"' . $data['device_id'] . '\\""+';
        if ($data['device_id'] == $_POST['device']) {
            echo '" selected"+';
        }
        echo '">' . $data['hostname'] . '</option>"+';
    }
}
?>
                 "</select>"+
                 "</div>"+
                 "<div class=\"form-group\">"+
                 "<input type=\"text\" size=24 name=\"device_string\" id=\"device_string\" value=\"<?php 
if ($_POST['device_string']) {
    echo $_POST['device_string'];
}
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:inventory.inc.php

示例10: get_vars

    exit;
}
$vars = get_vars();
$vars['page'] = "popup";
switch ($vars['entity_type']) {
    case "port":
        if (is_numeric($vars['entity_id']) && port_permitted($vars['entity_id'])) {
            $port = get_port_by_id($vars['entity_id']);
            echo generate_port_popup($port);
        } else {
            print_warning("You are not permitted to view this port.");
        }
        exit;
        break;
    case "device":
        if (is_numeric($vars['entity_id']) && device_permitted($vars['entity_id'])) {
            $device = device_by_id_cache($vars['entity_id']);
            echo generate_device_popup($device, $vars, $start, $end);
        } else {
            print_warning("You are not permitted to view this device.");
        }
        exit;
        break;
    case "group":
        if (is_numeric($vars['entity_id']) && $_SESSION['userlevel'] >= 5) {
            $group = get_group_by_id($vars['entity_id']);
            generate_group_popup_header($group, array());
        } else {
            print_warning("You are not permitted to view this device.");
        }
        exit;
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:entity_popup.php

示例11: dbFetchRow

<?php

if (is_numeric($vars['plugin'])) {
    $mplug = dbFetchRow("SELECT * FROM `munin_plugins` AS M, `devices` AS D WHERE `mplug_id` = ? AND D.device_id = M.device_id ", array($vars['plugin']));
} else {
    $mplug = dbFetchRow("SELECT * FROM `munin_plugins` AS M, `devices` AS D WHERE M.`device_id` = ? AND `mplug_type` = ?  AND D.device_id = M.device_id", array($device['device_id'], $vars['plugin']));
}
if (is_numeric($mplug['device_id']) && ($auth || device_permitted($mplug['device_id']))) {
    $device =& $mplug;
    $title = generate_device_link($device);
    $plugfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/munin/" . $mplug['mplug_type'];
    $title .= " :: Plugin :: " . $mplug['mplug_type'] . " - " . $mplug['mplug_title'];
    $auth = TRUE;
}
开发者ID:REAP720801,项目名称:librenms,代码行数:14,代码来源:auth.inc.php

示例12:

<?php

if (is_numeric($vars['id']) && ($auth || device_permitted($vars['id']))) {
    $device = device_by_id_cache($vars['id']);
    $title = generate_device_link($device);
    $graph_title = $device['hostname'];
    $auth = true;
}
开发者ID:rasssta,项目名称:librenms,代码行数:8,代码来源:auth.inc.php

示例13: foreach

                $cache['bgp']['external'][] = (int) $bgp['bgpPeer_id'];
                // Collect eBGP peers
            }
        }
    }
}
// OSPF
if (isset($config['enable_ospf']) && $config['enable_ospf']) {
    $routing['ospf']['last_seen'] = $config['time']['now'];
    foreach (dbFetchRows("SELECT `device_id`, `ospfAdminStat` FROM `ospf_instances`") as $ospf) {
        if (!$config['web_show_disabled']) {
            if ($cache['devices']['id'][$ospf['device_id']]['disabled']) {
                continue;
            }
        }
        if (device_permitted($ospf)) {
            if ($ospf['ospfAdminStat'] == 'enabled') {
                $routing['ospf']['up']++;
            } else {
                if ($ospf['ospfAdminStat'] == 'disabled') {
                    $routing['ospf']['down']++;
                } else {
                    continue;
                }
            }
            $routing['ospf']['count']++;
        }
    }
}
// Common permission sql query
//r(range_to_list($cache['devices']['permitted']));
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:cache-data.inc.php

示例14: array

    $sql = ' WHERE `devices`.`hostname`=?';
    $sql_array = array($device['hostname']);
} else {
    $sql = ' WHERE 1';
}
$sql .= ' AND `local_device_id` != 0 AND `remote_device_id` != 0 ';
$sql .= ' AND `local_device_id` IS NOT NULL AND `remote_device_id` IS NOT NULL ';
$tmp_ids = array();
foreach (dbFetchRows("SELECT DISTINCT least(`devices`.`device_id`, `remote_device_id`) AS `remote_device_id`, GREATEST(`remote_device_id`,`devices`.`device_id`) AS `local_device_id` FROM `links` LEFT JOIN `ports` ON `local_port_id`=`ports`.`port_id` LEFT JOIN `devices` ON `ports`.`device_id`=`devices`.`device_id` {$sql}", $sql_array) as $link_devices) {
    if (!in_array($link_devices['local_device_id'], $tmp_ids) && device_permitted($link_devices['local_device_id'])) {
        $link_dev = dbFetchRow("SELECT * FROM `devices` WHERE `device_id`=?", array($link_devices['local_device_id']));
        if (!empty($link_dev)) {
            $tmp_devices[] = array('id' => $link_devices['local_device_id'], 'label' => $link_dev['hostname'], 'title' => generate_device_link($link_dev, '', array(), '', '', '', 0), 'group' => $link_dev['location'], 'shape' => 'box');
        }
    }
    if (!in_array($link_devices['remote_device_id'], $tmp_ids) && device_permitted($link_devices['remote_device_id'])) {
        $link_dev = dbFetchRow("SELECT * FROM `devices` WHERE `device_id`=?", array($link_devices['remote_device_id']));
        if (!empty($link_dev)) {
            $tmp_devices[] = array('id' => $link_devices['remote_device_id'], 'label' => $link_dev['hostname'], 'title' => generate_device_link($link_dev, '', array(), '', '', '', 0), 'group' => $link_dev['location'], 'shape' => 'box');
        }
    }
    array_push($tmp_ids, $link_devices['local_device_id']);
    array_push($tmp_ids, $link_devices['remote_device_id']);
}
$tmp_ids = implode(',', $tmp_ids);
$nodes = json_encode($tmp_devices);
if (is_array($tmp_devices[0])) {
    $tmp_links = array();
    foreach (dbFetchRows("SELECT local_device_id, remote_device_id, `remote_hostname`,`ports`.*, `remote_port` FROM `links` LEFT JOIN `ports` ON `local_port_id`=`ports`.`port_id` LEFT JOIN `devices` ON `ports`.`device_id`=`devices`.`device_id` WHERE (`local_device_id` IN ({$tmp_ids}) AND `remote_device_id` IN ({$tmp_ids}))") as $link_devices) {
        $port = '';
        foreach ($tmp_devices as $k => $v) {
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:print-map.inc.php

示例15: dbFetchRow

<?php

if (is_numeric($vars['id'])) {
    $sensor = dbFetchRow('SELECT * FROM sensors WHERE sensor_id = ?', array($vars['id']));
    if (is_numeric($sensor['device_id']) && ($auth || device_permitted($sensor['device_id']))) {
        $device = device_by_id_cache($sensor['device_id']);
        $rrd_filename = get_sensor_rrd($device, $sensor);
        $title = generate_device_link($device);
        $title .= ' :: Sensor :: ' . htmlentities($sensor['sensor_descr']);
        $auth = true;
    }
}
开发者ID:awlx,项目名称:librenms,代码行数:12,代码来源:auth.inc.php


注:本文中的device_permitted函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。