@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * <base_url>/copyright.php after deploying the software |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | -require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
| 22 | +require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php"; |
|
| 23 | 23 | $admin = filter_input(INPUT_GET, 'admin', FILTER_VALIDATE_INT); |
| 24 | 24 | $sp = filter_input(INPUT_GET, 'sp', FILTER_VALIDATE_INT); |
| 25 | 25 | $givenRealm = filter_input(INPUT_GET, 'realm', FILTER_SANITIZE_STRING); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | unset($q_el[$idx]); |
| 36 | 36 | $q_r = preg_replace("/\?.*/", "", $_SERVER['REQUEST_URI']); |
| 37 | 37 | if (count($q_el)) { |
| 38 | - $q_r = $q_r . '?' . implode('&', $q_el); |
|
| 38 | + $q_r = $q_r.'?'.implode('&', $q_el); |
|
| 39 | 39 | } |
| 40 | 40 | $_SERVER['REQUEST_URI'] = $q_r; |
| 41 | 41 | } |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | $auth->authenticate(); |
| 45 | 45 | } |
| 46 | 46 | if (isset($_SESSION['admin_diag_auth'])) { |
| 47 | - $admin = 1; |
|
| 47 | + $admin = 1; |
|
| 48 | 48 | unset($_SESSION['admin_diag_auth']); |
| 49 | 49 | } |
| 50 | 50 | $Gui = new \web\lib\user\Gui(); |
| 51 | 51 | $skinObject = new \web\lib\user\Skinjob($_REQUEST['skin'] ?? $_SESSION['skin'] ?? $fedskin[0] ?? \config\Master::APPEARANCE['skins'][0]); |
| 52 | -require "../skins/" . $skinObject->skin . "/diag/diag.php"; |
|
| 52 | +require "../skins/".$skinObject->skin."/diag/diag.php"; |
|
| 53 | 53 | |
| 54 | 54 | |
@@ -98,98 +98,98 @@ |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | switch ($operationMode) { |
| 101 | - case OPERATION_MODE_EDIT: |
|
| 102 | - $idp = $validator->existingIdP($_GET['inst_id']); |
|
| 103 | - // editing IdPs is done from within the popup. When we're done, send the |
|
| 104 | - // user back to the popup (append the result of the operation later) |
|
| 105 | - $redirectDestination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&"; |
|
| 106 | - if (count($validAddresses) == 0) { |
|
| 107 | - header("Location: $redirectDestination" . "invitation=INVALIDSYNTAX"); |
|
| 108 | - exit(1); |
|
| 109 | - } |
|
| 110 | - // is the user primary admin of this IdP? |
|
| 111 | - $is_owner = $idp->isPrimaryOwner($_SESSION['user']); |
|
| 112 | - // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then. |
|
| 113 | - $fedadmin = $userObject->isFederationAdmin($idp->federation); |
|
| 114 | - // check if he is either one, if not, complain |
|
| 115 | - if (!$is_owner && !$fedadmin) { |
|
| 116 | - echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclatureFed, $uiElements->nomenclatureFed, $uiElements->nomenclatureInst) . "</p>"; |
|
| 117 | - exit(1); |
|
| 118 | - } |
|
| 101 | + case OPERATION_MODE_EDIT: |
|
| 102 | + $idp = $validator->existingIdP($_GET['inst_id']); |
|
| 103 | + // editing IdPs is done from within the popup. When we're done, send the |
|
| 104 | + // user back to the popup (append the result of the operation later) |
|
| 105 | + $redirectDestination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&"; |
|
| 106 | + if (count($validAddresses) == 0) { |
|
| 107 | + header("Location: $redirectDestination" . "invitation=INVALIDSYNTAX"); |
|
| 108 | + exit(1); |
|
| 109 | + } |
|
| 110 | + // is the user primary admin of this IdP? |
|
| 111 | + $is_owner = $idp->isPrimaryOwner($_SESSION['user']); |
|
| 112 | + // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then. |
|
| 113 | + $fedadmin = $userObject->isFederationAdmin($idp->federation); |
|
| 114 | + // check if he is either one, if not, complain |
|
| 115 | + if (!$is_owner && !$fedadmin) { |
|
| 116 | + echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclatureFed, $uiElements->nomenclatureFed, $uiElements->nomenclatureInst) . "</p>"; |
|
| 117 | + exit(1); |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - $prettyprintname = $idp->name; |
|
| 121 | - $newtokens = $mgmt->createTokens($fedadmin, $validAddresses, $idp); |
|
| 122 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . implode(",", $validAddresses)); |
|
| 123 | - $introtext = "CO-ADMIN"; |
|
| 124 | - $participant_type = $idp->type; |
|
| 125 | - break; |
|
| 126 | - case OPERATION_MODE_NEWUNLINKED: |
|
| 127 | - $redirectDestination = "../overview_federation.php?"; |
|
| 128 | - if (count($validAddresses) == 0) { |
|
| 129 | - header("Location: $redirectDestination"."invitation=INVALIDSYNTAX"); |
|
| 130 | - exit(1); |
|
| 131 | - } |
|
| 132 | - // run an input check and conversion of the raw inputs... just in case |
|
| 133 | - $newinstname = $validator->string($_POST['name']); |
|
| 134 | - $newcountry = $validator->string($_POST['country']); |
|
| 135 | - $participant_type = $validator->partType($_POST['participant_type']); |
|
| 136 | - $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry); |
|
| 137 | - if ($new_idp_authorized_fedadmin !== TRUE) { |
|
| 138 | - throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclatureInst . ", but are not a " . $uiElements->nomenclatureFed . " admin for the " . $uiElements->nomenclatureFed . " it should be in!"); |
|
| 139 | - } |
|
| 140 | - $federation = $validator->existingFederation($newcountry); |
|
| 141 | - $prettyprintname = $newinstname; |
|
| 142 | - $introtext = "NEW-FED"; |
|
| 143 | - // send the user back to his federation overview page, append the result of the operation later |
|
| 144 | - // do the token creation magic |
|
| 145 | - $newtokens = $mgmt->createTokens(TRUE, $validAddresses, $newinstname, 0, $newcountry, $participant_type); |
|
| 146 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "ORG FUTURE - Token created for $participant_type " . implode(",", $validAddresses)); |
|
| 147 | - break; |
|
| 148 | - case OPERATION_MODE_NEWFROMDB: |
|
| 149 | - $redirectDestination = "../overview_federation.php?"; |
|
| 150 | - if (count($validAddresses) == 0) { |
|
| 151 | - header("Location: $redirectDestination"."invitation=INVALIDSYNTAX"); |
|
| 152 | - exit(1); |
|
| 153 | - } |
|
| 154 | - // a real external DB entry was submitted and all the required parameters are there |
|
| 155 | - $newexternalid = $validator->string($_POST['externals']); |
|
| 156 | - $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid); |
|
| 157 | - $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']); |
|
| 158 | - if ($new_idp_authorized_fedadmin !== TRUE) { |
|
| 159 | - throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclatureInst . ", but are not a " . $uiElements->nomenclatureFed . " admin for the " . $uiElements->nomenclatureFed . " it should be in!"); |
|
| 160 | - } |
|
| 161 | - $federation = $validator->existingFederation($extinfo['country']); |
|
| 162 | - $newcountry = $extinfo['country']; |
|
| 163 | - // see if the inst name is defined in the currently set language; if not, pick its English name; if N/A, pick the last in the list |
|
| 164 | - $prettyprintname = ""; |
|
| 165 | - foreach ($extinfo['names'] as $lang => $name) { |
|
| 166 | - if ($lang == $languageInstance->getLang()) { |
|
| 167 | - $prettyprintname = $name; |
|
| 120 | + $prettyprintname = $idp->name; |
|
| 121 | + $newtokens = $mgmt->createTokens($fedadmin, $validAddresses, $idp); |
|
| 122 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . implode(",", $validAddresses)); |
|
| 123 | + $introtext = "CO-ADMIN"; |
|
| 124 | + $participant_type = $idp->type; |
|
| 125 | + break; |
|
| 126 | + case OPERATION_MODE_NEWUNLINKED: |
|
| 127 | + $redirectDestination = "../overview_federation.php?"; |
|
| 128 | + if (count($validAddresses) == 0) { |
|
| 129 | + header("Location: $redirectDestination"."invitation=INVALIDSYNTAX"); |
|
| 130 | + exit(1); |
|
| 168 | 131 | } |
| 169 | - } |
|
| 170 | - if ($prettyprintname == "" && isset($extinfo['names']['en'])) { |
|
| 171 | - $prettyprintname = $extinfo['names']['en']; |
|
| 172 | - } |
|
| 173 | - if ($prettyprintname == "") { |
|
| 174 | - foreach ($extinfo['names'] as $name) { |
|
| 175 | - $prettyprintname = $name; |
|
| 132 | + // run an input check and conversion of the raw inputs... just in case |
|
| 133 | + $newinstname = $validator->string($_POST['name']); |
|
| 134 | + $newcountry = $validator->string($_POST['country']); |
|
| 135 | + $participant_type = $validator->partType($_POST['participant_type']); |
|
| 136 | + $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry); |
|
| 137 | + if ($new_idp_authorized_fedadmin !== TRUE) { |
|
| 138 | + throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclatureInst . ", but are not a " . $uiElements->nomenclatureFed . " admin for the " . $uiElements->nomenclatureFed . " it should be in!"); |
|
| 176 | 139 | } |
| 177 | - } |
|
| 178 | - $participant_type = $extinfo['type']; |
|
| 179 | - // fill the rest of the text |
|
| 180 | - $introtext = "EXISTING-FED"; |
|
| 181 | - // do the token creation magic |
|
| 182 | - $newtokens = $mgmt->createTokens(TRUE, $validAddresses, $prettyprintname, $newexternalid); |
|
| 183 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . implode(",", $validAddresses)); |
|
| 184 | - break; |
|
| 185 | - default: // includes OPERATION_MODE_INVALID |
|
| 186 | - // second param is TRUE, so the variable *will* contain a string |
|
| 187 | - // i.e. ignore Scrutinizer type warning later |
|
| 188 | - $wrongcontent = print_r($_POST, TRUE); |
|
| 189 | - echo "<pre>Wrong parameters in POST: |
|
| 140 | + $federation = $validator->existingFederation($newcountry); |
|
| 141 | + $prettyprintname = $newinstname; |
|
| 142 | + $introtext = "NEW-FED"; |
|
| 143 | + // send the user back to his federation overview page, append the result of the operation later |
|
| 144 | + // do the token creation magic |
|
| 145 | + $newtokens = $mgmt->createTokens(TRUE, $validAddresses, $newinstname, 0, $newcountry, $participant_type); |
|
| 146 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "ORG FUTURE - Token created for $participant_type " . implode(",", $validAddresses)); |
|
| 147 | + break; |
|
| 148 | + case OPERATION_MODE_NEWFROMDB: |
|
| 149 | + $redirectDestination = "../overview_federation.php?"; |
|
| 150 | + if (count($validAddresses) == 0) { |
|
| 151 | + header("Location: $redirectDestination"."invitation=INVALIDSYNTAX"); |
|
| 152 | + exit(1); |
|
| 153 | + } |
|
| 154 | + // a real external DB entry was submitted and all the required parameters are there |
|
| 155 | + $newexternalid = $validator->string($_POST['externals']); |
|
| 156 | + $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid); |
|
| 157 | + $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']); |
|
| 158 | + if ($new_idp_authorized_fedadmin !== TRUE) { |
|
| 159 | + throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclatureInst . ", but are not a " . $uiElements->nomenclatureFed . " admin for the " . $uiElements->nomenclatureFed . " it should be in!"); |
|
| 160 | + } |
|
| 161 | + $federation = $validator->existingFederation($extinfo['country']); |
|
| 162 | + $newcountry = $extinfo['country']; |
|
| 163 | + // see if the inst name is defined in the currently set language; if not, pick its English name; if N/A, pick the last in the list |
|
| 164 | + $prettyprintname = ""; |
|
| 165 | + foreach ($extinfo['names'] as $lang => $name) { |
|
| 166 | + if ($lang == $languageInstance->getLang()) { |
|
| 167 | + $prettyprintname = $name; |
|
| 168 | + } |
|
| 169 | + } |
|
| 170 | + if ($prettyprintname == "" && isset($extinfo['names']['en'])) { |
|
| 171 | + $prettyprintname = $extinfo['names']['en']; |
|
| 172 | + } |
|
| 173 | + if ($prettyprintname == "") { |
|
| 174 | + foreach ($extinfo['names'] as $name) { |
|
| 175 | + $prettyprintname = $name; |
|
| 176 | + } |
|
| 177 | + } |
|
| 178 | + $participant_type = $extinfo['type']; |
|
| 179 | + // fill the rest of the text |
|
| 180 | + $introtext = "EXISTING-FED"; |
|
| 181 | + // do the token creation magic |
|
| 182 | + $newtokens = $mgmt->createTokens(TRUE, $validAddresses, $prettyprintname, $newexternalid); |
|
| 183 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . implode(",", $validAddresses)); |
|
| 184 | + break; |
|
| 185 | + default: // includes OPERATION_MODE_INVALID |
|
| 186 | + // second param is TRUE, so the variable *will* contain a string |
|
| 187 | + // i.e. ignore Scrutinizer type warning later |
|
| 188 | + $wrongcontent = print_r($_POST, TRUE); |
|
| 189 | + echo "<pre>Wrong parameters in POST: |
|
| 190 | 190 | " . htmlspecialchars(/** @scrutinizer ignore-type */ $wrongcontent) . " |
| 191 | 191 | </pre>"; |
| 192 | - exit(1); |
|
| 192 | + exit(1); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | // send, and invalidate the token immediately if the mail could not be sent! |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * <base_url>/copyright.php after deploying the software |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | -require_once dirname(dirname(dirname(__DIR__))) . "/config/_config.php"; |
|
| 23 | +require_once dirname(dirname(dirname(__DIR__)))."/config/_config.php"; |
|
| 24 | 24 | |
| 25 | 25 | $auth = new \web\lib\admin\Authentication(); |
| 26 | 26 | $auth->authenticate(); |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | $idp = $validator->existingIdP($_GET['inst_id']); |
| 103 | 103 | // editing IdPs is done from within the popup. When we're done, send the |
| 104 | 104 | // user back to the popup (append the result of the operation later) |
| 105 | - $redirectDestination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&"; |
|
| 105 | + $redirectDestination = "manageAdmins.inc.php?inst_id=".$idp->identifier."&"; |
|
| 106 | 106 | if (count($validAddresses) == 0) { |
| 107 | - header("Location: $redirectDestination" . "invitation=INVALIDSYNTAX"); |
|
| 107 | + header("Location: $redirectDestination"."invitation=INVALIDSYNTAX"); |
|
| 108 | 108 | exit(1); |
| 109 | 109 | } |
| 110 | 110 | // is the user primary admin of this IdP? |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | $fedadmin = $userObject->isFederationAdmin($idp->federation); |
| 114 | 114 | // check if he is either one, if not, complain |
| 115 | 115 | if (!$is_owner && !$fedadmin) { |
| 116 | - echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclatureFed, $uiElements->nomenclatureFed, $uiElements->nomenclatureInst) . "</p>"; |
|
| 116 | + echo "<p>".sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclatureFed, $uiElements->nomenclatureFed, $uiElements->nomenclatureInst)."</p>"; |
|
| 117 | 117 | exit(1); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $prettyprintname = $idp->name; |
| 121 | 121 | $newtokens = $mgmt->createTokens($fedadmin, $validAddresses, $idp); |
| 122 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . implode(",", $validAddresses)); |
|
| 122 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP ".$idp->identifier." - Token created for ".implode(",", $validAddresses)); |
|
| 123 | 123 | $introtext = "CO-ADMIN"; |
| 124 | 124 | $participant_type = $idp->type; |
| 125 | 125 | break; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $participant_type = $validator->partType($_POST['participant_type']); |
| 136 | 136 | $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry); |
| 137 | 137 | if ($new_idp_authorized_fedadmin !== TRUE) { |
| 138 | - throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclatureInst . ", but are not a " . $uiElements->nomenclatureFed . " admin for the " . $uiElements->nomenclatureFed . " it should be in!"); |
|
| 138 | + throw new Exception("Something's wrong... you want to create a new ".$uiElements->nomenclatureInst.", but are not a ".$uiElements->nomenclatureFed." admin for the ".$uiElements->nomenclatureFed." it should be in!"); |
|
| 139 | 139 | } |
| 140 | 140 | $federation = $validator->existingFederation($newcountry); |
| 141 | 141 | $prettyprintname = $newinstname; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | // send the user back to his federation overview page, append the result of the operation later |
| 144 | 144 | // do the token creation magic |
| 145 | 145 | $newtokens = $mgmt->createTokens(TRUE, $validAddresses, $newinstname, 0, $newcountry, $participant_type); |
| 146 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "ORG FUTURE - Token created for $participant_type " . implode(",", $validAddresses)); |
|
| 146 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "ORG FUTURE - Token created for $participant_type ".implode(",", $validAddresses)); |
|
| 147 | 147 | break; |
| 148 | 148 | case OPERATION_MODE_NEWFROMDB: |
| 149 | 149 | $redirectDestination = "../overview_federation.php?"; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid); |
| 157 | 157 | $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']); |
| 158 | 158 | if ($new_idp_authorized_fedadmin !== TRUE) { |
| 159 | - throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclatureInst . ", but are not a " . $uiElements->nomenclatureFed . " admin for the " . $uiElements->nomenclatureFed . " it should be in!"); |
|
| 159 | + throw new Exception("Something's wrong... you want to create a new ".$uiElements->nomenclatureInst.", but are not a ".$uiElements->nomenclatureFed." admin for the ".$uiElements->nomenclatureFed." it should be in!"); |
|
| 160 | 160 | } |
| 161 | 161 | $federation = $validator->existingFederation($extinfo['country']); |
| 162 | 162 | $newcountry = $extinfo['country']; |
@@ -180,14 +180,14 @@ discard block |
||
| 180 | 180 | $introtext = "EXISTING-FED"; |
| 181 | 181 | // do the token creation magic |
| 182 | 182 | $newtokens = $mgmt->createTokens(TRUE, $validAddresses, $prettyprintname, $newexternalid); |
| 183 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . implode(",", $validAddresses)); |
|
| 183 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for ".implode(",", $validAddresses)); |
|
| 184 | 184 | break; |
| 185 | 185 | default: // includes OPERATION_MODE_INVALID |
| 186 | 186 | // second param is TRUE, so the variable *will* contain a string |
| 187 | 187 | // i.e. ignore Scrutinizer type warning later |
| 188 | 188 | $wrongcontent = print_r($_POST, TRUE); |
| 189 | 189 | echo "<pre>Wrong parameters in POST: |
| 190 | -" . htmlspecialchars(/** @scrutinizer ignore-type */ $wrongcontent) . " |
|
| 190 | +" . htmlspecialchars(/** @scrutinizer ignore-type */ $wrongcontent)." |
|
| 191 | 191 | </pre>"; |
| 192 | 192 | exit(1); |
| 193 | 193 | } |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | if (count($status) == 0) { |
| 215 | - header("Location: $redirectDestination" . "invitation=FAILURE"); |
|
| 215 | + header("Location: $redirectDestination"."invitation=FAILURE"); |
|
| 216 | 216 | exit; |
| 217 | 217 | } |
| 218 | 218 | $finalDestParams = "invitation=SUCCESS"; |
| 219 | 219 | if (count($status) < count($totalSegments)) { // only a subset of mails was sent, update status |
| 220 | 220 | $finalDestParams = "invitation=PARTIAL"; |
| 221 | 221 | } |
| 222 | -$finalDestParams .= "&successcount=" . count($status); |
|
| 222 | +$finalDestParams .= "&successcount=".count($status); |
|
| 223 | 223 | if ($allEncrypted === TRUE) { |
| 224 | 224 | $finalDestParams .= "&transportsecurity=ENCRYPTED"; |
| 225 | 225 | } elseif ($allClear === TRUE) { |
@@ -228,4 +228,4 @@ discard block |
||
| 228 | 228 | $finalDestParams .= "&transportsecurity=PARTIAL"; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | -header("Location: $redirectDestination" . $finalDestParams); |
|
| 231 | +header("Location: $redirectDestination".$finalDestParams); |
|
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * ****************************************************************************** |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php"; |
|
| 12 | +require_once dirname(dirname(dirname(dirname(__FILE__))))."/config/_config.php"; |
|
| 13 | 13 | |
| 14 | 14 | $auth = new \web\lib\admin\Authentication(); |
| 15 | 15 | $auth->authenticate(); |
@@ -29,31 +29,31 @@ discard block |
||
| 29 | 29 | ?> |
| 30 | 30 | |
| 31 | 31 | <h1><?php $tablecaption = _("User Authentication Records"); echo $tablecaption; ?></h1> |
| 32 | -<p><?php echo _("Note that:");?></p> |
|
| 32 | +<p><?php echo _("Note that:"); ?></p> |
|
| 33 | 33 | <ul> |
| 34 | - <li><?php echo _("Authentication records are deleted after six months retention time");?></li> |
|
| 35 | - <li><?php echo _("Operator Domain is based on the RADIUS attribute 'Operator-Name' and not sent by all hotspots");?></li> |
|
| 36 | - <li><?php echo _("Different MAC addresses per credential may be due to MAC Address randomisation in recent operating systems");?></li> |
|
| 34 | + <li><?php echo _("Authentication records are deleted after six months retention time"); ?></li> |
|
| 35 | + <li><?php echo _("Operator Domain is based on the RADIUS attribute 'Operator-Name' and not sent by all hotspots"); ?></li> |
|
| 36 | + <li><?php echo _("Different MAC addresses per credential may be due to MAC Address randomisation in recent operating systems"); ?></li> |
|
| 37 | 37 | </ul> |
| 38 | 38 | <table class='authrecord'> |
| 39 | - <caption><?php echo $tablecaption;?></caption> |
|
| 39 | + <caption><?php echo $tablecaption; ?></caption> |
|
| 40 | 40 | <tr> |
| 41 | - <th scope="col"><strong><?php echo _("Timestamp");?></strong></th> |
|
| 42 | - <th scope="col"><strong><?php echo _("Credential");?></strong></th> |
|
| 43 | - <th scope="col"><strong><?php echo _("MAC Address");?></strong></th> |
|
| 44 | - <th scope="col"><strong><?php echo _("Result");?></strong></th> |
|
| 45 | - <th scope="col"><strong><?php echo _("Operator Domain");?></strong></th> |
|
| 41 | + <th scope="col"><strong><?php echo _("Timestamp"); ?></strong></th> |
|
| 42 | + <th scope="col"><strong><?php echo _("Credential"); ?></strong></th> |
|
| 43 | + <th scope="col"><strong><?php echo _("MAC Address"); ?></strong></th> |
|
| 44 | + <th scope="col"><strong><?php echo _("Result"); ?></strong></th> |
|
| 45 | + <th scope="col"><strong><?php echo _("Operator Domain"); ?></strong></th> |
|
| 46 | 46 | </tr> |
| 47 | 47 | <?php |
| 48 | 48 | $userAuthData = $profile->getUserAuthRecords($userInt); |
| 49 | 49 | foreach ($userAuthData as $oneRecord) { |
| 50 | - echo "<tr class='".($oneRecord['RESULT'] == "Access-Accept" ? "auth-success" : "auth-fail" )."'>" |
|
| 50 | + echo "<tr class='".($oneRecord['RESULT'] == "Access-Accept" ? "auth-success" : "auth-fail")."'>" |
|
| 51 | 51 | . "<td>".$oneRecord['TIMESTAMP']."</td>" |
| 52 | 52 | // $oneRecord['CN'] is a simple string, not an array, so disable Scrutinizer type check here |
| 53 | - . "<td>"./** @scrutinizer ignore-type */ substr_replace($oneRecord['CN'], "@…", strpos($oneRecord['CN'],"@"))."</td>" |
|
| 53 | + . "<td>"./** @scrutinizer ignore-type */ substr_replace($oneRecord['CN'], "@…", strpos($oneRecord['CN'], "@"))."</td>" |
|
| 54 | 54 | . "<td>".$oneRecord['MAC']."</td>" |
| 55 | 55 | . "<td>".($oneRecord['RESULT'] == "Access-Accept" ? _("Success") : _("Failure"))."</td>" |
| 56 | - . "<td>".substr($oneRecord['OPERATOR'] ?? "1(unknown)",1)."</td>" |
|
| 56 | + . "<td>".substr($oneRecord['OPERATOR'] ?? "1(unknown)", 1)."</td>" |
|
| 57 | 57 | . "</tr>"; |
| 58 | 58 | } |
| 59 | 59 | ?> |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | namespace core; |
| 23 | 23 | |
| 24 | -require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
| 24 | +require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php"; |
|
| 25 | 25 | |
| 26 | 26 | $instMgmt = new \core\UserManagement(); |
| 27 | 27 | $deco = new \web\lib\admin\PageDecoration(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | <?php echo $uiElements->infoblock($user->getAttributes(), "user", "User"); ?> |
| 60 | 60 | <tr> |
| 61 | 61 | <td> |
| 62 | -<?php echo "" . _("Unique Identifier") ?> |
|
| 62 | +<?php echo ""._("Unique Identifier") ?> |
|
| 63 | 63 | </td> |
| 64 | 64 | <td> |
| 65 | 65 | </td> |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | <div> |
| 73 | 73 | <?php |
| 74 | 74 | if (\config\Master::DB['USER']['readonly'] === FALSE) { |
| 75 | - echo "<a href='edit_user.php'><button>" . _("Edit User Details") . "</button></a>"; |
|
| 75 | + echo "<a href='edit_user.php'><button>"._("Edit User Details")."</button></a>"; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | if ($user->isFederationAdmin()) { |
| 79 | - echo "<form action='overview_federation.php' method='GET' accept-charset='UTF-8'><button type='submit'>" . sprintf(_('Click here for %s management tasks'), $uiElements->nomenclatureFed) . "</button></form>"; |
|
| 79 | + echo "<form action='overview_federation.php' method='GET' accept-charset='UTF-8'><button type='submit'>".sprintf(_('Click here for %s management tasks'), $uiElements->nomenclatureFed)."</button></form>"; |
|
| 80 | 80 | } |
| 81 | 81 | if ($user->isSuperadmin()) { |
| 82 | - echo "<form action='112365365321.php' method='GET' accept-charset='UTF-8'><button type='submit'>" . _('Click here to access the superadmin page') . "</button></form>"; |
|
| 82 | + echo "<form action='112365365321.php' method='GET' accept-charset='UTF-8'><button type='submit'>"._('Click here to access the superadmin page')."</button></form>"; |
|
| 83 | 83 | } |
| 84 | 84 | ?> |
| 85 | 85 | </div> |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL") { |
| 93 | 93 | $target = "https://wiki.geant.org/x/6Zg7Bw"; // Managed IdP manual |
| 94 | 94 | } |
| 95 | - $helptext = "<h3 style='display:inline;'>" . sprintf(_("(Need help? Refer to the <a href='%s'>%s administrator manual</a>)"), $target, $uiElements->nomenclatureInst) . "</h3>"; |
|
| 95 | + $helptext = "<h3 style='display:inline;'>".sprintf(_("(Need help? Refer to the <a href='%s'>%s administrator manual</a>)"), $target, $uiElements->nomenclatureInst)."</h3>"; |
|
| 96 | 96 | } else { |
| 97 | 97 | $helptext = ""; |
| 98 | 98 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | // we need to run the Federation constructor |
| 102 | 102 | $cat = new \core\CAT; |
| 103 | 103 | /// first parameter: number of Identity Providers; second param is the literal configured term for 'Identity Provider' (you may or may not be able to add a plural suffix for your locale) |
| 104 | - echo "<h2>" . sprintf(ngettext("You are managing the following <span style='display:none'>%d </span>%s:", "You are managing the following <strong>%d</strong> %s:", sizeof($hasInst)), sizeof($hasInst), $uiElements->nomenclatureParticipant) . "</h2>"; |
|
| 104 | + echo "<h2>".sprintf(ngettext("You are managing the following <span style='display:none'>%d </span>%s:", "You are managing the following <strong>%d</strong> %s:", sizeof($hasInst)), sizeof($hasInst), $uiElements->nomenclatureParticipant)."</h2>"; |
|
| 105 | 105 | $instlist = []; |
| 106 | 106 | $my_idps = []; |
| 107 | 107 | $myFeds = []; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | ?> |
| 126 | 126 | <table class='user_overview'> |
| 127 | - <caption><?php echo sprintf(_("%s Management Overview"),$uiElements->nomenclatureParticipant);?></caption> |
|
| 127 | + <caption><?php echo sprintf(_("%s Management Overview"), $uiElements->nomenclatureParticipant); ?></caption> |
|
| 128 | 128 | <tr> |
| 129 | 129 | <th scope='col'><?php echo sprintf(_("%s Name"), $uiElements->nomenclatureParticipant); ?></th> |
| 130 | 130 | <th scope="col"><?php echo sprintf(_("Other admins of this %s"), $uiElements->nomenclatureParticipant); ?></th> |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | <?php |
| 145 | 145 | foreach ($myFeds as $fed_id => $fed_name) { |
| 146 | 146 | /// nomenclature 'fed', fed name, nomenclature 'inst' |
| 147 | - echo "<tr><td colspan='4'><strong>" . sprintf(_("%s %s: %s list"), $uiElements->nomenclatureFed, $fed_name, $uiElements->nomenclatureParticipant) . "</strong></td></tr>"; |
|
| 147 | + echo "<tr><td colspan='4'><strong>".sprintf(_("%s %s: %s list"), $uiElements->nomenclatureFed, $fed_name, $uiElements->nomenclatureParticipant)."</strong></td></tr>"; |
|
| 148 | 148 | |
| 149 | 149 | $fedOrganisations = $my_idps[$fed_id]; |
| 150 | 150 | asort($fedOrganisations); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $the_inst = $oneinst['object']; |
| 154 | 154 | |
| 155 | 155 | echo "<tr>" |
| 156 | - . "<td>" . $oneinst['name'] . "</td>"; |
|
| 156 | + . "<td>".$oneinst['name']."</td>"; |
|
| 157 | 157 | echo "<td>"; |
| 158 | 158 | $admins = $the_inst->listOwners(); |
| 159 | 159 | $blessedUser = FALSE; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $coadmin = new \core\User($username['ID']); |
| 163 | 163 | $coadmin_name = $coadmin->getAttributes('user:realname'); |
| 164 | 164 | if (count($coadmin_name) > 0) { |
| 165 | - echo $coadmin_name[0]['value'] . "<br/>"; |
|
| 165 | + echo $coadmin_name[0]['value']."<br/>"; |
|
| 166 | 166 | unset($admins[$number]); |
| 167 | 167 | } |
| 168 | 168 | } else { // don't list self |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | echo "</td><td>"; |
| 179 | 179 | if ($blessedUser && \config\Master::DB['INST']['readonly'] === FALSE) { |
| 180 | - echo "<div style='white-space: nowrap;'><form method='post' action='inc/manageAdmins.inc.php?inst_id=" . $the_inst->identifier . "' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'><button type='submit'>" . _("Add/Remove Administrators") . "</button></form></div>"; |
|
| 180 | + echo "<div style='white-space: nowrap;'><form method='post' action='inc/manageAdmins.inc.php?inst_id=".$the_inst->identifier."' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'><button type='submit'>"._("Add/Remove Administrators")."</button></form></div>"; |
|
| 181 | 181 | } |
| 182 | 182 | echo "</td></tr>"; |
| 183 | 183 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | echo "</td><td>"; // danger zone |
| 218 | 218 | ?> |
| 219 | 219 | <form action='edit_participant_result.php?inst_id=<?php echo $the_inst->identifier; ?>' method='post' accept-charset='UTF-8'> |
| 220 | - <button class='delete' type='submit' name='submitbutton' value='<?php echo \web\lib\common\FormElements::BUTTON_DELETE; ?>' onclick="return confirm('<?php echo ( \config\ConfAssistant::CONSORTIUM['selfservice_registration'] === NULL ? sprintf(_("After deleting the %s, you can not recreate it yourself - you need a new invitation token from the %s administrator!"), $uiElements->nomenclatureInst, $uiElements->nomenclatureFed) . " " : "" ) . sprintf(_("Do you really want to delete your %s %s?"), $uiElements->nomenclatureParticipant, $my_inst->name); ?>')"><?php echo sprintf(_("Delete %s"), $uiElements->nomenclatureParticipant); ?></button> |
|
| 220 | + <button class='delete' type='submit' name='submitbutton' value='<?php echo \web\lib\common\FormElements::BUTTON_DELETE; ?>' onclick="return confirm('<?php echo (\config\ConfAssistant::CONSORTIUM['selfservice_registration'] === NULL ? sprintf(_("After deleting the %s, you can not recreate it yourself - you need a new invitation token from the %s administrator!"), $uiElements->nomenclatureInst, $uiElements->nomenclatureFed)." " : "").sprintf(_("Do you really want to delete your %s %s?"), $uiElements->nomenclatureParticipant, $my_inst->name); ?>')"><?php echo sprintf(_("Delete %s"), $uiElements->nomenclatureParticipant); ?></button> |
|
| 221 | 221 | </form> |
| 222 | 222 | <form action='edit_participant_result.php?inst_id=<?php echo $the_inst->identifier; ?>' method='post' accept-charset='UTF-8'> |
| 223 | 223 | <button class='delete' type='submit' name='submitbutton' value='<?php echo \web\lib\common\FormElements::BUTTON_FLUSH_AND_RESTART; ?>' onclick="return confirm('<?php echo sprintf(_("This action will delete all properties of the %s and start over the configuration from scratch. Do you really want to reset all settings of the %s %s?"), $uiElements->nomenclatureParticipant, $uiElements->nomenclatureParticipant, $my_inst->name); ?>')"><?php echo sprintf(_("Reset all %s settings"), $uiElements->nomenclatureParticipant); ?></button> |
@@ -227,32 +227,32 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | $otherAdminCount = count($admins); // only the unnamed remain |
| 229 | 229 | if ($otherAdminCount > 0) { |
| 230 | - echo sprintf(ngettext("%d other user", "%d other users", $otherAdminCount),$otherAdminCount); |
|
| 230 | + echo sprintf(ngettext("%d other user", "%d other users", $otherAdminCount), $otherAdminCount); |
|
| 231 | 231 | } |
| 232 | 232 | echo "</td><td>"; |
| 233 | 233 | $isAdminMgmtAvailable = FALSE; |
| 234 | 234 | if ($blessedUser && \config\Master::DB['INST']['readonly'] === FALSE) { |
| 235 | 235 | $isAdminMgmtAvailable = TRUE; |
| 236 | 236 | } |
| 237 | - echo "<div style='white-space: nowrap;'><form method='post' action='inc/manageAdmins.inc.php?inst_id=" . $the_inst->identifier . "' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'><button type='submit' ". ($isAdminMgmtAvailable ? "" : "disabled") .">" . _("Add/Remove Administrators") . "</button></form></div>"; |
|
| 237 | + echo "<div style='white-space: nowrap;'><form method='post' action='inc/manageAdmins.inc.php?inst_id=".$the_inst->identifier."' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'><button type='submit' ".($isAdminMgmtAvailable ? "" : "disabled").">"._("Add/Remove Administrators")."</button></form></div>"; |
|
| 238 | 238 | echo "</td></tr>"; |
| 239 | 239 | } |
| 240 | 240 | ?> |
| 241 | 241 | </table> |
| 242 | 242 | <?php |
| 243 | 243 | } else { |
| 244 | - echo "<h2>" . sprintf(_("You are not managing any %s."), $uiElements->nomenclatureInst) . "</h2>"; |
|
| 244 | + echo "<h2>".sprintf(_("You are not managing any %s."), $uiElements->nomenclatureInst)."</h2>"; |
|
| 245 | 245 | } |
| 246 | 246 | if (\config\Master::DB['INST']['readonly'] === FALSE) { |
| 247 | 247 | if (\config\ConfAssistant::CONSORTIUM['selfservice_registration'] === NULL) { |
| 248 | - echo "<p>" . sprintf(_("Please ask your %s administrator to invite you to become an %s administrator."), $uiElements->nomenclatureFed, $uiElements->nomenclatureParticipant) . "</p>"; |
|
| 248 | + echo "<p>".sprintf(_("Please ask your %s administrator to invite you to become an %s administrator."), $uiElements->nomenclatureFed, $uiElements->nomenclatureParticipant)."</p>"; |
|
| 249 | 249 | echo "<hr/> |
| 250 | 250 | <div style='white-space: nowrap;'> |
| 251 | 251 | <form action='action_enrollment.php' method='get' accept-charset='UTF-8'>" . |
| 252 | - sprintf(_("Did you receive an invitation token to manage an %s? Please paste it here:"), $uiElements->nomenclatureParticipant) . |
|
| 252 | + sprintf(_("Did you receive an invitation token to manage an %s? Please paste it here:"), $uiElements->nomenclatureParticipant). |
|
| 253 | 253 | " <input type='text' id='token' name='token'/> |
| 254 | 254 | <button type='submit'>" . |
| 255 | - _("Go!") . " |
|
| 255 | + _("Go!")." |
|
| 256 | 256 | </button> |
| 257 | 257 | </form> |
| 258 | 258 | </div>"; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | <div style='white-space: nowrap;'> |
| 262 | 262 | <form action='action_enrollment.php' method='get'><button type='submit' accept-charset='UTF-8'> |
| 263 | 263 | <input type='hidden' id='token' name='token' value='SELF-REGISTER'/>" . |
| 264 | - sprintf(_("New %s Registration"), $uiElements->nomenclatureParticipant) . " |
|
| 264 | + sprintf(_("New %s Registration"), $uiElements->nomenclatureParticipant)." |
|
| 265 | 265 | </button> |
| 266 | 266 | </form> |
| 267 | 267 | </div>"; |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | class CertificationAuthorityEmbeddedECDSA extends EntityWithDBProperties implements CertificationAuthorityInterface |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - private const LOCATION_ROOT_CA = ROOT . "/config/SilverbulletClientCerts/rootca-ECDSA.pem"; |
|
| 20 | - private const LOCATION_ISSUING_CA = ROOT . "/config/SilverbulletClientCerts/real-ECDSA.pem"; |
|
| 21 | - private const LOCATION_ISSUING_KEY = ROOT . "/config/SilverbulletClientCerts/real-ECDSA.key"; |
|
| 22 | - private const LOCATION_CONFIG = ROOT . "/config/SilverbulletClientCerts/openssl-ECDSA.cnf"; |
|
| 19 | + private const LOCATION_ROOT_CA = ROOT."/config/SilverbulletClientCerts/rootca-ECDSA.pem"; |
|
| 20 | + private const LOCATION_ISSUING_CA = ROOT."/config/SilverbulletClientCerts/real-ECDSA.pem"; |
|
| 21 | + private const LOCATION_ISSUING_KEY = ROOT."/config/SilverbulletClientCerts/real-ECDSA.key"; |
|
| 22 | + private const LOCATION_CONFIG = ROOT."/config/SilverbulletClientCerts/openssl-ECDSA.cnf"; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * string with the PEM variant of the root CA |
@@ -66,29 +66,29 @@ discard block |
||
| 66 | 66 | parent::__construct(); |
| 67 | 67 | $this->rootPem = file_get_contents(CertificationAuthorityEmbeddedECDSA::LOCATION_ROOT_CA); |
| 68 | 68 | if ($this->rootPem === FALSE) { |
| 69 | - throw new Exception("Root CA PEM file not found: " . CertificationAuthorityEmbeddedECDSA::LOCATION_ROOT_CA); |
|
| 69 | + throw new Exception("Root CA PEM file not found: ".CertificationAuthorityEmbeddedECDSA::LOCATION_ROOT_CA); |
|
| 70 | 70 | } |
| 71 | 71 | $this->issuingCertRaw = file_get_contents(CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA); |
| 72 | 72 | if ($this->issuingCertRaw === FALSE) { |
| 73 | - throw new Exception("Issuing CA PEM file not found: " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA); |
|
| 73 | + throw new Exception("Issuing CA PEM file not found: ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA); |
|
| 74 | 74 | } |
| 75 | 75 | $rootParsed = openssl_x509_read($this->rootPem); |
| 76 | 76 | $issuingCertCandidate = openssl_x509_read($this->issuingCertRaw); |
| 77 | - if ($issuingCertCandidate === FALSE || is_resource($issuingCertCandidate)|| $rootParsed === FALSE) { |
|
| 77 | + if ($issuingCertCandidate === FALSE || is_resource($issuingCertCandidate) || $rootParsed === FALSE) { |
|
| 78 | 78 | throw new Exception("At least one CA PEM file did not parse correctly (or not a PHP8 resource)!"); |
| 79 | 79 | } |
| 80 | 80 | $this->issuingCert = $issuingCertCandidate; |
| 81 | 81 | |
| 82 | 82 | if (stat(CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY) === FALSE) { |
| 83 | - throw new Exception("Private key not found: " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY); |
|
| 83 | + throw new Exception("Private key not found: ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY); |
|
| 84 | 84 | } |
| 85 | - $issuingKeyTemp = openssl_pkey_get_private("file://" . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY); |
|
| 85 | + $issuingKeyTemp = openssl_pkey_get_private("file://".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY); |
|
| 86 | 86 | if ($issuingKeyTemp === FALSE || is_resource($issuingKeyTemp)) { |
| 87 | 87 | throw new Exception("The private key did not parse correctly (or not a PHP8 resource)!"); |
| 88 | 88 | } |
| 89 | 89 | $this->issuingKey = $issuingKeyTemp; |
| 90 | 90 | if (stat(CertificationAuthorityEmbeddedECDSA::LOCATION_CONFIG) === FALSE) { |
| 91 | - throw new Exception("openssl configuration not found: " . CertificationAuthorityEmbeddedECDSA::LOCATION_CONFIG); |
|
| 91 | + throw new Exception("openssl configuration not found: ".CertificationAuthorityEmbeddedECDSA::LOCATION_CONFIG); |
|
| 92 | 92 | } |
| 93 | 93 | $this->conffile = CertificationAuthorityEmbeddedECDSA::LOCATION_CONFIG; |
| 94 | 94 | } |
@@ -131,27 +131,27 @@ discard block |
||
| 131 | 131 | // generate stub index.txt file |
| 132 | 132 | $tempdirArray = \core\common\Entity::createTemporaryDirectory("test"); |
| 133 | 133 | $tempdir = $tempdirArray['dir']; |
| 134 | - $nowIndexTxt = (new \DateTime())->format("ymdHis") . "Z"; |
|
| 135 | - $expiryIndexTxt = $originalExpiry->format("ymdHis") . "Z"; |
|
| 134 | + $nowIndexTxt = (new \DateTime())->format("ymdHis")."Z"; |
|
| 135 | + $expiryIndexTxt = $originalExpiry->format("ymdHis")."Z"; |
|
| 136 | 136 | // serials for our CA are always integers |
| 137 | 137 | $serialHex = strtoupper(dechex((int) $cert->serial)); |
| 138 | 138 | if (strlen($serialHex) % 2 == 1) { |
| 139 | - $serialHex = "0" . $serialHex; |
|
| 139 | + $serialHex = "0".$serialHex; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $indexStatement = "$certstatus\t$expiryIndexTxt\t" . ($certstatus == "R" ? "$nowIndexTxt,unspecified" : "") . "\t$serialHex\tunknown\t/O=" . \config\ConfAssistant::CONSORTIUM['name'] . "/OU=$federation/CN=$cert->username\n"; |
|
| 142 | + $indexStatement = "$certstatus\t$expiryIndexTxt\t".($certstatus == "R" ? "$nowIndexTxt,unspecified" : "")."\t$serialHex\tunknown\t/O=".\config\ConfAssistant::CONSORTIUM['name']."/OU=$federation/CN=$cert->username\n"; |
|
| 143 | 143 | $this->loggerInstance->debug(4, "index.txt contents-to-be: $indexStatement"); |
| 144 | - if (!file_put_contents($tempdir . "/index.txt", $indexStatement)) { |
|
| 144 | + if (!file_put_contents($tempdir."/index.txt", $indexStatement)) { |
|
| 145 | 145 | $this->loggerInstance->debug(1, "Unable to write openssl index.txt file for revocation handling!"); |
| 146 | 146 | } |
| 147 | 147 | // index.txt.attr is dull but needs to exist |
| 148 | - file_put_contents($tempdir . "/index.txt.attr", "unique_subject = yes\n"); |
|
| 148 | + file_put_contents($tempdir."/index.txt.attr", "unique_subject = yes\n"); |
|
| 149 | 149 | // call "openssl ocsp" to manufacture our own OCSP statement |
| 150 | 150 | // adding "-rmd sha1" to the following command-line makes the |
| 151 | 151 | // choice of signature algorithm for the response explicit |
| 152 | 152 | // but it's only available from openssl-1.1.0 (which we do not |
| 153 | 153 | // want to require just for that one thing). |
| 154 | - $execCmd = \config\Master::PATHS['openssl'] . " ocsp -issuer " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA . " -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA . " -rsigner " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA . " -rkey " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY . " -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der"; |
|
| 154 | + $execCmd = \config\Master::PATHS['openssl']." ocsp -issuer ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA." -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA." -rsigner ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA." -rkey ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY." -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der"; |
|
| 155 | 155 | $this->loggerInstance->debug(2, "Calling openssl ocsp with following cmdline: $execCmd\n"); |
| 156 | 156 | $output = []; |
| 157 | 157 | $return = 999; |
@@ -159,11 +159,11 @@ discard block |
||
| 159 | 159 | if ($return !== 0) { |
| 160 | 160 | throw new Exception("Non-zero return value from openssl ocsp!"); |
| 161 | 161 | } |
| 162 | - $ocsp = file_get_contents($tempdir . "/$serialHex.response.der"); |
|
| 162 | + $ocsp = file_get_contents($tempdir."/$serialHex.response.der"); |
|
| 163 | 163 | // remove the temp dir! |
| 164 | - unlink($tempdir . "/$serialHex.response.der"); |
|
| 165 | - unlink($tempdir . "/index.txt.attr"); |
|
| 166 | - unlink($tempdir . "/index.txt"); |
|
| 164 | + unlink($tempdir."/$serialHex.response.der"); |
|
| 165 | + unlink($tempdir."/index.txt.attr"); |
|
| 166 | + unlink($tempdir."/index.txt"); |
|
| 167 | 167 | rmdir($tempdir); |
| 168 | 168 | $this->databaseHandle->exec("UPDATE silverbullet_certificate SET OCSP = ?, OCSP_timestamp = NOW() WHERE serial_number = ?", "si", $ocsp, $cert->serial); |
| 169 | 169 | return $ocsp; |