mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
eradicate split() in favour of explode()
git-svn-id: http://www.observium.org/svn/observer/trunk@2054 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -30,7 +30,7 @@ foreach ($config['graph_sections'] as $section)
|
||||
echo('<span class="pagemenu-selected">');
|
||||
}
|
||||
|
||||
echo("<a href='".$config['base_url']."/device/".$device['device_id']."/graphs/" . $type . ($_GET['optb'] ? "/" . $_GET['optb'] : ''). "/'> " . $type ."</a>");
|
||||
echo("<a href='".$config['base_url']."/device/".$device['device_id']."/graphs/" . $type . ($_GET['optb'] ? "/" . $_GET['optb'] : ''). "/'> " . ucfirst($type) ."</a>");
|
||||
if ($_GET['opta'] == $type)
|
||||
{
|
||||
echo("</span>");
|
||||
|
@ -18,7 +18,7 @@ if ($_SESSION['userlevel'] >= "7")
|
||||
|
||||
if ($config['rancid_ignorecomments'])
|
||||
{
|
||||
$lines = split("\n",$text);
|
||||
$lines = explode("\n",$text);
|
||||
for ($i = 0;$i < count($lines);$i++)
|
||||
{
|
||||
if ($lines[$i][0] == "#") { unset($lines[$i]); }
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
<?php
|
||||
|
||||
if ($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
||||
if ($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg = "#ffffff"; }
|
||||
|
||||
$type_where = " (";
|
||||
foreach (split(",", $_GET['opta']) as $type)
|
||||
foreach (explode(",", $_GET['opta']) as $type)
|
||||
{
|
||||
$type_where .= " $or `port_descr_type` = '" . mres($type) . "' ";
|
||||
$or = "OR";
|
||||
@ -47,7 +47,7 @@ if ($if_list)
|
||||
$interface['ifAlias'] = str_ireplace($type . ": ", "", $interface['ifAlias']);
|
||||
$interface['ifAlias'] = str_ireplace("[PNI]", "Private", $interface['ifAlias']);
|
||||
$ifclass = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
|
||||
if ($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
||||
if ($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg = "#ffffff"; }
|
||||
echo("<tr bgcolor='$bg'>
|
||||
<td><span class=list-large>" . generate_port_link($interface,$interface['port_descr_descr']) . "</span><br />
|
||||
<span class=interface-desc style='float: left;'>".generate_device_link($interface)." ".generate_port_link($interface)." </span>");
|
||||
|
@ -3,7 +3,8 @@
|
||||
function getDates($dayofmonth)
|
||||
{
|
||||
$dayofmonth = zeropad($dayofmonth);
|
||||
list($year, $month) = split('-', date('Y-m'));
|
||||
$year = date('Y');
|
||||
$month = date('m');
|
||||
|
||||
if (date('d') > $dayofmonth)
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ if ($config['enable_bgp'])
|
||||
|
||||
foreach (explode("\n", $peers) as $peer)
|
||||
{
|
||||
list($peer_ip, $peer_as) = split(" ", $peer);
|
||||
list($peer_ip, $peer_as) = explode(" ", $peer);
|
||||
|
||||
if ($peer && $peer_ip != "0.0.0.0")
|
||||
{
|
||||
@ -43,7 +43,7 @@ if ($config['enable_bgp'])
|
||||
$peers = trim(str_replace(".1.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.","", $result));
|
||||
foreach (explode("\n", $peers) as $peer)
|
||||
{
|
||||
list($peer_ip_snmp, $peer_as) = split(" ", $peer);
|
||||
list($peer_ip_snmp, $peer_as) = explode(" ", $peer);
|
||||
|
||||
# Magic! Basically, takes SNMP form and finds peer IPs from the walk OIDs.
|
||||
$peer_ip = Net_IPv6::compress(snmp2ipv6(implode('.',array_slice(explode('.',$peer_ip_snmp),count(explode('.',$peer_ip_snmp))-16))));
|
||||
|
@ -21,7 +21,7 @@ if ($config['enable_pseudowires'] && $device['os_group'] == "ios")
|
||||
|
||||
if ($cpwOid)
|
||||
{
|
||||
list($cpw_remote_id) = split(":", shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MPLS-MIB -Ln -Osqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcMplsPeerLdpID." . $cpwOid));
|
||||
list($cpw_remote_id) = explode(":", shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MPLS-MIB -Ln -Osqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcMplsPeerLdpID." . $cpwOid));
|
||||
$interface_descr = trim(shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MIB -Oqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcName." . $cpwOid));
|
||||
$cpw_remote_device = @mysql_result(mysql_query("SELECT device_id FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = '".$cpw_remote_id."' AND A.interface_id = I.interface_id"),0);
|
||||
$if_id = @mysql_result(mysql_query("SELECT `interface_id` FROM `ports` WHERE `ifDescr` = '$interface_descr' AND `device_id` = '".$device['device_id']."'"),0);
|
||||
|
@ -50,7 +50,7 @@ if (!$oids)
|
||||
{
|
||||
$data = trim($data);
|
||||
list($if_ipv6addr,$ipv6_prefixlen) = explode(" ", $data);
|
||||
list($ifIndex,$ipv6addr) = split("\\.",$if_ipv6addr,2);
|
||||
list($ifIndex,$ipv6addr) = explode("\\.",$if_ipv6addr,2);
|
||||
$ipv6_address = snmp2ipv6($ipv6addr);
|
||||
$ipv6_origin = snmp_get($device, "IPV6-MIB::ipv6AddrType.$if_ipv6addr", "-Ovq", "IPV6-MIB");
|
||||
discover_process_ipv6($ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_origin);
|
||||
|
@ -12,7 +12,7 @@ if ($vlanversion == 'version1')
|
||||
|
||||
foreach (explode("\n", $vlans) as $vlan_oid)
|
||||
{
|
||||
list($oid,$vlan_index) = split(' ',$vlan_oid);
|
||||
list($oid,$vlan_index) = explode(' ',$vlan_oid);
|
||||
$oid_ex = explode('.',$oid);
|
||||
$vlan = $oid_ex[count($oid_ex)-1];
|
||||
|
||||
|
@ -129,7 +129,7 @@ function getImage($host)
|
||||
if ($type == "linux")
|
||||
{
|
||||
$features = strtolower(trim($data['features']));
|
||||
list($distro) = split(" ", $features);
|
||||
list($distro) = explode(" ", $features);
|
||||
if (file_exists($config['html_dir'] . "/images/os/$distro" . ".png")){ $image = '<img src="'.$config['base_url'].'/images/os/'.$distro.'.png" />';
|
||||
} elseif (file_exists($config['html_dir'] . "/images/os/$distro" . ".gif")){ $image = '<img src="'.$config['base_url'].'/images/os/'.$distro.'.gif" />'; }
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ else
|
||||
$peer_cmd .= " jnxBgpM2PeerStatus.0.ipv6";
|
||||
foreach (explode("\n",trim(`$peer_cmd`)) as $oid)
|
||||
{
|
||||
list($peer_oid) = split(' ',$oid);
|
||||
list($peer_oid) = explode(' ',$oid);
|
||||
$peer_id = explode('.',$peer_oid);
|
||||
$junos_v6[implode('.',array_slice($peer_id,35))] = implode('.',array_slice($peer_id,18));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
list(,$hardware,$version) = split(' ',$sysDescr);
|
||||
list(,$hardware,$version) = explode(' ',$sysDescr);
|
||||
|
||||
?>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
list(,$version) = split(',',$sysDescr,2);
|
||||
list(,$version) = explode(',',$sysDescr,2);
|
||||
$hardware = "1900";
|
||||
|
||||
?>
|
@ -13,7 +13,7 @@ foreach ($dellinfo as $dellinf)
|
||||
|
||||
$hardware = $dell_laser['MDL'];
|
||||
|
||||
list(,$version) = split('Engine ',$sysDescr);
|
||||
list(,$version) = explode('Engine ',$sysDescr);
|
||||
|
||||
$version = "Engine " . trim($version,')');
|
||||
|
||||
|
@ -56,7 +56,7 @@ elseif ($device['os'] == "openbsd" || $device['os'] == "solaris" || $device['os'
|
||||
}
|
||||
elseif ($device['os'] == "monowall" || $device['os'] == "Voswall")
|
||||
{
|
||||
list(,,$version,$hardware,$freebsda, $freebsdb, $arch) = split(" ", $sysDescr);
|
||||
list(,,$version,$hardware,$freebsda, $freebsdb, $arch) = explode(" ", $sysDescr);
|
||||
$features = $freebsda . " " . $freebsdb;
|
||||
$hardware = "$hardware ($arch)";
|
||||
$hardware = str_replace("\"", "", $hardware);
|
||||
|
@ -41,7 +41,7 @@ function process_syslog ($entry, $update)
|
||||
if (strstr($entry[msg], "%"))
|
||||
{
|
||||
$entry['msg'] = preg_replace("/^%(.+?):\ /", "\\1||", $entry['msg']);
|
||||
list(,$entry[msg]) = split(": %", $entry['msg']);
|
||||
list(,$entry[msg]) = explode(": %", $entry['msg']);
|
||||
$entry['msg'] = "%" . $entry['msg'];
|
||||
$entry['msg'] = preg_replace("/^%(.+?):\ /", "\\1||", $entry['msg']);
|
||||
}
|
||||
|
Reference in New Issue
Block a user