Skip to content

Commit 7370e80

Browse files
authored
Fix usage of INPUT_SERVER variables
fixes #342
1 parent 599dcbf commit 7370e80

31 files changed

+42
-44
lines changed

ajax/dropdownCredentials.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdownCredentials.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdownCredentials.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/dropdown_taskjob.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdown_taskjob.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdown_taskjob.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/dropdownactionlist.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdownactionlist.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdownactionlist.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/dropdownactionselection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdownactionselection.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdownactionselection.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/dropdownactiontype.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdownactiontype.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdownactiontype.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/dropdowndefinitionlist.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdowndefinitionlist.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdowndefinitionlist.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/dropdowndefinitionselection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdowndefinitionselection.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdowndefinitionselection.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/dropdowndefinitiontype.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdowndefinitiontype.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdowndefinitiontype.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/dropdowndefinitiontypelist.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdowndefinitiontypelist.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdowndefinitiontypelist.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/dropdownlist.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdownlist.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdownlist.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/dropdownlocation.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdownlocation.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdownlocation.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/dropdowntype.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdowntype.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdowntype.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/dropdowntypelist.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "dropdowntypelist.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "dropdowntypelist.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/jobstates_logs.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "jobstates_logs.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "jobstates_logs.php")) {
3535
include("../../../inc/includes.php");
3636
Session::checkCentralAccess();
3737
}

