Commit ca2fcdce authored by ueli heuer's avatar ueli heuer 👾
Browse files

Fixes some more "PHP Notice: Undefined variable: varname"

parent 3cbdccac
......@@ -245,7 +245,7 @@ if ($parameter_count > 0 ) { # wenn es was zu tun gibt tun wir es
$get_old_value_h->execute($device_id,$n);
if ( $get_old_value_h->rows == 1 ) {
($value_id,$old_value,$old_delta,$old_time) = $get_old_value_h->fetchrow;
if ( $val !~ /^U/i ) {
if ( $val !~ /^U/i && defined($old_value)) {
$delta_value = $val-$old_value;
$delta_time = time() - $old_time;
} else {
......@@ -256,7 +256,12 @@ if ($parameter_count > 0 ) { # wenn es was zu tun gibt tun wir es
$old_time = time();
}
if ( $value_id > 0 ) {
$update_value_h->execute($val,$delta_value,$delta_time,time(),$value_id);
if ($val eq 'U') {
$update_value_h->execute(undef,$delta_value,$delta_time,time(),$value_id)
} else {
$update_value_h->execute($val,$delta_value,$delta_time,time(),$value_id)
}
} else {
$insert_value_h->execute($device_id,$n,$val,$delta_value,$delta_time,time());
}
......
......@@ -176,9 +176,10 @@ function detail_link ($link_id) { // {{{
// {{{ check if link points to an host::device
if (preg_match('/([0-9a-zäüö\.\-]*)(::| )*(.+)*/i',
$linkname,$matches)) {
$hostname_ = trim($matches[1]);
$glue_ = trim($matches[2]);
$devicename_ = trim($matches[3]);
$n = count($matches);
if ($n >= 2) { $hostname_ = trim($matches[1]); } else { $hostname_ = ''; }
if ($n >= 3) { $glue_ = trim($matches[2]); } else { $glue_ = ''; }
if ($n >= 4) { $devicename_ = trim($matches[3]); } else { $devicename_ = ''; }
$link_host_r = $CONFIG->DB->query(sprintf('select id
from dvg_host
where name regexp (\'^%s$\')
......
......@@ -171,7 +171,7 @@ function logout() // {{{
$USER->logout();
DVG_interface::showpage ('/index');
DVG_interface::showpage (USER_HOME);
exit;
} // }}}
......
......@@ -331,7 +331,7 @@ function select_speed ($name,$linespeed,$maxspeed = null) {
// {{{ function showpage($uri)
function showpage($uri) {
if ( isset($_COOKIE[DVG_session::REMEMBER_COOKIE]) & ($_COOKIE[DVG_session::REMEMBER_COOKIE] != '' )) {
if ( isset($_COOKIE[DVG_session::REMEMBER_COOKIE]) && ($_COOKIE[DVG_session::REMEMBER_COOKIE] != '' )) {
$session_id = '';
} else {
if (preg_match('/\?/',$uri)) { $delimiter= ';'; } else { $delimiter= '?'; }
......
......@@ -150,7 +150,7 @@ class DVG_session {
session_unset();
session_destroy();
setcookie(self::REMEMBER_COOKIE,
sprintf("%s;",$USER->user_name),
isset($USER->user_name) ? sprintf("%s;",$USER->user_name) : ':',
time()-$CONFIG->get_cookie_ttl(),'/',
$CONFIG->get_cookie_domain(),0); //delete cookie
......
......@@ -154,7 +154,7 @@ sub _get_interfaces # {{{
$host_id, $interface);# if $DEBUG > 2;
$result_id = undef;
$ifindex = $ifdescr = $ifname = $ifalias = $ifmacaddr = undef;
Unix::Syslog::syslog(LOG_DEBUG, '_get_interfaces: SNMP START (%s)',$host_id);
$vars = new SNMP::VarList(['ifIndex'],['ifDescr'],['ifName'],['ifAlias'],['ifPhysAddress']);
($ifindex, $ifdescr, $ifname, $ifalias, $ifmacaddr) = $session->getnext($vars);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment