Passed
Push — master ( 542ccc...11646b )
by Tomasz
06:50
created
devices/linux/DeviceLinuxSh.php 1 patch
Braces   +39 added lines, -28 removed lines patch added patch discarded remove patch
@@ -67,10 +67,11 @@  discard block
 block discarded – undo
67 67
 
68 68
      $out_string .= $this->printNMScript($SSIDs,$delSSIDs);
69 69
      $out_string .= $this->writeWpaConf($SSIDs);
70
-     if($this->selected_eap == \core\common\EAP::EAPTYPE_TLS) 
71
-       $out_string .= $this->printP12Dialog();
72
-     else
73
-       $out_string .= $this->printPasswordDialog();
70
+     if($this->selected_eap == \core\common\EAP::EAPTYPE_TLS) {
71
+            $out_string .= $this->printP12Dialog();
72
+     } else {
73
+            $out_string .= $this->printPasswordDialog();
74
+     }
74 75
      $out_string .= $this->checkNMResultAndCont();
75 76
      $installer_path = $this->installerBasename.'.sh';
76 77
       file_put_contents($installer_path, $out_string);
@@ -86,13 +87,15 @@  discard block
 block discarded – undo
86 87
     if($ssid_ct > 1) {
87 88
         if($ssid_ct > 2) {
88 89
             $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to the following networks:"),implode(', ',\config\ConfAssistant::CONSORTIUM['ssid']))." ";
89
-        } else
90
-            $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to:"),implode(', ',\config\ConfAssistant::CONSORTIUM['ssid']))." ";
90
+        } else {
91
+                    $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to:"),implode(', ',\config\ConfAssistant::CONSORTIUM['ssid']))." ";
92
+        }
91 93
         $i = 0;
92 94
         foreach ($this->attributes['internal:SSID'] as $ssid=>$v) {
93 95
            if(! in_array($ssid, \config\ConfAssistant::CONSORTIUM['ssid'])) {
94
-             if($i > 0)
95
-           $out .= ", ";
96
+             if($i > 0) {
97
+                        $out .= ", ";
98
+             }
96 99
          $i++;
97 100
          $out .= "<strong>$ssid</strong>";
98 101
        }
@@ -100,9 +103,9 @@  discard block
 block discarded – undo
100 103
     $out .= "<p>";
101 104
     }
102 105
    $out .= _("The installer will create .cat_installer sub-directory in your home directory and will copy your server certificates there.");
