diff --git a/config/web_portal/menu.xml b/config/web_portal/menu.xml
index ee39eb7f8..65e19927b 100644
--- a/config/web_portal/menu.xml
+++ b/config/web_portal/menu.xml
@@ -1,171 +1,163 @@
-
-
- all
- Browse
-
-
-
- all
- My Resources
- index.php?Page_Type=My_Sites
-
-
-
- all
- Projects
- index.php?Page_Type=Projects
-
-
-
- all
- NGIs
- index.php?Page_Type=NGIs
-
-
-
- all
- Sites
- index.php?Page_Type=Sites
-
-
-
- all
- Service Groups
- index.php?Page_Type=Service_Groups
-
-
-
- all
- Services
- index.php?Page_Type=Services
-
-
-
- all
- Service Types
- index.php?Page_Type=Service_Types
-
-
-
- all
- Scopes
- index.php?Page_Type=Scopes
-
-
-
- all
- Role Action Map
- index.php?Page_Type=View_Role_Action_Mappings
-
-
-
- Add
- write_enabled
-
-
-
- write_enabled
- Add Site
- index.php?Page_Type=Add_Site
-
-
-
- write_enabled
- Add Service Group
- index.php?Page_Type=Add_Service_Group
-
-
-
- write_enabled
- Add Service
- index.php?Page_Type=Add_Service
-
-
-
- write_enabled
- Add Downtime
- index.php?Page_Type=Add_Downtime
-
-
-
- Downtimes
- all
-
-
-
-
-
-
- all
- Active & Imminent
- index.php?Page_Type=Downtimes_Overview
-
-
-
- all
- Downtime Calendar
- index.php?Page_Type=Downtimes_Calendar
-
-
-
- About GOCDB5
- all
-
-
-
-
-
- all
- Doc, Help & Support
- index.php?Page_Type=Static_HTML&Page=Help_And_Contact
-
-
-
- GOCDB Admin
- admin
-
-
-
- admin
- Add NGI
- index.php?Page_Type=Admin_Add_NGI
-
-
-
- admin
- Add Project
- index.php?Page_Type=Admin_Add_Project
-
-
-
- admin
- Add Service Type
- index.php?Page_Type=Admin_Add_Service_Type
-
-
-
- admin
- Move Service
- index.php?Page_Type=Admin_Move_SEP
-
-
-
- admin
- Move Site
- index.php?Page_Type=Admin_Move_Site
-
-
-
- admin
- Users
- index.php?Page_Type=Admin_Users
-
-
+
+
+ all
+ Browse
+
+
+
+ all
+ My Resources
+ index.php?Page_Type=My_Sites
+
+
+
+ all
+ Projects
+ index.php?Page_Type=Projects
+
+
+
+ all
+ NGIs
+ index.php?Page_Type=NGIs
+
+
+
+ all
+ Sites
+ index.php?Page_Type=Sites
+
+
+
+ all
+ Service Groups
+ index.php?Page_Type=Service_Groups
+
+
+
+ all
+ Services
+ index.php?Page_Type=Services
+
+
+
+ all
+ Service Types
+ index.php?Page_Type=Service_Types
+
+
+
+ all
+ Scopes
+ index.php?Page_Type=Scopes
+
+
+
+ all
+ Role Action Map
+ index.php?Page_Type=View_Role_Action_Mappings
+
+
+
+ Add
+ write_enabled
+
+
+
+ write_enabled
+ Add Site
+ index.php?Page_Type=Add_Site
+
+
+
+ write_enabled
+ Add Service Group
+ index.php?Page_Type=Add_Service_Group
+
+
+
+ write_enabled
+ Add Service
+ index.php?Page_Type=Add_Service
+
+
+
+ write_enabled
+ Add Downtime
+ index.php?Page_Type=Add_Downtime
+
+
+
+ Downtimes
+ all
+
+
+
+ all
+ Active & Imminent
+ index.php?Page_Type=Downtimes_Overview
+
+
+
+ all
+ Downtime Calendar
+ index.php?Page_Type=Downtimes_Calendar
+
+
+
+ About GOCDB5
+ all
+
+
+
+ all
+ Doc, Help & Support
+
+ index.php?Page_Type=Static_HTML&Page=Help_And_Contact
+
+
+
+
+ GOCDB Admin
+ admin
+
+
+
+ admin
+ Add NGI
+ index.php?Page_Type=Admin_Add_NGI
+
+
+
+ admin
+ Add Project
+ index.php?Page_Type=Admin_Add_Project
+
+
+
+ admin
+ Add Service Type
+ index.php?Page_Type=Admin_Add_Service_Type
+
+
+
+ admin
+ Move Service
+ index.php?Page_Type=Admin_Move_SEP
+
+
+
+ admin
+ Move Site
+ index.php?Page_Type=Admin_Move_Site
+
+
+
+ admin
+ Users
+ index.php?Page_Type=Admin_Users
+
diff --git a/htdocs/web_portal/controllers/service_type/view_service_type.php b/htdocs/web_portal/controllers/service_type/view_service_type.php
index 77da4bf6b..6f7e4694e 100644
--- a/htdocs/web_portal/controllers/service_type/view_service_type.php
+++ b/htdocs/web_portal/controllers/service_type/view_service_type.php
@@ -4,7 +4,8 @@
*======================================================
* File: view_service_type.php
* Author: George Ryall, David Meredith
- * Description: Controller for displaying a service type and associated services
+ * Description: Controller for displaying a service type
+ * and associated services
*
* License information
*
@@ -20,12 +21,14 @@
* limitations under the License.
/*======================================================*/
require_once __DIR__ . '/../utils.php';
-require_once __DIR__ . '/../../../web_portal/components/Get_User_Principle.php';
+require_once __DIR__
+ . '/../../../web_portal/components/Get_User_Principle.php';
+
+use Exception;
function view_service_type()
{
$params = [];
-
$identifier = Get_User_Principle();
$user = \Factory::getUserService()->getUserByPrinciple($identifier);
@@ -45,7 +48,8 @@ function view_service_type()
$params['Name'] = $serviceType->getName();
$params['Description'] = $serviceType->getDescription();
$params['ID'] = $serviceType->getId();
- $params['AllowMonitoringException'] = $serviceType->getAllowMonitoringException();
+ $params['AllowMonitoringException'] = $serviceType
+ ->getAllowMonitoringException();
$params['Services'] = $serv->getServices($params['ID']);
show_view("service_type/view_service_type.php", $params, $params['Name']);
diff --git a/htdocs/web_portal/controllers/service_type/view_service_types.php b/htdocs/web_portal/controllers/service_type/view_service_types.php
index 6f8370fed..7040b738b 100644
--- a/htdocs/web_portal/controllers/service_type/view_service_types.php
+++ b/htdocs/web_portal/controllers/service_type/view_service_types.php
@@ -1,4 +1,5 @@
getServiceTypes();
- $params['ServiceTypes']= $serviceTypes;
+ $params['ServiceTypes'] = $serviceTypes;
show_view('service_type/view_service_types.php', $params, 'Service Types');
}
diff --git a/htdocs/web_portal/controllers/utils.php b/htdocs/web_portal/controllers/utils.php
index a65b7838f..99e3c2869 100644
--- a/htdocs/web_portal/controllers/utils.php
+++ b/htdocs/web_portal/controllers/utils.php
@@ -2,24 +2,32 @@
require_once __DIR__ . '/../../../lib/Gocdb_Services/Factory.php';
+use Exception;
+
/**
* Parse properties file
*
* @param string $txtProperties String containing the contents of a .properties
+ *
* @return array $results Associative array of key value pairs
*/
function parse_properties($txtProperties)
{
- $value = '';
- $result = array();
+ $value = '';
+ $result = array();
+
+ $lines = explode("\n", $txtProperties);
+ $key = "";
- $lines = explode("\n", $txtProperties);
- $key = "";
+ $isWaitingOtherLine = false;
- $isWaitingOtherLine = false;
foreach ($lines as $i => $line) {
$trimedLine = trim($line);
- if (empty($trimedLine) || (!$isWaitingOtherLine && strpos($line, "#") === 0)) {
+
+ if (
+ empty($trimedLine)
+ || (!$isWaitingOtherLine && strpos($line, "#") === 0)
+ ) {
continue;
}
@@ -40,21 +48,27 @@ function parse_properties($txtProperties)
if ($key == null) {
$line = $i + 1;
- throw new \Exception("Property name on line {$line} is null");
+
+ throw new Exception("Property name on line {$line} is null");
}
if ($value == null) {
$line = $i + 1;
- throw new \Exception("Property value on line {$line} is null");
+
+ throw new Exception("Property value on line {$line} is null");
}
- //we can't use the prop key as the key due to key duplicates [PREVIOUSLY] being allowed
- //we are using an indexed array of indexed arrays TODO: use prop key as array key
+ /**
+ * we can't use the prop key as the key due to key duplicates
+ * [PREVIOUSLY] being allowed
+ */
+ // we are using an indexed array of indexed arrays
+ // TODO: use prop key as array key
$result[] = array($key, $value);
unset($lines[$i]);
}
- return $result;
+ return $result;
}
@@ -89,12 +103,18 @@ function parse_properties($txtProperties)
* "disableReserved":true
* }
*
- * @param \IScopedEntity $targetScopedEntity Optional, use Null if creating a new IScopedEntity
- * @param \IScopedEntity $parentScopedEntity Optional, the parent to inherit tags from
+ *
+ * @param \IScopedEntity $targetScopedEntity Optional, use Null if creating
+ * a new IScopedEntity
+ * @param \IScopedEntity $parentScopedEntity Optional, the parent
+ * to inherit tags from
* @param bool $noReservedScopes True to disable 'reserved' tags
- * @param bool $inheritScopeChecked True to set the checked status of each scope value
- * according to whether the parent has the same scope checked (every scope will always be
- * false if the $parentScopedEntity is null)
+ * @param bool $inheritScopeChecked True to set the checked status
+ * of each scope value according to whether
+ * the parent has the same scope checked
+ * (every scope will always be false if the
+ * $parentScopedEntity is null)
+ *
* @return string
* @throws \LogicException
*/
@@ -104,23 +124,30 @@ function getEntityScopesAsJSON2(
$noReservedScopes = true,
$inheritScopeChecked = false
) {
-
$targetScopes = array();
+
if ($targetScopedEntity != null) {
if (!($targetScopedEntity instanceof \IScopedEntity)) {
- throw new \LogicException('Invalid $scopedEntityChild, does not implement IScopedEntity');
+ throw new \LogicException(
+ 'Invalid $scopedEntityChild, does not implement IScopedEntity'
+ );
}
+
$targetScopes = $targetScopedEntity->getScopes()->toArray();
}
+
$parentScopes = array();
+
if ($parentScopedEntity != null) {
if (!($parentScopedEntity instanceof \IScopedEntity)) {
- throw new \LogicException('Invalid scopedEntityParent, does not implement IScopedEntity');
+ throw new \LogicException(
+ 'Invalid scopedEntityParent, does not implement IScopedEntity'
+ );
}
+
$parentScopes = $parentScopedEntity->getScopes()->toArray();
}
- // $reservedScopeNames = \Factory::getConfigService()->getReservedScopeList();
$allScopes = \Factory::getScopeService()->getScopes();
$optionalScopeIds = array();
// Reserved optional scope ids
@@ -133,6 +160,7 @@ function getEntityScopesAsJSON2(
foreach ($allScopes as $scope) {
$targetChecked = false;
$parentChecked = false;
+
// is scope already joined to target
if (in_array($scope, $targetScopes)) {
$targetChecked = true;
@@ -143,6 +171,7 @@ function getEntityScopesAsJSON2(
}
// Determine if this tag should be checked = t/f
$isChecked = $targetChecked;
+
if ($inheritScopeChecked) {
$isChecked = $parentChecked;
}
@@ -152,22 +181,48 @@ function getEntityScopesAsJSON2(
// A reserved scope tag:
if ($parentChecked || $targetChecked) {
if ($parentChecked) {
- // tag CAN be inherited from parent, so put in relevant array
- $resOptHeritScopeIds[] = array($scope->getId(), $scope->getName(), $isChecked);
+ /**
+ * tag CAN be inherited from parent,
+ * so put in relevant array
+ */
+ $resOptHeritScopeIds[] = array(
+ $scope->getId(),
+ $scope->getName(),
+ $isChecked
+ );
} else {
- // tag CAN'T be inherited from parent, but it has already been directly assigned,
- // so put in relevant array
- $resOptScopeIds[] = array($scope->getId(), $scope->getName(), $isChecked);
+ /**
+ * tag CAN'T be inherited from parent,
+ * but it has already been directly assigned,
+ * so put in relevant array
+ */
+ $resOptScopeIds[] = array(
+ $scope->getId(),
+ $scope->getName(),
+ $isChecked
+ );
}
} else {
- // tag is not inheritable and has not been directly assigned, so its reserved/protected
- $reservedScopeIds[] = array($scope->getId(), $scope->getName(), $isChecked);
+ /**
+ * tag is not inheritable and has not been directly assigned,
+ * so its reserved/protected
+ */
+ $reservedScopeIds[] = array(
+ $scope->getId(),
+ $scope->getName(),
+ $isChecked
+ );
}
} else {
// An optional scope tag:
- $optionalScopeIds[] = array($scope->getId(), $scope->getName(), $isChecked);
+ $optionalScopeIds[] = array(
+ $scope->getId(),
+ $scope->getName(),
+ $isChecked
+ );
}
}
+
// build the response
$scopeCategories = array();
$scopeCategories['optional'] = $optionalScopeIds;
@@ -183,32 +238,41 @@ function getEntityScopesAsJSON2(
* Checks with the config service if the portal is in read only mode and if
* it is throws an exception (except when the user is a GOCDB admin)
*
- * @throws \Exception
+ * @throws Exception
*/
function checkPortalIsNotReadOnlyOrUserIsAdmin(\User $user = null)
{
if (portalIsReadOnlyAndUserIsNotAdmin($user)) {
- throw new \Exception("The portal is currently in read only mode, changes can not be made.");
+ throw new Exception(
+ "The portal is currently in read only mode, "
+ . "changes can not be made."
+ );
}
}
/**
- * Checks config service and returns true if the portal is in read only mode (and
- * the user is not a GOCDB admin.) Used to hide features of the portal used for
- * editing entities when in read only mode.
+ * Checks config service and returns true if the portal is in read only mode
+ * (and the user is not a GOCDB admin.) Used to hide features of the portal
+ * used for editing entities when in read only mode.
*
* @param \user $user
* current user
+ *
* @return boolean
*/
function portalIsReadOnlyAndUserIsNotAdmin(\user $user = null)
{
require_once __DIR__ . '/../../../lib/Gocdb_Services/Factory.php';
- // this block is required to deal with unregistered users (where $user is null)
+ /**
+ * this block is required to deal with unregistered users
+ * (where $user is null)
+ */
$userIsAdmin = false;
+
if (! is_null($user)) {
- if ($user->isAdmin()) { // sub query required becauser ->isAdmin can't be called on null
+ // sub query required becauser ->isAdmin can't be called on null
+ if ($user->isAdmin()) {
$userIsAdmin = true;
}
}
@@ -224,31 +288,36 @@ function portalIsReadOnlyAndUserIsNotAdmin(\user $user = null)
* Checks the user has permission to perform/view admin functionality
*
* @return null
- *
*/
function checkUserIsAdmin()
{
- require_once __DIR__ . '/../../web_portal/components/Get_User_Principle.php';
+ require_once __DIR__
+ . '/../../web_portal/components/Get_User_Principle.php';
+
$dn = Get_User_Principle();
- /**
- * @var \User $user
- */
$user = \Factory::getUserService()->getUserByPrinciple($dn);
+
if ($user == null) {
- throw new Exception("Unregistered users may not carry out this operation");
+ throw new Exception(
+ "Unregistered users may not carry out this operation"
+ );
}
- if (! $user->isAdmin()) {
- throw new Exception("Only GOCDB administrators can perform this action.");
+
+ if (!$user->isAdmin()) {
+ throw new Exception(
+ "Only GOCDB administrators can perform this action."
+ );
}
}
+
function CheckCurrentUserCanEditProject(\Project $project)
{
- require_once __DIR__ . '/../../web_portal/components/Get_User_Principle.php';
+ require_once __DIR__
+ . '/../../web_portal/components/Get_User_Principle.php';
+
$dn = Get_User_Principle();
$user = \Factory::getUserService()->getUserByPrinciple($dn);
- //$enablingRoles = \Factory::getProjectService()->authorize Action('ACTION_EDIT_OBJECT', $project, $user);
- //if (count($enablingRoles) == 0){
if (
\Factory::getRoleActionAuthorisationService()->authoriseAction(
\Action::EDIT_OBJECT,
@@ -256,7 +325,9 @@ function CheckCurrentUserCanEditProject(\Project $project)
$user
)->getGrantAction() == false
) {
- throw new Exception("You do not have a role that enables you to edit this project");
+ throw new Exception(
+ "You do not have a role that enables you to edit this project"
+ );
}
}
@@ -266,6 +337,7 @@ function CheckCurrentUserCanEditProject(\Project $project)
* add_site().
*
* @global array $_REQUEST site data submitted by the end user
+ *
* @return array an array representation of a site
*/
function getSiteDataFromWeb()
@@ -275,29 +347,32 @@ function getSiteDataFromWeb()
'Country',
'ProductionStatus'
);
-
$siteData = [];
+
foreach ($fields as $field) {
- $siteData[$field] = $_REQUEST [$field];
+ $siteData[$field] = $_REQUEST[$field];
}
if (isset($_REQUEST['childServiceScopeAction'])) {
- $siteData['childServiceScopeAction'] = $_REQUEST['childServiceScopeAction'];
+ $siteData['childServiceScopeAction'] = $_REQUEST[
+ 'childServiceScopeAction'
+ ];
} else {
$siteData['childServiceScopeAction'] = 'noModify';
}
// get non-reserved scopes if any are selected, if not set as empty array
- if (isset($_REQUEST ['Scope_ids'])) {
- $siteData ['Scope_ids'] = $_REQUEST ['Scope_ids'];
+ if (isset($_REQUEST['Scope_ids'])) {
+ $siteData['Scope_ids'] = $_REQUEST['Scope_ids'];
} else {
- $siteData ['Scope_ids'] = array ();
+ $siteData['Scope_ids'] = array();
}
+
// get reserved scopes if any are selected, if not set as empty array
if (isset($_REQUEST ['ReservedScope_ids'])) {
- $siteData ['ReservedScope_ids'] = $_REQUEST ['ReservedScope_ids'];
+ $siteData['ReservedScope_ids'] = $_REQUEST['ReservedScope_ids'];
} else {
- $siteData ['ReservedScope_ids'] = array ();
+ $siteData['ReservedScope_ids'] = array();
}
/*
@@ -305,56 +380,56 @@ function getSiteDataFromWeb()
* Editing an existing site's cert status uses a separate form
*/
if (isset($_REQUEST ['Certification_Status'])) {
- $siteData ['Certification_Status'] = $_REQUEST ['Certification_Status'];
+ $siteData['Certification_Status'] = $_REQUEST['Certification_Status'];
}
/*
- * ROC is only set during the add_site procedure. A site's ROC can't be edited in the web portal
+ * ROC is only set during the add_site procedure.
+ * A site's ROC can't be edited in the web portal
*/
- if (isset($_REQUEST ['NGI'])) {
- $siteData ['NGI'] = $_REQUEST ['NGI'];
+ if (isset($_REQUEST['NGI'])) {
+ $siteData['NGI'] = $_REQUEST['NGI'];
}
// Fields specific to the site object and not linked to other entities
$siteObjectFields = array (
- 'SHORT_NAME',
- 'OFFICIAL_NAME',
- 'HOME_URL',
- 'GIIS_URL',
- 'IP_RANGE',
- 'IP_V6_RANGE',
- 'LOCATION',
- 'LATITUDE',
- 'LONGITUDE',
- 'DESCRIPTION',
- 'EMAIL',
- 'CONTACTTEL',
- 'EMERGENCYTEL',
- 'CSIRTEMAIL',
- 'CSIRTTEL',
- 'EMERGENCYEMAIL',
- 'HELPDESKEMAIL',
- 'DOMAIN',
- 'TIMEZONE'
+ 'SHORT_NAME',
+ 'OFFICIAL_NAME',
+ 'HOME_URL',
+ 'GIIS_URL',
+ 'IP_RANGE',
+ 'IP_V6_RANGE',
+ 'LOCATION',
+ 'LATITUDE',
+ 'LONGITUDE',
+ 'DESCRIPTION',
+ 'EMAIL',
+ 'CONTACTTEL',
+ 'EMERGENCYTEL',
+ 'CSIRTEMAIL',
+ 'CSIRTTEL',
+ 'EMERGENCYEMAIL',
+ 'HELPDESKEMAIL',
+ 'DOMAIN',
+ 'TIMEZONE'
);
foreach ($siteObjectFields as $field) {
- $siteData ['Site'] [$field] = trim($_REQUEST [$field]);
+ $siteData['Site'][$field] = trim($_REQUEST[$field]);
}
- //Notifcations
- $siteData ['NOTIFY'] = $_REQUEST ['NOTIFY'];
+ // Notifcations
+ $siteData['NOTIFY'] = $_REQUEST['NOTIFY'];
/*
- * If the user is updating a site the optional cobjectid parameter will be set.
+ * If the user is updating a site the optional cobjectid
+ * parameter will be set.
* If it is set we return it as part of the array
*/
- if (! empty($_REQUEST ['ID'])) {
- $siteData ['ID'] = $_REQUEST ['ID'];
+ if (!empty($_REQUEST ['ID'])) {
+ $siteData['ID'] = $_REQUEST['ID'];
}
- //
-
return $siteData;
}
@@ -363,12 +438,14 @@ function getSiteDataFromWeb()
* ($_REQUEST)
*
* @global array $_REQUEST site data submitted by the end user
+ *
* @return array An array of service group data
*/
function getSGroupDataFromWeb()
{
/*
- * $_REQUEST['monitored'] is set by the "Should this Virtual Site be monitored?" tick box
+ * $_REQUEST['monitored'] is set by the
+ * "Should this Virtual Site be monitored?" tick box
*/
if (isset($_REQUEST ['monitored'])) {
$monitored = 'Y';
@@ -379,24 +456,25 @@ function getSGroupDataFromWeb()
$sGroup = [];
$sGroup['MONITORED'] = $monitored;
- if (isset($_REQUEST ['objectId'])) {
- $sGroup['ID'] = $_REQUEST ['objectId'];
+ if (isset($_REQUEST['objectId'])) {
+ $sGroup['ID'] = $_REQUEST['objectId'];
}
- $sGroup['SERVICEGROUP'] ['NAME'] = trim($_REQUEST ['name']);
- $sGroup['SERVICEGROUP'] ['DESCRIPTION'] = trim($_REQUEST ['description']);
- $sGroup['SERVICEGROUP'] ['EMAIL'] = trim($_REQUEST ['email']);
+ $sGroup['SERVICEGROUP']['NAME'] = trim($_REQUEST['name']);
+ $sGroup['SERVICEGROUP']['DESCRIPTION'] = trim($_REQUEST['description']);
+ $sGroup['SERVICEGROUP']['EMAIL'] = trim($_REQUEST['email']);
// get scopes if any are selected, if not set as null
- if (isset($_REQUEST ['Scope_ids'])) {
- $sGroup['Scope_ids'] = $_REQUEST ['Scope_ids'];
+ if (isset($_REQUEST['Scope_ids'])) {
+ $sGroup['Scope_ids'] = $_REQUEST['Scope_ids'];
} else {
- $sGroup['Scope_ids'] = array ();
+ $sGroup['Scope_ids'] = array();
}
+
if (isset($_REQUEST ['ReservedScope_ids'])) {
- $sGroup['ReservedScope_ids'] = $_REQUEST ['ReservedScope_ids'];
+ $sGroup['ReservedScope_ids'] = $_REQUEST['ReservedScope_ids'];
} else {
- $sGroup['ReservedScope_ids'] = array ();
+ $sGroup['ReservedScope_ids'] = array();
}
return $sGroup;
@@ -408,61 +486,64 @@ function getSGroupDataFromWeb()
* add_new_service() or editService.
*
* @global array $_REQUEST SE data submitted by the end user
+ *
* @return array an array representation of a service
*/
function getSeDataFromWeb()
{
$fields = array (
- 'serviceType',
- 'IS_MONITORED',
- 'NOTIFY',
- 'PRODUCTION_LEVEL'
+ 'serviceType',
+ 'IS_MONITORED',
+ 'NOTIFY',
+ 'PRODUCTION_LEVEL'
);
$seData = [];
+
foreach ($fields as $field) {
- $seData [$field] = $_REQUEST [$field];
+ $seData[$field] = $_REQUEST[$field];
}
/*
- * If the user is adding a new service the optional HOSTING_SITE parameter will be set.
+ * If the user is adding a new service
+ * the optional HOSTING_SITE parameter will be set.
* If it is set we return it as part of the array
*/
- if (! empty($_REQUEST ['hostingSite'])) {
- $seData ['hostingSite'] = $_REQUEST ['hostingSite'];
- }
-
- // $seData['SE']['ENDPOINT'] = $_REQUEST['HOSTNAME'] . $_REQUEST['serviceType'];
- $seData ['SE'] ['HOSTNAME'] = trim($_REQUEST ['HOSTNAME']);
- $seData ['SE'] ['HOST_IP'] = trim($_REQUEST ['HOST_IP']);
- $seData ['SE'] ['HOST_IP_V6'] = trim($_REQUEST['HOST_IP_V6']);
- $seData ['SE'] ['HOST_DN'] = trim($_REQUEST ['HOST_DN']);
- $seData ['SE'] ['DESCRIPTION'] = trim($_REQUEST ['DESCRIPTION']);
- $seData ['SE'] ['HOST_OS'] = trim($_REQUEST ['HOST_OS']);
- $seData ['SE'] ['HOST_ARCH'] = trim($_REQUEST ['HOST_ARCH']);
- $seData ['SE'] ['EMAIL'] = trim($_REQUEST ['EMAIL']);
- $seData ['SE'] ['URL'] = trim($_REQUEST ['endpointUrl']);
- $seData ['BETA'] = $_REQUEST ['HOST_BETA'];
+ if (! empty($_REQUEST['hostingSite'])) {
+ $seData['hostingSite'] = $_REQUEST['hostingSite'];
+ }
+
+ $seData['SE']['HOSTNAME'] = trim($_REQUEST['HOSTNAME']);
+ $seData['SE']['HOST_IP'] = trim($_REQUEST['HOST_IP']);
+ $seData['SE']['HOST_IP_V6'] = trim($_REQUEST['HOST_IP_V6']);
+ $seData['SE']['HOST_DN'] = trim($_REQUEST['HOST_DN']);
+ $seData['SE']['DESCRIPTION'] = trim($_REQUEST['DESCRIPTION']);
+ $seData['SE']['HOST_OS'] = trim($_REQUEST['HOST_OS']);
+ $seData['SE']['HOST_ARCH'] = trim($_REQUEST['HOST_ARCH']);
+ $seData['SE']['EMAIL'] = trim($_REQUEST['EMAIL']);
+ $seData['SE']['URL'] = trim($_REQUEST['endpointUrl']);
+ $seData['BETA'] = $_REQUEST['HOST_BETA'];
/*
- * If the user is updating a service the optional cobjectid parameter will be set.
+ * If the user is updating a service
+ * the optional cobjectid parameter will be set.
* If it is set we return it as part of the array
*/
- if (! empty($_REQUEST ['ID'])) {
- $seData ['ID'] = $_REQUEST ['ID'];
+ if (!empty($_REQUEST['ID'])) {
+ $seData['ID'] = $_REQUEST['ID'];
}
// get scopes if any are selected, if not set as null
- if (isset($_REQUEST ['Scope_ids'])) {
- $seData ['Scope_ids'] = $_REQUEST ['Scope_ids'];
+ if (isset($_REQUEST['Scope_ids'])) {
+ $seData['Scope_ids'] = $_REQUEST['Scope_ids'];
} else {
- $seData ['Scope_ids'] = array ();
+ $seData['Scope_ids'] = array();
}
- if (isset($_REQUEST ['ReservedScope_ids'])) {
- $seData ['ReservedScope_ids'] = $_REQUEST ['ReservedScope_ids'];
+ if (isset($_REQUEST['ReservedScope_ids'])) {
+ $seData['ReservedScope_ids'] = $_REQUEST['ReservedScope_ids'];
} else {
- $seData ['ReservedScope_ids'] = array ();
+ $seData['ReservedScope_ids'] = array();
}
return $seData;
@@ -475,71 +556,73 @@ function getSeDataFromWeb()
function getProjectDataFromWeb()
{
$projectValues = [];
+
// new projects won't have an id
- if (isset($_REQUEST ['ID'])) {
- $projectValues ['ID'] = $_REQUEST ['ID'];
+ if (isset($_REQUEST['ID'])) {
+ $projectValues['ID'] = $_REQUEST['ID'];
}
// Get the rest of the project post data into an array
$fields = array (
- 'Name',
- 'Description'
+ 'Name',
+ 'Description'
);
foreach ($fields as $field) {
- $projectValues [$field] = trim($_REQUEST [$field]);
+ $projectValues[$field] = trim($_REQUEST[$field]);
}
+
return $projectValues;
}
+
function getNGIDataFromWeb()
{
// Get the NGI post data into an array
$fields = array (
- 'EMAIL',
- 'HELPDESK_EMAIL',
- 'ROD_EMAIL',
- 'SECURITY_EMAIL',
- 'GGUS_SU'
+ 'EMAIL',
+ 'HELPDESK_EMAIL',
+ 'ROD_EMAIL',
+ 'SECURITY_EMAIL',
+ 'GGUS_SU'
);
$ngiValues = [];
+
foreach ($fields as $field) {
- $ngiValues [$field] = trim($_REQUEST [$field]);
+ $ngiValues[$field] = trim($_REQUEST[$field]);
}
if (isset($_REQUEST ['NAME'])) {
- $ngiValues ['NAME'] = $_REQUEST ['NAME'];
+ $ngiValues['NAME'] = $_REQUEST['NAME'];
}
-// $scopes = array ();
-// if (isset($_REQUEST ['SCOPE_IDS'])){
-// $scopes = $_REQUEST ['SCOPE_IDS'];
-// }
-
// get scopes if any are selected, if not set as null
$optionalScopes = array();
- if (isset($_REQUEST ['Scope_ids'])) {
- $optionalScopes['Scope_ids'] = $_REQUEST ['Scope_ids'];
+
+ if (isset($_REQUEST['Scope_ids'])) {
+ $optionalScopes['Scope_ids'] = $_REQUEST['Scope_ids'];
} else {
- $optionalScopes['Scope_ids'] = array ();
+ $optionalScopes['Scope_ids'] = array();
}
+
$reservedScopes = array();
- if (isset($_REQUEST ['ReservedScope_ids'])) {
- $reservedScopes['ReservedScope_ids'] = $_REQUEST ['ReservedScope_ids'];
+
+ if (isset($_REQUEST['ReservedScope_ids'])) {
+ $reservedScopes['ReservedScope_ids'] = $_REQUEST['ReservedScope_ids'];
} else {
- $reservedScopes['ReservedScope_ids'] = array ();
+ $reservedScopes['ReservedScope_ids'] = array();
}
$id = null;
- if (isset($_REQUEST ['ID'])) {
- $id = $_REQUEST ['ID'];
+
+ if (isset($_REQUEST['ID'])) {
+ $id = $_REQUEST['ID'];
}
$values = array (
- 'NGI' => $ngiValues,
- //'SCOPES' => $scopes,
- 'Scope_ids' => $optionalScopes['Scope_ids'],
- 'ReservedScope_ids' => $reservedScopes['ReservedScope_ids'],
- 'ID' => $id
+ 'NGI' => $ngiValues,
+ 'Scope_ids' => $optionalScopes['Scope_ids'],
+ 'ReservedScope_ids' => $reservedScopes['ReservedScope_ids'],
+ 'ID' => $id
);
return $values;
@@ -550,28 +633,36 @@ function getNGIDataFromWeb()
* ($_REQUEST) and returns an associative array.
*
* @global array $_REQUEST Downtime data submitted by the end user
+ *
* @return array an array representation of a downtime
*/
function getDtDataFromWeb()
{
$downTime = [];
- $downTime['DOWNTIME'] ['SEVERITY'] = $_REQUEST ['SEVERITY'];
- $downTime['DOWNTIME'] ['DESCRIPTION'] = trim($_REQUEST ['DESCRIPTION']);
- $downTime['DOWNTIME'] ['START_TIMESTAMP'] = $_REQUEST ['START_TIMESTAMP'];
- $downTime['DOWNTIME'] ['END_TIMESTAMP'] = $_REQUEST ['END_TIMESTAMP'];
+ $downTime['DOWNTIME']['SEVERITY'] = $_REQUEST['SEVERITY'];
+ $downTime['DOWNTIME']['DESCRIPTION'] = trim($_REQUEST['DESCRIPTION']);
+ $downTime['DOWNTIME']['START_TIMESTAMP'] = $_REQUEST['START_TIMESTAMP'];
+ $downTime['DOWNTIME']['END_TIMESTAMP'] = $_REQUEST['END_TIMESTAMP'];
+
+ $downTime['DOWNTIME']['DEFINE_TZ_BY_UTC_OR_SITE'] = 'utc'; //default
- $downTime['DOWNTIME'] ['DEFINE_TZ_BY_UTC_OR_SITE'] = 'utc'; //default
- if (isset($_REQUEST ['DEFINE_TZ_BY_UTC_OR_SITE'])) {
- $downTime['DOWNTIME'] ['DEFINE_TZ_BY_UTC_OR_SITE'] = $_REQUEST ['DEFINE_TZ_BY_UTC_OR_SITE']; // 'utc' or 'site'
+ if (isset($_REQUEST['DEFINE_TZ_BY_UTC_OR_SITE'])) {
+ // 'utc' or 'site'
+ $downTime['DOWNTIME']['DEFINE_TZ_BY_UTC_OR_SITE'] = $_REQUEST[
+ 'DEFINE_TZ_BY_UTC_OR_SITE'
+ ];
}
- if (! isset($_REQUEST ['IMPACTED_IDS'])) {
- throw new Exception('Error - No endpoints or services selected, downtime must affect at least one endpoint');
+ if (!isset($_REQUEST ['IMPACTED_IDS'])) {
+ throw new Exception(
+ "Error - No endpoints or services selected, "
+ . "downtime must affect at least one endpoint"
+ );
}
- $downTime['IMPACTED_IDS'] = $_REQUEST ['IMPACTED_IDS'];
+ $downTime['IMPACTED_IDS'] = $_REQUEST['IMPACTED_IDS'];
- //Get the previous downtimes ID if we are doing an edit
+ // Get the previous downtimes ID if we are doing an edit
if (isset($_REQUEST['DOWNTIME_ID'])) {
$downTime['DOWNTIME']['EXISTINGID'] = $_REQUEST['DOWNTIME_ID'];
}
@@ -585,19 +676,25 @@ function getDtDataFromWeb()
function getSpDataFromWeb()
{
$siteProp = [];
- $siteProp['SITEPROPERTIES'] ['SITE'] = $_REQUEST ['SITE'];
- $siteProp['SITEPROPERTIES'] ['NAME'] = $_REQUEST ['KEYPAIRNAME'];
- $siteProp['SITEPROPERTIES'] ['VALUE'] = $_REQUEST ['KEYPAIRVALUE'];
- if (isset($_REQUEST ['PROP'])) {
- $siteProp['SITEPROPERTIES'] ['PROP'] = $_REQUEST ['PROP'];
+ $siteProp['SITEPROPERTIES']['SITE'] = $_REQUEST['SITE'];
+ $siteProp['SITEPROPERTIES']['NAME'] = $_REQUEST['KEYPAIRNAME'];
+ $siteProp['SITEPROPERTIES']['VALUE'] = $_REQUEST['KEYPAIRVALUE'];
+
+ if (isset($_REQUEST['PROP'])) {
+ $siteProp['SITEPROPERTIES']['PROP'] = $_REQUEST['PROP'];
}
+ // TODO Need to check why Assignment made to same variable?
if (isset($siteProp['SITEPROPERTIES']['NAME'])) {
- $siteProp['SITEPROPERTIES']['NAME'] = $siteProp['SITEPROPERTIES']['NAME'];
+ $siteProp['SITEPROPERTIES']['NAME'] =
+ $siteProp['SITEPROPERTIES']['NAME'];
}
+
if (isset($siteProp['SITEPROPERTIES']['VALUE'])) {
- $siteProp['SITEPROPERTIES']['VALUE'] = $siteProp['SITEPROPERTIES']['VALUE'];
+ $siteProp['SITEPROPERTIES']['VALUE'] =
+ $siteProp['SITEPROPERTIES']['VALUE'];
}
+
return $siteProp;
}
@@ -607,18 +704,24 @@ function getSpDataFromWeb()
function getSerPropDataFromWeb()
{
$serviceProp = [];
- $serviceProp['SERVICEPROPERTIES'] ['SERVICE'] = $_REQUEST ['SERVICE'];
- $serviceProp['SERVICEPROPERTIES'] ['NAME'] = $_REQUEST ['KEYPAIRNAME'];
- $serviceProp['SERVICEPROPERTIES'] ['VALUE'] = $_REQUEST ['KEYPAIRVALUE'];
- if (isset($_REQUEST ['PROP'])) {
- $serviceProp['SERVICEPROPERTIES'] ['PROP'] = trim($_REQUEST ['PROP']);
+ $serviceProp['SERVICEPROPERTIES']['SERVICE'] = $_REQUEST['SERVICE'];
+ $serviceProp['SERVICEPROPERTIES']['NAME'] = $_REQUEST['KEYPAIRNAME'];
+ $serviceProp['SERVICEPROPERTIES']['VALUE'] = $_REQUEST['KEYPAIRVALUE'];
+
+ if (isset($_REQUEST['PROP'])) {
+ $serviceProp['SERVICEPROPERTIES']['PROP'] = trim($_REQUEST['PROP']);
}
+
if (isset($serviceProp['SERVICEPROPERTIES']['NAME'])) {
- $serviceProp['SERVICEPROPERTIES']['NAME'] = $serviceProp['SERVICEPROPERTIES']['NAME'];
+ $serviceProp['SERVICEPROPERTIES']['NAME'] =
+ $serviceProp['SERVICEPROPERTIES']['NAME'];
}
+
if (isset($serviceProp['SERVICEPROPERTIES']['VALUE'])) {
- $serviceProp['SERVICEPROPERTIES']['VALUE'] = $serviceProp['SERVICEPROPERTIES']['VALUE'];
+ $serviceProp['SERVICEPROPERTIES']['VALUE'] =
+ $serviceProp['SERVICEPROPERTIES']['VALUE'];
}
+
return $serviceProp;
}
@@ -628,18 +731,26 @@ function getSerPropDataFromWeb()
function getEndpointPropDataFromWeb()
{
$endpointProp = array();
- if (isset($_REQUEST ['PROP'])) {
- $endpointProp['ENDPOINTPROPERTIES'] ['PROP'] = trim($_REQUEST ['PROP']);
+
+ if (isset($_REQUEST['PROP'])) {
+ $endpointProp['ENDPOINTPROPERTIES']['PROP'] = trim($_REQUEST['PROP']);
}
- if (isset($_REQUEST ['ENDPOINTID'])) {
- $endpointProp['ENDPOINTPROPERTIES']['ENDPOINTID'] = trim($_REQUEST ['ENDPOINTID']);
+
+ if (isset($_REQUEST['ENDPOINTID'])) {
+ $endpointProp['ENDPOINTPROPERTIES']['ENDPOINTID'] = trim(
+ $_REQUEST['ENDPOINTID']
+ );
}
- if (isset($_REQUEST ['KEYPAIRNAME'])) {
- $endpointProp['ENDPOINTPROPERTIES']['NAME'] = $_REQUEST ['KEYPAIRNAME'];
+
+ if (isset($_REQUEST['KEYPAIRNAME'])) {
+ $endpointProp['ENDPOINTPROPERTIES']['NAME'] = $_REQUEST['KEYPAIRNAME'];
}
- if (isset($_REQUEST ['KEYPAIRVALUE'])) {
- $endpointProp['ENDPOINTPROPERTIES']['VALUE'] = $_REQUEST ['KEYPAIRVALUE'];
+
+ if (isset($_REQUEST['KEYPAIRVALUE'])) {
+ $endpointProp['ENDPOINTPROPERTIES']['VALUE'] =
+ $_REQUEST['KEYPAIRVALUE'];
}
+
return $endpointProp;
}
@@ -649,12 +760,18 @@ function getEndpointPropDataFromWeb()
function getSerGroupPropDataFromWeb()
{
$serGroupProp = [];
- $serGroupProp['SERVICEGROUPPROPERTIES'] ['SERVICEGROUP'] = $_REQUEST ['SERVICEGROUP'];
- $serGroupProp['SERVICEGROUPPROPERTIES'] ['NAME'] = $_REQUEST ['KEYPAIRNAME'];
- $serGroupProp['SERVICEGROUPPROPERTIES'] ['VALUE'] = $_REQUEST ['KEYPAIRVALUE'];
- if (isset($_REQUEST ['PROP'])) {
- $serGroupProp['SERVICEGROUPPROPERTIES'] ['PROP'] = $_REQUEST ['PROP'];
+
+ $serGroupProp['SERVICEGROUPPROPERTIES']['SERVICEGROUP'] =
+ $_REQUEST ['SERVICEGROUP'];
+ $serGroupProp['SERVICEGROUPPROPERTIES']['NAME'] =
+ $_REQUEST ['KEYPAIRNAME'];
+ $serGroupProp['SERVICEGROUPPROPERTIES']['VALUE'] =
+ $_REQUEST ['KEYPAIRVALUE'];
+
+ if (isset($_REQUEST['PROP'])) {
+ $serGroupProp['SERVICEGROUPPROPERTIES']['PROP'] = $_REQUEST['PROP'];
}
+
return $serGroupProp;
}
@@ -664,20 +781,33 @@ function getSerGroupPropDataFromWeb()
function getEndpointDataFromWeb()
{
$endpoint = [];
- $endpoint['SERVICEENDPOINT'] ['SERVICE'] = $_REQUEST ['SERVICE'];
- $endpoint['SERVICEENDPOINT'] ['NAME'] = trim($_REQUEST ['ENDPOINTNAME']);
- $endpoint['SERVICEENDPOINT'] ['URL'] = trim($_REQUEST ['ENDPOINTURL']);
- $endpoint['SERVICEENDPOINT'] ['INTERFACENAME'] = trim($_REQUEST ['ENDPOINTINTERFACENAME']);
- if (isset($_REQUEST ['DESCRIPTION'])) {
- $endpoint['SERVICEENDPOINT'] ['DESCRIPTION'] = trim($_REQUEST ['DESCRIPTION']);
- }
- if (isset($_REQUEST ['ENDPOINTID'])) {
- $endpoint['SERVICEENDPOINT'] ['ENDPOINTID'] = trim($_REQUEST ['ENDPOINTID']);
- }
- $endpoint['SERVICEENDPOINT']['EMAIL'] = trim($_REQUEST ['EMAIL']);
- //The value comes from a checkbox, which wiill not return a value when unchecked
+ $endpoint['SERVICEENDPOINT']['SERVICE'] = $_REQUEST['SERVICE'];
+ $endpoint['SERVICEENDPOINT']['NAME'] = trim($_REQUEST['ENDPOINTNAME']);
+ $endpoint['SERVICEENDPOINT']['URL'] = trim($_REQUEST['ENDPOINTURL']);
+ $endpoint['SERVICEENDPOINT']['INTERFACENAME'] = trim(
+ $_REQUEST['ENDPOINTINTERFACENAME']
+ );
+
+ if (isset($_REQUEST['DESCRIPTION'])) {
+ $endpoint['SERVICEENDPOINT']['DESCRIPTION'] = trim(
+ $_REQUEST['DESCRIPTION']
+ );
+ }
+
+ if (isset($_REQUEST['ENDPOINTID'])) {
+ $endpoint['SERVICEENDPOINT']['ENDPOINTID'] = trim(
+ $_REQUEST['ENDPOINTID']
+ );
+ }
+
+ $endpoint['SERVICEENDPOINT']['EMAIL'] = trim($_REQUEST['EMAIL']);
+
+ /**
+ * The value comes from a checkbox,
+ * which will not return a value when unchecked
+ */
if (isset($_REQUEST['IS_MONITORED'])) {
- $endpoint['IS_MONITORED'] = $_REQUEST ['IS_MONITORED'];
+ $endpoint['IS_MONITORED'] = $_REQUEST['IS_MONITORED'];
} else {
$endpoint['IS_MONITORED'] = false;
}
@@ -697,19 +827,23 @@ function getDateFormat()
* Gets the submitted post data for the addition or editing of a scope
*
* @global array $_REQUEST array containg the post data
+ *
* @return array
*/
function getScopeDataFromWeb()
{
$scopeData = [];
- $scopeData['Name'] = trim($_REQUEST ['Name']);
- $scopeData['Description'] = trim($_REQUEST ['Description']);
+
+ $scopeData['Name'] = trim($_REQUEST['Name']);
+ $scopeData['Description'] = trim($_REQUEST['Description']);
+
// 'Reserved' value is a checkbox ==>> absent if not checked
if (array_key_exists('Reserved', $_REQUEST)) {
- $scopeData['Reserved'] = ($_REQUEST ['Reserved'] == '1');
+ $scopeData['Reserved'] = ($_REQUEST['Reserved'] == '1');
}
+
if (array_key_exists('Id', $_REQUEST)) {
- $scopeData['Id'] = $_REQUEST ['Id'];
+ $scopeData['Id'] = $_REQUEST['Id'];
}
return $scopeData;
@@ -719,51 +853,60 @@ function getScopeDataFromWeb()
* Gets the submitted post data for the addition or editing of a service type
*
* @global array $_REQUEST array containg the post data
+ *
* @return array $serviceTypeData an array containg the new site data
*/
function getSTDataFromWeb()
{
$serviceTypeData = [];
- $serviceTypeData['Name'] = trim($_REQUEST ['Name']);
- $serviceTypeData['Description'] = trim($_REQUEST ['Description']);
+
+ $serviceTypeData['Name'] = trim($_REQUEST['Name']);
+ $serviceTypeData['Description'] = trim($_REQUEST['Description']);
+
if (isset($_REQUEST['AllowMonitoringException'])) {
- $serviceTypeData['AllowMonitoringException'] = ($_REQUEST ['AllowMonitoringException'] == "checked");
+ $serviceTypeData['AllowMonitoringException'] = (
+ $_REQUEST['AllowMonitoringException'] == "checked"
+ );
} else {
$serviceTypeData['AllowMonitoringException'] = false;
}
+
if (array_key_exists('ID', $_REQUEST)) {
- $serviceTypeData['ID'] = $_REQUEST ['ID'];
+ $serviceTypeData['ID'] = $_REQUEST['ID'];
}
return $serviceTypeData;
}
/**
- * Gets the submitted post data for the addition or editing of API Authentication Entities
+ * Gets the submitted post data for the addition or editing
+ * of API Authentication Entities
*
* @global array $_REQUEST array containg the post data
+ *
* @return array
*/
function getAPIAuthenticationFromWeb()
{
$authEntityData = [];
+
$authEntityData['TYPE'] = $_REQUEST['TYPE'];
$authEntityData['IDENTIFIER'] = trim($_REQUEST['IDENTIFIER']);
- $authEntityData['ALLOW_WRITE'] = key_exists('ALLOW_WRITE', $_REQUEST) ?
- trim($_REQUEST['ALLOW_WRITE']) == 'checked' :
- false;
+ $authEntityData['ALLOW_WRITE'] = key_exists('ALLOW_WRITE', $_REQUEST)
+ ? trim($_REQUEST['ALLOW_WRITE']) == 'checked'
+ : false;
return $authEntityData;
}
+
/**
* Return information message text
*
* @return string short message, a dash, supplementary text
- * e.g. "PROTECTED - Registration required"
+ * e.g. "PROTECTED - Registration required"
*/
function getInfoMessage($code = null)
{
-
if ($code == null) {
$code = 'privacy-1';
}
@@ -780,12 +923,15 @@ function getInfoMessage($code = null)
}
if (!array_key_exists($code, $messages)) {
- throw new LogicException("Information message code $code has not been defined. " .
- "Please contact GOCDB administrators.");
+ throw new LogicException(
+ "Information message code $code has not been defined. "
+ . "Please contact GOCDB administrators."
+ );
}
return $messages[$code];
}
+
/**
* Helper function to set view parameters for deciding to show personal data
*
@@ -804,8 +950,10 @@ function getReadPDParams($user)
// ToDo: should this be restricted to role at a site?
if (!$user instanceof \User) {
- throw new LogicException("Personal data read authorisation expected User object as input. Received " .
- get_class($user) . "'.");
+ throw new LogicException(
+ "Personal data read authorisation expected User "
+ . "object as input. Received " . get_class($user) . "'."
+ );
}
if ($user->isAdmin()) {
@@ -815,6 +963,7 @@ function getReadPDParams($user)
$authenticated = true;
}
}
+
return array($userIsAdmin, $authenticated);
}
diff --git a/htdocs/web_portal/index.php b/htdocs/web_portal/index.php
index bd64c6129..490bb6bbe 100644
--- a/htdocs/web_portal/index.php
+++ b/htdocs/web_portal/index.php
@@ -1,4 +1,5 @@
setLocalInfoOverride($_SERVER['SERVER_NAME']);
try {
Draw_Page($Page_Type);
-
} catch (ErrorException $e) {
/* ErrorExceptions may be thrown by an invalid configuration so it is
not safe to try to give a pretty output. Set 'raw' to true. */
- show_view('error.php', $e->getMessage(), NULL, TRUE);
+ show_view('error.php', $e->getMessage(), null, true);
+
die();
-} catch(Exception $e) {
- show_view('error.php', $e->getMessage(), NULL, FALSE);
+} catch (Exception $e) {
+ show_view('error.php', $e->getMessage(), null, false);
+
die();
}
+
/**
* If a page type has been set then return this value. If it hasn't,
* return an empty string.
*/
-function Get_Page_Type() {
- if(!isset($_REQUEST['Page_Type'])){
+function Get_Page_Type()
+{
+ if (!isset($_REQUEST['Page_Type'])) {
return "default";
} else {
return $_REQUEST['Page_Type'];
}
}
-function testForHtmlSpecialChars($value, $key){
- if(is_string($key) && strcmp($key, htmlspecialchars($key)) !== 0) {
- throw new \Exception("Invalid chars detected in URL parameter keys");
+function testForHtmlSpecialChars($value, $key)
+{
+ if (is_string($key) && strcmp($key, htmlspecialchars($key)) !== 0) {
+ throw new Exception("Invalid chars detected in URL parameter keys");
}
- if(is_string($value) && strcmp($value, htmlspecialchars($value)) !== 0) {
- throw new \Exception("Invalid chars detected in URL parameter values");
+
+ if (is_string($value) && strcmp($value, htmlspecialchars($value)) !== 0) {
+ throw new Exception("Invalid chars detected in URL parameter values");
}
}
/* Decides which type of page to draw based on the passed $Page_Type */
-function Draw_Page($Page_Type) {
-
+function Draw_Page($Page_Type)
+{
// We call this to account for URL params that have an array for the value
array_walk_recursive($_GET, 'testForHtmlSpecialChars');
- // Read only pages - these pages don't strictly require user authentication.
+ /**
+ * Read only pages - these pages don't strictly
+ * require user authentication.
+ */
// Therefore, to enable permit-all page viewing, comment out the call
// to rejectIfNotAuthenticated() in the relevant case block. Note, some of
// these pages will replace sensitive info such as telephone/email with
// the string 'PROTECTED'
// ************************************************************************
- switch($Page_Type) {
- case "default" :
- //rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/start_page.php';
+ switch ($Page_Type) {
+ case "default":
+ require_once __DIR__ . '/controllers/start_page.php';
startPage();
break;
- case "View_Service_Endpoint" :
- //rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service/view_service_endpoint.php';
+ case "View_Service_Endpoint":
+ require_once __DIR__
+ . '/controllers/service/view_service_endpoint.php';
view_endpoint();
break;
case "Service_Groups":
- //rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/service_group/view_all.php';
showAllServiceGroups();
break;
case "Service_Group":
- //rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service_group/view_sgroup.php';
+ require_once __DIR__
+ . '/controllers/service_group/view_sgroup.php';
showServiceGroup();
break;
case "Site":
- //rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/site/view_site.php';
view_site();
break;
case "NGI":
- //rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/ngi/view_ngi.php';
view_ngi();
break;
case "Service":
- //rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/service/view_service.php';
view_se();
break;
case "Services":
- //rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/service/view_all.php';
drawSEs();
break;
case "NGIs":
- //rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/ngi/view_ngis.php';
view_ngis();
break;
case "Sites":
- //rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/site/view_all.php';
showAllSites();
break;
case "Projects":
- //rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/project/view_all.php';
show_all_projects();
break;
case "Project":
- //rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/project/view_project.php';
show_project();
break;
@@ -195,467 +212,499 @@ function Draw_Page($Page_Type) {
require_once __DIR__ . '/controllers/scope.php';
view_scope();
break;
- case "Site_Geo_xml" :
- //rejectIfNotAuthenticated();
+ case "Site_Geo_xml":
require_once __DIR__ . '/controllers/sitesForMapXML.php';
- show_xml ();
+ show_xml();
break;
case "Error_Redirect":
- //rejectIfNotAuthenticated();
show_view('error.php', $_REQUEST['error']);
break;
case "Static_HTML":
- //rejectIfNotAuthenticated();
Draw_Static_HTML();
break;
case "Search":
- //rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/search.php';
+ require_once __DIR__ . '/controllers/search.php';
search();
break;
case "View_Role_Action_Mappings":
- //rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/political_role/view_role_action_mappings.php';
+ require_once __DIR__
+ . '/controllers/political_role/view_role_action_mappings.php';
view_role_action_mappings();
break;
// CrUD Pages - These pages MUST have authentication enabled so
// the calls to rejectIfNotAuthenticated() must be used.
- // *********************************************************************
+ // ********************************************************************
case "Revoke_Role":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/political_role/revoke_request.php';
+ require_once __DIR__
+ . '/controllers/political_role/revoke_request.php';
view_revoke_request();
break;
case "Accept_Role_Request":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/political_role/accept_request.php';
+ require_once __DIR__
+ . '/controllers/political_role/accept_request.php';
view_accept_request();
break;
case "Deny_Role_Request":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/political_role/deny_request.php';
+ require_once __DIR__
+ . '/controllers/political_role/deny_request.php';
view_deny_request();
break;
case "Role_Requests":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/political_role/view_requests.php';
+ require_once __DIR__
+ . '/controllers/political_role/view_requests.php';
view_requests();
break;
case "Request_Role":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/political_role/request_role.php';
+ require_once __DIR__
+ . '/controllers/political_role/request_role.php';
request_role();
break;
case "Edit_Site":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/site/edit_site.php';
+ require_once __DIR__ . '/controllers/site/edit_site.php';
edit_site();
break;
case "Edit_Service":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service/edit_service.php';
+ require_once __DIR__ . '/controllers/service/edit_service.php';
edit_service();
break;
case "SE_Downtimes":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service/se_downtimes.php';
+ require_once __DIR__ . '/controllers/service/se_downtimes.php';
se_downtimes();
break;
case "Add_Service":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service/add_service.php';
+ require_once __DIR__ . '/controllers/service/add_service.php';
add_service();
break;
case "Add_Service_Endpoint":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service/add_service_endpoint.php';
+ require_once __DIR__
+ . '/controllers/service/add_service_endpoint.php';
add_service_endpoint();
break;
case "Delete_Service":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service/delete_service.php';
+ require_once __DIR__ . '/controllers/service/delete_service.php';
delete();
break;
case "Edit_User":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/user/edit_user.php';
+ require_once __DIR__ . '/controllers/user/edit_user.php';
edit_user();
break;
case "User":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/user/view_user.php';
+ require_once __DIR__ . '/controllers/user/view_user.php';
view_user();
break;
case "Remove_User_Identifier":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/user/delete_user_identifier.php';
+ require_once __DIR__
+ . '/controllers/user/delete_user_identifier.php';
delete_identifier();
break;
case "Downtime":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/downtime/view_downtime.php';
+ require_once __DIR__ . '/controllers/downtime/view_downtime.php';
view();
break;
case "My_Sites":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/my_sites.php';
+ require_once __DIR__ . '/controllers/my_sites.php';
my_sites();
break;
case "Edit_NGI":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/ngi/edit_ngi.php';
+ require_once __DIR__ . '/controllers/ngi/edit_ngi.php';
edit_ngi();
break;
case "Edit_Service_Group":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service_group/edit_service_group.php';
+ require_once __DIR__
+ . '/controllers/service_group/edit_service_group.php';
edit_service_group();
break;
case "Add_Service_Group_SEs":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service_group/add_ses.php';
+ require_once __DIR__ . '/controllers/service_group/add_ses.php';
add_ses();
break;
case "Search_SEs":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service_group/search_ses.php';
+ require_once __DIR__ . '/controllers/service_group/search_ses.php';
search_ses();
break;
case "Remove_Service_Group_SEs":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service_group/remove_ses.php';
+ require_once __DIR__ . '/controllers/service_group/remove_ses.php';
remove_ses();
break;
case "Add_Site":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/site/add_site.php';
+ require_once __DIR__ . '/controllers/site/add_site.php';
add_site();
break;
case "SGroup_Downtimes":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service_group/view_sgroup_downtimes.php';
+ require_once __DIR__
+ . '/controllers/service_group/view_sgroup_downtimes.php';
view_sgroup_downtimes();
break;
case "Add_Service_Group":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service_group/add_service_group.php';
+ require_once __DIR__
+ . '/controllers/service_group/add_service_group.php';
add_service_group();
break;
case "Site_Downtimes":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/site/site_downtimes.php';
+ require_once __DIR__ . '/controllers/site/site_downtimes.php';
site_downtimes();
break;
case "Register":
- rejectIfNotAuthenticated('Access denied - '
- . 'you need to be pre-authenticated before you can register a new account');
- require_once __DIR__.'/controllers/user/register.php';
+ rejectIfNotAuthenticated(
+ 'Access denied - you need to be pre-authenticated before '
+ . 'you can register a new account'
+ );
+ require_once __DIR__ . '/controllers/user/register.php';
register();
break;
case "Add_Downtime":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/downtime/add_downtime.php';
- //require_once __DIR__.'/controllers/downtime/add_downtime_old.php';
+ require_once __DIR__ . '/controllers/downtime/add_downtime.php';
add();
break;
case "Edit_Downtime":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/downtime/edit_downtime.php';
- //require_once __DIR__.'/controllers/downtime/edit_downtime_old.php';
+ require_once __DIR__ . '/controllers/downtime/edit_downtime.php';
edit();
break;
case "End_Downtime":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/downtime/end_downtime.php';
+ require_once __DIR__ . '/controllers/downtime/end_downtime.php';
endDt();
break;
case "Downtime_view_endpoint_tree":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/downtime/view_endpoint_tree.php';
+ require_once __DIR__
+ . '/controllers/downtime/view_endpoint_tree.php';
getServiceandEndpointList();
break;
case "Edit_Downtime_view_endpoint_tree":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/downtime/view_endpoint_tree.php';
+ require_once __DIR__
+ . '/controllers/downtime/view_endpoint_tree.php';
editDowntimePopulateEndpointTree();
break;
case "Downtime_View_Services":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/downtime/view_services.php';
+ require_once __DIR__ . '/controllers/downtime/view_services.php';
getSitesServices();
break;
case "Delete_Site":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/site/delete_site.php';
+ require_once __DIR__ . '/controllers/site/delete_site.php';
delete();
break;
case "Delete_Downtime":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/downtime/delete_downtime.php';
+ require_once __DIR__ . '/controllers/downtime/delete_downtime.php';
delete();
break;
case "Downtimes_Overview":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/downtime/downtimes_overview.php';
+ require_once __DIR__
+ . '/controllers/downtime/downtimes_overview.php';
view();
break;
case "Downtimes_Calendar":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/downtime/downtimes_calendar.php';
+ require_once __DIR__
+ . '/controllers/downtime/downtimes_calendar.php';
view();
break;
case "Delete_Service_Group":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service_group/delete_service_group.php';
+ require_once __DIR__
+ . '/controllers/service_group/delete_service_group.php';
delete();
break;
case "Delete_User":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/user/delete_user.php';
+ require_once __DIR__ . '/controllers/user/delete_user.php';
delete();
break;
case "Edit_Certification_Status":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/site/edit_cert_status.php';
+ require_once __DIR__ . '/controllers/site/edit_cert_status.php';
edit();
break;
case "Remove_Project_NGIs":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/project/remove_ngis.php';
+ require_once __DIR__ . '/controllers/project/remove_ngis.php';
remove_ngis_project();
break;
case "Add_Project_NGIs":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/project/add_ngis.php';
+ require_once __DIR__ . '/controllers/project/add_ngis.php';
add_ngis_to_project();
break;
case "Edit_Project":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/project/edit_project.php';
+ require_once __DIR__ . '/controllers/project/edit_project.php';
edit_project();
break;
case "Delete_Project":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/project/delete_project.php';
+ require_once __DIR__ . '/controllers/project/delete_project.php';
delete_project();
break;
case "Admin_Move_Site":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/move_site.php';
+ require_once __DIR__ . '/controllers/admin/move_site.php';
move_site();
break;
case "Admin_Move_SEP":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/move_service_end_point.php';
+ require_once __DIR__
+ . '/controllers/admin/move_service_end_point.php';
move_service_end_point();
break;
case "Service_Types":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service_type/view_service_types.php';
+ require_once __DIR__
+ . '/controllers/service_type/view_service_types.php';
show_all();
break;
case "Service_Type":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/service_type/view_service_type.php';
+ require_once __DIR__
+ . '/controllers/service_type/view_service_type.php';
view_service_type();
break;
case "Admin_Edit_Service_Type":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/edit_service_type.php';
+ require_once __DIR__ . '/controllers/admin/edit_service_type.php';
edit_type();
break;
case "Admin_Add_Service_Type":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/add_service_type.php';
+ require_once __DIR__ . '/controllers/admin/add_service_type.php';
add_type();
break;
case "Admin_Delete_Service_Type":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/delete_service_type.php';
+ require_once __DIR__ . '/controllers/admin/delete_service_type.php';
delete_service_type();
break;
case "Admin_Delete_Service_Type_Denied":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/delete_service_type_denied.php';
+ require_once __DIR__
+ . '/controllers/admin/delete_service_type_denied.php';
deny_delete_type();
break;
case "Admin_Add_NGI":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/add_ngi.php';
+ require_once __DIR__ . '/controllers/admin/add_ngi.php';
add_ngi();
break;
case "Admin_Users":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/users.php';
+ require_once __DIR__ . '/controllers/admin/users.php';
show_users();
break;
case "Admin_Edit_User_Identifier":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/edit_user_identifier.php';
+ require_once __DIR__
+ . '/controllers/admin/edit_user_identifier.php';
edit_identifier();
break;
-// case "Admin_Change_User_Admin_Status":
-// rejectIfNotAuthenticated();
-// require_once __DIR__.'/controllers/admin/edit_user_isadmin.php';
-// make_admin();
-// break;
case "Admin_Add_Project":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/add_project.php';
+ require_once __DIR__ . '/controllers/admin/add_project.php';
add_project();
break;
case "Admin_Remove_Scope":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/delete_scope.php';
+ require_once __DIR__ . '/controllers/admin/delete_scope.php';
remove_scope();
break;
case "Admin_Add_Scope":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/add_scope.php';
+ require_once __DIR__ . '/controllers/admin/add_scope.php';
add_scope();
break;
case "Admin_Edit_Scope":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/edit_scope.php';
+ require_once __DIR__ . '/controllers/admin/edit_scope.php';
edit_scope();
break;
case "Admin_Delete_NGI":
rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/admin/delete_ngi.php';
+ require_once __DIR__ . '/controllers/admin/delete_ngi.php';
delete_ngi();
break;
- case "Add_Site_Properties" :
+ case "Add_Site_Properties":
rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/site/add_site_properties.php';
- add_site_properties ();
+ add_site_properties();
break;
- case "Export_Properties" :
+ case "Export_Properties":
rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/export_properties.php';
- export ();
+ export();
break;
- case "Add_Service_Properties" :
+ case "Add_Service_Properties":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service/add_service_properties.php';
- add_service_properties ();
+ require_once __DIR__
+ . '/controllers/service/add_service_properties.php';
+ add_service_properties();
break;
- case "Add_Endpoint_Properties" :
+ case "Add_Endpoint_Properties":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service/add_endpoint_properties.php';
- add_endpoint_properties ();
+ require_once __DIR__
+ . '/controllers/service/add_endpoint_properties.php';
+ add_endpoint_properties();
break;
- case "Delete_Service_Properties" :
+ case "Delete_Service_Properties":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service/delete_service_properties.php';
- delete ();
+ require_once __DIR__
+ . '/controllers/service/delete_service_properties.php';
+ delete();
break;
- case "Delete_Site_Properties" :
+ case "Delete_Site_Properties":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/site/delete_site_properties.php';
- delete ();
+ require_once __DIR__
+ . '/controllers/site/delete_site_properties.php';
+ delete();
break;
- case "Service_Properties_Controller" :
+ case "Service_Properties_Controller":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service/service_properties_controller.php';
- control ();
+ require_once __DIR__
+ . '/controllers/service/service_properties_controller.php';
+ control();
break;
- case "Endpoint_Properties_Controller" :
+ case "Endpoint_Properties_Controller":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service/endpoint_properties_controller.php';
- control ();
+ require_once __DIR__
+ . '/controllers/service/endpoint_properties_controller.php';
+ control();
break;
- case "Site_Properties_Controller" :
+ case "Site_Properties_Controller":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/site/site_properties_controller.php';
- control ();
+ require_once __DIR__
+ . '/controllers/site/site_properties_controller.php';
+ control();
break;
- case "Service_Group_Properties_Controller" :
+ case "Service_Group_Properties_Controller":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service_group/service_group_properties_controller.php';
- control ();
+ require_once __DIR__
+ . '/controllers/service_group'
+ . '/service_group_properties_controller.php';
+ control();
break;
- case "Delete_Endpoint_Properties" :
+ case "Delete_Endpoint_Properties":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service/delete_endpoint_properties.php';
- delete ();
+ require_once __DIR__
+ . '/controllers/service/delete_endpoint_properties.php';
+ delete();
break;
- case "Edit_Site_Property" :
+ case "Edit_Site_Property":
rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/site/edit_site_property.php';
- edit_property ();
+ edit_property();
break;
- case "Edit_Service_Property" :
+ case "Edit_Service_Property":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service/edit_service_property.php';
- edit_property ();
+ require_once __DIR__
+ . '/controllers/service/edit_service_property.php';
+ edit_property();
break;
- case "Edit_Endpoint_Property" :
+ case "Edit_Endpoint_Property":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service/edit_endpoint_property.php';
- edit_property ();
+ require_once __DIR__
+ . '/controllers/service/edit_endpoint_property.php';
+ edit_property();
break;
- case "Add_Service_Group_Properties" :
+ case "Add_Service_Group_Properties":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service_group/add_service_group_properties.php';
- add_service_group_properties ();
+ require_once __DIR__
+ . '/controllers/service_group'
+ . '/add_service_group_properties.php';
+ add_service_group_properties();
break;
- case "Edit_Service_Group_Property" :
+ case "Edit_Service_Group_Property":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service_group/edit_service_group_property.php';
- edit_property ();
+ require_once __DIR__
+ . '/controllers/service_group/edit_service_group_property.php';
+ edit_property();
break;
- case "Delete_Service_Group_Properties" :
+ case "Delete_Service_Group_Properties":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service_group/delete_service_group_properties.php';
- delete ();
+ require_once __DIR__
+ . '/controllers/service_group'
+ . '/delete_service_group_properties.php';
+ delete();
break;
- case "Delete_Service_Endpoint" :
+ case "Delete_Service_Endpoint":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service/delete_service_endpoint.php';
+ require_once __DIR__
+ . '/controllers/service/delete_service_endpoint.php';
delete_endpoint();
break;
- case "Edit_Service_Endpoint" :
+ case "Edit_Service_Endpoint":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service/edit_service_endpoint.php';
+ require_once __DIR__
+ . '/controllers/service/edit_service_endpoint.php';
edit_endpoint();
break;
- case "Add_API_Authentication_Entity" :
+ case "Add_API_Authentication_Entity":
rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/site/add_api_auth.php';
add_entity();
break;
- case "Edit_API_Authentication_Entity" :
+ case "Edit_API_Authentication_Entity":
rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/site/edit_api_auth.php';
edit_entity();
break;
- case "Delete_API_Authentication_Entity" :
+ case "Delete_API_Authentication_Entity":
rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/site/delete_api_auth.php';
delete_entity();
break;
- case "Link_Identity" :
+ case "Link_Identity":
rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/user/link_identity.php';
link_identity();
break;
- case "User_Validate_Identity_Link" :
+ case "User_Validate_Identity_Link":
rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/user/link_identity_user_validate.php';
+ require_once __DIR__
+ . '/controllers/user/link_identity_user_validate.php';
validate_identity_link();
break;
default:
- // require auth by default
- rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/start_page.php';
- startPage();
- break;
+ // require auth by default
+ rejectIfNotAuthenticated();
+ require_once __DIR__ . '/controllers/start_page.php';
+ startPage();
+ break;
}
}
/* Draws a static HTML page */
-function Draw_Static_HTML() {
+function Draw_Static_HTML()
+{
$Page_Name = Get_Static_Page_Name();
$Page_Content = Get_Static_Page_Contents($Page_Name);
Draw_Standard_Page($Page_Content);
@@ -663,46 +712,57 @@ function Draw_Static_HTML() {
/* Finds out if a static page has been requested. If it has, return
* the page name, otherwise return a blank string. */
-function Get_Static_Page_Name() {
- if(!isset($_REQUEST['Page'])) {
+function Get_Static_Page_Name()
+{
+ if (!isset($_REQUEST['Page'])) {
return "";
} else {
- return $_REQUEST['Page'].'.html';
+ return $_REQUEST['Page'] . '.html';
}
}
/* Get the contents of the static HTML page specified in $Page_Name
* if the page name isn't specified then return a blank string */
-function Get_Static_Page_Contents($Page_Name) {
- require_once __DIR__.'/components/Draw_Components/draw_page_components.php';
- $htmlDir = __DIR__."/static_html";
+function Get_Static_Page_Contents($Page_Name)
+{
+ require_once __DIR__
+ . '/components/Draw_Components/draw_page_components.php';
+
+ $htmlDir = __DIR__ . "/static_html";
$Available_Static_Pages = Get_Directory_Contents($htmlDir);
- if(!isset($Available_Static_Pages[$Page_Name])) {
+
+ if (!isset($Available_Static_Pages[$Page_Name])) {
return "";
}
- $HTML = Get_File_Contents($htmlDir."/".$Page_Name);
+
+ $HTML = Get_File_Contents($htmlDir . "/" . $Page_Name);
+
return $HTML;
}
/* Returns the contents of a specified directory name */
-function Get_Directory_Contents($Directory_Name) {
- if ($File_Handle = opendir($Directory_Name))
- {
+function Get_Directory_Contents($Directory_Name)
+{
+ if ($File_Handle = opendir($Directory_Name)) {
while (false !== ($Filename = readdir($File_Handle)))
$File_List[$Filename] = true;
}
closedir($File_Handle);
+
return $File_List;
}
/* Draws a standard GOCDB layout with the string $Page_Content in the
* right frame */
-function Draw_Standard_Page($Page_Content, $title=null) {
- require_once __DIR__.'/components/Draw_Components/draw_page_components.php';
+function Draw_Standard_Page($Page_Content, $title = null)
+{
+ require_once __DIR__
+ . '/components/Draw_Components/draw_page_components.php';
+
$HTML = "";
$HTML .= Get_Standard_Top_Section_HTML($title);
$HTML .= $Page_Content;
@@ -714,17 +774,22 @@ function Draw_Standard_Page($Page_Content, $title=null) {
/* Given the name of a file in the view directory, include it
* as the body of a standard GOCDB page */
-function show_view($view, $params=null, $title=null, $rawOutput=null) {
- if($rawOutput == true) {
- require_once __DIR__.'/views/'.$view;
+function show_view($view, $params = null, $title = null, $rawOutput = null)
+{
+ if ($rawOutput == true) {
+ require_once __DIR__ . '/views/' . $view;
+
return;
}
- require_once __DIR__.'/components/Draw_Components/draw_page_components.php';
+ require_once __DIR__
+ . '/components/Draw_Components/draw_page_components.php';
+
echo Get_Standard_Top_Section_HTML($title);
- require_once __DIR__.'/views/'.$view;
- echo Get_Standard_Bottom_Section_HTML();
+ require_once __DIR__ . '/views/' . $view;
+
+ echo Get_Standard_Bottom_Section_HTML();
}
/**
@@ -756,15 +821,23 @@ function show_view($view, $params=null, $title=null, $rawOutput=null) {
*
*
* @see http://en.wikipedia.org/wiki/Post/Redirect/Get
- * @param string $logical_view A logical view name to render by index.php, e.g. 'New_Site' or 'Static_HTML'
- * (this takes precidence over $absolute_view)
- * @param string $absolute_view Relative path to a view template file (only if $logical_view is null),
- * e.g. 'static_html/somepage.html'
- * @param array $params associative array of key value pairs for HTTP GET request params.
+ *
+ * @param string $logical_view A logical view name to render by index.php,
+ * e.g. 'New_Site' or 'Static_HTML'
+ * (this takes precidence over $absolute_view)
+ * @param string $absolute_view Relative path to a view template file
+ * (only if $logical_view is null),
+ * e.g. 'static_html/somepage.html'
+ * @param array $params associative array of key value pairs
+ * for HTTP GET request params.
* The params are converted into a suitable URL-encoded query string.
* @throws RuntimeException if $params is not null and not an array
*/
- function redirect_view($logical_view = null, $absolute_view = null, $params = null) {
+function redirect_view(
+ $logical_view = null,
+ $absolute_view = null,
+ $params = null
+) {
if ($params != null && !is_array($params)) {
throw new RuntimeException('Params must be an associative array');
}
@@ -772,14 +845,16 @@ function redirect_view($logical_view = null, $absolute_view = null, $params = nu
if ($logical_view != null) {
// redirect to the specified logical view
$path_params = 'index.php?Page_Type=' . $logical_view;
+
if ($params != null) {
- $path_params .= '&'. http_build_query($params);
+ $path_params .= '&' . http_build_query($params);
}
- } else if ($absolute_view != null) {
+ } elseif ($absolute_view != null) {
// redirect directly to the specified absolute view
$path_params = $absolute_view;
+
if ($params != null) {
- $path_params .= '?'. http_build_query($params);
+ $path_params .= '?' . http_build_query($params);
}
} else {
// show the home page by default
@@ -789,9 +864,11 @@ function redirect_view($logical_view = null, $absolute_view = null, $params = nu
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
- // Send the 'Location' header to send a REDIRECT (302) header back to the browser
+ /**
+ * Send the 'Location' header to send a REDIRECT (302)
+ * header back to the browser
+ */
header("Location: https://$host$uri/$path_params");
- exit; // ensure no code gets executed after the redirect
- }
-?>
+ exit; // ensure no code gets executed after the redirect
+}
diff --git a/htdocs/web_portal/views/admin/added_service_type.php b/htdocs/web_portal/views/admin/added_service_type.php
index 21f7ba52d..2c271a073 100644
--- a/htdocs/web_portal/views/admin/added_service_type.php
+++ b/htdocs/web_portal/views/admin/added_service_type.php
@@ -5,7 +5,5 @@
- Click here to view the service type.
-
-
+ Click here to view the service type.
diff --git a/htdocs/web_portal/views/admin/delete_service_type_denied.php b/htdocs/web_portal/views/admin/delete_service_type_denied.php
index b3fad629a..f759ea49b 100644
--- a/htdocs/web_portal/views/admin/delete_service_type_denied.php
+++ b/htdocs/web_portal/views/admin/delete_service_type_denied.php
@@ -7,16 +7,17 @@
$serviceTypeRelPath = "index.php?Page_Type=Service_Type";
?>
- getName());?>
+ getName()); ?>
'
can not be deleted as the following services are still of this type:
"
- . "getId() ."\">"
- . xssafe($sep->getHostName())
- . " ";
- }
+ foreach ($params['Services'] as $sep) {
+ echo " "
+ . "getId() . "\">"
+ . xssafe($sep->getHostName())
+ . " ";
+ }
?>