Completed
Branch master (03ec64)
by Brook
14:43
created
devices/ms/Vista7.php 1 patch
Braces   +64 added lines, -44 removed lines patch added patch discarded remove patch
@@ -45,10 +45,12 @@  discard block
 block discarded – undo
45 45
 //   create a list of profiles to be deleted after installation
46 46
      $delProfiles = [];
47 47
      foreach ($delSSIDs as $ssid => $cipher) {
48
-         if($cipher == 'DEL') 
49
-          $delProfiles[] = $ssid;
50
-         if($cipher == 'TKIP') 
51
-          $delProfiles[] = $ssid.' (TKIP)';
48
+         if($cipher == 'DEL') {
49
+                   $delProfiles[] = $ssid;
50
+         }
51
+         if($cipher == 'TKIP') {
52
+                   $delProfiles[] = $ssid.' (TKIP)';
53
+         }
52 54
      }
53 55
 
54 56
      if ($this->selected_eap == EAP::$TLS || $this->selected_eap == EAP::$PEAP_MSCHAP2 || $this->selected_eap == EAP::$PWD || $this->selected_eap == EAP::$TTLS_PAP) {
@@ -75,8 +77,9 @@  discard block
 block discarded – undo
75 77
     $this->writeProfilesNSH($WindowsProfile, $CA_files,$set_wired);
76 78
     $this->writeAdditionalDeletes($delProfiles);
77 79
     $this->copyFiles($this->selected_eap);
78
-    if(isset($this->attributes['internal:logo_file']))
79
-       $this->combineLogo($this->attributes['internal:logo_file']);
80
+    if(isset($this->attributes['internal:logo_file'])) {
81
+           $this->combineLogo($this->attributes['internal:logo_file']);
82
+    }
80 83
     $this->writeMainNSH($this->selected_eap,$this->attributes);
81 84
     $this->compileNSIS();
82 85
     $installer_path = $this->signInstaller($this->attributes); 
@@ -93,22 +96,24 @@  discard block
 block discarded – undo
93 96
     if($ssid_ct > 1) {
94 97
         if($ssid_ct > 2) {
95 98
             $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to the following networks:"),implode(', ',Config::$CONSORTIUM['ssid']))." ";
96
-        } else
97
-            $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to:"),implode(', ',Config::$CONSORTIUM['ssid']))." ";
99
+        } else {
100
+                    $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to:"),implode(', ',Config::$CONSORTIUM['ssid']))." ";
101
+        }
98 102
         $i = 0;
99 103
         foreach ($this->attributes['internal:SSID'] as $ssid=>$v) {
100 104
            if(! in_array($ssid, Config::$CONSORTIUM['ssid'])) {
101
-             if($i > 0)
102
-           $out .= ", ";
105
+             if($i > 0) {
106
+                        $out .= ", ";
107
+             }
103 108
          $i++;
104 109
          $out .= "<strong>$ssid</strong>";
105 110
        }
106 111
     }
107 112
     $out .= "<p>";
108 113
     }
