@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | namespace core\common; |
32 | 32 | |
33 | -require_once dirname(dirname(__DIR__)) . "/config/_config.php"; |
|
33 | +require_once dirname(dirname(__DIR__))."/config/_config.php"; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * This class maintains state of the selected language and can set the language. |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | $loggerInstance = new \core\common\Logging(); |
73 | 73 | $olddomain = textdomain(NULL); |
74 | 74 | $loggerInstance->debug(4, "set_locale($domain)\n"); |
75 | - $loggerInstance->debug(4, ROOT . "\n"); |
|
75 | + $loggerInstance->debug(4, ROOT."\n"); |
|
76 | 76 | textdomain($domain); |
77 | - bindtextdomain($domain, ROOT . "/translation/"); |
|
77 | + bindtextdomain($domain, ROOT."/translation/"); |
|
78 | 78 | return $olddomain; |
79 | 79 | } |
80 | 80 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $langConverted[] = $hardSetLang; |
97 | 97 | } |
98 | 98 | if (!empty($_REQUEST['lang'])) { |
99 | - $recoverLang = filter_input(INPUT_GET,'lang', FILTER_SANITIZE_STRING) ?? filter_input(INPUT_POST, 'lang', FILTER_SANITIZE_STRING); |
|
99 | + $recoverLang = filter_input(INPUT_GET, 'lang', FILTER_SANITIZE_STRING) ?? filter_input(INPUT_POST, 'lang', FILTER_SANITIZE_STRING); |
|
100 | 100 | $langConverted[] = $recoverLang; |
101 | 101 | } |
102 | 102 | CAT_session_start(); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $langConverted[] = $_SESSION['language']; |
105 | 105 | } |
106 | 106 | if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
107 | - $langs = explode(",", filter_input(INPUT_SERVER,"HTTP_ACCEPT_LANGUAGE", FILTER_SANITIZE_STRING)); |
|
107 | + $langs = explode(",", filter_input(INPUT_SERVER, "HTTP_ACCEPT_LANGUAGE", FILTER_SANITIZE_STRING)); |
|
108 | 108 | foreach ($langs as $lang) { |
109 | 109 | $result = []; |
110 | 110 | preg_match("/(.*);+.*/", $lang, $result); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | // check if this language is supported by the CAT config |
126 | 126 | foreach (CONFIG['LANGUAGES'] as $language => $value) { |
127 | - if (preg_match("/^" . $language . ".*/", $tryLang)) { |
|
127 | + if (preg_match("/^".$language.".*/", $tryLang)) { |
|
128 | 128 | $localeTmp = $value['locale']; |
129 | 129 | $langIndex = $language; // ??? |
130 | 130 | break; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | } |
141 | 141 | } |
142 | - putenv("LC_ALL=" . $theLocale); |
|
142 | + putenv("LC_ALL=".$theLocale); |
|
143 | 143 | $_SESSION['language'] = $langIndex; |
144 | 144 | $loggerInstance = new \core\common\Logging(); |
145 | 145 | $loggerInstance->debug(4, "selected lang:$langIndex:$theLocale\n"); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $returnArray = []; |
64 | 64 | $returnArray['status'] = $status; |
65 | 65 | $returnArray['data'] = $data; |
66 | - $returnArray['tou'] = "Please consult Terms of Use at: //" . $host . \core\CAT::getRootUrlPath() . "/tou.php"; |
|
66 | + $returnArray['tou'] = "Please consult Terms of Use at: //".$host.\core\CAT::getRootUrlPath()."/tou.php"; |
|
67 | 67 | if (!empty($otherData)) { |
68 | 68 | $returnArray['otherdata'] = $otherData; |
69 | 69 | } |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public function sendLogo($identifier, $type, $width = 0, $height = 0) { |
271 | 271 | $logo = $this->getLogo($identifier, $type, $width, $height); |
272 | - $blob = $logo === NULL ? file_get_contents(ROOT . '/web/resources/images/empty.png') : $logo['blob']; |
|
273 | - header("Content-type: " . $logo['filetype']); |
|
272 | + $blob = $logo === NULL ? file_get_contents(ROOT.'/web/resources/images/empty.png') : $logo['blob']; |
|
273 | + header("Content-type: ".$logo['filetype']); |
|
274 | 274 | header("Cache-Control:max-age=36000, must-revalidate"); |
275 | 275 | header($logo['expires']); |
276 | 276 | echo $blob; |
@@ -397,7 +397,6 @@ |
||
397 | 397 | * |
398 | 398 | * @param string $format only "der" and "pem" are currently allowed |
399 | 399 | * @return array an array of arrays or empty array on error |
400 | - |
|
401 | 400 | */ |
402 | 401 | final protected function saveCertificateFiles($format) { |
403 | 402 | switch ($format) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | protected function setSupportedEapMethods($eapArray) { |
84 | 84 | $this->supportedEapMethods = $eapArray; |
85 | - $this->loggerInstance->debug(4, "This device (" . __CLASS__ . ") supports the following EAP methods: "); |
|
85 | + $this->loggerInstance->debug(4, "This device (".__CLASS__.") supports the following EAP methods: "); |
|
86 | 86 | $this->loggerInstance->debug(4, $this->supportedEapMethods); |
87 | 87 | } |
88 | 88 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | throw new Exception("No EAP type available."); |
127 | 127 | } |
128 | 128 | $this->attributes = $this->getProfileAttributes($profile); |
129 | - $this->deviceUUID = common\Entity::uuid('', 'CAT' . $profile->institution . "-" . $profile->identifier . "-" . $this->device_id); |
|
129 | + $this->deviceUUID = common\Entity::uuid('', 'CAT'.$profile->institution."-".$profile->identifier."-".$this->device_id); |
|
130 | 130 | |
131 | 131 | |
132 | 132 | // if we are instantiating a Silverbullet profile AND have been given |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | // create temporary directory, its full path will be saved in $this->FPATH; |
151 | 151 | $tempDir = $this->createTemporaryDirectory($purpose); |
152 | 152 | $this->FPATH = $tempDir['dir']; |
153 | - mkdir($tempDir['dir'] . '/tmp'); |
|
154 | - chdir($tempDir['dir'] . '/tmp'); |
|
153 | + mkdir($tempDir['dir'].'/tmp'); |
|
154 | + chdir($tempDir['dir'].'/tmp'); |
|
155 | 155 | $caList = []; |
156 | 156 | $x509 = new \core\common\X509(); |
157 | 157 | if (isset($this->attributes['eap:ca_file'])) { |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | if (isset($this->attributes['general:logo_file'])) { |
173 | 173 | $this->loggerInstance->debug(5, "saving IDP logo\n"); |
174 | - $this->attributes['internal:logo_file'] = $this->saveLogoFile($this->attributes['general:logo_file'],'idp'); |
|
174 | + $this->attributes['internal:logo_file'] = $this->saveLogoFile($this->attributes['general:logo_file'], 'idp'); |
|
175 | 175 | } |
176 | 176 | if (isset($this->attributes['fed:logo_file'])) { |
177 | 177 | $this->loggerInstance->debug(5, "saving FED logo\n"); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $this->support_url_substitute = sprintf(_("your local %s support page"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']); |
188 | 188 | |
189 | 189 | if ($this->signer && $this->options['sign']) { |
190 | - $this->sign = ROOT . '/signer/' . $this->signer; |
|
190 | + $this->sign = ROOT.'/signer/'.$this->signer; |
|
191 | 191 | } |
192 | 192 | $this->installerBasename = $this->getInstallerBasename(); |
193 | 193 | common\Entity::outOfThePotatoes(); |
@@ -243,10 +243,10 @@ discard block |
||
243 | 243 | * @return string|boolean the filename as found, with path, or FALSE if it does not exist |
244 | 244 | */ |
245 | 245 | protected function findSourceFile($file) { |
246 | - if (is_file($this->module_path . '/Files/' . $this->device_id . '/' . $file)) { |
|
247 | - return $this->module_path . '/Files/' . $this->device_id . '/' . $file; |
|
248 | - } elseif (is_file($this->module_path . '/Files/' . $file)) { |
|
249 | - return $this->module_path . '/Files/' . $file; |
|
246 | + if (is_file($this->module_path.'/Files/'.$this->device_id.'/'.$file)) { |
|
247 | + return $this->module_path.'/Files/'.$this->device_id.'/'.$file; |
|
248 | + } elseif (is_file($this->module_path.'/Files/'.$file)) { |
|
249 | + return $this->module_path.'/Files/'.$file; |
|
250 | 250 | } else { |
251 | 251 | $this->loggerInstance->debug(2, "requested file $file does not exist\n"); |
252 | 252 | return FALSE; |
@@ -367,17 +367,17 @@ discard block |
||
367 | 367 | */ |
368 | 368 | private function getInstallerBasename() { |
369 | 369 | |
370 | - $baseName = $this->customTranslit(CONFIG_CONFASSISTANT['CONSORTIUM']['name']) . "-" . $this->getDeviceId(); |
|
370 | + $baseName = $this->customTranslit(CONFIG_CONFASSISTANT['CONSORTIUM']['name'])."-".$this->getDeviceId(); |
|
371 | 371 | if (isset($this->attributes['profile:customsuffix'][1])) { |
372 | 372 | // this string will end up as a filename on a filesystem, so always |
373 | 373 | // take a latin-based language variant if available |
374 | 374 | // and then scrub non-ASCII just in case |
375 | - return $baseName . $this->customTranslit($this->attributes['profile:customsuffix'][1]); |
|
375 | + return $baseName.$this->customTranslit($this->attributes['profile:customsuffix'][1]); |
|
376 | 376 | } |
377 | 377 | // Okay, no custom suffix. |
378 | 378 | // Use the configured inst name and apply shortening heuristics |
379 | 379 | $lang_pointer = CONFIG['LANGUAGES'][$this->languageInstance->getLang()]['latin_based'] == TRUE ? 0 : 1; |
380 | - $this->loggerInstance->debug(5, "getInstallerBasename1:" . $this->attributes['general:instname'][$lang_pointer] . "\n"); |
|
380 | + $this->loggerInstance->debug(5, "getInstallerBasename1:".$this->attributes['general:instname'][$lang_pointer]."\n"); |
|
381 | 381 | $inst = $this->customTranslit($this->attributes['general:instname'][$lang_pointer]); |
382 | 382 | $this->loggerInstance->debug(4, "getInstallerBasename2:$inst\n"); |
383 | 383 | $Inst_a = explode('_', $inst); |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | if (!empty($this->attributes['profile:name']) && !empty($this->attributes['profile:name'][$lang_pointer])) { |
393 | 393 | $profTemp = $this->customTranslit($this->attributes['profile:name'][$lang_pointer]); |
394 | 394 | $prof = preg_replace('/_+$/', '', $profTemp); |
395 | - return $baseName . $inst . '-' . $prof; |
|
395 | + return $baseName.$inst.'-'.$prof; |
|
396 | 396 | } |
397 | 397 | } |
398 | - return $baseName . $inst; |
|
398 | + return $baseName.$inst; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | /** |
@@ -463,13 +463,13 @@ discard block |
||
463 | 463 | * @return array |
464 | 464 | */ |
465 | 465 | private function getConsortia() { |
466 | - if(!isset(CONFIG_CONFASSISTANT['CONSORTIUM']['interworking-consortium-oi'])) { |
|
466 | + if (!isset(CONFIG_CONFASSISTANT['CONSORTIUM']['interworking-consortium-oi'])) { |
|
467 | 467 | return ([]); |
468 | 468 | } |
469 | 469 | $consortia = CONFIG_CONFASSISTANT['CONSORTIUM']['interworking-consortium-oi']; |
470 | 470 | if (isset($this->attributes['media:consortium_OI'])) { |
471 | 471 | foreach ($this->attributes['media:consortium_OI'] as $new_oi) { |
472 | - if(!in_array($new_oi, $consortia)) { |
|
472 | + if (!in_array($new_oi, $consortia)) { |
|
473 | 473 | $consortia[] = $new_oi; |
474 | 474 | } |
475 | 475 | } |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * @return array list of filenames and the mime types |
496 | 496 | * @throws Exception |
497 | 497 | */ |
498 | - private function saveLogoFile($logos,$type) { |
|
498 | + private function saveLogoFile($logos, $type) { |
|
499 | 499 | $iterator = 0; |
500 | 500 | $returnarray = []; |
501 | 501 | foreach ($logos as $blob) { |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | $ext = 'unsupported'; |
509 | 509 | } |
510 | 510 | $this->loggerInstance->debug(5, "saveLogoFile: $mime : $ext\n"); |
511 | - $fileName = 'logo-' . $type . $iterator . '.' . $ext; |
|
511 | + $fileName = 'logo-'.$type.$iterator.'.'.$ext; |
|
512 | 512 | $fileHandle = fopen($fileName, "w"); |
513 | 513 | if (!$fileHandle) { |
514 | 514 | $this->loggerInstance->debug(2, "saveLogoFile failed for: $fileName\n"); |
@@ -534,13 +534,13 @@ discard block |
||
534 | 534 | $mime = $finfo->buffer($blob); |
535 | 535 | $ext = isset($this->mime_extensions[$mime]) ? $this->mime_extensions[$mime] : 'usupported'; |
536 | 536 | $this->loggerInstance->debug(5, "saveInfoFile: $mime : $ext\n"); |
537 | - $fileHandle = fopen('local-info.' . $ext, "w"); |
|
537 | + $fileHandle = fopen('local-info.'.$ext, "w"); |
|
538 | 538 | if ($fileHandle === FALSE) { |
539 | 539 | throw new Exception("problem opening the file"); |
540 | 540 | } |
541 | 541 | fwrite($fileHandle, $blob); |
542 | 542 | fclose($fileHandle); |
543 | - return(['name' => 'local-info.' . $ext, 'mime' => $ext]); |
|
543 | + return(['name' => 'local-info.'.$ext, 'mime' => $ext]); |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | /** |
@@ -591,9 +591,9 @@ discard block |
||
591 | 591 | protected function determineOuterIdString() { |
592 | 592 | $outerId = NULL; |
593 | 593 | if (isset($this->attributes['internal:use_anon_outer']) && $this->attributes['internal:use_anon_outer'][0] == "1" && isset($this->attributes['internal:realm'])) { |
594 | - $outerId = "@" . $this->attributes['internal:realm'][0]; |
|
594 | + $outerId = "@".$this->attributes['internal:realm'][0]; |
|
595 | 595 | if (isset($this->attributes['internal:anon_local_value'])) { |
596 | - $outerId = $this->attributes['internal:anon_local_value'][0] . $outerId; |
|
596 | + $outerId = $this->attributes['internal:anon_local_value'][0].$outerId; |
|
597 | 597 | } |
598 | 598 | } |
599 | 599 | return $outerId; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | protected function saveDownloadDetails($idpIdentifier, $profileId, $deviceId, $area, $lang, $eapType) { |
131 | 131 | if (CONFIG['PATHS']['logdir']) { |
132 | - $file = fopen(CONFIG['PATHS']['logdir'] . "/download_details.log", "a"); |
|
132 | + $file = fopen(CONFIG['PATHS']['logdir']."/download_details.log", "a"); |
|
133 | 133 | if ($file === FALSE) { |
134 | 134 | throw new Exception("Unable to open file for append: $file"); |
135 | 135 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $eaptype = new common\EAP($eapQuery->eap_method_id); |
156 | 156 | $eapTypeArray[] = $eaptype; |
157 | 157 | } |
158 | - $this->loggerInstance->debug(4, "This profile supports the following EAP types:\n" . print_r($eapTypeArray, true)); |
|
158 | + $this->loggerInstance->debug(4, "This profile supports the following EAP types:\n".print_r($eapTypeArray, true)); |
|
159 | 159 | return $eapTypeArray; |
160 | 160 | } |
161 | 161 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | foreach ($new as $attrib) { |
211 | 211 | $ignore = ""; |
212 | 212 | foreach ($existing as $approvedAttrib) { |
213 | - if (($attrib["name"] == $approvedAttrib["name"] && $approvedAttrib["level"] != $newlevel) && ($approvedAttrib["name"] != "device-specific:redirect") ){ |
|
213 | + if (($attrib["name"] == $approvedAttrib["name"] && $approvedAttrib["level"] != $newlevel) && ($approvedAttrib["name"] != "device-specific:redirect")) { |
|
214 | 214 | $ignore = "YES"; |
215 | 215 | } |
216 | 216 | } |
@@ -253,16 +253,16 @@ discard block |
||
253 | 253 | if (count($this->getAttributes("internal:checkuser_outer")) > 0) { |
254 | 254 | // we are supposed to use a specific outer username for checks, |
255 | 255 | // which is different from the outer username we put into installers |
256 | - return $this->getAttributes("internal:checkuser_value")[0]['value'] . "@" . $realm; |
|
256 | + return $this->getAttributes("internal:checkuser_value")[0]['value']."@".$realm; |
|
257 | 257 | } |
258 | 258 | if (count($this->getAttributes("internal:use_anon_outer")) > 0) { |
259 | 259 | // no special check username, but there is an anon outer ID for |
260 | 260 | // installers - so let's use that one |
261 | - return $this->getAttributes("internal:anon_local_value")[0]['value'] . "@" . $realm; |
|
261 | + return $this->getAttributes("internal:anon_local_value")[0]['value']."@".$realm; |
|
262 | 262 | } |
263 | 263 | // okay, no guidance on outer IDs at all - but we need *something* to |
264 | 264 | // test with for the RealmChecks. So: |
265 | - return "@" . $realm; |
|
265 | + return "@".$realm; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * @param boolean $shallwe TRUE to enable outer identities (needs valid $realm), FALSE to disable |
343 | 343 | * @return void |
344 | 344 | */ |
345 | - abstract public function setAnonymousIDSupport($shallwe) ; |
|
345 | + abstract public function setAnonymousIDSupport($shallwe); |
|
346 | 346 | |
347 | 347 | /** |
348 | 348 | * Log a new download for our stats |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | */ |
697 | 697 | public function prepShowtime() { |
698 | 698 | $properConfig = $this->readyForShowtime(); |
699 | - $this->databaseHandle->exec("UPDATE profile SET sufficient_config = " . ($properConfig ? "TRUE" : "FALSE") . " WHERE profile_id = " . $this->identifier); |
|
699 | + $this->databaseHandle->exec("UPDATE profile SET sufficient_config = ".($properConfig ? "TRUE" : "FALSE")." WHERE profile_id = ".$this->identifier); |
|
700 | 700 | |
701 | 701 | $attribs = $this->getCollapsedAttributes(); |
702 | 702 | // if not enough info to go live, set FALSE |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | if ($device == "TOTAL") { |
127 | 127 | continue; |
128 | 128 | } |
129 | - $retstring .= "<tr><td>$device</td><td>" . $numbers['ADMIN'] . "</td><td>" . $numbers['SILVERBULLET'] . "</td><td>" . $numbers['USER'] . "</td></tr>"; |
|
129 | + $retstring .= "<tr><td>$device</td><td>".$numbers['ADMIN']."</td><td>".$numbers['SILVERBULLET']."</td><td>".$numbers['USER']."</td></tr>"; |
|
130 | 130 | } |
131 | - $retstring .= "<tr><td><strong>TOTAL</strong></td><td><strong>" . $data['TOTAL']['ADMIN'] . "</strong></td><td><strong>" . $data['TOTAL']['SILVERBULLET'] . "</strong></td><td><strong>" . $data['TOTAL']['USER'] . "</strong></td></tr>"; |
|
131 | + $retstring .= "<tr><td><strong>TOTAL</strong></td><td><strong>".$data['TOTAL']['ADMIN']."</strong></td><td><strong>".$data['TOTAL']['SILVERBULLET']."</strong></td><td><strong>".$data['TOTAL']['USER']."</strong></td></tr>"; |
|
132 | 132 | break; |
133 | 133 | case "XML": |
134 | 134 | // the calls to date() operate on current date, so there is no chance for a FALSE to be returned. Silencing scrutinizer. |
135 | - $retstring .= "<federation id='$this->tld' ts='" . /** @scrutinizer ignore-type */ date("Y-m-d") . "T" . /** @scrutinizer ignore-type */ date("H:i:s") . "'>\n"; |
|
135 | + $retstring .= "<federation id='$this->tld' ts='"./** @scrutinizer ignore-type */ date("Y-m-d")."T"./** @scrutinizer ignore-type */ date("H:i:s")."'>\n"; |
|
136 | 136 | foreach ($data as $device => $numbers) { |
137 | 137 | if ($device == "TOTAL") { |
138 | 138 | continue; |
139 | 139 | } |
140 | - $retstring .= " <device name='" . $device . "'>\n <downloads group='admin'>" . $numbers['ADMIN'] . "</downloads>\n <downloads group='managed_idp'>" . $numbers['SILVERBULLET'] . "</downloads>\n <downloads group='user'>" . $numbers['USER'] . "</downloads>\n </device>"; |
|
140 | + $retstring .= " <device name='".$device."'>\n <downloads group='admin'>".$numbers['ADMIN']."</downloads>\n <downloads group='managed_idp'>".$numbers['SILVERBULLET']."</downloads>\n <downloads group='user'>".$numbers['USER']."</downloads>\n </device>"; |
|
141 | 141 | } |
142 | - $retstring .= "<total>\n <downloads group='admin'>" . $data['TOTAL']['ADMIN'] . "</downloads>\n <downloads group='managed_idp'>" . $data['TOTAL']['SILVERBULLET'] . "</downloads>\n <downloads group='user'>" . $data['TOTAL']['USER'] . "</downloads>\n</total>\n"; |
|
142 | + $retstring .= "<total>\n <downloads group='admin'>".$data['TOTAL']['ADMIN']."</downloads>\n <downloads group='managed_idp'>".$data['TOTAL']['SILVERBULLET']."</downloads>\n <downloads group='user'>".$data['TOTAL']['USER']."</downloads>\n</total>\n"; |
|
143 | 143 | $retstring .= "</federation>"; |
144 | 144 | break; |
145 | 145 | case "array": |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $identifier = $this->databaseHandle->lastID(); |
222 | 222 | |
223 | 223 | if ($identifier == 0 || !$this->loggerInstance->writeAudit($ownerId, "NEW", "IdP $identifier")) { |
224 | - $text = "<p>Could not create a new " . CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_inst'] . "!</p>"; |
|
224 | + $text = "<p>Could not create a new ".CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_inst']."!</p>"; |
|
225 | 225 | echo $text; |
226 | 226 | throw new Exception($text); |
227 | 227 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | foreach ($idps as $idp) { |
38 | 38 | $idpTitle[$idp['entityID']] = $idp['title']; |
39 | 39 | $d = self::getIdpDistance($idp, $here); |
40 | - $resultSet[$idp['entityID']] = $d . " " . $idp['title']; |
|
40 | + $resultSet[$idp['entityID']] = $d." ".$idp['title']; |
|
41 | 41 | } |
42 | 42 | asort($resultSet); |
43 | 43 | $outarray = []; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $this->activationsTotal = $invitationRow->quantity; |
150 | 150 | $certificatesResult = $this->databaseHandle->exec("SELECT `serial_number`, `ca_type` FROM `silverbullet_certificate` WHERE `silverbullet_invitation_id` = ? ORDER BY `revocation_status`, `expiry` DESC", "i", $this->identifier); |
151 | 151 | $certificatesNumber = ($certificatesResult ? $certificatesResult->num_rows : 0); |
152 | - $this->loggerInstance->debug(5, "At token validation level, " . $certificatesNumber . " certificates exist.\n"); |
|
152 | + $this->loggerInstance->debug(5, "At token validation level, ".$certificatesNumber." certificates exist.\n"); |
|
153 | 153 | // SELECT -> resource, no boolean |
154 | 154 | while ($runner = mysqli_fetch_object(/** @scrutinizer ignore-type */ $certificatesResult)) { |
155 | 155 | $this->associatedCertificates[] = new \core\SilverbulletCertificate($runner->serial_number, $runner->ca_type); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | throw new Exception("Uh. Something went seriously wrong with URL path mangling."); |
209 | 209 | } |
210 | 210 | } |
211 | - $link = $link . $relPath; |
|
211 | + $link = $link.$relPath; |
|
212 | 212 | |
213 | 213 | if (preg_match('/admin$/', $link)) { |
214 | 214 | $link = substr($link, 0, -6); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | - return $link . '/accountstatus/accountstatus.php?token=' . $this->invitationTokenString; |
|
220 | + return $link.'/accountstatus/accountstatus.php?token='.$this->invitationTokenString; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $text .= sprintf(_("A new %s access credential has been created for you by your network administrator."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']); |
245 | 245 | $text .= " "; |
246 | 246 | $text .= sprintf(_("Please follow the following link with the device you want to enable for %s to get a custom %s installation program just for you. You can click on the link, copy and paste it into a browser or scan the attached QR code."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']); |
247 | - $text .= "\n\n" . $this->link() . "\n\n"; // gets replaced with the token value by getBody() |
|
247 | + $text .= "\n\n".$this->link()."\n\n"; // gets replaced with the token value by getBody() |
|
248 | 248 | $text .= sprintf(_("Please keep this email or bookmark this link for future use. After picking up your %s installation program, you can use the same link to get status information about your %s account."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']); |
249 | 249 | $text .= "\n\n"; |
250 | 250 | $text .= _("Regards,"); |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | // SELECT -> returns resource, not a boolean |
47 | 47 | while ($oneAffectedPayload = mysqli_fetch_object(/** @scrutinizer ignore-type */ $affectedPayloads)) { |
48 | 48 | if ($oneAffectedPayload->option_lang !== NULL) { |
49 | - echo "[SKIP] The option in row " . $oneAffectedPayload->row . " of table $tableName appears to be converted already. Not touching it.\n"; |
|
49 | + echo "[SKIP] The option in row ".$oneAffectedPayload->row." of table $tableName appears to be converted already. Not touching it.\n"; |
|
50 | 50 | continue; |
51 | 51 | } |
52 | 52 | $decoded = unserialize($oneAffectedPayload->option_value); |
53 | 53 | if ($decoded === FALSE || !isset($decoded["lang"]) || !isset($decoded['content'])) { |
54 | - echo "[WARN] Please check row " . $oneAffectedPayload->row . " of table $tableName - this entry did not successfully unserialize() even though it is a multi-lang attribute!\n"; |
|
54 | + echo "[WARN] Please check row ".$oneAffectedPayload->row." of table $tableName - this entry did not successfully unserialize() even though it is a multi-lang attribute!\n"; |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | // pry apart lang and content into their own columns |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $row = $oneAffectedPayload->row; |
61 | 61 | $rewrittenPayload = $dbInstance->exec("UPDATE $tableName SET option_lang = ?, option_value = ? WHERE row = ?", "ssi", $theLang, $theContent, $row); |
62 | 62 | if ($rewrittenPayload !== FALSE) { |
63 | - echo "[ OK ] " . $oneAffectedPayload->option_value . " ---> $theLang # $theContent\n"; |
|
63 | + echo "[ OK ] ".$oneAffectedPayload->option_value." ---> $theLang # $theContent\n"; |
|
64 | 64 | continue; |
65 | 65 | } |
66 | 66 | echo "[FAIL] Unknown error executing the payload update for row $row of table $tableName. Did you run the 'ALTER TABLE' statements?\n"; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | $rewrittenPayload = $dbInstance->exec("UPDATE institution_option SET option_value = ? WHERE row = ?", "si", $newstyle, $row); |
85 | 85 | if ($rewrittenPayload !== FALSE) { |
86 | - echo "[ OK ] " . $oneAffectedPayload->option_value . " ---> $newstyle\n"; |
|
86 | + echo "[ OK ] ".$oneAffectedPayload->option_value." ---> $newstyle\n"; |
|
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | echo "[FAIL] Unknown error executing the payload update for row $row of table institution_option.\n"; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $conditionString = "WHERE "; |
97 | 97 | $typeString = ""; |
98 | 98 | foreach ($eap_options as $index => $name) { |
99 | - $conditionString .= ($index == 0 ? "" : "OR ") . "option_name = ? "; |
|
99 | + $conditionString .= ($index == 0 ? "" : "OR ")."option_name = ? "; |
|
100 | 100 | $typeString .= "s"; |
101 | 101 | } |
102 | 102 | $idpWideOptionsQuery = $dbInstance->exec("SELECT institution_id, option_name, option_lang, option_value FROM institution_option $conditionString", $typeString, $eap_options[0], $eap_options[1]); |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | |
106 | 106 | while ($oneAttrib = mysqli_fetch_object(/** @scrutinizer ignore-type */ $idpWideOptionsQuery)) { |
107 | 107 | if (!isset($profiles[$oneAttrib->institution_id])) { |
108 | - $idp = new \core\IdP((int)$oneAttrib->institution_id); |
|
108 | + $idp = new \core\IdP((int) $oneAttrib->institution_id); |
|
109 | 109 | $profiles[$oneAttrib->institution_id] = ['IdP' => $idp, 'Profiles' => $idp->listProfiles()]; |
110 | - echo "Debug: IdP " . $idp->identifier . " has profiles "; |
|
110 | + echo "Debug: IdP ".$idp->identifier." has profiles "; |
|
111 | 111 | foreach ($profiles[$oneAttrib->institution_id]['Profiles'] as $oneProfileObject) { |
112 | - echo $oneProfileObject->identifier . " "; |
|
112 | + echo $oneProfileObject->identifier." "; |
|
113 | 113 | } |
114 | 114 | echo "\n"; |
115 | 115 | } |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | foreach ($relevantAttributes as $relevantAttribute) { |
122 | 122 | if ($relevantAttribute['level'] == 'Profile') { |
123 | 123 | $hasOnProfileLevel = TRUE; |
124 | - echo "[SKIP] EAP option " . $oneAttrib->option_name . " for IdP " . $profiles[$oneAttrib->institution_id]['IdP']->name . " (ID " . $profiles[$oneAttrib->institution_id]['IdP']->identifier . "), profile " . $oneProfileObject->name . " (ID " . $oneProfileObject->identifier . ") because Profile has EAP override.\n"; |
|
124 | + echo "[SKIP] EAP option ".$oneAttrib->option_name." for IdP ".$profiles[$oneAttrib->institution_id]['IdP']->name." (ID ".$profiles[$oneAttrib->institution_id]['IdP']->identifier."), profile ".$oneProfileObject->name." (ID ".$oneProfileObject->identifier.") because Profile has EAP override.\n"; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | if ($hasOnProfileLevel === FALSE) { // only add if profile didn't previously override IdP wide anyway! |
128 | 128 | $oneProfileObject->addAttribute($oneAttrib->option_name, $oneAttrib->option_lang, $oneAttrib->option_value); |
129 | - echo "[OK ] Added profile EAP option " . $oneAttrib->option_name . " for IdP " . $profiles[$oneAttrib->institution_id]['IdP']->name . " (ID " . $profiles[$oneAttrib->institution_id]['IdP']->identifier . "), profile " . $oneProfileObject->name . " (ID " . $oneProfileObject->identifier . ").\n"; |
|
129 | + echo "[OK ] Added profile EAP option ".$oneAttrib->option_name." for IdP ".$profiles[$oneAttrib->institution_id]['IdP']->name." (ID ".$profiles[$oneAttrib->institution_id]['IdP']->identifier."), profile ".$oneProfileObject->name." (ID ".$oneProfileObject->identifier.").\n"; |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | } |
@@ -136,5 +136,5 @@ discard block |
||
136 | 136 | $optLang = $oneAttrib->option_lang; |
137 | 137 | $optValue = $oneAttrib->option_value; |
138 | 138 | $deletionQuery = $dbInstance->exec("DELETE FROM institution_option WHERE institution_id = ? AND option_name = ? and option_lang = ? and option_value = ?", "isss", $instId, $optName, $optLang, $optValue); |
139 | - echo "[OK ] Deleted IdP-wide EAP option $optName for IdP " . $profiles[$instId]['IdP']->name . " (ID " . $profiles[$instId]['IdP']->identifier . ").\n"; |
|
139 | + echo "[OK ] Deleted IdP-wide EAP option $optName for IdP ".$profiles[$instId]['IdP']->name." (ID ".$profiles[$instId]['IdP']->identifier.").\n"; |
|
140 | 140 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | exec("openssl ocsp -reqin $derFilePath -req_text", $output, $retval); |
110 | 110 | |
111 | 111 | if ($retval !== 0) { |
112 | - instantDeath("openssl ocsp returned a non-zero return code. The DER data is probably bogus. B64 representation of DER data is: " . base64_encode($ocspRequestDer)); |
|
112 | + instantDeath("openssl ocsp returned a non-zero return code. The DER data is probably bogus. B64 representation of DER data is: ".base64_encode($ocspRequestDer)); |
|
113 | 113 | } |
114 | 114 | if ($output === NULL) { // this can't really happen, but makes Scrutinizer happier |
115 | 115 | $output = []; |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | * back (if we have it). |
140 | 140 | */ |
141 | 141 | if (strcasecmp($nameHash, OUR_NAME_HASH) != 0 || strcasecmp($keyHash, OUR_KEY_HASH) != 0) { |
142 | - instantDeath("The request is about a different Issuer name / public key. Expected vs. actual name hash: " . OUR_NAME_HASH . " / $nameHash, " . OUR_KEY_HASH . " / $keyHash"); |
|
142 | + instantDeath("The request is about a different Issuer name / public key. Expected vs. actual name hash: ".OUR_NAME_HASH." / $nameHash, ".OUR_KEY_HASH." / $keyHash"); |
|
143 | 143 | } |
144 | -error_log("base64-encoded request: " . base64_encode($ocspRequestDer)); |
|
144 | +error_log("base64-encoded request: ".base64_encode($ocspRequestDer)); |
|
145 | 145 | |
146 | -$response = fopen(__DIR__ . "/statements/" . $serialHex . ".der", "r"); |
|
146 | +$response = fopen(__DIR__."/statements/".$serialHex.".der", "r"); |
|
147 | 147 | if ($response === FALSE) { // not found |
148 | 148 | // first lets load the unauthorised response, which is the default reply |
149 | - $unauthResponse = fopen(__DIR__ . "/statements/UNAUTHORIZED.der", "r"); |
|
149 | + $unauthResponse = fopen(__DIR__."/statements/UNAUTHORIZED.der", "r"); |
|
150 | 150 | if ($unauthResponse === FALSE) { |
151 | 151 | instantDeath("Unable to open our canned UNAUTHORIZED response!"); |
152 | 152 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | $responseContent = fread($response, 1000000); |
190 | 190 | fclose($response); |
191 | -error_log("base64-encoded response: " . base64_encode($responseContent)); |
|
191 | +error_log("base64-encoded response: ".base64_encode($responseContent)); |
|
192 | 192 | header('Content-Type: application/ocsp-response'); |
193 | -header('Content-Length: ' . strlen($responseContent)); |
|
193 | +header('Content-Length: '.strlen($responseContent)); |
|
194 | 194 | echo $responseContent; |