• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP generate_box_close函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: print_neighbours

/**
 * Display neighbours.
 *
 * Display pages with device neighbours in some formats.
 * Examples:
 * print_neighbours() - display all neighbours from all devices
 * print_neighbours(array('pagesize' => 99)) - display 99 neighbours from all device
 * print_neighbours(array('pagesize' => 10, 'pageno' => 3, 'pagination' => TRUE)) - display 10 neighbours from page 3 with pagination header
 * print_neighbours(array('pagesize' => 10, 'device' = 4)) - display 10 neighbours for device_id 4
 *
 * @param array $vars
 * @return none
 *
 */
function print_neighbours($vars)
{
    // Get neighbours array
    $neighbours = get_neighbours_array($vars);
    if (!$neighbours['count']) {
        // There have been no entries returned. Print the warning.
        print_warning('<h4>No neighbours found!</h4>');
    } else {
        // Entries have been returned. Print the table.
        $list = array('device' => FALSE);
        if ($vars['page'] != 'device') {
            $list['device'] = TRUE;
        }
        if (in_array($vars['graph'], array('bits', 'upkts', 'nupkts', 'pktsize', 'percent', 'errors', 'etherlike', 'fdb_count'))) {
            $graph_types = array($vars['graph']);
        } else {
            $graph_types = array('bits', 'upkts', 'errors');
        }
        $string = generate_box_open($vars['header']);
        $string .= '<table class="table  table-striped table-hover table-condensed">' . PHP_EOL;
        $cols = array(array(NULL, 'class="state-marker"'), 'device_a' => 'Local Device', 'port_a' => 'Local Port', 'NONE' => NULL, 'device_b' => 'Remote Device', 'port_b' => 'Remote Port', 'protocol' => 'Protocol');
        if (!$list['device']) {
            unset($cols[0], $cols['device_a']);
        }
        $string .= get_table_header($cols, $vars);
        $string .= '  <tbody>' . PHP_EOL;
        foreach ($neighbours['entries'] as $entry) {
            $string .= '  <tr class="' . $entry['row_class'] . '">' . PHP_EOL;
            if ($list['device']) {
                $string .= '   <td class="state-marker"></td>';
                $string .= '    <td class="entity">' . generate_device_link($entry, NULL, array('tab' => 'ports', 'view' => 'neighbours')) . '</td>' . PHP_EOL;
            }
            $string .= '    <td><span class="entity">' . generate_port_link($entry) . '</span><br />' . $entry['ifAlias'] . '</td>' . PHP_EOL;
            $string .= '    <td><i class="icon-resize-horizontal text-success"></i></td>' . PHP_EOL;
            if (is_numeric($entry['remote_port_id']) && $entry['remote_port_id']) {
                $remote_port = get_port_by_id_cache($entry['remote_port_id']);
                $remote_device = device_by_id_cache($remote_port['device_id']);
                $string .= '    <td><span class="entity">' . generate_device_link($remote_device) . '</span><br />' . $remote_device['hardware'] . '</td>' . PHP_EOL;
                $string .= '    <td><span class="entity">' . generate_port_link($remote_port) . '</span><br />' . $remote_port['ifAlias'] . '</td>' . PHP_EOL;
            } else {
                $string .= '    <td><span class="entity">' . $entry['remote_hostname'] . '</span><br />' . $entry['remote_platform'] . '</td>' . PHP_EOL;
                $string .= '    <td><span class="entity">' . $entry['remote_port'] . '</span></td>' . PHP_EOL;
            }
            $string .= '    <td>' . strtoupper($entry['protocol']) . '</td>' . PHP_EOL;
            $string .= '  </tr>' . PHP_EOL;
        }
        $string .= '  </tbody>' . PHP_EOL;
        $string .= '</table>';
        $string .= generate_box_close();
        // Print pagination header
        if ($neighbours['pagination_html']) {
            $string = $neighbours['pagination_html'] . $string . $neighbours['pagination_html'];
        }
        // Print
        echo $string;
    }
}
开发者ID:Natolumin,项目名称:observium,代码行数:71,代码来源:neighbours.inc.php


示例2: print_authlog

/**
 * Display authentication log.
 *
 * @param array $vars
 * @return none
 *
 */