109
-    if($this->eap == EAP::$TLS)
110
-        $out .= _("In order to connect to the network you will need an 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.");
111
-    else {
114
+    if($this->eap == EAP::$TLS) {
115
+            $out .= _("In order to connect to the network you will need an 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.");
116
+    } else {
112 117
     $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.");
113 118
 
114 119
     if($this->eap == EAP::$PEAP_MSCHAP2) {
@@ -119,8 +124,9 @@  discard block
 block discarded – undo
119 124
              $out .= _("You will be required to enter the same credentials for each of the configured notworks:")." ";
120 125
              $i = 0;
121 126
             foreach ($this->attributes['internal:SSID'] as $ssid=>$v) {
122
-                 if($i > 0)
123
-                   $out .= ", ";
127
+                 if($i > 0) {
128
+                                    $out .= ", ";
129
+                 }
124 130
                  $i++;
125 131
                  $out .= "<strong>$ssid</strong>";
126 132
             }
@@ -190,11 +196,12 @@  discard block
 block discarded – undo
190 196
 if($use_anon == 1) {
191 197
     $profile_file_contents .= '<ClientSideCredential>
192 198
 ';
193
-    if($outer_user == '')
194
-        $profile_file_contents .= '<AnonymousIdentity>@</AnonymousIdentity>';
195
-    else
196
-        $profile_file_contents .= '<AnonymousIdentity>'.$outer_user.'@'.$realm.'</AnonymousIdentity>';
197
-$profile_file_contents .= '
199
+    if($outer_user == '') {
200
+            $profile_file_contents .= '<AnonymousIdentity>@</AnonymousIdentity>';
201
+    } else {
202
+            $profile_file_contents .= '<AnonymousIdentity>'.$outer_user.'@'.$realm.'</AnonymousIdentity>';
203
+    }
204
+    $profile_file_contents .= '
198 205
 </ClientSideCredential>
199 206
 ';
200 207
 }
@@ -225,9 +232,7 @@  discard block
 block discarded – undo
225 232
 </Config>
226 233
 ';
227 234
 
228
-}
229
-
230
-elseif( $eap == EAP::$TLS) {
235
+} elseif( $eap == EAP::$TLS) {
231 236
   $profile_file_contents .= '
232 237
 
233 238
 <Config xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1" 
@@ -242,26 +247,29 @@  discard block
 block discarded – undo
242 247
 <eapTls:DisableUserPromptForServerValidation>true</eapTls:DisableUserPromptForServerValidation>
243 248
 <eapTls:ServerNames>'.$servers.'</eapTls:ServerNames>';
244 249
 if($ca_array) {
245
-foreach ($ca_array as $CA)
250
+foreach ($ca_array as $CA) {
246 251
     if($CA['root'])
247 252
        $profile_file_contents .= "<eapTls:TrustedRootCA>".$CA['sha1']."</eapTls:TrustedRootCA>\n";
248 253
 }
254
+}
249 255
 $profile_file_contents .= '</eapTls:ServerValidation>
250 256
 ';
251
-if(isset($attr['eap-specific:tls_use_other_id']) && $attr['eap-specific:tls_use_other_id'][0] == 'on')
257
+if(isset($attr['eap-specific:tls_use_other_id']) && $attr['eap-specific:tls_use_other_id'][0] == 'on') {
252 258
    $profile_file_contents .= '<eapTls:DifferentUsername>true</eapTls:DifferentUsername>';
253
-else
259
+} else {
254 260
    $profile_file_contents .= '<eapTls:DifferentUsername>false</eapTls:DifferentUsername>';
261
+}
255 262
 $profile_file_contents .= '
256 263
 </eapTls:EapType>
257 264
 </baseEap:Eap>
258 265
 </Config>
259 266
 ';
260 267
 } elseif ( $eap == EAP::$PEAP_MSCHAP2) {
261
-if(isset($attr['eap:enable_nea']) && $attr['eap:enable_nea'][0] == 'on')
268
+if(isset($attr['eap:enable_nea']) && $attr['eap:enable_nea'][0] == 'on') {
262 269
    $nea = 'true';
263
-else
270
+} else {
264 271
    $nea = 'false';
272
+}
265 273
 $vista_ext = '<Config xmlns:eapUser="http://www.microsoft.com/provisioning/EapUserPropertiesV1" 
266 274
 xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1" 
267 275
   xmlns:msPeap="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1" 
@@ -273,10 +281,11 @@  discard block
 block discarded – undo
273 281
 <msPeap:DisableUserPromptForServerValidation>true</msPeap:DisableUserPromptForServerValidation> 
274 282
 <msPeap:ServerNames>'.$servers.'</msPeap:ServerNames>';
275 283
 if($ca_array) {
276
-foreach ($ca_array as $CA)
284
+foreach ($ca_array as $CA) {
277 285
     if($CA['root'])
278 286
        $vista_ext .= "<msPeap:TrustedRootCA>".$CA['sha1']."</msPeap:TrustedRootCA>\n";
279 287
 }
288
+}
280 289
 $vista_ext .= '</msPeap:ServerValidation>
281 290
 <msPeap:FastReconnect>true</msPeap:FastReconnect> 
282 291
 <msPeap:InnerEapOptional>0</msPeap:InnerEapOptional> 
@@ -300,10 +309,11 @@  discard block
 block discarded – undo
300 309
 <DisableUserPromptForServerValidation>true</DisableUserPromptForServerValidation>
301 310
 <ServerNames>'.$servers.'</ServerNames>';
302 311
 if($ca_array) {
303
-foreach ($ca_array as $CA)
312
+foreach ($ca_array as $CA) {
304 313
     if($CA['root'])
305 314
         $w7_ext .= "<TrustedRootCA>".$CA['sha1']."</TrustedRootCA>\n";
306 315
 }
316
+}
307 317
 $w7_ext .= '</ServerValidation>
308 318
 <FastReconnect>true</FastReconnect> 
309 319
 <InnerEapOptional>false</InnerEapOptional> 
@@ -316,14 +326,15 @@  discard block
 block discarded – undo
316 326
 <EnableQuarantineChecks>'.$nea.'</EnableQuarantineChecks>
317 327
 <RequireCryptoBinding>false</RequireCryptoBinding>
318 328
 ';
319
-if($use_anon == 1)
320
-$w7_ext .='<PeapExtensions>
329
+if($use_anon == 1) {
330
+    $w7_ext .='<PeapExtensions>
321 331
 <IdentityPrivacy xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2">
322 332
 <EnableIdentityPrivacy>true</EnableIdentityPrivacy>
323 333
 <AnonymousUserName>'.$outer_user.'</AnonymousUserName>
324 334
 </IdentityPrivacy>
325 335
 </PeapExtensions>
326 336
 ';
337
+}
327 338
 $w7_ext .='</EapType>
328 339
 </Eap>
329 340
 </Config>
@@ -372,12 +383,13 @@  discard block
 block discarded – undo
372 383
 <useOneX>true</useOneX>
373 384
 </authEncryption>
374 385
 ';
375
-if($auth == 'WPA2')
376
-$profile_file_contents .= '<PMKCacheMode>enabled</PMKCacheMode>
386
+if($auth == 'WPA2') {
387
+    $profile_file_contents .= '<PMKCacheMode>enabled</PMKCacheMode>
377 388
 <PMKCacheTTL>720</PMKCacheTTL>
378 389
 <PMKCacheSize>128</PMKCacheSize>
379 390
 <preAuthMode>disabled</preAuthMode>
380 391
 ';
392
+}
381 393
 $profile_file_contents .= '<OneX xmlns="http://www.microsoft.com/networking/OneX/v1">
382 394
 <cacheUserData>true</cacheUserData>
383 395
 <authMode>user</authMode>
@@ -390,10 +402,12 @@  discard block
 block discarded – undo
390 402
 </WLANProfile>
391 403
 ';
392 404
 
393
-if(! is_dir('w7'))
405
+if(! is_dir('w7')) {
394 406
   mkdir('w7');
395
-if(! is_dir('vista'))
407
+}
408
+if(! is_dir('vista')) {
396 409
   mkdir('vista');
410
+}
397 411
 $xml_f_name = "vista/wlan_prof-$i.xml";
398 412
 $xml_f = fopen($xml_f_name,'w');
399 413
 fwrite($xml_f,$profile_file_contents. $eap_config['vista']. $closing) ;
@@ -422,10 +436,12 @@  discard block
 block discarded – undo
422 436
 </MSM>
423 437
 </LANProfile>
424 438
 ';
425
-if(! is_dir('w7'))
439
+if(! is_dir('w7')) {
426 440
   mkdir('w7');
427
-if(! is_dir('vista'))
441
+}
442
+if(! is_dir('vista')) {
428 443
   mkdir('vista');
444
+}
429 445
 $xml_f_name = "vista/lan_prof.xml";
430 446
 $xml_f = fopen($xml_f_name,'w');
431 447
 fwrite($xml_f,$profile_file_contents. $eap_config['vista']. $closing) ;
@@ -462,8 +478,9 @@  discard block
 block discarded – undo
462 478
 PWD=>['str'=>'PWD','exec'=>'user'],
463 479
 ];
464 480
 $fcontents = '';
465
-if(Config::$NSIS_VERSION >= 3)
481
+if(Config::$NSIS_VERSION >= 3) {
466 482
     $fcontents .=  "Unicode true\n";
483
+}
467 484
  
468 485
 // Uncomment the line below if you want this module to run under XP (only displaying a warning)
469 486
 // $fcontents .= "!define ALLOW_XP\n";
@@ -476,8 +493,9 @@  discard block
 block discarded – undo
476 493
 
477 494
 $fcontents .= '!define '.$eap_str;
478 495
 $fcontents .= "\n".'!define EXECLEVEL "'.$exec_level.'"';
479
-if($attr['internal:profile_count'][0] > 1)
480
-$fcontents .= "\n".'!define USER_GROUP "'.$this->translateString(str_replace('"','$\\"',$attr['profile:name'][0]), $this->code_page).'"';
496
+if($attr['internal:profile_count'][0] > 1) {
497
+    $fcontents .= "\n".'!define USER_GROUP "'.$this->translateString(str_replace('"','$\\"',$attr['profile:name'][0]), $this->code_page).'"';
498
+}
481 499
 $fcontents .= '
482 500
 Caption "'. $this->translateString(sprintf(sprint_nsi(_("%s installer for %s")),Config::$CONSORTIUM['name'],$attr['general:instname'][0]), $this->code_page).'"
483 501
 !define APPLICATION "'. $this->translateString(sprintf(sprint_nsi(_("%s installer for %s")),Config::$CONSORTIUM['name'],$attr['general:instname'][0]), $this->code_page).'"
@@ -501,9 +519,10 @@  discard block
 block discarded – undo
501 519
 !endif
502 520
 ';
503 521
 
504
-if(isset($this->attributes['media:wired'][0]) && $attr['media:wired'][0] == 'on')
522
+if(isset($this->attributes['media:wired'][0]) && $attr['media:wired'][0] == 'on') {
505 523
   $fcontents .= '!define WIRED
506 524
 ';
525
+}
507 526
 
508 527
 $f = fopen('main.nsh','w');
509 528
 fwrite($f, $fcontents);
@@ -515,8 +534,9 @@  discard block
 block discarded – undo
515 534
 debug(4,"writeProfilesNSH");
516 535
 debug(4,$P);
517 536
   $fcontents = '';
518
-  foreach($P as $p) 
519
-    $fcontents .= "!insertmacro define_wlan_profile $p\n";
537
+  foreach($P as $p) {
538
+      $fcontents .= "!insertmacro define_wlan_profile $p\n";
539
+  }
520 540
   
521 541
 $f = fopen('profiles.nsh','w');
522 542
 fwrite($f, $fcontents);
Please login to merge, or discard this patch.
devices/ms/WindowsCommon.php 1 patch
Braces   +28 added lines, -23 removed lines patch added patch discarded remove patch
@@ -58,10 +58,11 @@  discard block
 block discarded – undo
58 58
  debug(4,"Logo size: "); debug(4,$logo_size); debug(4,"max=$max\n");
59 59
 // resize logo if necessary
60 60
  if($max > $max_size) {
61
-   if($max == $logo_size['width'])
62
-      $logo->scaleImage($max_size,0);
63
-   else
64
-      $logo->scaleImage(0,$max_size);
61
+   if($max == $logo_size['width']) {
62
+         $logo->scaleImage($max_size,0);
63
+   } else {
64
+         $logo->scaleImage(0,$max_size);
65
+   }
65 66
  }
66 67
  $logo_size = $logo->getImageGeometry();
67 68
  debug(4,"New logo size: "); debug(4,$logo_size);
@@ -80,17 +81,18 @@  discard block
 block discarded – undo
80 81
    $e = $this->installerBasename.'.exe';
81 82
    if($this->sign) {
82 83
       $o = system($this->sign." installer.exe '$e' > /dev/null");
84
+   } else {
85
+         rename("installer.exe",$e);
83 86
    }
84
-   else
85
-      rename("installer.exe",$e);
86 87
    return $e;
87 88
 }
88 89
 
89 90
 protected function compileNSIS() {
90
-   if(Config::$NSIS_VERSION >= 3)
91
-      $makensis = Config::$PATHS['makensis'] . " -INPUTCHARSET UTF8";
92
-   else
93
-      $makensis = Config::$PATHS['makensis']; 
91
+   if(Config::$NSIS_VERSION >= 3) {
92
+         $makensis = Config::$PATHS['makensis'] . " -INPUTCHARSET UTF8";
93
+   } else {
94
+         $makensis = Config::$PATHS['makensis'];
95
+   }
94 96
    $o = $makensis.' -V4 cat.NSI > nsis.log';
95 97
    system($o);
96 98
    debug(4,"compileNSIS:$o\n");
@@ -101,21 +103,22 @@  discard block
 block discarded – undo
101 103
 if(isset($attr['support:info_file'])) {
102 104
     $out .= '!define EXTERNAL_INFO "';
103 105
 //  debug(4,"Info file type ".$attr['support:info_file'][0]['mime']."\n");
104
-  if ($attr['internal:info_file'][0]['mime'] == 'rtf')
105
-     $out = '!define LICENSE_FILE "'. $attr['internal:info_file'][0]['name'];
106
-  elseif( $attr['internal:info_file'][0]['mime'] == 'txt') {
106
+  if ($attr['internal:info_file'][0]['mime'] == 'rtf') {
107
+       $out = '!define LICENSE_FILE "'. $attr['internal:info_file'][0]['name'];
108
+  } elseif( $attr['internal:info_file'][0]['mime'] == 'txt') {
107 109
      $in_txt = file_get_contents($attr['internal:info_file'][0]['name']);
108
-     if(Config::$NSIS_VERSION >= 3)
109
-        $out_txt = $in_txt;
110
-     else
111
-        $out_txt = iconv('UTF-8',$this->code_page.'//TRANSLIT',$in_txt);
110
+     if(Config::$NSIS_VERSION >= 3) {
111
+             $out_txt = $in_txt;
112
+     } else {
113
+             $out_txt = iconv('UTF-8',$this->code_page.'//TRANSLIT',$in_txt);
114
+     }
112 115
      if($out_txt) {
113 116
         file_put_contents('info_f.txt',$out_txt);
114 117
         $out = '!define LICENSE_FILE " info_f.txt';
115 118
      }
119
+  } else {
120
+       $out = '!define EXTERNAL_INFO "'. $attr['internal:info_file'][0]['name'];
116 121
   }
117
-  else
118
-     $out = '!define EXTERNAL_INFO "'. $attr['internal:info_file'][0]['name'];
119 122
 
120 123
   $out .= "\"\n";
121 124
 }
@@ -125,12 +128,14 @@  discard block
 block discarded – undo
125 128
 
126 129
 
127 130
 protected function writeAdditionalDeletes($P) {
128
-  if(count($P) == 0 )
129
-    return;
131
+  if(count($P) == 0 ) {
132
+      return;
133
+  }
130 134
   $f = fopen('profiles.nsh','a');
131 135
   fwrite($f,"!define AdditionalDeletes\n");
132
-  foreach ($P as $p)
133
-    fwrite($f,"!insertmacro define_delete_profile \"$p\"\n");
136
+  foreach ($P as $p) {
137
+      fwrite($f,"!insertmacro define_delete_profile \"$p\"\n");
138
+  }
134 139
   fclose($f);
135 140
 }
136 141
 
Please login to merge, or discard this patch.
devices/xml/XML.inc.php 1 patch
Braces   +29 added lines, -19 removed lines patch added patch discarded remove patch
@@ -70,8 +70,9 @@  discard block
 block discarded – undo
70 70
     return empty($this->attributes)?0:1;
71 71
   }
72 72
   public function setAttribute($attribute,$value) {
73
-    if( ! isset($this->attributes))
74
-       $this->attributes = [];
73
+    if( ! isset($this->attributes)) {
74
+           $this->attributes = [];
75
+    }
75 76
     $this->attributes[$attribute] = $value;
76 77
   }
77 78
   public function setProperty($property,$value) {
@@ -80,9 +81,10 @@  discard block
 block discarded – undo
80 81
   public function getAll() {
81 82
     $elems = get_object_vars($this);
82 83
     $objvars = [];
83
-    foreach ($elems as $key=>$val) 
84
-      if ( ($key!='attributes') && ($key!='value') ) 
84
+    foreach ($elems as $key=>$val) {
85
+          if ( ($key!='attributes') && ($key!='value') ) 
85 86
         $objvars[$key] = $val;
87
+    }
86 88
     return $objvars;
87 89
   }
88 90
 }
@@ -134,8 +136,9 @@  discard block
 block discarded – undo
134 136
     $out = get_object_vars($this);
135 137
     $OUT = [];
136 138
     foreach ($out as $o => $v) {
137
-       if(in_array($o, $E)) 
138
-         $OUT[$o] = $v;
139
+       if(in_array($o, $E)) {
140
+                $OUT[$o] = $v;
141
+       }
139 142
     }
140 143
     return($OUT);
141 144
   }
@@ -161,8 +164,9 @@  discard block
 block discarded – undo
161 164
 debug(4,"EEE:".$this->EAPType.":\n");
162 165
 debug(4,$E);
163 166
     foreach ($out as $o => $v) {
164
-       if(in_array($o, $E)) 
165
-          $OUT[$o] = $v;
167
+       if(in_array($o, $E)) {
168
+                 $OUT[$o] = $v;
169
+       }
166 170
     }
167 171
     return($OUT);
168 172
     }
