Completed
Branch master (03ec64)
by Brook
14:43
created
core/CAT.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -230,7 +230,7 @@
 block discarded – undo
230 230
      * @param string $user persistent identifier of the user who triggered the action
231 231
      * @param string $category type of modification, from the fixed vocabulary: "NEW", "OWN", "MOD", "DEL"
232 232
      * @param string $message message to log into the audit log
233
-     * @return boolean TRUE if successful. Will terminate script execution on failure. 
233
+     * @return boolean|null TRUE if successful. Will terminate script execution on failure. 
234 234
      */
235 235
     public static function writeAudit($user, $category, $message) {
236 236
         switch ($category) {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -191,9 +191,9 @@
 block discarded – undo
191 191
      * gets the language setting in CAT
192 192
      */
193 193
     static public function get_lang() {
194
-       if(self::$LANG === '')
195
-         list(self::$LANG, $xx) = self::set_lang();
196
-       return self::$LANG;
194
+        if(self::$LANG === '')
195
+            list(self::$LANG, $xx) = self::set_lang();
196
+        return self::$LANG;
197 197
     }
198 198
 
199 199
     /**
Please login to merge, or discard this patch.
core/DBConnection.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -87,6 +87,7 @@  discard block
 block discarded – undo
87 87
     /**
88 88
      * executes a query and triggers logging to the SQL audit log if it's not a SELECT
89 89
      * @param string $querystring the query to be executed
90
+     * @param string $db
90 91
      * @return mixed the query result as mysqli_result object; or TRUE on non-return-value statements
91 92
      */
92 93
     public static function exec($db, $querystring) {
@@ -134,6 +135,8 @@  discard block
 block discarded – undo
134 135
     /**
135 136
      * Checks if a raw data pointer is public data (return value FALSE) or if 
136 137
      * yes who the authorised admins to view it are (return array of user IDs)
138
+     * @param string $table
139
+     * @param string $row
137 140
      */
138 141
     public static function isDataRestricted($table, $row) {
139 142
         if ($table != "institution_option" && $table != "profile_option" && $table != "federation_option")
@@ -175,6 +178,7 @@  discard block
 block discarded – undo
175 178
 
176 179
     /**
177 180
      * Retrieves the last auto-id of an INSERT. Needs to be called immediately after the corresponding exec() call
181
+     * @param string $db
178 182
      * @return int the last autoincrement-ID
179 183
      */
180 184
     public static function lastID($db) {
Please login to merge, or discard this patch.
core/DeviceConfig.php 2 patches
Doc Comments   +2 added lines, -5 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     * named the same as device_id. The second option takes precedence.
173 173
     *
174 174
     * @param string $source_name The source file name
175
-    * @param string $output_name The destination file name
175
+    * @param integer $output_name The destination file name
176 176
     *
177 177
     * @return bool result of the copy operation
178 178
     * @final not to be redefined
@@ -216,8 +216,7 @@  discard block
 block discarded – undo
216 216
     * named the same as device_id. The second option takes precedence.
217 217
     *
218 218
     * @param string $source_name The source file name
219
-    * @param string $output_name The destination file name
220
-    * @param int $use_win_cp Set Windows charset if non-zero
219
+    * @param integer $output_name The destination file name
221 220
     *
222 221
     * @final not to be redefined
223 222
     */
@@ -262,8 +261,6 @@  discard block
 block discarded – undo
262 261
     * The second optional parameter, if nonzero, should be the character set understood by iconv
263 262
     * This is required by the Windows installer and is expected to go away in the future.
264 263
     *
265
-    * @param string $source_name The source file name
266
-    * @param int $use_win_cp Set Windows charset if non-zero
267 264
     *
268 265
     * @final not to be redefined
269 266
     */
Please login to merge, or discard this patch.
Indentation   +421 added lines, -421 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
 ?>
7 7
 <?php
8 8
 /**
9
-  * This file defines the abstract Device class
10
-  *
11
-  * @package ModuleWriting
12
-  */
9
+ * This file defines the abstract Device class
10
+ *
11
+ * @package ModuleWriting
12
+ */
13 13
 
14 14
 /**
15 15
  * 
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
  */
47 47
 
48 48
 abstract class DeviceConfig {
49
-   /**
50
-    * stores the path to the temporary working directory for a module instance
51
-    * @var string $FPATH
52
-    */
49
+    /**
50
+     * stores the path to the temporary working directory for a module instance
51
+     * @var string $FPATH
52
+     */
53 53
     public $FPATH;
54 54
 
55 55
     /**
@@ -58,390 +58,390 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public $specialities;
60 60
 
61
-   /**
61
+    /**
62 62
      * device module constructor should be defined by each module, but if it is not, then here is a default one
63 63
      */
64 64
 
65
-      public function __construct() {
66
-      $this->supportedEapMethods  = [EAP::$TLS, EAP::$PEAP_MSCHAP2, EAP::$TTLS_PAP];
67
-      debug(4,"This device supports the following EAP methods: ");
68
-      debug(4,$this->supportedEapMethods);
65
+        public function __construct() {
66
+        $this->supportedEapMethods  = [EAP::$TLS, EAP::$PEAP_MSCHAP2, EAP::$TTLS_PAP];
67
+        debug(4,"This device supports the following EAP methods: ");
68
+        debug(4,$this->supportedEapMethods);
69 69
     }
70 70
 
71 71
 
72
-   /**
73
-    * Set up working environment for a device module
74
-    *
75
-    * Sets up the device module environment taking into account the actual profile
76
-    * selected by the user in the GUI. The selected profile is passed as the
77
-    * Profile $profile argumant.
78
-    *
79
-    * This method needs to be called after the device instance has been created (the GUI class does that)
80
-    *
81
-    * setup performs the following tasks:
82
-    * - collect profile attributes and pass them as the attributes property;
83
-    * - create the temporary working directory
84
-    * - process CA certificates and store them as 'internal:CAs' attribute
85
-    * - process and save optional info files and store references to them in
86
-    *   'internal:info_file' attribute
87
-    * @param Profile $profile the profile object which will be passed by the caller
88
-    * @final not to be redefined
89
-    */
72
+    /**
73
+     * Set up working environment for a device module
74
+     *
75
+     * Sets up the device module environment taking into account the actual profile
76
+     * selected by the user in the GUI. The selected profile is passed as the
77
+     * Profile $profile argumant.
78
+     *
79
+     * This method needs to be called after the device instance has been created (the GUI class does that)
80
+     *
81
+     * setup performs the following tasks:
82
+     * - collect profile attributes and pass them as the attributes property;
83
+     * - create the temporary working directory
84
+     * - process CA certificates and store them as 'internal:CAs' attribute
85
+     * - process and save optional info files and store references to them in
86
+     *   'internal:info_file' attribute
87
+     * @param Profile $profile the profile object which will be passed by the caller
88
+     * @final not to be redefined
89
+     */
90 90
     final public function setup(Profile $profile) {
91
-       debug(4,"module setup start\n");
92
-       if(! $profile instanceof Profile) {
93
-          debug(2,"No profile has been set\n");
94
-          error("No profile has been set");
95
-          exit;
96
-       }
97
-       $this->attributes = $this->getProfileAttributes($profile);
98
-       if(! $this->selected_eap) {
99
-          error("No EAP type specified.");
100
-          exit;
101
-       }
102
-       // create temporary directory, its full path will be saved in $this->FPATH;
103
-       $T = createTemporaryDirectory('installer');
104
-       $this->FPATH = $T['dir'];
105
-       mkdir($T['dir'].'/tmp');
106
-       chdir($T['dir'].'/tmp');
107
-       $CAs = [];
108
-       if(isset($this->attributes['eap:ca_file'])) {
109
-       foreach ($this->attributes['eap:ca_file'] as $ca) {
110
-          if($c = X509::processCertificate($ca))
111
-             $CAs[] = $c;
112
-          }
113
-          $this->attributes['internal:CAs'][0]=$CAs;
114
-       }
115
-       if(isset($this->attributes['support:info_file'])) {
116
-          $this->attributes['internal:info_file'][0] = 
117
-             $this->saveInfoFile($this->attributes['support:info_file'][0]);
118
-       }
119
-       if(isset($this->attributes['general:logo_file']))
120
-          $this->attributes['internal:logo_file'] = 
121
-             $this->saveLogoFile($this->attributes['general:logo_file']);
122
-       $this->attributes['internal:SSID'] = $this->getSSIDs()['add'];;
123
-       $this->attributes['internal:remove_SSID'] = $this->getSSIDs()['del'];;
124
-       $this->attributes['internal:consortia'] = $this->getConsortia();
125
-       $this->lang_index = CAT::get_lang();
126
-       // phpMD says the below is not needed. Wow.
127
-       // $idp = new IdP($profile->institution);
128
-       $olddomain = CAT::set_locale("core");
129
-       $this->support_email_substitute = sprintf(_("your local %s support"),Config::$CONSORTIUM['name']);
130
-       $this->support_url_substitute = sprintf(_("your local %s support page"),Config::$CONSORTIUM['name']);
131
-       CAT::set_locale($olddomain);
132
-
133
-       if($this->signer && $this->options['sign'])
134
-         $this->sign = CAT::$root . '/signer/'. $this->signer;
135
-       $this->installerBasename = $this->getInstallerBasename();
91
+        debug(4,"module setup start\n");
92
+        if(! $profile instanceof Profile) {
93
+            debug(2,"No profile has been set\n");
94
+            error("No profile has been set");
95
+            exit;
96
+        }
97
+        $this->attributes = $this->getProfileAttributes($profile);
98
+        if(! $this->selected_eap) {
99
+            error("No EAP type specified.");
100
+            exit;
101
+        }
102
+        // create temporary directory, its full path will be saved in $this->FPATH;
103
+        $T = createTemporaryDirectory('installer');
104
+        $this->FPATH = $T['dir'];
105
+        mkdir($T['dir'].'/tmp');
106
+        chdir($T['dir'].'/tmp');
107
+        $CAs = [];
108
+        if(isset($this->attributes['eap:ca_file'])) {
109
+        foreach ($this->attributes['eap:ca_file'] as $ca) {
110
+            if($c = X509::processCertificate($ca))
111
+                $CAs[] = $c;
112
+            }
113
+            $this->attributes['internal:CAs'][0]=$CAs;
114
+        }
115
+        if(isset($this->attributes['support:info_file'])) {
116
+            $this->attributes['internal:info_file'][0] = 
117
+                $this->saveInfoFile($this->attributes['support:info_file'][0]);
118
+        }
119
+        if(isset($this->attributes['general:logo_file']))
120
+            $this->attributes['internal:logo_file'] = 
121
+                $this->saveLogoFile($this->attributes['general:logo_file']);
122
+        $this->attributes['internal:SSID'] = $this->getSSIDs()['add'];;
123
+        $this->attributes['internal:remove_SSID'] = $this->getSSIDs()['del'];;
124
+        $this->attributes['internal:consortia'] = $this->getConsortia();
125
+        $this->lang_index = CAT::get_lang();
126
+        // phpMD says the below is not needed. Wow.
127
+        // $idp = new IdP($profile->institution);
128
+        $olddomain = CAT::set_locale("core");
129
+        $this->support_email_substitute = sprintf(_("your local %s support"),Config::$CONSORTIUM['name']);
130
+        $this->support_url_substitute = sprintf(_("your local %s support page"),Config::$CONSORTIUM['name']);
131
+        CAT::set_locale($olddomain);
132
+
133
+        if($this->signer && $this->options['sign'])
134
+            $this->sign = CAT::$root . '/signer/'. $this->signer;
135
+        $this->installerBasename = $this->getInstallerBasename();
136 136
     }
137 137
 
138
-  /**
139
-    * Selects the preferred eap method based on profile EAP configuration and device EAP capabilities
140
-    *
141
-    * @param array eap_array an array of eap methods supported by a given device
142
-    * @return the best matching EAP type for the profile; or 0 if no match was found
143
-    */   
144
-   public function getPreferredEapType($eap_array) {
145
-     foreach ($eap_array as $eap) {
146
-         if(in_array($eap,$this->supportedEapMethods)) {
138
+    /**
139
+     * Selects the preferred eap method based on profile EAP configuration and device EAP capabilities
140
+     *
141
+     * @param array eap_array an array of eap methods supported by a given device
142
+     * @return the best matching EAP type for the profile; or 0 if no match was found
143
+     */   
144
+    public function getPreferredEapType($eap_array) {
145
+        foreach ($eap_array as $eap) {
146
+            if(in_array($eap,$this->supportedEapMethods)) {
147 147
             $this->selected_eap = $eap;
148 148
             debug(4,"Selected EAP:");
149 149
             debug(4,$eap);
150 150
             return($eap);
151
-         }
152
-     }
153
-     return(0);
154
-   }
155
-  /**
156
-    * prepare usage information for the installer
157
-    * every device module should override this method
158
-    *
159
-    * @return String HTML text to be displayed
160
-    */ 
161
-   public function writeDeviceInfo() {
162
-     return _("Sorry, this should not happen - no additional information is available");
163
-   }
164
-
165
-  /**
166
-    *  Copy a file from the module location to the temporary directory.
167
-    *
168
-    * If the second argument is provided then the file will be saved under the name 
169
-    * taken form this argument. If only one parameter is given, source and destination
170
-    * filenames are the same
171
-    * Source file can be located either in the Files subdirectory or in the sibdirectory of Files
172
-    * named the same as device_id. The second option takes precedence.
173
-    *
174
-    * @param string $source_name The source file name
175
-    * @param string $output_name The destination file name
176
-    *
177
-    * @return bool result of the copy operation
178
-    * @final not to be redefined
179
-    */
180
-   final protected function copyFile($source_name, $output_name = 0) {
181
-      if  ( $output_name === 0)
151
+            }
152
+        }
153
+        return(0);
154
+    }
155
+    /**
156
+     * prepare usage information for the installer
157
+     * every device module should override this method
158
+     *
159
+     * @return String HTML text to be displayed
160
+     */ 
161
+    public function writeDeviceInfo() {
162
+        return _("Sorry, this should not happen - no additional information is available");
163
+    }
164
+
165
+    /**
166
+     *  Copy a file from the module location to the temporary directory.
167
+     *
168
+     * If the second argument is provided then the file will be saved under the name 
169
+     * taken form this argument. If only one parameter is given, source and destination
170
+     * filenames are the same
171
+     * Source file can be located either in the Files subdirectory or in the sibdirectory of Files
172
+     * named the same as device_id. The second option takes precedence.
173
+     *
174
+     * @param string $source_name The source file name
175
+     * @param string $output_name The destination file name
176
+     *
177
+     * @return bool result of the copy operation
178
+     * @final not to be redefined
179
+     */
180
+    final protected function copyFile($source_name, $output_name = 0) {
181
+        if  ( $output_name === 0)
182 182
         $output_name = $source_name;
183 183
 
184
-      debug(4,"fileCopy($source_name, $output_name)\n");
185
-      if(is_file($this->module_path.'/Files/'.$this->device_id.'/'.$source_name))
186
-         $source = $this->module_path.'/Files/'.$this->device_id.'/'.$source_name;
187
-      elseif(is_file($this->module_path.'/Files/'.$source_name))
188
-         $source = $this->module_path.'/Files/'.$source_name;
189
-      else {
184
+        debug(4,"fileCopy($source_name, $output_name)\n");
185
+        if(is_file($this->module_path.'/Files/'.$this->device_id.'/'.$source_name))
186
+            $source = $this->module_path.'/Files/'.$this->device_id.'/'.$source_name;
187
+        elseif(is_file($this->module_path.'/Files/'.$source_name))
188
+            $source = $this->module_path.'/Files/'.$source_name;
189
+        else {
190 190
         debug(2,"fileCopy:reqested file $source_name does not exist\n");
191 191
         return(FALSE);
192
-      }
193
-      debug(4,"Copying $source to $output_name\n");
194
-      $result = copy($source,"$output_name");
195
-      if(! $result )
192
+        }
193
+        debug(4,"Copying $source to $output_name\n");
194
+        $result = copy($source,"$output_name");
195
+        if(! $result )
196 196
         debug(2,"fileCopy($source_name, $output_name) failed\n");
197
-      return($result); 
198
-   }
199
-
200
-
201
-  /**
202
-    *  Copy a file from the module location to the temporary directory aplying transcoding.
203
-    *
204
-    * Transcoding is only required for Windows installers, and no Unicode support
205
-    * in NSIS (NSIS version below 3)
206
-    * Trancoding is only applied if the third optional parameter is set and nonzero
207
-    * If Config::$NSIS_VERSION is set to 3 or more, no transcoding will be applied
208
-    * regardless of the third parameter value.
209
-    * If the second argument is provided and is not equal to 0, then the file will be
210
-    * saved under the name taken from this argument.
211
-    * If only one parameter is given or the second is equal to 0, source and destination
212
-    * filenames are the same.
213
-    * The third optional parameter, if nonzero, should be the character set understood by iconv
214
-    * This is required by the Windows installer and is expected to go away in the future.
215
-    * Source file can be located either in the Files subdirectory or in the sibdirectory of Files
216
-    * named the same as device_id. The second option takes precedence.
217
-    *
218
-    * @param string $source_name The source file name
219
-    * @param string $output_name The destination file name
220
-    * @param int $use_win_cp Set Windows charset if non-zero
221
-    *
222
-    * @final not to be redefined
223
-    */
224
-
225
-   final protected function translateFile($source_name, $output_name = 0, $encoding = 0) {
226
-      if(Config::$NSIS_VERSION >= 3)
197
+        return($result); 
198
+    }
199
+
200
+
201
+    /**
202
+     *  Copy a file from the module location to the temporary directory aplying transcoding.
203
+     *
204
+     * Transcoding is only required for Windows installers, and no Unicode support
205
+     * in NSIS (NSIS version below 3)
206
+     * Trancoding is only applied if the third optional parameter is set and nonzero
207
+     * If Config::$NSIS_VERSION is set to 3 or more, no transcoding will be applied
208
+     * regardless of the third parameter value.
209
+     * If the second argument is provided and is not equal to 0, then the file will be
210
+     * saved under the name taken from this argument.
211
+     * If only one parameter is given or the second is equal to 0, source and destination
212
+     * filenames are the same.
213
+     * The third optional parameter, if nonzero, should be the character set understood by iconv
214
+     * This is required by the Windows installer and is expected to go away in the future.
215
+     * Source file can be located either in the Files subdirectory or in the sibdirectory of Files
216
+     * named the same as device_id. The second option takes precedence.
217
+     *
218
+     * @param string $source_name The source file name
219
+     * @param string $output_name The destination file name
220
+     * @param int $use_win_cp Set Windows charset if non-zero
221
+     *
222
+     * @final not to be redefined
223
+     */
224
+
225
+    final protected function translateFile($source_name, $output_name = 0, $encoding = 0) {
226
+        if(Config::$NSIS_VERSION >= 3)
227 227
         $encoding = 0;
228
-      if  ( $output_name === 0)
228
+        if  ( $output_name === 0)
229 229
         $output_name = $source_name;
230 230
 
231
-      debug(4,"translateFile($source_name, $output_name, $encoding)\n");
232
-      ob_start();
233
-      debug(4,$this->module_path.'/Files/'.$this->device_id.'/'.$source_name."\n");
234
-      if(is_file($this->module_path.'/Files/'.$this->device_id.'/'.$source_name))
235
-         $source = $this->module_path.'/Files/'.$this->device_id.'/'.$source_name;
236
-      elseif(is_file($this->module_path.'/Files/'.$source_name))
237
-         $source = $this->module_path.'/Files/'.$source_name;
238
-      include($source);
239
-      $output = ob_get_clean();
240
-      if($encoding) {
231
+        debug(4,"translateFile($source_name, $output_name, $encoding)\n");
232
+        ob_start();
233
+        debug(4,$this->module_path.'/Files/'.$this->device_id.'/'.$source_name."\n");
234
+        if(is_file($this->module_path.'/Files/'.$this->device_id.'/'.$source_name))
235
+            $source = $this->module_path.'/Files/'.$this->device_id.'/'.$source_name;
236
+        elseif(is_file($this->module_path.'/Files/'.$source_name))
237
+            $source = $this->module_path.'/Files/'.$source_name;
238
+        include($source);
239
+        $output = ob_get_clean();
240
+        if($encoding) {
241 241
         $output_c = iconv('UTF-8',$encoding.'//TRANSLIT',$output);
242 242
         if($output_c)
243
-           $output = $output_c;
244
-      }
245
-      $f = fopen("$output_name","w");
246
-      if(! $f)
247
-         debug(2,"translateFile($source, $output_name, $encoding) failed\n");
248
-      fwrite($f,$output);
249
-      fclose($f);
250
-      debug(4,"translateFile($source, $output_name, $encoding) end\n");
251
-   }
252
-
253
-
254
-  /**
255
-    * Transcode a string adding double quotes escaping
256
-    *
257
-    * Transcoding is only required for Windows installers, and no Unicode support
258
-    * in NSIS (NSIS version below 3)
259
-    * Trancoding is only applied if the third optional parameter is set and nonzero
260
-    * If Config::$NSIS_VERSION is set to 3 or more, no transcoding will be applied
261
-    * regardless of the second parameter value.
262
-    * The second optional parameter, if nonzero, should be the character set understood by iconv
263
-    * This is required by the Windows installer and is expected to go away in the future.
264
-    *
265
-    * @param string $source_name The source file name
266
-    * @param int $use_win_cp Set Windows charset if non-zero
267
-    *
268
-    * @final not to be redefined
269
-    */
270
-
271
-   final protected function translateString($source_string,$encoding = 0) {
272
-      if(Config::$NSIS_VERSION >= 3)
243
+            $output = $output_c;
244
+        }
245
+        $f = fopen("$output_name","w");
246
+        if(! $f)
247
+            debug(2,"translateFile($source, $output_name, $encoding) failed\n");
248
+        fwrite($f,$output);
249
+        fclose($f);
250
+        debug(4,"translateFile($source, $output_name, $encoding) end\n");
251
+    }
252
+
253
+
254
+    /**
255
+     * Transcode a string adding double quotes escaping
256
+     *
257
+     * Transcoding is only required for Windows installers, and no Unicode support
258
+     * in NSIS (NSIS version below 3)
259
+     * Trancoding is only applied if the third optional parameter is set and nonzero
260
+     * If Config::$NSIS_VERSION is set to 3 or more, no transcoding will be applied
261
+     * regardless of the second parameter value.
262
+     * The second optional parameter, if nonzero, should be the character set understood by iconv
263
+     * This is required by the Windows installer and is expected to go away in the future.
264
+     *
265
+     * @param string $source_name The source file name
266
+     * @param int $use_win_cp Set Windows charset if non-zero
267
+     *
268
+     * @final not to be redefined
269
+     */
270
+
271
+    final protected function translateString($source_string,$encoding = 0) {
272
+        if(Config::$NSIS_VERSION >= 3)
273 273
         $encoding = 0;
274
-      if($encoding)
274
+        if($encoding)
275 275
         $output_c = iconv('UTF-8',$encoding.'//TRANSLIT',$source_string);
276
-      else
276
+        else
277 277
         $output_c = $source_string;
278
-      if($output_c) 
279
-         $source_string  = str_replace('"','$\\"',$output_c);
280
-      else
281
-         debug(2,"Failed to convert string $source_string\n");
282
-      return $source_string;
283
-   }
284
-
285
-
286
-  /**
287
-   * Save certificate files in either DER or PEM format
288
-   *
289
-   * Certificate files will be saved in the module working directory.
290
-   * @param string $format  only "der" and "pem" are currently allowed
291
-   * @return array an array of arrays or FALSE on error
292
-   * saved certificate file names are avalable under the 'file' index
293
-   * additional array entries are indexed as 'sha1', 'md5', and 'root'.
294
-   * sha1 and md5 are correcponding certificate hashes
295
-   * root is set to 1 for the CA roor certicicate and 0 otherwise
296
-  */ 
297
-   final protected function saveCertificateFiles($format) {
298
-     if($format == 'der' || $format == 'pam') {
299
-       $i = 0;
300
-       $CA_files = [];
301
-       $ca_array = $this->attributes['internal:CAs'][0];
302
-       if(! $ca_array)
303
-         return(FALSE);
304
-       foreach ($ca_array as $CA) {
305
-         $f = fopen("cert-$i.crt","w");
306
-         if(! $f) die("problem opening the file\n");
307
-         if($format == "pem")
278
+        if($output_c) 
279
+            $source_string  = str_replace('"','$\\"',$output_c);
280
+        else
281
+            debug(2,"Failed to convert string $source_string\n");
282
+        return $source_string;
283
+    }
284
+
285
+
286
+    /**
287
+     * Save certificate files in either DER or PEM format
288
+     *
289
+     * Certificate files will be saved in the module working directory.
290
+     * @param string $format  only "der" and "pem" are currently allowed
291
+     * @return array an array of arrays or FALSE on error
292
+     * saved certificate file names are avalable under the 'file' index
293
+     * additional array entries are indexed as 'sha1', 'md5', and 'root'.
294
+     * sha1 and md5 are correcponding certificate hashes
295
+     * root is set to 1 for the CA roor certicicate and 0 otherwise
296
+     */ 
297
+    final protected function saveCertificateFiles($format) {
298
+        if($format == 'der' || $format == 'pam') {
299
+        $i = 0;
300
+        $CA_files = [];
301
+        $ca_array = $this->attributes['internal:CAs'][0];
302
+        if(! $ca_array)
303
+            return(FALSE);
304
+        foreach ($ca_array as $CA) {
305
+            $f = fopen("cert-$i.crt","w");
306
+            if(! $f) die("problem opening the file\n");
307
+            if($format == "pem")
308 308
             fwrite($f,$CA['pem']);
309
-         else
309
+            else
310 310
             fwrite($f,$CA['der']);
311
-         fclose($f);
312
-         $C = [];
313
-         $C['file'] = "cert-$i.crt";
314
-         $C['sha1'] = $CA['sha1'];
315
-         $C['md5'] = $CA['md5'];
316
-         $C['root'] = $CA['root'];
317
-         $CA_files[] = $C;
318
-         $i++;
319
-       }
320
-       return($CA_files);
321
-     } else {
322
-       debug(2, 'incorrect format value specified');
323
-       return(FALSE);
324
-     }
311
+            fclose($f);
312
+            $C = [];
313
+            $C['file'] = "cert-$i.crt";
314
+            $C['sha1'] = $CA['sha1'];
315
+            $C['md5'] = $CA['md5'];
316
+            $C['root'] = $CA['root'];
317
+            $CA_files[] = $C;
318
+            $i++;
319
+        }
320
+        return($CA_files);
321
+        } else {
322
+        debug(2, 'incorrect format value specified');
323
+        return(FALSE);
324
+        }
325 325
       
326
-   }
327
-
328
-   /**
329
-    * Generate installer filename base.
330
-    * Device module should use this name adding an extension.
331
-    * Normally the device identifier follows the Consortium name.
332
-    * The sting taken for the device identifier equals (by default) to the index in the listDevices array,
333
-    * but can be overriden with the 'device_id' device option.
334
-    */
335
-   private function getInstallerBasename() {
336
-      $replace_pattern = '/[ ()\/\'"]+/';
337
-      debug(4,"getInstallerBasename1:".$this->attributes['general:instname'][0]."\n");
338
-      $inst = iconv("UTF-8", "US-ASCII//TRANSLIT", preg_replace($replace_pattern, '_', $this->attributes['general:instname'][0]));
339
-      debug(4,"getInstallerBasename2:$inst\n");
340
-      $Inst_a = explode('_',$inst);
341
-      if(count($Inst_a) > 2) {
342
-         $inst = '';
343
-         foreach($Inst_a as $i)
344
-           $inst .= $i[0];
345
-      }   
346
-      $c_name = iconv("UTF-8", "US-ASCII//TRANSLIT", preg_replace($replace_pattern, '_', Config::$CONSORTIUM['name']));
347
-      if($this->attributes['internal:profile_count'][0] > 1) {
348
-         if(!empty($this->attributes['profile:name']) && ! empty($this->attributes['profile:name'][0])) {
349
-             $prof = iconv("UTF-8", "US-ASCII//TRANSLIT", preg_replace($replace_pattern, '_', $this->attributes['profile:name'][0]));
350
-             $prof = preg_replace('/_+$/','',$prof);
351
-             return $c_name. '-'. $this->getDeviceId() . $inst .'-'. $prof;
352
-         }
353
-      }
354
-      return $c_name. '-'. $this->getDeviceId() . $inst;
355
-  }
356
-
357
-  private function getDeviceId() {
326
+    }
327
+
328
+    /**
329
+     * Generate installer filename base.
330
+     * Device module should use this name adding an extension.
331
+     * Normally the device identifier follows the Consortium name.
332
+     * The sting taken for the device identifier equals (by default) to the index in the listDevices array,
333
+     * but can be overriden with the 'device_id' device option.
334
+     */
335
+    private function getInstallerBasename() {
336
+        $replace_pattern = '/[ ()\/\'"]+/';
337
+        debug(4,"getInstallerBasename1:".$this->attributes['general:instname'][0]."\n");
338
+        $inst = iconv("UTF-8", "US-ASCII//TRANSLIT", preg_replace($replace_pattern, '_', $this->attributes['general:instname'][0]));
339
+        debug(4,"getInstallerBasename2:$inst\n");
340
+        $Inst_a = explode('_',$inst);
341
+        if(count($Inst_a) > 2) {
342
+            $inst = '';
343
+            foreach($Inst_a as $i)
344
+            $inst .= $i[0];
345
+        }   
346
+        $c_name = iconv("UTF-8", "US-ASCII//TRANSLIT", preg_replace($replace_pattern, '_', Config::$CONSORTIUM['name']));
347
+        if($this->attributes['internal:profile_count'][0] > 1) {
348
+            if(!empty($this->attributes['profile:name']) && ! empty($this->attributes['profile:name'][0])) {
349
+                $prof = iconv("UTF-8", "US-ASCII//TRANSLIT", preg_replace($replace_pattern, '_', $this->attributes['profile:name'][0]));
350
+                $prof = preg_replace('/_+$/','',$prof);
351
+                return $c_name. '-'. $this->getDeviceId() . $inst .'-'. $prof;
352
+            }
353
+        }
354
+        return $c_name. '-'. $this->getDeviceId() . $inst;
355
+    }
356
+
357
+    private function getDeviceId() {
358 358
     $d_id = $this->device_id;
359 359
     if(isset($this->options['device_id'])) 
360
-      $d_id = $this->options['device_id'];
360
+        $d_id = $this->options['device_id'];
361 361
     if($d_id !== '')
362
-      $d_id .= '-';
362
+        $d_id .= '-';
363 363
     return $d_id;
364
-  }
364
+    }
365 365
 
366 366
 
367
-  private function getSSIDs() {
367
+    private function getSSIDs() {
368 368
     $S['add']=[];
369 369
     $S['del']=[];
370 370
     if (isset(Config::$CONSORTIUM['ssid'])) {
371
-       foreach (Config::$CONSORTIUM['ssid'] as $ssid) {
371
+        foreach (Config::$CONSORTIUM['ssid'] as $ssid) {
372 372
         if(isset(Config::$CONSORTIUM['tkipsupport']) && Config::$CONSORTIUM['tkipsupport'] == TRUE)
373
-          $S['add'][$ssid] = 'TKIP';
373
+            $S['add'][$ssid] = 'TKIP';
374 374
         else {
375
-          $S['add'][$ssid] = 'AES';
376
-          $S['del'][$ssid] = 'TKIP';
375
+            $S['add'][$ssid] = 'AES';
376
+            $S['del'][$ssid] = 'TKIP';
377
+        }
377 378
         }
378
-       }
379 379
     }
380 380
     if(isset($this->attributes['media:SSID'])) {
381
-      $SSID = $this->attributes['media:SSID'];
381
+        $SSID = $this->attributes['media:SSID'];
382 382
 
383
-      foreach($SSID as $ssid)
384
-         $S['add'][$ssid] = 'AES';
385
-      }
383
+        foreach($SSID as $ssid)
384
+            $S['add'][$ssid] = 'AES';
385
+        }
386 386
     if(isset($this->attributes['media:SSID_with_legacy'])) {
387
-      $SSID = $this->attributes['media:SSID_with_legacy'];
388
-      foreach($SSID as $ssid)
389
-         $S['add'][$ssid] = 'TKIP';
387
+        $SSID = $this->attributes['media:SSID_with_legacy'];
388
+        foreach($SSID as $ssid)
389
+            $S['add'][$ssid] = 'TKIP';
390 390
     }
391 391
     if(isset($this->attributes['media:remove_SSID'])) {
392
-      $SSID = $this->attributes['media:remove_SSID'];
393
-      foreach($SSID as $ssid)
394
-         $S['del'][$ssid] = 'DEL';
392
+        $SSID = $this->attributes['media:remove_SSID'];
393
+        foreach($SSID as $ssid)
394
+            $S['del'][$ssid] = 'DEL';
395 395
     }
396 396
     return $S;
397
-  }
397
+    }
398 398
 
399
-  private function getConsortia() {
400
-      $OIs = [];
401
-      $OIs = array_merge($OIs, Config::$CONSORTIUM['interworking-consortium-oi']);
402
-      if (isset($this->attributes['media:consortium_OI']))
403
-          foreach ($this->attributes['media:consortium_OI'] as $new_oi)
399
+    private function getConsortia() {
400
+        $OIs = [];
401
+        $OIs = array_merge($OIs, Config::$CONSORTIUM['interworking-consortium-oi']);
402
+        if (isset($this->attributes['media:consortium_OI']))
403
+            foreach ($this->attributes['media:consortium_OI'] as $new_oi)
404 404
             $OIs[] = $new_oi;
405
-      return $OIs;
406
-  }
405
+        return $OIs;
406
+    }
407 407
   
408
-  /**
409
-   * An array with shorthand definitions for MIME types
410
-   * @var array
411
-   */
412
-  private $mime_extensions = [
413
-     'text/plain' => 'txt',
414
-     'text/rtf' => 'rtf',
415
-     'application/pdf' =>'pdf',
416
-  ];
417
-
418
-  private function saveLogoFile($Logos) {
408
+    /**
409
+     * An array with shorthand definitions for MIME types
410
+     * @var array
411
+     */
412
+    private $mime_extensions = [
413
+        'text/plain' => 'txt',
414
+        'text/rtf' => 'rtf',
415
+        'application/pdf' =>'pdf',
416
+    ];
417
+
418
+    private function saveLogoFile($Logos) {
419 419
     $i=0;
420 420
     $returnarray= [];
421 421
     foreach ($Logos as $blob) {
422
-      $finfo = new finfo(FILEINFO_MIME_TYPE);
423
-      $mime = $finfo->buffer($blob);
424
-      if(preg_match('/^image\/(.*)/',$mime,$m))
422
+        $finfo = new finfo(FILEINFO_MIME_TYPE);
423
+        $mime = $finfo->buffer($blob);
424
+        if(preg_match('/^image\/(.*)/',$mime,$m))
425 425
         $ext = $m[1];
426
-      else
426
+        else
427 427
         $ext = 'unsupported';
428
-      debug(4,"saveLogoFile: $mime : $ext\n");
429
-      $f_name = 'logo-'.$i.'.'.$ext;
430
-      $f = fopen($f_name,"w");
431
-      if(! $f) {
432
-          debug(2,"saveLogoFile failed for: $f_name\n");
433
-          die("problem opening the file\n");
434
-      }
435
-      fwrite($f,$blob);
436
-      fclose($f);
437
-      $returnarray[]= ['name'=>$f_name,'mime'=>$ext];
438
-      $i++;
428
+        debug(4,"saveLogoFile: $mime : $ext\n");
429
+        $f_name = 'logo-'.$i.'.'.$ext;
430
+        $f = fopen($f_name,"w");
431
+        if(! $f) {
432
+            debug(2,"saveLogoFile failed for: $f_name\n");
433
+            die("problem opening the file\n");
434
+        }
435
+        fwrite($f,$blob);
436
+        fclose($f);
437
+        $returnarray[]= ['name'=>$f_name,'mime'=>$ext];
438
+        $i++;
439 439
     }
440 440
     return($returnarray);
441
-  }
441
+    }
442 442
 
443 443
 
444
-  private function saveInfoFile($blob) {
444
+    private function saveInfoFile($blob) {
445 445
     $finfo = new finfo(FILEINFO_MIME_TYPE);
446 446
     $mime = $finfo->buffer($blob);
447 447
     $ext = isset($this->mime_extensions[$mime]) ? $this->mime_extensions[$mime] : 'usupported';
@@ -451,43 +451,43 @@  discard block
 block discarded – undo
451 451
     fwrite($f,$blob);
452 452
     fclose($f);
453 453
     return(['name'=>'local-info.'.$ext,'mime'=>$ext]);
454
-  }
455
-
456
-  private function getProfileAttributes(Profile $profile) {
457
-     $eaps = $profile->getEapMethodsinOrderOfPreference(1);
458
-     if($eap = $this->getPreferredEapType($eaps)) {
459
-          $a = $profile->getCollapsedAttributes($eap);
460
-          $a['eap'] = $eap;
461
-          $a['all_eaps'] = $eaps;
462
-          return($a);
463
-     } else {
464
-       error("No supported eap types found for this profile.");
465
-       return(FALSE);
466
-  }
467
-  }
454
+    }
455
+
456
+    private function getProfileAttributes(Profile $profile) {
457
+        $eaps = $profile->getEapMethodsinOrderOfPreference(1);
458
+        if($eap = $this->getPreferredEapType($eaps)) {
459
+            $a = $profile->getCollapsedAttributes($eap);
460
+            $a['eap'] = $eap;
461
+            $a['all_eaps'] = $eaps;
462
+            return($a);
463
+        } else {
464
+        error("No supported eap types found for this profile.");
465
+        return(FALSE);
466
+    }
467
+    }
468 468
 /**
469
-  * dumps attributes for debugging purposes
470
-  *
471
-  * dumpAttibutes method is supplied for debuging purposes, it simply dumps the attribute array
472
-  * to a file with name passed in the attribute.
473
-  * @param string $file the output file name
474
-  */
475
-  protected function dumpAttibutes($file) {
469
+     * dumps attributes for debugging purposes
470
+     *
471
+     * dumpAttibutes method is supplied for debuging purposes, it simply dumps the attribute array
472
+     * to a file with name passed in the attribute.
473
+     * @param string $file the output file name
474
+     */
475
+    protected function dumpAttibutes($file) {
476 476
         ob_start();
477 477
         print_r($this->attributes);
478 478
         $output = ob_get_clean();
479 479
         $f = fopen($file,"w");
480 480
         fwrite($f,$output);
481 481
         fclose($f);
482
-  }
482
+    }
483 483
 /** 
484
- * placeholder for the main device method
485
- *
486
- */
484
+     * placeholder for the main device method
485
+     *
486
+     */
487 487
 
488
-  protected function writeInstaller() {
489
-     return("download path");
490
-  }
488
+    protected function writeInstaller() {
489
+        return("download path");
490
+    }
491 491
 
492 492
 /**
493 493
  * Array passing all options to the device module.
@@ -521,76 +521,76 @@  discard block
 block discarded – undo
521 521
  * @see X509::processCertificate()
522 522
  * @var array $attributes
523 523
  */
524
-  public $attributes;
524
+    public $attributes;
525 525
 /**
526
-  * stores the path to the module source location and is used 
527
-  * by copyFile and translateFile
528
-  * the only reason for it to be a public variable ies that it is set by the DeviceFactory class
529
-  * module_path should not be used by module drivers.
530
-  * @var string 
531
-  */
532
-  public $module_path;
526
+     * stores the path to the module source location and is used 
527
+     * by copyFile and translateFile
528
+     * the only reason for it to be a public variable ies that it is set by the DeviceFactory class
529
+     * module_path should not be used by module drivers.
530
+     * @var string 
531
+     */
532
+    public $module_path;
533 533
 
534 534
 /**
535 535
  * The optimal EAP type
536 536
  *
537 537
  */ 
538 538
 /**
539
-  * optimal EAP method selected given profile and device
540
-  * @var EAP::constant
541
-  */
542
-  public $selected_eap;
539
+ * optimal EAP method selected given profile and device
540
+ * @var EAP::constant
541
+ */
542
+    public $selected_eap;
543 543
 /**
544
-  * the path to the profile signing program
545
-  * device modules which require signing should use this property to exec the signer
546
-  * the signer program must accept two arguments - input and output file names
547
-  * the signer program mus operate in the local directory and filenames are relative to this
548
-  * directory
549
-  *
550
-  *@var string
551
-  */
552
-  public $sign;
553
-  public $signer;
544
+     * the path to the profile signing program
545
+     * device modules which require signing should use this property to exec the signer
546
+     * the signer program must accept two arguments - input and output file names
547
+     * the signer program mus operate in the local directory and filenames are relative to this
548
+     * directory
549
+     *
550
+     *@var string
551
+     */
552
+    public $sign;
553
+    public $signer;
554 554
 /**
555
- * the string referencing the language (index ot the Config::$LANGUAGES array).
556
- * It is set to the current language and may be used by the device module to
557
- * set its language
558
- *
559
- *@var string
560
- */
561
-  public $lang_index;
562
-  /**
563
-   * The string identifier of the device (don't show this to users)
564
-   * @var string
565
-   */
566
-  public $device_id;
567
-
568
-  /**
569
-   * See devices-template.php for a list of available options
570
-   * @var array
571
-   */
572
-  public $options;
573
-
574
-  /**
575
-   * This string will be shown if no support email was configured by the admin
576
-   * 
577
-   * @var string 
578
-   */
579
-  public static $support_email_substitute;
580
-
581
-  /**
582
-   * This string will be shown if no support URL was configured by the admin
583
-   * 
584
-   * @var string 
585
-   */
586
-  public static $support_url_substitute;
587
-
588
-  /**
589
-   * This string should be used by all installer modules to set the 
590
-   * installer file basename.
591
-   *
592
-   * @var string 
593
-   */
594
-  public static $installerBasename;
555
+     * the string referencing the language (index ot the Config::$LANGUAGES array).
556
+     * It is set to the current language and may be used by the device module to
557
+     * set its language
558
+     *
559
+     *@var string
560
+     */
561
+    public $lang_index;
562
+    /**
563
+     * The string identifier of the device (don't show this to users)
564
+     * @var string
565
+     */
566
+    public $device_id;
567
+
568
+    /**
569
+     * See devices-template.php for a list of available options
570
+     * @var array
571
+     */
572
+    public $options;
573
+
574
+    /**
575
+     * This string will be shown if no support email was configured by the admin
576
+     * 
577
+     * @var string 
578
+     */
579
+    public static $support_email_substitute;
580
+
581
+    /**
582
+     * This string will be shown if no support URL was configured by the admin
583
+     * 
584
+     * @var string 
585
+     */
586
+    public static $support_url_substitute;
587
+
588
+    /**
589
+     * This string should be used by all installer modules to set the 
590
+     * installer file basename.
591
+     *
592
+     * @var string 
593
+     */
594
+    public static $installerBasename;
595 595
 }
596 596
 ?>
Please login to merge, or discard this patch.
core/Federation.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -661,7 +661,7 @@
 block discarded – undo
661 661
      * This function retrieves the federation attributes. If called with the optional parameter, only attribute values for the attribute
662 662
      * name in $option_name are retrieved; otherwise, all attributes are retrieved.
663 663
      *
664
-     * @param string $option_name optionally, the name of the attribute that is to be retrieved
664
+     * @param integer $option_name optionally, the name of the attribute that is to be retrieved
665 665
      * @return array of arrays of attributes which were set for this IdP
666 666
      */
667 667
     public function getAttributes($option_name = 0) {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -678,10 +678,10 @@
 block discarded – undo
678 678
     }
679 679
     
680 680
         /**
681
-     * deletes all attributes in this federation except the _file ones, these are reported as array
682
-     *
683
-     * @return array list of row id's of file-based attributes which weren't deleted
684
-     */
681
+         * deletes all attributes in this federation except the _file ones, these are reported as array
682
+         *
683
+         * @return array list of row id's of file-based attributes which weren't deleted
684
+         */
685 685
     public function beginFlushAttributes() {
686 686
         DBConnection::exec(Federation::$DB_TYPE, "DELETE FROM federation_option WHERE federation_id = '$this->identifier' AND option_name NOT LIKE '%_file'");
687 687
         $exec_q = DBConnection::exec(Federation::$DB_TYPE, "SELECT row FROM federation_option WHERE federation_id = '$this->identifier'");
Please login to merge, or discard this patch.
core/Helper.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,6 +32,7 @@  discard block
 block discarded – undo
32 32
 /**
33 33
  * write debug messages to the log
34 34
  *
35
+ * @param integer $level
35 36
  */
36 37
 function debug($level, $t) {
37 38
     if (Config::$DEBUG_LEVEL >= $level) {
@@ -130,7 +131,7 @@  discard block
 block discarded – undo
130 131
  * generates a UUID
131 132
  *
132 133
  * @param string $prefix an extra prefix to set before the UUID
133
- * @return UUID (possibly prefixed)
134
+ * @return string (possibly prefixed)
134 135
  */
135 136
 function uuid($prefix = '', $deterministic_source = NULL) {
136 137
     if ($deterministic_source === NULL) 
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -180,32 +180,32 @@  discard block
 block discarded – undo
180 180
 function createTemporaryDirectory($purpose = 'installer',$fail = 1) {
181 181
         $name = md5(time().rand());
182 182
         switch($purpose) {
183
-           case 'installer':
183
+            case 'installer':
184 184
              $path = CAT::$root.'/var/installer_cache';
185
-             break;
186
-           case 'logo':
185
+                break;
186
+            case 'logo':
187 187
              $path = CAT::$root.'/web/downloads/logos';
188
-             break;
189
-           case 'test':
188
+                break;
189
+            case 'test':
190 190
              $path = CAT::$root.'/var/tmp';
191
-             break;
192
-           default:
191
+                break;
192
+            default:
193 193
              error("unable to create temporary directory for unknown purpose: $purpose\n");
194
-             exit;
194
+                exit;
195 195
         }
196 196
         $tmp_dir = $path .'/'. $name;
197 197
         debug(4,"temp dir: $purpose : $tmp_dir\n");
198 198
         if(! mkdir($tmp_dir,0700, true)) {
199
-          if($fail) {
200
-             error("unable to create temporary directory: $tmp_dir\n");
201
-             exit;
202
-          } else  {
199
+            if($fail) {
200
+                error("unable to create temporary directory: $tmp_dir\n");
201
+                exit;
202
+            } else  {
203 203
             debug(4, "Directory creation failed for $tmp_dir\n");
204 204
             return ['base'=>$path,'dir'=>'',$name=>''];
205
-          }
205
+            }
206 206
         } else
207
-         debug(4, "Directory created: $tmp_dir\n");
208
-     return ['base'=>$path,'dir'=>$tmp_dir,'name'=>$name];
207
+            debug(4, "Directory created: $tmp_dir\n");
208
+        return ['base'=>$path,'dir'=>$tmp_dir,'name'=>$name];
209 209
 }
210 210
 
211 211
 function png_inject_consortium_logo ($inputpngstring, $symbolsize = 12, $marginsymbols = 4) {
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     $targetplacementy = $symbolsize * round(($sizeinput[1] / 2 - ($targetheight - $symbolsize) / 2)/$symbolsize);
237 237
     imagecopyresized($inputgd, $whiteimage, $targetplacementx-$symbolsize, $targetplacementy-$symbolsize, 0, 0, $targetwidth+2*$symbolsize, $targetheight+2*$symbolsize, $targetwidth+2*$symbolsize, $targetheight+2*$symbolsize);
238 238
     imagecopyresized($inputgd, $logogd,     $targetplacementx, $targetplacementy, 0, 0, $targetwidth   , $targetheight   , $sizelogo[0]   , $sizelogo[1]);
239
- // imagecopyresized($dst_image, $src_image, $dst_x,                               $dst_y,                                $src_x, $src_y, $dst_w,       $dst_h,        $src_w,       $src_h);
239
+    // imagecopyresized($dst_image, $src_image, $dst_x,                               $dst_y,                                $src_x, $src_y, $dst_w,       $dst_h,        $src_w,       $src_h);
240 240
     ob_start();
241 241
     imagepng($inputgd);
242 242
     return ob_get_clean();
Please login to merge, or discard this patch.
core/IdP.php 2 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,6 +68,7 @@  discard block
 block discarded – undo
68 68
      * Cannot be used to define a new IdP in the database! This happens via Federation::newIdP()
69 69
      *
70 70
      * @param integer $i_id the database row identifier
71
+     * @return string
71 72
      */
72 73
     public function __construct($i_id) {
73 74
         debug(3, "--- BEGIN Constructing new IdP object ... ---\n");
@@ -247,7 +248,7 @@  discard block
 block discarded – undo
247 248
      * This function retrieves the IdP-wide attributes. If called with the optional parameter, only attribute values for the attribute
248 249
      * name in $option_name are retrieved; otherwise, all attributes are retrieved.
249 250
      *
250
-     * @param string $option_name optionally, the name of the attribute that is to be retrieved
251
+     * @param integer $option_name optionally, the name of the attribute that is to be retrieved
251 252
      * @return array of arrays of attributes which were set for this IdP
252 253
      */
253 254
     public function getAttributes($option_name = 0) {
@@ -318,7 +319,7 @@  discard block
 block discarded – undo
318 319
      * Adds a new profile to this IdP.
319 320
      * Only creates the DB entry for the Profile. If you want to add attributes later, see Profile::addAttribute().
320 321
      *
321
-     * @return object new Profile object if successful, or FALSE if an error occured
322
+     * @return Profile|null new Profile object if successful, or FALSE if an error occured
322 323
      */
323 324
     public function newProfile() {
324 325
         DBConnection::exec(IdP::$DB_TYPE, "INSERT INTO profile (inst_id) VALUES($this->identifier)");
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -118,10 +118,10 @@
 block discarded – undo
118 118
             }
119 119
         }
120 120
         $this->priv_attributes[] = ["name" => "internal:country", 
121
-                                         "value" => $this->federation, 
122
-                                         "level" => "IdP", 
123
-                                         "row" => 0, 
124
-                                         "flag" => NULL];
121
+                                            "value" => $this->federation, 
122
+                                            "level" => "IdP", 
123
+                                            "row" => 0, 
124
+                                            "flag" => NULL];
125 125
 
126 126
         $this->name = getLocalisedValue($this->getAttributes('general:instname', 0, 0), CAT::get_lang());
127 127
         debug(3, "--- END Constructing new IdP object ... ---\n");
Please login to merge, or discard this patch.
core/Options.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
      * 
95 95
      * @assert ("user") == Array("user:email","user:fedadmin","user:realname")
96 96
      * 
97
-     * @param string $class_name optionally specifies the class of options to be listed (class is the part of the option name before the : sign)
97
+     * @param integer $class_name optionally specifies the class of options to be listed (class is the part of the option name before the : sign)
98 98
      * @return array of options
99 99
      */
100 100
     public function availableOptions($class_name = 0) {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
  */
30 30
 class Options {
31 31
     
32
-   /**
32
+    /**
33 33
      * database which this class queries by default
34 34
      * 
35 35
      * @var string
Please login to merge, or discard this patch.
core/phpqrcode.php 2 patches
Doc Comments   +108 added lines patch added patch discarded remove patch
@@ -96,6 +96,10 @@  discard block
 block discarded – undo
96 96
 	define('QR_FORMAT_PNG',  1);
97 97
 	
98 98
 	class qrstr {
99
+
100
+		/**
101
+		 * @param string $repl
102
+		 */
99 103
 		public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
100 104
 			$srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
101 105
 		}
@@ -231,6 +235,11 @@  discard block
 block discarded – undo
231 235
         }
232 236
 
233 237
         //----------------------------------------------------------------------
238
+
239
+        /**
240
+         * @param boolean $outfile
241
+         * @param string $err
242
+         */
234 243
         public static function log($outfile, $err)
235 244
         {
236 245
             if (QR_LOG_DIR !== false) {
@@ -256,6 +265,10 @@  discard block
 block discarded – undo
256 265
         }
257 266
         
258 267
         //----------------------------------------------------------------------
268
+
269
+        /**
270
+         * @param string $markerId
271
+         */
259 272
         public static function markTime($markerId)
260 273
         {
261 274
             list($usec, $sec) = explode(" ", microtime());
@@ -410,18 +423,30 @@  discard block
 block discarded – undo
410 423
         }
411 424
         
412 425
         //----------------------------------------------------------------------
426
+
427
+        /**
428
+         * @param integer $version
429
+         */
413 430
         public static function getWidth($version)
414 431
         {
415 432
             return self::$capacity[$version][QRCAP_WIDTH];
416 433
         }
417 434
         
418 435
         //----------------------------------------------------------------------
436
+
437
+        /**
438
+         * @param integer $version
439
+         */
419 440
         public static function getRemainder($version)
420 441
         {
421 442
             return self::$capacity[$version][QRCAP_REMINDER];
422 443
         }
423 444
         
424 445
         //----------------------------------------------------------------------
446
+
447
+        /**
448
+         * @param integer $size
449
+         */
425 450
         public static function getMinimumVersion($size, $level)
426 451
         {
427 452
 
@@ -535,6 +560,9 @@  discard block
 block discarded – undo
535 560
         //----------------------------------------------------------------------
536 561
         // CACHEABLE!!!
537 562
         
563
+        /**
564
+         * @param integer $version
565
+         */
538 566
         public static function getEccSpec($version, $level, array &$spec)
539 567
         {
540 568
             if (count($spec) < 5) {
@@ -857,12 +885,20 @@  discard block
 block discarded – undo
857 885
         }
858 886
         
859 887
         //----------------------------------------------------------------------
888
+
889
+        /**
890
+         * @param string $code
891
+         */
860 892
         public static function unserial($code)
861 893
         {
862 894
             return explode("\n", gzuncompress($code));
863 895
         }
864 896
         
865 897
         //----------------------------------------------------------------------
898
+
899
+        /**
900
+         * @param integer $version
901
+         */
866 902
         public static function newFrame($version)
867 903
         {
868 904
             if($version < 1 || $version > QRSPEC_VERSION_MAX) 
@@ -1236,6 +1272,10 @@  discard block
 block discarded – undo
1236 1272
         }
1237 1273
         
1238 1274
         //----------------------------------------------------------------------
1275
+
1276
+        /**
1277
+         * @param integer $version
1278
+         */
1239 1279
         public function encodeBitStream($version)
1240 1280
         {
1241 1281
             try {
@@ -1313,6 +1353,10 @@  discard block
 block discarded – undo
1313 1353
         }
1314 1354
         
1315 1355
         //----------------------------------------------------------------------
1356
+
1357
+        /**
1358
+         * @param integer $version
1359
+         */
1316 1360
         public function setVersion($version)
1317 1361
         {
1318 1362
             if($version < 0 || $version > QRSPEC_VERSION_MAX) {
@@ -1351,6 +1395,12 @@  discard block
 block discarded – undo
1351 1395
         }
1352 1396
         
1353 1397
         //----------------------------------------------------------------------
1398
+
1399
+        /**
1400
+         * @param QRinput $mode
1401
+         * @param integer $size
1402
+         * @param integer $data
1403
+         */
1354 1404
         public function append($mode, $size, $data)
1355 1405
         {
1356 1406
             try {
@@ -1446,6 +1496,10 @@  discard block
 block discarded – undo
1446 1496
         ];
1447 1497
         
1448 1498
         //----------------------------------------------------------------------
1499
+
1500
+        /**
1501
+         * @param integer $c
1502
+         */
1449 1503
         public static function lookAnTable($c)
1450 1504
         {
1451 1505
             return (($c > 127)?-1:self::$anTable[$c]);
@@ -1531,6 +1585,10 @@  discard block
 block discarded – undo
1531 1585
         
1532 1586
         
1533 1587
         //----------------------------------------------------------------------
1588
+
1589
+        /**
1590
+         * @param integer $version
1591
+         */
1534 1592
         public function estimateBitStreamSize($version)
1535 1593
         {
1536 1594
             $bits = 0;
@@ -1648,6 +1706,10 @@  discard block
 block discarded – undo
1648 1706
         }
1649 1707
         
1650 1708
         //----------------------------------------------------------------------
1709
+
1710
+        /**
1711
+         * @param QRbitstream $bstream
1712
+         */
1651 1713
         public function appendPaddingBit(&$bstream)
1652 1714
         {
1653 1715
             $bits = $bstream->size();
@@ -1977,6 +2039,10 @@  discard block
 block discarded – undo
1977 2039
         public $modeHint;
1978 2040
 
1979 2041
         //----------------------------------------------------------------------
2042
+
2043
+        /**
2044
+         * @param QRinput $input
2045
+         */
1980 2046
         public function __construct($dataStr, $input, $modeHint) 
1981 2047
         {
1982 2048
             $this->dataStr  = $dataStr;
@@ -1985,6 +2051,10 @@  discard block
 block discarded – undo
1985 2051
         }
1986 2052
         
1987 2053
         //----------------------------------------------------------------------
2054
+
2055
+        /**
2056
+         * @param string $str
2057
+         */
1988 2058
         public static function isdigitat($str, $pos)
1989 2059
         {    
1990 2060
             if ($pos >= strlen($str))
@@ -1994,6 +2064,10 @@  discard block
 block discarded – undo
1994 2064
         }
1995 2065
         
1996 2066
         //----------------------------------------------------------------------
2067
+
2068
+        /**
2069
+         * @param string $str
2070
+         */
1997 2071
         public static function isalnumat($str, $pos)
1998 2072
         {
1999 2073
             if ($pos >= strlen($str))
@@ -2114,6 +2188,10 @@  discard block
 block discarded – undo
2114 2188
         }
2115 2189
         
2116 2190
         //----------------------------------------------------------------------
2191
+
2192
+        /**
2193
+         * @return integer
2194
+         */
2117 2195
         public function eatKanji()
2118 2196
         {
2119 2197
             $p = 0;
@@ -2447,6 +2525,13 @@  discard block
 block discarded – undo
2447 2525
         public static $items = [];
2448 2526
         
2449 2527
         //----------------------------------------------------------------------
2528
+
2529
+        /**
2530
+         * @param integer $symsize
2531
+         * @param integer $gfpoly
2532
+         * @param integer $fcr
2533
+         * @param integer $prim
2534
+         */
2450 2535
         public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
2451 2536
         {
2452 2537
             foreach(self::$items as $rs) {
@@ -2601,6 +2686,10 @@  discard block
 block discarded – undo
2601 2686
         }
2602 2687
         
2603 2688
         //----------------------------------------------------------------------
2689
+
2690
+        /**
2691
+         * @param string $code
2692
+         */
2604 2693
         public static function unserial($code)
2605 2694
         {
2606 2695
             $codeArr = [];
@@ -2661,6 +2750,10 @@  discard block
 block discarded – undo
2661 2750
         }
2662 2751
         
2663 2752
         //----------------------------------------------------------------------
2753
+
2754
+        /**
2755
+         * @param integer $length
2756
+         */
2664 2757
         public function calcN1N3($length)
2665 2758
         {
2666 2759
             $demerit = 0;
@@ -2971,6 +3064,10 @@  discard block
 block discarded – undo
2971 3064
         public $data; 
2972 3065
         
2973 3066
         //----------------------------------------------------------------------
3067
+
3068
+        /**
3069
+         * @param integer $mask
3070
+         */
2974 3071
         public function encodeMask(QRinput $input, $mask)
2975 3072
         {
2976 3073
             if($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
@@ -3052,6 +3149,11 @@  discard block
 block discarded – undo
3052 3149
         }
3053 3150
         
3054 3151
         //----------------------------------------------------------------------
3152
+
3153
+        /**
3154
+         * @param integer $version
3155
+         * @param integer $level
3156
+         */
3055 3157
         public function encodeString8bit($string, $version, $level)
3056 3158
         {
3057 3159
             if(string == NULL) {
@@ -3071,6 +3173,12 @@  discard block
 block discarded – undo
3071 3173
         }
3072 3174
 
3073 3175
         //----------------------------------------------------------------------
3176
+
3177
+        /**
3178
+         * @param integer $version
3179
+         * @param integer $level
3180
+         * @param boolean $casesensitive
3181
+         */
3074 3182
         public function encodeString($string, $version, $level, $hint, $casesensitive)
3075 3183
         {
3076 3184
 
Please login to merge, or discard this patch.
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -74,32 +74,32 @@  discard block
 block discarded – undo
74 74
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
75 75
  */
76 76
  
77
-	// Encoding modes
77
+    // Encoding modes
78 78
 	 
79
-	define('QR_MODE_NUL', -1);
80
-	define('QR_MODE_NUM', 0);
81
-	define('QR_MODE_AN', 1);
82
-	define('QR_MODE_8', 2);
83
-	define('QR_MODE_KANJI', 3);
84
-	define('QR_MODE_STRUCTURE', 4);
85
-
86
-	// Levels of error correction.
87
-
88
-	define('QR_ECLEVEL_L', 0);
89
-	define('QR_ECLEVEL_M', 1);
90
-	define('QR_ECLEVEL_Q', 2);
91
-	define('QR_ECLEVEL_H', 3);
79
+    define('QR_MODE_NUL', -1);
80
+    define('QR_MODE_NUM', 0);
81
+    define('QR_MODE_AN', 1);
82
+    define('QR_MODE_8', 2);
83
+    define('QR_MODE_KANJI', 3);
84
+    define('QR_MODE_STRUCTURE', 4);
85
+
86
+    // Levels of error correction.
87
+
88
+    define('QR_ECLEVEL_L', 0);
89
+    define('QR_ECLEVEL_M', 1);
90
+    define('QR_ECLEVEL_Q', 2);
91
+    define('QR_ECLEVEL_H', 3);
92 92
 	
93
-	// Supported output formats
93
+    // Supported output formats
94 94
 	
95
-	define('QR_FORMAT_TEXT', 0);
96
-	define('QR_FORMAT_PNG',  1);
95
+    define('QR_FORMAT_TEXT', 0);
96
+    define('QR_FORMAT_PNG',  1);
97 97
 	
98
-	class qrstr {
99
-		public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
100
-			$srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
101
-		}
102
-	}	
98
+    class qrstr {
99
+        public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
100
+            $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
101
+        }
102
+    }	
103 103
 
104 104
 
105 105
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
         //----------------------------------------------------------------------
212 212
         public static function buildCache()
213 213
         {
214
-			QRtools::markTime('before_build_cache');
214
+            QRtools::markTime('before_build_cache');
215 215
 			
216
-			$mask = new QRmask();
216
+            $mask = new QRmask();
217 217
             for ($a=1; $a <= QRSPEC_VERSION_MAX; $a++) {
218 218
                 $frame = QRspec::newFrame($a);
219 219
                 if (QR_IMAGE) {
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
                     QRimage::png(self::binarize($frame), $fileName, 1, 0);
222 222
                 }
223 223
 				
224
-				$width = count($frame);
225
-				$bitMask = array_fill(0, $width, array_fill(0, $width, 0));
226
-				for ($maskNo=0; $maskNo<8; $maskNo++)
227
-					$mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
224
+                $width = count($frame);
225
+                $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
226
+                for ($maskNo=0; $maskNo<8; $maskNo++)
227
+                    $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
228 228
             }
229 229
 			
230
-			QRtools::markTime('after_build_cache');
230
+            QRtools::markTime('after_build_cache');
231 231
         }
232 232
 
233 233
         //----------------------------------------------------------------------
@@ -647,10 +647,10 @@  discard block
 block discarded – undo
647 647
 
648 648
         // Version information pattern -----------------------------------------
649 649
 
650
-		// Version information pattern (BCH coded).
650
+        // Version information pattern (BCH coded).
651 651
         // See Table 1 in Appendix D (pp.68) of JIS X0510:2004.
652 652
         
653
-		// size: [QRSPEC_VERSION_MAX - 6]
653
+        // size: [QRSPEC_VERSION_MAX - 6]
654 654
 		
655 655
         public static $versionPattern = [
656 656
             0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d,
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1439 1439
             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1440 1440
             36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43,
1441
-             0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 44, -1, -1, -1, -1, -1,
1441
+                0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 44, -1, -1, -1, -1, -1,
1442 1442
             -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1443 1443
             25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
1444 1444
             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -2500,17 +2500,17 @@  discard block
 block discarded – undo
2500 2500
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2501 2501
  */
2502 2502
  
2503
-	define('N1', 3);
2504
-	define('N2', 3);
2505
-	define('N3', 40);
2506
-	define('N4', 10);
2503
+    define('N1', 3);
2504
+    define('N2', 3);
2505
+    define('N3', 40);
2506
+    define('N4', 10);
2507 2507
 
2508
-	class QRmask {
2508
+    class QRmask {
2509 2509
 	
2510
-		public $runLength = [];
2510
+        public $runLength = [];
2511 2511
 		
2512
-		//----------------------------------------------------------------------
2513
-		public function __construct() 
2512
+        //----------------------------------------------------------------------
2513
+        public function __construct() 
2514 2514
         {
2515 2515
             $this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
2516 2516
         }
Please login to merge, or discard this patch.
core/Profile.php 2 patches
Doc Comments   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * supported EAP types from the DB and stores them in the priv_ arrays.
74 74
      * 
75 75
      * @param int $p_id identifier of the profile in the DB
76
-     * @param IdP $idp_object optionally, the institution to which this Profile belongs. Saves the construction of the IdP instance. If omitted, an extra query and instantiation is executed to find out.
76
+     * @param integer $idp_object optionally, the institution to which this Profile belongs. Saves the construction of the IdP instance. If omitted, an extra query and instantiation is executed to find out.
77 77
      */
78 78
     public function __construct($p_id, $idp_object = 0) {
79 79
         debug(3, "--- BEGIN Constructing new Profile object ... ---\n");
@@ -372,6 +372,8 @@  discard block
 block discarded – undo
372 372
      * 
373 373
      * @param string device the device identifier string
374 374
      * @param string path the path where the new installer can be found
375
+     * @param string $device
376
+     * @param string $path
375 377
      */
376 378
     public function updateCache($device, $path,$mime) {
377 379
         $device = DBConnection::escape_value(Profile::$DB_TYPE, $device);
@@ -384,9 +386,9 @@  discard block
 block discarded – undo
384 386
     /**
385 387
      * Log a new download for our stats
386 388
      * 
387
-     * @param device the device id string
388
-     * @param area either admin or user
389
-     * @return TRUE if incrementing worked, FALSE if not
389
+     * @param device string device id string
390
+     * @param area string admin or user
391
+     * @return boolean if incrementing worked, FALSE if not
390 392
      */
391 393
     public function incrementDownloadStats($device, $area) {
392 394
         $device = DBConnection::escape_value(Profile::$DB_TYPE, $device);
@@ -399,7 +401,7 @@  discard block
 block discarded – undo
399 401
 
400 402
     /**
401 403
      * Retrieve current download stats from database, either for one specific device or for all devices
402
-     * @param string $device the device id string
404
+     * @param integer $device the device id string
403 405
      * @return mixed user downloads of this profile; if device is given, returns the counter as int, otherwise an array with devicename => counter
404 406
      */
405 407
     public function getUserDownloadStats($device = 0) {
@@ -464,7 +466,7 @@  discard block
 block discarded – undo
464 466
      * @param string $attr_name name of the attribute to set
465 467
      * @param string $attr_value value of the attribute to set
466 468
      * @param int $eap_type identifier of the EAP type in the database. 0 if the attribute is valid for all EAP types.
467
-     * @param string $device identifier of the device in the databse. Omit the argument if attribute is valid for all devices.
469
+     * @param integer $device identifier of the device in the databse. Omit the argument if attribute is valid for all devices.
468 470
      */
469 471
     public function addAttribute($attr_name, $attr_value, $eap_type, $device = 0) {
470 472
         $attr_name = DBConnection::escape_value(Profile::$DB_TYPE, $attr_name);
@@ -574,7 +576,7 @@  discard block
 block discarded – undo
574 576
     /** Returns an array of the profile's attributes.
575 577
      * 
576 578
      * @param string option_name the name of a specific option. If set, only returns option values for this option name
577
-     * @param eapmethod the EAP type, in array ("OUTER/INNER") notation. If set, returns only attributes which are specific to that EAP type
579
+     * @param eapmethod integer EAP type, in array ("OUTER/INNER") notation. If set, returns only attributes which are specific to that EAP type
578 580
      * @param string device the device ID string. If set, returns only attributes which are specific to that device
579 581
      * @return array attributes of the profile
580 582
      */
@@ -658,7 +660,7 @@  discard block
 block discarded – undo
658 660
     /**
659 661
      * list all devices marking their availabiblity and possible redirects
660 662
      *
661
-     * @param string $locale for text-based attributes, either returns values for the default value, or if specified here, in the locale specified
663
+     * @param integer $locale for text-based attributes, either returns values for the default value, or if specified here, in the locale specified
662 664
      * @return array of device ids display names and their status
663 665
      */
664 666
     public function listDevices($locale = 0) {
@@ -713,7 +715,7 @@  discard block
 block discarded – undo
713 715
      * as wel as the chosen language.
714 716
      * can be called with an optional $eap argument
715 717
      * 
716
-     * @param array $eap if specified, retrieves attributes specific to the given EAP type
718
+     * @param integer $eap if specified, retrieves attributes specific to the given EAP type
717 719
      * @return array list of attributes in collapsed style (index is the attrib name, value is an array of different values)
718 720
      */
719 721
     public function getCollapsedAttributes($eap = 0) {
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -680,27 +680,27 @@
 block discarded – undo
680 680
             $redirect_url = getLocalisedValue($this->getAttributes("device-specific:redirect", 0, $d), $locale);
681 681
             $dev_status = AVAILABLE;
682 682
             if(isset($D['options']) && isset($D['options']['message']) && $D['options']['message']) 
683
-               $message = $D['options']['message'];
683
+                $message = $D['options']['message'];
684 684
             else
685
-               $message = 0;
685
+                $message = 0;
686 686
 
687 687
             if ($redirect_url === 0) {
688 688
                 if(isset($D['options']) && isset($D['options']['redirect']) && $D['options']['redirect']) {
689
-                   $dev_status = HIDDEN;
689
+                    $dev_status = HIDDEN;
690 690
                 }  else {
691
-                   $eap = $dev->getPreferredEapType($preferred_eap);
692
-                   if ($eap) {
693
-                       if (isset($EAP_options["eap-specific:customtext"][serialize($eap)]))
694
-                           $eap_customtext = $EAP_options["eap-specific:customtext"][serialize($eap)];
695
-                       else {
696
-                           $eap_customtext = getLocalisedValue($this->getAttributes("eap-specific:customtext", $eap, 0), $locale);
697
-                           $EAP_options["eap-specific:customtext"][serialize($eap)] = $eap_customtext;
698
-                       }
699
-                       $device_customtext = getLocalisedValue($this->getAttributes("device-specific:customtext", 0, $d), $locale);
700
-                   } else {
691
+                    $eap = $dev->getPreferredEapType($preferred_eap);
692
+                    if ($eap) {
693
+                        if (isset($EAP_options["eap-specific:customtext"][serialize($eap)]))
694
+                            $eap_customtext = $EAP_options["eap-specific:customtext"][serialize($eap)];
695
+                        else {
696
+                            $eap_customtext = getLocalisedValue($this->getAttributes("eap-specific:customtext", $eap, 0), $locale);
697
+                            $EAP_options["eap-specific:customtext"][serialize($eap)] = $eap_customtext;
698
+                        }
699
+                        $device_customtext = getLocalisedValue($this->getAttributes("device-specific:customtext", 0, $d), $locale);
700
+                    } else {
701 701
                     $dev_status = UNAVAILABLE;
702
-                   }
703
-               }
702
+                    }
703
+                }
704 704
             }
705 705
             $returnarray[] = ['id' => $d, 'display' => $D['display'], 'status' => $dev_status, 'redirect' => $redirect_url, 'eap_customtext' => $eap_customtext, 'device_customtext' => $device_customtext, 'message' => $message, 'options'=>$D['options']];
706 706
         }
Please login to merge, or discard this patch.