mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 00:24:21 +02:00
Merge branch 'master' of https://github.com/adaniels21487/librenms into issue-1650
Conflicts: html/api_v0.php html/includes/api_functions.inc.php
This commit is contained in:
@@ -51,6 +51,7 @@ $app->group(
|
||||
// api/v0/devices/$hostname/ports
|
||||
$app->get('/:hostname/components', 'authToken', 'get_components')->name('get_components');
|
||||
// api/v0/devices/$hostname/components
|
||||
$app->get('/:hostname/groups', 'authToken', 'get_device_groups')->name('get_device_groups');
|
||||
$app->get('/:hostname/:type', 'authToken', 'get_graph_generic_by_hostname')->name('get_graph_generic_by_hostname');
|
||||
// api/v0/devices/$hostname/$type
|
||||
$app->get('/:hostname/ports/:ifname', 'authToken', 'get_port_stats_by_port_hostname')->name('get_port_stats_by_port_hostname');
|
||||
@@ -63,6 +64,13 @@ $app->group(
|
||||
// api/v0/devices
|
||||
$app->post('/devices', 'authToken', 'add_device')->name('add_device');
|
||||
// api/v0/devices (json data needs to be passed)
|
||||
$app->group(
|
||||
'/devicegroups',
|
||||
function () use ($app) {
|
||||
$app->get('/:name', 'authToken', 'get_devices_by_group')->name('get_devices_by_group');
|
||||
}
|
||||
);
|
||||
$app->get('/devicegroups', 'authToken', 'get_device_groups')->name('get_devicegroups');
|
||||
$app->group(
|
||||
'/portgroups',
|
||||
function () use ($app) {
|
||||
|
||||
@@ -1834,3 +1834,24 @@ label {
|
||||
|
||||
@media only screen and (min-width: 1024px) {
|
||||
}
|
||||
|
||||
.redCluster {
|
||||
background-color: rgba(255,0,0);
|
||||
background-color: rgba(255,0,0,0.7);
|
||||
text-align: center;
|
||||
width: 25px !important;
|
||||
height: 25px !important;
|
||||
font-size: 14px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.greenCluster {
|
||||
background-color: rgba(0,255,0);
|
||||
background-color: rgba(0,255,0,0.7);
|
||||
text-align: center;
|
||||
width: 25px !important;
|
||||
height: 25px !important;
|
||||
font-size: 14px;
|
||||
color: black;
|
||||
border-color:transparent;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
@@ -14,7 +14,7 @@
|
||||
|
||||
require_once '../includes/functions.php';
|
||||
require_once '../includes/component.php';
|
||||
|
||||
require_once '../includes/device-groups.inc.php';
|
||||
|
||||
function authToken(\Slim\Route $route) {
|
||||
$app = \Slim\Slim::getInstance();
|
||||
@@ -63,10 +63,17 @@ function get_graph_by_port_hostname() {
|
||||
$vars['to'] = $_GET['to'];
|
||||
}
|
||||
|
||||
if ($_GET['ifDescr'] == true) {
|
||||
$port = 'ifDescr';
|
||||
}
|
||||
else {
|
||||
$port = 'ifName';
|
||||
}
|
||||
|
||||
$vars['width'] = $_GET['width'] ?: 1075;
|
||||
$vars['height'] = $_GET['height'] ?: 300;
|
||||
$auth = '1';
|
||||
$vars['id'] = dbFetchCell('SELECT `P`.`port_id` FROM `ports` AS `P` JOIN `devices` AS `D` ON `P`.`device_id` = `D`.`device_id` WHERE `D`.`hostname`=? AND `P`.`ifName`=?', array($hostname, $vars['port']));
|
||||
$vars['id'] = dbFetchCell("SELECT `P`.`port_id` FROM `ports` AS `P` JOIN `devices` AS `D` ON `P`.`device_id` = `D`.`device_id` WHERE `D`.`hostname`=? AND `P`.`$port`=?", array($hostname, $vars['port']));
|
||||
$app->response->headers->set('Content-Type', 'image/png');
|
||||
include 'includes/graphs/graph.inc.php';
|
||||
|
||||
@@ -1068,3 +1075,73 @@ function update_device() {
|
||||
$app->response->headers->set('Content-Type', 'application/json');
|
||||
echo _json_encode($output);
|
||||
}
|
||||
|
||||
function get_device_groups() {
|
||||
$app = \Slim\Slim::getInstance();
|
||||
$router = $app->router()->getCurrentRoute()->getParams();
|
||||
$status = 'error';
|
||||
$code = 404;
|
||||
$hostname = $router['hostname'];
|
||||
// use hostname as device_id if it's all digits
|
||||
$device_id = ctype_digit($hostname) ? $hostname : getidbyname($hostname);
|
||||
if (is_numeric($device_id)) {
|
||||
$groups = GetGroupsFromDevice($device_id,1);
|
||||
}
|
||||
else {
|
||||
$groups = GetDeviceGroups();
|
||||
}
|
||||
if (empty($groups)) {
|
||||
$message = 'No device groups found';
|
||||
}
|
||||
else {
|
||||
$status = 'ok';
|
||||
$code = 200;
|
||||
$message = 'Found ' . count($groups) . ' device groups';
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
'count' => count($groups),
|
||||
'groups' => $groups,
|
||||
);
|
||||
$app->response->setStatus($code);
|
||||
$app->response->headers->set('Content-Type', 'application/json');
|
||||
echo _json_encode($output);
|
||||
}
|
||||
|
||||
function get_devices_by_group() {
|
||||
$app = \Slim\Slim::getInstance();
|
||||
$router = $app->router()->getCurrentRoute()->getParams();
|
||||
$status = 'error';
|
||||
$code = 404;
|
||||
$count = 0;
|
||||
$name = urldecode($router['name']);
|
||||
$devices = array();
|
||||
if (empty($name)) {
|
||||
$message = 'No device group name provided';
|
||||
}
|
||||
else {
|
||||
$group_id = dbFetchCell("SELECT `id` FROM `device_groups` WHERE `name`=?",array($name));
|
||||
$devices = GetDevicesFromGroup($group_id);
|
||||
$count = count($devices);
|
||||
if (empty($devices)) {
|
||||
$message = 'No devices found in group ' . $name;
|
||||
}
|
||||
else {
|
||||
$message = "Found $count in group $name";
|
||||
$code = 200;
|
||||
}
|
||||
}
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
'count' => $count,
|
||||
'devices' => $devices,
|
||||
);
|
||||
|
||||
$app->response->setStatus($code);
|
||||
$app->response->headers->set('Content-Type', 'application/json');
|
||||
echo _json_encode($output);
|
||||
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ else {
|
||||
$auth_success = 0;
|
||||
|
||||
if ((isset($_SESSION['username'])) || (isset($_COOKIE['sess_id'],$_COOKIE['token']))) {
|
||||
if ((authenticate($_SESSION['username'], $_SESSION['password'])) || (reauthenticate($_COOKIE['sess_id'], $_COOKIE['token']))) {
|
||||
if (reauthenticate($_COOKIE['sess_id'], $_COOKIE['token']) || authenticate($_SESSION['username'], $_SESSION['password'])) {
|
||||
$_SESSION['userlevel'] = get_userlevel($_SESSION['username']);
|
||||
$_SESSION['user_id'] = get_userid($_SESSION['username']);
|
||||
if (!$_SESSION['authenticated']) {
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
require_once $config['install_dir'].'/lib/pure_php_radius/radius.class.php';
|
||||
|
||||
$radius = new Radius($config['radius']['hostname'], $config['radius']['secret'], $config['radius']['suffix'], $config['radius']['timeout'], $config['radius']['port']);
|
||||
|
||||
function authenticate($username, $password) {
|
||||
global $config, $radius, $debug;
|
||||
|
||||
if (empty($username)) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if ($debug) {
|
||||
$radius->SetDebugMode(TRUE);
|
||||
}
|
||||
$rad = $radius->AccessRequest($username,$password);
|
||||
if($rad === true) {
|
||||
adduser($username);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function reauthenticate() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
function passwordscanchange() {
|
||||
// not supported so return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
function changepassword() {
|
||||
// not supported so return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
function auth_usermanagement() {
|
||||
// not supported so return 0
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
function adduser($username, $password, $level=1, $email='', $realname='', $can_modify_passwd=0, $description='', $twofactor=0) {
|
||||
// Check to see if user is already added in the database
|
||||
global $config;
|
||||
if (!user_exists($username)) {
|
||||
$hasher = new PasswordHash(8, false);
|
||||
$encrypted = $hasher->HashPassword($password);
|
||||
if ($config['radius']['default_level'] > 0) {
|
||||
$level = $config['radius']['default_level'];
|
||||
}
|
||||
$userid = dbInsert(array('username' => $username, 'password' => $encrypted, 'realname' => $realname, 'email' => $email, 'descr' => $description, 'level' => $level, 'can_modify_passwd' => $can_modify_passwd, 'twofactor' => $twofactor), 'users');
|
||||
if ($userid == false) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
foreach (dbFetchRows('select notifications.* from notifications where not exists( select 1 from notifications_attribs where notifications.notifications_id = notifications_attribs.notifications_id and notifications_attribs.user_id = ?) order by notifications.notifications_id desc',array($userid)) as $notif) {
|
||||
dbInsert(array('notifications_id'=>$notif['notifications_id'],'user_id'=>$userid,'key'=>'read','value'=>1),'notifications_attribs');
|
||||
}
|
||||
}
|
||||
return $userid;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function user_exists($username) {
|
||||
return dbFetchCell('SELECT COUNT(*) FROM users WHERE username = ?', array($username), true);
|
||||
}
|
||||
|
||||
|
||||
function get_userlevel($username) {
|
||||
return dbFetchCell('SELECT `level` FROM `users` WHERE `username` = ?', array($username), true);
|
||||
}
|
||||
|
||||
|
||||
function get_userid($username) {
|
||||
return dbFetchCell('SELECT `user_id` FROM `users` WHERE `username` = ?', array($username), true);
|
||||
}
|
||||
|
||||
|
||||
function deluser($username) {
|
||||
dbDelete('bill_perms', '`user_name` = ?', array($username));
|
||||
dbDelete('devices_perms', '`user_name` = ?', array($username));
|
||||
dbDelete('ports_perms', '`user_name` = ?', array($username));
|
||||
dbDelete('users_prefs', '`user_name` = ?', array($username));
|
||||
dbDelete('users', '`user_name` = ?', array($username));
|
||||
return dbDelete('users', '`username` = ?', array($username));
|
||||
}
|
||||
|
||||
|
||||
function get_userlist() {
|
||||
return dbFetchRows('SELECT * FROM `users`');
|
||||
}
|
||||
|
||||
|
||||
function can_update_users() {
|
||||
// supported so return 1
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
function get_user($user_id) {
|
||||
return dbFetchRow('SELECT * FROM `users` WHERE `user_id` = ?', array($user_id), true);
|
||||
}
|
||||
|
||||
|
||||
function update_user($user_id, $realname, $level, $can_modify_passwd, $email) {
|
||||
dbUpdate(array('realname' => $realname, 'level' => $level, 'can_modify_passwd' => $can_modify_passwd, 'email' => $email), 'users', '`user_id` = ?', array($user_id));
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Daniel Preussker, QuxLabs UG <preussker@quxlabs.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.
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/**
|
||||
* Generic Image Widget
|
||||
* @author Daniel Preussker
|
||||
* @copyright 2015 Daniel Preussker, QuxLabs UG
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Widgets
|
||||
*/
|
||||
|
||||
if( defined('show_settings') || empty($widget_settings) ) {
|
||||
$common_output[] = '
|
||||
<form class="form" onsubmit="widget_settings(this); return false;">
|
||||
<div class="form-group input_'.$unique_id.'" id="input_'.$unique_id.'">
|
||||
<div class="col-sm-2">
|
||||
<label for="image_url" class="control-label">Title: </label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control input_'.$unique_id.'" name="image_title" placeholder="Title" value="'.htmlspecialchars($widget_settings['image_title']).'">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group input_'.$unique_id.'" id="input_'.$unique_id.'">
|
||||
<div class="col-sm-2">
|
||||
<label for="image_url" class="control-label">Image URL: </label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control input_'.$unique_id.'" name="image_url" placeholder="Image URL" value="'.htmlspecialchars($widget_settings['image_url']).'">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
<button type="submit" class="btn btn-default">Set</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
}
|
||||
else {
|
||||
$widget_settings['title'] = $widget_settings['image_title'];
|
||||
$common_output[] = '<img class="minigraph-image" width="'.$widget_dimensions['x'].'" height="'.$widget_dimensions['y'].'" src="'.$widget_settings['image_url'].'"/>';
|
||||
}
|
||||
@@ -137,6 +137,17 @@ L.tileLayer(\'//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\', {
|
||||
|
||||
var markers = L.markerClusterGroup({
|
||||
maxClusterRadius: ' . $group_radius . ',
|
||||
iconCreateFunction: function (cluster) {
|
||||
var markers = cluster.getAllChildMarkers();
|
||||
var n = 0;
|
||||
newClass = "greenCluster marker-cluster marker-cluster-small leaflet-zoom-animated leaflet-clickable";
|
||||
for (var i = 0; i < markers.length; i++) {
|
||||
if (markers[i].options.icon.options.markerColor == "red") {
|
||||
newClass = "redCluster marker-cluster marker-cluster-small leaflet-zoom-animated leaflet-clickable";
|
||||
}
|
||||
}
|
||||
return L.divIcon({ html: cluster.getChildCount(), className: newClass, iconSize: L.point(40, 40) });
|
||||
},
|
||||
});
|
||||
var redMarker = L.AwesomeMarkers.icon({
|
||||
icon: \'server\',
|
||||
|
||||
@@ -222,21 +222,16 @@ if (!defined('MBTTF_DIR')) {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check minimum PHP version
|
||||
//
|
||||
/*
|
||||
* Check minimum PHP version
|
||||
* @author f0o <f0o@devilcode.org>
|
||||
* @copyright 2015 f0o, LibreNMS
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Billing
|
||||
*/
|
||||
function CheckPHPVersion($aMinVersion) {
|
||||
list($majorC, $minorC, $editC) = preg_split('/[\/.-]/', PHP_VERSION);
|
||||
list($majorR, $minorR, $editR) = preg_split('/[\/.-]/', $aMinVersion);
|
||||
|
||||
if ($majorC != $majorR) return false;
|
||||
if ($majorC < $majorR) return false;
|
||||
// same major - check minor
|
||||
if ($minorC > $minorR) return true;
|
||||
if ($minorC < $minorR) return false;
|
||||
// and same minor
|
||||
if ($editC >= $editR) return true;
|
||||
return true;
|
||||
return version_compare(PHP_VERSION, $aMinVersion, '>=');
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -38,9 +38,18 @@ else {
|
||||
|
||||
echo "<tr style=\"background-color: $row_colour;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\" style='cursor: pointer;'>
|
||||
<td valign=top width=350 onclick=\"location.href='".generate_port_url($port)."'\">";
|
||||
echo ' <span class=list-large>
|
||||
|
||||
// Don't echo out ports ifIndex if it's a NOS device since their ifIndex is, for lack of better words....different
|
||||
if ($device['os'] == 'nos') {
|
||||
echo ' <span class=list-large>
|
||||
'.generate_port_link($port, $port['label'])." $error_img $mac
|
||||
</span><br /><span class=interface-desc>".$port['ifAlias'].'</span>';
|
||||
}
|
||||
else {
|
||||
echo ' <span class=list-large>
|
||||
'.generate_port_link($port, $port['ifIndex'].'. '.$port['label'])." $error_img $mac
|
||||
</span><br /><span class=interface-desc>".$port['ifAlias'].'</span>';
|
||||
}
|
||||
|
||||
if ($port['ifAlias']) {
|
||||
echo '<br />';
|
||||
|
||||
@@ -312,6 +312,10 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($vars['dashboard'])) {
|
||||
dbUpdate(array('dashboard'=>$vars['dashboard']),'users','user_id = ?',array($vars['user_id']));
|
||||
}
|
||||
|
||||
echo "<form class='form-horizontal' role='form' method='post' action=''>
|
||||
<input type='hidden' name='user_id' value='".$vars['user_id']."'>
|
||||
<input type='hidden' name='cur_username' value='" . $users_details['username'] . "'>
|
||||
@@ -374,6 +378,18 @@ if (passwordscanchange($users_details['username'])) {
|
||||
</div>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<div class='form-group'>
|
||||
<label for='dashboard' class='col-sm-2 control-label'>Dashboard</label>
|
||||
<div class='col-sm-4'><select class='form-control' name='dashboard'>";
|
||||
$defdash = dbFetchCell("SELECT dashboard FROM users WHERE user_id = ?",array($vars['user_id']));
|
||||
foreach(dbFetchRows("SELECT dashboards.*,users.username FROM `dashboards` INNER JOIN `users` ON users.user_id = dashboards.user_id WHERE (dashboards.access > 0 && dashboards.user_id != ?) || dashboards.user_id = ?",array($vars['user_id'],$vars['user_id'])) as $dash) {
|
||||
echo "<option value='".$dash['dashboard_id']."'".($defdash == $dash['dashboard_id'] ? ' selected' : '').">".$dash['dashboard_name']."</option>";
|
||||
}
|
||||
echo "</select>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
echo "<div class='form-group'>
|
||||
<div class='col-sm-6'>
|
||||
|
||||
@@ -16,8 +16,13 @@
|
||||
* Code for Gridster.sort_by_row_and_col_asc(serialization) call is from http://gridster.net/demos/grid-from-serialize.html
|
||||
*/
|
||||
|
||||
$no_refresh = true;
|
||||
if (dbFetchCell('SELECT dashboard_id FROM dashboards WHERE user_id=?',array($_SESSION['user_id'])) == 0) {
|
||||
$no_refresh = true;
|
||||
$default_dash = 0;
|
||||
if (($tmp = dbFetchCell('SELECT dashboard FROM users WHERE user_id=?',array($_SESSION['user_id']))) != 0) {
|
||||
$default_dash = $tmp;
|
||||
}
|
||||
else if (dbFetchCell('SELECT dashboard_id FROM dashboards WHERE user_id=?',array($_SESSION['user_id'])) == 0) {
|
||||
$tmp = dbInsert(array('dashboard_name'=>'Default','user_id'=>$_SESSION['user_id']),'dashboards');
|
||||
$vars['dashboard'] = dbInsert(array('dashboard_name'=>'Default','user_id'=>$_SESSION['user_id']),'dashboards');
|
||||
if (dbFetchCell('select 1 from users_widgets where user_id = ? && dashboard_id = ?',array($_SESSION['user_id'],0)) == 1) {
|
||||
dbUpdate(array('dashboard_id'=>$vars['dashboard']),'users_widgets','user_id = ? && dashboard_id = ?',array($_SESSION['user_id'],0));
|
||||
@@ -31,7 +36,12 @@ if (!empty($vars['dashboard'])) {
|
||||
}
|
||||
}
|
||||
if (empty($vars['dashboard'])) {
|
||||
$vars['dashboard'] = dbFetchRow('select * from dashboards where user_id = ? order by dashboard_id limit 1',array($_SESSION['user_id']));
|
||||
if ($default_dash != 0) {
|
||||
$vars['dashboard'] = dbFetchRow('select * from dashboards where dashboard_id = ?',array($default_dash));
|
||||
}
|
||||
else {
|
||||
$vars['dashboard'] = dbFetchRow('select * from dashboards where user_id = ? order by dashboard_id limit 1',array($_SESSION['user_id']));
|
||||
}
|
||||
if (isset($orig)) {
|
||||
$msg_box[] = array('type' => 'error', 'message' => 'Dashboard <code>#'.$orig.'</code> does not exist! Loaded <code>'.$vars['dashboard']['dashboard_name'].'</code> instead.','title' => 'Requested Dashboard Not Found!');
|
||||
}
|
||||
|
||||
+35
-35
@@ -53,31 +53,32 @@ echo $pagetitle[0];
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($vars['sub'])) {
|
||||
if (is_admin() === true) {
|
||||
if (isset($vars['sub'])) {
|
||||
|
||||
if (file_exists("pages/settings/".mres($vars['sub']).".inc.php")) {
|
||||
require_once "pages/settings/".mres($vars['sub']).".inc.php";
|
||||
}
|
||||
else {
|
||||
print_error("This settings page doesn't exist, please go to the main settings page");
|
||||
}
|
||||
|
||||
if (file_exists("pages/settings/".mres($vars['sub']).".inc.php")) {
|
||||
require_once "pages/settings/".mres($vars['sub']).".inc.php";
|
||||
}
|
||||
else {
|
||||
print_error("This settings page doesn't exist, please go to the main settings page");
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
?>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<?php
|
||||
foreach (dbFetchRows("SELECT `config_group` FROM `config` GROUP BY `config_group`") as $sub_page) {
|
||||
$sub_page = $sub_page['config_group'];
|
||||
foreach (dbFetchRows("SELECT `config_group` FROM `config` GROUP BY `config_group`") as $sub_page) {
|
||||
$sub_page = $sub_page['config_group'];
|
||||
?>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
|
||||
<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
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -90,33 +91,32 @@ else {
|
||||
* @return string
|
||||
*/
|
||||
|
||||
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>";
|
||||
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;
|
||||
}
|
||||
echo "<div class='table-responsive'>".a2t($config)."</div>";
|
||||
|
||||
if ($_SESSION['userlevel'] >= '10') {
|
||||
|
||||
if ($debug) {
|
||||
echo("<pre>");
|
||||
print_r($config);
|
||||
echo("</pre>");
|
||||
}
|
||||
}
|
||||
$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';
|
||||
}
|
||||
|
||||
if ($_SESSION['userlevel'] >= '10') {
|
||||
|
||||
if ($debug) {
|
||||
echo("<pre>");
|
||||
print_r($config);
|
||||
echo("</pre>");
|
||||
else {
|
||||
include 'includes/error-no-perm.inc.php';
|
||||
}
|
||||
}
|
||||
else {
|
||||
include 'includes/error-no-perm.inc.php';
|
||||
}
|
||||
}
|
||||
else {
|
||||
include 'includes/error-no-perm.inc.php';
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user