function print_authlog($vars)
{
    $authlog = get_authlog_array($vars);
    if (!$authlog['count']) {
        // There have been no entries returned. Print the warning. Shouldn't happen, how did you get here without auth?!
        print_warning('<h4>No authentication entries found!</h4>');
    } else {
        $string = generate_box_open($vars['header']);
        // Entries have been returned. Print the table.
        $string .= '<table class="' . OBS_CLASS_TABLE_STRIPED_MORE . '">' . PHP_EOL;
        $cols = array('date' => array('Date', 'style="width: 150px;"'), 'user' => 'User', 'from' => 'From', 'ua' => array('User-Agent', 'style="width: 200px;"'), 'NONE' => 'Action');
        if ($vars['page'] == 'preferences') {
            unset($cols['user']);
        }
        $string .= get_table_header($cols);
        //, $vars); // Currently sorting is not available
        $string .= '<tbody>' . PHP_EOL;
        foreach ($authlog['entries'] as $entry) {
            if (strlen($entry['user_agent']) > 1) {
                $entry['detect_browser'] = detect_browser($entry['user_agent']);
                //r($entry['detect_browser']);
                $entry['user_agent'] = '<i class="' . $entry['detect_browser']['icon'] . '"></i>&nbsp;' . $entry['detect_browser']['browser_full'];
                if ($entry['detect_browser']['platform']) {
                    $entry['user_agent'] .= ' (' . $entry['detect_browser']['platform'] . ')';
                }
            }
            if (strstr(strtolower($entry['result']), 'fail', true)) {
                $class = " class=\"error\"";
            } else {
                $class = "";
            }
            $string .= '
      <tr' . $class . '>
        <td>' . $entry['datetime'] . '</td>';
            if (isset($cols['user'])) {
                $string .= '
        <td>' . escape_html($entry['user']) . '</td>';
            }
            $string .= '
        <td>' . ($_SESSION['userlevel'] > 5 ? generate_popup_link('ip', $entry['address']) : preg_replace('/^\\d+/', '*', $entry['address'])) . '</td>
        <td>' . $entry['user_agent'] . '</td>
        <td>' . $entry['result'] . '</td>
      </tr>' . PHP_EOL;
        }
        $string .= '  </tbody>' . PHP_EOL;
        $string .= '</table>';
        $string .= generate_box_close();
        // Add pagination header
        if ($authlog['pagination_html']) {
            $string = $authlog['pagination_html'] . $string . $authlog['pagination_html'];
        }
        // Print authlog
        echo $string;
    }
}
开发者ID:Natolumin,项目名称:observium,代码行数:62,代码来源:authlog.inc.php


示例3: print_processor_table

function print_processor_table($vars)
{
    global $cache;
    $sql = generate_processor_query($vars);
    $processors = array();
    foreach (dbFetchRows($sql) as $proc) {
        if (isset($cache['devices']['id'][$proc['device_id']])) {
            $proc['hostname'] = $cache['devices']['id'][$proc['device_id']]['hostname'];
            $proc['html_row_class'] = $cache['devices']['id'][$proc['device_id']]['html_row_class'];
            $processors[] = $proc;
        }
    }
    // Sorting
    // FIXME. Sorting can be as function, but in must before print_table_header and after get table from db
    switch ($vars['sort_order']) {
        case 'desc':
            $sort_order = SORT_DESC;
            $sort_neg = SORT_ASC;
            break;
        case 'reset':
            unset($vars['sort'], $vars['sort_order']);
            // no break here
        // no break here
        default:
            $sort_order = SORT_ASC;
            $sort_neg = SORT_DESC;
    }
    switch ($vars['sort']) {
        case 'usage':
            $processors = array_sort_by($processors, 'processor_usage', $sort_neg, SORT_NUMERIC);
            break;
        default:
            $processors = array_sort_by($processors, 'hostname', $sort_order, SORT_STRING, 'processor_descr', $sort_order, SORT_STRING);
            break;
    }
    $processors_count = count($processors);
    // Pagination
    $pagination_html = pagination($vars, $processors_count);
    echo $pagination_html;
    if ($vars['pageno']) {
        $processors = array_chunk($processors, $vars['pagesize']);
        $processors = $processors[$vars['pageno'] - 1];
    }
    // End Pagination
    echo generate_box_open();
    print_processor_table_header($vars);
    foreach ($processors as $processor) {
        print_processor_row($processor, $vars);
    }
    echo "</tbody></table>";
    echo generate_box_close();
    echo $pagination_html;
}
开发者ID:Natolumin,项目名称:observium,代码行数:53,代码来源:processor.inc.php


示例4: print_p2pradio_table

function print_p2pradio_table($vars)
{
    if ($vars['view'] == "graphs" || isset($vars['graph'])) {
        $stripe_class = "table-striped-two";
    } else {
        $stripe_class = "table-striped";
    }
    echo generate_box_open();
    echo '<table class="table table-hover ' . $stripe_class . '  table-condensed">';
    print_p2pradio_table_header($vars);
    $sql = generate_p2pradio_query($vars);
    $radios = dbFetchRows($sql);
    foreach ($radios as $radio) {
        print_p2pradio_row($radio, $vars);
    }
    echo '</table>';
    echo generate_box_close();
}
开发者ID:Natolumin,项目名称:observium,代码行数:18,代码来源:p2pradio.inc.php


示例5: generate_port_popup_header

/**
 * Returns a string containing an HTML table to be used in popups for the port entity type
 *
 * @param array $port array
 *
 * @return string Table containing port header for popups
 */
function generate_port_popup_header($port)
{
    // Push through processing function to set attributes
    humanize_port($port);
    $contents .= generate_box_open();
    $contents .= '<table class="' . OBS_CLASS_TABLE . '">
        <tr class="' . $port['row_class'] . '" style="font-size: 10pt;">
          <td class="state-marker"></td>
          <td style="width: 10px;"></td>
          <td style="width: 250px;"><a href="#" class="' . $port['html_class'] . '" style="font-size: 15px; font-weight: bold;">' . $port['port_label'] . '</a><br />' . escape_html($port['ifAlias']) . '</td>
          <td style="width: 100px;">' . $port['human_speed'] . '<br />' . $port['ifMtu'] . '</td>
          <td>' . $port['human_type'] . '<br />' . $port['human_mac'] . '</td>
        </tr>
          </table>';
    $contents .= generate_box_close();
    return $contents;
}
开发者ID:Natolumin,项目名称:observium,代码行数:24,代码来源:port.inc.php


