Completed
Branch master (03ec64)
by Brook
14:43
created
web/resources/inc/header.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     else
62 62
         $css_url = "http://" . $css_url;
63 63
     echo "<link rel='stylesheet' type='text/css' href='$css_url' />";
64
-    echo "<title>".htmlspecialchars($pagetitle)."</title>";
64
+    echo "<title>" . htmlspecialchars($pagetitle) . "</title>";
65 65
 
66 66
     return $Cat;
67 67
 }
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
     echo "<form action='" . $place['path'] . "' method='GET' accept-charset='UTF-8'>" . _("View this page in") . " ";
133 133
     echo "<select id='lang' name='lang' onchange='this.form.submit()'>";
134 134
     foreach (Config::$LANGUAGES as $lang => $value) {
135
-        echo "<option value='$lang' ".(strtoupper($language) == strtoupper($lang) ? "selected" : "" )." >" . $value['display'] . "</option> ";
135
+        echo "<option value='$lang' " . (strtoupper($language) == strtoupper($lang) ? "selected" : "") . " >" . $value['display'] . "</option> ";
136 136
     }
137 137
     echo "</select>";
138 138
     foreach ($_GET as $var => $value) {
139 139
         if ($var != "lang" && $value != "")
140
-            echo "<input type='hidden' name='".htmlspecialchars($var)."' value='".htmlspecialchars($value)."'>";
140
+            echo "<input type='hidden' name='" . htmlspecialchars($var) . "' value='" . htmlspecialchars($value) . "'>";
141 141
     }
142 142
     echo "</form>";
143 143
     echo "</div><!--langselection-->";
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     // content from here on will SCROLL instead of being fixed at the top
164 164
     echo "<div class='pagecontent'>
165 165
           <div class='trick'>";
166
-    echo "<div id='secondrow' style='border-bottom:5px solid ". Config::$APPEARANCE['colour1']."; min-height:100px;'>";
166
+    echo "<div id='secondrow' style='border-bottom:5px solid " . Config::$APPEARANCE['colour1'] . "; min-height:100px;'>";
167 167
     echo "<div id='secondarycaptions' style='display:inline-block; float:left'>";
168 168
     echo "<h2>$cap2</h2>";
169 169
     echo "</div><!--secondarycaptions-->";
Please login to merge, or discard this patch.
web/basic.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 require_once("CAT.php");
20 20
 require_once("UserAPI.php");
21 21
 
22
-debug(4,"basic.php\n");
23
-debug(4,$_POST);
22
+debug(4, "basic.php\n");
23
+debug(4, $_POST);
24 24
 
25 25
 /**
26 26
   * SimpleGUI defines extensions of the GUI class used only in the simple interface
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 public function __construct() {
37 37
   parent::__construct();
38 38
   $this->Args = [];
39
-  $this->page =  0;
39
+  $this->page = 0;
40 40
   $this->set_locale('core');
41 41
   $this->version = 2;
42 42
   $this->Args['lang'] = CAT::get_lang();
@@ -49,28 +49,28 @@  discard block
 block discarded – undo
49 49
 */
50 50
 
51 51
 
52
-    if(isset($_REQUEST['reset_dev']) && $_REQUEST['reset_dev'] == 1)
52
+    if (isset($_REQUEST['reset_dev']) && $_REQUEST['reset_dev'] == 1)
53 53
       unset($_REQUEST['device']);
54 54
 
55 55
 /* Start with checking if we have the country code if not then use geolocation..
56 56
 */
57 57
     $F = array_keys($this->printCountryList(1));
58
-    if(isset($_REQUEST['country']) && $_REQUEST['country']) {
58
+    if (isset($_REQUEST['country']) && $_REQUEST['country']) {
59 59
        $c = strtoupper($_REQUEST['country']);
60 60
     } else {
61 61
        $L = $this->locateUser();
62
-       if( $L['status'] == 'ok' ) {
62
+       if ($L['status'] == 'ok') {
63 63
          $c = strtoupper($L['country']);
64 64
        } else {
65 65
          debug(2, "No coutry provided and unable to locate the address\n");
66
-         $c='NONE';
66
+         $c = 'NONE';
67 67
        }
68 68
     }
69
-    if(!in_array($c,$F))
70
-      $c= array_shift($F);
69
+    if (!in_array($c, $F))
70
+      $c = array_shift($F);
71 71
     $this->Country = new Federation($c);
72 72
     $this->Args['country'] = $this->Country->identifier;
73
-    $this->page =  1;
73
+    $this->page = 1;
74 74
 
75 75
 // If we have IdP identifier then match country to this identifier
76 76
 // if the request contians a country code and an IdP code that do nat match
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
 // If we have Profile identifier then test if we also have IdP identifier, if we do
79 79
 // and they do not match then drop the profile code and just leave the IdP
80 80
 
81
-    if(isset($_REQUEST['idp']) && $_REQUEST['idp']) {
82
-       $this->page =  2;
81
+    if (isset($_REQUEST['idp']) && $_REQUEST['idp']) {
82
+       $this->page = 2;
83 83
        try {
84 84
          $this->Idp = new IdP($_REQUEST['idp']);
85 85
        }
86 86
        catch (Exception $fail) {
87
-         $this->page =  1;
87
+         $this->page = 1;
88 88
          $this->set_locale("web_user");
89 89
          return;
90 90
        }
91 91
        $country_tmp = new Federation($this->Idp->federation);
92
-       if(strtoupper($this->Country->identifier) !== strtoupper($country_tmp->identifier)) {
92
+       if (strtoupper($this->Country->identifier) !== strtoupper($country_tmp->identifier)) {
93 93
          unset($this->Idp);
94 94
          $this->page = 1;
95 95
          $this->set_locale("web_user");
@@ -97,27 +97,27 @@  discard block
 block discarded – undo
97 97
        } 
98 98
        $this->Args['idp'] = $_REQUEST['idp'];
99 99
        $this->profile_count = $this->Idp->profileCount();
100
-       if(!isset($_REQUEST['profile'])) {
100
+       if (!isset($_REQUEST['profile'])) {
101 101
          $this->set_locale("web_user");
102 102
          return;
103 103
        }
104
-       $this->page =  3;
104
+       $this->page = 3;
105 105
        try {
106 106
          $this->Profile = new Profile($_REQUEST['profile']);
107 107
        }
108 108
        catch (Exception $fail) {
109
-         $this->page =  2;
109
+         $this->page = 2;
110 110
          $this->set_locale("web_user");
111 111
          return;
112 112
        }
113
-       if($this->Profile->institution != $this->Idp->identifier)  {
113
+       if ($this->Profile->institution != $this->Idp->identifier) {
114 114
           unset($this->Profile);
115 115
           $this->page = 2;
116 116
           $this->set_locale("web_user");
117 117
           return;
118 118
        }
119 119
        $this->Args['profile'] = $_REQUEST['profile'];
120
-       if(isset($_REQUEST['device'])) {
120
+       if (isset($_REQUEST['device'])) {
121 121
              $this->Args['device'] = $_REQUEST['device'];
122 122
        }
123 123
 
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 public function listCountries() {
131 131
    $out = '';
132 132
    $FED = $this->printCountryList(1);
133
-   $out .= _('Select your country').'<br>';
134
-   $out .= '<select name="country" onchange="submit_form(this)">'."\n";
133
+   $out .= _('Select your country') . '<br>';
134
+   $out .= '<select name="country" onchange="submit_form(this)">' . "\n";
135 135
    foreach ($FED as $f => $F) {
136
-     $out .= '<option value="'.$f.'"';
137
-     if($f === $this->Country->identifier)
136
+     $out .= '<option value="' . $f . '"';
137
+     if ($f === $this->Country->identifier)
138 138
          $out .= ' selected';
139
-     $out .= '>'.$F.'</option>'."\n";
139
+     $out .= '>' . $F . '</option>' . "\n";
140 140
    }
141 141
    $out .= '</select>';
142 142
    return $out;
@@ -144,17 +144,17 @@  discard block
 block discarded – undo
144 144
 
145 145
 public function listIdPs() {
146 146
    $Inst = $this->orderIdentityProviders($this->Country->identifier);
147
-   if(! isset($this->Idp))
148
-     $this->Idp = new Idp ($Inst[0]['idp']);
147
+   if (!isset($this->Idp))
148
+     $this->Idp = new Idp($Inst[0]['idp']);
149 149
    $i_id = $this->Idp->identifier;
150 150
    $out = '';
151 151
    $out .= _("Select your institution");
152 152
    $out .= '<select name="idp" onchange="submit_form(this)">';
153 153
    foreach ($Inst as $I) {
154
-      $out .= '<option value="'.$I['idp'].'"';
155
-      if($I['idp'] == $i_id)
154
+      $out .= '<option value="' . $I['idp'] . '"';
155
+      if ($I['idp'] == $i_id)
156 156
          $out .= ' selected';
157
-      $out .= '>'.$I['title'].'</option>';
157
+      $out .= '>' . $I['title'] . '</option>';
158 158
    }
159 159
    $out .= '</select>'; 
160 160
    return $out;
@@ -162,19 +162,19 @@  discard block
 block discarded – undo
162 162
 
163 163
 public function listProfiles() {
164 164
    $Prof = $this->Idp->listProfiles(1);
165
-   if(! isset($this->Profile))
165
+   if (!isset($this->Profile))
166 166
      $this->Profile = $Prof[0];
167 167
    $p_id = $this->Profile->identifier;
168 168
    $this->Args['profile'] = $p_id;
169 169
    $out = '';
170 170
    if (count($Prof) > 1) {
171
-     $out .=  _("Select the user group").'<br>';
171
+     $out .= _("Select the user group") . '<br>';
172 172
      $out .= '<select name="profile" onchange="submit_form(this)">';
173 173
      foreach ($Prof as $P) {
174
-       $out .= '<option value="'.$P->identifier.'"';
175
-       if($P->identifier == $p_id)
174
+       $out .= '<option value="' . $P->identifier . '"';
175
+       if ($P->identifier == $p_id)
176 176
          $out .= ' selected';
177
-       $out .= '>'.$P->name.'</option>';
177
+       $out .= '>' . $P->name . '</option>';
178 178
      }
179 179
      $out .= '</select>';
180 180
    } else {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
 
188 188
 public function listDevices() {
189
-   if(! isset($this->Profile))
189
+   if (!isset($this->Profile))
190 190
       return '';
191 191
    $OS = $this->detectOS();
192 192
    $os = $OS['device'];
@@ -195,55 +195,55 @@  discard block
 block discarded – undo
195 195
    $redirect_target = '';
196 196
    $device_redirects = '';
197 197
    $selected_os = 0;
198
-   $unsupported_message = '<div id="unsupported_os">'._("Your operating system was not properly detected, is not supported yet or cannot be configured with settings provided by your institution")."</div><br>";
198
+   $unsupported_message = '<div id="unsupported_os">' . _("Your operating system was not properly detected, is not supported yet or cannot be configured with settings provided by your institution") . "</div><br>";
199 199
    
200 200
    $a = $this->profileAttributes($this->Profile->identifier);
201 201
    $thedevices = $a['devices'];
202 202
    $message = '';
203
-   if(! $os)
203
+   if (!$os)
204 204
      $message = $unsupported_message;
205
-   $out = _("Choose an installer to download").'<br>';
205
+   $out = _("Choose an installer to download") . '<br>';
206 206
    $out .= '<select name="device" onchange="set_device(this)">';
207
-   $i= 0;
207
+   $i = 0;
208 208
    foreach ($thedevices as $D) {
209
-      if((isset($D['options']) && isset($D['options']['hidden']) &&  $D['options']['hidden']) || $D['status'] )
209
+      if ((isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden']) || $D['status'])
210 210
          continue; 
211
-      if(! $os)
211
+      if (!$os)
212 212
          $os = $D['id'];
213 213
       $disp = $D['display'];
214
-      if($D['id'] === '0') {
214
+      if ($D['id'] === '0') {
215 215
         $profile_redirect = 1;
216 216
         $redirect_target = $D['redirect'];
217 217
       }
218
-      $out .= '<option value="'.$D['id'].'"';
219
-      if($D['id'] == $os) {
218
+      $out .= '<option value="' . $D['id'] . '"';
219
+      if ($D['id'] == $os) {
220 220
         $out .= ' selected';
221 221
         $selected_os = 1;
222
-        if($D['redirect']) {
222
+        if ($D['redirect']) {
223 223
            $redirect_target = $D['redirect'];
224 224
         }
225 225
       }
226
-      $out .= '>'.$disp.'</option>';
227
-      $device_redirects .= 'redirects['.$i.'] = '.( $D['redirect'] ? 1 : 0 ).';';
226
+      $out .= '>' . $disp . '</option>';
227
+      $device_redirects .= 'redirects[' . $i . '] = ' . ($D['redirect'] ? 1 : 0) . ';';
228 228
       $i++;
229 229
    }
230 230
    $out .= '</select>';
231
-   if( $selected_os == 0)
231
+   if ($selected_os == 0)
232 232
       $message = $unsupported_message;
233 233
    $out = $message . $out;
234
-   if($profile_redirect)
234
+   if ($profile_redirect)
235 235
       $out = '';
236
-   if($redirect_target) {
236
+   if ($redirect_target) {
237 237
       $device_redirects .= 'is_redirected = 1;';
238
-      $out .= _("Your local administrator has specified a redirect to a local support page.").'<br>'. _("When you click <b>CONTINUE</b> this support page will be opened.");
239
-      $action = 'window.location.href=\''.$redirect_target.'\'; return(false);';
240
-   $out .= "<p><button id='devices' name='devices' style='width:100%;' onclick=\"".$action.'">'._("CONTINUE to local support page")."</button>";
238
+      $out .= _("Your local administrator has specified a redirect to a local support page.") . '<br>' . _("When you click <b>CONTINUE</b> this support page will be opened.");
239
+      $action = 'window.location.href=\'' . $redirect_target . '\'; return(false);';
240
+   $out .= "<p><button id='devices' name='devices' style='width:100%;' onclick=\"" . $action . '">' . _("CONTINUE to local support page") . "</button>";
241 241
    } else {
242 242
       $device_redirects .= 'is_redirected = 0;';
243 243
       $action = 'submit_form(this)';
244
-   $out .= "<p><button id='devices' name='devices' style='width:100%;' onclick=\"".$action.'">'._("Do you have an account at this institution?").'<br>'._("If so and if the other settings above are OK then click here to download...")."</button>";
244
+   $out .= "<p><button id='devices' name='devices' style='width:100%;' onclick=\"" . $action . '">' . _("Do you have an account at this institution?") . '<br>' . _("If so and if the other settings above are OK then click here to download...") . "</button>";
245 245
    }
246
-   $out .= '<script type="text/javascript">'.$device_redirects.'</script>';
246
+   $out .= '<script type="text/javascript">' . $device_redirects . '</script>';
247 247
    return $out;
248 248
 }
249 249
 
@@ -253,15 +253,15 @@  discard block
 block discarded – undo
253 253
    $thedevices = $a['devices'];
254 254
    $this->set_locale("web_user");
255 255
    $out = '';
256
-   if(isset($a['description']) && $a['description'])
257
-     print '<div>'.$a['description'] . '</div>';
256
+   if (isset($a['description']) && $a['description'])
257
+     print '<div>' . $a['description'] . '</div>';
258 258
    if (isset($a['local_email']) && $a['local_email'])
259 259
      $out .= '<p>Email: <a href="mailto:' . $a['local_email'] . '">' . $a['local_email'] . '</a>';
260 260
    if (isset($a['local_url']) && $a['local_url'])
261 261
      $out .= '<p>WWW: <a href="' . $a['local_url'] . '">' . $a['local_url'] . '</a>';
262 262
    if (isset($a['local_phone']) && $a['local_phone'])
263 263
      $out .= '<p>Tel: <a href="' . $a['local_phone'] . '">' . $a['local_phone'] . '</a>';
264
-   if( $out !== '') {
264
+   if ($out !== '') {
265 265
      print '<div class="user_info">';
266 266
      print _("If you encounter problems you should ask for help at your home institution");
267 267
      print $out;
@@ -269,15 +269,15 @@  discard block
 block discarded – undo
269 269
    }
270 270
                    
271 271
    foreach ($thedevices as $D) {
272
-      if(isset($D['options']) && isset($D['options']['hidden']) &&  $D['options']['hidden'])
272
+      if (isset($D['options']) && isset($D['options']['hidden']) && $D['options']['hidden'])
273 273
           continue; 
274 274
       $disp = $D['display'];
275
-      if($D['id'] === '0') {
276
-          print _("Your local administrator has specified a redirect to a local support page.").' '. _("Click on the link below to continue.");
277
-          print '<div style="width:100%; text-align:center"><a href ="'.$D['redirect'].'">'.$D['redirect'].'</a></div>';
275
+      if ($D['id'] === '0') {
276
+          print _("Your local administrator has specified a redirect to a local support page.") . ' ' . _("Click on the link below to continue.");
277
+          print '<div style="width:100%; text-align:center"><a href ="' . $D['redirect'] . '">' . $D['redirect'] . '</a></div>';
278 278
           exit;
279 279
       }
280
-      if($D['id'] === $this->Args['device']) 
280
+      if ($D['id'] === $this->Args['device']) 
281 281
           break;
282 282
    }
283 283
    $this->set_locale("web_user");
@@ -288,27 +288,27 @@  discard block
 block discarded – undo
288 288
       return;
289 289
    }
290 290
    $extra_text = '';
291
-   if(isset($D['message']) && $D['message']) 
291
+   if (isset($D['message']) && $D['message']) 
292 292
       $extra_text = $D['message']; 
293
-   if(isset($D['device_customtext']) && $D['device_customtext']) {
294
-      if($extra_text)
293
+   if (isset($D['device_customtext']) && $D['device_customtext']) {
294
+      if ($extra_text)
295 295
            $extra_text .= '<p>';
296 296
       $extra_text = $D['device_customtext']; 
297 297
     }
298
-   if(isset($D['eap_customtext']) && $D['eap_customtext']) {
299
-      if($extra_text)
298
+   if (isset($D['eap_customtext']) && $D['eap_customtext']) {
299
+      if ($extra_text)
300 300
           $extra_text .= '<p>';
301 301
       $extra_text .= $D['eap_customtext']; 
302 302
     }
303
-   if($extra_text)
303
+   if ($extra_text)
304 304
       $extra_text .= '<p>';
305 305
       print $extra_text;
306 306
 
307
-      $download_link = 'user/API.php?action=downloadInstaller&api_version=2&generatedfor=user&lang='.CAT::get_lang().'&device='.$o['device'].'&profile='.$o['profile'];
307
+      $download_link = 'user/API.php?action=downloadInstaller&api_version=2&generatedfor=user&lang=' . CAT::get_lang() . '&device=' . $o['device'] . '&profile=' . $o['profile'];
308 308
 
309
-      print '<p><button id="download_button" onclick="window.location.href=\'' . rtrim(dirname($_SERVER['SCRIPT_NAME']),'/'). '/' . $download_link . '\'; return(false)"><div>' . _("Download installer for") . '<br><span style="color:yellow; font-weight: bold">' . $D['display']. '</span></div></button>';
309
+      print '<p><button id="download_button" onclick="window.location.href=\'' . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/') . '/' . $download_link . '\'; return(false)"><div>' . _("Download installer for") . '<br><span style="color:yellow; font-weight: bold">' . $D['display'] . '</span></div></button>';
310 310
 
311
-      print '<p><button id="start_over" name="start_over" onclick="submit_form(this)">'._("Start over").'</button>';
311
+      print '<p><button id="start_over" name="start_over" onclick="submit_form(this)">' . _("Start over") . '</button>';
312 312
    print $this->passArgument('country');
313 313
    print $this->passArgument('idp');
314 314
    print $this->passArgument('profile');
@@ -318,13 +318,13 @@  discard block
 block discarded – undo
318 318
 
319 319
 
320 320
 public function langSelection() {
321
-   $out = _("View this page in")." ";
321
+   $out = _("View this page in") . " ";
322 322
    $out .= '<select onchange="submit_form(this)" name="lang">';
323 323
    foreach (Config::$LANGUAGES as $lng => $value) {
324
-       $out .= '<option value="'.$lng.'"';
324
+       $out .= '<option value="' . $lng . '"';
325 325
        if ($lng === CAT::get_lang())
326 326
           $out .= ' selected';
327
-       $out .= '>'. $value['display'] . '</option>';
327
+       $out .= '>' . $value['display'] . '</option>';
328 328
    }
329 329
    $out .= '</select>';
330 330
    return $out;
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
   $out = '';
339 339
    $c = strtoupper($this->Country->identifier);
340 340
    $name = isset(Federation::$FederationList[$c]) ? Federation::$FederationList[$c] : $c;
341
-   $name = preg_replace('/ +/','&nbsp;',$name);
341
+   $name = preg_replace('/ +/', '&nbsp;', $name);
342 342
    $out .= "$name; ";
343 343
    $name = $this->Idp->name;
344
-   $name = preg_replace('/ +/','&nbsp;',$name);
344
+   $name = preg_replace('/ +/', '&nbsp;', $name);
345 345
    $out .= "$name";
346
-   if($this->profile_count > 1) {
347
-     $name = '; '.$this->Profile->name;
348
-     $name = preg_replace('/ +/','&nbsp;',$name);
346
+   if ($this->profile_count > 1) {
347
+     $name = '; ' . $this->Profile->name;
348
+     $name = preg_replace('/ +/', '&nbsp;', $name);
349 349
      $out .= "$name";
350 350
    }
351 351
   return $out;
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
   */
360 360
 
361 361
 public function passArgument($arg_name) {
362
-   return '<input type="hidden" name="'.$arg_name.'" value="'.$this->Args[$arg_name].'">';
362
+   return '<input type="hidden" name="' . $arg_name . '" value="' . $this->Args[$arg_name] . '">';
363 363
 }
364 364
 
365 365
 public $Country;
@@ -372,13 +372,13 @@  discard block
 block discarded – undo
372 372
 
373 373
 $Gui = new SimpleGUI();
374 374
 
375
-debug(4,"\n----------------------------------SIMPLE.PHP------------------------\n");
375
+debug(4, "\n----------------------------------SIMPLE.PHP------------------------\n");
376 376
 ?>
377 377
 <!DOCTYPE html>
378 378
 <html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo CAT::get_lang()?>">
379 379
     <head lang="<?php echo CAT::get_lang()?>"> 
380
-        <title><?php echo Config::$APPEARANCE['productname_long'];?></title>
381
-<link href="<?php echo rtrim(dirname($_SERVER['SCRIPT_NAME']),'/') ?>/resources/css/cat-basic.css.php" type= "text/css" rel="stylesheet" />
380
+        <title><?php echo Config::$APPEARANCE['productname_long']; ?></title>
381
+<link href="<?php echo rtrim(dirname($_SERVER['SCRIPT_NAME']), '/') ?>/resources/css/cat-basic.css.php" type= "text/css" rel="stylesheet" />
382 382
         <meta charset="utf-8" /> 
383 383
     <script type="text/javascript">
384 384
     var redirects = new Array();
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
     </head>
408 408
     <body style="">
409 409
 
410
-<?php debug(4,"SERVER\n"); debug(4,$_SERVER) ?>
411
-<?php    print '<div id="motd">'.( isset(Config::$APPEARANCE['MOTD']) ? Config::$APPEARANCE['MOTD'] : '&nbsp' ).'</div>'; ?>
410
+<?php debug(4, "SERVER\n"); debug(4, $_SERVER) ?>
411
+<?php    print '<div id="motd">' . (isset(Config::$APPEARANCE['MOTD']) ? Config::$APPEARANCE['MOTD'] : '&nbsp') . '</div>'; ?>
412 412
 <form name="my_form" method="POST" action="<?php echo $_SERVER['SCRIPT_NAME']?>" accept-charset='UTF-8'>
413 413
         <img src="<?php echo rtrim(dirname($_SERVER['SCRIPT_NAME']), '/') ?>/resources/images/consortium_logo.png" style="width: 20%; padding-right:20px; padding-top:0px; float:right" alt="logo" />
414 414
          <?php
@@ -420,22 +420,22 @@  discard block
 block discarded – undo
420 420
 */
421 421
         print '<h1><a href="' . $_SERVER['SCRIPT_NAME'] . '?lang=' . CAT::get_lang() . '">' . Config::$APPEARANCE['productname'] . '</a></h1>';
422 422
         print $Gui->langSelection();
423
-        if(! isset($_REQUEST['devices_h']) || $_REQUEST['devices_h'] == 0 || isset($_REQUEST['start_over'])) {
423
+        if (!isset($_REQUEST['devices_h']) || $_REQUEST['devices_h'] == 0 || isset($_REQUEST['start_over'])) {
424 424
         print "<p>\n";
425 425
           print $Gui->listCountries();
426
-          if($Gui->page == 2 && ! isset($FED[strtoupper($Gui->Country->identifier)]))
426
+          if ($Gui->page == 2 && !isset($FED[strtoupper($Gui->Country->identifier)]))
427 427
              $Gui->page = 1;
428
-          print "<p>".$Gui->listIdPs();
429
-          print "<p>".$Gui->listProfiles();
430
-          print "<p>".$Gui->listDevices();
428
+          print "<p>" . $Gui->listIdPs();
429
+          print "<p>" . $Gui->listProfiles();
430
+          print "<p>" . $Gui->listDevices();
431 431
           print '<input type="hidden" name="devices_h" id="devices_h" value="0">';
432 432
 
433 433
         } else {
434
-          if($Gui->page != 3) {
434
+          if ($Gui->page != 3) {
435 435
              print "Arguments missmatch error.";
436 436
              exit;
437 437
           }
438
-        print '<div id="user_choice">'.$Gui->yourChoice().'</div><p>';
438
+        print '<div id="user_choice">' . $Gui->yourChoice() . '</div><p>';
439 439
           $Gui->displayDeviceDownload();
440 440
         print '<input type="hidden" name="devices_h" id="devices_h" value="1">';
441 441
         }
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
         </form>
445 445
         <div class='footer'><hr />
446 446
 <?php
447
-print('<a href="tou.php">'._("Terms of use")."</a><p>");
448
-echo Config::$APPEARANCE['productname']." - " . CAT::$VERSION;
449
-echo " &copy; 2011-15 G&Eacute;ANT on behalf of the GN3, GN3plus, GN4 consortia and others <a href='copyright.php'>Full Copyright and Licenses</a></div>";?>
447
+print('<a href="tou.php">' . _("Terms of use") . "</a><p>");
448
+echo Config::$APPEARANCE['productname'] . " - " . CAT::$VERSION;
449
+echo " &copy; 2011-15 G&Eacute;ANT on behalf of the GN3, GN3plus, GN4 consortia and others <a href='copyright.php'>Full Copyright and Licenses</a></div>"; ?>
450 450
 </body>
451 451
 </html>
Please login to merge, or discard this patch.
utils/notify_invitation_expiry.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
             $mailtext .= "$instname\n";
50 50
 
51 51
         if ($numberofexistingidps > 0)
52
-            $mailtext .="
52
+            $mailtext .= "
53 53
 
54 54
 Additionally, $numberofexistingidps invitations for existing institutions have expired.
55 55
 ";
Please login to merge, or discard this patch.
core/Federation.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         
75 75
         $retstring = "";
76 76
         if (!$astablerows)
77
-            $retstring .= "<federation id='" . ( $federationid == NULL ? "ALL" : $federationid ) . "' ts='$timestamp'>\n";
77
+            $retstring .= "<federation id='" . ($federationid == NULL ? "ALL" : $federationid) . "' ts='$timestamp'>\n";
78 78
 
79 79
         foreach (Devices::listDevices() as $index => $device_array) {
80 80
             $query = "SELECT SUM(downloads_admin) AS admin, SUM(downloads_user) AS user FROM downloads, profile, institution WHERE device_id = '$index' AND downloads.profile_id = profile.profile_id AND profile.inst_id = institution.inst_id ";
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
                 if ($astablerows)
88 88
                     $retstring .= "<td>" . $device_array['display'] . "</td>";
89 89
                 $retstring .= ($astablerows ? "<td>" : "    <downloads group='admin'>");
90
-                $retstring .= ( $a->admin === NULL ? "0" : $a->admin);
90
+                $retstring .= ($a->admin === NULL ? "0" : $a->admin);
91 91
                 $retstring .= ($astablerows ? "</td><td>" : "</downloads>\n    <downloads group='user'>");
92
-                $retstring .= ( $a->user === NULL ? "0" : $a->user);
92
+                $retstring .= ($a->user === NULL ? "0" : $a->user);
93 93
                 $retstring .= ($astablerows ? "</td>" : "</downloads>\n");
94 94
                 $gross_admin = $gross_admin + $a->admin;
95 95
                 $gross_user = $gross_user + $a->user;
Please login to merge, or discard this patch.
core/UserManagement.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 %s"), $bestnameguess, Config::$CONSORTIUM['name'], strtoupper($fed->identifier), Config::$APPEARANCE['productname'], Config::$APPEARANCE['productname_long']);
159 159
                     $retval = $user->sendMailToUser(_("IdP in your federation was created"), $message);
160 160
                     if ($retval == FALSE)
161
-                        debug (2, "Mail to federation admin was NOT sent!\n");
161
+                        debug(2, "Mail to federation admin was NOT sent!\n");
162 162
                 }
163 163
 
164 164
                 return $idp;
@@ -226,14 +226,14 @@  discard block
 block discarded – undo
226 226
             return $token;
227 227
         } else if (func_num_args() == 4) { // string name, but no country - new IdP with link to external DB
228 228
             // what country are we talking about?
229
-            $newname = DBConnection::escape_value(UserManagement::$DB_TYPE,valid_string_db($inst_identifier));
229
+            $newname = DBConnection::escape_value(UserManagement::$DB_TYPE, valid_string_db($inst_identifier));
230 230
             $extinfo = Federation::getExternalDBEntityDetails($external_id);
231
-            $externalhandle = DBConnection::escape_value(UserManagement::$DB_TYPE,valid_string_db($external_id));
231
+            $externalhandle = DBConnection::escape_value(UserManagement::$DB_TYPE, valid_string_db($external_id));
232 232
             DBConnection::exec(UserManagement::$DB_TYPE, "INSERT INTO invitations (invite_issuer_level, invite_dest_mail, invite_token,name,country, external_db_uniquehandle) VALUES('$level', '$for', '$token', '" . $newname . "', '" . $extinfo['country'] . "',  '" . $externalhandle . "')");
233 233
             return $token;
234 234
         } else if (func_num_args() == 5) { // string name, and country set - whole new IdP
235
-            $newname = DBConnection::escape_value(UserManagement::$DB_TYPE,valid_string_db($inst_identifier));
236
-            $newcountry = DBConnection::escape_value(UserManagement::$DB_TYPE,valid_string_db($country));
235
+            $newname = DBConnection::escape_value(UserManagement::$DB_TYPE, valid_string_db($inst_identifier));
236
+            $newcountry = DBConnection::escape_value(UserManagement::$DB_TYPE, valid_string_db($country));
237 237
             DBConnection::exec(UserManagement::$DB_TYPE, "INSERT INTO invitations (invite_issuer_level, invite_dest_mail, invite_token,name,country) VALUES('$level', '$for', '$token', '" . $newname . "', '" . $newcountry . "')");
238 238
             return $token;
239 239
         } else {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         $retval = [];
253 253
         $invitations = DBConnection::exec(UserManagement::$DB_TYPE, "SELECT cat_institution_id, country, name, invite_issuer_level, invite_dest_mail, invite_token 
254 254
                                         FROM invitations 
255
-                                        WHERE cat_institution_id " . ( $idp_identifier != 0 ? "= $idp_identifier" : "IS NULL") . " AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0");
255
+                                        WHERE cat_institution_id " . ($idp_identifier != 0 ? "= $idp_identifier" : "IS NULL") . " AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0");
256 256
         if ($idp_identifier != 0) { // list invitations for existing institution, must match cat_institution_id
257 257
             while ($a = mysqli_fetch_object($invitations)) {
258 258
                 debug(4, "Retrieving pending invitations for IdP $idp_identifier.\n");
Please login to merge, or discard this patch.
core/CAT.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 
74 74
 
75 75
         if (CAT::$RELEASE_VERSION) {
76
-            $temp_version = "CAT-".CAT::$VERSION_MAJOR.".".CAT::$VERSION_MINOR;
76
+            $temp_version = "CAT-" . CAT::$VERSION_MAJOR . "." . CAT::$VERSION_MINOR;
77 77
             if (CAT::$VERSION_PATCH != 0)
78
-                    $temp_version .= ".".CAT::$VERSION_PATCH;
78
+                    $temp_version .= "." . CAT::$VERSION_PATCH;
79 79
             if (CAT::$VERSION_EXTRA != "")
80
-                $temp_version .= "-".CAT::$VERSION_EXTRA;
81
-            CAT::$VERSION = sprintf(_("Release %s"), $temp_version );
80
+                $temp_version .= "-" . CAT::$VERSION_EXTRA;
81
+            CAT::$VERSION = sprintf(_("Release %s"), $temp_version);
82 82
         }
83 83
         else
84 84
             CAT::$VERSION = _("Unreleased SVN Revision");
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * gets the language setting in CAT
192 192
      */
193 193
     static public function get_lang() {
194
-       if(self::$LANG === '')
194
+       if (self::$LANG === '')
195 195
          list(self::$LANG, $xx) = self::set_lang();
196 196
        return self::$LANG;
197 197
     }
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
             case "MOD": // modified existing object
240 240
             case "DEL": // deleted an object
241 241
                 ob_start();
242
-                printf("%-015s",microtime(TRUE));
242
+                printf("%-015s", microtime(TRUE));
243 243
                 print " ($category) ";
244
-                print_r(" ".$user.": ".$message."\n");
244
+                print_r(" " . $user . ": " . $message . "\n");
245 245
                 $output = ob_get_clean();
246 246
                 if (Config::$PATHS['logdir']) {
247 247
                     $f = fopen(Config::$PATHS['logdir'] . "/audit-activity.log", "a");
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
         $logtext1 = preg_replace("/[\n\r]/", "", $query);
269 269
         $logtext = preg_replace("/ +/", " ", $logtext1);
270 270
         ob_start();
271
-        printf("%-015s",microtime(TRUE));
272
-        print(" ".$logtext."\n");
271
+        printf("%-015s", microtime(TRUE));
272
+        print(" " . $logtext . "\n");
273 273
         $output = ob_get_clean();
274 274
         if (Config::$PATHS['logdir']) {
275 275
             $f = fopen(Config::$PATHS['logdir'] . "/audit-SQL.log", "a");
Please login to merge, or discard this patch.
core/SanityTests.php 1 patch
Spacing   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
      * @param string $test the test name
76 76
      */
77 77
     public function test($test) {
78
-       $this->out[$test] =[];
78
+       $this->out[$test] = [];
79 79
        $this->name = $test;
80
-       $m_name = $test.'_test';
80
+       $m_name = $test . '_test';
81 81
        $this->test_result[$test] = 0;
82
-       if(! method_exists($this,$m_name)) {
83
-           $this->test_return($test,L_ERROR,"Configuration error, no test configured for <strong>$test</strong>.");
82
+       if (!method_exists($this, $m_name)) {
83
+           $this->test_return($test, L_ERROR, "Configuration error, no test configured for <strong>$test</strong>.");
84 84
            return;
85 85
        }
86 86
        $this->$m_name();
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function run_tests($Tests) {
99 99
        foreach ($Tests as $t) {
100
-         if(preg_match('/(.+)=>(.+)/',$t,$m)) {
100
+         if (preg_match('/(.+)=>(.+)/', $t, $m)) {
101 101
             $tst = $m[1];
102
-            $subtst=$m[2];
103
-            if($this->test_result[$tst]  < L_ERROR)
102
+            $subtst = $m[2];
103
+            if ($this->test_result[$tst] < L_ERROR)
104 104
                $this->test($subtst);
105 105
          }
106 106
          else
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
     public function get_test_names() {
112 112
        $T = get_class_methods($this);
113 113
        $out = [];
114
-       foreach($T as $t) {
115
-         if(preg_match('/^(.*)_test$/',$t,$m)) {
114
+       foreach ($T as $t) {
115
+         if (preg_match('/^(.*)_test$/', $t, $m)) {
116 116
             $out[] = $m[1];
117 117
          } 
118 118
        }
@@ -132,17 +132,17 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public $test_result;
134 134
 
135
-    private function test_return($level,$message) {
135
+    private function test_return($level, $message) {
136 136
         $this->out[$this->name][] = ['level'=>$level, 'message'=>$message];
137
-        $this->test_result[$this->name] = max($this->test_result[$this->name],$level);
138
-        $this->test_result['global'] = max($this->test_result['global'],$level);
137
+        $this->test_result[$this->name] = max($this->test_result[$this->name], $level);
138
+        $this->test_result['global'] = max($this->test_result['global'], $level);
139 139
     }
140 140
 
141 141
     private function get_exec_path($s) {
142 142
         $the_path = "";
143 143
         $exec_is = "UNDEFINED";
144 144
         if (!empty(Config::$PATHS[$s])) {
145
-             preg_match('/([^ ]+) ?/',Config::$PATHS[$s],$m);
145
+             preg_match('/([^ ]+) ?/', Config::$PATHS[$s], $m);
146 146
              $exe = $m[1];
147 147
              $the_path = exec("which " . Config::$PATHS[$s]);
148 148
              if ($the_path == $exe)
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
              else
151 151
                  $exec_is = "IMPLICIT";
152 152
          } 
153
-        return(['exec'=>$the_path,'exec_is'=>$exec_is]);
153
+        return(['exec'=>$the_path, 'exec_is'=>$exec_is]);
154 154
     }
155 155
 
156 156
     /**
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
       */
159 159
     private function php_test() {
160 160
          if (version_compare(phpversion(), $this->php_needversion, '>='))
161
-            $this->test_return(L_OK,"<strong>PHP</strong> is sufficiently recent. You are running " . phpversion() . ".");
161
+            $this->test_return(L_OK, "<strong>PHP</strong> is sufficiently recent. You are running " . phpversion() . ".");
162 162
          else
163
-            $this->test_return(L_ERROR,"<strong>PHP</strong> is too old. We need at least $this->php_needversion, but you only have ".phpversion(). ".");
163
+            $this->test_return(L_ERROR, "<strong>PHP</strong> is too old. We need at least $this->php_needversion, but you only have " . phpversion() . ".");
164 164
     }
165 165
 
166 166
     /**
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
       */
169 169
     private function ssp_test() {
170 170
          if (!is_file(CONFIG::$AUTHENTICATION['ssp-path-to-autoloader']))
171
-             $this->test_return(L_ERROR,"<strong>simpleSAMLphp</strong> not found!");
171
+             $this->test_return(L_ERROR, "<strong>simpleSAMLphp</strong> not found!");
172 172
          else
173
-             $this->test_return(L_OK,"<strong>simpleSAMLphp</strong> autoloader found.");
173
+             $this->test_return(L_OK, "<strong>simpleSAMLphp</strong> autoloader found.");
174 174
     }
175 175
 
176 176
     /**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
       */
179 179
     private function security_test() {
180 180
          if (in_array("I do not care about security!", Config::$SUPERADMINS))
181
-             $this->test_return(L_WARN,"You do not care about security. This page should be made accessible to the CAT admin only! See config.php 'Superadmins'!");
181
+             $this->test_return(L_WARN, "You do not care about security. This page should be made accessible to the CAT admin only! See config.php 'Superadmins'!");
182 182
     }
183 183
 
184 184
     /**
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
       */
187 187
     private function zip_test() {
188 188
          if (exec("which zip") != "")
189
-             $this->test_return(L_OK,"<strong>zip</strong> binary found.");
189
+             $this->test_return(L_OK, "<strong>zip</strong> binary found.");
190 190
          else
191
-             $this->test_return(L_ERROR,"<strong>zip</strong> not found in your \$PATH!");
191
+             $this->test_return(L_ERROR, "<strong>zip</strong> not found in your \$PATH!");
192 192
     }
193 193
 
194 194
     /**
@@ -196,15 +196,15 @@  discard block
 block discarded – undo
196 196
       */
197 197
     private function eapol_test_test() {
198 198
          exec(Config::$PATHS['eapol_test'], $out, $retval);
199
-         if($retval == 255 ) {
200
-            $o = preg_grep('/-o<server cert/',$out);
201
-               if(count($o) > 0)
202
-                   $this->test_return(L_OK,"<strong>eapol_test</strong> script found.");
199
+         if ($retval == 255) {
200
+            $o = preg_grep('/-o<server cert/', $out);
201
+               if (count($o) > 0)
202
+                   $this->test_return(L_OK, "<strong>eapol_test</strong> script found.");
203 203
                else
204
-                   $this->test_return(L_ERROR,"<strong>eapol_test</strong> found, but is too old!");
204
+                   $this->test_return(L_ERROR, "<strong>eapol_test</strong> found, but is too old!");
205 205
          }
206 206
          else
207
-            $this->test_return(L_ERROR,"<strong>eapol_test</strong> not found!");
207
+            $this->test_return(L_ERROR, "<strong>eapol_test</strong> not found!");
208 208
     }
209 209
 
210 210
     /**
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
       */
213 213
     private function logdir_test() {
214 214
          if (fopen(Config::$PATHS['logdir'] . "/debug.log", "a") == FALSE)
215
-             $this->test_return(L_WARN,"Log files in <strong>" . Config::$PATHS['logdir'] . "</strong> are not writable!");
215
+             $this->test_return(L_WARN, "Log files in <strong>" . Config::$PATHS['logdir'] . "</strong> are not writable!");
216 216
          else
217
-             $this->test_return(L_OK,"Log directory is writable.");
217
+             $this->test_return(L_OK, "Log directory is writable.");
218 218
     }
219 219
 
220 220
     /**
@@ -222,34 +222,34 @@  discard block
 block discarded – undo
222 222
       */
223 223
     private function phpModules_test() {
224 224
         if (function_exists('idn_to_ascii'))
225
-            $this->test_return(L_OK,"PHP can handle internationalisation.");
225
+            $this->test_return(L_OK, "PHP can handle internationalisation.");
226 226
         else
227
-            $this->test_return(L_ERROR,"PHP can <strongNOT</strong> handle internationalisation (idn_to_ascii() from php5-intl).");
227
+            $this->test_return(L_ERROR, "PHP can <strongNOT</strong> handle internationalisation (idn_to_ascii() from php5-intl).");
228 228
 
229 229
         if (function_exists('gettext'))
230
-            $this->test_return(L_OK,"PHP extension <strong>GNU Gettext</strong> is installed.");
230
+            $this->test_return(L_OK, "PHP extension <strong>GNU Gettext</strong> is installed.");
231 231
         else
232
-           $this->test_return(L_ERROR,"PHP extension <strong>GNU Gettext</strong> not found!");
232
+           $this->test_return(L_ERROR, "PHP extension <strong>GNU Gettext</strong> not found!");
233 233
 
234 234
         if (function_exists('openssl_sign'))
235
-            $this->test_return(L_OK,"PHP extension <strong>OpenSSL</strong> is installed.");
235
+            $this->test_return(L_OK, "PHP extension <strong>OpenSSL</strong> is installed.");
236 236
         else
237
-            $this->test_return(L_ERROR,"PHP extension <strong>OpenSSL</strong> not found!");
237
+            $this->test_return(L_ERROR, "PHP extension <strong>OpenSSL</strong> not found!");
238 238
 
239 239
         if (class_exists('Imagick'))
240
-            $this->test_return(L_OK,"PHP extension <strong>Imagick</strong> is installed.");
240
+            $this->test_return(L_OK, "PHP extension <strong>Imagick</strong> is installed.");
241 241
         else
242
-            $this->test_return(L_ERROR,"PHP extension <strong>Imagick</strong> not found! Get it from your distribution or <a href='http://pecl.php.net/package/imagick'>here</a>.");
242
+            $this->test_return(L_ERROR, "PHP extension <strong>Imagick</strong> not found! Get it from your distribution or <a href='http://pecl.php.net/package/imagick'>here</a>.");
243 243
 
244 244
         if (function_exists('ImageCreate'))
245
-            $this->test_return(L_OK,"PHP extension <strong>GD</strong> is installed.");
245
+            $this->test_return(L_OK, "PHP extension <strong>GD</strong> is installed.");
246 246
         else
247
-            $this->test_return(L_ERROR,"PHP extension <strong>GD</strong> not found!</a>.");
247
+            $this->test_return(L_ERROR, "PHP extension <strong>GD</strong> not found!</a>.");
248 248
 
249 249
         if (function_exists('mysqli_connect'))
250
-            $this->test_return(L_OK,"PHP extension <strong>MySQL</strong> is installed.");
250
+            $this->test_return(L_OK, "PHP extension <strong>MySQL</strong> is installed.");
251 251
         else
252
-            $this->test_return(L_ERROR,"PHP extension <strong>MySQL</strong> not found!");
252
+            $this->test_return(L_ERROR, "PHP extension <strong>MySQL</strong> not found!");
253 253
 /*
254 254
         if (function_exists('geoip_record_by_name')) {
255 255
            $host = '158.75.1.10';
@@ -275,31 +275,31 @@  discard block
 block discarded – undo
275 275
        $host_6 = '2001:610:188:444::50';
276 276
        switch (Config::$GEOIP['version']) {
277 277
            case 0:
278
-              $this->test_return(L_REMARK,"As set in the config, no geolocation service will be used");
278
+              $this->test_return(L_REMARK, "As set in the config, no geolocation service will be used");
279 279
               break;
280 280
            case 1:
281 281
               if (!function_exists('geoip_record_by_name')) {
282
-                  $this->test_return(L_ERROR,"PHP extension <strong>GeoIP</strong> (legacy) not found! Get it from your distribution or <a href='http://pecl.php.net/package/geoip'>here</a> or better install GeoIP2 from <a href='https://github.com/maxmind/GeoIP2-php'>here</a>.");
282
+                  $this->test_return(L_ERROR, "PHP extension <strong>GeoIP</strong> (legacy) not found! Get it from your distribution or <a href='http://pecl.php.net/package/geoip'>here</a> or better install GeoIP2 from <a href='https://github.com/maxmind/GeoIP2-php'>here</a>.");
283 283
                   return;
284 284
               }
285 285
               $record = geoip_record_by_name($host_4);
286
-              if(! $record) {
287
-                 $this->test_return(L_ERROR,"PHP extension <strong>GeoIP</strong> (legacy) found but not working properly, perhaps you need to download the databases. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
286
+              if (!$record) {
287
+                 $this->test_return(L_ERROR, "PHP extension <strong>GeoIP</strong> (legacy) found but not working properly, perhaps you need to download the databases. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
288 288
                  return;
289 289
               }
290
-              if($record['city'] != 'Utrecht') {
291
-                 $this->test_return(L_ERROR,"PHP extension <strong>GeoIP</strong> (legacy) found but not working properly, perhaps you need to download the databases. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
290
+              if ($record['city'] != 'Utrecht') {
291
+                 $this->test_return(L_ERROR, "PHP extension <strong>GeoIP</strong> (legacy) found but not working properly, perhaps you need to download the databases. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
292 292
                  return;
293 293
               }
294
-              $this->test_return(L_REMARK,"PHP extension <strong>GeoIP</strong> (legacy) is installed and working. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly. We stronly advise to replace the legacy GeoIP with GeoIP2 from <a href='https://github.com/maxmind/GeoIP2-php'>here</a>.");
294
+              $this->test_return(L_REMARK, "PHP extension <strong>GeoIP</strong> (legacy) is installed and working. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly. We stronly advise to replace the legacy GeoIP with GeoIP2 from <a href='https://github.com/maxmind/GeoIP2-php'>here</a>.");
295 295
               break;
296 296
            case 2:
297
-              if(! is_file(Config::$GEOIP['geoip2-path-to-autoloader'])) {
298
-                 $this->test_return(L_ERROR,"PHP extension <strong>GeoIP2</strong> not found! Get it from <a href='https://github.com/maxmind/GeoIP2-php'>here</a>.");
297
+              if (!is_file(Config::$GEOIP['geoip2-path-to-autoloader'])) {
298
+                 $this->test_return(L_ERROR, "PHP extension <strong>GeoIP2</strong> not found! Get it from <a href='https://github.com/maxmind/GeoIP2-php'>here</a>.");
299 299
                  return;
300 300
               }
301
-              if(! is_file(Config::$GEOIP['geoip2-path-to-db'])) {
302
-                 $this->test_return(L_ERROR,"<strong>GeoIP2 database</strong> not found! See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
301
+              if (!is_file(Config::$GEOIP['geoip2-path-to-db'])) {
302
+                 $this->test_return(L_ERROR, "<strong>GeoIP2 database</strong> not found! See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
303 303
                  return;
304 304
               }
305 305
               require_once Config::$GEOIP['geoip2-path-to-autoloader'];
@@ -307,27 +307,27 @@  discard block
 block discarded – undo
307 307
               try {
308 308
                  $record = $reader->city($host_4);
309 309
               } catch (Exception $e) {
310
-                 $this->test_return(L_ERROR,"PHP extension <strong>GeoIP2</strong> found but not working properly, perhaps you need to download the databases. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
310
+                 $this->test_return(L_ERROR, "PHP extension <strong>GeoIP2</strong> found but not working properly, perhaps you need to download the databases. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
311 311
                  return;
312 312
               }
313
-              if( $record->city->name != 'Utrecht') {
314
-                 $this->test_return(L_ERROR,"PHP extension <strong>GeoIP2</strong> found but not working properly, perhaps you need to download the databases. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
313
+              if ($record->city->name != 'Utrecht') {
314
+                 $this->test_return(L_ERROR, "PHP extension <strong>GeoIP2</strong> found but not working properly, perhaps you need to download the databases. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
315 315
                  return;
316 316
               }
317 317
               try {
318 318
                  $record = $reader->city($host_6);
319 319
               } catch (Exception $e) {
320
-                 $this->test_return(L_ERROR,"PHP extension <strong>GeoIP2</strong> found but not working properly with IPv6, perhaps you need to download the databases. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
320
+                 $this->test_return(L_ERROR, "PHP extension <strong>GeoIP2</strong> found but not working properly with IPv6, perhaps you need to download the databases. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
321 321
                  return;
322 322
               }
323
-              if( $record->city->name != 'Utrecht') {
324
-                 $this->test_return(L_ERROR,"PHP extension <strong>GeoIP2</strong> found but not working properly with IPv6, perhaps you need to download the databases. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
323
+              if ($record->city->name != 'Utrecht') {
324
+                 $this->test_return(L_ERROR, "PHP extension <strong>GeoIP2</strong> found but not working properly with IPv6, perhaps you need to download the databases. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
325 325
                  return;
326 326
               }
327
-              $this->test_return(L_OK,"PHP extension <strong>GeoIP2</strong> is installed and working. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
327
+              $this->test_return(L_OK, "PHP extension <strong>GeoIP2</strong> is installed and working. See utils/GeoIP-update.sh in the CAT distribution and use it tu update the GeoIP database regularly.");
328 328
               break;
329 329
            default:
330
-              $this->test_return(L_ERROR,'Check Config::$GEOIP[\'version\'], it must be set to either 1 or 2');
330
+              $this->test_return(L_ERROR, 'Check Config::$GEOIP[\'version\'], it must be set to either 1 or 2');
331 331
               break;
332 332
        }
333 333
     }
@@ -337,88 +337,88 @@  discard block
 block discarded – undo
337 337
       */
338 338
     private function openssl_test() {
339 339
          $A = $this->get_exec_path('openssl');    
340
-         if($A['exec'] != "") {
340
+         if ($A['exec'] != "") {
341 341
              $t = exec($A['exec'] . ' version');
342
-             if($A['exec_is'] == "EXPLICIT")
343
-                $this->test_return(L_OK,"<strong>$t</strong> was found and is configured explicitly in your config.");
342
+             if ($A['exec_is'] == "EXPLICIT")
343
+                $this->test_return(L_OK, "<strong>$t</strong> was found and is configured explicitly in your config.");
344 344
              else
345
-                $this->test_return(L_WARN,"<strong>$t</strong> was found, but is not configured with an absolute path in your config.");
345
+                $this->test_return(L_WARN, "<strong>$t</strong> was found, but is not configured with an absolute path in your config.");
346 346
          } else
347
-            $this->test_return(L_ERROR,"<strong>openssl</strong> was not found on your system!");
347
+            $this->test_return(L_ERROR, "<strong>openssl</strong> was not found on your system!");
348 348
     }
349 349
 
350 350
     /**
351 351
       * test if makensis is available
352 352
       */
353 353
     private function makensis_test() {
354
-         if(! is_numeric(Config::$NSIS_VERSION)) {
355
-            $this->test_return(L_ERROR,"NSIS_VERSION needs to be numeric!");
354
+         if (!is_numeric(Config::$NSIS_VERSION)) {
355
+            $this->test_return(L_ERROR, "NSIS_VERSION needs to be numeric!");
356 356
             return;
357 357
          }
358
-         if(Config::$NSIS_VERSION < 2) {
359
-            $this->test_return(L_ERROR,"NSIS_VERSION needs to be at least 2!");
358
+         if (Config::$NSIS_VERSION < 2) {
359
+            $this->test_return(L_ERROR, "NSIS_VERSION needs to be at least 2!");
360 360
             return;
361 361
          }
362 362
          $A = $this->get_exec_path('makensis');    
363
-         if($A['exec'] != "") {
363
+         if ($A['exec'] != "") {
364 364
              $t = exec($A['exec'] . ' -VERSION');
365
-             if($A['exec_is'] == "EXPLICIT") 
366
-                $this->test_return(L_OK,"<strong>makensis $t</strong> was found and is configured explicitly in your config.");
365
+             if ($A['exec_is'] == "EXPLICIT") 
366
+                $this->test_return(L_OK, "<strong>makensis $t</strong> was found and is configured explicitly in your config.");
367 367
              else
368
-                $this->test_return(L_WARN,"<strong>makensis $t</strong> was found, but is not configured with an absolute path in your config.");
369
-             exec($A['exec'] . ' -HELP',$t);
370
-             $t1 = count(preg_grep('/INPUTCHARSET/',$t));
371
-             if($t1 == 1 && Config::$NSIS_VERSION == 2)
372
-                $this->test_return(L_ERROR,"Declared NSIS_VERSION does not seem to match the file pointed to by PATHS['makensis']!");
373
-             if($t1 == 0 && Config::$NSIS_VERSION >= 3)
374
-                $this->test_return(L_ERROR,"Declared NSIS_VERSION does not seem to match the file pointed to by PATHS['makensis']!");
368
+                $this->test_return(L_WARN, "<strong>makensis $t</strong> was found, but is not configured with an absolute path in your config.");
369
+             exec($A['exec'] . ' -HELP', $t);
370
+             $t1 = count(preg_grep('/INPUTCHARSET/', $t));
371
+             if ($t1 == 1 && Config::$NSIS_VERSION == 2)
372
+                $this->test_return(L_ERROR, "Declared NSIS_VERSION does not seem to match the file pointed to by PATHS['makensis']!");
373
+             if ($t1 == 0 && Config::$NSIS_VERSION >= 3)
374
+                $this->test_return(L_ERROR, "Declared NSIS_VERSION does not seem to match the file pointed to by PATHS['makensis']!");
375 375
          } else
376
-            $this->test_return(L_ERROR,"<strong>makensis</strong> was not found on your system!");
376
+            $this->test_return(L_ERROR, "<strong>makensis</strong> was not found on your system!");
377 377
     }
378 378
 
379 379
     /**
380 380
       * test if all required NSIS modules are available
381 381
       */
382 382
     private function NSISmodules_test() {
383
-         $tmp_dir = createTemporaryDirectory('installer',0)['dir'];
384
-         if(!chdir($tmp_dir)) {
383
+         $tmp_dir = createTemporaryDirectory('installer', 0)['dir'];
384
+         if (!chdir($tmp_dir)) {
385 385
            debug(2, "Cannot chdir to $tmp_dir\n");
386
-           $this->test_return(L_ERROR,"NSIS modules test - problem with temporary directory permissions, cannot continue");
386
+           $this->test_return(L_ERROR, "NSIS modules test - problem with temporary directory permissions, cannot continue");
387 387
            return;
388 388
          }
389
-         $exe= 'tt.exe';
389
+         $exe = 'tt.exe';
390 390
          $NSIS_Module_status = [];
391 391
          foreach ($this->NSIS_Modules as $module) {
392 392
             unset($out);
393
-            exec(Config::$PATHS['makensis']." -V1 '-X!include $module' '-XOutFile $exe' '-XSection X' '-XSectionEnd'", $out, $retval);
394
-            if($retval > 0) 
393
+            exec(Config::$PATHS['makensis'] . " -V1 '-X!include $module' '-XOutFile $exe' '-XSection X' '-XSectionEnd'", $out, $retval);
394
+            if ($retval > 0) 
395 395
                $NSIS_Module_status[$module] = 0;
396 396
             else
397 397
                $NSIS_Module_status[$module] = 1;
398 398
          }
399
-         if(is_file($exe))
399
+         if (is_file($exe))
400 400
             unlink($exe);
401 401
          foreach ($NSIS_Module_status as $module => $status) {
402
-            if($status == 1)
403
-               $this->test_return(L_OK,"NSIS module <strong>$module</strong> was found.");
402
+            if ($status == 1)
403
+               $this->test_return(L_OK, "NSIS module <strong>$module</strong> was found.");
404 404
             else
405
-               $this->test_return(L_ERROR,"NSIS module <strong>$module</strong> was not found or is not working correctly.");
405
+               $this->test_return(L_ERROR, "NSIS module <strong>$module</strong> was not found or is not working correctly.");
406 406
          }
407 407
     }
408 408
     private function NSIS_GetVersion_test() {
409
-         $tmp_dir = createTemporaryDirectory('installer',0)['dir'];
410
-         if(!chdir($tmp_dir)) {
409
+         $tmp_dir = createTemporaryDirectory('installer', 0)['dir'];
410
+         if (!chdir($tmp_dir)) {
411 411
            debug(2, "Cannot chdir to $tmp_dir\n");
412
-           $this->test_return(L_ERROR,"NSIS module <strong>GetVersion</strong> - problem with temporary directory permissions, cannot continue");
412
+           $this->test_return(L_ERROR, "NSIS module <strong>GetVersion</strong> - problem with temporary directory permissions, cannot continue");
413 413
            return;
414 414
          }
415
-         $exe= 'tt.exe';
416
-         exec(Config::$PATHS['makensis']." -V1 '-XOutFile $exe' '-XSection X' '-XGetVersion::WindowsName' '-XSectionEnd'", $out, $retval);
417
-         if($retval > 0)
418
-            $this->test_return(L_ERROR,"NSIS module <strong>GetVersion</strong> was not found or is not working correctly.");
415
+         $exe = 'tt.exe';
416
+         exec(Config::$PATHS['makensis'] . " -V1 '-XOutFile $exe' '-XSection X' '-XGetVersion::WindowsName' '-XSectionEnd'", $out, $retval);
417
+         if ($retval > 0)
418
+            $this->test_return(L_ERROR, "NSIS module <strong>GetVersion</strong> was not found or is not working correctly.");
419 419
          else
420
-            $this->test_return(L_OK,"NSIS module <strong>GetVersion</strong> was found.");
421
-         if(is_file($exe))
420
+            $this->test_return(L_OK, "NSIS module <strong>GetVersion</strong> was found.");
421
+         if (is_file($exe))
422 422
             unlink($exe);
423 423
     }
424 424
 
@@ -426,32 +426,32 @@  discard block
 block discarded – undo
426 426
       * test access to dowloads directories
427 427
       */
428 428
     private function directories_test() {
429
-               $Dir = createTemporaryDirectory('installer',0);
429
+               $Dir = createTemporaryDirectory('installer', 0);
430 430
                $dir = $Dir['dir'];
431 431
                $base = $Dir['base'];
432
-               if($dir) {
433
-                  $this->test_return(L_OK,"Installer cache directory is writable.");
432
+               if ($dir) {
433
+                  $this->test_return(L_OK, "Installer cache directory is writable.");
434 434
                   rrmdir($dir);
435 435
                } else {
436
-                  $this->test_return(L_ERROR,"Installer cache directory $base does not exist or is not writable!");
436
+                  $this->test_return(L_ERROR, "Installer cache directory $base does not exist or is not writable!");
437 437
                }
438
-               $Dir = createTemporaryDirectory('test',0);
438
+               $Dir = createTemporaryDirectory('test', 0);
439 439
                $dir = $Dir['dir'];
440 440
                $base = $Dir['base'];
441
-               if($dir) {
442
-                  $this->test_return(L_OK,"Test directory is writable.");
441
+               if ($dir) {
442
+                  $this->test_return(L_OK, "Test directory is writable.");
443 443
                   rrmdir($dir);
444 444
                } else {
445
-                  $this->test_return(L_ERROR,"Test directory  $base does not exist or is not writable!");
445
+                  $this->test_return(L_ERROR, "Test directory  $base does not exist or is not writable!");
446 446
                }
447
-               $Dir = createTemporaryDirectory('logo',0);
447
+               $Dir = createTemporaryDirectory('logo', 0);
448 448
                $dir = $Dir['dir'];
449 449
                $base = $Dir['base'];
450
-               if($dir) {
451
-                  $this->test_return(L_OK,"Logos cache directory is writable.");
450
+               if ($dir) {
451
+                  $this->test_return(L_OK, "Logos cache directory is writable.");
452 452
                   rrmdir($dir);
453 453
                } else {
454
-                  $this->test_return(L_ERROR,"Logos cache directory  $base does not exist or is not writable!");
454
+                  $this->test_return(L_ERROR, "Logos cache directory  $base does not exist or is not writable!");
455 455
                }
456 456
     }
457 457
 
@@ -466,16 +466,16 @@  discard block
 block discarded – undo
466 466
                         $allthere .= $onelanguage['locale'] . " ";
467 467
 
468 468
                 if ($allthere == "")
469
-                    $this->test_return(L_OK,"All of your configured locales are available on your system.");
469
+                    $this->test_return(L_OK, "All of your configured locales are available on your system.");
470 470
                 else
471
-                    $this->test_return(L_WARN,"Some of your configured locales (<strong>$allthere</strong>) are not installed and will not be displayed correctly!");
471
+                    $this->test_return(L_WARN, "Some of your configured locales (<strong>$allthere</strong>) are not installed and will not be displayed correctly!");
472 472
     }
473 473
 
474
-    private function check_config_default($type,$key,$value) {
474
+    private function check_config_default($type, $key, $value) {
475 475
                 if (empty(Config::$type[$key]))
476
-                    $missingvalues .="type/webcert_OCSP ";
476
+                    $missingvalues .= "type/webcert_OCSP ";
477 477
                 elseif (Config::$type['webcert_OCSP'] == $value)
478
-                    $defaultvalues .="type/$key ";
478
+                    $defaultvalues .= "type/$key ";
479 479
     }
480 480
 
481 481
 
@@ -486,31 +486,31 @@  discard block
 block discarded – undo
486 486
                 $defaultvalues = "";
487 487
                 $missingvalues = "";
488 488
                 if (Config::$APPEARANCE['from-mail'] == "[email protected]")
489
-                    $defaultvalues .="APPEARANCE/from-mail ";
489
+                    $defaultvalues .= "APPEARANCE/from-mail ";
490 490
                 if (Config::$APPEARANCE['support-contact']['url'] == "[email protected]?body=Only%20English%20language%20please!")
491
-                    $defaultvalues .="APPEARANCE/support-contact/url ";
491
+                    $defaultvalues .= "APPEARANCE/support-contact/url ";
492 492
                 if (Config::$APPEARANCE['support-contact']['display'] == "[email protected]")
493
-                    $defaultvalues .="APPEARANCE/support-contact/display ";
493
+                    $defaultvalues .= "APPEARANCE/support-contact/display ";
494 494
                 if (Config::$APPEARANCE['support-contact']['developer-mail'] == "[email protected]")
495
-                    $defaultvalues .="APPEARANCE/support-contact/mail ";
495
+                    $defaultvalues .= "APPEARANCE/support-contact/mail ";
496 496
                 if (Config::$APPEARANCE['abuse-mail'] == "[email protected]")
497
-                    $defaultvalues .="APPEARANCE/abuse-mail ";
497
+                    $defaultvalues .= "APPEARANCE/abuse-mail ";
498 498
                 if (Config::$APPEARANCE['MOTD'] == "Release Candidate. All bugs to be shot on sight!")
499
-                    $defaultvalues .="APPEARANCE/MOTD ";
499
+                    $defaultvalues .= "APPEARANCE/MOTD ";
500 500
                 if (Config::$APPEARANCE['webcert_CRLDP'] == ['list', 'of', 'CRL', 'pointers'])
501
-                    $defaultvalues .="APPEARANCE/webcert_CRLDP ";
501
+                    $defaultvalues .= "APPEARANCE/webcert_CRLDP ";
502 502
                 if (empty(Config::$APPEARANCE['webcert_OCSP']))
503
-                    $missingvalues .="APPEARANCE/webcert_OCSP ";
503
+                    $missingvalues .= "APPEARANCE/webcert_OCSP ";
504 504
                 elseif (Config::$APPEARANCE['webcert_OCSP'] == ['list', 'of', 'OCSP', 'pointers'])
505
-                    $defaultvalues .="APPEARANCE/webcert_OCSP ";
505
+                    $defaultvalues .= "APPEARANCE/webcert_OCSP ";
506 506
                 if (isset(Config::$RADIUSTESTS['UDP-hosts'][0]) && Config::$RADIUSTESTS['UDP-hosts'][0]['ip'] == "192.0.2.1")
507
-                    $defaultvalues .="RADIUSTESTS/UDP-hosts ";
507
+                    $defaultvalues .= "RADIUSTESTS/UDP-hosts ";
508 508
                 if (Config::$DB['INST']['host'] == "db.host.example")
509
-                    $defaultvalues .="DB/INST ";
509
+                    $defaultvalues .= "DB/INST ";
510 510
                 if (Config::$DB['INST']['host'] == "db.host.example")
511
-                    $defaultvalues .="DB/USER ";
512
-                if(!empty(Config::$DB['EXTERNAL']) && Config::$DB['EXTERNAL']['host'] == "customerdb.otherhost.example")
513
-                    $defaultvalues .="DB/EXTERNAL ";
511
+                    $defaultvalues .= "DB/USER ";
512
+                if (!empty(Config::$DB['EXTERNAL']) && Config::$DB['EXTERNAL']['host'] == "customerdb.otherhost.example")
513
+                    $defaultvalues .= "DB/EXTERNAL ";
514 514
                 $files = [];
515 515
                 foreach (Config::$RADIUSTESTS['TLS-clientcerts'] as $cadata) {
516 516
                     foreach ($cadata['certificates'] as $cert_files) {
@@ -522,14 +522,14 @@  discard block
 block discarded – undo
522 522
                 foreach ($files as $file) {
523 523
                     $handle = fopen(CAT::$root . "/config/cli-certs/" . $file, 'r');
524 524
                     if (!$handle)
525
-                        $defaultvalues .="CERTIFICATE/$file ";
525
+                        $defaultvalues .= "CERTIFICATE/$file ";
526 526
                     else
527 527
                         fclose($handle);
528 528
                 }
529 529
                 if ($defaultvalues != "")
530
-                    $this->test_return(L_WARN,"Your configuration in config/config.php contains unchanged default values or links to inexistent files: <strong>$defaultvalues</strong>!");
530
+                    $this->test_return(L_WARN, "Your configuration in config/config.php contains unchanged default values or links to inexistent files: <strong>$defaultvalues</strong>!");
531 531
                 else
532
-                    $this->test_return(L_OK,"Your configuration does not contain any unchanged defaults, which is a good sign.");
532
+                    $this->test_return(L_OK, "Your configuration does not contain any unchanged defaults, which is a good sign.");
533 533
     }
534 534
 
535 535
    /**
@@ -538,37 +538,37 @@  discard block
 block discarded – undo
538 538
    private function databases_test() {
539 539
         $DB = 'INST';
540 540
         $db = mysqli_connect(Config::$DB[$DB]['host'], Config::$DB[$DB]['user'], Config::$DB[$DB]['pass'], Config::$DB[$DB]['db']);
541
-        if(! $db) {
542
-           $this->test_return(L_ERROR,"Connection to the  $DB database failed");
541
+        if (!$db) {
542
+           $this->test_return(L_ERROR, "Connection to the  $DB database failed");
543 543
         } else {
544
-           $r = mysqli_query($db,'select * from profile_option_dict');
545
-           if($r->num_rows == $this->profile_option_ct)
546
-              $this->test_return(L_OK,"The $DB database appears to be OK.");
544
+           $r = mysqli_query($db, 'select * from profile_option_dict');
545
+           if ($r->num_rows == $this->profile_option_ct)
546
+              $this->test_return(L_OK, "The $DB database appears to be OK.");
547 547
            else
548
-              $this->test_return(L_ERROR,"The $DB database is reacheable but probably not updated to this version of CAT.");
548
+              $this->test_return(L_ERROR, "The $DB database is reacheable but probably not updated to this version of CAT.");
549 549
         }
550 550
         $DB = 'USER';
551 551
         $db = mysqli_connect(Config::$DB[$DB]['host'], Config::$DB[$DB]['user'], Config::$DB[$DB]['pass'], Config::$DB[$DB]['db']);
552
-        if(! $db) {
553
-           $this->test_return(L_ERROR,"Connection to the  $DB database failed");
552
+        if (!$db) {
553
+           $this->test_return(L_ERROR, "Connection to the  $DB database failed");
554 554
         } else {
555
-           $r = mysqli_query($db,'desc view_admin');
556
-           if($r->num_rows == $this->view_admin_ct)
557
-              $this->test_return(L_OK,"The $DB database appears to be OK.");
555
+           $r = mysqli_query($db, 'desc view_admin');
556
+           if ($r->num_rows == $this->view_admin_ct)
557
+              $this->test_return(L_OK, "The $DB database appears to be OK.");
558 558
            else
559
-              $this->test_return(L_ERROR,"The $DB is reacheable but there is something wrong with the schema");
559
+              $this->test_return(L_ERROR, "The $DB is reacheable but there is something wrong with the schema");
560 560
         }
561 561
         $DB = 'EXTERNAL';
562
-        if(! empty(Config::$DB[$DB])) {
562
+        if (!empty(Config::$DB[$DB])) {
563 563
         $db = mysqli_connect(Config::$DB[$DB]['host'], Config::$DB[$DB]['user'], Config::$DB[$DB]['pass'], Config::$DB[$DB]['db']);
564
-        if(! $db) {
565
-           $this->test_return(L_ERROR,"Connection to the  $DB database failed");
564
+        if (!$db) {
565
+           $this->test_return(L_ERROR, "Connection to the  $DB database failed");
566 566
         } else {
567
-           $r = mysqli_query($db,'desc view_admin');
568
-           if($r->num_rows == $this->view_admin_ct)
569
-              $this->test_return(L_OK,"The $DB database appears to be OK.");
567
+           $r = mysqli_query($db, 'desc view_admin');
568
+           if ($r->num_rows == $this->view_admin_ct)
569
+              $this->test_return(L_OK, "The $DB database appears to be OK.");
570 570
            else
571
-              $this->test_return(L_ERROR,"The $DB is reacheable but there is something wrong with the schema");
571
+              $this->test_return(L_ERROR, "The $DB is reacheable but there is something wrong with the schema");
572 572
         }
573 573
         }
574 574
    }
@@ -578,37 +578,37 @@  discard block
 block discarded – undo
578 578
      * test devices.php for the no_cache option
579 579
      */
580 580
    private function device_cache_test() {
581
-       if((! empty(Devices::$Options['no_cache'])) && Devices::$Options['no_cache'])
581
+       if ((!empty(Devices::$Options['no_cache'])) && Devices::$Options['no_cache'])
582 582
           $global_no_cache = 1;
583 583
        else
584 584
           $global_no_cache = 0;
585 585
 
586
-       if($global_no_cache == 1)
587
-          $this->test_return(L_WARN,"Devices no_cache global option is set, this is not a good idea in a production setting\n");
586
+       if ($global_no_cache == 1)
587
+          $this->test_return(L_WARN, "Devices no_cache global option is set, this is not a good idea in a production setting\n");
588 588
        $Devs = Devices::listDevices();
589 589
        $no_cache_dev = '';
590 590
        $no_cache_dev_count = 0;
591
-       if($global_no_cache) {
591
+       if ($global_no_cache) {
592 592
           foreach ($Devs as $dev=>$D) {
593
-             if(empty($D['options']['no_cache']) || $D['options']['no_cache'] != 0) {
594
-                $no_cache_dev .= $dev." ";
593
+             if (empty($D['options']['no_cache']) || $D['options']['no_cache'] != 0) {
594
+                $no_cache_dev .= $dev . " ";
595 595
                 $no_cache_dev_count++;
596 596
              }
597 597
           }
598 598
        } else {
599 599
           foreach ($Devs as $dev=>$D) {
600
-             if(!empty($D['options']['no_cache']) && $D['options']['no_cache'] != 0) {
601
-                $no_cache_dev .= $dev." ";
600
+             if (!empty($D['options']['no_cache']) && $D['options']['no_cache'] != 0) {
601
+                $no_cache_dev .= $dev . " ";
602 602
                 $no_cache_dev_count++;
603 603
              }
604 604
           }
605 605
        }
606 606
 
607 607
 
608
-       if($no_cache_dev_count > 1 ) 
609
-          $this->test_return(L_WARN,"The following devices will not be cached: $no_cache_dev");
610
-       if($no_cache_dev_count == 1 ) 
611
-          $this->test_return(L_WARN,"The following device will not be cached: $no_cache_dev");
608
+       if ($no_cache_dev_count > 1) 
609
+          $this->test_return(L_WARN, "The following devices will not be cached: $no_cache_dev");
610
+       if ($no_cache_dev_count == 1) 
611
+          $this->test_return(L_WARN, "The following device will not be cached: $no_cache_dev");
612 612
 
613 613
    }
614 614
 
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
      */
618 618
    private function mailer_test() {
619 619
       if (empty(Config::$APPEARANCE['abuse-mail']) || Config::$APPEARANCE['abuse-mail'] == "[email protected]") {
620
-         $this->test_return(L_ERROR,"Your abuse-mail has not been set, cannot continue with mailer tests.");
620
+         $this->test_return(L_ERROR, "Your abuse-mail has not been set, cannot continue with mailer tests.");
621 621
          return;
622 622
       }
623 623
       $mail = new PHPMailer();
@@ -637,10 +637,10 @@  discard block
 block discarded – undo
637 637
       $mail->Subject = "testing CAT configuration mail";
638 638
       $mail->Body = "Testing CAT mailing\n";
639 639
       $sent = $mail->send();
640
-      if($sent)
641
-          $this->test_return(L_OK,"mailer settings appear to be working, check ".Config::$APPEARANCE['abuse-mail']." mailbox if the message was receiced.");
640
+      if ($sent)
641
+          $this->test_return(L_OK, "mailer settings appear to be working, check " . Config::$APPEARANCE['abuse-mail'] . " mailbox if the message was receiced.");
642 642
       else
643
-          $this->test_return(L_ERROR,"mailer settings failed, check the Config::MAILSETTINGS");
643
+          $this->test_return(L_ERROR, "mailer settings failed, check the Config::MAILSETTINGS");
644 644
 
645 645
    }
646 646
 
Please login to merge, or discard this patch.
core/DeviceConfig.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
      */
64 64
 
65 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);
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
 
@@ -88,50 +88,50 @@  discard block
 block discarded – undo
88 88
     * @final not to be redefined
89 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");
91
+       debug(4, "module setup start\n");
92
+       if (!$profile instanceof Profile) {
93
+          debug(2, "No profile has been set\n");
94 94
           error("No profile has been set");
95 95
           exit;
96 96
        }
97 97
        $this->attributes = $this->getProfileAttributes($profile);
98
-       if(! $this->selected_eap) {
98
+       if (!$this->selected_eap) {
99 99
           error("No EAP type specified.");
100 100
           exit;
101 101
        }
102 102
        // create temporary directory, its full path will be saved in $this->FPATH;
103 103
        $T = createTemporaryDirectory('installer');
104 104
        $this->FPATH = $T['dir'];
105
-       mkdir($T['dir'].'/tmp');
106
-       chdir($T['dir'].'/tmp');
105
+       mkdir($T['dir'] . '/tmp');
106
+       chdir($T['dir'] . '/tmp');
107 107
        $CAs = [];
108
-       if(isset($this->attributes['eap:ca_file'])) {
108
+       if (isset($this->attributes['eap:ca_file'])) {
109 109
        foreach ($this->attributes['eap:ca_file'] as $ca) {
110
-          if($c = X509::processCertificate($ca))
110
+          if ($c = X509::processCertificate($ca))
111 111
              $CAs[] = $c;
112 112
           }
113
-          $this->attributes['internal:CAs'][0]=$CAs;
113
+          $this->attributes['internal:CAs'][0] = $CAs;
114 114
        }
115
-       if(isset($this->attributes['support:info_file'])) {
115
+       if (isset($this->attributes['support:info_file'])) {
116 116
           $this->attributes['internal:info_file'][0] = 
117 117
              $this->saveInfoFile($this->attributes['support:info_file'][0]);
118 118
        }
119
-       if(isset($this->attributes['general:logo_file']))
119
+       if (isset($this->attributes['general:logo_file']))
120 120
           $this->attributes['internal:logo_file'] = 
121 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'];;
122
+       $this->attributes['internal:SSID'] = $this->getSSIDs()['add']; ;
123
+       $this->attributes['internal:remove_SSID'] = $this->getSSIDs()['del']; ;
124 124
        $this->attributes['internal:consortia'] = $this->getConsortia();
125 125
        $this->lang_index = CAT::get_lang();
126 126
        // phpMD says the below is not needed. Wow.
127 127
        // $idp = new IdP($profile->institution);
128 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']);
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 131
        CAT::set_locale($olddomain);
132 132
 
133
-       if($this->signer && $this->options['sign'])
134
-         $this->sign = CAT::$root . '/signer/'. $this->signer;
133
+       if ($this->signer && $this->options['sign'])
134
+         $this->sign = CAT::$root . '/signer/' . $this->signer;
135 135
        $this->installerBasename = $this->getInstallerBasename();
136 136
     }
137 137
 
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
     */   
144 144
    public function getPreferredEapType($eap_array) {
145 145
      foreach ($eap_array as $eap) {
146
-         if(in_array($eap,$this->supportedEapMethods)) {
146
+         if (in_array($eap, $this->supportedEapMethods)) {
147 147
             $this->selected_eap = $eap;
148
-            debug(4,"Selected EAP:");
149
-            debug(4,$eap);
148
+            debug(4, "Selected EAP:");
149
+            debug(4, $eap);
150 150
             return($eap);
151 151
          }
152 152
      }
@@ -178,22 +178,22 @@  discard block
 block discarded – undo
178 178
     * @final not to be redefined
179 179
     */
180 180
    final protected function copyFile($source_name, $output_name = 0) {
181
-      if  ( $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;
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 189
       else {
190
-        debug(2,"fileCopy:reqested file $source_name does not exist\n");
190
+        debug(2, "fileCopy:reqested file $source_name does not exist\n");
191 191
         return(FALSE);
192 192
       }
193
-      debug(4,"Copying $source to $output_name\n");
194
-      $result = copy($source,"$output_name");
195
-      if(! $result )
196
-        debug(2,"fileCopy($source_name, $output_name) failed\n");
193
+      debug(4, "Copying $source to $output_name\n");
194
+      $result = copy($source, "$output_name");
195
+      if (!$result)
196
+        debug(2, "fileCopy($source_name, $output_name) failed\n");
197 197
       return($result); 
198 198
    }
199 199
 
@@ -223,31 +223,31 @@  discard block
 block discarded – undo
223 223
     */
224 224
 
225 225
    final protected function translateFile($source_name, $output_name = 0, $encoding = 0) {
226
-      if(Config::$NSIS_VERSION >= 3)
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");
231
+      debug(4, "translateFile($source_name, $output_name, $encoding)\n");
232 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;
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 238
       include($source);
239 239
       $output = ob_get_clean();
240
-      if($encoding) {
241
-        $output_c = iconv('UTF-8',$encoding.'//TRANSLIT',$output);
242
-        if($output_c)
240
+      if ($encoding) {
241
+        $output_c = iconv('UTF-8', $encoding . '//TRANSLIT', $output);
242
+        if ($output_c)
243 243
            $output = $output_c;
244 244
       }
245
-      $f = fopen("$output_name","w");
246
-      if(! $f)
247
-         debug(2,"translateFile($source, $output_name, $encoding) failed\n");
248
-      fwrite($f,$output);
245
+      $f = fopen("$output_name", "w");
246
+      if (!$f)
247
+         debug(2, "translateFile($source, $output_name, $encoding) failed\n");
248
+      fwrite($f, $output);
249 249
       fclose($f);
250
-      debug(4,"translateFile($source, $output_name, $encoding) end\n");
250
+      debug(4, "translateFile($source, $output_name, $encoding) end\n");
251 251
    }
252 252
 
253 253
 
@@ -268,17 +268,17 @@  discard block
 block discarded – undo
268 268
     * @final not to be redefined
269 269
     */
270 270
 
271
-   final protected function translateString($source_string,$encoding = 0) {
272
-      if(Config::$NSIS_VERSION >= 3)
271
+   final protected function translateString($source_string, $encoding = 0) {
272
+      if (Config::$NSIS_VERSION >= 3)
273 273
         $encoding = 0;
274
-      if($encoding)
275
-        $output_c = iconv('UTF-8',$encoding.'//TRANSLIT',$source_string);
274
+      if ($encoding)
275
+        $output_c = iconv('UTF-8', $encoding . '//TRANSLIT', $source_string);
276 276
       else
277 277
         $output_c = $source_string;
278
-      if($output_c) 
279
-         $source_string  = str_replace('"','$\\"',$output_c);
278
+      if ($output_c) 
279
+         $source_string = str_replace('"', '$\\"', $output_c);
280 280
       else
281
-         debug(2,"Failed to convert string $source_string\n");
281
+         debug(2, "Failed to convert string $source_string\n");
282 282
       return $source_string;
283 283
    }
284 284
 
@@ -295,19 +295,19 @@  discard block
 block discarded – undo
295 295
    * root is set to 1 for the CA roor certicicate and 0 otherwise
296 296
   */ 
297 297
    final protected function saveCertificateFiles($format) {
298
-     if($format == 'der' || $format == 'pam') {
298
+     if ($format == 'der' || $format == 'pam') {
299 299
        $i = 0;
300 300
        $CA_files = [];
301 301
        $ca_array = $this->attributes['internal:CAs'][0];
302
-       if(! $ca_array)
302
+       if (!$ca_array)
303 303
          return(FALSE);
304 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
-            fwrite($f,$CA['pem']);
305
+         $f = fopen("cert-$i.crt", "w");
306
+         if (!$f) die("problem opening the file\n");
307
+         if ($format == "pem")
308
+            fwrite($f, $CA['pem']);
309 309
          else
310
-            fwrite($f,$CA['der']);
310
+            fwrite($f, $CA['der']);
311 311
          fclose($f);
312 312
          $C = [];
313 313
          $C['file'] = "cert-$i.crt";
@@ -334,42 +334,42 @@  discard block
 block discarded – undo
334 334
     */
335 335
    private function getInstallerBasename() {
336 336
       $replace_pattern = '/[ ()\/\'"]+/';
337
-      debug(4,"getInstallerBasename1:".$this->attributes['general:instname'][0]."\n");
337
+      debug(4, "getInstallerBasename1:" . $this->attributes['general:instname'][0] . "\n");
338 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) {
339
+      debug(4, "getInstallerBasename2:$inst\n");
340
+      $Inst_a = explode('_', $inst);
341
+      if (count($Inst_a) > 2) {
342 342
          $inst = '';
343
-         foreach($Inst_a as $i)
343
+         foreach ($Inst_a as $i)
344 344
            $inst .= $i[0];
345 345
       }   
346 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])) {
347
+      if ($this->attributes['internal:profile_count'][0] > 1) {
348
+         if (!empty($this->attributes['profile:name']) && !empty($this->attributes['profile:name'][0])) {
349 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;
350
+             $prof = preg_replace('/_+$/', '', $prof);
351
+             return $c_name . '-' . $this->getDeviceId() . $inst . '-' . $prof;
352 352
          }
353 353
       }
354
-      return $c_name. '-'. $this->getDeviceId() . $inst;
354
+      return $c_name . '-' . $this->getDeviceId() . $inst;
355 355
   }
356 356
 
357 357
   private function getDeviceId() {
358 358
     $d_id = $this->device_id;
359
-    if(isset($this->options['device_id'])) 
359
+    if (isset($this->options['device_id'])) 
360 360
       $d_id = $this->options['device_id'];
361
-    if($d_id !== '')
361
+    if ($d_id !== '')
362 362
       $d_id .= '-';
363 363
     return $d_id;
364 364
   }
365 365
 
366 366
 
367 367
   private function getSSIDs() {
368
-    $S['add']=[];
369
-    $S['del']=[];
368
+    $S['add'] = [];
369
+    $S['del'] = [];
370 370
     if (isset(Config::$CONSORTIUM['ssid'])) {
371 371
        foreach (Config::$CONSORTIUM['ssid'] as $ssid) {
372
-        if(isset(Config::$CONSORTIUM['tkipsupport']) && Config::$CONSORTIUM['tkipsupport'] == TRUE)
372
+        if (isset(Config::$CONSORTIUM['tkipsupport']) && Config::$CONSORTIUM['tkipsupport'] == TRUE)
373 373
           $S['add'][$ssid] = 'TKIP';
374 374
         else {
375 375
           $S['add'][$ssid] = 'AES';
@@ -377,20 +377,20 @@  discard block
 block discarded – undo
377 377
         }
378 378
        }
379 379
     }
380
-    if(isset($this->attributes['media:SSID'])) {
380
+    if (isset($this->attributes['media:SSID'])) {
381 381
       $SSID = $this->attributes['media:SSID'];
382 382
 
383
-      foreach($SSID as $ssid)
383
+      foreach ($SSID as $ssid)
384 384
          $S['add'][$ssid] = 'AES';
385 385
       }
386
-    if(isset($this->attributes['media:SSID_with_legacy'])) {
386
+    if (isset($this->attributes['media:SSID_with_legacy'])) {
387 387
       $SSID = $this->attributes['media:SSID_with_legacy'];
388
-      foreach($SSID as $ssid)
388
+      foreach ($SSID as $ssid)
389 389
          $S['add'][$ssid] = 'TKIP';
390 390
     }
391
-    if(isset($this->attributes['media:remove_SSID'])) {
391
+    if (isset($this->attributes['media:remove_SSID'])) {
392 392
       $SSID = $this->attributes['media:remove_SSID'];
393
-      foreach($SSID as $ssid)
393
+      foreach ($SSID as $ssid)
394 394
          $S['del'][$ssid] = 'DEL';
395 395
     }
396 396
     return $S;
@@ -416,25 +416,25 @@  discard block
 block discarded – undo
416 416
   ];
417 417
 
418 418
   private function saveLogoFile($Logos) {
419
-    $i=0;
420
-    $returnarray= [];
419
+    $i = 0;
420
+    $returnarray = [];
421 421
     foreach ($Logos as $blob) {
422 422
       $finfo = new finfo(FILEINFO_MIME_TYPE);
423 423
       $mime = $finfo->buffer($blob);
424
-      if(preg_match('/^image\/(.*)/',$mime,$m))
424
+      if (preg_match('/^image\/(.*)/', $mime, $m))
425 425
         $ext = $m[1];
426 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");
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 433
           die("problem opening the file\n");
434 434
       }
435
-      fwrite($f,$blob);
435
+      fwrite($f, $blob);
436 436
       fclose($f);
437
-      $returnarray[]= ['name'=>$f_name,'mime'=>$ext];
437
+      $returnarray[] = ['name'=>$f_name, 'mime'=>$ext];
438 438
       $i++;
439 439
     }
440 440
     return($returnarray);
@@ -445,17 +445,17 @@  discard block
 block discarded – undo
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';
448
-    debug(4,"saveInfoFile: $mime : $ext\n");
449
-    $f = fopen('local-info.'.$ext,"w");
450
-    if(! $f) die("problem opening the file\n");
451
-    fwrite($f,$blob);
448
+    debug(4, "saveInfoFile: $mime : $ext\n");
449
+    $f = fopen('local-info.' . $ext, "w");
450
+    if (!$f) die("problem opening the file\n");
451
+    fwrite($f, $blob);
452 452
     fclose($f);
453
-    return(['name'=>'local-info.'.$ext,'mime'=>$ext]);
453
+    return(['name'=>'local-info.' . $ext, 'mime'=>$ext]);
454 454
   }
455 455
 
456 456
   private function getProfileAttributes(Profile $profile) {
457 457
      $eaps = $profile->getEapMethodsinOrderOfPreference(1);
458
-     if($eap = $this->getPreferredEapType($eaps)) {
458
+     if ($eap = $this->getPreferredEapType($eaps)) {
459 459
           $a = $profile->getCollapsedAttributes($eap);
460 460
           $a['eap'] = $eap;
461 461
           $a['all_eaps'] = $eaps;
@@ -476,8 +476,8 @@  discard block
 block discarded – undo
476 476
         ob_start();
477 477
         print_r($this->attributes);
478 478
         $output = ob_get_clean();
479
-        $f = fopen($file,"w");
480
-        fwrite($f,$output);
479
+        $f = fopen($file, "w");
480
+        fwrite($f, $output);
481 481
         fclose($f);
482 482
   }
483 483
 /** 
Please login to merge, or discard this patch.
core/DeviceFactory.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -47,24 +47,24 @@
 block discarded – undo
47 47
     public function __construct($blueprint) {
48 48
 
49 49
       $Dev = Devices::listDevices();
50
-        if(isset($Dev[$blueprint])) {
51
-            if($Dev[$blueprint]['directory'] && $Dev[$blueprint]['module'])
52
-                require_once("devices/".$Dev[$blueprint]['directory']."/".$Dev[$blueprint]['module'].".php");
53
-            debug(4,"loaded: devices/".$Dev[$blueprint]['directory']."/".$Dev[$blueprint]['module'].".php\n");
54
-            $class_name = "Device_".$Dev[$blueprint]['module'];
50
+        if (isset($Dev[$blueprint])) {
51
+            if ($Dev[$blueprint]['directory'] && $Dev[$blueprint]['module'])
52
+                require_once("devices/" . $Dev[$blueprint]['directory'] . "/" . $Dev[$blueprint]['module'] . ".php");
53
+            debug(4, "loaded: devices/" . $Dev[$blueprint]['directory'] . "/" . $Dev[$blueprint]['module'] . ".php\n");
54
+            $class_name = "Device_" . $Dev[$blueprint]['module'];
55 55
             $this->device = new $class_name();
56
-            if(! $this->device) {
57
-                debug(2,"module loading failed");
56
+            if (!$this->device) {
57
+                debug(2, "module loading failed");
58 58
                 die("module loading failed");
59 59
             }
60 60
         } else {
61 61
             error("unknown devicename:$blueprint");
62 62
         }
63
-       $this->device->module_path = CAT::$root.'/devices/'.$Dev[$blueprint]['directory'];
63
+       $this->device->module_path = CAT::$root . '/devices/' . $Dev[$blueprint]['directory'];
64 64
        $this->device->signer = isset($Dev[$blueprint]['signer']) ? $Dev[$blueprint]['signer'] : 0; 
65 65
        $this->device->device_id = $blueprint;
66 66
        $options = Devices::$Options;
67
-       if(isset($Dev[$blueprint]['options'])) {
67
+       if (isset($Dev[$blueprint]['options'])) {
68 68
           $Opt = $Dev[$blueprint]['options'];
69 69
           foreach ($Opt as $option => $value)
70 70
             $options[$option] = $value;
Please login to merge, or discard this patch.