@@ -259,24 +263,29 @@  discard block
 block discarded – undo
259 263
 
260 264
   $name = get_class($object);
261 265
   $name = preg_replace("/_/", "-", $name);
262
-  if ($object->getValue()) $val = $object->getValue();
263
-  else $val = '';
266
+  if ($object->getValue()) {
267
+      $val = $object->getValue();
268
+  } else {
269
+      $val = '';
270
+  }
264 271
   $simplexmlelement = '';
265 272
   if ($val instanceof SimpleXMLElement) {
266 273
     $simplexmlelement = $val;
267 274
     $val = '';
268 275
   }
269 276
   if ($val) { 
270
-    if(getType($val) == 'string')
271
-       $val = preg_replace('/&/','&amp;',$val);
277
+    if(getType($val) == 'string') {
278
+           $val = preg_replace('/&/','&amp;',$val);
279
+    }
272 280
     $node = $node->addChild($name, $val);
273
-  } 
274
-  else 
275
-    $node = $node->addChild($name);
281
+  } else {
282
+      $node = $node->addChild($name);
283
+  }
276 284
   if ($object->areAttributes()) {
277 285
     $attrs = $object->getAttributes();
278
-    foreach ($attrs as $attrt=>$attrv)
279
-      $node->addAttribute($attrt, $attrv);
286
+    foreach ($attrs as $attrt=>$attrv) {
287
+          $node->addAttribute($attrt, $attrv);
288
+    }
280 289
   }