示例6: generate_url

                $navbar['options'][$app_section]['class'] = "active";
            }
            $navbar['options'][$app_section]['url'] = generate_url($vars, array('app_section' => $app_section));
            $navbar['options'][$app_section]['text'] = $text;
        }
        print_navbar($navbar);
        unset($navbar);
    } else {
        // It appears this app doesn't have multiple sections. We set app_section to default here.
        $vars['app_section'] = 'default';
    }
    // If a matching app_section array exists within app_graphs, print the graphs.
    if (isset($app_graphs[$vars['app_section']]) && is_array($app_graphs[$vars['app_section']])) {
        echo generate_box_open();
        echo '<table class="table table-striped table-hover  table-condensed">';
        foreach ($app_graphs[$vars['app_section']] as $key => $text) {
            $graph_type = $key;
            $graph_array['to'] = $config['time']['now'];
            $graph_array['id'] = $app['app_id'];
            $graph_array['type'] = "application_" . $key;
            echo '<tr><td>';
            echo '<h3>', $text, '</h4>';
            print_graph_row($graph_array);
            echo '</td></tr>';
        }
        echo '</table>';
        generate_box_close();
    }
}
register_html_title("Apps");
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:apps.inc.php


示例7: print_xml

/**
 * Pretty print for xml string
 *
 * @param string $xml An xml string
 * @param boolean $formatted Convert or not output to human formatted xml
 */
function print_xml($xml, $formatted = TRUE)
{
    if ($formatted) {
        $xml = format_xml($xml);
    }
    if (is_cli()) {
        echo $xml;
    } else {
        echo generate_box_open(array('title' => 'Output', 'padding' => TRUE));
        echo '
    <pre class="prettyprint lang-xml small">' . escape_html($xml) . '</pre>
    <span><em>NOTE: XML values are always escaped, that\'s why you can see this <mark>' . escape_html(escape_html('< > & " \'')) . '</mark> instead of this <mark>' . escape_html('< > & " \'') . '</mark>. <u>Leave them as is</u>.</em></span>
    <script type="text/javascript">window.prettyPrint && prettyPrint();</script>' . PHP_EOL;
        echo generate_box_close();
    }
}
开发者ID:Natolumin,项目名称:observium,代码行数:22,代码来源:templates.inc.php


示例8: print_bgp_table


