require_once './lib/core/router_old.class.php'; require_once './lib/core/crawling.class.php'; require_once './lib/core/Chipsetlist.class.php'; /** Get and assign global messages **/ $smarty->assign('message', Message::getMessage()); /** Get and assign crawler status **/ $last_ended_crawl_cycle = Crawling::getLastEndedCrawlCycle(); if (!empty($last_ended_crawl_cycle)) { $last_ended_crawl_cycle['crawl_date_end'] = strtotime($last_ended_crawl_cycle['crawl_date']) + $GLOBALS['crawl_cycle'] * 60; $actual_crawl_cycle = Crawling::getActualCrawlCycle(); $actual_crawl_cycle['crawl_date_end'] = strtotime($actual_crawl_cycle['crawl_date']) + $GLOBALS['crawl_cycle'] * 60; $actual_crawl_cycle['crawl_date_end_minutes'] = floor(($actual_crawl_cycle['crawl_date_end'] - time()) / 60) . ':' . sprintf("%02d", ($actual_crawl_cycle['crawl_date_end'] - time()) % 60); $smarty->assign('last_ended_crawl_cycle', $last_ended_crawl_cycle); $smarty->assign('actual_crawl_cycle', $actual_crawl_cycle); /**Get number of routers by chipset **/ $chipsetlist = new Chipsetlist(); $router_chipsets = array(); foreach ($chipsetlist->getList() as $key => $chipset) { $router_chipsets[$key]['chipset_id'] = $chipset->getChipsetId(); $router_chipsets[$key]['chipset_name'] = $chipset->getName(); $router_chipsets[$key]['hardware_name'] = $chipset->getHardwareName(); $router_chipsets[$key]['count'] = Router_old::countRoutersByChipsetId($chipset->getChipsetId()); } /* echo "<pre>"; print_r($router_chipsets); die();*/ $smarty->assign('router_chipsets', $router_chipsets); /**Get number of routers by batman advanced version **/ try { $stmt = DB::getInstance()->prepare("SELECT batman_advanced_version \n\t\t\t\t\t\t FROM crawl_routers\n\t\t\t\t\t\t WHERE crawl_cycle_id=?\n\t\t\t\t\t\t\tAND batman_advanced_version != \"\"\n\t\t\t\t\t\t GROUP BY batman_advanced_version"); $stmt->execute(array($last_ended_crawl_cycle['id']));
$router->fetch(); $smarty->assign('router', $router); $networkinterfacelist = new Networkinterfacelist(false, $router->getRouterId(), 0, -1, 'name', 'asc'); $smarty->assign('networkinterfacelist', $networkinterfacelist); $originator_status_list = new OriginatorStatusList($router->getRouterId(), $router->getStatusdata()->getCrawlCycleId(), 0, -1); $smarty->assign('originator_status_list', $originator_status_list); $eventlist = new Eventlist(); $eventlist->init('router', $router->getRouterId(), false, 0, 10, 'event_id', 'desc'); $smarty->assign('eventlist', $eventlist); $smarty->display("header.tpl.html"); $smarty->display("router.tpl.html"); $smarty->display("footer.tpl.html"); } elseif (isset($_GET['section']) and $_GET['section'] == 'add') { //Logged in users can add a new router if (Permission::checkPermission(PERM_USER)) { $smarty->assign('message', Message::getMessage()); $smarty->assign('google_maps_api_key', ConfigLine::configByName('google_maps_api_key')); $smarty->assign('community_location_longitude', ConfigLine::configByName('community_location_longitude')); $smarty->assign('community_location_latitude', ConfigLine::configByName('community_location_latitude')); $smarty->assign('community_location_zoom', ConfigLine::configByName('community_location_zoom')); $smarty->assign('twitter_token', ConfigLine::configByName('twitter_token')); $chipsetlist = new Chipsetlist(false, false, 0, -1); $smarty->assign('chipsetlist', $chipsetlist->getList()); $smarty->display("header.tpl.html"); $smarty->display("router_new.tpl.html"); $smarty->display("footer.tpl.html"); } else { Permission::denyAccess(PERM_USER); } } elseif ($_GET['section'] == "store") { }