Completed
Pull Request — master (#14)
by Janusz
10:08 queued 04:29
created
devices/redirect_dev/RedirectDev.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -2,20 +2,20 @@
 block discarded – undo
2 2
 require_once('DeviceConfig.php');
3 3
 
4 4
 class Device_RedirectDev extends DeviceConfig {
5
-   /**
6
-    * Constructs a Device object.
7
-    *
8
-    * It is CRUTCIAL that the constructor sets $this->supportedEapMethods to an array of methods
9
-    * available for the particular device.
10
-    * {@source}
11
-    * @param string $device a pointer to a device module, which must
12
-    * be an index of one of the devices defined in the {@link Devices}
13
-    * array in {@link devices.php}.
14
-    * @final not to be redefined
15
-    */
5
+    /**
6
+     * Constructs a Device object.
7
+     *
8
+     * It is CRUTCIAL that the constructor sets $this->supportedEapMethods to an array of methods
9
+     * available for the particular device.
10
+     * {@source}
11
+     * @param string $device a pointer to a device module, which must
12
+     * be an index of one of the devices defined in the {@link Devices}
13
+     * array in {@link devices.php}.
14
+     * @final not to be redefined
15
+     */
16 16
     final public function __construct() {
17
-      $this->supportedEapMethods  = [EAP::$EAP_NONE];
18
-      debug(4,"RedirectEx called");
17
+        $this->supportedEapMethods  = [EAP::$EAP_NONE];
18
+        debug(4,"RedirectEx called");
19 19
     }
20 20
     public function writeDeviceInfo() {
21 21
         $out = "<p>";
Please login to merge, or discard this patch.
devices/linux/Linux.php 1 patch
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
  */
31 31
 class Device_Linux extends DeviceConfig {
32 32
 
33
-      final public function __construct() {
33
+        final public function __construct() {
34 34
 //      $this->supportedEapMethods  = array(EAP::$TLS, EAP::$PEAP_MSCHAP2, EAP::$TTLS_PAP);
35
-      $this->supportedEapMethods  = [ EAP::$PEAP_MSCHAP2, EAP::$TTLS_PAP, EAP::$TTLS_MSCHAP2, EAP::$TLS ];
36
-      $this->local_dir = '.cat_installer';
37
-      $this->conf_file = '$HOME/'.$this->local_dir.'/cat_installer.conf';
38
-      debug(4,"LINUX: This device supports the following EAP methods: ");
39
-      debug(4,$this->supportedEapMethods);
35
+        $this->supportedEapMethods  = [ EAP::$PEAP_MSCHAP2, EAP::$TTLS_PAP, EAP::$TTLS_MSCHAP2, EAP::$TLS ];
36
+        $this->local_dir = '.cat_installer';
37
+        $this->conf_file = '$HOME/'.$this->local_dir.'/cat_installer.conf';
38
+        debug(4,"LINUX: This device supports the following EAP methods: ");
39
+        debug(4,$this->supportedEapMethods);
40 40
     }
41 41
 
42
-   public function writeInstaller() {
43
-      $out_string = '#!/usr/bin/env bash
42
+    public function writeInstaller() {
43
+        $out_string = '#!/usr/bin/env bash
44 44
 if [ -z "$BASH" ] ; then
45 45
    bash  $0
46 46
    exit
@@ -48,42 +48,42 @@  discard block
 block discarded – undo
48 48
 
49 49
 
50 50
 ';
51
-      $out_string .= $this->printFunctions();
52
-      $out_string .= $this->printStart();
53
-      $out_string .= $this->printProfileConfirmation();
54
-      $out_string .= $this->printUserConsent();
55
-      $out_string .= $this->printCheckDirectory();
56
-      $CAs = $this->attributes['internal:CAs'][0];
57
-      $this->server_name = $this->glueServerNames($this->attributes['eap:server_name']);
58
-      $this->server_alt_subject_name_list = $this->mkSubjectAltNameList($this->attributes['eap:server_name']);
59
-      $out_string .= "# save certificates\n";
60
-      $out_string .= 'echo "';
61
-      foreach ($CAs as $ca) {
51
+        $out_string .= $this->printFunctions();
52
+        $out_string .= $this->printStart();
53
+        $out_string .= $this->printProfileConfirmation();
54
+        $out_string .= $this->printUserConsent();
55
+        $out_string .= $this->printCheckDirectory();
56
+        $CAs = $this->attributes['internal:CAs'][0];
57
+        $this->server_name = $this->glueServerNames($this->attributes['eap:server_name']);
58
+        $this->server_alt_subject_name_list = $this->mkSubjectAltNameList($this->attributes['eap:server_name']);
59
+        $out_string .= "# save certificates\n";
60
+        $out_string .= 'echo "';
61
+        foreach ($CAs as $ca) {
62 62
         $out_string .= $ca['pem']."\n";
63
-      }
64
-      $out_string .= '"'." > \$HOME/$this->local_dir/ca.pem\n";
63
+        }
64
+        $out_string .= '"'." > \$HOME/$this->local_dir/ca.pem\n";
65 65
 
66
-     $SSIDs = $this->attributes['internal:SSID'];
67
-     $delSSIDs = $this->attributes['internal:remove_SSID'];
66
+        $SSIDs = $this->attributes['internal:SSID'];
67
+        $delSSIDs = $this->attributes['internal:remove_SSID'];
68 68
 
69
-     $out_string .= $this->printNMScript($SSIDs,$delSSIDs);
70
-     $out_string .= $this->writeWpaConf($SSIDs);
71
-     if($this->selected_eap == EAP::$TLS) 
72
-       $out_string .= $this->printP12Dialog();
73
-     else
74
-       $out_string .= $this->printPasswordDialog();
75
-     $out_string .= $this->checkNMResultAndCont();
76
-     $installer_path = $this->installerBasename.'.sh';
77
-      file_put_contents($installer_path, $out_string);
78
-      return($installer_path);
79
-   }
69
+        $out_string .= $this->printNMScript($SSIDs,$delSSIDs);
70
+        $out_string .= $this->writeWpaConf($SSIDs);
71
+        if($this->selected_eap == EAP::$TLS) 
72
+        $out_string .= $this->printP12Dialog();
73
+        else
74
+        $out_string .= $this->printPasswordDialog();
75
+        $out_string .= $this->checkNMResultAndCont();
76
+        $installer_path = $this->installerBasename.'.sh';
77
+        file_put_contents($installer_path, $out_string);
78
+        return($installer_path);
79
+    }
80 80
 
81 81
     public function writeDeviceInfo() {
82 82
     $ssid_ct=count($this->attributes['internal:SSID']);
83 83
     $out = '';
84 84
 
85
-   $out .= _("The installer is in the form of a bash script. It will try to configure eduroam under Network Manager and if this is either not appropriate for your system or your version of Network Manager is too old, a wpa_supplicant config file will be created instead.");
86
-   $out .= "<p>";
85
+    $out .= _("The installer is in the form of a bash script. It will try to configure eduroam under Network Manager and if this is either not appropriate for your system or your version of Network Manager is too old, a wpa_supplicant config file will be created instead.");
86
+    $out .= "<p>";
87 87
     if($ssid_ct > 1) {
88 88
         if($ssid_ct > 2) {
89 89
             $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to the following networks:"),implode(', ',Config::$CONSORTIUM['ssid']))." ";
@@ -91,39 +91,39 @@  discard block
 block discarded – undo
91 91
             $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to:"),implode(', ',Config::$CONSORTIUM['ssid']))." ";
92 92
         $i = 0;
93 93
         foreach ($this->attributes['internal:SSID'] as $ssid=>$v) {
94
-           if(! in_array($ssid, Config::$CONSORTIUM['ssid'])) {
95
-             if($i > 0)
96
-           $out .= ", ";
97
-         $i++;
98
-         $out .= "<strong>$ssid</strong>";
99
-       }
94
+            if(! in_array($ssid, Config::$CONSORTIUM['ssid'])) {
95
+                if($i > 0)
96
+            $out .= ", ";
97
+            $i++;
98
+            $out .= "<strong>$ssid</strong>";
99
+        }
100 100
     }
101 101
     $out .= "<p>";
102 102
     }
103
-   $out .= _("The installer will create .cat_installer sub-directory in your home directory and will copy your server certificates there.");
103
+    $out .= _("The installer will create .cat_installer sub-directory in your home directory and will copy your server certificates there.");
104 104
 if($this->eap == EAP::$TLS)
105
-   $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
+    $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.");
106 106
 else {
107
-   $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.");
108
-   $out .= "<p>";
109
-   $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.");
107
+    $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.");
108
+    $out .= "<p>";
109
+    $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.");
110 110
 }
111 111
     $out .= "<p>";
112 112
     return $out;
113
-  }
113
+    }
114 114
 
115 115
 
116
-  private function printCheckDirectory() {
116
+    private function printCheckDirectory() {
117 117
 $out = 'if [ -d $HOME/'.$this->local_dir.' ] ; then
118 118
    if ! ask "'.sprintf(_("Directory %s exists; some of its files may be overwritten."),'$HOME/'.$this->local_dir).'" "'._("Continue").'" 1 ; then exit; fi
119 119
 else
120 120
   mkdir $HOME/'.$this->local_dir.'
121 121
 fi
122 122
 ';
123
- return $out;
124
-  }
123
+    return $out;
124
+    }
125 125
 
126
-  private function checkNMResultAndCont() {
126
+    private function checkNMResultAndCont() {
127 127
     $out = 'if run_python_script ; then
128 128
    show_info "'._("Installation successful").'"
129 129
 else
@@ -138,50 +138,50 @@  discard block
 block discarded – undo
138 138
    show_info "'.sprintf(_("Output written to %s"),$this->conf_file).'"
139 139
 fi
140 140
 ';
141
-  return $out;
142
-  }
141
+    return $out;
142
+    }
143 143
 
144 144
 private function printStart() {
145
-     $out = "setup_environment\n";
146
-     $out .= 'show_info "'._("This installer has been prepared for \${ORGANISATION}").'\n\n'._("More information and comments:").'\n\nEMAIL: ${SUPPORT}\nWWW: ${URL}\n\n'.
145
+        $out = "setup_environment\n";
146
+        $out .= 'show_info "'._("This installer has been prepared for \${ORGANISATION}").'\n\n'._("More information and comments:").'\n\nEMAIL: ${SUPPORT}\nWWW: ${URL}\n\n'.
147 147
 _("Installer created with software from the GEANT project.").'"
148 148
 ';
149
-  return $out;
149
+    return $out;
150 150
 }
151 151
 
152 152
 
153 153
 private function printProfileConfirmation() {
154
- if($this->attributes['internal:profile_count'][0] > 1)
155
-       $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}"';
154
+    if($this->attributes['internal:profile_count'][0] > 1)
155
+        $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}"';
156 156
     else
157
-       $out = 'if ! ask "'.sprintf(_("This installer will only work properly if you are a member of %s."),'${bf}'.$this->attributes['general:instname'][0]).'${n}"';
157
+        $out = 'if ! ask "'.sprintf(_("This installer will only work properly if you are a member of %s."),'${bf}'.$this->attributes['general:instname'][0]).'${n}"';
158 158
     $out .= ' "'._("Continue").'" 1 ; then exit; fi
159 159
 ';
160
-  return $out;
160
+    return $out;
161 161
 
162 162
 }
163 163
 
164 164
 
165
-  private function printUserConsent() {
165
+    private function printUserConsent() {
166 166
     $out = '';
167 167
     if(isset($this->attributes['support:info_file'])) {
168
-      if( $this->attributes['internal:info_file'][0]['mime'] == 'txt') {
169
-         $handle = fopen($this->attributes['internal:info_file'][0]['name'],"r");
170
-         $consent = '';
171
-         while (($buffer = fgets($handle, 4096)) !== false) {
172
-           $consent .= rtrim($buffer) . '\n';
173
-         }
174
-         $out = 'if ! ask "'.$consent.'${n}" "'._("Continue").'" 1 ; then exit; fi
168
+        if( $this->attributes['internal:info_file'][0]['mime'] == 'txt') {
169
+            $handle = fopen($this->attributes['internal:info_file'][0]['name'],"r");
170
+            $consent = '';
171
+            while (($buffer = fgets($handle, 4096)) !== false) {
172
+            $consent .= rtrim($buffer) . '\n';
173
+            }
174
+            $out = 'if ! ask "'.$consent.'${n}" "'._("Continue").'" 1 ; then exit; fi
175 175
 ';
176
-      }
176
+        }
177 177
     }
178 178
     return $out;
179
-  }
179
+    }
180 180
 # ask user for confirmation
181 181
 # the first argument is the user prompt
182 182
 # if the second argument is 0 then the first element of yes_no array
183 183
 # will be the default value prompted to the user
184
-  private function printFunctions() {
184
+    private function printFunctions() {
185 185
 $url = (isset($this->attributes['support:url'][0]) && $this->attributes['support:url'][0] ) ? $this->attributes['support:url'][0] : $this->support_url_substitute;
186 186
 $support=(isset($this->attributes['support:email'][0]) && $this->attributes['support:email'][0] ) ? $this->attributes['support:email'][0] : $this->support_email_substitute;
187 187
 $out ='
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
 }
392 392
 
393 393
 
394
-  private function writeWpaConf($SSIDs) {
395
-     $e = EAP::eapDisplayName($this->selected_eap);
394
+    private function writeWpaConf($SSIDs) {
395
+        $e = EAP::eapDisplayName($this->selected_eap);
396 396
 $out = 'function create_wpa_conf {
397 397
 cat << EOFW >> '.$this->conf_file."\n";
398
-     foreach (array_keys($SSIDs) as $ssid) {
398
+        foreach (array_keys($SSIDs) as $ssid) {
399 399
     $out .= '
400 400
 network={
401 401
   ssid="'.$ssid.'"
@@ -405,42 +405,42 @@  discard block
 block discarded – undo
405 405
   eap='.$e['OUTER'].'
406 406
   ca_cert="${HOME}/'.$this->local_dir.'/ca.pem"
407 407
   identity="${USER_NAME}"';
408
-  if($this->server_name)
408
+    if($this->server_name)
409 409
     $out .= '
410 410
   domain_suffix_match="'.$this->server_name.'"';
411
-  if($this->selected_eap == EAP::$TLS) {
411
+    if($this->selected_eap == EAP::$TLS) {
412 412
     $out .= '
413 413
   private_key="${HOME}/'.$this->local_dir.'/user.p12"
414 414
   private_key_passwd="${PASSWORD}"';
415
-  } else {
415
+    } else {
416 416
     $out .= '
417 417
   phase2="auth='.$e['INNER'].'"
418 418
   password="${PASSWORD}"';
419
-  if($this->attributes['internal:use_anon_outer'][0] == 1) 
419
+    if($this->attributes['internal:use_anon_outer'][0] == 1) 
420 420
     $out .= '
421 421
   anonymous_identity="'.$this->attributes['internal:anon_local_value'][0].'@'.$this->attributes['internal:realm'][0].'"';
422
-  }
422
+    }
423 423
     $out .= '
424 424
 }';
425 425
 }
426
-  $out .= '
426
+    $out .= '
427 427
 EOFW
428 428
 chmod 600 '.$this->conf_file.'
429 429
 }
430 430
 ';
431
-  return $out;
431
+    return $out;
432 432
 }
433 433
 
434 434
 
435 435
 
436
-  private function printPasswordDialog() {
437
-  $out = '#prompt user for credentials
436
+    private function printPasswordDialog() {
437
+    $out = '#prompt user for credentials
438 438
   user_cred
439 439
   ';
440
-  return $out;
440
+    return $out;
441 441
 }
442
-  private function printP12Dialog() {
443
-  $out ='function p12dialog {
442
+    private function printP12Dialog() {
443
+    $out ='function p12dialog {
444 444
   if [ ! -z $ZENITY ] ; then
445 445
     if ! cert=`$ZENITY --file-selection --file-filter="'._("personal certificate file (p12 or pfx)").' | *.p12 *.P12 *.pfx *.PFX" --file-filter="All files | *" --title="'._("personal certificate file (p12 or pfx)").'" 2>/dev/null` ; then
446 446
        exit
@@ -499,37 +499,37 @@  discard block
 block discarded – undo
499 499
 }  
500 500
 p12dialog
501 501
 ';
502
- return $out;
502
+    return $out;
503 503
 }
504 504
 
505 505
 
506 506
 private function glueServerNames($server_list) {
507
-  if(! $server_list)
507
+    if(! $server_list)
508 508
     return '';
509
-  $A0 =  array_reverse(explode('.',array_shift($server_list)));
510
-  $B = $A0;
511
-  foreach($server_list as $a) {
512
-     $A= array_reverse(explode('.',$a));
513
-     $B = array_intersect_assoc($A0,$A);
514
-     $A0 = $B;
515
-   }
516
-  return(implode('.',array_reverse($B)));
509
+    $A0 =  array_reverse(explode('.',array_shift($server_list)));
510
+    $B = $A0;
511
+    foreach($server_list as $a) {
512
+        $A= array_reverse(explode('.',$a));
513
+        $B = array_intersect_assoc($A0,$A);
514
+        $A0 = $B;
515
+    }
516
+    return(implode('.',array_reverse($B)));
517 517
 }
518 518
 
519 519
 private function mkSubjectAltNameList($server_list) {
520
-  if(! $server_list)
520
+    if(! $server_list)
521 521
     return '';
522
-  $out = '';
523
-  foreach($server_list as $a) {
524
-     if($out)
525
-       $out .= ','; 
526
-     $out .= "'DNS:$a'";
527
-  }
528
-  return $out;
522
+    $out = '';
523
+    foreach($server_list as $a) {
524
+        if($out)
525
+        $out .= ','; 
526
+        $out .= "'DNS:$a'";
527
+    }
528
+    return $out;
529 529
 }
530 530
 
531 531
 private function printNMScript($SSIDs,$delSSIDs) {
532
-   $e = EAP::eapDisplayName($this->selected_eap);
532
+    $e = EAP::eapDisplayName($this->selected_eap);
533 533
 $out = 'function run_python_script {
534 534
 PASSWORD=$( echo "$PASSWORD" | sed "s/\'/\\\\\\\'/g" )
535 535
 if python << EEE1 > /dev/null 2>&1
@@ -668,20 +668,20 @@  discard block
 block discarded – undo
668 668
             \'identity\': \'$USER_NAME\',
669 669
             \'ca-cert\': dbus.ByteArray("file://{0}\0".format(self.cacert_file).encode(\'utf8\')),';
670 670
     if($this->server_name) {
671
-             $out .= '
671
+                $out .= '
672 672
              match_key: match_value,';
673 673
     }
674 674
     if($this->selected_eap == EAP::$TLS) {
675
-       $out .= '
675
+        $out .= '
676 676
             \'client-cert\':  dbus.ByteArray("file://{0}\0".format(self.pfx_file).encode(\'utf8\')),
677 677
             \'private-key\':  dbus.ByteArray("file://{0}\0".format(self.pfx_file).encode(\'utf8\')),
678 678
             \'private-key-password\':  \'$PASSWORD\',';
679 679
     } else {
680
-       $out .= '
680
+        $out .= '
681 681
             \'password\': \'$PASSWORD\',
682 682
             \'phase2-auth\': \''.strtolower($e['INNER']).'\',';
683
-         if($this->attributes['internal:use_anon_outer'][0] == 1) 
684
-              $out .= '
683
+            if($this->attributes['internal:use_anon_outer'][0] == 1) 
684
+                $out .= '
685 685
             \'anonymous-identity\': \''.$this->attributes['internal:anon_local_value'][0].'@'.$this->attributes['internal:realm'][0].'\',';
686 686
     }
687 687
     $out .= '
@@ -701,17 +701,17 @@  discard block
 block discarded – undo
701 701
     def main(self):
702 702
         self.check_opts()
703 703
         ver = self.connect_to_NM()';
704
-     foreach (array_keys($SSIDs) as $ssid) {
705
-           $out .='
704
+        foreach (array_keys($SSIDs) as $ssid) {
705
+            $out .='
706 706
         self.delete_existing_connections(\''.$ssid.'\')
707 707
         self.add_connection(\''.$ssid.'\')';
708
-     }
708
+        }
709 709
 //   create a list of profiles to be deleted after installation
710
-     foreach ($delSSIDs as $ssid => $cipher) {
711
-         if($cipher == 'DEL')
710
+        foreach ($delSSIDs as $ssid => $cipher) {
711
+            if($cipher == 'DEL')
712 712
             $out .='
713 713
         self.delete_existing_connections(\''.$ssid.'\')';
714
-     }
714
+        }
715 715
 
716 716
 $out .='
717 717
 
Please login to merge, or discard this patch.
devices/devices-template.php 1 patch
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
  */
56 56
 
57 57
 public static $Options=[
58
-  'sign'=>0,
59
-  'no_cache'=>0,
60
-  'hidden'=>0,
61
-  'redirect'=>0,
58
+    'sign'=>0,
59
+    'no_cache'=>0,
60
+    'hidden'=>0,
61
+    'redirect'=>0,
62 62
 ];
63 63
 
64 64
 /**
@@ -96,75 +96,75 @@  discard block
 block discarded – undo
96 96
 
97 97
 public static function listDevices() {
98 98
     return [
99
- 'w10'=>[
100
-   'group' => "microsoft",
101
-   'display'=>_("MS Windows 10"),
102
-   'match'=>'Windows NT 10',
103
-   'directory'=>'ms',
104
-   'module'=>'W8',
105
-   'signer'=>'ms_windows_sign',
99
+    'w10'=>[
100
+    'group' => "microsoft",
101
+    'display'=>_("MS Windows 10"),
102
+    'match'=>'Windows NT 10',
103
+    'directory'=>'ms',
104
+    'module'=>'W8',
105
+    'signer'=>'ms_windows_sign',
106 106
     'options'=>[
107
-       'sign'=>1,
108
-       'device_id'=>'W10',
109
-       'mime'=>'application/x-dosexec',
110
-      ],
111
-   ],
107
+        'sign'=>1,
108
+        'device_id'=>'W10',
109
+        'mime'=>'application/x-dosexec',
110
+        ],
111
+    ],
112 112
 	
113
- 'w8'=>[
114
-   'group' => "microsoft",
115
-   'display'=>_("MS Windows 8, 8.1"),
116
-   'match'=>'Windows NT 6[._][23]',
117
-   'directory'=>'ms',
118
-   'module'=>'W8',
119
-   'signer'=>'ms_windows_sign',
113
+    'w8'=>[
114
+    'group' => "microsoft",
115
+    'display'=>_("MS Windows 8, 8.1"),
116
+    'match'=>'Windows NT 6[._][23]',
117
+    'directory'=>'ms',
118
+    'module'=>'W8',
119
+    'signer'=>'ms_windows_sign',
120 120
     'options'=>[
121
-       'sign'=>1,
122
-       'device_id'=>'W8',
123
-       'mime'=>'application/x-dosexec',
124
-      ],
125
-   ],
121
+        'sign'=>1,
122
+        'device_id'=>'W8',
123
+        'mime'=>'application/x-dosexec',
124
+        ],
125
+    ],
126 126
 	
127
- 'w7'=>[
128
-   'group' => "microsoft",
129
-   'display'=>_("MS Windows 7"),
130
-   'match'=>'Windows NT 6[._]1',
131
-   'directory'=>'ms',
132
-   'module'=>'Vista7',
133
-   'signer'=>'ms_windows_sign',
127
+    'w7'=>[
128
+    'group' => "microsoft",
129
+    'display'=>_("MS Windows 7"),
130
+    'match'=>'Windows NT 6[._]1',
131
+    'directory'=>'ms',
132
+    'module'=>'Vista7',
133
+    'signer'=>'ms_windows_sign',
134 134
     'options'=>[
135
-       'sign'=>1,
136
-       'device_id'=>'W7',
137
-       'mime'=>'application/x-dosexec',
138
-      ],
139
-   ],
135
+        'sign'=>1,
136
+        'device_id'=>'W7',
137
+        'mime'=>'application/x-dosexec',
138
+        ],
139
+    ],
140 140
 	
141
- 'vista'=>[
142
-   'group' => "microsoft",
143
-   'display'=>_("MS Windows Vista"),
144
-   'match'=>'Windows NT 6[._]0',
145
-   'directory'=>'ms',
146
-   'module'=>'Vista7',
147
-   'signer'=>'ms_windows_sign',
141
+    'vista'=>[
142
+    'group' => "microsoft",
143
+    'display'=>_("MS Windows Vista"),
144
+    'match'=>'Windows NT 6[._]0',
145
+    'directory'=>'ms',
146
+    'module'=>'Vista7',
147
+    'signer'=>'ms_windows_sign',
148 148
     'options'=>[
149
-       'sign'=>1,
150
-       'device_id'=>'Vista',
151
-       'mime'=>'application/x-dosexec',
152
-      ],
153
-   ],
149
+        'sign'=>1,
150
+        'device_id'=>'Vista',
151
+        'mime'=>'application/x-dosexec',
152
+        ],
153
+    ],
154 154
 	
155
- 'win-rt'=>[
155
+    'win-rt'=>[
156 156
     'group' => "microsoft",
157 157
     'display'=>_("Windows RT"),
158 158
     'directory'=>'redirect_dev',
159 159
     'module'=>'RedirectDev',
160 160
     'options'=>[
161
-      'hidden'=>0,
162
-      'redirect'=>1,
163
-      ],
164
-   ],
161
+        'hidden'=>0,
162
+        'redirect'=>1,
163
+        ],
164
+    ],
165 165
     
166 166
 
167
- 'apple_el_cap'=>[
167
+    'apple_el_cap'=>[
168 168
     'group' => "apple",
169 169
     'display'=>_("Apple OS X El Capitan"),
170 170
     'match'=>'Mac OS X 10[._]11',
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
     'module'=>'mobileconfig_os_x',
173 173
     'signer'=>'mobileconfig_sign',
174 174
     'options'=>array(
175
-       'sign'=>1,
176
-       'device_id'=>'OS_X',
177
-       'mime'=>'application/x-apple-aspen-config',
178
-      ),
175
+        'sign'=>1,
176
+        'device_id'=>'OS_X',
177
+        'mime'=>'application/x-apple-aspen-config',
178
+        ),
179 179
     ],
180 180
 
181
- 'apple_yos'=>[
181
+    'apple_yos'=>[
182 182
     'group' => "apple",
183 183
     'display'=>_("Apple OS X Yosemite"),
184 184
     'match'=>'Mac OS X 10[._]10',
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
     'module'=>'mobileconfig_os_x',
187 187
     'signer'=>'mobileconfig_sign',
188 188
     'options'=>[
189
-       'sign'=>1,
190
-       'device_id'=>'OS_X',
191
-       'mime'=>'application/x-apple-aspen-config',
192
-      ],
189
+        'sign'=>1,
190
+        'device_id'=>'OS_X',
191
+        'mime'=>'application/x-apple-aspen-config',
192
+        ],
193 193
     ],
194 194
 
195
- 'apple_mav'=>[
195
+    'apple_mav'=>[
196 196
     'group' => "apple",
197 197
     'display'=>_("Apple OS X Mavericks"),
198 198
     'match'=>'Mac OS X 10[._]9',
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
     'module'=>'mobileconfig_os_x',
201 201
     'signer'=>'mobileconfig_sign',
202 202
     'options'=>[
203
-       'sign'=>1,
204
-       'device_id'=>'OS_X',
205
-       'mime'=>'application/x-apple-aspen-config',
206
-      ],
203
+        'sign'=>1,
204
+        'device_id'=>'OS_X',
205
+        'mime'=>'application/x-apple-aspen-config',
206
+        ],
207 207
     ],
208 208
 
209
- 'apple_m_lion'=>[
209
+    'apple_m_lion'=>[
210 210
     'group' => "apple",
211 211
     'display'=>_("Apple OS X Mountain Lion"),
212 212
     'match'=>'Mac OS X 10[._]8',
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
     'module'=>'mobileconfig_os_x',
215 215
     'signer'=>'mobileconfig_sign',
216 216
     'options'=>[
217
-       'sign'=>1,
218
-       'device_id'=>'OS_X',
219
-       'mime'=>'application/x-apple-aspen-config',
220
-      ],
217
+        'sign'=>1,
218
+        'device_id'=>'OS_X',
219
+        'mime'=>'application/x-apple-aspen-config',
220
+        ],
221 221
     ],
222 222
 	
223
- 'apple_lion'=>[
223
+    'apple_lion'=>[
224 224
     'group' => "apple",
225 225
     'display'=>_("Apple OS X Lion"),
226 226
     'match'=>'Mac OS X 10[._]7',
@@ -228,13 +228,13 @@  discard block
 block discarded – undo
228 228
     'module'=>'mobileconfig_os_x',
229 229
     'signer'=>'mobileconfig_sign',
230 230
     'options'=>[
231
-       'sign'=>1,
232
-       'device_id'=>'OS_X',
233
-       'mime'=>'application/x-apple-aspen-config',
234
-      ],
231
+        'sign'=>1,
232
+        'device_id'=>'OS_X',
233
+        'mime'=>'application/x-apple-aspen-config',
234
+        ],
235 235
     ],
236 236
         
237
- 'mobileconfig'=>[
237
+    'mobileconfig'=>[
238 238
     'group' => "apple",     
239 239
     'display'=>_("Apple iOS mobile devices"),
240 240
     'match'=>'(iPad|iPhone|iPod);.*OS [7-9]_',
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
     'module'=>'mobileconfig_ios',
243 243
     'signer'=>'mobileconfig_sign',
244 244
     'options'=>[
245
-       'sign'=>1,
246
-       'device_id'=>'iOS',
247
-       'mime'=>'application/x-apple-aspen-config',
248
-      ],
245
+        'sign'=>1,
246
+        'device_id'=>'iOS',
247
+        'mime'=>'application/x-apple-aspen-config',
248
+        ],
249 249
     ],
250 250
 
251
- 'mobileconfig-56'=>[
251
+    'mobileconfig-56'=>[
252 252
     'group' => "apple",
253 253
     'display'=>_("Apple iOS mobile devices (iOS 5 and 6)"),
254 254
     'match'=>'(iPad|iPhone|iPod);.*OS [56]_',
@@ -256,132 +256,132 @@  discard block
 block discarded – undo
256 256
     'module'=>'mobileconfig_ios_56',
257 257
     'signer'=>'mobileconfig_sign',
258 258
     'options'=>[
259
-       'sign'=>1,
260
-       'device_id'=>'iOS',
261
-       'mime'=>'application/x-apple-aspen-config',
262
-      ],
259
+        'sign'=>1,
260
+        'device_id'=>'iOS',
261
+        'mime'=>'application/x-apple-aspen-config',
262
+        ],
263 263
     ],
264 264
 
265 265
         
266
- 'linux'=>[
267
-     'group' => "linux",
268
-     'display'=>_("Linux"),
269
-     'match'=>'Linux(?!.*Android)',
270
-     'directory'=>'linux',
271
-     'module' => 'Linux',
272
-     'options'=>[
273
-       'mime'=>'application/x-sh',
274
-      ],
275
-   ],
266
+    'linux'=>[
267
+        'group' => "linux",
268
+        'display'=>_("Linux"),
269
+        'match'=>'Linux(?!.*Android)',
270
+        'directory'=>'linux',
271
+        'module' => 'Linux',
272
+        'options'=>[
273
+        'mime'=>'application/x-sh',
274
+        ],
275
+    ],
276 276
 
277
- 'chromeos'=>[
277
+    'chromeos'=>[
278 278
     'group' => "chrome",
279 279
     'display'=>_("Chrome OS"),
280 280
     'match'=>'CrOS',
281 281
     'directory'=>'chromebook',
282 282
     'module'=>'chromebook',
283 283
     'options'=>[
284
-       'mime'=>'application/x-onc',
285
-       'message'=>sprintf(_("After downloading the file, open the Chrome browser and browse to this URL: <a href='chrome://net-internals/#chromeos'>chrome://net-internals/#chromeos</a>. Then, use the 'Import ONC file' button. The import is silent; the new network definitions will be added to the preferred networks.")),
286
-      ],
287
-   ],
284
+        'mime'=>'application/x-onc',
285
+        'message'=>sprintf(_("After downloading the file, open the Chrome browser and browse to this URL: <a href='chrome://net-internals/#chromeos'>chrome://net-internals/#chromeos</a>. Then, use the 'Import ONC file' button. The import is silent; the new network definitions will be added to the preferred networks.")),
286
+        ],
287
+    ],
288 288
         
289
- 'android_marshmallow'=>[
289
+    'android_marshmallow'=>[
290 290
     'group' => "android",
291 291
     'display'=>_("Android 6.0 Marshmallow"),
292
-     'match'=>'Android 6\.[0-9]',
292
+        'match'=>'Android 6\.[0-9]',
293 293
     'directory'=>'xml',
294 294
     'module'=>'Lollipop',
295 295
     'options'=>[
296
-       'mime'=>'application/eap-config',
297
-       'message'=>sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from %s, %s and %s, and will use the configuration file downloaded from CAT to create all necessary settings."),
296
+        'mime'=>'application/eap-config',
297
+        'message'=>sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from %s, %s and %s, and will use the configuration file downloaded from CAT to create all necessary settings."),
298 298
                             "eduroamCAT",
299 299
                             "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>",
300 300
                             "<a target='_blank' href='unbeknownst'>Amazon Appstore</a>",
301 301
                             "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"),
302
-      ],
303
-   ],
302
+        ],
303
+    ],
304 304
 
305
- 'android_lollipop'=>[
305
+    'android_lollipop'=>[
306 306
     'group' => "android",
307 307
     'display'=>_("Android 5.0 Lollipop"),
308
-     'match'=>'Android 5\.[0-9]',
308
+        'match'=>'Android 5\.[0-9]',
309 309
     'directory'=>'xml',
310 310
     'module'=>'Lollipop',
311 311
     'options'=>[
312
-       'mime'=>'application/eap-config',
313
-       'message'=>sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from %s, %s and %s, and will use the configuration file downloaded from CAT to create all necessary settings."),
312
+        'mime'=>'application/eap-config',
313
+        'message'=>sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from %s, %s and %s, and will use the configuration file downloaded from CAT to create all necessary settings."),
314 314
                             "eduroamCAT",
315 315
                             "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>",
316 316
                             "<a target='_blank' href='unbeknownst'>Amazon Appstore</a>",
317 317
                             "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"),
318
-      ],
319
-   ],
318
+        ],
319
+    ],
320 320
 
321
- 'android_kitkat'=>[
321
+    'android_kitkat'=>[
322 322
     'group' => "android",
323 323
     'display'=>_("Android 4.4 KitKat"),
324
-     'match'=>'Android 4\.[4-9]',
324
+        'match'=>'Android 4\.[4-9]',
325 325
     'directory'=>'xml',
326 326
     'module'=>'KitKat',
327 327
     'options'=>[
328
-       'mime'=>'application/eap-config',
329
-       'message'=>sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from %s, %s and %s, and will use the configuration file downloaded from CAT to create all necessary settings."),
328
+        'mime'=>'application/eap-config',
329
+        'message'=>sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from %s, %s and %s, and will use the configuration file downloaded from CAT to create all necessary settings."),
330 330
                             "eduroamCAT",
331 331
                             "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>",
332 332
                             "<a target='_blank' href='unbeknownst'>Amazon Appstore</a>",
333 333
                             "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"),
334
-      ],
335
-   ],
334
+        ],
335
+    ],
336 336
 
337 337
 
338
- 'android_43'=>[
338
+    'android_43'=>[
339 339
     'group' => "android",
340 340
     'display'=>_("Android 4.3"),
341
-     'match'=>'Android 4\.3',
341
+        'match'=>'Android 4\.3',
342 342
     'directory'=>'xml',
343 343
     'module'=>'KitKat',
344 344
     'options'=>[
345
-       'mime'=>'application/eap-config',
346
-       'message'=>sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from %s, %s and %s, and will use the configuration file downloaded from CAT to create all necessary settings."),
345
+        'mime'=>'application/eap-config',
346
+        'message'=>sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from %s, %s and %s, and will use the configuration file downloaded from CAT to create all necessary settings."),
347 347
                             "eduroamCAT",
348 348
                             "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>",
349 349
                             "<a target='_blank' href='unbeknownst'>Amazon Appstore</a>",
350 350
                             "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"),
351
-      ],
352
-   ],
351
+        ],
352
+    ],
353 353
 
354
- 'android_legacy'=>[
355
-     'group' => "android",
356
-     'display'=>_("Android"),
357
-     'match'=>'Android',
358
-     'directory'=>'redirect_dev',
359
-     'module'=>'RedirectDev',
360
-     'options'=>[
361
-       'redirect'=>1,
362
-      ],
363
-   ],
354
+    'android_legacy'=>[
355
+        'group' => "android",
356
+        'display'=>_("Android"),
357
+        'match'=>'Android',
358
+        'directory'=>'redirect_dev',
359
+        'module'=>'RedirectDev',
360
+        'options'=>[
361
+        'redirect'=>1,
362
+        ],
363
+    ],
364 364
 
365
- 'eap-config'=>[
365
+    'eap-config'=>[
366 366
     'group' => "eap-config",
367 367
     'display'=>_("EAP config"),
368 368
     'directory'=>'xml',
369 369
     'module'=>'XML_ALL',
370 370
     'options'=>[
371
-       'mime'=>'application/eap-config',
372
-       'message'=>sprintf(_("This option provides a generic EAP config XML file, which can be consumed by dedicated applications like eduroamCAT for Android and Linux platforms. This is still an experimental feature.")),
373
-      ],
371
+        'mime'=>'application/eap-config',
372
+        'message'=>sprintf(_("This option provides a generic EAP config XML file, which can be consumed by dedicated applications like eduroamCAT for Android and Linux platforms. This is still an experimental feature.")),
373
+        ],
374 374
     ],
375 375
 
376
- 'test'=>[
376
+    'test'=>[
377 377
     'group' => "other",
378 378
     'display'=>_("Test"),
379 379
     'directory'=>'test_module',
380 380
     'module'=>'TestModule',
381 381
     'options'=>[
382
-       'hidden'=>1,
383
-      ],
384
-   ],
382
+        'hidden'=>1,
383
+        ],
384
+    ],
385 385
 
386 386
 
387 387
 /*    
Please login to merge, or discard this patch.
devices/test_module/TestModule.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -70,51 +70,51 @@  discard block
 block discarded – undo
70 70
  * @package ModuleWriting
71 71
  */
72 72
 class Device_TestModule extends DeviceConfig {
73
-   /**
74
-    * Constructs a Device object.
75
-    *
76
-    * It is CRUTCIAL that the constructor sets $this->supportedEapMethods to an array of methods
77
-    * available for the particular device.
78
-    * {@source}
79
-    * @param string $device a pointer to a device module, which must
80
-    * be an index of one of the devices defined in the {@link Devices}
81
-    * array in {@link devices.php}.
82
-    * @final not to be redefined
83
-    */
73
+    /**
74
+     * Constructs a Device object.
75
+     *
76
+     * It is CRUTCIAL that the constructor sets $this->supportedEapMethods to an array of methods
77
+     * available for the particular device.
78
+     * {@source}
79
+     * @param string $device a pointer to a device module, which must
80
+     * be an index of one of the devices defined in the {@link Devices}
81
+     * array in {@link devices.php}.
82
+     * @final not to be redefined
83
+     */
84 84
     final public function __construct() {
85
-      $this->supportedEapMethods  = EAP::listKnownEAPTypes();
86
-      debug(4,"This device supports the following EAP methods: ");
87
-      debug(4,$this->supportedEapMethods);
85
+        $this->supportedEapMethods  = EAP::listKnownEAPTypes();
86
+        debug(4,"This device supports the following EAP methods: ");
87
+        debug(4,$this->supportedEapMethods);
88 88
     }
89 89
 
90
-  /**
91
-   * prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer
92
-   *
93
-   * {@source}
94
-   * @return string installer path name
95
-   */
96
-   public function writeInstaller() {
90
+    /**
91
+     * prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer
92
+     *
93
+     * {@source}
94
+     * @return string installer path name
95
+     */
96
+    public function writeInstaller() {
97 97
 debug(4,"Test Module Installer start\n");
98
-   // create certificate files and save their names in $CA_files arrary
99
-     $CA_files = $this->saveCertificateFiles('der');
98
+    // create certificate files and save their names in $CA_files arrary
99
+        $CA_files = $this->saveCertificateFiles('der');
100 100
   
101 101
     // copy a fixed file from the module Files directory
102
-       if(! $this->copyFile('Module.howto'))
103
-          debug(2, "copying of Module.howto failed\n");
102
+        if(! $this->copyFile('Module.howto'))
103
+            debug(2, "copying of Module.howto failed\n");
104 104
 
105 105
     // copy a fixed file from the module Files directory and saveunde a different name
106
-       if( ! $this->copyFile('test_file','copied_test_file'))
107
-          debug(2, "copying of Module.howto to copied_test_file failed\n");
108
-       $this->dumpAttibutes('profile_attributes');
109
-       $installer_path =  $this->zipInstaller($this->attributes);
110
-       return($installer_path);
111
-   }
106
+        if( ! $this->copyFile('test_file','copied_test_file'))
107
+            debug(2, "copying of Module.howto to copied_test_file failed\n");
108
+        $this->dumpAttibutes('profile_attributes');
109
+        $installer_path =  $this->zipInstaller($this->attributes);
110
+        return($installer_path);
111
+    }
112 112
 
113
-  /**
114
-    * prepare module desctiption and usage information
115
-    * {@source}
116
-    * @return string HTML text to be displayed in the information window
117
-    */
113
+    /**
114
+     * prepare module desctiption and usage information
115
+     * {@source}
116
+     * @return string HTML text to be displayed in the information window
117
+     */
118 118
     public function writeDeviceInfo() {
119 119
     $ssid_ct=count($this->attributes['internal:SSID']);
120 120
     $out = "<p>";
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 
125 125
 
126 126
 /**
127
-  * zip files and return the archive name
128
-  *
129
-  * inline{@source}
130
-  * return string
131
-  */
132
-  private function zipInstaller($attr) {
127
+ * zip files and return the archive name
128
+ *
129
+ * inline{@source}
130
+ * return string
131
+ */
132
+    private function zipInstaller($attr) {
133 133
     $e = $this->installerBasename.'.zip';
134 134
     $o = system('zip -q '.$e.' *');
135 135
     return $e;
136
-  }
136
+    }
137 137
 
138 138
 }
Please login to merge, or discard this patch.
devices/ms/WindowsCommon.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
  * @param string $in input string
19 19
  */
20 20
 function echo_nsi($in) {
21
-  echo preg_replace('/"/','$\"',$in);
21
+    echo preg_replace('/"/','$\"',$in);
22 22
 }
23 23
 
24 24
 function sprint_nsi($in) {
25
-  return preg_replace('/"/','$\"',$in);
25
+    return preg_replace('/"/','$\"',$in);
26 26
 }
27 27
 
28 28
 /**
@@ -35,39 +35,39 @@  discard block
 block discarded – undo
35 35
 
36 36
 protected function prepareInstallerLang() {
37 37
     if(isset($this->LANGS[$this->lang_index])) {
38
-      $L = $this->LANGS[$this->lang_index];
39
-      $this->lang = $L['nsis'];
40
-      $this->code_page = 'cp'.$L['cp'];
38
+        $L = $this->LANGS[$this->lang_index];
39
+        $this->lang = $L['nsis'];
40
+        $this->code_page = 'cp'.$L['cp'];
41 41
     } else {
42
-      $this->lang = 'English';
43
-      $this->code_page = 'cp1252';
42
+        $this->lang = 'English';
43
+        $this->code_page = 'cp1252';
44 44
     }
45 45
 }
46 46
 
47 47
 protected function combineLogo($Logos) {
48 48
     // maximum size to which we want to resize
49
- $max_size= 120;
49
+    $max_size= 120;
50 50
 // logo wull be shited up by this much
51
- $vshift = 20;
52
- $bg_image = new Imagick('cat_bg.bmp');
53
- $bg_image->setFormat('BMP3');
54
- $bg_image_size = $bg_image->getImageGeometry();
55
- $logo = new Imagick($Logos[0]['name']);
56
- $logo_size = $logo->getImageGeometry();
57
- $max = max($logo_size);
58
- debug(4,"Logo size: "); debug(4,$logo_size); debug(4,"max=$max\n");
51
+    $vshift = 20;
52
+    $bg_image = new Imagick('cat_bg.bmp');
53
+    $bg_image->setFormat('BMP3');
54
+    $bg_image_size = $bg_image->getImageGeometry();
55
+    $logo = new Imagick($Logos[0]['name']);
56
+    $logo_size = $logo->getImageGeometry();
57
+    $max = max($logo_size);
58
+    debug(4,"Logo size: "); debug(4,$logo_size); debug(4,"max=$max\n");
59 59
 // resize logo if necessary
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);
65
- }
66
- $logo_size = $logo->getImageGeometry();
67
- debug(4,"New logo size: "); debug(4,$logo_size);
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);
65
+    }
66
+    $logo_size = $logo->getImageGeometry();
67
+    debug(4,"New logo size: "); debug(4,$logo_size);
68 68
 // calculate logo offsets for composition with the background
69
- $hoffset = round(($bg_image_size['width'] - $logo_size['width'])/2);
70
- $voffset = round(($bg_image_size['height'] - $logo_size['height'])/2) - $vshift;
69
+    $hoffset = round(($bg_image_size['width'] - $logo_size['width'])/2);
70
+    $voffset = round(($bg_image_size['height'] - $logo_size['height'])/2) - $vshift;
71 71
 
72 72
 //logo image is put on top of the background
73 73
 $bg_image->compositeImage($logo, $logo->getImageCompose(), $hoffset, $voffset);
@@ -77,61 +77,61 @@  discard block
 block discarded – undo
77 77
 }
78 78
 
79 79
 protected function signInstaller($attr) {
80
-   $e = $this->installerBasename.'.exe';
81
-   if($this->sign) {
82
-      $o = system($this->sign." installer.exe '$e' > /dev/null");
83
-   }
84
-   else
85
-      rename("installer.exe",$e);
86
-   return $e;
80
+    $e = $this->installerBasename.'.exe';
81
+    if($this->sign) {
82
+        $o = system($this->sign." installer.exe '$e' > /dev/null");
83
+    }
84
+    else
85
+        rename("installer.exe",$e);
86
+    return $e;
87 87
 }
88 88
 
89 89
 protected function compileNSIS() {
90
-   if(Config::$NSIS_VERSION >= 3)
91
-      $makensis = Config::$PATHS['makensis'] . " -INPUTCHARSET UTF8";
92
-   else
93
-      $makensis = Config::$PATHS['makensis']; 
94
-   $o = $makensis.' -V4 cat.NSI > nsis.log';
95
-   system($o);
96
-   debug(4,"compileNSIS:$o\n");
90
+    if(Config::$NSIS_VERSION >= 3)
91
+        $makensis = Config::$PATHS['makensis'] . " -INPUTCHARSET UTF8";
92
+    else
93
+        $makensis = Config::$PATHS['makensis']; 
94
+    $o = $makensis.' -V4 cat.NSI > nsis.log';
95
+    system($o);
96
+    debug(4,"compileNSIS:$o\n");
97 97
 }
98 98
 
99 99
 protected function msInfoFile($attr) {
100
- $out = '';
100
+    $out = '';
101 101
 if(isset($attr['support:info_file'])) {
102 102
     $out .= '!define EXTERNAL_INFO "';
103 103
 //  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') {
107
-     $in_txt = file_get_contents($attr['internal:info_file'][0]['name']);
108
-     if(Config::$NSIS_VERSION >= 3)
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') {
107
+        $in_txt = file_get_contents($attr['internal:info_file'][0]['name']);
108
+        if(Config::$NSIS_VERSION >= 3)
109 109
         $out_txt = $in_txt;
110
-     else
110
+        else
111 111
         $out_txt = iconv('UTF-8',$this->code_page.'//TRANSLIT',$in_txt);
112
-     if($out_txt) {
112
+        if($out_txt) {
113 113
         file_put_contents('info_f.txt',$out_txt);
114 114
         $out = '!define LICENSE_FILE " info_f.txt';
115
-     }
116
-  }
117
-  else
118
-     $out = '!define EXTERNAL_INFO "'. $attr['internal:info_file'][0]['name'];
115
+        }
116
+    }
117
+    else
118
+        $out = '!define EXTERNAL_INFO "'. $attr['internal:info_file'][0]['name'];
119 119
 
120
-  $out .= "\"\n";
120
+    $out .= "\"\n";
121 121
 }
122
- debug(4,"Info file returned: $out");
123
-  return $out;
122
+    debug(4,"Info file returned: $out");
123
+    return $out;
124 124
 }
125 125
 
126 126
 
127 127
 protected function writeAdditionalDeletes($P) {
128
-  if(count($P) == 0 )
128
+    if(count($P) == 0 )
129 129
     return;
130
-  $f = fopen('profiles.nsh','a');
131
-  fwrite($f,"!define AdditionalDeletes\n");
132
-  foreach ($P as $p)
130
+    $f = fopen('profiles.nsh','a');
131
+    fwrite($f,"!define AdditionalDeletes\n");
132
+    foreach ($P as $p)
133 133
     fwrite($f,"!insertmacro define_delete_profile \"$p\"\n");
134
-  fclose($f);
134
+    fclose($f);
135 135
 }
136 136
 
137 137
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 'af'=>['nsis'=>"Afrikaans",'cp'=>'1252'],
182 182
 'ast'=>['nsis'=>"Asturian",'cp'=>'1252'],
183 183
 
184
-  ];
184
+    ];
185 185
 
186 186
 public $code_page;
187 187
 public $lang;
Please login to merge, or discard this patch.
devices/xml/XML_TTLS_PAP.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@
 block discarded – undo
5 5
 
6 6
 class Device_XML_TTLS_PAP extends Device_XML {
7 7
     final public function __construct() {
8
-      $this->supportedEapMethods  =
8
+        $this->supportedEapMethods  =
9 9
             [
10
-              EAP::$TTLS_PAP,
11
-       ];
12
-      $this->lang_scope = 'single';
10
+                EAP::$TTLS_PAP,
11
+        ];
12
+        $this->lang_scope = 'single';
13 13
     }
14 14
 }
15 15
 
Please login to merge, or discard this patch.
devices/xml/XML_ALL.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -5,16 +5,16 @@
 block discarded – undo
5 5
 
6 6
 class Device_XML_ALL extends Device_XML{
7 7
     final public function __construct() {
8
-      $this->supportedEapMethods  =
8
+        $this->supportedEapMethods  =
9 9
             [
10
-              EAP::$PEAP_MSCHAP2,
11
-              EAP::$TTLS_PAP,
12
-              EAP::$TTLS_MSCHAP2,
13
-              EAP::$TLS,
14
-              EAP::$PWD,
15
-       ];
16
-      $this->lang_scope = 'single';
17
-      $this->all_eaps = TRUE;
10
+                EAP::$PEAP_MSCHAP2,
11
+                EAP::$TTLS_PAP,
12
+                EAP::$TTLS_MSCHAP2,
13
+                EAP::$TLS,
14
+                EAP::$PWD,
15
+        ];
16
+        $this->lang_scope = 'single';
17
+        $this->all_eaps = TRUE;
18 18
     }
19 19
 }
20 20
 
Please login to merge, or discard this patch.
devices/xml/KitKat.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@
 block discarded – undo
5 5
 
6 6
 class Device_KitKat extends Device_XML{
7 7
     final public function __construct() {
8
-      $this->supportedEapMethods  =
8
+        $this->supportedEapMethods  =
9 9
             [
10
-              EAP::$PEAP_MSCHAP2,
11
-              EAP::$TTLS_PAP,
12
-              EAP::$TTLS_MSCHAP2,
13
-       ];
14
-      $this->lang_scope = 'single';
15
-      $this->all_eaps = TRUE;
10
+                EAP::$PEAP_MSCHAP2,
11
+                EAP::$TTLS_PAP,
12
+                EAP::$TTLS_MSCHAP2,
13
+        ];
14
+        $this->lang_scope = 'single';
15
+        $this->all_eaps = TRUE;
16 16
     }
17 17
 }
18 18
 
Please login to merge, or discard this patch.
devices/xml/XML_TLS.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@
 block discarded – undo
5 5
 
6 6
 class Device_XML_TLS extends Device_XML {
7 7
     final public function __construct() {
8
-      $this->supportedEapMethods  =
8
+        $this->supportedEapMethods  =
9 9
             [
10
-              EAP::$TLS,
11
-       ];
12
-      $this->lang_scope = 'single';
10
+                EAP::$TLS,
11
+        ];
12
+        $this->lang_scope = 'single';
13 13
     }
14 14
 }
15 15
 
Please login to merge, or discard this patch.