281 290
   if ($simplexmlelement == '') {
282 291
     $fields = $object->getAll();
@@ -286,9 +295,10 @@  discard block
 block discarded – undo
286 295
           $node->addChild($name, $value);
287 296
         } else {
288 297
           if (getType($value)=='array') {
289
-            foreach ($value as $v)
290
-              if (is_object($v))
298
+            foreach ($value as $v) {
299
+                          if (is_object($v))
291 300
                 marshalObject($node, $v);
301
+            }
292 302
           } else if (getType($value)=='object')  {
293 303
             marshalObject($node, $value);
294 304
           }
Please login to merge, or discard this patch.
devices/xml/XML.php 1 patch
Braces   +34 added lines, -25 removed lines patch added patch discarded remove patch
@@ -64,11 +64,13 @@  discard block
 block discarded – undo
64 64
     if($this->all_eaps) {
65 65
       $EAPs = [];
66 66
       foreach ($attr['all_eaps'] as $eap) {
67
-         if(in_array($eap, $this->supportedEapMethods))
68
-            $EAPs[] = $eap;
67
+         if(in_array($eap, $this->supportedEapMethods)) {
68
+                     $EAPs[] = $eap;
69
+         }
69 70
       }
70
-    } else
71
-      $EAPs = [ $this->selected_eap];
71
+    } else {
72
+          $EAPs = [ $this->selected_eap];
73
+    }
72 74
 
