N°2060 [WIP] Initialisation of the portal application: Huge code cleanup

- Rename variables and methods in iTop files to match coding conventions
- Format code accordingly to coding conventions
- Add / update PHPDoc all over the place
- Suppress most of the warnings that did not have a big impact on code's logic
This commit is contained in:
Molkobain
2019-07-09 19:08:40 +02:00
parent c1258d0527
commit 9e9187b169
63 changed files with 3998 additions and 3088 deletions

View File

@@ -1,21 +1,24 @@
<?php
// Copyright (C) 2010-2017 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Copyright (C) 2013-2019 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*
*
*/
/**
* Backward Compatibility file for default portal.
@@ -37,15 +40,15 @@
);
// Load current environment
if (file_exists(__DIR__ . '/../../approot.inc.php'))
if (file_exists(__DIR__.'/../../approot.inc.php'))
{
require_once __DIR__ . '/../../approot.inc.php'; // When in env-xxxx folder
require_once __DIR__.'/../../approot.inc.php'; // When in env-xxxx folder
}
else
{
require_once __DIR__ . '/../../../approot.inc.php'; // When in datamodels/x.x folder
require_once __DIR__.'/../../../approot.inc.php'; // When in datamodels/x.x folder
}
require_once APPROOT . 'application/startup.inc.php';
require_once APPROOT.'application/startup.inc.php';
// Protection against setup in the following configuration : ITIL Ticket with Enhanced Portal selected but neither UserRequest or Incident. Which would crash the portal.
if (!class_exists('UserRequest') && !class_exists('Incident'))
@@ -58,4 +61,4 @@ $sDir = basename(__DIR__);
define('PORTAL_ID', $sDir);
// Load frontal
require_once MODULESROOT . 'itop-portal-base/index.php';
require_once MODULESROOT.'itop-portal-base/index.php';

View File

@@ -25,14 +25,14 @@ require_once APPROOT.'/lib/composer-vendor/autoload.php';
/**
* iTopPortalEditUrlMaker
*
*
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @author Bruno Da Silva <bruno.dasilva@combodo.com>
* @since 2.3.0
* @since 2.3.0
*/
class iTopPortalEditUrlMaker extends AbstractPortalUrlMaker
{
/** @var string PORTAL_ID */
/** @var string PORTAL_ID */
const PORTAL_ID = 'itop-portal';
}
@@ -41,7 +41,7 @@ class iTopPortalEditUrlMaker extends AbstractPortalUrlMaker
*
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @author Bruno Da Silva <bruno.dasilva@combodo.com>
* @since 2.3.0
* @since 2.3.0
*/
class iTopPortalViewUrlMaker extends iTopPortalEditUrlMaker
{
@@ -52,7 +52,7 @@ class iTopPortalViewUrlMaker extends iTopPortalEditUrlMaker
{
return static::PrepareObjectURL($sClass, $iId, 'view');
}
}
// Default portal hyperlink (for notifications) is the edit hyperlink

View File

@@ -1,5 +1,6 @@
<?php
/** @noinspection PhpUnhandledExceptionInspection */
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'itop-portal/2.7.0', array(