Passed
Push — master ( 20c378...20937d )
by Maja
13:45
created
web/admin/edit_hotspot.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 ?>
28 28
 <?php
29
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
29
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
30 30
 
31 31
 $deco = new \web\lib\admin\PageDecoration();
32 32
 $validator = new \web\lib\common\InputValidation();
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 if (!isset($_GET['deployment_id'])) {
38 38
     $my_inst->newDeployment(\core\AbstractDeployment::DEPLOYMENTTYPE_MANAGED);
39
-    header("Location: overview_sp.php?inst_id=" . $my_inst->identifier);
39
+    header("Location: overview_sp.php?inst_id=".$my_inst->identifier);
40 40
     exit(0);
41 41
 }
42 42
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         if ($res == 'OK') {
51 51
             $deployment->deactivate();
52 52
         }
53
-        header("Location: overview_sp.php?inst_id=" . $my_inst->identifier . "&res=$res");
53
+        header("Location: overview_sp.php?inst_id=".$my_inst->identifier."&res=$res");
54 54
         exit(0);
55 55
     }
56 56
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         if ($res == 'OK') {
60 60
             $deployment->activate();
61 61
         }
62
-        header("Location: overview_sp.php?inst_id=" . $my_inst->identifier . "&res=$res");
62
+        header("Location: overview_sp.php?inst_id=".$my_inst->identifier."&res=$res");
63 63
         exit(0);
64 64
     }
65 65
     if ($_POST['submitbutton'] == web\lib\common\FormElements::BUTTON_SAVE) {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             $res = $deployment->setRADIUSconfig();
81 81
             $addParam = "&res=$res";
82 82
         }
83
-        header("Location: overview_sp.php?inst_id=" . $my_inst->identifier . $addParam);
83
+        header("Location: overview_sp.php?inst_id=".$my_inst->identifier.$addParam);
84 84
         exit(0);
85 85
     }
86 86
 }
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
     echo $uiElements->instLevelInfoBoxes($my_inst);
109 109
     $deploymentOptions = $deployment->getAttributes();
110 110
     echo "<form enctype='multipart/form-data' action='edit_hotspot.php?inst_id=$my_inst->identifier&amp;deployment_id=$deployment->identifier' method='post' accept-charset='UTF-8'>
111
-                <input type='hidden' name='MAX_FILE_SIZE' value='" . \config\Master::MAX_UPLOAD_SIZE . "'>";
111
+                <input type='hidden' name='MAX_FILE_SIZE' value='".\config\Master::MAX_UPLOAD_SIZE."'>";
112 112
     $optionDisplay = new \web\lib\admin\OptionDisplay($deploymentOptions, "Profile");
113 113
     ?>
114 114
     <?php
115 115
     echo "<fieldset class='option_container' id='managedsp_override'>
116
-    <legend><strong>" . _("Options for this deployment") . "</strong></legend>";
116
+    <legend><strong>" . _("Options for this deployment")."</strong></legend>";
117 117
     ?>
118 118
     <table>
119 119
         <tr>
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             <!-- input for VLAN identifier for home users-->
132 132
             <td>
133 133
                 <span id='vlan_label'>
134
-                    <?php echo sprintf(_("VLAN tag for own users%s:"), ($vlan === NULL ? "" : " " . _("(unset with '0')"))); ?>
134
+                    <?php echo sprintf(_("VLAN tag for own users%s:"), ($vlan === NULL ? "" : " "._("(unset with '0')"))); ?>
135 135
                 </span>
136 136
             </td>
137 137
             <td>
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
     </table>
147 147
     <?php
148 148
     echo $optionDisplay->prefilledOptionTable("managedsp");
149
-    echo "<button type='button' class='newoption' onclick='getXML(\"managedsp\")'>" . _("Add new option") . "</button>";
149
+    echo "<button type='button' class='newoption' onclick='getXML(\"managedsp\")'>"._("Add new option")."</button>";
150 150
     echo "</fieldset>";
