@@ -22,15 +22,15 @@ |
||
22 | 22 | namespace devices\redirect_dev; |
23 | 23 | |
24 | 24 | class Device_RedirectDev extends \core\DeviceConfig { |
25 | - /** |
|
26 | - * Constructs a Device object. |
|
27 | - * |
|
28 | - * @final not to be redefined |
|
29 | - */ |
|
25 | + /** |
|
26 | + * Constructs a Device object. |
|
27 | + * |
|
28 | + * @final not to be redefined |
|
29 | + */ |
|
30 | 30 | final public function __construct() { |
31 | 31 | parent::__construct(); |
32 | - $this->setSupportedEapMethods([\core\common\EAP::EAPTYPE_NONE]); |
|
33 | - $this->loggerInstance->debug(4,"RedirectEx called"); |
|
32 | + $this->setSupportedEapMethods([\core\common\EAP::EAPTYPE_NONE]); |
|
33 | + $this->loggerInstance->debug(4,"RedirectEx called"); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -30,7 +30,7 @@ |
||
30 | 30 | final public function __construct() { |
31 | 31 | parent::__construct(); |
32 | 32 | $this->setSupportedEapMethods([\core\common\EAP::EAPTYPE_NONE]); |
33 | - $this->loggerInstance->debug(4,"RedirectEx called"); |
|
33 | + $this->loggerInstance->debug(4, "RedirectEx called"); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -138,8 +138,8 @@ |
||
138 | 138 | */ |
139 | 139 | private function zipInstaller() { |
140 | 140 | // one can always access $this->attributes to check things |
141 | - $fileName = $this->installerBasename . '.zip'; |
|
142 | - $output = system('zip -q ' . $fileName . ' *'); |
|
141 | + $fileName = $this->installerBasename.'.zip'; |
|
142 | + $output = system('zip -q '.$fileName.' *'); |
|
143 | 143 | if ($output === FALSE) { |
144 | 144 | $this->loggerInstance->debug(2, "unable to zip the installer\n"); |
145 | 145 | } |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | <key>PayloadDescription</key> |
94 | 94 | <string>$tagline</string> |
95 | 95 | <key>PayloadDisplayName</key> |
96 | - <string>" . CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'] . "</string> |
|
96 | + <string>".CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']."</string> |
|
97 | 97 | <key>PayloadIdentifier</key> |
98 | - <string>" . self::$iPhonePayloadPrefix . ".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang</string> |
|
98 | + <string>" . self::$iPhonePayloadPrefix.".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang</string> |
|
99 | 99 | <key>PayloadOrganization</key> |
100 | - <string>" . htmlspecialchars(iconv("UTF-8", "UTF-8//IGNORE", $this->attributes['general:instname'][0]), ENT_XML1, 'UTF-8') . ( $this->attributes['internal:profile_count'][0] > 1 ? " (" . htmlspecialchars(iconv("UTF-8", "UTF-8//IGNORE", $this->attributes['profile:name'][0]), ENT_XML1, 'UTF-8') . ")" : "") . "</string> |
|
100 | + <string>".htmlspecialchars(iconv("UTF-8", "UTF-8//IGNORE", $this->attributes['general:instname'][0]), ENT_XML1, 'UTF-8').($this->attributes['internal:profile_count'][0] > 1 ? " (".htmlspecialchars(iconv("UTF-8", "UTF-8//IGNORE", $this->attributes['profile:name'][0]), ENT_XML1, 'UTF-8').")" : "")."</string> |
|
101 | 101 | <key>PayloadType</key> |
102 | 102 | <string>Configuration</string> |
103 | 103 | <key>PayloadUUID</key> |
104 | - <string>" . \core\common\Entity::uuid('', self::$iPhonePayloadPrefix . $this->massagedConsortium . $this->massagedCountry . $this->massagedInst . $this->massagedProfile) . "</string> |
|
104 | + <string>" . \core\common\Entity::uuid('', self::$iPhonePayloadPrefix.$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile)."</string> |
|
105 | 105 | <key>PayloadVersion</key> |
106 | 106 | <integer>1</integer>"; |
107 | 107 | \core\common\Entity::outOfThePotatoes(); |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | protected function consentBlock() { |
133 | 133 | \core\common\Entity::intoThePotatoes(); |
134 | 134 | if (isset($this->attributes['support:info_file'])) { |
135 | - return MobileconfigSuperclass::BUFFER_CONSENT_PRE . htmlspecialchars(iconv("UTF-8", "UTF-8//TRANSLIT", $this->attributes['support:info_file'][0]), ENT_XML1, 'UTF-8') . MobileconfigSuperclass::BUFFER_CONSENT_POST; |
|
135 | + return MobileconfigSuperclass::BUFFER_CONSENT_PRE.htmlspecialchars(iconv("UTF-8", "UTF-8//TRANSLIT", $this->attributes['support:info_file'][0]), ENT_XML1, 'UTF-8').MobileconfigSuperclass::BUFFER_CONSENT_POST; |
|
136 | 136 | } |
137 | 137 | if ($this->attributes['internal:verify_userinput_suffix'][0] != 0) { |
138 | 138 | if (strlen($this->attributes['internal:realm'][0]) > 0) { |
139 | - $retval =MobileconfigSuperclass::BUFFER_CONSENT_PRE . sprintf(_("Important Notice: your username must end with @%s!"), $this->attributes['internal:realm'][0]) . MobileconfigSuperclass::BUFFER_CONSENT_POST; |
|
139 | + $retval = MobileconfigSuperclass::BUFFER_CONSENT_PRE.sprintf(_("Important Notice: your username must end with @%s!"), $this->attributes['internal:realm'][0]).MobileconfigSuperclass::BUFFER_CONSENT_POST; |
|
140 | 140 | \core\common\Entity::outOfThePotatoes(); |
141 | 141 | return $retval; |
142 | 142 | } |
143 | - $retval = MobileconfigSuperclass::BUFFER_CONSENT_PRE . _("Important Notice: your username MUST be in the form of xxx@yyy where the yyy is a common suffix identifying your Identity Provider. Please find out what to use there and enter the username in the correct format.") . MobileconfigSuperclass::BUFFER_CONSENT_POST; |
|
143 | + $retval = MobileconfigSuperclass::BUFFER_CONSENT_PRE._("Important Notice: your username MUST be in the form of xxx@yyy where the yyy is a common suffix identifying your Identity Provider. Please find out what to use there and enter the username in the correct format.").MobileconfigSuperclass::BUFFER_CONSENT_POST; |
|
144 | 144 | \core\common\Entity::outOfThePotatoes(); |
145 | 145 | return $retval; |
146 | 146 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | // also escape htmlspecialchars |
166 | 166 | // not all names and profiles have a name, so be prepared |
167 | 167 | |
168 | - $this->loggerInstance->debug(5, "List of available attributes: " . var_export($this->attributes, TRUE)); |
|
168 | + $this->loggerInstance->debug(5, "List of available attributes: ".var_export($this->attributes, TRUE)); |
|
169 | 169 | |
170 | 170 | $this->instName = $this->attributes['general:instname'][0] ?? _("Unnamed Organisation"); |
171 | 171 | $this->profileName = $this->attributes['profile:name'][0] ?? _("Unnamed Profile"); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | |
210 | 210 | textdomain($dom); |
211 | 211 | |
212 | - $fileName = $this->installerBasename . '.mobileconfig'; |
|
212 | + $fileName = $this->installerBasename.'.mobileconfig'; |
|
213 | 213 | |
214 | 214 | if (!$this->sign) { |
215 | 215 | rename("installer_profile", $fileName); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | return $fileName; |
218 | 218 | } |
219 | 219 | // still here? Then we are signing. |
220 | - $signing = system($this->sign . " installer_profile '$fileName' > /dev/null"); |
|
220 | + $signing = system($this->sign." installer_profile '$fileName' > /dev/null"); |
|
221 | 221 | if ($signing === FALSE) { |
222 | 222 | $this->loggerInstance->debug(2, "Signing the mobileconfig installer $fileName FAILED!\n"); |
223 | 223 | } |
@@ -235,19 +235,19 @@ discard block |
||
235 | 235 | \core\common\Entity::intoThePotatoes(); |
236 | 236 | $ssidCount = count($this->attributes['internal:SSID']); |
237 | 237 | $certCount = count($this->attributes['internal:CAs'][0]); |
238 | - $out = "<p>" . _("For best results, please use the built-in browser (Safari) to open the configuration file.") . "</p>"; |
|
238 | + $out = "<p>"._("For best results, please use the built-in browser (Safari) to open the configuration file.")."</p>"; |
|
239 | 239 | $out .= "<p>"; |
240 | 240 | $out .= _("The profile will install itself after you click (or tap) the button. You will be asked for confirmation/input at several points:"); |
241 | 241 | $out .= "<ul>"; |
242 | - $out .= "<li>" . _("to install the profile") . "</li>"; |
|
243 | - $out .= "<li>" . ngettext("to accept the server certificate authority", "to accept the server certificate authorities", $certCount); |
|
242 | + $out .= "<li>"._("to install the profile")."</li>"; |
|
243 | + $out .= "<li>".ngettext("to accept the server certificate authority", "to accept the server certificate authorities", $certCount); |
|
244 | 244 | if ($certCount > 1) { |
245 | - $out .= " " . sprintf(_("(%d times)"), $certCount); |
|
245 | + $out .= " ".sprintf(_("(%d times)"), $certCount); |
|
246 | 246 | } |
247 | 247 | $out .= "</li>"; |
248 | - $out .= "<li>" . _("to enter the username and password you have been given by your organisation"); |
|
248 | + $out .= "<li>"._("to enter the username and password you have been given by your organisation"); |
|
249 | 249 | if ($ssidCount > 1) { |
250 | - $out .= " " . sprintf(_("(%d times each, because %s is installed for %d SSIDs)"), $ssidCount, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $ssidCount); |
|
250 | + $out .= " ".sprintf(_("(%d times each, because %s is installed for %d SSIDs)"), $ssidCount, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $ssidCount); |
|
251 | 251 | } |
252 | 252 | $out .= "</li>"; |
253 | 253 | $out .= "</ul>"; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | <key>ServiceProviderRoamingEnabled</key> |
285 | 285 | <true/> |
286 | 286 | <key>DisplayedOperatorName</key> |
287 | - <string>" . CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'] . " via Passpoint</string>"; |
|
287 | + <string>" . CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']." via Passpoint</string>"; |
|
288 | 288 | // if we don't know the realm, omit the entire DomainName key |
289 | 289 | if (isset($this->attributes['internal:realm'])) { |
290 | 290 | $retval .= "<key>DomainName</key> |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | <dict> |
333 | 333 | <key>AcceptEAPTypes</key> |
334 | 334 | <array> |
335 | - <integer>" . $eapType['OUTER'] . "</integer> |
|
335 | + <integer>" . $eapType['OUTER']."</integer> |
|
336 | 336 | </array> |
337 | 337 | <key>EAPFASTProvisionPAC</key> |
338 | 338 | <true /> |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | "; |
346 | 346 | if ($realm !== NULL) { |
347 | 347 | $retval .= "<key>OuterIdentity</key> |
348 | - <string>" . htmlspecialchars($realm, ENT_XML1, 'UTF-8') . "</string> |
|
348 | + <string>" . htmlspecialchars($realm, ENT_XML1, 'UTF-8')."</string> |
|
349 | 349 | "; |
350 | 350 | } |
351 | 351 | $retval .= "<key>PayloadCertificateAnchorUUID</key> |
@@ -369,11 +369,11 @@ discard block |
||
369 | 369 | $retval .= " |
370 | 370 | </array>"; |
371 | 371 | if ($eapType['INNER'] == \core\common\EAP::NE_SILVERBULLET) { |
372 | - $retval .= "<key>UserName</key><string>" . $this->clientCert["certObject"]->username . "</string>"; |
|
372 | + $retval .= "<key>UserName</key><string>".$this->clientCert["certObject"]->username."</string>"; |
|
373 | 373 | } |
374 | 374 | $retval .= " |
375 | 375 | <key>TTLSInnerAuthentication</key> |
376 | - <string>" . ($eapType['INNER'] == \core\common\EAP::NONE ? "PAP" : "MSCHAPv2") . "</string> |
|
376 | + <string>" . ($eapType['INNER'] == \core\common\EAP::NONE ? "PAP" : "MSCHAPv2")."</string> |
|
377 | 377 | </dict>"; |
378 | 378 | return $retval; |
379 | 379 | } |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | // characters are still reversed, invert on use! |
393 | 393 | $buffer .= "<string>Manual</string> |
394 | 394 | <key>ProxyServer</key> |
395 | - <string>" . strrev($serverAndPort[1]) . "</string> |
|
395 | + <string>" . strrev($serverAndPort[1])."</string> |
|
396 | 396 | <key>ProxyServerPort</key> |
397 | - <integer>" . strrev($serverAndPort[0]) . "</integer> |
|
397 | + <integer>" . strrev($serverAndPort[0])."</integer> |
|
398 | 398 | <key>ProxyPACFallbackAllowed</key> |
399 | 399 | <false/>"; |
400 | 400 | } else { |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | throw new Exception("SSID must be a string!"); |
423 | 423 | } |
424 | 424 | $escapedSSID = htmlspecialchars($toBeConfigured, ENT_XML1, 'UTF-8'); |
425 | - $payloadIdentifier = "wifi." . $this->serial; |
|
425 | + $payloadIdentifier = "wifi.".$this->serial; |
|
426 | 426 | $payloadShortName = sprintf(_("SSID %s"), $escapedSSID); |
427 | 427 | $payloadName = sprintf(_("%s configuration for network name %s"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $escapedSSID); |
428 | 428 | $encryptionTypeString = "WPA"; |
@@ -470,11 +470,11 @@ discard block |
||
470 | 470 | <key>PayloadDisplayName</key> |
471 | 471 | <string>$payloadShortName</string> |
472 | 472 | <key>PayloadIdentifier</key> |
473 | - <string>" . self::$iPhonePayloadPrefix . ".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang.$payloadIdentifier</string> |
|
473 | + <string>".self::$iPhonePayloadPrefix.".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang.$payloadIdentifier</string> |
|
474 | 474 | <key>PayloadOrganization</key> |
475 | - <string>" . $this->massagedConsortium . ".1x-config.org</string> |
|
475 | + <string>".$this->massagedConsortium.".1x-config.org</string> |
|
476 | 476 | <key>PayloadType</key> |
477 | - <string>com.apple." . ($blocktype == MobileconfigSuperclass::NETWORK_BLOCK_TYPE_WIRED ? "firstactiveethernet" : "wifi") . ".managed</string>"; |
|
477 | + <string>com.apple." . ($blocktype == MobileconfigSuperclass::NETWORK_BLOCK_TYPE_WIRED ? "firstactiveethernet" : "wifi").".managed</string>"; |
|
478 | 478 | $retval .= $this->proxySettings(); |
479 | 479 | $retval .= $setupModesString; |
480 | 480 | if ($eapType['INNER'] == \core\common\EAP::NE_SILVERBULLET) { |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | } |
487 | 487 | $retval .= " |
488 | 488 | <key>PayloadUUID</key> |
489 | - <string>" . \core\common\Entity::uuid() . "</string> |
|
489 | + <string>" . \core\common\Entity::uuid()."</string> |
|
490 | 490 | <key>PayloadVersion</key> |
491 | 491 | <integer>1</integer> |
492 | 492 | $wifiNetworkIdentification</dict>"; |
@@ -515,15 +515,15 @@ discard block |
||
515 | 515 | <key>IsHotspot</key> |
516 | 516 | <false/> |
517 | 517 | <key>PayloadDescription</key> |
518 | - <string>" . sprintf(_("This SSID should not be used after bootstrapping %s"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']) . "</string> |
|
518 | + <string>" . sprintf(_("This SSID should not be used after bootstrapping %s"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'])."</string> |
|
519 | 519 | <key>PayloadDisplayName</key> |
520 | - <string>" . _("Disabled WiFi network") . "</string> |
|
520 | + <string>" . _("Disabled WiFi network")."</string> |
|
521 | 521 | <key>PayloadIdentifier</key> |
522 | - <string>" . self::$iPhonePayloadPrefix . ".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang.wifi.disabled.$this->removeSerial</string> |
|
522 | + <string>" . self::$iPhonePayloadPrefix.".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang.wifi.disabled.$this->removeSerial</string> |
|
523 | 523 | <key>PayloadType</key> |
524 | 524 | <string>com.apple.wifi.managed</string> |
525 | 525 | <key>PayloadUUID</key> |
526 | - <string>" . \core\common\Entity::uuid() . "</string> |
|
526 | + <string>".\core\common\Entity::uuid()."</string> |
|
527 | 527 | <key>PayloadVersion</key> |
528 | 528 | <real>1</real>"; |
529 | 529 | $retval .= $this->proxySettings(); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $mimeBlob = base64_encode($binaryBlob); |
598 | 598 | $mimeFormatted = chunk_split($mimeBlob, 52, "\r\n"); |
599 | 599 | $payloadUUID = \core\common\Entity::uuid('', $mimeBlob); |
600 | - $retArray = ["block" => "<dict>" . |
|
600 | + $retArray = ["block" => "<dict>". |
|
601 | 601 | // we don't include the import password. It's displayed on screen, and should be input by the user. |
602 | 602 | // <key>Password</key> |
603 | 603 | // <string>" . $this->clientCert['password'] . "</string> |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | <key>PayloadDescription</key> |
611 | 611 | <string>MIME Base-64 encoded PKCS#12 Client Certificate</string> |
612 | 612 | <key>PayloadDisplayName</key> |
613 | - <string>" . _("eduroam user certificate") . "</string> |
|
613 | + <string>"._("eduroam user certificate")."</string> |
|
614 | 614 | <key>PayloadIdentifier</key> |
615 | 615 | <string>com.apple.security.pkcs12.$payloadUUID</string> |
616 | 616 | <key>PayloadType</key> |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | <key>PayloadVersion</key> |
621 | 621 | <integer>1</integer> |
622 | 622 | </dict>", |
623 | - "UUID" => $payloadUUID,]; |
|
623 | + "UUID" => $payloadUUID, ]; |
|
624 | 624 | \core\common\Entity::outOfThePotatoes(); |
625 | 625 | return $retArray; |
626 | 626 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | } |
639 | 639 | $expiryTime = new \DateTime($this->clientCert['certObject']->expiry); |
640 | 640 | return "<key>RemovalDate</key> |
641 | - <date>" . $expiryTime->format("Y-m-d") . "T" . $expiryTime->format("H:i:s") . "Z</date>"; |
|
641 | + <date>" . $expiryTime->format("Y-m-d")."T".$expiryTime->format("H:i:s")."Z</date>"; |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | private $CAsAccountedFor = []; |
@@ -661,21 +661,21 @@ discard block |
||
661 | 661 | $stream = " |
662 | 662 | <dict> |
663 | 663 | <key>PayloadCertificateFileName</key> |
664 | - <string>" . $ca['uuid'] . ".der</string> |
|
664 | + <string>" . $ca['uuid'].".der</string> |
|
665 | 665 | <key>PayloadContent</key> |
666 | 666 | <data> |
667 | -" . $trimmedPem . "</data> |
|
667 | +" . $trimmedPem."</data> |
|
668 | 668 | <key>PayloadDescription</key> |
669 | - <string>" . sprintf(_("The %s Certification Authority"), \core\common\Entity::$nomenclature_inst) . "</string> |
|
669 | + <string>" . sprintf(_("The %s Certification Authority"), \core\common\Entity::$nomenclature_inst)."</string> |
|
670 | 670 | <key>PayloadDisplayName</key> |
671 | - <string>" . sprintf(_("%s CA"), \core\common\Entity::$nomenclature_inst) . "</string> |
|
671 | + <string>" . sprintf(_("%s CA"), \core\common\Entity::$nomenclature_inst)."</string> |
|
672 | 672 | <key>PayloadIdentifier</key> |
673 | - <string>" . self::$iPhonePayloadPrefix . ".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.credential.$this->caSerial</string> |
|
673 | + <string>" . self::$iPhonePayloadPrefix.".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.credential.$this->caSerial</string> |
|
674 | 674 | <key>PayloadOrganization</key> |
675 | - <string>" . $this->massagedConsortium . ".1x-config.org</string> |
|
675 | + <string>".$this->massagedConsortium.".1x-config.org</string> |
|
676 | 676 | <key>PayloadType</key> |
677 | 677 | <string>com.apple.security.root</string> |
678 | - <key>PayloadUUID</key><string>" . $ca['uuid'] . "</string> |
|
678 | + <key>PayloadUUID</key><string>" . $ca['uuid']."</string> |
|
679 | 679 | <key>PayloadVersion</key> |
680 | 680 | <integer>1</integer> |
681 | 681 | </dict>"; |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | "eduroamCAT", |
362 | 362 | "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>", |
363 | 363 | "<a target='_blank' href='https://www.amazon.com/dp/B01EACCX0S/'>Amazon Appstore</a>", |
364 | - "<a target='_blank' href='eduroamCAT-stable.apk'>" . _("as local download") . "</a>"), |
|
364 | + "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"), |
|
365 | 365 | ], |
366 | 366 | ], |
367 | 367 | 'android_oreo' => [ |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | "eduroamCAT", |
377 | 377 | "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>", |
378 | 378 | "<a target='_blank' href='https://www.amazon.com/dp/B01EACCX0S/'>Amazon Appstore</a>", |
379 | - "<a target='_blank' href='eduroamCAT-stable.apk'>" . _("as local download") . "</a>"), |
|
379 | + "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"), |
|
380 | 380 | ], |
381 | 381 | ], |
382 | 382 | 'android_nougat' => [ |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | "eduroamCAT", |
392 | 392 | "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>", |
393 | 393 | "<a target='_blank' href='https://www.amazon.com/dp/B01EACCX0S/'>Amazon Appstore</a>", |
394 | - "<a target='_blank' href='eduroamCAT-stable.apk'>" . _("as local download") . "</a>"), |
|
394 | + "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"), |
|
395 | 395 | ], |
396 | 396 | ], |
397 | 397 | 'android_marshmallow' => [ |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | "eduroamCAT", |
407 | 407 | "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>", |
408 | 408 | "<a target='_blank' href='https://www.amazon.com/dp/B01EACCX0S/'>Amazon Appstore</a>", |
409 | - "<a target='_blank' href='eduroamCAT-stable.apk'>" . _("as local download") . "</a>"), |
|
409 | + "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"), |
|
410 | 410 | ], |
411 | 411 | ], |
412 | 412 | 'android_lollipop' => [ |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | "eduroamCAT", |
422 | 422 | "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>", |
423 | 423 | "<a target='_blank' href='https://www.amazon.com/dp/B01EACCX0S/'>Amazon Appstore</a>", |
424 | - "<a target='_blank' href='eduroamCAT-stable.apk'>" . _("as local download") . "</a>"), |
|
424 | + "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"), |
|
425 | 425 | ], |
426 | 426 | ], |
427 | 427 | 'android_kitkat' => [ |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | "eduroamCAT", |
437 | 437 | "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>", |
438 | 438 | "<a target='_blank' href='https://www.amazon.com/dp/B01EACCX0S/'>Amazon Appstore</a>", |
439 | - "<a target='_blank' href='eduroamCAT-stable.apk'>" . _("as local download") . "</a>"), |
|
439 | + "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"), |
|
440 | 440 | ], |
441 | 441 | ], |
442 | 442 | 'android_43' => [ |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | "eduroamCAT", |
452 | 452 | "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>", |
453 | 453 | "<a target='_blank' href='https://www.amazon.com/dp/B01EACCX0S/'>Amazon Appstore</a>", |
454 | - "<a target='_blank' href='eduroamCAT-stable.apk'>" . _("as local download") . "</a>"), |
|
454 | + "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"), |
|
455 | 455 | ], |
456 | 456 | ], |
457 | 457 | 'android_legacy' => [ |
@@ -211,7 +211,7 @@ |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | if (!empty($this->attributes['internal:realm'][0])) { |
214 | - $config['user_realm'] = $this->attributes['internal:realm'][0]; |
|
214 | + $config['user_realm'] = $this->attributes['internal:realm'][0]; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | if(!empty($this->attributes['internal:hint_userinput_suffix'][0]) && $this->attributes['internal:hint_userinput_suffix'][0] == 1) { |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * |
55 | 55 | */ |
56 | 56 | public function writeInstaller() { |
57 | - $installerPath = $this->installerBasename . ".py"; |
|
57 | + $installerPath = $this->installerBasename.".py"; |
|
58 | 58 | $this->copyFile("main.py", $installerPath); |
59 | - $installer = fopen($installerPath,"a"); |
|
59 | + $installer = fopen($installerPath, "a"); |
|
60 | 60 | if ($installer === FALSE) { |
61 | 61 | throw new Exception("Unable to open installer file for writing!"); |
62 | 62 | } |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | $out .= "<p>"; |
84 | 84 | if ($ssidCount > 1) { |
85 | 85 | if ($ssidCount > 2) { |
86 | - $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to the following networks:"), implode(', ', CONFIG_CONFASSISTANT['CONSORTIUM']['ssid'])) . " "; |
|
86 | + $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to the following networks:"), implode(', ', CONFIG_CONFASSISTANT['CONSORTIUM']['ssid']))." "; |
|
87 | 87 | } else { |
88 | - $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to:"), implode(', ', CONFIG_CONFASSISTANT['CONSORTIUM']['ssid'])) . " "; |
|
88 | + $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to:"), implode(', ', CONFIG_CONFASSISTANT['CONSORTIUM']['ssid']))." "; |
|
89 | 89 | } |
90 | 90 | $iterator = 0; |
91 | 91 | foreach ($this->attributes['internal:SSID'] as $ssid => $v) { |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | * @return void |
124 | 124 | */ |
125 | 125 | private function writeConfigLine($file, $prefix, $name, $text) { |
126 | - $out = $prefix . $name . ' = "' . $text; |
|
127 | - fwrite($file, wordwrap($out, 70, " \" \\\n \"") . "\n"); |
|
126 | + $out = $prefix.$name.' = "'.$text; |
|
127 | + fwrite($file, wordwrap($out, 70, " \" \\\n \"")."\n"); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'user_cert_missing' => _("personal certificate file not found"), |
164 | 164 | ]; |
165 | 165 | foreach ($messages as $name => $value) { |
166 | - $this->writeConfigLine($file, 'Messages.', $name, $value . '"'); |
|
166 | + $this->writeConfigLine($file, 'Messages.', $name, $value.'"'); |
|
167 | 167 | } |
168 | 168 | \core\common\Entity::outOfThePotatoes(); |
169 | 169 | } |
@@ -207,39 +207,39 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | if ($outerId !== NULL) { |
210 | - $configRaw['anonymous_identity'] = '"' . $outerId . '"'; |
|
210 | + $configRaw['anonymous_identity'] = '"'.$outerId.'"'; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | if (!empty($this->attributes['internal:realm'][0])) { |
214 | 214 | $config['user_realm'] = $this->attributes['internal:realm'][0]; |
215 | 215 | } |
216 | 216 | |
217 | - if(!empty($this->attributes['internal:hint_userinput_suffix'][0]) && $this->attributes['internal:hint_userinput_suffix'][0] == 1) { |
|
217 | + if (!empty($this->attributes['internal:hint_userinput_suffix'][0]) && $this->attributes['internal:hint_userinput_suffix'][0] == 1) { |
|
218 | 218 | $configRaw['hint_user_input'] = "True"; |
219 | 219 | } |
220 | 220 | |
221 | - if(!empty($this->attributes['internal:verify_userinput_suffix'][0]) && $this->attributes['internal:verify_userinput_suffix'][0] == 1) { |
|
221 | + if (!empty($this->attributes['internal:verify_userinput_suffix'][0]) && $this->attributes['internal:verify_userinput_suffix'][0] == 1) { |
|
222 | 222 | $configRaw['verify_user_realm_input'] = "True"; |
223 | 223 | } |
224 | 224 | |
225 | 225 | foreach ($config as $name => $value) { |
226 | - $this->writeConfigLine($file, 'Config.', $name, $value . '"'); |
|
226 | + $this->writeConfigLine($file, 'Config.', $name, $value.'"'); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | foreach ($configRaw as $name => $value) { |
230 | - fwrite($file, 'Config.' . $name . ' = ' . $value . "\n"); |
|
230 | + fwrite($file, 'Config.'.$name.' = '.$value."\n"); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | if ($tou === '') { |
234 | - fwrite($file, 'Config.tou = ""' . "\n"); |
|
234 | + fwrite($file, 'Config.tou = ""'."\n"); |
|
235 | 235 | } else { |
236 | - fwrite($file, 'Config.tou = """' . $tou . '"""' . "\n"); |
|
236 | + fwrite($file, 'Config.tou = """'.$tou.'"""'."\n"); |
|
237 | 237 | } |
238 | 238 | |
239 | - fwrite($file, 'Config.CA = """' . $this->mkCAfile() . '"""' . "\n"); |
|
239 | + fwrite($file, 'Config.CA = """'.$this->mkCAfile().'"""'."\n"); |
|
240 | 240 | $sbUserFile = $this->mkSbUserFile(); |
241 | 241 | if ($sbUserFile !== '') { |
242 | - fwrite($file, 'Config.sb_user_file = """' . $sbUserFile . '"""' . "\n"); |
|
242 | + fwrite($file, 'Config.sb_user_file = """'.$sbUserFile.'"""'."\n"); |
|
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | $out .= "'DNS:$oneServer'"; |
293 | 293 | } |
294 | - return "[" . $out. "]"; |
|
294 | + return "[".$out."]"; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | foreach ($ssids as $ssid => $cipher) { |
306 | 306 | $outArray[] = "'$ssid'"; |
307 | 307 | } |
308 | - return '[' . implode(', ', $outArray) . ']'; |
|
308 | + return '['.implode(', ', $outArray).']'; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $outArray[] = "'$ssid'"; |
322 | 322 | } |
323 | 323 | } |
324 | - return '[' . implode(', ', $outArray) . ']'; |
|
324 | + return '['.implode(', ', $outArray).']'; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @return string |
331 | 331 | */ |
332 | - private function mkCAfile(){ |
|
332 | + private function mkCAfile() { |
|
333 | 333 | $out = ''; |
334 | 334 | $cAlist = $this->attributes['internal:CAs'][0]; |
335 | 335 | foreach ($cAlist as $oneCa) { |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | */ |
346 | 346 | private function mkIntro() { |
347 | 347 | \core\common\Entity::intoThePotatoes(); |
348 | - $out = _("This installer has been prepared for {0}") . '\n\n' . _("More information and comments:") . '\n\nEMAIL: {1}\nWWW: {2}\n\n' . |
|
348 | + $out = _("This installer has been prepared for {0}").'\n\n'._("More information and comments:").'\n\nEMAIL: {1}\nWWW: {2}\n\n'. |
|
349 | 349 | _("Installer created with software from the GEANT project."); |
350 | 350 | \core\common\Entity::outOfThePotatoes(); |
351 | 351 | return $out; |
@@ -201,8 +201,7 @@ |
||
201 | 201 | |
202 | 202 | if ($this->selectedEap == \core\common\EAP::EAPTYPE_TLS && isset($this->attributes['eap-specific:tls_use_other_id']) && $this->attributes['eap-specific:tls_use_other_id'][0] == 'on') { |
203 | 203 | $configRaw['use_other_tls_id'] = "True"; |
204 | - } |
|
205 | - else { |
|
204 | + } else { |
|
206 | 205 | $configRaw['use_other_tls_id'] = "False"; |
207 | 206 | } |
208 | 207 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * @author Stefan Winter <[email protected]> |
26 | 26 | * @package Core |
27 | 27 | */ |
28 | -require_once dirname(dirname(__FILE__)) . "/config/_config.php"; |
|
28 | +require_once dirname(dirname(__FILE__))."/config/_config.php"; |
|
29 | 29 | |
30 | 30 | $Gui = new \web\lib\user\Gui(); |
31 | 31 | // ... unless overwritten by direct GET/POST parameter in the request or a SESSION setting |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $invitationObject = new SilverbulletInvitation($token); |
156 | 156 | $profile = new ProfileSilverbullet($invitationObject->profile); |
157 | 157 | $inst = new IdP($profile->institution); |
158 | - $loggerInstance->debug(5, "tokenStatus: done, got " . $invitationObject->invitationTokenStatus . ", " . $invitationObject->profile . ", " . $invitationObject->userId . ", " . $invitationObject->expiry . ", " . $invitationObject->invitationTokenString . "\n"); |
|
158 | + $loggerInstance->debug(5, "tokenStatus: done, got ".$invitationObject->invitationTokenStatus.", ".$invitationObject->profile.", ".$invitationObject->userId.", ".$invitationObject->expiry.", ".$invitationObject->invitationTokenString."\n"); |
|
159 | 159 | if ($invitationObject->invitationTokenStatus != SilverbulletInvitation::SB_TOKENSTATUS_VALID && $invitationObject->invitationTokenStatus != SilverbulletInvitation::SB_TOKENSTATUS_PARTIALLY_REDEEMED) { |
160 | 160 | throw new Exception("Attempt to generate a SilverBullet installer with an invalid/redeemed/expired token. The user should never have gotten that far!"); |
161 | 161 | } |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | throw new Exception("Despite a valid token, the corresponding user was not found in database or database query error!"); |
169 | 169 | } |
170 | 170 | $expiryObject = mysqli_fetch_object(/** @scrutinizer ignore-type */ $userrow); |
171 | - $loggerInstance->debug(5, "EXP: " . $expiryObject->expiry . "\n"); |
|
171 | + $loggerInstance->debug(5, "EXP: ".$expiryObject->expiry."\n"); |
|
172 | 172 | $expiryDateObject = date_create_from_format("Y-m-d H:i:s", $expiryObject->expiry); |
173 | 173 | if ($expiryDateObject === FALSE) { |
174 | 174 | throw new Exception("The expiry date we got from the DB is bogus!"); |
175 | 175 | } |
176 | - $loggerInstance->debug(5, $expiryDateObject->format("Y-m-d H:i:s") . "\n"); |
|
176 | + $loggerInstance->debug(5, $expiryDateObject->format("Y-m-d H:i:s")."\n"); |
|
177 | 177 | // date_create with no parameters can't fail, i.e. is never FALSE |
178 | 178 | $validity = date_diff(/** @scrutinizer ignore-type */ date_create(), $expiryDateObject); |
179 | 179 | $expiryDays = $validity->days + 1; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $certString = ""; |
223 | 223 | openssl_x509_export($cert, $certString); |
224 | 224 | $parsedCert = $x509->processCertificate($certString); |
225 | - $loggerInstance->debug(5, "CERTINFO: " . print_r($parsedCert['full_details'], true)); |
|
225 | + $loggerInstance->debug(5, "CERTINFO: ".print_r($parsedCert['full_details'], true)); |
|
226 | 226 | $realExpiryDate = date_create_from_format("U", $parsedCert['full_details']['validTo_time_t'])->format("Y-m-d H:i:s"); |
227 | 227 | |
228 | 228 | // store new cert info in DB |
@@ -280,26 +280,26 @@ discard block |
||
280 | 280 | $cat = new CAT(); |
281 | 281 | $tempdirArray = $cat->createTemporaryDirectory("test"); |
282 | 282 | $tempdir = $tempdirArray['dir']; |
283 | - $nowIndexTxt = (new \DateTime())->format("ymdHis") . "Z"; |
|
284 | - $expiryIndexTxt = $originalExpiry->format("ymdHis") . "Z"; |
|
283 | + $nowIndexTxt = (new \DateTime())->format("ymdHis")."Z"; |
|
284 | + $expiryIndexTxt = $originalExpiry->format("ymdHis")."Z"; |
|
285 | 285 | $serialHex = strtoupper(dechex($this->serial)); |
286 | 286 | if (strlen($serialHex) % 2 == 1) { |
287 | - $serialHex = "0" . $serialHex; |
|
287 | + $serialHex = "0".$serialHex; |
|
288 | 288 | } |
289 | 289 | |
290 | - $indexStatement = "$certstatus\t$expiryIndexTxt\t" . ($certstatus == "R" ? "$nowIndexTxt,unspecified" : "") . "\t$serialHex\tunknown\t/O=" . CONFIG_CONFASSISTANT['CONSORTIUM']['name'] . "/OU=$federation/CN=$this->username\n"; |
|
290 | + $indexStatement = "$certstatus\t$expiryIndexTxt\t".($certstatus == "R" ? "$nowIndexTxt,unspecified" : "")."\t$serialHex\tunknown\t/O=".CONFIG_CONFASSISTANT['CONSORTIUM']['name']."/OU=$federation/CN=$this->username\n"; |
|
291 | 291 | $logHandle->debug(4, "index.txt contents-to-be: $indexStatement"); |
292 | - if (!file_put_contents($tempdir . "/index.txt", $indexStatement)) { |
|
292 | + if (!file_put_contents($tempdir."/index.txt", $indexStatement)) { |
|
293 | 293 | $logHandle->debug(1, "Unable to write openssl index.txt file for revocation handling!"); |
294 | 294 | } |
295 | 295 | // index.txt.attr is dull but needs to exist |
296 | - file_put_contents($tempdir . "/index.txt.attr", "unique_subject = yes\n"); |
|
296 | + file_put_contents($tempdir."/index.txt.attr", "unique_subject = yes\n"); |
|
297 | 297 | // call "openssl ocsp" to manufacture our own OCSP statement |
298 | 298 | // adding "-rmd sha1" to the following command-line makes the |
299 | 299 | // choice of signature algorithm for the response explicit |
300 | 300 | // but it's only available from openssl-1.1.0 (which we do not |
301 | 301 | // want to require just for that one thing). |
302 | - $execCmd = CONFIG['PATHS']['openssl'] . " ocsp -issuer " . ROOT . "/config/SilverbulletClientCerts/real-".$this->ca_type.".pem -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA " . ROOT . "/config/SilverbulletClientCerts/real-".$this->ca_type.".pem -rsigner " . ROOT . "/config/SilverbulletClientCerts/real-".$this->ca_type.".pem -rkey " . ROOT . "/config/SilverbulletClientCerts/real-".$this->ca_type.".key -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der"; |
|
302 | + $execCmd = CONFIG['PATHS']['openssl']." ocsp -issuer ".ROOT."/config/SilverbulletClientCerts/real-".$this->ca_type.".pem -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA ".ROOT."/config/SilverbulletClientCerts/real-".$this->ca_type.".pem -rsigner ".ROOT."/config/SilverbulletClientCerts/real-".$this->ca_type.".pem -rkey ".ROOT."/config/SilverbulletClientCerts/real-".$this->ca_type.".key -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der"; |
|
303 | 303 | $logHandle->debug(2, "Calling openssl ocsp with following cmdline: $execCmd\n"); |
304 | 304 | $output = []; |
305 | 305 | $return = 999; |
@@ -307,11 +307,11 @@ discard block |
||
307 | 307 | if ($return !== 0) { |
308 | 308 | throw new Exception("Non-zero return value from openssl ocsp!"); |
309 | 309 | } |
310 | - $ocsp = file_get_contents($tempdir . "/$serialHex.response.der"); |
|
310 | + $ocsp = file_get_contents($tempdir."/$serialHex.response.der"); |
|
311 | 311 | // remove the temp dir! |
312 | - unlink($tempdir . "/$serialHex.response.der"); |
|
313 | - unlink($tempdir . "/index.txt.attr"); |
|
314 | - unlink($tempdir . "/index.txt"); |
|
312 | + unlink($tempdir."/$serialHex.response.der"); |
|
313 | + unlink($tempdir."/index.txt.attr"); |
|
314 | + unlink($tempdir."/index.txt"); |
|
315 | 315 | rmdir($tempdir); |
316 | 316 | break; |
317 | 317 | default: |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $username = ""; |
366 | 366 | while ($usernameIsUnique === FALSE) { |
367 | 367 | $usernameLocalPart = common\Entity::randomString(64 - 1 - strlen($realm), "0123456789abcdefghijklmnopqrstuvwxyz"); |
368 | - $username = $usernameLocalPart . "@" . $realm; |
|
368 | + $username = $usernameLocalPart."@".$realm; |
|
369 | 369 | $uniquenessQuery = $databaseHandle->exec("SELECT cn from silverbullet_certificate WHERE cn = ?", "s", $username); |
370 | 370 | // SELECT -> resource, not boolean |
371 | 371 | if (mysqli_num_rows(/** @scrutinizer ignore-type */ $uniquenessQuery) == 0) { |
@@ -417,10 +417,10 @@ discard block |
||
417 | 417 | $databaseHandle = DBConnection::handle("INST"); |
418 | 418 | switch (CONFIG_CONFASSISTANT['SILVERBULLET']['CA']['type']) { |
419 | 419 | case "embedded": |
420 | - $rootCaPem = file_get_contents(ROOT . "/config/SilverbulletClientCerts/rootca-$certtype.pem"); |
|
421 | - $issuingCaPem = file_get_contents(ROOT . "/config/SilverbulletClientCerts/real-$certtype.pem"); |
|
420 | + $rootCaPem = file_get_contents(ROOT."/config/SilverbulletClientCerts/rootca-$certtype.pem"); |
|
421 | + $issuingCaPem = file_get_contents(ROOT."/config/SilverbulletClientCerts/real-$certtype.pem"); |
|
422 | 422 | $issuingCa = openssl_x509_read($issuingCaPem); |
423 | - $issuingCaKey = openssl_pkey_get_private("file://" . ROOT . "/config/SilverbulletClientCerts/real-$certtype.key"); |
|
423 | + $issuingCaKey = openssl_pkey_get_private("file://".ROOT."/config/SilverbulletClientCerts/real-$certtype.key"); |
|
424 | 424 | $nonDupSerialFound = FALSE; |
425 | 425 | do { |
426 | 426 | $serial = random_int(1000000000, PHP_INT_MAX); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | throw new Exception("Unknown cert type!"); |
443 | 443 | } |
444 | 444 | return [ |
445 | - "CERT" => openssl_csr_sign($csr, $issuingCa, $issuingCaKey, $expiryDays, ['digest_alg' => $alg, 'config' => dirname(__DIR__) . "/config/SilverbulletClientCerts/openssl-$certtype.cnf"], $serial), |
|
445 | + "CERT" => openssl_csr_sign($csr, $issuingCa, $issuingCaKey, $expiryDays, ['digest_alg' => $alg, 'config' => dirname(__DIR__)."/config/SilverbulletClientCerts/openssl-$certtype.cnf"], $serial), |
|
446 | 446 | "SERIAL" => $serial, |
447 | 447 | "ISSUER" => $issuingCaPem, |
448 | 448 | "ROOT" => $rootCaPem, |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } else { |
147 | 147 | $this->databaseHandle->exec("INSERT INTO ownership (user_id, institution_id, blesslevel, orig_mail) VALUES(?, ?, ?, ?)", "siss", $owner, $catId, $level, $destMail); |
148 | 148 | } |
149 | - $this->loggerInstance->writeAudit((string) $owner, "OWN", "IdP " . $invitationDetails->cat_institution_id . " - added user as owner"); |
|
149 | + $this->loggerInstance->writeAudit((string) $owner, "OWN", "IdP ".$invitationDetails->cat_institution_id." - added user as owner"); |
|
150 | 150 | common\Entity::outOfThePotatoes(); |
151 | 151 | return new IdP($invitationDetails->cat_institution_id); |
152 | 152 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $idp = new IdP($fed->newIdP($owner, $invitationDetails->invite_issuer_level, $invitationDetails->invite_dest_mail, $bestnameguess)); |
169 | 169 | } |
170 | 170 | $idp->addAttribute("general:instname", 'C', $bestnameguess); |
171 | - $this->loggerInstance->writeAudit($owner, "NEW", "IdP " . $idp->identifier . " - created from invitation"); |
|
171 | + $this->loggerInstance->writeAudit($owner, "NEW", "IdP ".$idp->identifier." - created from invitation"); |
|
172 | 172 | |
173 | 173 | // in case we have more admins in the queue which were invited to |
174 | 174 | // administer the same inst but haven't redeemed their invitations |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | WHERE invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0 AND name = ? AND country = ? AND ( cat_institution_id IS NULL OR external_db_uniquehandle IS NULL ) ", "ss", $invitationDetails->name, $invitationDetails->country); |
183 | 183 | // SELECT -> resource, no boolean |
184 | 184 | while ($pendingDetail = mysqli_fetch_object(/** @scrutinizer ignore-type */ $otherPending)) { |
185 | - $this->databaseHandle->exec("UPDATE invitations SET cat_institution_id = " . $idp->identifier . " WHERE id = " . $pendingDetail->id); |
|
185 | + $this->databaseHandle->exec("UPDATE invitations SET cat_institution_id = ".$idp->identifier." WHERE id = ".$pendingDetail->id); |
|
186 | 186 | } |
187 | 187 | common\Entity::outOfThePotatoes(); |
188 | 188 | return $idp; |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | $retval = []; |
277 | 277 | $invitations = $this->databaseHandle->exec("SELECT cat_institution_id, country, name, invite_issuer_level, invite_dest_mail, invite_token , TIMESTAMPADD(DAY, 1, invite_created) as expiry |
278 | 278 | FROM invitations |
279 | - WHERE cat_institution_id " . ( $idpIdentifier != 0 ? "= $idpIdentifier" : "IS NULL") . " AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0"); |
|
279 | + WHERE cat_institution_id " . ($idpIdentifier != 0 ? "= $idpIdentifier" : "IS NULL")." AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0"); |
|
280 | 280 | // SELECT -> resource, not boolean |
281 | - $this->loggerInstance->debug(4, "Retrieving pending invitations for " . ($idpIdentifier != 0 ? "IdP $idpIdentifier" : "IdPs awaiting initial creation" ) . ".\n"); |
|
281 | + $this->loggerInstance->debug(4, "Retrieving pending invitations for ".($idpIdentifier != 0 ? "IdP $idpIdentifier" : "IdPs awaiting initial creation").".\n"); |
|
282 | 282 | while ($invitationQuery = mysqli_fetch_object(/** @scrutinizer ignore-type */ $invitations)) { |
283 | 283 | $retval[] = ["country" => $invitationQuery->country, "name" => $invitationQuery->name, "mail" => $invitationQuery->invite_dest_mail, "token" => $invitationQuery->invite_token, "expiry" => $invitationQuery->expiry]; |
284 | 284 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function __construct() { |
96 | 96 | $this->loggerInstance = new Logging(); |
97 | - $this->loggerInstance->debug(3, "--- BEGIN constructing class " . get_class($this) . " .\n"); |
|
97 | + $this->loggerInstance->debug(3, "--- BEGIN constructing class ".get_class($this)." .\n"); |
|
98 | 98 | $this->languageInstance = new Language(); |
99 | 99 | Entity::intoThePotatoes(); |
100 | 100 | // some config elements are displayable. We need some dummies to |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $dummy_inst2 = _("organisation"); |
107 | 107 | $dummy_inst3 = _("Identity Provider"); |
108 | 108 | // and do something useless with the strings so that there's no "unused" complaint |
109 | - if (strlen($dummy_NRO . $dummy_inst1 . $dummy_inst2 . $dummy_inst3) < 0) { |
|
109 | + if (strlen($dummy_NRO.$dummy_inst1.$dummy_inst2.$dummy_inst3) < 0) { |
|
110 | 110 | throw new \Exception("Strings are usually not shorter than 0 characters. We've encountered a string blackhole."); |
111 | 111 | } |
112 | 112 | Entity::$nomenclature_fed = _(CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_federation']); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * Logs the end of lifetime of the entity to the debug log on level 5. |
122 | 122 | */ |
123 | 123 | public function __destruct() { |
124 | - (new Logging())->debug(5, "--- KILL Destructing class " . get_class($this) . " .\n"); |
|
124 | + (new Logging())->debug(5, "--- KILL Destructing class ".get_class($this)." .\n"); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function createTemporaryDirectory($purpose = 'installer', $failIsFatal = 1) { |
153 | 153 | $loggerInstance = new Logging(); |
154 | - $name = md5(time() . rand()); |
|
154 | + $name = md5(time().rand()); |
|
155 | 155 | $path = ROOT; |
156 | 156 | switch ($purpose) { |
157 | 157 | case 'silverbullet': |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | default: |
170 | 170 | throw new Exception("unable to create temporary directory due to unknown purpose: $purpose\n"); |
171 | 171 | } |
172 | - $tmpDir = $path . '/' . $name; |
|
172 | + $tmpDir = $path.'/'.$name; |
|
173 | 173 | $loggerInstance->debug(4, "temp dir: $purpose : $tmpDir\n"); |
174 | 174 | if (!mkdir($tmpDir, 0700, true)) { |
175 | 175 | if ($failIsFatal) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @return void |
190 | 190 | */ |
191 | 191 | public static function rrmdir($dir) { |
192 | - foreach (glob($dir . '/*') as $file) { |
|
192 | + foreach (glob($dir.'/*') as $file) { |
|
193 | 193 | if (is_dir($file)) { |
194 | 194 | Entity::rrmdir($file); |
195 | 195 | } else { |
@@ -214,12 +214,12 @@ discard block |
||
214 | 214 | } |
215 | 215 | // these substr() are guaranteed to yield actual string data, as the |
216 | 216 | // base string is an MD5 hash - has sufficient length |
217 | - $uuid = /** @scrutinizer ignore-type */ substr($chars, 0, 8) . '-'; |
|
218 | - $uuid .= /** @scrutinizer ignore-type */ substr($chars, 8, 4) . '-'; |
|
219 | - $uuid .= /** @scrutinizer ignore-type */ substr($chars, 12, 4) . '-'; |
|
220 | - $uuid .= /** @scrutinizer ignore-type */ substr($chars, 16, 4) . '-'; |
|
217 | + $uuid = /** @scrutinizer ignore-type */ substr($chars, 0, 8).'-'; |
|
218 | + $uuid .= /** @scrutinizer ignore-type */ substr($chars, 8, 4).'-'; |
|
219 | + $uuid .= /** @scrutinizer ignore-type */ substr($chars, 12, 4).'-'; |
|
220 | + $uuid .= /** @scrutinizer ignore-type */ substr($chars, 16, 4).'-'; |
|
221 | 221 | $uuid .= /** @scrutinizer ignore-type */ substr($chars, 20, 12); |
222 | - return $prefix . $uuid; |
|
222 | + return $prefix.$uuid; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | // if called from a class, guess based on the class name; |
265 | 265 | // otherwise, on the filename relative to ROOT |
266 | 266 | $myName = $caller['class'] ?? substr($caller['file'], strlen(ROOT)); |
267 | - $loggerInstance->debug(1,$caller); |
|
268 | - $loggerInstance->debug(1,"\nFOUND ".$myName."\n"); |
|
267 | + $loggerInstance->debug(1, $caller); |
|
268 | + $loggerInstance->debug(1, "\nFOUND ".$myName."\n"); |
|
269 | 269 | if (preg_match("/diag/", $myName) == 1) { |
270 | 270 | $ret = "diagnostics"; |
271 | 271 | } elseif (preg_match("/core/", $myName) == 1) { |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } else { |
280 | 280 | $ret = "web_user"; |
281 | 281 | } |
282 | - $loggerInstance->debug(1,"\nRETURNING ".$ret."\n"); |
|
282 | + $loggerInstance->debug(1, "\nRETURNING ".$ret."\n"); |
|
283 | 283 | return $ret; |
284 | 284 | } |
285 | 285 | |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | if ($catalogue === NULL) { |
298 | 298 | $theCatalogue = Entity::determineOwnCatalogue(); |
299 | 299 | textdomain($theCatalogue); |
300 | - bindtextdomain($theCatalogue, ROOT . "/translation/"); |
|
300 | + bindtextdomain($theCatalogue, ROOT."/translation/"); |
|
301 | 301 | } else { |
302 | 302 | textdomain($catalogue); |
303 | - bindtextdomain($catalogue, ROOT . "/translation/"); |
|
303 | + bindtextdomain($catalogue, ROOT."/translation/"); |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 |