Commit 1a8c62b7 authored by Tim Niemeyer's avatar Tim Niemeyer Committed by Jan-Tarek Butt

runtime.php: fix Undefined variable

parent 5ae4a673
......@@ -102,12 +102,16 @@ if($_GET['section']=="router_auto_assign") {
if($_GET['section']=="autoadd_ipv6_address") {
//first try to determine network of given address
$ipv6_network = Ip::ipv6NetworkFromAddr($_GET['ip'], (int)$_GET['netmask']);
$network = new Network(false, false, $ipv6_network, (int)$_GET['netmask'], (int)$_GET['ipv']);
$network = new Network(false, false, $ipv6_network, (int)$_GET['netmask'], 6);
if($network->fetch()) {
//if network found, then try to add ip address.
//first we need to check if the interface we want to add th ip to already exists
//and if not we need to create it.
$networkinterface = new Networkinterface(false, (int)$_GET['router_id'], $_GET['networkinterface_name']);
if (!isset($_GET['networkinterface_name']))
$networkinterface_name = "";
else
$networkinterface_name = $_GET['networkinterface_name'];
$networkinterface = new Networkinterface(false, (int)$_GET['router_id'], $networkinterface_name);
if(!$networkinterface->fetch()) {
$networkinterface_id = $networkinterface->store();
if(!$networkinterface_id) {
......@@ -137,4 +141,4 @@ if($_GET['section']=="get_hostname") {
echo "success,".$router_data['hostname'].",";
}
?>
\ No newline at end of file
?>
......@@ -101,13 +101,32 @@
/**Insert Router System Data*/
echo " Inserting RouterStatus into DB\n";
$router_status = New RouterStatus(false, (int)$actual_crawl_cycle, $router->getRouterId(),
$data['system_data']['status'], false, $data['system_data']['hostname'], (int)$data['client_count'], $data['system_data']['chipset'],
$data['system_data']['cpu'], (int)$data['system_data']['memory_total'], (int)$data['system_data']['memory_caching'], (int)$data['system_data']['memory_buffering'],
(int)$data['system_data']['memory_free'], $data['system_data']['loadavg'], $data['system_data']['processes'], $data['system_data']['uptime'],
$data['system_data']['idletime'], $data['system_data']['local_time'], $data['system_data']['distname'], $data['system_data']['distversion'], $data['system_data']['openwrt_core_revision'],
$data['system_data']['openwrt_feeds_packages_revision'], $data['system_data']['firmware_version'],
$data['system_data']['firmware_revision'], $data['system_data']['kernel_version'], $data['system_data']['configurator_version'],
$data['system_data']['nodewatcher_version'], $data['system_data']['fastd_version'], $data['system_data']['batman_advanced_version']);
$data['system_data']['status'],
false,
isset($data['system_data']['hostname']) ? $data['system_data']['hostname'] : "",
isset($data['client_count']) ? (int)$data['client_count'] : 0,
isset($data['system_data']['chipset']) ? $data['system_data']['chipset'] : "",
isset($data['system_data']['cpu']) ? $data['system_data']['cpu'] : "",
isset($data['system_data']['memory_total']) ? (int)$data['system_data']['memory_total'] : 0,
isset($data['system_data']['memory_caching']) ? (int)$data['system_data']['memory_caching'] : 0,
isset($data['system_data']['memory_buffering']) ? (int)$data['system_data']['memory_buffering'] : 0,
isset($data['system_data']['memory_free']) ? (int)$data['system_data']['memory_free'] : 0,
isset($data['system_data']['loadavg']) ? $data['system_data']['loadavg'] : "",
isset($data['system_data']['processes']) ? $data['system_data']['processes'] : "",
isset($data['system_data']['uptime']) ? $data['system_data']['uptime'] : "",
isset($data['system_data']['idletime']) ? $data['system_data']['idletime'] : "",
isset($data['system_data']['local_time']) ? $data['system_data']['local_time'] : "",
isset($data['system_data']['distname']) ? $data['system_data']['distname'] : "",
isset($data['system_data']['distversion']) ? $data['system_data']['distversion'] : "",
isset($data['system_data']['openwrt_core_revision']) ? $data['system_data']['openwrt_core_revision'] : "",
isset($data['system_data']['openwrt_feeds_packages_revision']) ? $data['system_data']['openwrt_feeds_packages_revision'] : "",
isset($data['system_data']['firmware_version']) ? $data['system_data']['firmware_version'] : "",
isset($data['system_data']['firmware_revision']) ? $data['system_data']['firmware_revision'] : "",
isset($data['system_data']['kernel_version']) ? $data['system_data']['kernel_version'] : "",
isset($data['system_data']['configurator_version']) ? $data['system_data']['configurator_version'] : "",
isset($data['system_data']['nodewatcher_version']) ? $data['system_data']['nodewatcher_version'] : "",
isset($data['system_data']['fastd_version']) ? $data['system_data']['fastd_version'] : "",
isset($data['system_data']['batman_advanced_version']) ? $data['system_data']['batman_advanced_version'] : "");
if($router_status->store()) {
echo " Inserting Batman advanced interfaces into DB\n";
/**Insert Batman advanced Interfaces*/
......@@ -118,8 +137,8 @@
$stmt->execute(array(
':router_id' => $data['router_id'],
':actual_crawl_cycle' => $actual_crawl_cycle,
':name' => $bat_adv_int['name'],
':status' => $bat_adv_int['status']
':name' => isset($bat_adv_int['name']) ? $bat_adv_int['name'] : "",
':status' => isset($bat_adv_int['status']) ? $bat_adv_int['status'] : ""
));
} catch(PDOException $e) {
echo $e->getMessage();
......@@ -166,7 +185,7 @@
echo "The process took ".(time()-$starttime)." seconds\n";
function simplexml2array($xml) {
if (!is_string($xml) AND (get_class($xml) == 'SimpleXMLElement')) {
if (!is_string($xml) AND !is_array($xml) AND (get_class($xml) == 'SimpleXMLElement')) {
$attributes = $xml->attributes();
foreach($attributes as $k=>$v) {
if ($v) $a[$k] = (string) $v;
......
......@@ -67,7 +67,10 @@ class Crawl {
//add unknown ipv6 link local addresses to netmon
//prepare data
$ipv6_link_local_addr = explode("/", $sendet_interface['ipv6_link_local_addr']);
if (isset($sendet_interface['ipv6_link_local_addr']))
$ipv6_link_local_addr = explode("/", $sendet_interface['ipv6_link_local_addr']);
else
$ipv6_link_local_addr[0] = "";
$ipv6_link_local_netmask = (isset($ipv6_link_local_addr[1])) ? (int)$ipv6_link_local_addr[1] : 64;
$ipv6_link_local_addr = Ip::ipv6Expand($ipv6_link_local_addr[0]);
......
......@@ -523,6 +523,7 @@ class ApiMap {
$crawl_interfaces = Interfaces::getInterfacesCrawlByCrawlCycle($last_endet_crawl_cycle['id'], $crawl_router['router_id']);
$row['traffic'] = 0;
$traffic = 0;
foreach($crawl_interfaces as $interface) {
$traffic = $traffic + $interface['traffic_rx_avg'] + $interface['traffic_tx_avg'];
}
......@@ -708,6 +709,7 @@ else
$crawl_interfaces = Interfaces::getInterfacesCrawlByCrawlCycle($last_endet_crawl_cycle['id'], $crawl_router['router_id']);
$row['traffic'] = 0;
$traffic = 0;
foreach($crawl_interfaces as $interface) {
$traffic = $traffic + $interface['traffic_rx_avg'] + $interface['traffic_tx_avg'];
}
......
......@@ -14,11 +14,12 @@
echo "Could not fetch Info.";
}
$return = array();
echo "Command: ".$command."<br><br>";
exec($command, $return);
echo "Result:<pre>";
print_r($return);
echo "</pre>";
?>
\ No newline at end of file
if (isset($command)) {
$return = array();
echo "Command: ".$command."<br><br>";
exec($command, $return);
echo "Result:<pre>";
print_r($return);
echo "</pre>";
}
?>
......@@ -45,7 +45,7 @@
$GLOBALS['community_name'] = "Freifunk Deinestadt";
$GLOBALS['community_slogan'] = "Die freie WLAN-Community aus deiner Stadt • Freie Netze für alle!";
if (!$crawler) {
if (!isset($crawler) || !$crawler) {
//check if netmons root path and the config path is writable to created temp dirs and config file
$check_writable[] = '/';
$check_writable[] = '/config/';
......
......@@ -351,7 +351,7 @@
<tbody>
{foreach $originator_status_list->getOriginatorStatusList() as $originator}
<tr style="{if $originator->getOriginator()== $originator->getNexthop()}font-weight: bold;{/if} background-color: {if $originator->getLinkQuality() >= 0 AND $originator->getLinkQuality() < 105}#ff1e1e{else if $originator->getLinkQuality() >= 105 AND $originator->getLinkQuality() < 130}#ff4949{else if $originator->getLinkQuality() >= 130 AND $originator->getLinkQuality() < 155}#ff6a6a{else if $originator->getLinkQuality() >= 155 AND $originator->getLinkQuality() < 180}#ffac53{else if $originator->getLinkQuality() >= 180 AND $originator->getLinkQuality() < 205}#ffeb79{else if $originator->getLinkQuality() >= 205 AND $originator->getLinkQuality() < 230}#79ff7c{else if $originator->getLinkQuality() >= 230}#04ff0a{/if};">
<td><a href="search.php?search_range=mac_addr&search_string={$originators.originator}">{$originator->getOriginator()}</a></td>
<td><a href="search.php?search_range=mac_addr&search_string={$originator->getOriginator()}">{$originator->getOriginator()}</a></td>
<td>{$originator->getLastSeen()}</td>
<td>{$originator->getLinkQuality()}</td>
<td>{$originator->getNexthop()}</td>
......
......@@ -37,7 +37,7 @@
<h2 style="font-size: 9.5pt;">Aktuelle Statusdaten</h2>
<p style="font-size: 8pt;">
<b>Status:</b> {if $router->getStatusdata()->getStatus()=="online"}
<b>Status:</b> {if $router->getStatusdata() AND $router->getStatusdata()->getStatus()=="online"}
<img width="13" src="./templates/{$template}/img/ffmap/status_up_small.png" alt="online">
{elseif $router->getStatusdata()->getStatus()=="offline"}
<img src="./templates/{$template}/img/ffmap/status_down_small.png" alt="offline">
......
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