//.........这里部分代码省略.........
                        $afi_class = 'success';
                        break;
                    case 'ipv6':
                    case 'ipv6z':
                        $afi_class = 'primary';
                        break;
                    default:
                        $afi_class = 'default';
                }
                switch ($peer_afi['safi']) {
                    case 'unicast':
                        $safi_class = 'delayed';
                        break;
                    case 'multicast':
                        $safi_class = 'warning';
                        break;
                    case 'vpn':
                        $safi_class = 'suppressed';
                        break;
                    default:
                        $safi_class = 'default';
                }
                $peer_afi_html .= '<span class="label label-' . $afi_class . '">' . $peer_afi['afi'] . '</span>';
                $peer_afi_html .= '<span class="label label-' . $safi_class . '">' . $peer_afi['safi'] . '</span>';
                $peer_afi_html .= '</span>';
                $peer_afis_html[] = $peer_afi_html;
            }
            $string .= '  <tr class="' . $peer['html_row_class'] . '">' . PHP_EOL;
            $string .= '     <td class="state-marker"></td>' . PHP_EOL;
            $string .= '     <td></td>' . PHP_EOL;
            $string .= '     <td style="white-space: nowrap" class="entity">' . $local_ip . '<br />' . $local_name . '</td>' . PHP_EOL;
            $string .= '     <td><span class="text-success"><i class="glyphicon glyphicon-arrow-right"></i></span></td>' . PHP_EOL;
            $string .= '     <td style="white-space: nowrap" class="entity">' . $peer_ip . '<br />' . $peer_name . '</td>' . PHP_EOL;
            $string .= '     <td><span class="label label-' . $peer['peer_type_class'] . '">' . $peer['peer_type'] . '</span></td>' . PHP_EOL;
            $string .= '     <td>' . implode('<br />', $peer_afis_html) . '</td>' . PHP_EOL;
            $string .= '     <td><strong>' . $peer_as . '</strong><br />' . $peer['astext'] . '</td>' . PHP_EOL;
            $string .= '     <td><strong><span class=" label label-' . $peer['admin_class'] . '">' . $peer['bgpPeerAdminStatus'] . '</span><br /><span class="label label-' . $peer['state_class'] . '">' . $peer['bgpPeerState'] . '</span></strong></td>' . PHP_EOL;
            $string .= '     <td style="white-space: nowrap">' . formatUptime($peer['bgpPeerFsmEstablishedTime']) . '<br />
                Updates: <i class="icon-circle-arrow-down text-success"></i> ' . format_si($peer['bgpPeerInUpdates']) . ' <i class="icon-circle-arrow-up text-primary"></i> ' . format_si($peer['bgpPeerOutUpdates']) . '</td>' . PHP_EOL;
            $string .= '  </tr>' . PHP_EOL;
            // Graphs
            $peer_graph = FALSE;
            switch ($vars['graph']) {
                case 'prefixes_ipv4unicast':
                case 'prefixes_ipv4multicast':
                case 'prefixes_ipv4vpn':
                case 'prefixes_ipv6unicast':
                case 'prefixes_ipv6multicast':
                    $afisafi = preg_replace('/prefixes_(ipv[46])(\\w+)/', '$1.$2', $vars['graph']);
                    // prefixes_ipv6unicast ->> ipv6.unicast
                    if (isset($peer_afis[$afisafi]) && $peer['bgpPeer_id']) {
                        $graph_array['type'] = 'bgp_' . $vars['graph'];
                        $graph_array['id'] = $peer['bgpPeer_id'];
                        $peer_graph = TRUE;
                    }
                    break;
                case 'updates':
                    if ($peer['bgpPeer_id']) {
                        $graph_array['type'] = 'bgp_updates';
                        $graph_array['id'] = $peer['bgpPeer_id'];
                        $peer_graph = TRUE;
                    }
                    break;
                case 'macaccounting_bits':
                case 'macaccounting_pkts':
                    //FIXME. I really still not know it works or not? -- mike
                    // This part copy-pasted from old code as is
                    $acc = dbFetchRow("SELECT * FROM `mac_accounting` AS M\n                            LEFT JOIN `ip_mac` AS I ON M.mac = I.mac_address\n                            LEFT JOIN `ports` AS P ON P.port_id = M.port_id\n                            LEFT JOIN `devices` AS D ON D.device_id = P.device_id\n                            WHERE I.ip_address = ?", array($peer['bgpPeerRemoteAddr']));
                    $database = get_rrd_path($device, "cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
                    if (is_array($acc) && is_file($database)) {
                        $peer_graph = TRUE;
                        $graph_array['id'] = $acc['ma_id'];
                        $graph_array['type'] = $vars['graph'];
                    }
                    break;
            }
            if ($peer_graph) {
                $graph_array['to'] = $config['time']['now'];
                $string .= '  <tr class="' . $peer['html_row_class'] . '">' . PHP_EOL;
                $string .= '    <td class="state-marker"></td><td colspan="10" style="white-space: nowrap">' . PHP_EOL;
                $string .= generate_graph_row($graph_array);
                $string .= '    </td>' . PHP_EOL . '  </tr>' . PHP_EOL;
            } else {
                if ($list['graph']) {
                    // Empty row for correct view class table-striped-two
                    $string .= '  <tr class="' . $peer['html_row_class'] . '"><td class="state-marker"></td><td colspan="10"></td></tr>' . PHP_EOL;
                }
            }
        }
        $string .= '  </tbody>' . PHP_EOL;
        $string .= '</table>';
        $string .= generate_box_close();
        // Print pagination header
        if ($entries['pagination_html']) {
            $string = $entries['pagination_html'] . $string . $entries['pagination_html'];
        }
        // Print
        echo $string;
    }
}
开发者ID:Natolumin,项目名称:observium,代码行数:101,代码来源:routing.inc.php


示例9: print_dot1xtable


