Skip to content

Commit d9acbd0

Browse files
cedric-annetrasher
authored andcommitted
Remove specific AJAX handling based on manual declarations
1 parent 2a84937 commit d9acbd0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+30
-246
lines changed

.phpstan-baseline.php

-6
Original file line numberDiff line numberDiff line change
@@ -2305,12 +2305,6 @@
23052305
'count' => 2,
23062306
'path' => __DIR__ . '/src/Glpi/Controller/ApiController.php',
23072307
];
2308-
$ignoreErrors[] = [
2309-
'message' => '#^Method Glpi\\\\Controller\\\\LegacyFileLoadController\\:\\:getRequest\\(\\) never returns null so it can be removed from the return type\\.$#',
2310-
'identifier' => 'return.unusedType',
2311-
'count' => 1,
2312-
'path' => __DIR__ . '/src/Glpi/Controller/LegacyFileLoadController.php',
2313-
];
23142308
$ignoreErrors[] = [
23152309
'message' => '#^Expression on left side of \\?\\? is not nullable\\.$#',
23162310
'identifier' => 'nullCoalesce.expr',

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ The present file will list all changes made to the project; according to the
233233
- Usage of the `/marketplace` path for plugins URLs. All plugins URLs should now start with `/plugins`.
234234
- Usage of `GLPI_PLUGINS_PATH` javascript variable.
235235
- Usage of `MAIL_SMTPSSL` and `MAIL_SMTPTLS` constants.
236-
- `$AJAX_INCLUDE` global variable usage. Use `$this->setAjax()` in legacy `/ajax/` and `/front` scripts or `Html::setAjax()` and `Session::setAjax()`.
237236
- Usage of `name` and `users_id_validate` parameter in `ajax/dropdownValidator.php`.
238237
- Usage of `users_id_validate` parameter in `front/commonitilvalidation.form.php`.
239238
- `front/ticket_ticket.form.php` script usage.
@@ -307,6 +306,7 @@ The present file will list all changes made to the project; according to the
307306
- `GLPI_DEMO_MODE` constant.
308307
- `GLPI_DUMP_DIR` constant.
309308
- `GLPI_SQL_DEBUG` constant.
309+
- `$AJAX_INCLUDE` global variable.
310310
- `$CFG_GLPI_PLUGINS` global variable.
311311
- `$DBCONNECTION_REQUIRED` and `$USEDBREPLICATE` global variables. Use `DBConnection::getReadConnection()` to get the most apporpriate connection for read only operations.
312312
- `$dont_check_maintenance_mode` and `$skip_db_check` global variables.

ajax/2fa.php

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
* ---------------------------------------------------------------------
3434
*/
3535

36-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
37-
$this->setAjax();
38-
3936
if (isset($_POST['regenerate_backup_codes'])) {
4037
$totp = new \Glpi\Security\TOTPManager();
4138
$codes = $totp->regenerateBackupCodes(Session::getLoginUserID());

ajax/actorinformation.php

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
* ---------------------------------------------------------------------
3434
*/
3535

36-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
37-
$this->setAjax();
3836
header("Content-Type: text/html; charset=UTF-8");
3937
Html::header_nocache();
4038

ajax/actors.php

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
* ---------------------------------------------------------------------
3434
*/
3535

36-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
37-
$this->setAjax();
38-
3936
switch ($_REQUEST['action']) {
4037
case "getActors":
4138
header("Content-Type: application/json; charset=UTF-8");

ajax/agent.php

-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
use Glpi\Exception\Http\AccessDeniedHttpException;
3737
use Glpi\Exception\Http\NotFoundHttpException;
3838

39-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
40-
$this->setAjax();
41-
4239
header("Content-Type: application/json; charset=UTF-8");
4340
Html::header_nocache();
4441

ajax/asset/assetdefinition.php

-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
use Glpi\Exception\Http\BadRequestHttpException;
3838
use Glpi\Exception\Http\NotFoundHttpException;
3939

40-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
41-
$this->setAjax();
42-
4340
Session::checkRight(AssetDefinition::$rightname, READ);
4441
Session::writeClose();
4542

ajax/asset/customfield.php

-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
use Glpi\Asset\CustomFieldDefinition;
3636
use Glpi\Exception\Http\BadRequestHttpException;
3737

38-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
39-
$this->setAjax();
40-
4138
Session::checkRight(CustomFieldDefinition::$rightname, READ);
4239

4340
if (isset($_POST['action'])) {

ajax/central.php

-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535

3636
use Glpi\Exception\Http\BadRequestHttpException;
3737

38-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
39-
40-
$this->setAjax();
41-
4238
// Send UTF8 Headers
4339
header("Content-Type: text/html; charset=UTF-8");
4440
Html::header_nocache();

ajax/comments.php

-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
*/
3939
global $CFG_GLPI;
4040

41-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
42-
$this->setAjax();
43-
4441
// Send UTF8 Headers
4542
header("Content-Type: text/html; charset=UTF-8");
4643
Html::header_nocache();

ajax/common.tabs.php

-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
*/
3939
global $CFG_GLPI;
4040

41-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
42-
$this->setAjax();
43-
4441
header("Content-Type: text/html; charset=UTF-8");
4542
Html::header_nocache();
4643

ajax/commonitilsatisfaction.php

-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
use Glpi\Application\View\TemplateRenderer;
3737
use Glpi\Exception\Http\AccessDeniedHttpException;
3838

39-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
40-
$this->setAjax();
41-
4239
header("Content-Type: text/html; charset=UTF-8");
4340
Html::header_nocache();
4441

ajax/displayMessageAfterRedirect.php

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
* ---------------------------------------------------------------------
3434
*/
3535

36-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
37-
$this->setAjax();
38-
3936
Html::header_nocache();
4037

4138
if (isset($_GET['get_raw']) && filter_var(($_GET['display_container'] ?? true), FILTER_VALIDATE_BOOLEAN)) {

ajax/dropdownConnectNetworkPort.php

-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@
4444
*/
4545
global $DB;
4646

47-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
48-
$this->setAjax();
49-
5047
header("Content-Type: text/html; charset=UTF-8");
5148
Html::header_nocache();
5249

ajax/dropdownInstallVersion.php

-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
*/
3939
global $DB;
4040

41-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
42-
$this->setAjax();
43-
4441
header("Content-Type: text/html; charset=UTF-8");
4542
Html::header_nocache();
4643

ajax/dropdownMassiveActionAddActor.php

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
* ---------------------------------------------------------------------
3434
*/
3535

36-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
37-
$this->setAjax();
38-
3936
header("Content-Type: text/html; charset=UTF-8");
4037
Html::header_nocache();
4138

ajax/dropdownMassiveActionAddValidator.php

-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
*/
4343
global $CFG_GLPI;
4444

45-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
46-
$this->setAjax();
47-
4845
header("Content-Type: text/html; charset=UTF-8");
4946
Html::header_nocache();
5047

ajax/dropdownMassiveActionAuthMethods.php

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
* ---------------------------------------------------------------------
3434
*/
3535

36-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
37-
$this->setAjax();
38-
3936
header("Content-Type: text/html; charset=UTF-8");
4037
Html::header_nocache();
4138

ajax/dropdownRubDocument.php

-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
*/
3939
global $DB;
4040

41-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
42-
$this->setAjax();
43-
4441
header("Content-Type: text/html; charset=UTF-8");
4542
Html::header_nocache();
4643

ajax/dropdownSoftwareLicense.php

-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
*/
3939
global $DB;
4040

41-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
42-
$this->setAjax();
43-
4441
header("Content-Type: text/html; charset=UTF-8");
4542
Html::header_nocache();
4643

ajax/dropdownValidator.php

-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
*/
4343
global $CFG_GLPI;
4444

45-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
46-
$this->setAjax();
47-
4845
header("Content-Type: text/html; charset=UTF-8");
4946
Html::header_nocache();
5047

ajax/entitytreesons.php

-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@
3939
*/
4040
global $CFG_GLPI, $GLPI_CACHE;
4141

42-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
43-
$this->setAjax();
44-
4542
header("Content-Type: application/json; charset=UTF-8");
4643
Html::header_nocache();
4744

ajax/fuzzysearch.php

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
* ---------------------------------------------------------------------
3434
*/
3535

36-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
37-
$this->setAjax();
38-
3936
header("Content-Type: application/json; charset=UTF-8");
4037
Html::header_nocache();
4138

ajax/genericdate.php

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
* ---------------------------------------------------------------------
3434
*/
3535

36-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
37-
$this->setAjax();
38-
3936
// Send UTF8 Headers
4037
header("Content-Type: text/html; charset=UTF-8");
4138
Html::header_nocache();

ajax/getDropdownUsers.php

-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
* @since 0.85
3838
*/
3939

40-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
41-
$this->setAjax();
42-
4340
header("Content-Type: application/json; charset=UTF-8");
4441
Html::header_nocache();
4542

ajax/getFileTag.php

-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
* @since 0.85
3838
*/
3939

40-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
41-
$this->setAjax();
42-
4340
header('Content-type: application/json; charset=UTF-8');
4441
Html::header_nocache();
4542

ajax/getUserPicture.php

-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535

3636
use Glpi\Exception\Http\BadRequestHttpException;
3737

38-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
39-
$this->setAjax();
40-
4138
header("Content-Type: application/json; charset=UTF-8");
4239
Html::header_nocache();
4340

ajax/impact.php

-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
const DELTA_ACTION_UPDATE = 2;
4242
const DELTA_ACTION_DELETE = 3;
4343

44-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
45-
$this->setAjax();
46-
4744
/**
4845
* @var array $CFG_GLPI
4946
*/

ajax/itilfollowup.php

-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@
3939

4040
use Glpi\Exception\Http\BadRequestHttpException;
4141

42-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
43-
$this->setAjax();
44-
4542
header("Content-Type: application/json; charset=UTF-8");
4643
Html::header_nocache();
4744

ajax/itilvalidation.php

-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@
3939

4040
use Glpi\Exception\Http\BadRequestHttpException;
4141

42-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
43-
$this->setAjax();
44-
4542
header("Content-Type: application/json; charset=UTF-8");
4643
Html::header_nocache();
4744

ajax/kanban.php

-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
use Glpi\Features\Kanban;
4141
use Glpi\Features\Teamwork;
4242

43-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
44-
$this->setAjax();
45-
4643
header("Content-Type: text/html; charset=UTF-8");
4744
Html::header_nocache();
4845

ajax/mailcollector.php

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
* ---------------------------------------------------------------------
3434
*/
3535

36-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
37-
$this->setAjax();
38-
3936
// Send UTF8 Headers
4037
header("Content-Type: text/html; charset=UTF-8");
4138
Html::header_nocache();

ajax/notificationmailingsettings.php

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
* ---------------------------------------------------------------------
3434
*/
3535

36-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
37-
$this->setAjax();
38-
3936
Session::checkRight("config", UPDATE);
4037

4138
if (isset($_POST["test_smtp_send"])) {

ajax/planningend.php

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
* ---------------------------------------------------------------------
3434
*/
3535

36-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
37-
$this->setAjax();
38-
3936
// Send UTF8 Headers
4037
header("Content-Type: text/html; charset=UTF-8");
4138
Html::header_nocache();

ajax/projecttask.php

-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
* @since 9.2
3838
*/
3939

40-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
41-
$this->setAjax();
42-
4340
header("Content-Type: application/json; charset=UTF-8");
4441
Html::header_nocache();
4542

ajax/rack.php

-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@
3636
use Glpi\Exception\Http\AccessDeniedHttpException;
3737
use Glpi\Exception\Http\BadRequestHttpException;
3838

39-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
40-
41-
$this->setAjax();
42-
4339
header("Content-Type: text/html; charset=UTF-8");
4440
Html::header_nocache();
4541

ajax/resaperiod.php

-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
* @since 0.84
3838
*/
3939

40-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
41-
$this->setAjax();
42-
4340
// Send UTF8 Headers
4441
header("Content-Type: text/html; charset=UTF-8");
4542
Html::header_nocache();

ajax/rule.php

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
* ---------------------------------------------------------------------
3434
*/
3535

36-
/** @var \Glpi\Controller\LegacyFileLoadController $this */
37-
$this->setAjax();
38-
3936
switch ($_REQUEST['action']) {
4037
case "move_rule":
4138
$rule_collection = getItemForItemtype($_POST['collection_classname']);

0 commit comments

Comments
 (0)