151 151
 
152 152
 
153
-    echo "<p><button type='submit' name='submitbutton' value='" . web\lib\common\FormElements::BUTTON_SAVE . "'>" . _("Save data") . "</button><button type='button' class='delete' name='abortbutton' value='abort' onclick='javascript:window.location = \"overview_sp.php?inst_id=$my_inst->identifier\"'>" . _("Discard changes") . "</button></p></form>";
153
+    echo "<p><button type='submit' name='submitbutton' value='".web\lib\common\FormElements::BUTTON_SAVE."'>"._("Save data")."</button><button type='button' class='delete' name='abortbutton' value='abort' onclick='javascript:window.location = \"overview_sp.php?inst_id=$my_inst->identifier\"'>"._("Discard changes")."</button></p></form>";
154 154
     echo $deco->footer();
155 155
     
Please login to merge, or discard this patch.
web/admin/overview_sp.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 ?>
28 28
 <?php
29
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
29
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
30 30
 
31 31
 $deco = new \web\lib\admin\PageDecoration();
32 32
 $validator = new \web\lib\common\InputValidation();
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 } else {
39 39
     $link = 'http://';
40 40
 }
41
-$link .= $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'];
41
+$link .= $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
42 42
 $link = htmlspecialchars($link);
43 43
 
44 44
 echo $deco->defaultPagePrelude(sprintf(_("%s: %s Dashboard"), \config\Master::APPEARANCE['productname'], $uiElements->nomenclatureHotspot));
@@ -88,21 +88,21 @@  discard block
 block discarded – undo
88 88
         <?php
89 89
         if (\config\Master::FUNCTIONALITY_LOCATIONS['DIAGNOSTICS'] !== NULL) {
90 90
             echo "<tr>
91
-                        <td>" . _("Check another realm's reachability") . "</td>
91
+                        <td>" . _("Check another realm's reachability")."</td>
92 92
                         <td><form method='post' action='../diag/action_realmcheck.php?inst_id=$my_inst->identifier' accept-charset='UTF-8'>
93 93
                               <input type='text' name='realm' id='realm'>
94 94
                               <input type='hidden' name='comefrom' id='comefrom' value='$link'/>
95
-                              <button type='submit'>" . _("Go!") . "</button>
95
+                              <button type='submit'>"._("Go!")."</button>
96 96
                             </form>
97 97
                         </td>
98 98
                     </tr>";
99 99
         }