//.........这里部分代码省略.........
    $where = ' WHERE 1 ';
    foreach ($vars as $var => $value) {
        if ($value != '') {
            switch ($var) {
                case 'device':
                case 'device_id':
                    $where .= generate_query_values($value, 'device_id');
                    break;
                case 'address':
                    if (isset($vars['searchby']) && $vars['searchby'] == 'ip') {
                        $value = trim($value);
                        $where .= generate_query_values($value, 'ipv4_addr', '%LIKE%');
                    } else {
                        if (isset($vars['searchby']) && $vars['searchby'] == 'mac') {
                            $value = str_replace(array(':', ' ', '-', '.', '0x'), '', $value);
                            $where .= generate_query_values($value, 'M.mac_addr', '%LIKE%');
                        } else {
                            $value = trim($value);
                            $where .= generate_query_values($value, 'username', '%LIKE%');
                        }
                    }
                    break;
            }
        }
    }
    // Check permissions
    $query_permitted = generate_query_permitted(array('device'), array('device_table' => 'M'));
    $query = 'FROM `wifi_sessions` AS M ';
    $query .= 'LEFT JOIN `wifi_radios` AS I ON I.`wifi_radio_id` = M.`radio_id` ';
    $query .= $where . $query_permitted;
    $query_count = 'SELECT COUNT(`wifi_session_id`) ' . $query;
    $query = 'SELECT *, M.`mac_addr` AS `session_mac` ' . $query;
    $query .= ' ORDER BY M.`timestamp` DESC';
    $query .= " LIMIT {$start},{$pagesize}";
    // Query wireless  sessions table
    $entries = dbFetchRows($query, $param);
    // Query wireless  sessions table count
    if ($pagination) {
        $count = dbFetchCell($query_count, $param);
    }
    $aps_db = dbFetchRows("SELECT `wifi_accesspoint_id`, `name`, `ap_number`  FROM `wifi_accesspoints`");
    foreach ($aps_db as $ap_db) {
        $aps_sorted_db[$ap_db['wifi_accesspoint_id']] = $ap_db;
    }
    $list = array('device' => FALSE, 'port' => FALSE);
    // A radio is like a port
    if (!isset($vars['device']) || empty($vars['device']) || $vars['page'] == 'search') {
        $list['device'] = TRUE;
    }
    if (!isset($vars['port']) || empty($vars['port']) || $vars['page'] == 'search') {
        $list['port'] = TRUE;
    }
    $string = generate_box_open();
    $string .= '<table class="table  table-striped table-hover table-condensed">' . PHP_EOL;
    if (!$short) {
        $string .= '  <thead>' . PHP_EOL;
        $string .= '    <tr>' . PHP_EOL;
        $string .= '      <th>MAC Address</th>' . PHP_EOL;
        $string .= '      <th>IP Address</th>' . PHP_EOL;
        $string .= '      <th>Username</th>' . PHP_EOL;
        $string .= '      <th>SSID/VLAN</th>' . PHP_EOL;
        $string .= '      <th>Last Seen</th>' . PHP_EOL;
        if ($list['device']) {
            $string .= '      <th>Device</th>' . PHP_EOL;
        }
        if ($list['port']) {
            $string .= '      <th>Interface/AP</th>' . PHP_EOL;
        }
        $string .= '    </tr>' . PHP_EOL;
        $string .= '  </thead>' . PHP_EOL;
    }
    $string .= '  <tbody>' . PHP_EOL;
    foreach ($entries as $entry) {
        $ap_id = $entry['accesspoint_id'];
        $interface = $aps_sorted_db[$ap_id]['name'];
        $string .= '  <tr>' . PHP_EOL;
        $string .= '    <td style="width: 140px;">' . generate_popup_link('mac', format_mac($entry['session_mac'])) . '</td>' . PHP_EOL;
        $string .= '    <td style="width: 140px;">' . generate_popup_link('ip', $entry['ipv4_addr']) . '</td>' . PHP_EOL;
        $string .= '    <td style="white-space: nowrap;">' . $entry['username'] . '</td>' . PHP_EOL;
        $string .= '    <td style="width: 140px;">' . $entry['ssid'] . '</td>' . PHP_EOL;
        $string .= '    <td style="white-space: nowrap;">' . $entry['timestamp'] . '</td>' . PHP_EOL;
        if ($list['device']) {
            $dev = device_by_id_cache($entry['device_id']);
            $string .= '    <td class="entity" style="white-space: nowrap;">' . generate_device_link($dev) . '</td>' . PHP_EOL;
        }
        if ($list['port']) {
            $string .= '    <td class="entity"><a href="' . generate_url(array('page' => 'device', 'device' => $entry['device_id'], 'tab' => 'wifi', 'view' => 'accesspoint', 'accesspoint' => $ap_id)) . '">' . $interface . '</a></td>' . PHP_EOL;
        }
        $string .= '  </tr>' . PHP_EOL;
    }
    $string .= '  </tbody>' . PHP_EOL;
    $string .= '</table>';
    $string .= generate_box_close();
    // Print pagination header
    if ($pagination) {
        $string = pagination($vars, $count) . $string . pagination($vars, $count);
    }
    // Print wireless sessions
    echo $string;
}
开发者ID:Natolumin,项目名称:observium,代码行数:101,代码来源:dot1xtable.inc.php


示例10: print_addresses


