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 04bbb02 commit 5db1463
Show file tree
Hide file tree
Showing 3 changed files with 26 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
8 changes: 4 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,8 @@
</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 +144,8 @@
</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 5db1463

Please sign in to comment.