100 100
         if (\config\ConfAssistant::CONSORTIUM['name'] == "eduroam") { // SW: APPROVED
101 101
             echo "<tr>
102
-                        <td>" . sprintf(_("Check %s server status"), $uiElements->nomenclatureFed) . "</td>
102
+                        <td>" . sprintf(_("Check %s server status"), $uiElements->nomenclatureFed)."</td>
103 103
                         <td>
104 104
                            <form action='https://monitor.eduroam.org/mon_direct.php' accept-charset='UTF-8'>
105
-                              <button type='submit'>" . _("Go!") . "</button>
105
+                              <button type='submit'>" . _("Go!")."</button>
106 106
                            </form>
107 107
                         </td>
108 108
                     </tr>";
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
     <?php
114 114
     $hotspotProfiles = $my_inst->listDeployments();
115 115
     if (count($hotspotProfiles) == 0) { // no profiles yet.
116
-        echo "<h2>" . sprintf(_("There are not yet any known deployments for your %s."), $uiElements->nomenclatureHotspot) . "</h2>";
116
+        echo "<h2>".sprintf(_("There are not yet any known deployments for your %s."), $uiElements->nomenclatureHotspot)."</h2>";
117 117
     }
118 118
     if (count($hotspotProfiles) > 0) { // no profiles yet.
119
-        echo "<h2>" . sprintf(_("Deployments for this %s"), $uiElements->nomenclatureHotspot) . "</h2>";
119
+        echo "<h2>".sprintf(_("Deployments for this %s"), $uiElements->nomenclatureHotspot)."</h2>";
120 120
         // display an info box with the connection data
121 121
     }
122 122
 
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
         ?>
125 125
         <div style='display: table-row; margin-bottom: 20px;'>
126 126
             <div class='profilebox' style='display: table-cell;'>
127
-                <h2><?php echo core\DeploymentManaged::PRODUCTNAME . " (<span style='color:" . ( $deploymentObject->status == \core\AbstractDeployment::INACTIVE ? "red;'>" . _("inactive") : "green;'>" . _("active") ) . "</span>)"; ?></h2>
127
+                <h2><?php echo core\DeploymentManaged::PRODUCTNAME." (<span style='color:".($deploymentObject->status == \core\AbstractDeployment::INACTIVE ? "red;'>"._("inactive") : "green;'>"._("active"))."</span>)"; ?></h2>
128 128
                 <table>
129 129
                     <tr>
130 130
                         <td><strong><?php echo _("Your primary RADIUS server") ?></strong><br/>
131 131
                         <?php
132 132
                             if ($deploymentObject->host1_v4 !== NULL) {
133
-                                echo _("IPv4") . ": " . $deploymentObject->host1_v4;
133
+                                echo _("IPv4").": ".$deploymentObject->host1_v4;
134 134
                             }
135 135
                             if ($deploymentObject->host1_v4 !== NULL && $deploymentObject->host1_v6 !== NULL) {
136 136
                                 echo "<br/>";
137 137
                             }
138 138
                             if ($deploymentObject->host1_v6 !== NULL) {
139
-                                echo _("IPv6") . ": " . $deploymentObject->host1_v6;
139
+                                echo _("IPv6").": ".$deploymentObject->host1_v6;
140 140
                             }
141 141
                             ?>
142 142
                         </td>
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
                         <td><strong><?php echo _("Your backup RADIUS server") ?><br/></strong>
148 148
                             <?php
149 149
                             if ($deploymentObject->host2_v4 !== NULL) {
150
-                                echo _("IPv4") . ": " . $deploymentObject->host2_v4;
150
+                                echo _("IPv4").": ".$deploymentObject->host2_v4;
151 151
                             }
152 152
                             if ($deploymentObject->host2_v4 !== NULL && $deploymentObject->host2_v6 !== NULL) {
153 153
                                 echo "<br/>";
154 154
                             }
155 155
                             if ($deploymentObject->host2_v6 !== NULL) {
156
-                                echo _("IPv6") . ": " . $deploymentObject->host2_v6;
156
+                                echo _("IPv6").": ".$deploymentObject->host2_v6;
157 157
                             }
158 158
                             ?></td>
159 159
                         <td><?php echo _("RADIUS port number: ") ?></td>
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                                 <?php echo _("Activate"); ?>
185 185
                             </button>
186 186
                             <?php if (isset($_GET['res']) && $_GET['res'] != 'OK') {
187
-                                echo ' <span style="color: red;">' . _("Activation failure") . '</span>';
187
+                                echo ' <span style="color: red;">'._("Activation failure").'</span>';
188 188
                             } ?>
189 189
                         </form>
190 190
                     <?php
Please login to merge, or discard this patch.
core/DeploymentManaged.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
                 $serverCandidates[IdPlist::geoDistance($adminLocation, ['lat' => $iterator->location_lat, 'lon' => $iterator->location_lon])] = $iterator->server_id;
234 234
             }
235 235
             if ($clients > $maxSupportedClients * 0.9) {
236
-                $this->loggerInstance->debug(1, "A RADIUS server for Managed SP (" . $iterator->server_id . ") is serving at more than 90% capacity!");
236
+                $this->loggerInstance->debug(1, "A RADIUS server for Managed SP (".$iterator->server_id.") is serving at more than 90% capacity!");
237 237
             }
238 238
         }
