Merge pull request #1667 from miken32/master

changes needed to run under a web server subdirectory
This commit is contained in:
Neil Lathwood
2015-08-14 15:05:29 +01:00
55 changed files with 127 additions and 99 deletions

View File

@@ -45,6 +45,8 @@ Contributors to LibreNMS:
- Aaron Daniels <aaron@daniels.id.au> (adaniels21487)
- David M. Syzdek <david@syzdek.net> (syzdek)
- Gerben Meijer <gerben@daybyday.nl> (infernix)
- Michael Newton <mnewton@pofp.com> (miken32)
[1]: http://observium.org/ "Observium web site"

View File

@@ -0,0 +1,20 @@
To run LibreNMS under a subdirectory on your Apache server, the directives for the LibreNMS directory are placed in the base server configuration, or in a virtual host
container of your choosing. If using a virtual host, place the directives in the file where the virtual host is configured. If using the base server on RHEL distributions
(CentOS, Scientific Linux, etc.) the directives can be placed in `/etc/httpd/conf.d/librenms.conf`. For Debian distributions (Ubuntu, etc.) place the directives in
`/etc/apache2/sites-available/default`.
```apache
#These directives can be inside a virtual host or in the base server configuration
AllowEncodedSlashes On
Alias /librenms /opt/librenms/html
<Directory "/opt/librenms/html">
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
```
The `RewriteBase` directive in `html/.htaccess` must be rewritten to reference the subdirectory name. Assuming LibreNMS is running at http://example.com/librenms/,
you will need to change `RewriteBase /` to `RewriteBase /librenms`.
Finally, ensure `$config["base_url"]` -- if configured -- is correct as well.

View File

@@ -63,7 +63,7 @@ ul ul ul { list-style: square outside; }
}
.submit {
background-image: url('/images/submitbg.png');
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAATCAIAAAA4QDsKAAAABGdBTUEAALGPC/xhBQAAAEZJREFUeJyVjMEJACEQA2dlSxD7r2/xcdhAfNwJig/PfJIhISaJocQk/9ccwTDAEYAQ4K99sylfXm+gtbFl1p4WNUouUaMDPUI2q6SigUIAAAAASUVORK5CYII=');
background-position: 0 100%;
border-color: #B2B2B2 #525252 #525252 #B2B2B2;
}

View File

@@ -33,7 +33,7 @@ if ($vars['page'] == 'logout' && $_SESSION['authenticated']) {
setcookie('auth', '', (time() - 60 * 60 * 24 * $config['auth_remember']), '/');
session_destroy();
$auth_message = 'Logged Out';
header('Location: /');
header('Location: ' . $config['base_url']);
exit;
}

View File

