librenms-librenms/html/pages/settings.inc.php

108 lines
2.8 KiB
PHP
Raw Normal View History

<?php
2015-05-15 14:19:45 +01:00
/* Copyright (C) 2015 Daniel Preussker <f0o@devilcode.org>
* 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.
2015-07-13 20:10:26 +02:00
*
2015-05-15 14:19:45 +01:00
* 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.
2015-07-13 20:10:26 +02:00
*
2015-05-15 14:19:45 +01:00
* You should have received a copy of the GNU General Public License
2015-07-13 20:10:26 +02:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2015-05-15 14:19:45 +01:00
2015-07-13 20:10:26 +02:00
/*
2015-05-15 14:19:45 +01:00
* Global Settings
* @author f0o <f0o@devilcode.org>
* @copyright 2015 f0o, LibreNMS
* @license GPL
* @package LibreNMS
* @subpackage Page
*/
2015-09-01 19:21:49 +05:30
$pagetitle[] = 'Global Settings';
2015-05-17 03:20:28 +01:00
?>
<div class="container-fluid">
2015-09-01 19:21:49 +05:30
<h2>Global Settings</h2>
<hr>
2015-05-17 03:20:28 +01:00
<div class="row">
<div class="col-md-12">
<span id="message"></span>
</div>
</div>
</div>
<?php
if (isset($vars['sub'])) {
2015-05-17 03:20:28 +01:00
if (file_exists("pages/settings/".mres($vars['sub']).".inc.php")) {
require_once "pages/settings/".mres($vars['sub']).".inc.php";
2015-07-13 20:10:26 +02:00
}
else {
print_error("This settings page doesn't exist, please go to the main settings page");
}
2015-07-13 20:10:26 +02:00
}
else {
?>
<div class="container-fluid">
<div class="row">
<?php
2015-07-13 20:10:26 +02:00
foreach (dbFetchRows("SELECT `config_group` FROM `config` GROUP BY `config_group`") as $sub_page) {
$sub_page = $sub_page['config_group'];
?>
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
<a class="btn btn-primary" href="<?php echo(generate_url(array('page'=>'settings','sub'=>$sub_page))); ?>"><?php echo ucfirst($sub_page); ?> Settings</a>
</div>
<?php
2015-07-13 20:10:26 +02:00
}
?>
</div>
</div>
<br />
<?php
2015-05-15 14:19:45 +01:00
/**
* Array-To-Table
* @param array $a N-Dimensional, Associative Array
* @return string
*/
2015-07-13 20:10:26 +02:00
function a2t($a) {
$r = "<table class='table table-condensed table-hover'><tbody>";
foreach( $a as $k=>$v ) {
if( !empty($v) ) {
$r .= "<tr><td class='col-md-2'><i><b>".$k."</b></i></td><td class='col-md-10'>".(is_array($v)?a2t($v):"<code>".wordwrap($v,75,"<br/>")."</code>")."</td></tr>";
}
}
$r .= '</tbody></table>';
return $r;
}
if( $_SESSION['userlevel'] >= 10 ) {
echo "<div class='table-responsive'>".a2t($config)."</div>";
}
else {
include 'includes/error-no-perm.inc.php';
}
2015-05-15 14:19:45 +01:00
if ($_SESSION['userlevel'] >= '10') {
2015-01-22 21:22:37 +00:00
if ($debug) {
echo("<pre>");
print_r($config);
echo("</pre>");
2015-01-22 21:22:37 +00:00
}
2015-07-13 20:10:26 +02:00
}
else {
include 'includes/error-no-perm.inc.php';
}
}
?>