103
-if($this->eap == \core\common\EAP::EAPTYPE_TLS)
106
+if($this->eap == \core\common\EAP::EAPTYPE_TLS) {
104 107
    $out .= _("In order to connect to the network you will need a personal certificate in the form of a p12 file. You should obtain this certificate from your home institution. Consult the support page to find out how this certificate can be obtained. Such certificate files are password protected. You should have both the file and the password available during the installation process. Your p12 file will also be copied to the .cat_installer directory.");
105
-else {
108
+} else {
106 109
    $out .= _("In order to connect to the network you will need an account from your home institution. You should consult the support page to find out how this account can be obtained. It is very likely that your account is already activated.");
107 110
    $out .= "<p>";
108 111
    $out .= _("You will be requested to enter your account credentials during the installation. This information will be saved so that you will reconnect to the network automatically each time you are in the range.");
@@ -150,10 +153,11 @@  discard block
 block discarded – undo
150 153
 
151 154
 
152 155
 private function printProfileConfirmation() {
153
- if($this->attributes['internal:profile_count'][0] > 1)
154
-       $out = 'if ! ask "'.sprintf(_("This installer will only work properly if you are a member of %s and the user group: %s."),'${bf}'.$this->attributes['general:instname'][0].'${n}','${bf}'.$this->attributes['profile:name'][0]).'${n}"';
155
-    else
156
-       $out = 'if ! ask "'.sprintf(_("This installer will only work properly if you are a member of %s."),'${bf}'.$this->attributes['general:instname'][0]).'${n}"';
156
+ if($this->attributes['internal:profile_count'][0] > 1) {
157
+        $out = 'if ! ask "'.sprintf(_("This installer will only work properly if you are a member of %s and the user group: %s."),'${bf}'.$this->attributes['general:instname'][0].'${n}','${bf}'.$this->attributes['profile:name'][0]).'${n}"';
158
+ } else {
159
+           $out = 'if ! ask "'.sprintf(_("This installer will only work properly if you are a member of %s."),'${bf}'.$this->attributes['general:instname'][0]).'${n}"';
160
+    }
157 161
     $out .= ' "'._("Continue").'" 1 ; then exit; fi
158 162
 ';
159 163
   return $out;
@@ -404,9 +408,10 @@  discard block
 block discarded – undo
404 408
   eap='.$e['OUTER'].'
405 409
   ca_cert="${HOME}/'.$this->local_dir.'/ca.pem"
406 410
   identity="${USER_NAME}"';
407
-  if($this->server_name)
408
-    $out .= '
411
+  if($this->server_name) {
412
+      $out .= '
409 413
   domain_suffix_match="'.$this->server_name.'"';
414
+  }
410 415
   if($this->selected_eap == \core\common\EAP::EAPTYPE_TLS) {
411 416
     $out .= '
412 417
   private_key="${HOME}/'.$this->local_dir.'/user.p12"
@@ -415,10 +420,11 @@  discard block
 block discarded – undo
415 420
     $out .= '
416 421
   phase2="auth='.$e['INNER'].'"
417 422
   password="${PASSWORD}"';
418
-  if($this->attributes['internal:use_anon_outer'][0] == 1) 
419
-    $out .= '
423
+  if($this->attributes['internal:use_anon_outer'][0] == 1) {
424
+      $out .= '
420 425
   anonymous_identity="'.$this->attributes['internal:anon_local_value'][0].'@'.$this->attributes['internal:realm'][0].'"';
421 426
   }
427
+  }
422 428
     $out .= '
423 429
 }';
424 430
 }
@@ -515,8 +521,9 @@  discard block
 block discarded – undo
515 521
 
516 522
 
517 523
 private function glueServerNames($server_list) {
518
-  if(! $server_list)
519
-    return '';
524
+  if(! $server_list) {
525
+      return '';
526
+  }
520 527
   $A0 =  array_reverse(explode('.',array_shift($server_list)));
521 528
   $B = $A0;
522 529
   foreach($server_list as $a) {
@@ -528,12 +535,14 @@  discard block
 block discarded – undo
528 535
 }
529 536
 
530 537
 private function mkSubjectAltNameList($server_list) {
531
-  if(! $server_list)
532
-    return '';
538
+  if(! $server_list) {
539
+      return '';
540
+  }
533 541
   $out = '';
534 542
   foreach($server_list as $a) {
535
-     if($out)
536
-       $out .= ','; 
543
+     if($out) {
544
+            $out .= ',';
545
+     }
537 546
      $out .= "'DNS:$a'";
538 547
   }
539 548
   return $out;
@@ -691,9 +700,10 @@  discard block
 block discarded – undo
691 700
        $out .= '
692 701
             \'password\': \'$PASSWORD\',
693 702
             \'phase2-auth\': \''.strtolower($e['INNER']).'\',';
694
-         if($this->attributes['internal:use_anon_outer'][0] == 1) 
695
-              $out .= '
703
+         if($this->attributes['internal:use_anon_outer'][0] == 1) {
704
+                       $out .= '
696 705
             \'anonymous-identity\': \''.$this->attributes['internal:anon_local_value'][0].'@'.$this->attributes['internal:realm'][0].'\',';
706
+         }
697 707
     }
698 708
     $out .= '
699 709
         })
@@ -719,9 +729,10 @@  discard block
 block discarded – undo
719 729
      }
720 730
 //   create a list of profiles to be deleted after installation
721 731
      foreach ($delSSIDs as $ssid => $cipher) {
722
-         if($cipher == 'DEL')
723
-            $out .='
732
+         if($cipher == 'DEL') {
733
+                     $out .='
724 734
         self.delete_existing_connections(\''.$ssid.'\')';
735
+         }
725 736
      }
726 737
 
727 738
 $out .='
Please login to merge, or discard this patch.