239 239
         if (count($serverCandidates) == 0 && $federation != "DEFAULT") {
@@ -264,28 +264,28 @@  discard block
 block discarded – undo
264 264
             $ourLocation = ['lon' => $geoip['geo']['lon'], 'lat' => $geoip['geo']['lat']];
265 265
         }
266 266
         $inst = new IdP($this->institution);
267
-        $ourserver = $this->findGoodServerLocation($ourLocation, $inst->federation , []);
267
+        $ourserver = $this->findGoodServerLocation($ourLocation, $inst->federation, []);
268 268
         // now, find an unused port in the preferred server
269 269
         $foundFreePort1 = 0;
270 270
         while ($foundFreePort1 == 0) {
271 271
             $portCandidate = random_int(1200, 65535);
272
-            $check = $this->databaseHandle->exec("SELECT port_instance_1 FROM deployment WHERE radius_instance_1 = '" . $ourserver . "' AND port_instance_1 = $portCandidate");
272
+            $check = $this->databaseHandle->exec("SELECT port_instance_1 FROM deployment WHERE radius_instance_1 = '".$ourserver."' AND port_instance_1 = $portCandidate");
273 273
             if (mysqli_num_rows(/** @scrutinizer ignore-type */ $check) == 0) {
274 274
                 $foundFreePort1 = $portCandidate;
275 275
             }
276 276
         }
277
-        $ourSecondServer = $this->findGoodServerLocation($ourLocation, $inst->federation , [$ourserver]);
277
+        $ourSecondServer = $this->findGoodServerLocation($ourLocation, $inst->federation, [$ourserver]);
278 278
         $foundFreePort2 = 0;
279 279
         while ($foundFreePort2 == 0) {
280 280
             $portCandidate = random_int(1200, 65535);
281
-            $check = $this->databaseHandle->exec("SELECT port_instance_2 FROM deployment WHERE radius_instance_2 = '" . $ourSecondServer . "' AND port_instance_2 = $portCandidate");
281
+            $check = $this->databaseHandle->exec("SELECT port_instance_2 FROM deployment WHERE radius_instance_2 = '".$ourSecondServer."' AND port_instance_2 = $portCandidate");
282 282
             if (mysqli_num_rows(/** @scrutinizer ignore-type */ $check) == 0) {
283 283
                 $foundFreePort2 = $portCandidate;
284 284
             }
285 285
         }
286 286
         // and make up a shared secret that is halfways readable
287 287
         $futureSecret = $this->randomString(16, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
288
-        $this->databaseHandle->exec("UPDATE deployment SET radius_instance_1 = '" . $ourserver . "', radius_instance_2 = '" . $ourSecondServer . "', port_instance_1 = $foundFreePort1, port_instance_2 = $foundFreePort2, secret = '$futureSecret' WHERE deployment_id = $this->identifier");
288
+        $this->databaseHandle->exec("UPDATE deployment SET radius_instance_1 = '".$ourserver."', radius_instance_2 = '".$ourSecondServer."', port_instance_1 = $foundFreePort1, port_instance_2 = $foundFreePort2, secret = '$futureSecret' WHERE deployment_id = $this->identifier");
289 289
         return ["port_instance_1" => $foundFreePort1, "port_instance_2" => $foundFreePort2, "secret" => $futureSecret, "radius_instance_1" => $ourserver, "radius_instance_2" => $ourserver];
290 290
     }
291 291
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
      * @return void
329 329
      */
330 330
     public function deactivate() {
331
-        $this->databaseHandle->exec("UPDATE deployment SET status = " . DeploymentManaged::INACTIVE . " WHERE deployment_id = $this->identifier");
331
+        $this->databaseHandle->exec("UPDATE deployment SET status = ".DeploymentManaged::INACTIVE." WHERE deployment_id = $this->identifier");
332 332
     }
333 333
 
334 334
     /**
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
      * @return void
339 339
      */
