Tony Murray e99f421511 Remove legacy auth usage of $_SESSION (#10491)
* Remove auth use of $_SESSION

Will break plugins that depend on $_SESSION, Weathermap was already fixed.
Port them to use Auth::check()/Auth::user()/Auth:id()

* revert accidental replacement
2019-08-05 14:16:05 -05:00

41 lines
1.1 KiB
PHP

<?php
$no_refresh = true;
if (!Auth::user()->hasGlobalAdmin()) {
include 'includes/html/error-no-perm.inc.php';
} else {
if ($vars['addsrv']) {
if (Auth::user()->hasGlobalAdmin()) {
$updated = '1';
$service_id = add_service($vars['device'], $vars['type'], $vars['descr'], $vars['ip'], $vars['params'], 0);
if ($service_id) {
$message .= $message_break.'Service added ('.$service_id.')!';
$message_break .= '<br />';
}
}
}
foreach (list_available_services() as $current_service) {
$servicesform .= "<option value='$current_service'>$current_service</option>";
}
foreach (dbFetchRows('SELECT * FROM `devices` ORDER BY `hostname`') as $device) {
$devicesform .= "<option value='".$device['device_id']."'>".format_hostname($device).'</option>';
}
if ($updated) {
print_message('Device Settings Saved');
}
$pagetitle[] = 'Add service';
echo "<div class='row'>
<div class='col-sm-6'>";
include_once 'includes/html/print-service-add.inc.php';
echo '</div>
</div>';
}//end if