mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Updated parse_location function
This commit is contained in:
@@ -35,6 +35,7 @@ function authenticate($username, $password) {
|
||||
if (isset($config['auth_ad_groups'][$group_cn]['level'])) {
|
||||
// user is in one of the defined groups
|
||||
$user_authenticated = 1;
|
||||
adduser($username);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +44,7 @@ function authenticate($username, $password) {
|
||||
}
|
||||
else {
|
||||
// group membership is not required and user is valid
|
||||
adduser($username);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -81,11 +83,20 @@ function auth_usermanagement() {
|
||||
}
|
||||
|
||||
|
||||
function adduser() {
|
||||
// not supported so return 0
|
||||
return 0;
|
||||
function adduser($username) {
|
||||
// Check to see if user is already added in the database
|
||||
if (!user_exists_in_db($username)) {
|
||||
return dbInsert(array('username' => $username, 'user_id' => get_userid($username), 'level' => "0", 'can_modify_passwd' => 0, 'twofactor' => 0), 'users');
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function user_exists_in_db($username) {
|
||||
$return = dbFetchCell('SELECT COUNT(*) FROM users WHERE username = ?', array($username), true);
|
||||
return $return;
|
||||
}
|
||||
|
||||
function user_exists($username) {
|
||||
global $config, $ds;
|
||||
|
30
html/includes/forms/query-ripenccapi.inc.php
Normal file
30
html/includes/forms/query-ripenccapi.inc.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
$status = 'error';
|
||||
$message = 'unknown error';
|
||||
$parameter = mres($_POST['parameter']);
|
||||
if (isset($parameter)) {
|
||||
$status = 'ok';
|
||||
$message = 'Queried';
|
||||
$output = get_ripe_api_whois_data_json($parameter);
|
||||
}
|
||||
else {
|
||||
$status = 'error';
|
||||
$message = 'ERROR: Could not query';
|
||||
}
|
||||
die(json_encode(array(
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
'parameter' => $parameter,
|
||||
'output' => $output
|
||||
)));
|
@@ -1178,6 +1178,9 @@ function dynamic_override_config($type, $name, $device) {
|
||||
if ($type == 'checkbox') {
|
||||
return '<input type="checkbox" id="override_config" name="override_config" data-attrib="'.$name.'" data-device_id="'.$device['device_id'].'" data-size="small" '.$checked.'>';
|
||||
}
|
||||
elseif ($type == 'text') {
|
||||
return '<input type="text" id="override_config_text" name="override_config_text" data-attrib="'.$name.'" data-device_id="'.$device['device_id'].'" value="'.$attrib_val.'">';
|
||||
}
|
||||
}//end dynamic_override_config()
|
||||
|
||||
function generate_dynamic_config_panel($title,$end_panel=true,$config_groups,$items=array(),$transport='') {
|
||||
@@ -1250,3 +1253,8 @@ function generate_dynamic_config_panel($title,$end_panel=true,$config_groups,$it
|
||||
return $output;
|
||||
}//end generate_dynamic_config_panel()
|
||||
|
||||
function get_ripe_api_whois_data_json($ripe_parameter) {
|
||||
$ripe_whois_url = 'https://stat.ripe.net/data/whois/data.json?resource=' . $ripe_parameter;
|
||||
return json_decode(file_get_contents($ripe_whois_url) , true);
|
||||
}//end get_ripe_api_whois_data_json()
|
||||
|
||||
|
@@ -218,7 +218,7 @@ echo $edges;
|
||||
var network = new vis.Network(container, data, options);
|
||||
network.on('click', function (properties) {
|
||||
if (properties.nodes > 0) {
|
||||
window.location.href = "/device/device="+properties.nodes+"/tab=map/"
|
||||
window.location.href = "device/device="+properties.nodes+"/tab=map/"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@@ -74,6 +74,12 @@ if ($_SESSION['userlevel'] >= '10') {
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'availability-map'))); ?>"><i class="fa fa-arrow-circle-up fa-fw fa-lg"></i> Availability</a></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'map'))); ?>"><i class="fa fa-desktop fa-fw fa-lg"></i> Network</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown-submenu">
|
||||
<a href="<?php echo(generate_url(array('page'=>'overview'))); ?>"><i class="fa fa-wrench fa-fw fa-lg"></i> Tools</a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'ripenccapi'))); ?>"><i class="fa fa-arrow-circle-up fa-fw fa-lg"></i> RIPE NCC API</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'eventlog'))); ?>"><i class="fa fa-book fa-fw fa-lg"></i> Eventlog</a></li>
|
||||
|
@@ -29,7 +29,7 @@ if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||
$sql .= " AND (`D`.`hostname` LIKE '%$searchPhrase%' OR `E`.`datetime` LIKE '%$searchPhrase%' OR `E`.`message` LIKE '%$searchPhrase%' OR `E`.`type` LIKE '%$searchPhrase%')";
|
||||
}
|
||||
|
||||
$count_sql = "SELECT COUNT(datetime) $sql";
|
||||
$count_sql = "SELECT COUNT(event_id) $sql";
|
||||
$total = dbFetchCell($count_sql, $param);
|
||||
if (empty($total)) {
|
||||
$total = 0;
|
||||
|
Reference in New Issue
Block a user