73 75
     foreach ($EAPs as $eap) {
74 76
        $authmethods[] = $this->getAuthMethod($eap);
@@ -83,8 +85,9 @@  discard block
 block discarded – undo
83 85
        $eap_idp->setAttribute('ID',$attr['internal:realm'][0]);
84 86
        $eap_idp->setAttribute('namespace',$NAMESPACE);
85 87
     }
86
-    if($this->lang_scope === 'single')
87
-       $eap_idp->setAttribute('lang',$this->lang_index);
88
+    if($this->lang_scope === 'single') {
89
+           $eap_idp->setAttribute('lang',$this->lang_index);
90
+    }
88 91
     $eap_idp->setAttribute('version','1');
89 92
     
90 93
 
@@ -124,9 +127,10 @@  discard block
 block discarded – undo
124 127
       $obj = new $class_name();
125 128
       $obj->setValue($a[0]);
126 129
       return($obj);   
127
-   } else
128
-     return '';
129
-}
130
+   } else {
131
+        return '';
132
+   }
133
+   }
130 134
 
131 135
 
132 136
 private function getSimpleMLAttribute($attr_name) {
@@ -153,17 +157,19 @@  discard block
 block discarded – undo
153 157
       }
154 158
 
155 159
       return($objs);
156
-      } else
157
-     return '';
158
-}
160
+      } else {
161
+           return '';
162
+      }
163
+      }
159 164
 
160 165
 private function getDisplayName() {
161 166
    $attr = $this->attributes;
162 167
    $objs = [];
163 168
    if($this->lang_scope === 'global') {
164 169
       $I = $attr['general:instname']['langs'];
165
-      if($attr['internal:profile_count'][0] > 1)
166
-        $P = $attr['profile:name']['langs'];
170
+      if($attr['internal:profile_count'][0] > 1) {
171
+              $P = $attr['profile:name']['langs'];
172
+      }
167 173
       foreach( $I as $l => $v ) {
168 174
         $l = ( $l === 'C' ? 'any' : $l );
169 175
         $displayname = new DisplayName();
@@ -178,8 +184,9 @@  discard block
 block discarded – undo
178 184
    } else {
179 185
    $displayname = new DisplayName();
180 186
    $v = $attr['general:instname'][0];
181
-   if($attr['internal:profile_count'][0] > 1)
182
-       $v .= ' - '.$attr['profile:name'][0];
187
+   if($attr['internal:profile_count'][0] > 1) {
188
+          $v .= ' - '.$attr['profile:name'][0];
189
+   }
183 190
    $displayname->setValue($v);
184 191
      $objs[] = $displayname;
185 192
    }
@@ -222,8 +229,7 @@  discard block
 block discarded – undo
222 229
                $providerlocation->setProperty('Latitude',$b['lat']);
223 230
                $at1[] = $providerlocation;
224 231
           }
225
-         }
226
-         else {
232
+         } else {
227 233
                $providerlocation = new ProviderLocation();
228 234
                $b = unserialize($at[0]);
229 235
                $providerlocation->setProperty('Longitude',$b['lon']);
@@ -270,9 +276,10 @@  discard block
 block discarded – undo
270 276
       $eapmethod->setProperty('Type',$eaptype);
271 277
       $innerauthmethod->setProperty($class_name,$eapmethod);
272 278
       return ['inner_method'=>$innerauthmethod,'methodID'=> $outer_id, 'inner_methodID'=>$inner['METHOD']];
273
-   } else
274
-   return ['inner_method'=>0,'methodID'=>$outer_id, 'inner_methodID'=>0];
275
-}
279
+   } else {
280
+      return ['inner_method'=>0,'methodID'=>$outer_id, 'inner_methodID'=>0];
281
+   }
282
+   }
276 283
 
277 284
 private function getAuthMethod($eap) {
278 285
    $attr = $this->attributes;
@@ -327,12 +334,14 @@  discard block
 block discarded – undo
327 334
    $clientsidecredential = new ClientSideCredential();
328 335
 
329 336
 // OuterIdentity 
330
-   if($attr['internal:use_anon_outer'] [0])
331
-      $clientsidecredential->setProperty('OuterIdentity',$attr['internal:anon_local_value'][0].'@'.$attr['internal:realm'][0]);
337
+   if($attr['internal:use_anon_outer'] [0]) {
338
+         $clientsidecredential->setProperty('OuterIdentity',$attr['internal:anon_local_value'][0].'@'.$attr['internal:realm'][0]);
339
+   }
332 340
    $clientsidecredential->setProperty('EAPType',$eapParams['inner_methodID'] ? $eapParams['inner_methodID'] : $eapParams['methodID']);
333 341
    $authmethod->setProperty('ClientSideCredential',$clientsidecredential);
334
-   if($eapParams['inner_method'])
335
-      $authmethod->setProperty('InnerAuthenticationMethod',$eapParams['inner_method']);
342
+   if($eapParams['inner_method']) {
343
+         $authmethod->setProperty('InnerAuthenticationMethod',$eapParams['inner_method']);
344
+   }
336 345
    return $authmethod;
337 346
 }
338 347
 
Please login to merge, or discard this patch.
devices/chromebook/chromebook.php 1 patch
Braces   +16 added lines, -12 removed lines patch added patch discarded remove patch
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
         // construct outer id, if anonymity is desired
