mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge branch 'master' of github.com:laf/librenms into issue-711
This commit is contained in:
@@ -122,7 +122,7 @@ function generate_device_url($device, $vars=array())
|
||||
return generate_url(array('page' => 'device', 'device' => $device['device_id']), $vars);
|
||||
}
|
||||
|
||||
function generate_device_link($device, $text=NULL, $vars=array(), $start=0, $end=0, $escape_text=1)
|
||||
function generate_device_link($device, $text=NULL, $vars=array(), $start=0, $end=0, $escape_text=1, $overlib=1)
|
||||
{
|
||||
global $config;
|
||||
|
||||
@@ -168,7 +168,11 @@ function generate_device_link($device, $text=NULL, $vars=array(), $start=0, $end
|
||||
}
|
||||
|
||||
if ($escape_text) { $text = htmlentities($text); }
|
||||
$link = overlib_link($url, $text, escape_quotes($contents), $class);
|
||||
if ($overlib == 0) {
|
||||
$link = $contents;
|
||||
} else {
|
||||
$link = overlib_link($url, $text, escape_quotes($contents), $class);
|
||||
}
|
||||
|
||||
if (device_permitted($device['device_id']))
|
||||
{
|
||||
@@ -404,7 +408,7 @@ function generate_entity_link($type, $entity, $text = NULL, $graph_type=NULL)
|
||||
|
||||
}
|
||||
|
||||
function generate_port_link($port, $text = NULL, $type = NULL)
|
||||
function generate_port_link($port, $text = NULL, $type = NULL, $overlib = 1, $single_graph = 0)
|
||||
{
|
||||
global $config;
|
||||
|
||||
@@ -429,17 +433,21 @@ function generate_port_link($port, $text = NULL, $type = NULL)
|
||||
$graph_array['from'] = $config['time']['day'];
|
||||
$graph_array['id'] = $port['port_id'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$graph_array['from'] = $config['time']['week'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$graph_array['from'] = $config['time']['month'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$graph_array['from'] = $config['time']['year'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
if ($single_graph == 0) {
|
||||
$graph_array['from'] = $config['time']['week'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$graph_array['from'] = $config['time']['month'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$graph_array['from'] = $config['time']['year'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
}
|
||||
$content .= "</div>";
|
||||
|
||||
$url = generate_port_url($port);
|
||||
|
||||
if (port_permitted($port['port_id'], $port['device_id'])) {
|
||||
if ($overlib == 0) {
|
||||
return $content;
|
||||
} elseif (port_permitted($port['port_id'], $port['device_id'])) {
|
||||
return overlib_link($url, $text, $content, $class);
|
||||
} else {
|
||||
return fixifName($text);
|
||||
@@ -744,4 +752,12 @@ function shorten_interface_type($string) {
|
||||
);
|
||||
}
|
||||
|
||||
function clean_bootgrid($string) {
|
||||
|
||||
$output = str_replace(array("\r","\n"), "", $string);
|
||||
$output = addslashes($output);
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -25,7 +25,7 @@ $rrd_options .= " AREA:system_perc#ea8f00:system:STACK";
|
||||
$rrd_options .= " GPRINT:system_perc:LAST:' %5.2lf%%'";
|
||||
$rrd_options .= " GPRINT:system_perc:AVERAGE:' %5.2lf%%'";
|
||||
$rrd_options .= " GPRINT:system_perc:MAX:' %5.2lf%%\\n'";
|
||||
$rrd_options .= " AREA:idle_perc#f5f5e5:idle:STACK";
|
||||
$rrd_options .= " AREA:idle_perc#f8f8f3:idle:STACK";
|
||||
$rrd_options .= " GPRINT:idle_perc:LAST:' %5.2lf%%'";
|
||||
$rrd_options .= " GPRINT:idle_perc:AVERAGE:' %5.2lf%%'";
|
||||
$rrd_options .= " GPRINT:idle_perc:MAX:' %5.2lf%%\\n'";
|
||||
|
@@ -93,16 +93,18 @@ if($format == "octets" || $format == "bytes")
|
||||
|
||||
$rrd_options .= " COMMENT:'bps Now Ave Max 95th %\\n'";
|
||||
|
||||
$rrd_options .= " AREA:in".$format."_max#aDEB7B:";
|
||||
$rrd_options .= " AREA:in".$format."#91B13C:'In '";
|
||||
$rrd_options .= " AREA:in".$format."_max#D7FFC7:";
|
||||
$rrd_options .= " AREA:in".$format."#90B040:'In '";
|
||||
$rrd_options .= " LINE:in".$format."#608720:'In '";
|
||||
#$rrd_options .= " LINE1.25:in".$format."#006600:'In '";
|
||||
$rrd_options .= " GPRINT:in".$format.":LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:in".$format.":AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:in".$format."_max:MAX:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:95thin:%6.2lf%s\\\\n";
|
||||
|
||||
$rrd_options .= " AREA:dout".$format."_max#a3b9FF:";
|
||||
$rrd_options .= " AREA:dout".$format."#8080BD:'Out'";
|
||||
$rrd_options .= " AREA:dout".$format."_max#E0E0FF:";
|
||||
$rrd_options .= " AREA:dout".$format."#8080C0:";
|
||||
$rrd_options .= " LINE:dout".$format."#606090:'Out'";
|
||||
#$rrd_options .= " LINE1.25:dout".$format."#000099:Out";
|
||||
$rrd_options .= " GPRINT:out".$format.":LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:out".$format.":AVERAGE:%6.2lf%s";
|
||||
|
@@ -47,7 +47,7 @@ foreach ($sql_debug as $sql_error) {
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">SQL Debug</h4>
|
||||
<h4 class="modal-title" id="myModalLabel">PHP Debug</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class="table table-condensed table-hover">
|
||||
|
@@ -19,11 +19,11 @@ if (isset($device['device_id']) && $device['device_id'] > 0) {
|
||||
}
|
||||
|
||||
if ($_SESSION['userlevel'] >= '5') {
|
||||
$query = "SELECT DATE(time_logged) Date, COUNT(alert_log.device_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules WHERE alert_log.rule_id=alert_rules.id $sql GROUP BY DATE(time_logged),alert_rules.severity";
|
||||
$query = "SELECT DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."') Date, COUNT(alert_log.rule_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules WHERE alert_log.rule_id=alert_rules.id AND `alert_log`.`state` != 0 $sql GROUP BY DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."'),alert_rules.severity";
|
||||
}
|
||||
|
||||
if ($_SESSION['userlevel'] < '5') {
|
||||
$query = "SELECT DATE(time_logged) Date, COUNT(alert_log.device_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules,devices_perms WHERE alert_log.rule_id=alert_rules.id $sql AND alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . $_SESSION['user_id'] . " GROUP BY DATE(time_logged),alert_rules.severity";
|
||||
$query = "SELECT DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."') Date, COUNT(alert_log.device_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules,devices_perms WHERE alert_log.rule_id=alert_rules.id AND `alert_log`.`state` != 0 $sql AND alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . $_SESSION['user_id'] . " GROUP BY DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."'),alert_rules.severity";
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -86,7 +86,7 @@ echo $max_count; ?>
|
||||
}
|
||||
}
|
||||
},
|
||||
zoomMin: 2073600000, //24hrs
|
||||
zoomMin: 86400, //24hrs
|
||||
zoomMax: <?php
|
||||
$first_date = reset($data);
|
||||
$last_date = end($data);
|
||||
@@ -97,4 +97,4 @@ echo $milisec_diff;
|
||||
};
|
||||
var graph2d = new vis.Graph2d(container, items, groups, options);
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
@@ -25,12 +25,12 @@ $sql .= ' AND `local_device_id` != 0 AND `remote_device_id` != 0';
|
||||
$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 `hostname`,`location` FROM `devices` WHERE `device_id`=?",array($link_devices['local_device_id']));
|
||||
$tmp_devices[] = array('id'=>$link_devices['local_device_id'],'label'=>$link_dev['hostname'],'title'=>$link_dev['hostname'],'group'=>$link_dev['location']);
|
||||
$link_dev = dbFetchRow("SELECT * FROM `devices` WHERE `device_id`=?",array($link_devices['local_device_id']));
|
||||
$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 `hostname`,`location` FROM `devices` WHERE `device_id`=?",array($link_devices['remote_device_id']));
|
||||
$tmp_devices[] = array('id'=>$link_devices['remote_device_id'],'label'=>$link_dev['hostname'],'title'=>$link_dev['hostname'],'group'=>$link_dev['location']);
|
||||
$link_dev = dbFetchRow("SELECT * FROM `devices` WHERE `device_id`=?",array($link_devices['remote_device_id']));
|
||||
$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']);
|
||||
@@ -42,11 +42,12 @@ $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`.`ifName` AS `local_port`, `remote_port`,`ports`.`ifSpeed` AS ifSpeed 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) {
|
||||
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) {
|
||||
foreach ($tmp_devices as $k=>$v) {
|
||||
if ($v['id'] == $link_devices['local_device_id']) {
|
||||
$from = $v['id'];
|
||||
$port = shorten_interface_type($link_devices['local_port']);
|
||||
$port = shorten_interface_type($link_devices['ifName']);
|
||||
$port_data = $link_devices;
|
||||
}
|
||||
if ($v['id'] == $link_devices['remote_device_id']) {
|
||||
$to = $v['id'];
|
||||
@@ -67,7 +68,20 @@ if (is_array($tmp_devices[0])) {
|
||||
} else {
|
||||
$width = 1;
|
||||
}
|
||||
$tmp_links[] = array('from'=>$from,'to'=>$to,'label'=>$port,'title'=>$port,'width'=>$width);
|
||||
$link_in_used = ($link_devices['ifInOctets_rate'] * 8) / $link_devices['ifSpeed'] * 100;
|
||||
$link_out_used = ($link_devices['ifOutOctets_rate'] * 8) / $link_devices['ifSpeed'] * 100;
|
||||
if ($link_in_used > $link_out_used) {
|
||||
$link_used = $link_in_used;
|
||||
} else {
|
||||
$link_used = $link_out_used;
|
||||
}
|
||||
$link_used = round($link_used, -1);
|
||||
if ($link_used > 100) {
|
||||
$link_used = 100;
|
||||
}
|
||||
$link_color = $config['map_legend'][$link_used];
|
||||
|
||||
$tmp_links[] = array('from'=>$from,'to'=>$to,'label'=>$port,'title'=>generate_port_link($port_data, "<img src='graph.php?type=port_bits&id=".$port['port_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>",'',0,1),'width'=>$width,'color'=>$link_color);
|
||||
}
|
||||
|
||||
$edges = json_encode($tmp_links);
|
||||
@@ -97,9 +111,26 @@ echo $edges;
|
||||
var data = {
|
||||
nodes: nodes,
|
||||
edges: edges,
|
||||
stabilize: true
|
||||
stabilize: false
|
||||
};
|
||||
var options = {
|
||||
physics: {
|
||||
barnesHut: {
|
||||
gravitationalConstant: -80000, springConstant: 0.001, springLength: 200
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
color: {
|
||||
background: '#ffffff'
|
||||
}
|
||||
},
|
||||
smoothCurves: {dynamic:false, type: "continuous"},
|
||||
edges: {
|
||||
color: {
|
||||
color: '#000000'
|
||||
}
|
||||
}
|
||||
};
|
||||
var options = {physics: {barnesHut: {gravitationalConstant: -11900, centralGravity: 1.4, springLength: 203, springConstant: 0.05, damping: 0.3}}, smoothCurves: false};
|
||||
var network = new vis.Network(container, data, options);
|
||||
network.on("resize", function(params) {console.log(params.width,params.height)});
|
||||
network.on('click', function (properties) {
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
include($config['install_dir'].'/includes/object-cache.inc.php');
|
||||
|
||||
// FIXME - this could do with some performance improvements, i think. possible rearranging some tables and setting flags at poller time (nothing changes outside of then anyways)
|
||||
|
||||
@@ -194,13 +195,14 @@ if ($_SESSION['userlevel'] >= '10')
|
||||
<li><a href="ports/"><i class="fa fa-link fa-fw fa-lg"></i> All Ports</a></li>
|
||||
|
||||
<?php
|
||||
$ports = new ObjCache('ports');
|
||||
|
||||
if (isset($ports['errored']))
|
||||
if ($ports['errored'] > 0)
|
||||
{
|
||||
echo(' <li><a href="ports/errors=1/"><i class="fa fa-exclamation-circle fa-fw fa-lg"></i> Errored ('.$ports['errored'].')</a></li>');
|
||||
}
|
||||
|
||||
if (isset($ports['ignored']))
|
||||
if ($ports['ignored'] > 0)
|
||||
{
|
||||
echo(' <li><a href="ports/ignore=1/"><i class="fa fa-question-circle fa-fw fa-lg"></i> Ignored ('.$ports['ignored'].')</a></li>');
|
||||
}
|
||||
@@ -431,8 +433,12 @@ Plugins::call('menu');
|
||||
|
||||
if ($_SESSION['userlevel'] >= '10')
|
||||
{
|
||||
echo('
|
||||
if (dbFetchCell("SELECT COUNT(*) from `plugins` WHERE plugin_active = '1'") > 0) {
|
||||
echo('
|
||||
<li role="presentation" class="divider"></li>
|
||||
');
|
||||
}
|
||||
echo('
|
||||
<li><a href="plugin/view=admin"> <i class="fa fa-lock fa-fw fa-lg"></i>Plugin Admin</a></li>
|
||||
');
|
||||
}
|
||||
|
137
html/includes/reports/ports.csv.inc.php
Normal file
137
html/includes/reports/ports.csv.inc.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
$param = array();
|
||||
|
||||
if(!isset($vars['ignore'])) { $vars['ignore'] = "0"; }
|
||||
if(!isset($vars['disabled'])) { $vars['disabled'] = "0"; }
|
||||
if(!isset($vars['deleted'])) { $vars['deleted'] = "0"; }
|
||||
|
||||
$where = '';
|
||||
|
||||
foreach ($vars as $var => $value)
|
||||
{
|
||||
if ($value != "")
|
||||
{
|
||||
switch ($var)
|
||||
{
|
||||
case 'hostname':
|
||||
$where .= " AND D.hostname LIKE ?";
|
||||
$param[] = "%".$value."%";
|
||||
break;
|
||||
case 'location':
|
||||
$where .= " AND D.location LIKE ?";
|
||||
$param[] = "%".$value."%";
|
||||
break;
|
||||
case 'device_id':
|
||||
$where .= " AND D.device_id = ?";
|
||||
$param[] = $value;
|
||||
break;
|
||||
case 'deleted':
|
||||
case 'ignore':
|
||||
if ($value == 1)
|
||||
{
|
||||
$where .= " AND (I.ignore = 1 OR D.ignore = 1) AND I.deleted = 0";
|
||||
}
|
||||
break;
|
||||
case 'disable':
|
||||
case 'ifSpeed':
|
||||
if (is_numeric($value))
|
||||
{
|
||||
$where .= " AND I.$var = ?";
|
||||
$param[] = $value;
|
||||
}
|
||||
break;
|
||||
case 'ifType':
|
||||
$where .= " AND I.$var = ?";
|
||||
$param[] = $value;
|
||||
break;
|
||||
case 'ifAlias':
|
||||
case 'port_descr_type':
|
||||
$where .= " AND I.$var LIKE ?";
|
||||
$param[] = "%".$value."%";
|
||||
break;
|
||||
case 'errors':
|
||||
if ($value == 1)
|
||||
{
|
||||
$where .= " AND (I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0')";
|
||||
}
|
||||
break;
|
||||
case 'state':
|
||||
if ($value == "down")
|
||||
{
|
||||
$where .= "AND I.ifAdminStatus = ? AND I.ifOperStatus = ?";
|
||||
$param[] = "up";
|
||||
$param[] = "down";
|
||||
} elseif($value == "up") {
|
||||
$where .= "AND I.ifAdminStatus = ? AND I.ifOperStatus = ? AND I.ignore = '0' AND D.ignore='0' AND I.deleted='0'";
|
||||
$param[] = "up";
|
||||
$param[] = "up";
|
||||
} elseif($value == "admindown") {
|
||||
$where .= "AND I.ifAdminStatus = ? AND D.ignore = 0";
|
||||
$param[] = "down";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id ".$where." ".$query_sort;
|
||||
|
||||
$row = 1;
|
||||
|
||||
list($format, $subformat) = explode("_", $vars['format']);
|
||||
|
||||
$ports = dbFetchRows($query, $param);
|
||||
|
||||
switch ($vars['sort'])
|
||||
{
|
||||
case 'traffic':
|
||||
$ports = array_sort($ports, 'ifOctets_rate', SORT_DESC);
|
||||
break;
|
||||
case 'traffic_in':
|
||||
$ports = array_sort($ports, 'ifInOctets_rate', SORT_DESC);
|
||||
break;
|
||||
case 'traffic_out':
|
||||
$ports = array_sort($ports, 'ifOutOctets_rate', SORT_DESC);
|
||||
break;
|
||||
case 'packets':
|
||||
$ports = array_sort($ports, 'ifUcastPkts_rate', SORT_DESC);
|
||||
break;
|
||||
case 'packets_in':
|
||||
$ports = array_sort($ports, 'ifInUcastOctets_rate', SORT_DESC);
|
||||
break;
|
||||
case 'packets_out':
|
||||
$ports = array_sort($ports, 'ifOutUcastOctets_rate', SORT_DESC);
|
||||
break;
|
||||
case 'errors':
|
||||
$ports = array_sort($ports, 'ifErrors_rate', SORT_DESC);
|
||||
break;
|
||||
case 'speed':
|
||||
$ports = array_sort($ports, 'ifSpeed', SORT_DESC);
|
||||
break;
|
||||
case 'port':
|
||||
$ports = array_sort($ports, 'ifDescr', SORT_ASC);
|
||||
break;
|
||||
case 'media':
|
||||
$ports = array_sort($ports, 'ifType', SORT_ASC);
|
||||
break;
|
||||
case 'descr':
|
||||
$ports = array_sort($ports, 'ifAlias', SORT_ASC);
|
||||
break;
|
||||
case 'device':
|
||||
default:
|
||||
$ports = array_sort($ports, 'hostname', SORT_ASC);
|
||||
}
|
||||
|
||||
$csv[] = array('Device','Port','Speed','Down','Up','Media','Description');
|
||||
foreach( $ports as $port ) {
|
||||
if( port_permitted($port['port_id'], $port['device_id']) ) {
|
||||
$speed = humanspeed($port['ifSpeed']);
|
||||
$type = humanmedia($port['ifType']);
|
||||
$port['in_rate'] = formatRates($port['ifInOctets_rate'] * 8);
|
||||
$port['out_rate'] = formatRates($port['ifOutOctets_rate'] * 8);
|
||||
$port = ifLabel($port, $device);
|
||||
$csv[] = array($port['hostname'],fixIfName($port['label']),$speed,$port['in_rate'],$port['out_rate'],$type,$port['ifAlias']);
|
||||
}
|
||||
}
|
||||
?>
|
40
html/includes/vars.inc.php
Normal file
40
html/includes/vars.inc.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
foreach ($_GET as $key=>$get_var)
|
||||
{
|
||||
if (strstr($key, "opt"))
|
||||
{
|
||||
list($name, $value) = explode("|", $get_var);
|
||||
if (!isset($value)) { $value = "yes"; }
|
||||
$vars[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$segments = explode('/', trim($_SERVER['REQUEST_URI'], '/'));
|
||||
|
||||
foreach ($segments as $pos => $segment)
|
||||
{
|
||||
$segment = urldecode($segment);
|
||||
if ($pos == "0")
|
||||
{
|
||||
$vars['page'] = $segment;
|
||||
} else {
|
||||
list($name, $value) = explode("=", $segment);
|
||||
if ($value == "" || !isset($value))
|
||||
{
|
||||
$vars[$name] = yes;
|
||||
} else {
|
||||
$vars[$name] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($_GET as $name => $value)
|
||||
{
|
||||
$vars[$name] = $value;
|
||||
}
|
||||
|
||||
foreach ($_POST as $name => $value)
|
||||
{
|
||||
$vars[$name] = $value;
|
||||
}
|
Reference in New Issue
Block a user