mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
More url helper fixes (#10241)
* More url helpers graph links ajax search * Fix for non-Laravel pages using the url helper * fix widget settings
This commit is contained in:
@@ -59,7 +59,8 @@ class Laravel
|
||||
$kernel = $app->make(\Illuminate\Contracts\Http\Kernel::class);
|
||||
|
||||
$request = \Illuminate\Http\Request::capture();
|
||||
$request->server->set('REQUEST_URI', '/blank'); // load an empty page since it will be discarded
|
||||
// strip .php to make the url helper in non-laravel pages
|
||||
$request->server->set('REQUEST_URI', str_replace('.php', '', $_SERVER['REQUEST_URI']));
|
||||
$response = $kernel->handle($request);
|
||||
|
||||
// $response->send(); // don't send response, legacy code will
|
||||
|
@@ -201,7 +201,7 @@ class Url
|
||||
$args['bg'] = 'FFFFFF00';
|
||||
}
|
||||
|
||||
return "<img src='graph.php?type=" . $args['graph_type'] . '&id=' . $args['port_id'] . '&from=' . $args['from'] . '&to=' . $args['to'] . '&width=' . $args['width'] . '&height=' . $args['height'] . '&bg=' . $args['bg'] . "'>";
|
||||
return '<img src="' . url('graph.php') . '?type=' . $args['graph_type'] . '&id=' . $args['port_id'] . '&from=' . $args['from'] . '&to=' . $args['to'] . '&width=' . $args['width'] . '&height=' . $args['height'] . '&bg=' . $args['bg'] . '">';
|
||||
}
|
||||
|
||||
public static function generate($vars, $new_vars = [])
|
||||
@@ -231,7 +231,7 @@ class Url
|
||||
$urlargs[] = $key . '=' . urlencode($arg);
|
||||
}
|
||||
|
||||
return '<img src="graph.php?' . implode('&', $urlargs) . '" style="border:0;" />';
|
||||
return '<img src="' . url('graph.php') . '?' . implode('&', $urlargs) . '" style="border:0;" />';
|
||||
}
|
||||
|
||||
public static function lazyGraphTag($args)
|
||||
@@ -244,10 +244,10 @@ class Url
|
||||
|
||||
|
||||
if (Config::get('enable_lazy_load', true)) {
|
||||
return '<img class="lazy img-responsive" data-original="graph.php?' . implode('&', $urlargs) . '" style="border:0;" />';
|
||||
return '<img class="lazy img-responsive" data-original="' . url('graph.php') . '?' . implode('&', $urlargs) . '" style="border:0;" />';
|
||||
}
|
||||
|
||||
return '<img class="img-responsive" src="graph.php?' . implode('&', $urlargs) . '" style="border:0;" />';
|
||||
return '<img class="img-responsive" src="' . url('graph.php') . '?' . implode('&', $urlargs) . '" style="border:0;" />';
|
||||
}
|
||||
|
||||
public static function overlibLink($url, $text, $contents, $class = null)
|
||||
@@ -306,7 +306,7 @@ class Url
|
||||
public static function minigraphImage($device, $start, $end, $type, $legend = 'no', $width = 275, $height = 100, $sep = '&', $class = 'minigraph-image', $absolute_size = 0)
|
||||
{
|
||||
$vars = ['device=' . $device->device_id, "from=$start", "to=$end", "width=$width", "height=$height", "type=$type", "legend=$legend", "absolute=$absolute_size"];
|
||||
return '<img class="' . $class . '" width="' . $width . '" height="' . $height . '" src="graph.php?' . implode($sep, $vars) . '">';
|
||||
return '<img class="' . $class . '" width="' . $width . '" height="' . $height . '" src="' . url('graph.php') . '?' . implode($sep, $vars) . '">';
|
||||
}
|
||||
|
||||
private static function getOverviewGraphsForDevice($device)
|
||||
|
@@ -377,7 +377,7 @@ function getLogo($device)
|
||||
*/
|
||||
function getLogoTag($device, $class = null)
|
||||
{
|
||||
$tag = '<img src="' . getLogo($device) . '" title="' . getImageTitle($device) . '"';
|
||||
$tag = '<img src="' . url(getLogo($device)) . '" title="' . getImageTitle($device) . '"';
|
||||
if (isset($class)) {
|
||||
$tag .= " class=\"$class\" ";
|
||||
}
|
||||
|
@@ -611,7 +611,7 @@ if (empty($vars['bare']) || $vars['bare'] == "no") {
|
||||
if( widget_id > 0 && widget_settings != {} ) {
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: '<?php echo url('/ajax/form/widget-settings/'); ?>' + widget_id,
|
||||
url: '<?php echo url('/ajax/form/widget-settings/'); ?>/' + widget_id,
|
||||
data: {settings: widget_settings},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
|
@@ -410,7 +410,7 @@
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
remote: {
|
||||
url: "ajax_search.php?search=%QUERY&type=device",
|
||||
url: ajax_url + "_search.php?search=%QUERY&type=device",
|
||||
filter: function (devices) {
|
||||
return $.map(devices, function (device) {
|
||||
return {
|
||||
@@ -433,7 +433,7 @@
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
remote: {
|
||||
url: "ajax_search.php?search=%QUERY&type=ports",
|
||||
url: ajax_url + "_search.php?search=%QUERY&type=ports",
|
||||
filter: function (ports) {
|
||||
return $.map(ports, function (port) {
|
||||
return {
|
||||
@@ -453,7 +453,7 @@
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
remote: {
|
||||
url: "ajax_search.php?search=%QUERY&type=bgp",
|
||||
url: ajax_url + "_search.php?search=%QUERY&type=bgp",
|
||||
filter: function (bgp_sessions) {
|
||||
return $.map(bgp_sessions, function (bgp) {
|
||||
return {
|
||||
|
Reference in New Issue
Block a user