109 109
         if (isset($this->attributes['internal:use_anon_outer']) && $this->attributes['internal:use_anon_outer'][0] == "1" && isset($this->attributes['internal:realm'])) {
110 110
             $outer_id = "@" . $this->attributes['internal:realm'][0];
111
-            if (isset($this->attributes['internal:anon_local_value']))
112
-                $outer_id = $this->attributes['internal:anon_local_value'][0] . $outer_id;
113
-        }
114
-        else {
111
+            if (isset($this->attributes['internal:anon_local_value'])) {
112
+                            $outer_id = $this->attributes['internal:anon_local_value'][0] . $outer_id;
113
+            }
114
+        } else {
115 115
             $outer_id = 0;
116 116
         }
117 117
         // define networks
@@ -119,26 +119,30 @@  discard block
 block discarded – undo
119 119
             $network_uuid = uuid($prefix, $ssid);
120 120
             $eap_prettyprint = EAP::eapDisplayName($this->selected_eap);
121 121
             // ONC has its own enums, and guess what, they don't always match
122
-            if ($eap_prettyprint["OUTER"] == "PEAP" && $eap_prettyprint["INNER"] == "MSCHAPV2")
123
-                // the dictionary entry EAP-MSCHAPv2 does not work. Setting MSCHAPv2 does. (ChromeOS 50)
122
+            if ($eap_prettyprint["OUTER"] == "PEAP" && $eap_prettyprint["INNER"] == "MSCHAPV2") {
123
+                            // the dictionary entry EAP-MSCHAPv2 does not work. Setting MSCHAPv2 does. (ChromeOS 50)
124 124
                 $eap_prettyprint["INNER"] = "MSCHAPv2";
125
+            }
125 126
             if ($eap_prettyprint["OUTER"] == "TTLS" && $eap_prettyprint["INNER"] == "MSCHAPV2") {
126 127
                 $eap_prettyprint["OUTER"] = "EAP-TTLS";
127 128
                 $eap_prettyprint["INNER"] = "MSCHAPv2";
128 129
             }
129
-            if ($eap_prettyprint["OUTER"] == "TLS")
130
-                $eap_prettyprint["OUTER"] = "EAP-TLS";
130
+            if ($eap_prettyprint["OUTER"] == "TLS") {
131
+                            $eap_prettyprint["OUTER"] = "EAP-TLS";
132
+            }
131 133
             // define EAP properties
132 134
 
133 135
             $eaparray = array("Outer" => $eap_prettyprint["OUTER"]);
134
-            if ($eap_prettyprint["INNER"] == "MSCHAPv2")
135
-                $eaparray["Inner"] = $eap_prettyprint["INNER"];
136
+            if ($eap_prettyprint["INNER"] == "MSCHAPv2") {
137
+                            $eaparray["Inner"] = $eap_prettyprint["INNER"];
138
+            }
136 139
             $eaparray["SaveCredentials"] = true;
137 140
             $eaparray["ServerCARefs"] = $ca_refs; // maybe takes just one CA?
138 141
             $eaparray["UseSystemCAs"] = false;
139 142
                     
140
-            if ($outer_id)
141
-                $eaparray["AnonymousIdentity"] = "$outer_id";
143
+            if ($outer_id) {
144
+                            $eaparray["AnonymousIdentity"] = "$outer_id";
145
+            }
142 146
             
143 147
             $json_array["NetworkConfigurations"][] = [
144 148
                 "GUID" => $network_uuid,
Please login to merge, or discard this patch.
devices/apple_mobileconfig/mobileconfig_superclass.php 1 patch
Braces   +92 added lines, -70 removed lines patch added patch discarded remove patch
@@ -68,15 +68,17 @@  discard block
 block discarded – undo
68 68
         // remove spaces and slashes (filename!), make sure it's simple ASCII only, then lowercase it
69 69
         // also escape htmlspecialchars
70 70
         // not all names and profiles have a name, so be prepared
71
-        if (empty($this->attributes['general:instname'][0]))
72
-            $inst_name = "Unnamed Institution";
73
-        else
74
-            $inst_name = $this->attributes['general:instname'][0];
71
+        if (empty($this->attributes['general:instname'][0])) {
72
+                    $inst_name = "Unnamed Institution";
73
+        } else {
74
+                    $inst_name = $this->attributes['general:instname'][0];
75
+        }
75 76
 
76
-        if (empty($this->attributes['profile:name'][0]))
77
-            $profile_name = "Unnamed Profile";
78
-        else
79
-            $profile_name = $this->attributes['profile:name'][0];
77
+        if (empty($this->attributes['profile:name'][0])) {
78
+                    $profile_name = "Unnamed Profile";
79
+        } else {
80
+                    $profile_name = $this->attributes['profile:name'][0];
81
+        }
80 82
 
81 83
         $this->massaged_inst = htmlspecialchars(strtolower(iconv("UTF-8", "US-ASCII//TRANSLIT", preg_replace(['/ /', '/\//'], '_', $inst_name))), ENT_XML1, 'UTF-8');
82 84
         $this->massaged_profile = htmlspecialchars(strtolower(iconv("UTF-8", "US-ASCII//TRANSLIT", preg_replace(['/ /', '/\//'], '_', $profile_name))), ENT_XML1, 'UTF-8');
@@ -87,10 +89,10 @@  discard block
 block discarded – undo
87 89
         if (isset($this->attributes['internal:use_anon_outer']) && $this->attributes['internal:use_anon_outer'][0] == "1" && isset($this->attributes['internal:realm'])) {
88 90
 
89 91
             $use_realm = "@" . $this->attributes['internal:realm'][0];
90
-            if (isset($this->attributes['internal:anon_local_value']))
91
-                $use_realm = $this->attributes['internal:anon_local_value'][0] . $use_realm;
92
-        }
93
-        else {
92
+            if (isset($this->attributes['internal:anon_local_value'])) {
93
+                            $use_realm = $this->attributes['internal:anon_local_value'][0] . $use_realm;
94
+            }
95
+        } else {
94 96
             $use_realm = 0;
95 97
         }
96 98
 
@@ -109,10 +111,11 @@  discard block
 block discarded – undo
109 111
          <array>";
110 112
 
111 113
         // did the admin want wired config?
112
-        if (isset($this->attributes['media:wired']) && get_class($this) == "Device_mobileconfig_os_x")
113
-            $include_wired = TRUE;
114
-        else
115
-            $include_wired = FALSE;
114
+        if (isset($this->attributes['media:wired']) && get_class($this) == "Device_mobileconfig_os_x") {
115
+                    $include_wired = TRUE;
116
+        } else {
117
+                    $include_wired = FALSE;
118
+        }
116 119
 
117 120
         $output_xml .= $this->all_network_blocks($ssid_list, $OI_list, $server_names, $uuid_list, $eap_type, $include_wired, $use_realm);
118 121
 
@@ -134,14 +137,15 @@  discard block
 block discarded – undo
134 137
          <string>" . uuid('', mobileconfig_superclass::$IPHONE_PAYLOAD_PREFIX . $this->massaged_consortium . $this->massaged_country . $this->massaged_inst . $this->massaged_profile) . "</string>
135 138
       <key>PayloadVersion</key>
136 139
          <integer>1</integer>";
137
-        if (isset($this->attributes['support:info_file']))
138
-            $output_xml .= "
140
+        if (isset($this->attributes['support:info_file'])) {
141
+                    $output_xml .= "
139 142
       <key>ConsentText</key>
140 143
          <dict>
141 144
             <key>default</key>
142 145
                <string>" . htmlspecialchars(iconv("UTF-8", "UTF-8//TRANSLIT", $this->attributes['support:info_file'][0]), ENT_XML1, 'UTF-8') . "</string>
143 146
          </dict>
144 147
          ";
148
+        }
145 149
 
146 150
         $output_xml .= "</dict></plist>";
147 151
 
@@ -152,10 +156,12 @@  discard block
 block discarded – undo
152 156
         $e = $this->installerBasename . '.mobileconfig';
153 157
         if ($this->sign) {
154 158
             $o = system($this->sign . " installer_profile '$e' > /dev/null");
155
-            if ($o === FALSE)
156
-                debug(2, "Signing the mobileconfig installer $e FAILED!\n");
157
-        } else
158
-            rename("installer_profile", $e);
159
+            if ($o === FALSE) {
160
+                            debug(2, "Signing the mobileconfig installer $e FAILED!\n");
161
+            }
162
+        } else {
163
+                    rename("installer_profile", $e);
164
+        }
159 165
 
