Test Setup Failed
Branch master (b368d1)
by Stefan
05:40
created
devices/apple_mobileconfig/MobileconfigSuperclass.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         \core\common\Entity::intoThePotatoes();
146 146
         // that's what all variants support. Sub-classes can change it.
147 147
         $this->setSupportedEapMethods([\core\common\EAP::EAPTYPE_PEAP_MSCHAP2, \core\common\EAP::EAPTYPE_TTLS_PAP, \core\common\EAP::EAPTYPE_TTLS_MSCHAP2, \core\common\EAP::EAPTYPE_SILVERBULLET]);
148
-        foreach(\core\common\EAP::listKnownEAPTypes() as $eapType) {
148
+        foreach (\core\common\EAP::listKnownEAPTypes() as $eapType) {
149 149
             if ($eapType->isPasswordRequired() || $eapType->isPasswordOptional()) {
150 150
                 $this->specialities['internal:verify_userinput_suffix'][serialize($eapType->getArrayRep())] = _("It is not possible to actively verify the user input for suffix match; but if there is no 'Terms of Use' configured, the installer will display a corresponding hint to the user instead.");
151 151
                 $this->specialities['media:openroaming'][serialize($eapType->getArrayRep())] = _("OpenRoaming is not provisioned due to severe UI limitations during install time.");
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
       <key>PayloadDescription</key>
186 186
          <string>$tagline</string>
187 187
       <key>PayloadDisplayName</key>
188
-         <string>" . \config\ConfAssistant::CONSORTIUM['display_name'] . "</string>
188
+         <string>".\config\ConfAssistant::CONSORTIUM['display_name']."</string>
189 189
       <key>PayloadIdentifier</key>
190
-         <string>" . self::IPHONE_PAYLOAD_PREFIX . ".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang</string>
190
+         <string>" . self::IPHONE_PAYLOAD_PREFIX.".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang</string>
191 191
       <key>PayloadOrganization</key>
192
-         <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>
192
+         <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>
193 193
       <key>PayloadType</key>
194 194
          <string>Configuration</string>
195 195
       <key>PayloadUUID</key>
196
-         <string>" . \core\common\Entity::uuid('', self::IPHONE_PAYLOAD_PREFIX . $this->massagedConsortium . $this->massagedCountry . $this->massagedInst . $this->massagedProfile) . "</string>
196
+         <string>" . \core\common\Entity::uuid('', self::IPHONE_PAYLOAD_PREFIX.$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile)."</string>
197 197
       <key>PayloadVersion</key>
198 198
          <integer>1</integer>";
199 199
         \core\common\Entity::outOfThePotatoes();
@@ -225,21 +225,21 @@  discard block
 block discarded – undo
225 225
     {
226 226
         \core\common\Entity::intoThePotatoes();
227 227
         if (isset($this->attributes['support:info_file'])) {
228
-            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;
228
+            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;
229 229
         }
230 230
         if ($this->attributes['internal:verify_userinput_suffix'][0] != 0) {
231 231
             if ($this->attributes['internal:hint_userinput_suffix'][0] != 0) {
232
-                $retval = MobileconfigSuperclass::BUFFER_CONSENT_PRE . sprintf(_("Important Notice: your username MUST end exactly with '...@%s' !"), $this->attributes['internal:realm'][0]) . MobileconfigSuperclass::BUFFER_CONSENT_POST;
232
+                $retval = MobileconfigSuperclass::BUFFER_CONSENT_PRE.sprintf(_("Important Notice: your username MUST end exactly with '...@%s' !"), $this->attributes['internal:realm'][0]).MobileconfigSuperclass::BUFFER_CONSENT_POST;
233 233
                 \core\common\Entity::outOfThePotatoes();
234 234
                 return $retval;
235 235
             } else { 
236 236
             if (strlen($this->attributes['internal:realm'][0]) > 0) {
237 237
                 /// note space between variable and exclamation mark - makes sure users don't mistakenly think the exclamation mark is part of the required username!
238
-                $retval = MobileconfigSuperclass::BUFFER_CONSENT_PRE . sprintf(_("Important Notice: your username MUST contain an '@' and end with ...%s !"), $this->attributes['internal:realm'][0]) . MobileconfigSuperclass::BUFFER_CONSENT_POST;
238
+                $retval = MobileconfigSuperclass::BUFFER_CONSENT_PRE.sprintf(_("Important Notice: your username MUST contain an '@' and end with ...%s !"), $this->attributes['internal:realm'][0]).MobileconfigSuperclass::BUFFER_CONSENT_POST;
239 239
                 \core\common\Entity::outOfThePotatoes();
240 240
                 return $retval;
241 241
             }
242
-            $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;
242
+            $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;
243 243
             \core\common\Entity::outOfThePotatoes();
244 244
             return $retval;
245 245
             }
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         // also escape htmlspecialchars
264 264
         // not all names and profiles have a name, so be prepared
265 265
 
266
-        $this->loggerInstance->debug(5, "List of available attributes: " . var_export($this->attributes, TRUE));
266
+        $this->loggerInstance->debug(5, "List of available attributes: ".var_export($this->attributes, TRUE));
267 267
 
268 268
         $this->instName = $this->attributes['general:instname'][0] ?? _("Unnamed Organisation");
269 269
         $this->profileName = $this->attributes['profile:name'][0] ?? _("Unnamed Profile");
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 
306 306
         file_put_contents('installer_profile', $outputXml);
307 307
 
308
-        $fileName = $this->installerBasename . '.mobileconfig';
308
+        $fileName = $this->installerBasename.'.mobileconfig';
309 309
 
310 310
         if (!$this->sign) {
311 311
             rename("installer_profile", $fileName);
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             return $fileName;
314 314
         }
315 315
         // still here? Then we are signing.
316
-        $signing = system($this->sign . " installer_profile '$fileName' > /dev/null");
316
+        $signing = system($this->sign." installer_profile '$fileName' > /dev/null");
317 317
         if ($signing === FALSE) {
318 318
             $this->loggerInstance->debug(2, "Signing the mobileconfig installer $fileName FAILED!\n");
319 319
         }
@@ -332,19 +332,19 @@  discard block
 block discarded – undo
332 332
         \core\common\Entity::intoThePotatoes();
333 333
         $ssidCount = count($this->attributes['internal:SSID']);
334 334
         $certCount = count($this->attributes['internal:CAs'][0]);
335
-        $out = "<p>" . _("For best results, please use the built-in browser (Safari) to open the configuration file.") . "</p>";
335
+        $out = "<p>"._("For best results, please use the built-in browser (Safari) to open the configuration file.")."</p>";
336 336
         $out .= "<p>";
337 337
         $out .= _("The profile will install itself after you click (or tap) the button. You will be asked for confirmation/input at several points:");
338 338
         $out .= "<ul>";
339
-        $out .= "<li>" . _("to install the profile") . "</li>";
340
-        $out .= "<li>" . ngettext("to accept the server certificate authority", "to accept the server certificate authorities", $certCount);
339
+        $out .= "<li>"._("to install the profile")."</li>";
340
+        $out .= "<li>".ngettext("to accept the server certificate authority", "to accept the server certificate authorities", $certCount);
341 341
         if ($certCount > 1) {
342
-            $out .= " " . sprintf(_("(%d times)"), $certCount);
342
+            $out .= " ".sprintf(_("(%d times)"), $certCount);
343 343
         }
344 344
         $out .= "</li>";
345
-        $out .= "<li>" . _("to enter the username and password you have been given by your organisation");
345
+        $out .= "<li>"._("to enter the username and password you have been given by your organisation");
346 346
         if ($ssidCount > 1) {
347
-            $out .= " " . sprintf(_("(%d times each, because %s is installed for %d SSIDs)"), $ssidCount, \config\ConfAssistant::CONSORTIUM['display_name'], $ssidCount);
347
+            $out .= " ".sprintf(_("(%d times each, because %s is installed for %d SSIDs)"), $ssidCount, \config\ConfAssistant::CONSORTIUM['display_name'], $ssidCount);
348 348
         }
349 349
         $out .= "</li>";
350 350
         $out .= "</ul>";
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
                <key>ServiceProviderRoamingEnabled</key>
385 385
                <true/>
386 386
                <key>DisplayedOperatorName</key>
387
-               <string>" . $oiName . "</string>";
387
+               <string>" . $oiName."</string>";
388 388
         // if we don't know the realm, omit the entire DomainName key
389 389
         if (isset($this->attributes['internal:realm'])) {
390 390
             $retval .= "<key>DomainName</key>
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
                 <array>";
398 398
 
399 399
         foreach ($consortiumOi as $oneCons) {
400
-            $retval .= "<string>" . strtoupper($oneCons) . "</string>";
400
+            $retval .= "<string>".strtoupper($oneCons)."</string>";
401 401
         }
402 402
 
403 403
         $retval .= "</array>";
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
                   <dict>
436 436
                       <key>AcceptEAPTypes</key>
437 437
                          <array>
438
-                            <integer>" . $eapType['OUTER'] . "</integer>
438
+                            <integer>" . $eapType['OUTER']."</integer>
439 439
                          </array>
440 440
                       <key>EAPFASTProvisionPAC</key>
441 441
                             <true />
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 ";
449 449
         if ($realm !== NULL) {
450 450
             $retval .= "<key>OuterIdentity</key>
451
-                                    <string>" . htmlspecialchars($realm, ENT_XML1, 'UTF-8') . "</string>
451
+                                    <string>" . htmlspecialchars($realm, ENT_XML1, 'UTF-8')."</string>
452 452
 ";
453 453
         }
454 454
         $retval .= "<key>PayloadCertificateAnchorUUID</key>
@@ -472,11 +472,11 @@  discard block
 block discarded – undo
472 472
         $retval .= "
473 473
                          </array>";
474 474
         if ($eapType['INNER'] == \core\common\EAP::NE_SILVERBULLET) {
475
-            $retval .= "<key>UserName</key><string>" . $this->clientCert["certObject"]->username . "</string>";
475
+            $retval .= "<key>UserName</key><string>".$this->clientCert["certObject"]->username."</string>";
476 476
         }
477 477
         $retval .= "
478 478
                       <key>TTLSInnerAuthentication</key>
479
-                         <string>" . ($eapType['INNER'] == \core\common\EAP::NE_PAP ? "PAP" : "MSCHAPv2") . "</string>
479
+                         <string>" . ($eapType['INNER'] == \core\common\EAP::NE_PAP ? "PAP" : "MSCHAPv2")."</string>
480 480
                    </dict>";
481 481
         return $retval;
482 482
     }
@@ -496,9 +496,9 @@  discard block
 block discarded – undo
496 496
             // characters are still reversed, invert on use!
497 497
             $buffer .= "<string>Manual</string>
498 498
                   <key>ProxyServer</key>
499
-                  <string>" . strrev($serverAndPort[1]) . "</string>
499
+                  <string>" . strrev($serverAndPort[1])."</string>
500 500
                   <key>ProxyServerPort</key>
501
-                  <integer>" . strrev($serverAndPort[0]) . "</integer>
501
+                  <integer>" . strrev($serverAndPort[0])."</integer>
502 502
                   <key>ProxyPACFallbackAllowed</key>
503 503
                   <false/>";
504 504
         } else {
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                     throw new Exception("SSID must be a string!");
529 529
                 }
530 530
                 $escapedSSID = htmlspecialchars($toBeConfigured, ENT_XML1, 'UTF-8');
531
-                $payloadIdentifier = "wifi." . $this->serial;
531
+                $payloadIdentifier = "wifi.".$this->serial;
532 532
                 $payloadShortName = sprintf(_("%s - SSID %s"), $prettyName, $escapedSSID);
533 533
                 $payloadName = sprintf(_("%s configuration for network name %s"), $prettyName, $escapedSSID);
534 534
                 $encryptionTypeString = "WPA";
@@ -558,9 +558,9 @@  discard block
 block discarded – undo
558 558
                 if (count($toBeConfigured) == 0) {
559 559
                     return "";
560 560
                 }
561
-                $payloadIdentifier = "hs20.".implode('-',$toBeConfigured);
561
+                $payloadIdentifier = "hs20.".implode('-', $toBeConfigured);
562 562
                 $payloadShortName = sprintf(_("%s - RCOI"), $prettyName);
563
-                $payloadName = sprintf(_("%s configuration (Passpoint RCOI)"),$prettyName);
563
+                $payloadName = sprintf(_("%s configuration (Passpoint RCOI)"), $prettyName);
564 564
                 $encryptionTypeString = "WPA";
565 565
                 $setupModesString = "";
566 566
                 $wifiNetworkIdentification = $this->passPointBlock($toBeConfigured, $prettyName);
@@ -579,11 +579,11 @@  discard block
 block discarded – undo
579 579
                <key>PayloadDisplayName</key>
580 580
                   <string>$payloadShortName</string>
581 581
                <key>PayloadIdentifier</key>
582
-                  <string>" . self::IPHONE_PAYLOAD_PREFIX . ".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang.$payloadIdentifier</string>
582
+                  <string>".self::IPHONE_PAYLOAD_PREFIX.".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang.$payloadIdentifier</string>
583 583
                <key>PayloadOrganization</key>
584
-                  <string>" . $this->massagedConsortium . ".1x-config.org</string>
584
+                  <string>".$this->massagedConsortium.".1x-config.org</string>
585 585
                <key>PayloadType</key>
586
-                  <string>com.apple." . ($blocktype == MobileconfigSuperclass::NETWORK_BLOCK_TYPE_WIRED ? "firstactiveethernet" : "wifi") . ".managed</string>";
586
+                  <string>com.apple." . ($blocktype == MobileconfigSuperclass::NETWORK_BLOCK_TYPE_WIRED ? "firstactiveethernet" : "wifi").".managed</string>";
587 587
         $retval .= $this->proxySettings();
588 588
         $retval .= $setupModesString;
589 589
         if ($eapType['INNER'] == \core\common\EAP::NE_SILVERBULLET) {
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
         }
596 596
         $retval .= "
597 597
                <key>PayloadUUID</key>
598
-                  <string>" . \core\common\Entity::uuid() . "</string>
598
+                  <string>" . \core\common\Entity::uuid()."</string>
599 599
                <key>PayloadVersion</key>
600 600
                   <integer>1</integer>
601 601
                   $wifiNetworkIdentification</dict>";
@@ -625,15 +625,15 @@  discard block
 block discarded – undo
625 625
 	<key>IsHotspot</key>
626 626
 	<false/>
627 627
 	<key>PayloadDescription</key>
628
-	<string>" . sprintf(_("This SSID should not be used after bootstrapping %s"), \config\ConfAssistant::CONSORTIUM['display_name']) . "</string>
628
+	<string>" . sprintf(_("This SSID should not be used after bootstrapping %s"), \config\ConfAssistant::CONSORTIUM['display_name'])."</string>
629 629
 	<key>PayloadDisplayName</key>
630
-	<string>" . _("Disabled WiFi network") . "</string>
630
+	<string>" . _("Disabled WiFi network")."</string>
631 631
 	<key>PayloadIdentifier</key>
632
-	<string>" . self::IPHONE_PAYLOAD_PREFIX . ".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang.wifi.disabled.$this->removeSerial</string>
632
+	<string>" . self::IPHONE_PAYLOAD_PREFIX.".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang.wifi.disabled.$this->removeSerial</string>
633 633
 	<key>PayloadType</key>
634 634
 	<string>com.apple.wifi.managed</string>
635 635
 	<key>PayloadUUID</key>
636
-	<string>" . \core\common\Entity::uuid() . "</string>
636
+	<string>".\core\common\Entity::uuid()."</string>
637 637
 	<key>PayloadVersion</key>
638 638
 	<real>1</real>";
639 639
         $retval .= $this->proxySettings();
@@ -713,12 +713,12 @@  discard block
 block discarded – undo
713 713
         $mimeBlob = base64_encode($binaryBlob);
714 714
         $mimeFormatted = chunk_split($mimeBlob, 52, "\r\n");
715 715
         $payloadUUID = \core\common\Entity::uuid('', $mimeBlob);
716
-        $retArray = ["block" => "<dict>" .
716
+        $retArray = ["block" => "<dict>".
717 717
             // we don't include the import password. It's displayed on screen, and should be input by the user.
718 718
             // <key>Password</key>
719 719
             //   <string>" . $this->clientCert['password'] . "</string>
720 720
             "<key>PayloadCertificateFileName</key>
721
-                     <string>" . $this->massagedConsortium . ".pfx</string>
721
+                     <string>" . $this->massagedConsortium.".pfx</string>
722 722
                   <key>PayloadContent</key>
723 723
                      <data>
724 724
 $mimeFormatted
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
                   <key>PayloadDescription</key>
727 727
                      <string>MIME Base-64 encoded PKCS#12 Client Certificate</string>
728 728
                   <key>PayloadDisplayName</key>
729
-                     <string>" . _("User certificate") . "</string>
729
+                     <string>"._("User certificate")."</string>
730 730
                   <key>PayloadIdentifier</key>
731 731
                      <string>com.apple.security.pkcs12.$payloadUUID</string>
732 732
                   <key>PayloadType</key>
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
                   <key>PayloadVersion</key>
737 737
                      <integer>1</integer>
738 738
                 </dict>",
739
-            "UUID" => $payloadUUID,];
739
+            "UUID" => $payloadUUID, ];
740 740
         \core\common\Entity::outOfThePotatoes();
741 741
         return $retArray;
742 742
     }
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
         }
755 755
         $expiryTime = new \DateTime($this->clientCert['certObject']->expiry);
756 756
         return "<key>RemovalDate</key>
757
-        <date>" . $expiryTime->format("Y-m-d") . "T" . $expiryTime->format("H:i:s") . "Z</date>";
757
+        <date>" . $expiryTime->format("Y-m-d")."T".$expiryTime->format("H:i:s")."Z</date>";
758 758
     }
759 759
 
760 760
     /**
@@ -776,27 +776,27 @@  discard block
 block discarded – undo
776 776
             $stream = "
777 777
             <dict>
778 778
                <key>PayloadCertificateFileName</key>
779
-               <string>" . $ca['uuid'] . ".der</string>
779
+               <string>" . $ca['uuid'].".der</string>
780 780
                <key>PayloadContent</key>
781 781
                <data>
782
-" . $trimmedPem . "</data>
782
+" . $trimmedPem."</data>
783 783
                <key>PayloadDescription</key>
784
-               <string>" . sprintf(_("The %s Certification Authority"), \core\common\Entity::$nomenclature_inst) . "</string>
784
+               <string>" . sprintf(_("The %s Certification Authority"), \core\common\Entity::$nomenclature_inst)."</string>
785 785
                <key>PayloadDisplayName</key>
786 786
                <string>" . 
787 787
                     /// example: "Identity Provider CA #1 (Root)"
788
-                    sprintf(_("%s CA #%d (%s)" ), 
788
+                    sprintf(_("%s CA #%d (%s)"), 
789 789
                             \core\common\Entity::$nomenclature_inst, 
790
-                            count($this->CAsAccountedFor)+1, 
791
-                            ($ca['root'] ? _("Root") : _("Intermediate"))) . 
790
+                            count($this->CAsAccountedFor) + 1, 
791
+                            ($ca['root'] ? _("Root") : _("Intermediate"))). 
792 792
               "</string>
793 793
                <key>PayloadIdentifier</key>
794
-               <string>" . self::IPHONE_PAYLOAD_PREFIX . ".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.credential.$this->caSerial</string>
794
+               <string>" . self::IPHONE_PAYLOAD_PREFIX.".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.credential.$this->caSerial</string>
795 795
                <key>PayloadOrganization</key>
796
-               <string>" . $this->massagedConsortium . ".1x-config.org</string>
796
+               <string>".$this->massagedConsortium.".1x-config.org</string>
797 797
                <key>PayloadType</key>
798 798
                <string>com.apple.security.root</string>
799
-               <key>PayloadUUID</key><string>" . $ca['uuid'] . "</string>
799
+               <key>PayloadUUID</key><string>" . $ca['uuid']."</string>
800 800
                <key>PayloadVersion</key>
801 801
                <integer>1</integer>
802 802
             </dict>";
Please login to merge, or discard this patch.