ajax/showtaskjoblogdetail.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "showtaskjoblogdetail.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "showtaskjoblogdetail.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/taskjob_form.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "taskjob_form.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "taskjob_form.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/taskjob_itemtypes.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "taskjob_itemtypes.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "taskjob_itemtypes.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/taskjob_logs.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (
35-
!isset($_SERVER['PHP_SELF'])
36-
|| strpos(filter_input(INPUT_SERVER, 'PHP_SELF'), "taskjob_logs.php")
37-
) {
34+
if (strpos($_SERVER['PHP_SELF'], "taskjob_logs.php")) {
3835
include("../../../inc/includes.php");
3936
Session::checkCentralAccess();
4037
}

ajax/taskjob_moduleitems.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "taskjob_moduleitems.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "taskjob_moduleitems.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/taskjob_moduletypes.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "taskjob_moduletypes.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "taskjob_moduletypes.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/taskjobaddtype.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "taskjobaddtype.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "taskjobaddtype.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/taskjobdeletetype.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "taskjobdeletetype.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "taskjobdeletetype.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

ajax/taskmethodupdate.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
if (strpos(filter_input(INPUT_SERVER, "PHP_SELF"), "taskmethodupdate.php")) {
34+
if (strpos($_SERVER['PHP_SELF'], "taskmethodupdate.php")) {
3535
include("../../../inc/includes.php");
3636
header("Content-Type: text/html; charset=UTF-8");
3737
Html::header_nocache();

hook.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,9 @@ function plugin_glpiinventory_install()
381381
{
382382
ini_set("max_execution_time", "0");
383383

384-
if (basename(filter_input(INPUT_SERVER, "SCRIPT_NAME")) != "cli_install.php") {
384+
if (basename($_SERVER['SCRIPT_NAME']) != "cli_install.php") {
385385
if (!isCommandLine()) {
386-
Html::header(__('Setup', 'glpiinventory'), filter_input(INPUT_SERVER, "PHP_SELF"), "config", "plugins");
386+
Html::header(__('Setup', 'glpiinventory'), $_SERVER['PHP_SELF'], "config", "plugins");
387387
}
388388
$migrationname = 'Migration';
389389
} else {

index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
} else {
4747
Html::header(
4848
__('GLPI Inventory', 'glpiinventory'),
49-
filter_input(INPUT_SERVER, "PHP_SELF"),
49+
$_SERVER['PHP_SELF'],
5050
"plugins",
5151
"glpiinventory"
5252
);

install/install.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ function pluginGlpiinventoryInstall($version, $migrationname = 'Migration')
304304
$agent_base_url = Entity::getUsedConfig('agent_base_url', 0, 'agent_base_url', '');
305305

306306
if (empty($agent_base_url)) {
307-
$full_url = filter_input(INPUT_SERVER, "PHP_SELF");
307+
$full_url = $_SERVER['PHP_SELF'] ?? null;
308308
$https = filter_input(INPUT_SERVER, "HTTPS");
309309
$http_host = filter_input(INPUT_SERVER, "HTTP_HOST");
310310

report/computer_last_inventory.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
include("../../../inc/includes.php");
3939

40-
Html::header(__('FusionInventory', 'glpiinventory'), $_SERVER['PHP_SELF'], "utils", "report");
40+
Html::header(__('GLPI Inventory', 'glpiinventory'), $_SERVER['PHP_SELF'], "utils", "report");
4141

4242
Session::checkRight('computer', READ);
4343

@@ -51,7 +51,7 @@
5151
$state = 0;
5252
}
5353

54-
echo "<form action='" . filter_input(INPUT_SERVER, "PHP_SELF") . "' method='get'>";
54+
echo "<form action='" . $_SERVER['PHP_SELF'] . "' method='get'>";
5555
echo "<table class='tab_cadre' cellpadding='5'>";
5656

5757
echo "<tr>";

report/not_queried_recently.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
include("../../../inc/includes.php");
4141

42-
Html::header(__('FusionInventory', 'glpiinventory'), filter_input(INPUT_SERVER, "PHP_SELF"), "utils", "report");
42+
Html::header(__('GLPI Inventory', 'glpiinventory'), $_SERVER['PHP_SELF'], "utils", "report");
4343

4444
Session::checkRight('plugin_glpiinventory_reportnetworkequipment', READ);
4545

@@ -49,7 +49,7 @@
4949
}
5050
$state = filter_input(INPUT_GET, "state");
5151

52-
echo "<form action='" . filter_input(INPUT_SERVER, "PHP_SELF") . "' method='get'>";
52+
echo "<form action='" . $_SERVER['PHP_SELF'] . "' method='get'>";
5353
echo "<table class='tab_cadre' cellpadding='5'>";
5454

5555
echo "<tr class='tab_bg_1' align='center'>";

report/ports_date_connections.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
include("../../../inc/includes.php");
3939

40-
Html::header(__('FusionInventory', 'glpiinventory'), filter_input(INPUT_SERVER, "PHP_SELF"), "utils", "report");
40+
Html::header(__('GLPI Inventory', 'glpiinventory'), $_SERVER['PHP_SELF'], "utils", "report");
4141

4242
Session::checkRight('plugin_glpiinventory_reportnetworkequipment', READ);
4343

report/switch_ports.history.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
define('GLPI_ROOT', '../../..');
3939
include(GLPI_ROOT . "/inc/includes.php");
4040

41-
Html::header(__('FusionInventory', 'glpiinventory'), filter_input(INPUT_SERVER, "PHP_SELF"), "utils", "report");
41+
Html::header(__('GLPI Inventory', 'glpiinventory'), $_SERVER['PHP_SELF'], "utils", "report");
4242

4343
Session::checkRight('plugin_glpiinventory_reportnetworkequipment', READ);
4444

4545
$FK_port = filter_input(INPUT_GET, "networkports_id");
4646

47-
echo "<form action='" . filter_input(INPUT_SERVER, "PHP_SELF") . "' method='get'>";
47+
echo "<form action='" . $_SERVER['PHP_SELF'] . "' method='get'>";
4848
echo "<table class='tab_cadre' cellpadding='5'>";
4949
echo "<tr class='tab_bg_1' align='center'>";
5050

setup.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ function plugin_glpiinventory_script_endswith($scriptname)
6969
{
7070
//append plugin directory to avoid dumb errors...
7171
$scriptname = 'glpiinventory/front/' . $scriptname;
72-
$script_name = filter_input(INPUT_SERVER, "SCRIPT_NAME");
72+
$script_name = $_SERVER['SCRIPT_NAME'];
73+
7374
return substr($script_name, -strlen($scriptname)) === $scriptname;
7475
}
7576

@@ -234,9 +235,9 @@ function plugin_init_glpiinventory()
234235
$PLUGIN_HOOKS['add_javascript']['glpiinventory'] = [];
235236
$PLUGIN_HOOKS['add_css']['glpiinventory'] = [];
236237
if (
237-
strpos(filter_input(INPUT_SERVER, "SCRIPT_NAME"), Plugin::getWebDir('glpiinventory', false)) != false
238-
|| strpos(filter_input(INPUT_SERVER, "SCRIPT_NAME"), "front/printer.form.php") != false
239-
|| strpos(filter_input(INPUT_SERVER, "SCRIPT_NAME"), "front/computer.form.php") != false
238+
strpos($_SERVER['SCRIPT_NAME'], Plugin::getWebDir('glpiinventory', false)) != false
239+
|| strpos($_SERVER['SCRIPT_NAME'], "front/printer.form.php") != false
240+
|| strpos($_SERVER['SCRIPT_NAME'], "front/computer.form.php") != false
240241
) {
241242
$PLUGIN_HOOKS['add_css']['glpiinventory'][] = "css/views.css";
242243
$PLUGIN_HOOKS['add_css']['glpiinventory'][] = "css/deploy.css";
@@ -324,7 +325,7 @@ function plugin_init_glpiinventory()
324325
}
325326

326327
// load task view css for computer self deploy (tech)
327-
if (strpos(filter_input(INPUT_SERVER, "SCRIPT_NAME"), "front/computer.form.php") != false) {
328+
if (strpos($_SERVER['SCRIPT_NAME'], "front/computer.form.php") != false) {
328329
$PLUGIN_HOOKS['add_css']['glpiinventory'][] = "css/views.css";
329330
}
330331

@@ -359,8 +360,8 @@ function plugin_init_glpiinventory()
359360

360361
// Load nvd3 for printerpage counter graph
361362
if (
362-
strstr(filter_input(INPUT_SERVER, "PHP_SELF"), '/front/printer.form.php')
363-
|| strstr(filter_input(INPUT_SERVER, "PHP_SELF"), 'glpiinventory/front/menu.php')
363+
strstr($_SERVER['SCRIPT_NAME'], '/front/printer.form.php')
364+
|| strstr($_SERVER['SCRIPT_NAME'], 'glpiinventory/front/menu.php')
364365
) {
365366
// Add graph javascript
366367
$PLUGIN_HOOKS['add_javascript']['glpiinventory'] = array_merge(

0 commit comments

Comments
 (0)