160 166
         textdomain($dom);
161 167
         return $e;
@@ -170,12 +176,14 @@  discard block
 block discarded – undo
170 176
         $out .= "<ul>";
171 177
         $out .= "<li>" . _("to install the profile") . "</li>";
172 178
         $out .= "<li>" . ngettext("to accept the server certificate authority", "to accept the server certificate authorities", $cert_ct);
173
-        if ($cert_ct > 1)
174
-            $out .= " " . sprintf(_("(%d times)"), $cert_ct);
179
+        if ($cert_ct > 1) {
180
+                    $out .= " " . sprintf(_("(%d times)"), $cert_ct);
181
+        }
175 182
         $out .= "</li>";
176 183
         $out .= "<li>" . _("to enter the username and password of your institution");
177
-        if ($ssid_ct > 1)
178
-            $out .= " " . sprintf(_("(%d times each, because %s is installed for %d SSIDs)"), $ssid_ct, Config::$CONSORTIUM['name'], $ssid_ct);
184
+        if ($ssid_ct > 1) {
185
+                    $out .= " " . sprintf(_("(%d times each, because %s is installed for %d SSIDs)"), $ssid_ct, Config::$CONSORTIUM['name'], $ssid_ct);
186
+        }
179 187
         $out .= "</li>";
180 188
         $out .= "</ul>";
181 189
         $out .= "</p>";
@@ -186,8 +194,9 @@  discard block
 block discarded – undo
186 194
 
187 195
     private function list_ca_uuids($ca_array) {
188 196
         $retval = [];
189
-        foreach ($ca_array as $ca)
190
-            $retval[] = $ca['uuid'];
197
+        foreach ($ca_array as $ca) {
198
+                    $retval[] = $ca['uuid'];
199
+        }
191 200
         return $retval;
192 201
     }
193 202
 
@@ -212,24 +221,27 @@  discard block
 block discarded – undo
212 221
                       <key>OneTimeUserPassword</key>
213 222
                             <false />
214 223
 ";
215
-        if ($realm !== 0)
216
-            $retval .= "<key>OuterIdentity</key>
224
+        if ($realm !== 0) {
225
+                    $retval .= "<key>OuterIdentity</key>
217 226
                                     <string>" . htmlspecialchars($realm, ENT_XML1, 'UTF-8') . "</string>
218 227
 ";
228
+        }
219 229
         $retval .= "<key>PayloadCertificateAnchorUUID</key>
220 230
                          <array>";
221
-        foreach ($CA_UUID_list as $uuid)
222
-            $retval .= "
231
+        foreach ($CA_UUID_list as $uuid) {
232
+                    $retval .= "
223 233
 <string>$uuid</string>";
234
+        }
224 235
         $retval .= "
225 236
                          </array>
226 237
                       <key>TLSAllowTrustExceptions</key>
227 238
                          <false />
228 239
                       <key>TLSTrustedServerNames</key>
229 240
                          <array>";
230
-        foreach ($server_list as $cn)
231
-            $retval .= "
241
+        foreach ($server_list as $cn) {
242
+                    $retval .= "
232 243
 <string>$cn</string>";
244
+        }
233 245
         $retval .= "
234 246
                          </array>
235 247
                       <key>TTLSInnerAuthentication</key>
@@ -237,42 +249,46 @@  discard block
 block discarded – undo
237 249
                    </dict>
238 250
                <key>EncryptionType</key>
239 251
                   <string>";
240
-        if ($wired)
241
-            $retval .= "any";
242
-        else if (count($oi) > 0)
243
-            $retval .= "WPA";
244
-        else
245
-            $retval .= "WPA";
252
+        if ($wired) {
253
+                    $retval .= "any";
254
+        } else if (count($oi) > 0) {
255
+                    $retval .= "WPA";
256
+        } else {
257
+                    $retval .= "WPA";
258
+        }
246 259
 