//.........这里部分代码省略.........
        //$query_netscaler_count = str_replace(array('vsvr_ip', '0.0.0.0'), array('vsvr_ipv6', '0:0:0:0:0:0:0:0'), $query_netscaler_count);
    }
    $entries = dbFetchRows($query_netscaler, $param_netscaler);
    // Rewrite netscaler addresses
    foreach ($entries as $entry) {
        $ip_address = $address_type == 'ipv4' ? $entry['vsvr_ip'] : $entry['vsvr_' . $address_type];
        $ip_network = $address_type == 'ipv4' ? $entry['vsvr_ip'] . '/32' : $entry['vsvr_' . $address_type] . '/128';
        $ip_array[] = array('type' => 'netscaler_vsvr', 'device_id' => $entry['device_id'], 'hostname' => $entry['hostname'], 'vsvr_id' => $entry['vsvr_id'], 'vsvr_label' => $entry['vsvr_label'], 'ifAlias' => 'Netscaler: ' . $entry['vsvr_type'] . '/' . $entry['vsvr_entitytype'], $address_type . '_address' => $ip_address, $address_type . '_network' => $ip_network);
    }
    //print_message($query_netscaler_count);
    $query = 'FROM `ip_addresses` AS A ';
    $query .= 'LEFT JOIN `ports`   AS I ON I.`port_id`   = A.`port_id` ';
    $query .= 'LEFT JOIN `devices` AS D ON I.`device_id` = D.`device_id` ';
    $query .= 'LEFT JOIN `ip_networks` AS N ON N.`ip_network_id` = A.`ip_network_id` ';
    $query .= $where . $query_port_permitted;
    //$query_count = 'SELECT COUNT(`ip_address_id`) ' . $query;
    $query = 'SELECT * ' . $query;
    $query .= ' ORDER BY A.`ip_address`';
    if ($ip_valid) {
        $pagination = FALSE;
    }
    // Override by address type
    $query = str_replace(array('ip_address', 'ip_network'), array($address_type . '_address', $address_type . '_network'), $query);
    //$query_count = str_replace(array('ip_address', 'ip_network'), array($address_type.'_address', $address_type.'_network'), $query_count);
    // Query addresses
    $entries = dbFetchRows($query, $param);
    $ip_array = array_merge($ip_array, $entries);
    $ip_array = array_sort($ip_array, $address_type . '_address');
    // Query address count
    //if ($pagination) { $count = dbFetchCell($query_count, $param); }
    if ($pagination) {
        $count = count($ip_array);
        $ip_array = array_slice($ip_array, $start, $pagesize);
    }
    $list = array('device' => FALSE);
    if (!isset($vars['device']) || empty($vars['device']) || $vars['page'] == 'search') {
        $list['device'] = TRUE;
    }
    $string = generate_box_open($vars['header']);
    $string .= '<table class="' . OBS_CLASS_TABLE_STRIPED . '">' . PHP_EOL;
    if (!$short) {
        $string .= '  <thead>' . PHP_EOL;
        $string .= '    <tr>' . PHP_EOL;
        if ($list['device']) {
            $string .= '      <th>Device</th>' . PHP_EOL;
        }
        $string .= '      <th>Interface</th>' . PHP_EOL;
        $string .= '      <th>Address</th>' . PHP_EOL;
        $string .= '      <th>Description</th>' . PHP_EOL;
        $string .= '    </tr>' . PHP_EOL;
        $string .= '  </thead>' . PHP_EOL;
    }
    $string .= '  <tbody>' . PHP_EOL;
    foreach ($ip_array as $entry) {
        $address_show = TRUE;
        if ($ip_valid) {
            // If address not in specified network, don't show entry.
            if ($address_type === 'ipv4') {
                $address_show = Net_IPv4::ipInNetwork($entry[$address_type . '_address'], $addr . '/' . $mask);
            } else {
                $address_show = Net_IPv6::isInNetmask($entry[$address_type . '_address'], $addr, $mask);
            }
        }
        if ($address_show) {
            list($prefix, $length) = explode('/', $entry[$address_type . '_network']);
            if (port_permitted($entry['port_id']) || $entry['type'] == 'netscaler_vsvr') {
                if ($entry['type'] == 'netscaler_vsvr') {
                    $entity_link = generate_entity_link($entry['type'], $entry);
                } else {
                    humanize_port($entry);
                    if ($entry['ifInErrors_delta'] > 0 || $entry['ifOutErrors_delta'] > 0) {
                        $port_error = generate_port_link($entry, '<span class="label label-important">Errors</span>', 'port_errors');
                    }
                    $entity_link = generate_port_link($entry, $entry['port_label_short']) . ' ' . $port_error;
                }
                $device_link = generate_device_link($entry);
                $string .= '  <tr>' . PHP_EOL;
                if ($list['device']) {
                    $string .= '    <td class="entity" style="white-space: nowrap">' . $device_link . '</td>' . PHP_EOL;
                }
                $string .= '    <td class="entity">' . $entity_link . '</td>' . PHP_EOL;
                if ($address_type === 'ipv6') {
                    $entry[$address_type . '_address'] = Net_IPv6::compress($entry[$address_type . '_address']);
                }
                $string .= '    <td>' . generate_popup_link('ip', $entry[$address_type . '_address'] . '/' . $length) . '</td>' . PHP_EOL;
                $string .= '    <td>' . $entry['ifAlias'] . '</td>' . PHP_EOL;
                $string .= '  </tr>' . PHP_EOL;
            }
        }
    }
    $string .= '  </tbody>' . PHP_EOL;
    $string .= '</table>';
    $string .= generate_box_close();
    // Print pagination header
    if ($pagination) {
        $string = pagination($vars, $count) . $string . pagination($vars, $count);
    }
    // Print addresses
    echo $string;
}
开发者ID:Natolumin,项目名称:observium,代码行数:101,代码来源:addresses.inc.php


示例11: print_syslog_rules_table


//.........这里部分代码省略.........
 <form id="edit" name="edit" method="post" class="form" action="' . generate_url(array('page' => 'syslog_rules')) . '">
  <input type="hidden" name="la_id" value="' . $la['la_id'] . '">

  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Delete Syslog Rule ' . escape_html($la['la_descr']) . '</h3>
  </div>
  <div class="modal-body">

  <span class="help-block">This will completely delete the rule and all associations and history.</span>
  <fieldset>
    <div class="control-group">
      <label class="control-label" for="confirm">
        <strong>Confirm</strong>
      </label>
      <div class="controls">
        <label class="checkbox">
          <input type="checkbox" name="confirm" value="confirm" onchange="javascript: showWarning(this.checked, ' . $la['la_id'] . ');" />
          Yes, please delete this rule.
        </label>

      <script type="text/javascript">' . "\n        function showWarning(checked, id) {\n          \$('#warning'+id).toggle();\n          if (checked) {\n            \$('#delete_button'+id).removeAttr('disabled');\n          } else {\n            \$('#delete_button'+id).attr('disabled', 'disabled');\n          }\n        } " . '
      </script>

      </div>
    </div>
  </fieldset>

  <div class="alert alert-message alert-danger" id="warning' . $la['la_id'] . '" style="display:none;">
    <h4 class="alert-heading"><i class="icon-warning-sign"></i> Warning!</h4>
    This rule and all history will be completely deleted!
  </div>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
    <button id="delete_button' . $la['la_id'] . '" type="submit" class="btn btn-danger" name="submit" value="delete_syslog_rule" disabled><i class="icon-trash icon-white"></i> Delete Rule</button>
  </div>
 </form>