@@ -31,7 +31,7 @@ var alerts_grid = $("#alerts").bootgrid({
device_id: \'' . $device['device_id'] .'\'
};
},
url: "/ajax_table.php",
url: "ajax_table.php",
formatters: {
"status": function(column,row) {
return "<h4><span class=\'label label-"+row.extra+" threeqtr-width\'>" + row.msg + "</span></h4>";
@@ -70,7 +70,7 @@ var alerts_grid = $("#alerts").bootgrid({
var state = $(this).data("state");
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: { type: "ack-alert", alert_id: alert_id, state: state },
success: function(msg){
$("#message").html(\'<div class="alert alert-info">\'+msg+\'</div>\');

View File

@@ -24,7 +24,7 @@ var eventlog_grid = $("#eventlog").bootgrid({
type: "' .mres($vars['type']) .'",
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
});
</script>

View File

@@ -102,7 +102,7 @@ $('#schedule-maintenance').on('show.bs.modal', function (event) {
if (schedule_id > 0) {
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: { type: "schedule-maintenance", sub_type: "parse-maintenance", schedule_id: schedule_id },
dataType: "json",
success: function(output) {
@@ -124,7 +124,7 @@ $('#sched-submit').click('', function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: $('form.schedule-maintenance-form').serialize(),
dataType: "json",
success: function(data){

View File

@@ -107,7 +107,7 @@ $('#alert-template').on('show.bs.modal', function (event) {
$('#template_id').val(template_id);
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: { type: "parse-alert-template", template_id: template_id },
dataType: "json",
success: function(output) {
@@ -125,7 +125,7 @@ $('#create-template').click('', function(e) {
var name = $("#name").val();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: { type: "alert-templates", template: template , name: name, template_id: template_id},
dataType: "html",
success: function(msg){

View File

@@ -60,7 +60,7 @@ $('#attach-alert-template').on('show.bs.modal', function(e) {
$("#template_id").val(template_id);
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: { type: "parse-template-rules", template_id: template_id },
dataType: "json",
success: function(output) {
@@ -88,7 +88,7 @@ $('#alert-template-attach').click('', function(event) {
var rules = items.join(',');
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "attach-alert-template", template_id: template_id, rule_id: rules },
dataType: "html",
success: function(msg) {

View File

@@ -50,7 +50,7 @@ $('#alert-map-removal').click('', function(event) {
var map_id = $("#map_id").val();
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "delete-alert-map", map_id: map_id },
dataType: "html",
success: function(msg) {

View File

@@ -50,7 +50,7 @@ $('#alert-rule-removal').click('', function(event) {
var alert_id = $("#alert_id").val();
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "delete-alert-rule", alert_id: alert_id },
dataType: "html",
success: function(msg) {

View File

@@ -50,7 +50,7 @@ $('#alert-template-removal').click('', function(event) {
var template_id = $("#template_id").val();
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "delete-alert-template", template_id: template_id },
dataType: "html",
success: function(msg) {

View File

@@ -50,7 +50,7 @@ $('#device-group-removal').click('', function(event) {
var group_id = $("#group_id").val();
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "delete-device-group", group_id: group_id },
dataType: "html",
success: function(msg) {

View File

@@ -57,7 +57,7 @@ $('#create-map').on('show.bs.modal', function (event) {
$('#map_id').val(map_id);
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: { type: "parse-alert-map", map_id: map_id },
dataType: "json",
success: function(output) {
@@ -166,7 +166,7 @@ $('#map-submit').click('', function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: $('form.maps-form').serialize(),
success: function(msg){
$("#message").html('<div class="alert alert-info">'+msg+'</div>');

View File

@@ -184,7 +184,7 @@ $('#create-alert').on('show.bs.modal', function (event) {
}
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: { type: "parse-alert-rule", alert_id: alert_id },
dataType: "json",
success: function(output) {
@@ -347,7 +347,7 @@ $('#rule-submit').click('', function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: $('form.alerts-form').serialize(),
success: function(msg){
if(msg.indexOf("ERROR:") <= -1) {

View File

@@ -119,7 +119,7 @@ $('#create-group').on('show.bs.modal', function (event) {
});
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: { type: "parse-device-group", group_id: group_id },
dataType: "json",
success: function(output) {
@@ -192,7 +192,7 @@ $('#group-submit').click('', function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: $('form.group-form').serialize(),
success: function(msg){
if(msg.indexOf("ERROR:") <= -1) {

View File

@@ -93,7 +93,7 @@ $('#group-removal').click('', function(e) {
group_id = $("#group_id").val();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: $('form.remove_group_form').serialize() ,
success: function(msg) {
$("#thanks").html('<div class="alert alert-info">'+msg+'</div>');
@@ -115,7 +115,7 @@ $('#poller-groups').on('show.bs.modal', function (event) {
$('#group_id').val(group_id);
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: { type: "parse-poller-groups", group_id: group_id },
dataType: "json",
success: function(output) {
@@ -133,7 +133,7 @@ $('#create-group').click('', function(e) {
var group_id = $('#group_id').val();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: { type: "poller-groups", group_name: group_name, descr: descr, group_id: group_id },
dataType: "html",
success: function(msg){

View File

@@ -52,7 +52,7 @@ $('#sched-maintenance-removal').click('', function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: $('form.schedule-maintenance-del').serialize(),
dataType: "json",
success: function(data){

View File

@@ -268,7 +268,7 @@ $('#ack-alert').click('', function(e) {
var alert_id = $(this).data("alert_id");
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: { type: "ack-alert", alert_id: alert_id },
success: function(msg){
$("#message").html('<div class="alert alert-info">'+msg+'</div>');
@@ -294,7 +294,7 @@ $('input[name="alert-rule"]').on('switchChange.bootstrapSwitch', function(event
var orig_class = $(this).data("orig_class");
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "update-alert-rule", alert_id: alert_id, state: state },
dataType: "html",
success: function(msg) {

View File

@@ -30,7 +30,7 @@ else {
}
if (dbFetchCell('SELECT COUNT(*) FROM `mac_accounting` WHERE `port_id` = ?', array($port['port_id']))) {
$mac = "<a href='".generate_port_url($port, array('view' => 'macaccounting'))."'><img src='/images/16/chart_curve.png' align='absmiddle'></a>";
$mac = "<a href='".generate_port_url($port, array('view' => 'macaccounting'))."'><img src='images/16/chart_curve.png' align='absmiddle'></a>";
}
else {
$mac = '';

View File

@@ -489,12 +489,12 @@ if ($_SESSION['userlevel'] >= '10') {
<li class="dropdown-submenu">
<a href="#"><i class="fa fa-clock-o fa-fw fa-lg"></i> Pollers</a>
<ul class="dropdown-menu scrollable-menu">
<li><a href="/poll-log/"><i class="fa fa-exclamation fa-fw fa-lg"></i> Poll-log</a></li>');
<li><a href="poll-log/"><i class="fa fa-exclamation fa-fw fa-lg"></i> Poll-log</a></li>');
if($config['distributed_poller'] === TRUE) {
echo ('
<li><a href="/pollers/tab=pollers/"><i class="fa fa-clock-o fa-fw fa-lg"></i> Pollers</a></li>
<li><a href="/pollers/tab=groups/"><i class="fa fa-gears fa-fw fa-lg"></i> Groups</a></li>');
<li><a href="pollers/tab=pollers/"><i class="fa fa-clock-o fa-fw fa-lg"></i> Pollers</a></li>
<li><a href="pollers/tab=groups/"><i class="fa fa-gears fa-fw fa-lg"></i> Groups</a></li>');
}
echo ('
</ul>

View File

@@ -11,7 +11,14 @@ foreach ($_GET as $key => $get_var) {
}
}
$base_url = parse_url($config["base_url"]);
// don't parse the subdirectory, if there is one in the path
if (strlen($base_url["path"]) > 1) {
$segments = explode('/', trim(str_replace($base_url["path"], "", $_SERVER['REQUEST_URI']), '/'));
}
else {
$segments = explode('/', trim($_SERVER['REQUEST_URI'], '/'));
}
foreach ($segments as $pos => $segment) {
$segment = urldecode($segment);

View File

@@ -54,7 +54,7 @@ $msg_box = array();
// Check for install.inc.php
if (!file_exists('../config.php') && $_SERVER['PATH_INFO'] != '/install.php') {
// no config.php does so let's redirect to the install
header('Location: /install.php');
header('Location: install.php');
exit;
}

View File

@@ -29,7 +29,7 @@ if($stage == "4" || $stage == "3") {
require '../includes/defaults.inc.php';
// Work out the install directory
$cur_dir = explode('/',$_SERVER['DOCUMENT_ROOT']);
$cur_dir = explode('/',__DIR__);
$check = end($cur_dir);
if( empty($check) ) {
$install_dir = array_pop($cur_dir);
@@ -90,7 +90,6 @@ $complete = 1;
<html>
<head>
<title><?php echo($config['page_title_prefix']); ?></title>
<base href="<?php echo($config['base_url']); ?>" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="content-language" content="en-us" />

View File

@@ -208,7 +208,7 @@ echo "
event.preventDefault();
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "callback-statistics", state: state},
dataType: "html",
success: function(data){
@@ -222,7 +222,7 @@ echo "
event.preventDefault();
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "callback-clear"},
dataType: "html",
success: function(data){

View File

@@ -72,7 +72,7 @@ foreach (get_all_devices() as $hostname) {
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>'
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
}).on("loaded.rs.jquery.bootgrid", function() {
var results = $("div.infos").text().split(" ");

View File

@@ -73,7 +73,7 @@ var grid = $("#alert-schedule").bootgrid({
id: "alert-schedule",
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
}).on("loaded.rs.jquery.bootgrid", function()
{
/* Executes after data is loaded and rendered */

View File

@@ -160,7 +160,7 @@ foreach (dbFetchRows('SELECT `AT`.*,`U`.`username` FROM `api_tokens` AS AT JOIN
var token_id = $(this).data("token_id");
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "token-item-disable", token_id: token_id, state: state},
dataType: "html",
success: function(data){
@@ -180,7 +180,7 @@ foreach (dbFetchRows('SELECT `AT`.*,`U`.`username` FROM `api_tokens` AS AT JOIN
token_id = $("#token_id").val();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: $('form.remove_token_form').serialize() ,
success: function(msg){
$("#thanks").html('<div class="alert alert-info">'+msg+'</div>');
@@ -197,7 +197,7 @@ foreach (dbFetchRows('SELECT `AT`.*,`U`.`username` FROM `api_tokens` AS AT JOIN
event.preventDefault();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: $('form.create_token_form').serialize(),
success: function(msg){
$("#thanks").html('<div class="alert alert-info">'+msg+'</div>');

View File

@@ -146,7 +146,7 @@ if (bill_permitted($bill_id)) {
}
}//end if
echo '<div style="font-weight: bold; float: right;"><a href="'.generate_url(array('page' => 'bills')).'/"><img align=absmiddle src="/images/16/arrow_left.png"> Back to Bills</a></div>';
echo '<div style="font-weight: bold; float: right;"><a href="'.generate_url(array('page' => 'bills')).'/"><img align=absmiddle src="images/16/arrow_left.png"> Back to Bills</a></div>';
print_optionbar_end();

View File

@@ -99,7 +99,7 @@ else if ($vars['view'] == 'add') {
}
}
echo '<div style="font-weight: bold; float: right;"><a href="'.generate_url(array('page' => 'bills')).'/"><img align=absmiddle src="/images/16/arrow_left.png"> Back to Bills</a></div>';
echo '<div style="font-weight: bold; float: right;"><a href="'.generate_url(array('page' => 'bills')).'/"><img align=absmiddle src="images/16/arrow_left.png"> Back to Bills</a></div>';
print_optionbar_end();
?>

View File

@@ -149,7 +149,7 @@ if ($unknown) {
var device_id = $(this).data("device_id");
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "rediscover-device", device_id: device_id },
dataType: "json",
success: function(data){

View File

@@ -101,7 +101,7 @@ $('#newThread').on('click', function(e){
var form = $('#alert-reset');
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: form.serialize(),
dataType: "html",
success: function(data){
@@ -125,7 +125,7 @@ $( ".sensor" ).blur(function() {
var $this = $(this);
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "health-update", device_id: device_id, data: data, sensor_id: sensor_id , value_type: value_type},
dataType: "html",
success: function(data){
@@ -155,7 +155,7 @@ $('input[name="alert-status"]').on('switchChange.bootstrapSwitch', function(eve
var sensor_id = $(this).data("sensor_id");
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "sensor-alert-update", device_id: device_id, sensor_id: sensor_id, state: state},
dataType: "html",
success: function(data){
@@ -172,7 +172,7 @@ $("[name='remove-custom']").on('click', function(event) {
var sensor_id = $(this).data("sensor_id");
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "sensor-alert-update", sensor_id: sensor_id, sub_type: "remove-custom" },
dataType: "html",
success: function(data){

View File

@@ -153,7 +153,7 @@ echo('
var device_id = $(this).data("device_id");
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "poller-module-update", poller_module: poller_module, device_id: device_id, state: state},
dataType: "html",
success: function(data){
@@ -184,7 +184,7 @@ echo('
var device_id = $(this).data("device_id");
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: { type: "discovery-module-update", discovery_module: discovery_module, device_id: device_id, state: state},
dataType: "html",
success: function(data){

View File

@@ -79,7 +79,7 @@
event.preventDefault();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: $('form#ignoreport').serialize(),
dataType: "json",
success: function(data){
@@ -108,6 +108,6 @@
device_id: "<?php echo $device['device_id']; ?>"
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
});
</script>

View File

@@ -192,7 +192,7 @@ if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE port_id = '".$port['port_i
echo "<span class='pagemenu-selected'>";
}
echo "<a href='/device/device=".$device['device_id'].'/tab=port/port='.$port['port_id']."/junose-atm-vp/bits/'>Bits</a>";
echo "<a href='" . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'port', 'port'=>$port['port_id'])) . "/junose-atm-vp/bits/'>Bits</a>";
if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') {
echo '</span>';
}
@@ -202,7 +202,7 @@ if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE port_id = '".$port['port_i
echo "<span class='pagemenu-selected'>";
}
echo "<a href='device/device=".$device['device_id'].'/tab=port/port='.$port['port_id']."/junose-atm-vp/packets/'>Packets</a>";
echo "<a href='" . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'port', 'port'=>$port['port_id'])) . "/junose-atm-vp/packets/'>Packets</a>";
if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') {
echo '</span>';
}
@@ -212,7 +212,7 @@ if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE port_id = '".$port['port_i
echo "<span class='pagemenu-selected'>";
}
echo "<a href='device/device=".$device['device_id'].'/tab=port/port='.$port['port_id']."/junose-atm-vp/cells/'>Cells</a>";
echo "<a href='" . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'port', 'port'=>$port['port_id'])) . "/junose-atm-vp/cells/'>Cells</a>";
if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') {
echo '</span>';
}
@@ -222,14 +222,14 @@ if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE port_id = '".$port['port_i
echo "<span class='pagemenu-selected'>";
}
echo "<a href='device/device=".$device['device_id'].'/tab=port/port='.$port['port_id']."/junose-atm-vp/errors/'>Errors</a>";
echo "<a href='" . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'port', 'port'=>$port['port_id'])) . "/junose-atm-vp/errors/'>Errors</a>";
if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') {
echo '</span>';
}
}//end if
if ($_SESSION['userlevel'] >= '10') {
echo "<span style='float: right;'><a href='bills/view=add/port=".$port['port_id']."/'><img src='images/16/money.png' border='0' align='absmiddle'> Create Bill</a></span>";
echo "<span style='float: right;'><a href='" . generate_url(array('page'=>'bills', 'view'=>'add', 'port'=>$port['port_id'])) . "'><img src='images/16/money.png' border='0' align='absmiddle'> Create Bill</a></span>";
}
print_optionbar_end();

View File

@@ -85,7 +85,7 @@ foreach ($heads as $head => $extra) {
$icon .= "'";
}
echo '<th><a href="/device/device='.$device['device_id'].'/tab=processes/order='.$lhead.'/by='.$bhead.'"><span'.$icon.'>&nbsp;';
echo '<th><a href="' . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'processes', 'order'=>$lhead, 'by'=>$bhead)) . '"><span'.$icon.'>&nbsp;';
if (!empty($extra)) {
echo "<abbr title='$extra'>$head</abbr>";
}

View File

@@ -435,7 +435,7 @@ var grid = $("#devices").bootgrid({
group: '<?php echo mres($vars['group']); ?>',
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
});
</script>

View File

@@ -74,7 +74,7 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg
var s = JSON.stringify(gridster.serialize());
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "update-dashboard-config", data: s},
dataType: "json",
success: function (data) {
@@ -134,7 +134,7 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg
var widget_id = $(this).data('widget-id');
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "update-dashboard-config", sub_type: 'remove-all'},
dataType: "json",
success: function (data) {
@@ -155,7 +155,7 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg
var widget_id = $(this).data('widget_id');
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "update-dashboard-config", sub_type: 'add', widget_id: widget_id},
dataType: "json",
success: function (data) {
@@ -189,7 +189,7 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg
var widget_id = $(this).data('widget-id');
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "update-dashboard-config", sub_type: 'remove', widget_id: widget_id},
dataType: "json",
success: function (data) {
@@ -213,7 +213,7 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg
new_refresh = refresh * 1000;
$.ajax({
type: 'POST',
url: '/ajax_dash.php',
url: 'ajax_dash.php',
data: {type: data_type},
dataType: "json",
success: function (data) {

View File

@@ -23,7 +23,7 @@
view: '<?php echo $vars['view']; ?>'
};
},
url: "/ajax_table.php",
url: "ajax_table.php",
formatters: {
"status": function(column,row) {
return "<h4><span class='label label-"+row.extra+" threeqtr-width'>" + row.msg + "</span></h4>";

View File

@@ -22,7 +22,7 @@
view: '<?php echo $vars['view']; ?>'
};
},
url: "/ajax_table.php",
url: "ajax_table.php",
formatters: {
"status": function(column,row) {
return "<h4><span class='label label-"+row.extra+" threeqtr-width'>" + row.msg + "</span></h4>";

View File

@@ -23,7 +23,7 @@
view: '<?php echo $vars['view']; ?>'
};
},
url: "/ajax_table.php",
url: "ajax_table.php",
formatters: {
"status": function(column,row) {
return "<h4><span class='label label-"+row.extra+" threeqtr-width'>" + row.msg + "</span></h4>";

View File

@@ -89,7 +89,7 @@ if ($if_list) {
<td colspan='5'";
if (dbFetchCell('SELECT count(*) FROM mac_accounting WHERE port_id = ?', array($port['port_id']))) {
echo "<span style='float: right;'><a href='device/device=".$port['device_id'].'/tab=port/port='.$port['port_id']."/view=macaccounting/'><img src='/images/16/chart_curve.png' align='absmiddle'> MAC Accounting</a></span>";
echo "<span style='float: right;'><a href='" . generate_url(array('page'=>'device', 'device'=>$port['device_id'], 'tab'=>'port', 'port'=>$port['port_id'], 'view'=>'macaccounting')) . "'><img src='images/16/chart_curve.png' align='absmiddle'> MAC Accounting</a></span>";
}
echo '<br />';

View File

@@ -92,7 +92,7 @@ foreach (dbFetchRows('SELECT * FROM `devices` ORDER BY `hostname`') as $data) {
serial: '<?php echo mres($_POST['serial']); ?>'
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
});
</script>

View File

@@ -22,7 +22,7 @@ var grid = $("#poll-log").bootgrid({
id: "poll-log"
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
});
</script>

View File

@@ -30,7 +30,7 @@ $poll_tabs = array(
foreach ($poll_tabs as $tab) {
echo '
<li>
<a href="/pollers/tab='.lcfirst($tab['name']).'">
<a href="' . generate_url(array('page'=>'pollers','tab'=>lcfirst($tab['name']))) . '">
<img src="images/16/'.$tab['icon'].'.png" align="absmiddle" border="0"> '.$tab['name'].'
</a>
</li>';

View File

@@ -55,7 +55,7 @@ foreach ($menu_options as $option => $text) {
echo('<div style="float: right;">');
?>
<a href="/csv.php/report=<?php echo generate_url($vars,array('format'=>'')); ?>" title="Export as CSV" target="_blank">Export CSV</a> |
<a href="csv.php/report=<?php echo generate_url($vars,array('format'=>'')); ?>" title="Export as CSV" target="_blank">Export CSV</a> |
<a href="<?php echo(generate_url($vars)); ?>" title="Update the browser URL to reflect the search criteria." >Update URL</a> |
<?php

View File

@@ -78,7 +78,7 @@ else {
else {
$twofactor = dbFetchRow('SELECT twofactor FROM users WHERE username = ?', array($_SESSION['username']));
if (empty($twofactor['twofactor'])) {
echo '<div class="alert alert-danger">Error: How did you even get here?!</div><script>window.location = "/preferences/";</script>';
echo '<div class="alert alert-danger">Error: How did you even get here?!</div><script>window.location = "preferences/";</script>';
}
else {
$twofactor = json_decode($twofactor['twofactor'], true);
@@ -94,13 +94,13 @@ else {
}
else {
session_destroy();
echo '<div class="alert alert-danger">Error: Supplied TwoFactor Token is wrong, you\'ve been logged out.</div><script>window.location = "/";</script>';
echo '<div class="alert alert-danger">Error: Supplied TwoFactor Token is wrong, you\'ve been logged out.</div><script>window.location = "' . $config['base_url'] . '";</script>';
}
}//end if
}
else {
$twofactor = dbFetchRow('SELECT twofactor FROM users WHERE username = ?', array($_SESSION['username']));
echo '<script src="/js/jquery.qrcode.min.js"></script>';
echo '<script src="js/jquery.qrcode.min.js"></script>';
echo '<div class="well"><h3>Two-Factor Authentication</h3>';
if (!empty($twofactor['twofactor'])) {
$twofactor = json_decode($twofactor['twofactor'], true);
@@ -154,7 +154,7 @@ else {
echo '<div class="alert alert-danger">Error inserting TwoFactor details. Please try again later and contact Administrator if error persists.</div>';
}
else {
echo '<div class="alert alert-success">Added TwoFactor credentials. Please reload page.</div><script>window.location = "/preferences/";</script>';
echo '<div class="alert alert-success">Added TwoFactor credentials. Please reload page.</div><script>window.location = "preferences/";</script>';
}
}
else {

View File

@@ -91,7 +91,7 @@ echo '"'.$_POST['address'].'"+';
address: '<?php echo mres($_POST['address']); ?>'
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
});
</script>

View File

@@ -86,7 +86,7 @@ if ($_POST['interface'] == 'Vlan%') {
address: '<?php echo mres($_POST['address']); ?>'
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
});
</script>

View File

@@ -87,7 +87,7 @@ if ($_POST['interface'] == 'Vlan%') {
address: '<?php echo mres($_POST['address']); ?>'
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
});
</script>

View File

@@ -88,7 +88,7 @@ echo '"'.$_POST['address'].'"+';
address: '<?php echo mres($_POST['address']); ?>'
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
});
</script>

View File

@@ -158,7 +158,7 @@ foreach( $ordered as $name=>$entry ) {
if( sizeof($arch) > 0 && sizeof($vers) > 0 ) {
?>
<tr>
<td><a href="/packages/name=<?php echo $name; ?>/"><?php echo $name; ?></a></td>
<td><a href="<?php echo(generate_url(array('page'=>'packages','name'=>$name))); ?>"><?php echo $name; ?></a></td>
<td><?php echo implode('<br/>',$vers); ?></td>
<td><?php echo implode('<br/>',$arch); ?></td>
<td><?php echo implode('<br/>',$devs); ?></td>

View File

@@ -833,7 +833,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_value = $('#new_conf_value').val();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: {type: "config-item", config_group: "alerting", config_sub_group: "transports", config_name: config_name, config_value: config_value},
dataType: "json",
success: function(data){
@@ -869,7 +869,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_extra = $('#slack_extra').val();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: {type: "config-item", action: 'add-slack', config_group: "alerting", config_sub_group: "transports", config_extra: config_extra, config_value: config_value},
dataType: "json",
success: function(data){
@@ -907,7 +907,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_from = $('#new_from').val();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: {type: "config-item", action: 'add-hipchat', config_group: "alerting", config_sub_group: "transports", config_extra: config_extra, config_value: config_value, config_room_id: config_room_id, config_from: config_from},
dataType: "json",
success: function(data){
@@ -946,7 +946,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_userkey = $('#new_userkey').val();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: {type: "config-item", action: 'add-pushover', config_group: "alerting", config_sub_group: "transports", config_extra: config_extra, config_value: config_value, config_userkey: config_userkey},
dataType: "json",
success: function(data){
@@ -984,7 +984,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_extra = $('#boxcar_extra').val();
$.ajax({
type: "POST",
url: "/ajax_form.php",
url: "ajax_form.php",
data: {type: "config-item", action: 'add-boxcar', config_group: "alerting", config_sub_group: "transports", config_extra: config_extra, config_value: config_value},
dataType: "json",
success: function(data){
@@ -1018,7 +1018,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_id = $(this).data('config_id');
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "config-item", action: 'remove', config_id: config_id},
dataType: "json",
success: function (data) {
@@ -1039,7 +1039,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_id = $(this).data('config_id');
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "config-item", action: 'remove-slack', config_id: config_id},
dataType: "json",
success: function (data) {
@@ -1060,7 +1060,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_id = $(this).data('config_id');
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "config-item", action: 'remove-hipchat', config_id: config_id},
dataType: "json",
success: function (data) {
@@ -1081,7 +1081,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_id = $(this).data('config_id');
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "config-item", action: 'remove-pushover', config_id: config_id},
dataType: "json",
success: function (data) {
@@ -1102,7 +1102,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_id = $(this).data('config_id');
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "config-item", action: 'remove-boxcar', config_id: config_id},
dataType: "json",
success: function (data) {
@@ -1124,7 +1124,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_id = $(this).data("config_id");
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "update-config-item", config_id: config_id, config_value: state},
dataType: "json",
success: function (data) {
@@ -1145,7 +1145,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_value = $this.val();
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "update-config-item", config_id: config_id, config_value: config_value},
dataType: "json",
success: function (data) {
@@ -1177,7 +1177,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_value = $this.val();
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "update-config-item", config_id: config_id, config_value: config_value},
dataType: "json",
success: function (data) {
@@ -1210,7 +1210,7 @@ echo '<div id="boxcar_appkey_template" class="hide">
var config_type = $this.data("type");
$.ajax({
type: 'POST',
url: '/ajax_form.php',
url: 'ajax_form.php',
data: {type: "update-config-item", action: 'update-textarea', config_type: config_type, config_id: config_id, config_value: config_value},
dataType: "json",
success: function (data) {

View File

@@ -87,7 +87,7 @@ var grid = $("#syslog").bootgrid({
from: '<?php echo htmlspecialchars($vars['from']); ?>',
};
},
url: "/ajax_table.php"
url: "ajax_table.php"
});
$(function () {

View File

@@ -76,7 +76,7 @@ function print_error($text) {
print $console_color->convert("%r".$text."%n\n", false);
}
else {
echo('<div class="alert alert-danger"><img src="/images/16/exclamation.png" align="absmiddle"> '.$text.'</div>');
echo('<div class="alert alert-danger"><img src="images/16/exclamation.png" align="absmiddle"> '.$text.'</div>');
}
}
@@ -85,7 +85,7 @@ function print_message($text) {
print Console_Color2::convert("%g".$text."%n\n", false);
}
else {
echo('<div class="alert alert-success"><img src="/images/16/tick.png" align="absmiddle"> '.$text.'</div>');
echo('<div class="alert alert-success"><img src="images/16/tick.png" align="absmiddle"> '.$text.'</div>');
}
}