340 340
     public function activate() {
341
-        $this->databaseHandle->exec("UPDATE deployment SET status = " . DeploymentManaged::ACTIVE . " WHERE deployment_id = $this->identifier");
341
+        $this->databaseHandle->exec("UPDATE deployment SET status = ".DeploymentManaged::ACTIVE." WHERE deployment_id = $this->identifier");
342 342
     }
343 343
 
344 344
     /**
@@ -360,12 +360,12 @@  discard block
 block discarded – undo
360 360
      * @return string
361 361
      */
362 362
     public function setRADIUSconfig($remove = 0) {
363
-        $toPost1 = 'instid=' . $this->institution . '&deploymentid=' . $this->identifier . '&secret=' . $this->secret . '&country=' . $this->getAttributes("internal:country")[0]['value'] . '&';
363
+        $toPost1 = 'instid='.$this->institution.'&deploymentid='.$this->identifier.'&secret='.$this->secret.'&country='.$this->getAttributes("internal:country")[0]['value'].'&';
364 364
         if ($remove) {
365
-            $toPost1 = $toPost1 . 'remove=1&';
365
+            $toPost1 = $toPost1.'remove=1&';
366 366
         } else {
367 367
             if ($this->getAttributes("managedsp:operatorname")[0]['value'] ?? NULL) {
368
-                $toPost1 = $toPost1 . 'operatorname=' . $this->getAttributes("managedsp:operatorname")[0]['value'] . '&';
368
+                $toPost1 = $toPost1.'operatorname='.$this->getAttributes("managedsp:operatorname")[0]['value'].'&';
369 369
             }
370 370
             if ($this->getAttributes("managedsp:vlan")[0]['value'] ?? NULL) {
371 371
                 $idp = new IdP($this->institution);
@@ -383,22 +383,22 @@  discard block
 block discarded – undo
383 383
                 }
384 384
                 if (!empty($allRealms)) {
385 385
                     $this->loggerInstance->debug(1, $allRealms);
386
-                    $toPost1 = $toPost1 . 'vlan=' . $this->getAttributes("managedsp:vlan")[0]['value'] . '&';
387
-                    $toPost1 = $toPost1 . 'realmforvlan[]=' . implode('&realmforvlan[]=', $allRealms) . '&';
386
+                    $toPost1 = $toPost1.'vlan='.$this->getAttributes("managedsp:vlan")[0]['value'].'&';
387
+                    $toPost1 = $toPost1.'realmforvlan[]='.implode('&realmforvlan[]=', $allRealms).'&';
388 388
                 }
389 389
             }
390 390
         }
391 391
         $toPost2 = $toPost1;
392
-        $toPost1 = $toPost1 . 'port=' . $this->port1;
393
-        $toPost2 = $toPost2 . 'port=' . $this->port2;
394
-        $ch = curl_init( "http://" . $this->radius_hostname_1 );
395
-        curl_setopt( $ch, CURLOPT_POST, 1);
396
-        curl_setopt( $ch, CURLOPT_POSTFIELDS, $toPost1);
397
-        $this->loggerInstance->debug(1, "Posting to http://" . $this->radius_hostname_1 . ": $toPost1\n");
398
-        curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
399
-        curl_setopt( $ch, CURLOPT_HEADER, 0);
400
-        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
401
-        $response = curl_exec( $ch );
392
+        $toPost1 = $toPost1.'port='.$this->port1;
393
+        $toPost2 = $toPost2.'port='.$this->port2;
394
+        $ch = curl_init("http://".$this->radius_hostname_1);
395
+        curl_setopt($ch, CURLOPT_POST, 1);
396
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $toPost1);
397
+        $this->loggerInstance->debug(1, "Posting to http://".$this->radius_hostname_1.": $toPost1\n");
398
+        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
399
+        curl_setopt($ch, CURLOPT_HEADER, 0);
400
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
401
+        $response = curl_exec($ch);
402 402
         $this->loggerInstance->debug(1, "Response from FR configurator: $response\n");
403 403
         return $response;
404 404
     }
Please login to merge, or discard this patch.