</div>';
            // Edit Rule Modal
            $modals .= '
<div id="edit_modal_' . $la['la_id'] . '" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <form id="edit" name="edit" method="post" class="form form-horizontal" action="">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="edit_modal_label">Edit Syslog Rule</h3>
  </div>
  <div class="modal-body">

  <input type="hidden" name="la_id" value="' . $la['la_id'] . '">

  <fieldset>

    <div class="control-group">
      <label class="control-label" for="la_name">Rule Name</label>
      <div class="controls">
        <input type="text" name="la_name" size="32" value="' . escape_html($la['la_name']) . '"/>
      </div>
    </div>

    <div class="control-group">
      <label class="control-label" for="la_descr">Description</label>
      <div class="controls">
        <textarea class="form-control col-sm-12" name="la_descr" rows="3">' . escape_html($la['la_descr']) . '</textarea>
      </div>
    </div>

    <div class="control-group">
      <label class="control-label" for="la_rule">Regular Expression</label>
      <div class="controls">
        <textarea class="form-control col-sm-12" name="la_rule" rows="3">' . escape_html($la['la_rule']) . '</textarea>
      </div>
    </div>

    <div class="control-group">
      <label class="control-label" for="la_disable">Status</label>
      <div class="controls">
        <input type=checkbox id="la_disable" name="la_disable" ' . ($la['la_disable'] ? 'checked' : '') . ' data-toggle="switch" data-on-text="disabled" data-off-text="enabled" data-on-color="danger" data-off-color="primary">
      </div>
    </div>


  </fieldset>

  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
    <button type="submit" class="btn btn-primary" name="submit" value="edit_syslog_rule"><i class="icon-ok icon-white"></i> Save Changes</button>
  </div>
 </form>
</div>';
        }
        $string .= '</table>';
        $string .= generate_box_close();
        echo $string;
    } else {
        print_warning("There are currently no Syslog alerting filters defined.");
    }
    echo $modals;
}
开发者ID:Natolumin,项目名称:observium,代码行数:101,代码来源:syslog_rules.inc.php


示例12: print_mac_addresses

/**
 * Display Interface MACs addresses.
 *
 * Display pages with MAC addresses from device Interfaces.
 *
 * @param array $vars
 * @return none
 *
 */
function print_mac_addresses($vars)
{
    // With pagination? (display page numbers in header)
    $pagination = isset($vars['pagination']) && $vars['pagination'];
    pagination($vars, 0, TRUE);
    // Get default pagesize/pageno
    $pageno = $vars['pageno'];
    $pagesize = $vars['pagesize'];
    $start = $pagesize * $pageno - $pagesize;
    $param = array();
    $where = ' WHERE 1 ';
    foreach ($vars as $var => $value) {
        if ($value != '') {
            switch ($var) {
                case 'device':
                case 'device_id':
                    $where .= generate_query_values($value, 'device_id');
                    break;
                case 'interface':
                    $where .= generate_query_values($value, 'ifDescr', 'LIKE');
                    break;
                case 'address':
                    $value = str_replace(array(':', ' ', '-', '.', '0x'), '', $value);
                    $where .= generate_query_values($value, 'ifPhysAddress', '%LIKE%');
                    break;
            }
        }
    }
    $where .= ' AND `ifPhysAddress` IS NOT NULL';
    //Exclude empty MACs
    // Show MACs only for permitted ports
    $query_permitted = generate_query_permitted(array('port'));
    $query = 'FROM `ports` ';
    $query .= $where . $query_permitted;
    $query_count = 'SELECT COUNT(*) ' . $query;
    $query = 'SELECT * ' . $query;
    $query .= ' ORDER BY `ifPhysAddress`';
    $query .= " LIMIT {$start},{$pagesize}";
    // Query addresses
    $entries = dbFetchRows($query, $param);
    // Query address count
    if ($pagination) {
        $count = dbFetchCell($query_count, $param);
    }
    $list = array('device' => FALSE);
    if (!isset($vars['device']) || empty($vars['device']) || $vars['page'] == 'search') {
        $list['device'] = TRUE;
    }
    $string = generate_box_open($vars['header']);
    $string .= '<table class="table  table-striped table-hover table-condensed">' . PHP_EOL;
    if (!$short) {
        $string .= '  <thead>' . PHP_EOL;
        $string .= '    <tr>' . PHP_EOL;
        if ($list['device']) {
            $string .= '      <th>Device</th>' . PHP_EOL;
        }
        $string .= '      <th>Interface</th>' . PHP_EOL;
        $string .= '      <th>MAC Address</th>' . PHP_EOL;
        $string .= '      <th>Description</th>' . PHP_EOL;
        $string .= '    </tr>' . PHP_EOL;
        $string .= '  </thead>' . PHP_EOL;
    }
    $string .= '  <tbody>' . PHP_EOL;
    foreach ($entries as $entry) {
        if (port_permitted($entry['port_id'])) {
            humanize_port($entry);
            $string .= '  <tr>' . PHP_EOL;
            if ($list['device']) {
                $dev = device_by_id_cache($entry['device_id']);
                $string .= '    <td class="entity" style="white-space: nowrap;">' . generate_device_link($dev) . '</td>' . PHP_EOL;
            }
            if ($entry['ifInErrors_delta'] > 0 || $entry['ifOutErrors_delta'] > 0) {
                $port_error = generate_port_link($entry, '<span class="label label-important">Errors</span>', 'port_errors');
            }
            $string .= '    <td class="entity">' . generate_port_link($entry, $entry['port_label_short']) . ' ' . $port_error . '</td>' . PHP_EOL;
            $string .= '    <td style="width: 160px;">' . generate_popup_link('mac', $entry['human_mac']) . '</td>' . PHP_EOL;
            $string .= '    <td>' . $entry['ifAlias'] . '</td>' . PHP_EOL;
            $string .= '  </tr>' . PHP_EOL;
        }
    }
    $string .= '  </tbody>' . PHP_EOL;
    $string .= '</table>';
    $string .= generate_box_close();
    // Print pagination header
    if ($pagination) {
        $string = pagination($vars, $count) . $string . pagination($vars, $count);
    }
    // Print MAC addresses
    echo $string;
}
开发者ID:Natolumin,项目名称:observium,代码行数:99,代码来源:mac_addresses.inc.php