247 260
         $retval .= "</string>
248 261
                <key>HIDDEN_NETWORK</key>
249 262
                   <true />
250 263
                <key>PayloadDescription</key>
251 264
                   <string>";
252
-        if ($wired)
253
-            $retval .= sprintf(_("%s configuration for wired network"), Config::$CONSORTIUM['name']);
254
-        else if (count($oi) > 0)
255
-            $retval .= sprintf(_("%s Hotspot 2.0 configuration"), Config::$CONSORTIUM['name']);
256
-        else
257
-            $retval .= sprintf(_("%s configuration for network name %s"), Config::$CONSORTIUM['name'], $SSID);
265
+        if ($wired) {
266
+                    $retval .= sprintf(_("%s configuration for wired network"), Config::$CONSORTIUM['name']);
267
+        } else if (count($oi) > 0) {
268
+                    $retval .= sprintf(_("%s Hotspot 2.0 configuration"), Config::$CONSORTIUM['name']);
269
+        } else {
270
+                    $retval .= sprintf(_("%s configuration for network name %s"), Config::$CONSORTIUM['name'], $SSID);
271
+        }
258 272
         $retval .= "</string>
259 273
                <key>PayloadDisplayName</key>
260 274
                   <string>";
261
-        if ($wired)
262
-            $retval .= _("Wired Network");
263
-        else if (count($oi) > 0)
264
-            $retval .= _("Hotspot 2.0 Settings");
265
-        else
266
-            $retval .= sprintf(_("SSID %s"), $SSID);
275
+        if ($wired) {
276
+                    $retval .= _("Wired Network");
277
+        } else if (count($oi) > 0) {
278
+                    $retval .= _("Hotspot 2.0 Settings");
279
+        } else {
280
+                    $retval .= sprintf(_("SSID %s"), $SSID);
281
+        }
267 282
         $retval .= "</string>
268 283
                <key>PayloadIdentifier</key>
269 284
                   <string>" . mobileconfig_superclass::$IPHONE_PAYLOAD_PREFIX . ".$this->massaged_consortium.$this->massaged_country.$this->massaged_inst.$this->massaged_profile.$this->lang.";
270
-        if ($wired)
271
-            $retval .= "firstactiveethernet";
272
-        else if (count($oi) == 0)
273
-            $retval .= "wifi." . $this->serial;
274
-        else
275
-            $retval .= "hs20";
285
+        if ($wired) {
286
+                    $retval .= "firstactiveethernet";
287
+        } else if (count($oi) == 0) {
288
+                    $retval .= "wifi." . $this->serial;
289
+        } else {
290
+                    $retval .= "hs20";
291
+        }
276 292
         $retval .="</string>
277 293
                <key>PayloadOrganization</key>
278 294
                   <string>" . $this->massaged_consortium . ".1x-config.org</string>
@@ -284,20 +300,22 @@  discard block
 block discarded – undo
284 300
                   <string>Auto</string>
285 301
                 ";
286 302
         }
287
-        if ($wired)
288
-            $retval .= "
303
+        if ($wired) {
304
+                    $retval .= "
289 305
                <key>SetupModes</key>
290 306
                   <array>
291 307
                      <string>System</string>
292 308
                   </array>";
309
+        }
293 310
         $retval .= "
294 311
                <key>PayloadUUID</key>
295 312
                   <string>" . uuid() . "</string>
296 313
                <key>PayloadVersion</key>
297 314
                   <integer>1</integer>";
298
-        if (!$wired && count($oi) == 0)
299
-            $retval .= "<key>SSID_STR</key>
315
+        if (!$wired && count($oi) == 0) {
316
+                    $retval .= "<key>SSID_STR</key>
300 317
                   <string>$SSID</string>";
318
+        }
301 319
         if (count($oi) > 0) {
302 320
             $retval .= "
303 321
                <key>IsHotspot</key>
@@ -316,8 +334,9 @@  discard block
 block discarded – undo
316 334
             }
317 335
             $retval .= "                <key>RoamingConsortiumOIs</key>
318 336
                 <array>";
319
-            foreach ($oi as $oi_value)
320
-                $retval .= "<string>$oi_value</string>";
337
+            foreach ($oi as $oi_value) {
338
+                            $retval .= "<string>$oi_value</string>";
339
+            }
321 340
             $retval .= "</array>";
322 341
         }
323 342
         $retval .= "</dict>";
@@ -365,13 +384,16 @@  discard block
 block discarded – undo
365 384
         foreach (array_keys($SSID_list) as $SSID) {
366 385
             $retval .= $this->network_block($SSID, NULL, $server_list, $CA_UUID_list, $eap_type, FALSE, $realm);
367 386
         }
368
-        if ($include_wired)
369
-            $retval .= $this->network_block("IRRELEVANT", NULL, $server_list, $CA_UUID_list, $eap_type, TRUE, $realm);
370
-        if (count($OI_list) > 0)
371
-            $retval .= $this->network_block("IRRELEVANT", $OI_list, $server_list, $CA_UUID_list, $eap_type, FALSE, $realm);
372
-        if (isset($this->attributes['media:remove_SSID']))
373
-            foreach ($this->attributes['media:remove_SSID'] as $index => $remove_SSID)
387
+        if ($include_wired) {
388
+                    $retval .= $this->network_block("IRRELEVANT", NULL, $server_list, $CA_UUID_list, $eap_type, TRUE, $realm);
389
+        }
390
+        if (count($OI_list) > 0) {
391
+                    $retval .= $this->network_block("IRRELEVANT", $OI_list, $server_list, $CA_UUID_list, $eap_type, FALSE, $realm);
392
+        }
393
+        if (isset($this->attributes['media:remove_SSID'])) {
394
+                    foreach ($this->attributes['media:remove_SSID'] as $index => $remove_SSID)
374 395
                 $retval .= $this->removenetwork_block($remove_SSID, $index);
396
+        }
375 397
         return $retval;
376 398
     }
377 399
 
Please login to merge, or discard this patch.