mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Move client authorization checks to a separate function
This commit is contained in:
@ -38,34 +38,11 @@ $graphfile = $config['temp_dir'] . "/" . strgen() . ".png";
|
||||
$type = $graphtype['type'];
|
||||
$subtype = $graphtype['subtype'];
|
||||
|
||||
if (is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php"))
|
||||
{
|
||||
$auth = is_client_authorized($_SERVER['REMOTE_ADDR']);
|
||||
include($config['install_dir'] . "/html/includes/graphs/$type/auth.inc.php");
|
||||
|
||||
if (isset($config['allow_unauth_graphs']) && $config['allow_unauth_graphs'])
|
||||
{
|
||||
$auth = "1"; // hardcode auth for all with config function
|
||||
}
|
||||
|
||||
if (isset($config['allow_unauth_graphs_cidr']) && count($config['allow_unauth_graphs_cidr']) > 0)
|
||||
{
|
||||
foreach ($config['allow_unauth_graphs_cidr'] as $range)
|
||||
{
|
||||
if (Net_IPv4::ipInNetwork($_SERVER['REMOTE_ADDR'], $range))
|
||||
{
|
||||
$auth = "1";
|
||||
if ($debug) { echo("matched $range"); }
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include($config['install_dir'] . "/html/includes/graphs/$type/auth.inc.php");
|
||||
|
||||
if (isset($auth) && $auth)
|
||||
{
|
||||
if ($auth && is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php")) {
|
||||
include($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user