示例13: print_pseudowire_table

function print_pseudowire_table($vars)
{
    $pws = get_pseudowire_table($vars);
    $pws_count = count($pws);
    // Pagination
    $pagination_html = pagination($vars, $pws_count);
    echo $pagination_html;
    if ($vars['pageno']) {
        $pws = array_chunk($pws, $vars['pagesize']);
        $pws = $pws[$vars['pageno'] - 1];
    }
    // End Pagination
    echo generate_box_open();
    print_pseudowire_table_header($vars);
    foreach ($pws as $pw) {
        print_pseudowire_row($pw, $vars);
    }
    echo '</tbody></table>';
    echo generate_box_close();
    echo $pagination_html;
}
开发者ID:Natolumin,项目名称:observium,代码行数:21,代码来源:pseudowire.inc.php


示例14: print_events


//.........这里部分代码省略.........
            $string .= '      <th>Date</th>' . PHP_EOL;
            if ($list['device']) {
                $string .= '      <th>Device</th>' . PHP_EOL;
            }
            if ($list['entity']) {
                $string .= '      <th>Entity</th>' . PHP_EOL;
            }
            $string .= '      <th>Message</th>' . PHP_EOL;
            $string .= '    </tr>' . PHP_EOL;
            $string .= '  </thead>' . PHP_EOL;
        }
        $string .= '  <tbody>' . PHP_EOL;
        foreach ($events['entries'] as $entry) {
            switch ($entry['severity']) {
                case "0":
                    // Emergency
                // Emergency
                case "1":
                    // Alert
                // Alert
                case "2":
                    // Critical
                // Critical
                case "3":
                    // Error
                    $entry['html_row_class'] = "error";
                    break;
                case "4":
                    // Warning
                    $entry['html_row_class'] = "warning";
                    break;
                case "5":
                    // Notification
                    $entry['html_row_class'] = "recovery";
                    break;
                case "6":
                    // Informational
                    $entry['html_row_class'] = "up";
                    break;
                case "7":
                    // Debugging
                    $entry['html_row_class'] = "suppressed";
                    break;
                default:
            }
            $string .= '  <tr class="' . $entry['html_row_class'] . '">' . PHP_EOL;
            $string .= '<td class="state-marker"></td>' . PHP_EOL;
            if ($events['short']) {
                $string .= '    <td class="syslog" style="white-space: nowrap">';
                $timediff = $GLOBALS['config']['time']['now'] - strtotime($entry['timestamp']);
                $string .= generate_tooltip_link('', formatUptime($timediff, "short-3"), format_timestamp($entry['timestamp']), NULL) . '</td>' . PHP_EOL;
            } else {
                $string .= '    <td style="width: 160px">';
                $string .= format_timestamp($entry['timestamp']) . '</td>' . PHP_EOL;
            }
            if ($list['device']) {
                $dev = device_by_id_cache($entry['device_id']);
                $device_vars = array('page' => 'device', 'device' => $entry['device_id'], 'tab' => 'logs', 'section' => 'eventlog');
                $string .= '    <td class="entity">' . generate_device_link($dev, short_hostname($dev['hostname']), $device_vars) . '</td>' .  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP generate_box_open函数代码示例发布时间:2022-05-15
下一篇:
PHP generate_board_url函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap