Exemplo n.º 1
0
 private function eventlist()
 {
     if ($this->get_request_method() == "GET") {
         $this->_request['object'] = isset($this->_request['object']) ? $this->_request['object'] : false;
         $this->_request['object_id'] = isset($this->_request['object_id']) ? $this->_request['object_id'] : false;
         $this->_request['action'] = isset($this->_request['action']) ? $this->_request['action'] : false;
         $eventlist = new Eventlist();
         $eventlist->init($this->_request['object'], (int) $this->_request['object_id'], $this->_request['action'], (int) $this->_request['offset'], (int) $this->_request['limit'], $this->_request['sort_by'], $this->_request['order']);
         $domxmldata = $eventlist->getDomXMLElement($this->domxml);
         $this->response($this->finishxml($domxmldata), 200);
     } else {
         $this->error_code = 2;
         $this->error_message = "The OriginatorStatusList could not be created, your request seems to be malformed.";
         $this->response($this->finishxml(), 400);
     }
 }
Exemplo n.º 2
0
    $router = new Router((int) $_GET['router_id']);
    $router->fetch();
    $smarty->assign('router', $router);
    $smarty->display("router_embed.tpl.html");
} elseif (!isset($_GET['section']) and isset($_GET['router_id'])) {
    $smarty->assign('message', Message::getMessage());
    $smarty->assign('google_maps_api_key', Config::getConfigValueByName('google_maps_api_key'));
    $router = new Router((int) $_GET['router_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());
Exemplo n.º 3
0
echo "Clean database\n";
//Delete old Crawls
echo "Remove old crawl data\n";
Crawling::deleteOldCrawlDataExceptLastOnlineCrawl($GLOBALS['hours_to_keep_mysql_crawl_data'] * 60 * 60);
//Remove old events
echo "Remove old events\n";
//Get number of total events in db
$total_count = new Eventlist();
$total_count->init(false, false, false, 0, 0);
$total_count = $total_count->getTotalCount();
//Fetch the 50 oldest events from db and check if they need to be deleted.
//Then fetch the next 50 oldest events until you get to an event that is not old enough to delete it
//or if you looped through all events.
for ($offset = 0; $offset < $total_count; $offset += 50) {
    $eventlist = new Eventlist();
    $eventlist->init(false, false, false, $offset, 50, 'create_date', 'asc');
    foreach ($eventlist->getEventlist() as $event) {
        if ($event->getCreateDate() < time() - 60 * 60 * $GLOBALS['hours_to_keep_history_table']) {
            $event->delete();
        } else {
            $offset = $total_count;
            break;
        }
    }
}
//Remove old not assigned routers
echo "Remove not assigned routers that haven´t been updated for a while\n";
DB::getInstance()->exec("DELETE FROM routers_not_assigned WHERE TO_DAYS(update_date) < TO_DAYS(NOW())-2");
/**
 * Crawl
 **/
Exemplo n.º 4
0
<?php

/** Include Classes **/
require_once 'runtime.php';
require_once 'lib/core/Eventlist.class.php';
require_once 'lib/core/RouterStatus.class.php';
/** Get and assign global messages **/
$smarty->assign('message', Message::getMessage());
/** History **/
if (empty($_POST['event_count'])) {
    $event_count = 30;
} else {
    $event_count = $_POST['event_count'];
}
$smarty->assign('event_count', $event_count);
$eventlist = new Eventlist();
$eventlist->init(false, false, false, 0, $event_count, 'event_id', 'desc');
$smarty->assign('eventlist', $eventlist->getEventlist());
/** Display templates **/
$smarty->display("header.tpl.html");
$smarty->display("eventlist.tpl.html");
$smarty->display("footer.tpl.html");