* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see . */
/**
* Custom Frontpage
* @author f0o
* @copyright 2014 f0o, LibreNMS
* @license GPL
* @package LibreNMS
* @subpackage Frontpage
*/
use LibreNMS\Authentication\LegacyAuth;
use LibreNMS\Config;
if (Config::get('map.engine') == 'leaflet') {
require_once 'includes/html/common/worldmap.inc.php';
echo implode('', $common_output);
} else {
if (Config::has('mapael.default_map') && is_file(Config::get('html_dir') . '/js/' . Config::get('mapael.default_map'))) {
$default_map = Config::get('mapael.default_map');
} else {
$default_map = 'maps/world_countries.js';
}
$map_tmp = preg_split("/\//", $default_map);
$map_name = $map_tmp[count($map_tmp)-1];
$map_name = str_replace('.js', '', $map_name);
$map_width = (int)Config::get('mapael.map_width', 800);
$default_zoom = Config::get('mapael.default_zoom', 0);
if (Config::has('mapael.default_lat') && Config::has('mapael.default_lng')) {
$init_zoom = "init: {
latitude: " . Config::has('mapael.default_lat') . ",
longitude: " . Config::has('mapael.default_lng') . ",
level: $default_zoom
}\n";
}
?>
';
//From default.php - This code is not part of above license.
if (Config::get('enable_syslog')) {
$sql = "SELECT *, DATE_FORMAT(timestamp, '" . Config::get('dateformat.mysql.compact') . "') AS date from syslog ORDER BY seq DESC LIMIT 20";
echo('
");
} else {
if (LegacyAuth::user()->hasGlobalAdmin()) {
$query = "SELECT *,DATE_FORMAT(datetime, '" . Config::get('dateformat.mysql.compact') . "') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
} else {
$query = "SELECT *,DATE_FORMAT(datetime, '" . Config::get('dateformat.mysql.compact') . "') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host =
P.device_id AND P.user_id = " . LegacyAuth::id() . " ORDER BY `datetime` DESC LIMIT 0,15";
}
echo('
Eventlog entries
');
foreach (dbFetchRows($query) as $entry) {
include 'includes/html/print-event.inc.php';
}
echo("