Skip to content

Commit

Permalink
Fix misc PHP7.4 Notices and Warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Neilson authored and gregcorbett committed Oct 12, 2023
1 parent 4c236b9 commit 1ea3fa7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
30 changes: 21 additions & 9 deletions htdocs/web_portal/controllers/user/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,35 @@ function draw() {
die();
}

//Extract users email from oidc claims
$authDetails = $_SERVER['OIDC_CLAIM_external_authn'];
$startPos = 3+strpos($authDetails, ":", (strpos($authDetails, "MAIL")));
$endPos = strpos($authDetails, "\"", 3+$startPos);
$length = $endPos-$startPos;
$userEmail = substr($authDetails, $startPos, $length);
$params = [];

//Extract users email from oidc claims
$params['email'] = '';
if (key_exists('OIDC_CLAIM_external_authn', $_SERVER)) {
$authDetails = $_SERVER['OIDC_CLAIM_external_authn'];
$startPos = 3+strpos($authDetails, ":", (strpos($authDetails, "MAIL")));
$endPos = strpos($authDetails, "\"", 3+$startPos);
$length = $endPos-$startPos;
$params['email'] = substr($authDetails, $startPos, $length);
}

getPolicyURLs($params);

/* @var $authToken \org\gocdb\security\authentication\IAuthentication */
$authToken = Get_User_AuthToken();
$params['authAttributes'] = $authToken->getDetails();

$params['given_name'] = $_SERVER['OIDC_CLAIM_given_name'];
$params['family_name'] = $_SERVER['OIDC_CLAIM_family_name'];
$params['email'] = $userEmail;
$params['given_name'] = '';
if (key_exists('OIDC_CLAIM_given_name', $_SERVER)) {
$params['given_name'] = $_SERVER['OIDC_CLAIM_given_name'];
}
$params['family_name'] = '';
if (key_exists('OIDC_CLAIM_family_name', $_SERVER)) {
$params['family_name'] = $_SERVER['OIDC_CLAIM_family_name'];
}

$params['idString'] = $idString;

show_view('user/register.php', $params);
}

Expand Down
14 changes: 10 additions & 4 deletions htdocs/web_portal/views/political_role/view_requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@
</tr>
<?php
$num = 2;
if(sizeof($params['myRequests'] > 0)) {
foreach($params['myRequests'] as $request) {
if (
is_array($params['myRequests'])
&& sizeof($params['myRequests']) > 0
) {
foreach ($params['myRequests'] as $request) {
?>
<tr class="site_table_row_<?php echo $num ?>">
<td class="site_table" style="width: 50%">
Expand Down Expand Up @@ -144,8 +147,11 @@
</tr>
<?php
$num = 2;
if(sizeof($params['allRequests'] > 0)) {
foreach($params['allRequests'] as $request) {
if (
is_array($params['allRequests'])
&& sizeof($params['allRequests']) > 0
) {
foreach ($params['allRequests'] as $request) {
?>
<tr class="site_table_row_<?php echo $num ?>">
<td class="site_table">
Expand Down
2 changes: 1 addition & 1 deletion htdocs/web_portal/views/user/view_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
</div>
</td>
</tr>-->
<?php if (sizeof($params['user']->getHomeSite()) != 0) { ?>
<?php if ($params['user']->getHomeSite() != null) { ?>
<tr class="site_table_row_2">
<td class="site_table">Home Site</td>
<td class="site_table">
Expand Down

0 comments on commit 1ea3fa7

Please sign in to comment.