Changed GET to POST in web2image

This commit is contained in:
fbsanchez 2018-06-19 19:07:36 +02:00
parent 4214577eea
commit b625f2e5c8
2 changed files with 25 additions and 27 deletions

View File

@ -13,9 +13,9 @@
// GNU General Public License for more details.
// Global & session manageme
session_id($_GET["session_id"]);
session_id($_REQUEST["session_id"]);
if (file_exists(session_save_path() . "/pansess_" . session_id())) {
$user = file_get_contents(session_save_path() . "/pansess_" . session_id());
$user = file_request_contents(session_save_path() . "/pansess_" . session_id());
}
session_start();
if (isset($user)) {
@ -39,12 +39,12 @@ check_login();
global $config;
$params = json_decode($_GET['data'], true);
$params = json_decode($_REQUEST['data'], true);
// Metaconsole connection to the node
$server_id = $params['server_id'];
if ($config["metaconsole"] && !empty($server_id)) {
$server = metaconsole_get_connection_by_id($server_id);
$server = metaconsole_request_connection_by_id($server_id);
// Error connecting
if (metaconsole_connect($server) !== NOERR) {
echo "<html>";
@ -68,7 +68,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pandora FMS Graph (<?php echo agents_get_alias($agent_id) . ' - ' . $interface_name; ?>)</title>
<title>Pandora FMS Graph (<?php echo agents_request_alias($agent_id) . ' - ' . $interface_name; ?>)</title>
<link rel="stylesheet" href="styles/pandora.css" type="text/css" />
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
<link rel="stylesheet" href="styles/jquery-ui-1.10.0.custom.css" type="text/css" />
@ -95,13 +95,13 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
<?php
$params['only_image'] = false;
$params['only_image'] = false;
$params['width'] = '1048';
$params['menu'] = false;
$params_combined = json_decode($_GET['data_combined'], true);
$module_list = json_decode($_GET['data_module_list'], true);
$type_graph_pdf = $_GET['type_graph_pdf'];
$params_combined = json_decode($_REQUEST['data_combined'], true);
$module_list = json_decode($_REQUEST['data_module_list'], true);
$type_graph_pdf = $_REQUEST['type_graph_pdf'];
if($type_graph_pdf == 'combined'){
echo '<div>';

View File

@ -4,7 +4,7 @@ if (system.args.length < 3 || system.args.length > 11) {
phantom.exit(1);
}
var webPage = require('webpage');
var webPage = require('webpage');
var page = webPage.create();
var url = system.args[1];
var type_graph_pdf = system.args[2];
@ -12,39 +12,37 @@ var url_params = system.args[3];
var url_params_comb = system.args[4];
var url_module_list = system.args[5];
var output_filename = system.args[6];
var _width = system.args[7];
var _height = system.args[8];
var viewport_width = system.args[7];
var viewport_height = system.args[8];
var session_id = system.args[9];
var base_64 = system.args[10];
if (!_width) {
_width = 750;
if (!viewport_width) {
viewport_width = 750;
}
if (!_height) {
_height = 350;
if (!viewport_height) {
viewport_height = 350;
}
if(type_graph_pdf == 'combined'){
finish_url = url + "?" + "data=" + url_params +
"&data_combined=" + url_params_comb +
"&data_module_list=" + url_module_list +
"&type_graph_pdf=" + type_graph_pdf +
"&session_id=" + session_id;
post_data = "data=" + url_params +
"&data_combined=" + url_params_comb +
"&data_module_list=" + url_module_list +
"&type_graph_pdf=" + type_graph_pdf +
"&session_id=" + session_id;
}
else{
finish_url = url + "?" + "data=" + url_params +
"&type_graph_pdf=" + type_graph_pdf +
"&session_id=" + session_id;
post_data = "data=" + url_params +
"&type_graph_pdf=" + type_graph_pdf +
"&session_id=" + session_id;
}
page.viewportSize = { width: _width, height: _height };
//page.zoomFactor = 1.75;
page.open(finish_url, function start(status) {
});
page.open(post_data, 'POST', post_data, function start(status) {});
page.onLoadFinished = function (status) {
if(!base_64){