diff --git a/config/web_portal/menu.xml b/config/web_portal/menu.xml
index ee39eb7f8..67be11229 100644
--- a/config/web_portal/menu.xml
+++ b/config/web_portal/menu.xml
@@ -1,99 +1,98 @@
-
-
- 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
+ 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
+ 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..711da138f 100644
--- a/htdocs/web_portal/controllers/service_type/view_service_type.php
+++ b/htdocs/web_portal/controllers/service_type/view_service_type.php
@@ -25,7 +25,6 @@
function view_service_type()
{
$params = [];
-
$identifier = Get_User_Principle();
$user = \Factory::getUserService()->getUserByPrinciple($identifier);
@@ -45,7 +44,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..eb2dc5305 100644
--- a/htdocs/web_portal/controllers/service_type/view_service_types.php
+++ b/htdocs/web_portal/controllers/service_type/view_service_types.php
@@ -22,10 +22,11 @@
require_once __DIR__ . '/../utils.php';
require_once __DIR__ . '/../../../web_portal/components/Get_User_Principle.php';
-function show_all(){
+function show_all()
+{
$serviceTypes = \Factory::getServiceTypeService()->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..109d21b72 100644
--- a/htdocs/web_portal/controllers/utils.php
+++ b/htdocs/web_portal/controllers/utils.php
@@ -10,16 +10,21 @@
*/
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;
}
@@ -47,14 +52,18 @@ function parse_properties($txtProperties)
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 +98,16 @@ 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 +117,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 +153,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 +164,7 @@ function getEntityScopesAsJSON2(
}
// Determine if this tag should be checked = t/f
$isChecked = $targetChecked;
+
if ($inheritScopeChecked) {
$isChecked = $parentChecked;
}
@@ -153,21 +175,42 @@ function getEntityScopesAsJSON2(
if ($parentChecked || $targetChecked) {
if ($parentChecked) {
// tag CAN be inherited from parent, so put in relevant array
- $resOptHeritScopeIds[] = array($scope->getId(), $scope->getName(), $isChecked);
+ $resOptHeritScopeIds[] = array(
+ $scope->getId(),
+ $scope->getName(),
+ $isChecked
+ );
} else {
- // tag CAN'T be inherited from parent, but it has already been directly assigned,
+ // 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);
+ $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;
@@ -188,14 +231,17 @@ function getEntityScopesAsJSON2(
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
@@ -205,10 +251,15 @@ 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;
}
}
@@ -228,22 +279,33 @@ function portalIsReadOnlyAndUserIsNotAdmin(\user $user = 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.");
+ 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);
@@ -256,7 +318,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"
+ );
}
}
@@ -275,14 +339,16 @@ function getSiteDataFromWeb()
'Country',
'ProductionStatus'
);
-
$siteData = [];
+
foreach ($fields as $field) {
$siteData[$field] = $_REQUEST [$field];
}
if (isset($_REQUEST['childServiceScopeAction'])) {
- $siteData['childServiceScopeAction'] = $_REQUEST['childServiceScopeAction'];
+ $siteData['childServiceScopeAction'] = $_REQUEST[
+ 'childServiceScopeAction'
+ ];
} else {
$siteData['childServiceScopeAction'] = 'noModify';
}
@@ -293,6 +359,7 @@ function getSiteDataFromWeb()
} else {
$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'];
@@ -309,7 +376,8 @@ function getSiteDataFromWeb()
}
/*
- * 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'];
@@ -342,19 +410,18 @@ function getSiteDataFromWeb()
$siteData ['Site'] [$field] = trim($_REQUEST [$field]);
}
- //Notifcations
+ // 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'];
}
- //
-
return $siteData;
}
@@ -368,7 +435,8 @@ function getSiteDataFromWeb()
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';
@@ -393,6 +461,7 @@ function getSGroupDataFromWeb()
} else {
$sGroup['Scope_ids'] = array ();
}
+
if (isset($_REQUEST ['ReservedScope_ids'])) {
$sGroup['ReservedScope_ids'] = $_REQUEST ['ReservedScope_ids'];
} else {
@@ -420,12 +489,14 @@ function getSeDataFromWeb()
'PRODUCTION_LEVEL'
);
$seData = [];
+
foreach ($fields as $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'])) {
@@ -445,7 +516,8 @@ function getSeDataFromWeb()
$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'])) {
@@ -475,6 +547,7 @@ function getSeDataFromWeb()
function getProjectDataFromWeb()
{
$projectValues = [];
+
// new projects won't have an id
if (isset($_REQUEST ['ID'])) {
$projectValues ['ID'] = $_REQUEST ['ID'];
@@ -489,8 +562,10 @@ function getProjectDataFromWeb()
foreach ($fields as $field) {
$projectValues [$field] = trim($_REQUEST [$field]);
}
+
return $projectValues;
}
+
function getNGIDataFromWeb()
{
// Get the NGI post data into an array
@@ -502,6 +577,7 @@ function getNGIDataFromWeb()
'GGUS_SU'
);
$ngiValues = [];
+
foreach ($fields as $field) {
$ngiValues [$field] = trim($_REQUEST [$field]);
}
@@ -517,12 +593,15 @@ function getNGIDataFromWeb()
// get scopes if any are selected, if not set as null
$optionalScopes = array();
+
if (isset($_REQUEST ['Scope_ids'])) {
$optionalScopes['Scope_ids'] = $_REQUEST ['Scope_ids'];
} else {
$optionalScopes['Scope_ids'] = array ();
}
+
$reservedScopes = array();
+
if (isset($_REQUEST ['ReservedScope_ids'])) {
$reservedScopes['ReservedScope_ids'] = $_REQUEST ['ReservedScope_ids'];
} else {
@@ -530,6 +609,7 @@ function getNGIDataFromWeb()
}
$id = null;
+
if (isset($_REQUEST ['ID'])) {
$id = $_REQUEST ['ID'];
}
@@ -561,17 +641,24 @@ function getDtDataFromWeb()
$downTime['DOWNTIME'] ['END_TIMESTAMP'] = $_REQUEST ['END_TIMESTAMP'];
$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'
+ // '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');
+ 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'];
}
@@ -588,16 +675,22 @@ function getSpDataFromWeb()
$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;
}
@@ -610,15 +703,21 @@ function getSerPropDataFromWeb()
$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 +727,26 @@ function getSerPropDataFromWeb()
function getEndpointPropDataFromWeb()
{
$endpointProp = array();
+
if (isset($_REQUEST ['PROP'])) {
$endpointProp['ENDPOINTPROPERTIES'] ['PROP'] = trim($_REQUEST ['PROP']);
}
+
if (isset($_REQUEST ['ENDPOINTID'])) {
- $endpointProp['ENDPOINTPROPERTIES']['ENDPOINTID'] = trim($_REQUEST ['ENDPOINTID']);
+ $endpointProp['ENDPOINTPROPERTIES']['ENDPOINTID'] = trim(
+ $_REQUEST ['ENDPOINTID']
+ );
}
+
if (isset($_REQUEST ['KEYPAIRNAME'])) {
$endpointProp['ENDPOINTPROPERTIES']['NAME'] = $_REQUEST ['KEYPAIRNAME'];
}
+
if (isset($_REQUEST ['KEYPAIRVALUE'])) {
- $endpointProp['ENDPOINTPROPERTIES']['VALUE'] = $_REQUEST ['KEYPAIRVALUE'];
+ $endpointProp['ENDPOINTPROPERTIES']['VALUE'] =
+ $_REQUEST['KEYPAIRVALUE'];
}
+
return $endpointProp;
}
@@ -649,12 +756,17 @@ function getEndpointPropDataFromWeb()
function getSerGroupPropDataFromWeb()
{
$serGroupProp = [];
- $serGroupProp['SERVICEGROUPPROPERTIES'] ['SERVICEGROUP'] = $_REQUEST ['SERVICEGROUP'];
- $serGroupProp['SERVICEGROUPPROPERTIES'] ['NAME'] = $_REQUEST ['KEYPAIRNAME'];
- $serGroupProp['SERVICEGROUPPROPERTIES'] ['VALUE'] = $_REQUEST ['KEYPAIRVALUE'];
+ $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;
}
@@ -667,15 +779,28 @@ function getEndpointDataFromWeb()
$endpoint['SERVICEENDPOINT'] ['SERVICE'] = $_REQUEST ['SERVICE'];
$endpoint['SERVICEENDPOINT'] ['NAME'] = trim($_REQUEST ['ENDPOINTNAME']);
$endpoint['SERVICEENDPOINT'] ['URL'] = trim($_REQUEST ['ENDPOINTURL']);
- $endpoint['SERVICEENDPOINT'] ['INTERFACENAME'] = trim($_REQUEST ['ENDPOINTINTERFACENAME']);
+ $endpoint['SERVICEENDPOINT'] ['INTERFACENAME'] = trim(
+ $_REQUEST ['ENDPOINTINTERFACENAME']
+ );
+
if (isset($_REQUEST ['DESCRIPTION'])) {
- $endpoint['SERVICEENDPOINT'] ['DESCRIPTION'] = trim($_REQUEST ['DESCRIPTION']);
+ $endpoint['SERVICEENDPOINT'] ['DESCRIPTION'] = trim(
+ $_REQUEST ['DESCRIPTION']
+ );
}
+
if (isset($_REQUEST ['ENDPOINTID'])) {
- $endpoint['SERVICEENDPOINT'] ['ENDPOINTID'] = trim($_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
+
+ /**
+ * 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'];
} else {
@@ -704,10 +829,12 @@ function getScopeDataFromWeb()
$scopeData = [];
$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');
}
+
if (array_key_exists('Id', $_REQUEST)) {
$scopeData['Id'] = $_REQUEST ['Id'];
}
@@ -726,11 +853,15 @@ function getSTDataFromWeb()
$serviceTypeData = [];
$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'];
}
@@ -739,7 +870,8 @@ function getSTDataFromWeb()
}
/**
- * 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
@@ -747,14 +879,16 @@ function getSTDataFromWeb()
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
*
@@ -763,7 +897,6 @@ function getAPIAuthenticationFromWeb()
*/
function getInfoMessage($code = null)
{
-
if ($code == null) {
$code = 'privacy-1';
}
@@ -780,12 +913,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 +940,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 +953,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..18fe33cf1 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);
+
die();
-} catch(Exception $e) {
+} 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) {
+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) {
+
+ 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');
@@ -126,15 +147,16 @@ function Draw_Page($Page_Type) {
// these pages will replace sensitive info such as telephone/email with
// the string 'PROTECTED'
// ************************************************************************
- switch($Page_Type) {
- case "default" :
+ switch ($Page_Type) {
+ case "default":
//rejectIfNotAuthenticated();
- require_once __DIR__.'/controllers/start_page.php';
+ require_once __DIR__ . '/controllers/start_page.php';
startPage();
break;
- case "View_Service_Endpoint" :
+ case "View_Service_Endpoint":
//rejectIfNotAuthenticated();
- require_once __DIR__ . '/controllers/service/view_service_endpoint.php';
+ require_once __DIR__
+ . '/controllers/service/view_service_endpoint.php';
view_endpoint();
break;
case "Service_Groups":
@@ -195,10 +217,10 @@ function Draw_Page($Page_Type) {
require_once __DIR__ . '/controllers/scope.php';
view_scope();
break;
- case "Site_Geo_xml" :
+ case "Site_Geo_xml":
//rejectIfNotAuthenticated();
require_once __DIR__ . '/controllers/sitesForMapXML.php';
- show_xml ();
+ show_xml();
break;
case "Error_Redirect":
//rejectIfNotAuthenticated();
@@ -210,289 +232,310 @@ function Draw_Page($Page_Type) {
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":
@@ -502,160 +545,180 @@ function Draw_Page($Page_Type) {
// 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 +726,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 +788,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 +835,22 @@ 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 +858,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 +877,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..0b7605ddf 100644
--- a/htdocs/web_portal/views/admin/added_service_type.php
+++ b/htdocs/web_portal/views/admin/added_service_type.php
@@ -6,6 +6,4 @@
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..622991c67 100644
--- a/htdocs/web_portal/views/admin/delete_service_type_denied.php
+++ b/htdocs/web_portal/views/admin/delete_service_type_denied.php
@@ -11,12 +11,13 @@
'
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())
+ . " ";
+ }
?>