@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $serverCandidates[IdPlist::geoDistance($adminLocation, ['lat' => $iterator->location_lat, 'lon' => $iterator->location_lon])] = $iterator->server_id; |
251 | 251 | } |
252 | 252 | if ($clients > $maxSupportedClients * 0.9) { |
253 | - $this->loggerInstance->debug(1, "A RADIUS server for Managed SP (" . $iterator->server_id . ") is serving at more than 90% capacity!"); |
|
253 | + $this->loggerInstance->debug(1, "A RADIUS server for Managed SP (".$iterator->server_id.") is serving at more than 90% capacity!"); |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | if (count($serverCandidates) == 0 && $federation != "DEFAULT") { |
@@ -281,28 +281,28 @@ discard block |
||
281 | 281 | $ourLocation = ['lon' => $geoip['geo']['lon'], 'lat' => $geoip['geo']['lat']]; |
282 | 282 | } |
283 | 283 | $inst = new IdP($this->institution); |
284 | - $ourserver = $this->findGoodServerLocation($ourLocation, $inst->federation , []); |
|
284 | + $ourserver = $this->findGoodServerLocation($ourLocation, $inst->federation, []); |
|
285 | 285 | // now, find an unused port in the preferred server |
286 | 286 | $foundFreePort1 = 0; |
287 | 287 | while ($foundFreePort1 == 0) { |
288 | 288 | $portCandidate = random_int(1200, 65535); |
289 | - $check = $this->databaseHandle->exec("SELECT port_instance_1 FROM deployment WHERE radius_instance_1 = '" . $ourserver . "' AND port_instance_1 = $portCandidate"); |
|
289 | + $check = $this->databaseHandle->exec("SELECT port_instance_1 FROM deployment WHERE radius_instance_1 = '".$ourserver."' AND port_instance_1 = $portCandidate"); |
|
290 | 290 | if (mysqli_num_rows(/** @scrutinizer ignore-type */ $check) == 0) { |
291 | 291 | $foundFreePort1 = $portCandidate; |
292 | 292 | } |
293 | 293 | } |
294 | - $ourSecondServer = $this->findGoodServerLocation($ourLocation, $inst->federation , [$ourserver]); |
|
294 | + $ourSecondServer = $this->findGoodServerLocation($ourLocation, $inst->federation, [$ourserver]); |
|
295 | 295 | $foundFreePort2 = 0; |
296 | 296 | while ($foundFreePort2 == 0) { |
297 | 297 | $portCandidate = random_int(1200, 65535); |
298 | - $check = $this->databaseHandle->exec("SELECT port_instance_2 FROM deployment WHERE radius_instance_2 = '" . $ourSecondServer . "' AND port_instance_2 = $portCandidate"); |
|
298 | + $check = $this->databaseHandle->exec("SELECT port_instance_2 FROM deployment WHERE radius_instance_2 = '".$ourSecondServer."' AND port_instance_2 = $portCandidate"); |
|
299 | 299 | if (mysqli_num_rows(/** @scrutinizer ignore-type */ $check) == 0) { |
300 | 300 | $foundFreePort2 = $portCandidate; |
301 | 301 | } |
302 | 302 | } |
303 | 303 | // and make up a shared secret that is halfways readable |
304 | 304 | $futureSecret = $this->randomString(16, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
305 | - $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"); |
|
305 | + $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"); |
|
306 | 306 | return ["port_instance_1" => $foundFreePort1, "port_instance_2" => $foundFreePort2, "secret" => $futureSecret, "radius_instance_1" => $ourserver, "radius_instance_2" => $ourserver]; |
307 | 307 | } |
308 | 308 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * @return void |
346 | 346 | */ |
347 | 347 | public function deactivate() { |
348 | - $this->databaseHandle->exec("UPDATE deployment SET status = " . DeploymentManaged::INACTIVE . " WHERE deployment_id = $this->identifier"); |
|
348 | + $this->databaseHandle->exec("UPDATE deployment SET status = ".DeploymentManaged::INACTIVE." WHERE deployment_id = $this->identifier"); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * @return void |
356 | 356 | */ |
357 | 357 | public function activate() { |
358 | - $this->databaseHandle->exec("UPDATE deployment SET status = " . DeploymentManaged::ACTIVE . " WHERE deployment_id = $this->identifier"); |
|
358 | + $this->databaseHandle->exec("UPDATE deployment SET status = ".DeploymentManaged::ACTIVE." WHERE deployment_id = $this->identifier"); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | /** |
@@ -381,15 +381,15 @@ discard block |
||
381 | 381 | public function sendToRADIUS($idx, $post) { |
382 | 382 | |
383 | 383 | $hostname = "radius_hostname_$idx"; |
384 | - $ch = curl_init( "http://" . $this->$hostname ); |
|
384 | + $ch = curl_init("http://".$this->$hostname); |
|
385 | 385 | if ($ch) { |
386 | - curl_setopt( $ch, CURLOPT_POST, 1); |
|
387 | - curl_setopt( $ch, CURLOPT_POSTFIELDS, $post); |
|
388 | - $this->loggerInstance->debug(1, "Posting to http://" . $this->$hostname . ": $post\n"); |
|
389 | - curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); |
|
390 | - curl_setopt( $ch, CURLOPT_HEADER, 0); |
|
391 | - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); |
|
392 | - $res = curl_exec( $ch ); |
|
386 | + curl_setopt($ch, CURLOPT_POST, 1); |
|
387 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $post); |
|
388 | + $this->loggerInstance->debug(1, "Posting to http://".$this->$hostname.": $post\n"); |
|
389 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
|
390 | + curl_setopt($ch, CURLOPT_HEADER, 0); |
|
391 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
392 | + $res = curl_exec($ch); |
|
393 | 393 | if ($res === FALSE) { |
394 | 394 | $res = 'FAILURE'; |
395 | 395 | } |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | } else { |
398 | 398 | $res = 'FAILURE'; |
399 | 399 | } |
400 | - $this->databaseHandle->exec("UPDATE deployment SET radius_status_$idx = " . ($res == 'OK'? \core\AbstractDeployment::RADIUS_OK : \core\AbstractDeployment::RADIUS_FAILURE) . " WHERE deployment_id = $this->identifier"); |
|
400 | + $this->databaseHandle->exec("UPDATE deployment SET radius_status_$idx = ".($res == 'OK' ? \core\AbstractDeployment::RADIUS_OK : \core\AbstractDeployment::RADIUS_FAILURE)." WHERE deployment_id = $this->identifier"); |
|
401 | 401 | return $res; |
402 | 402 | } |
403 | 403 | |
@@ -409,12 +409,12 @@ discard block |
||
409 | 409 | */ |
410 | 410 | public function setRADIUSconfig($remove = 0) { |
411 | 411 | $toPost = array(1 => '', 2 => ''); |
412 | - $toPost[1] = 'instid=' . $this->institution . '&deploymentid=' . $this->identifier . '&secret=' . $this->secret . '&country=' . $this->getAttributes("internal:country")[0]['value'] . '&'; |
|
412 | + $toPost[1] = 'instid='.$this->institution.'&deploymentid='.$this->identifier.'&secret='.$this->secret.'&country='.$this->getAttributes("internal:country")[0]['value'].'&'; |
|
413 | 413 | if ($remove) { |
414 | - $toPost[1] = $toPost[1] . 'remove=1&'; |
|
414 | + $toPost[1] = $toPost[1].'remove=1&'; |
|
415 | 415 | } else { |
416 | 416 | if ($this->getAttributes("managedsp:operatorname")[0]['value'] ?? NULL) { |
417 | - $toPost[1] = $toPost[1] . 'operatorname=' . $this->getAttributes("managedsp:operatorname")[0]['value'] . '&'; |
|
417 | + $toPost[1] = $toPost[1].'operatorname='.$this->getAttributes("managedsp:operatorname")[0]['value'].'&'; |
|
418 | 418 | } |
419 | 419 | if ($this->getAttributes("managedsp:vlan")[0]['value'] ?? NULL) { |
420 | 420 | $idp = new IdP($this->institution); |
@@ -431,16 +431,16 @@ discard block |
||
431 | 431 | } |
432 | 432 | } |
433 | 433 | if (!empty($allRealms)) { |
434 | - $toPost[1] = $toPost[1] . 'vlan=' . $this->getAttributes("managedsp:vlan")[0]['value'] . '&'; |
|
435 | - $toPost[1] = $toPost[1] . 'realmforvlan[]=' . implode('&realmforvlan[]=', $allRealms) . '&'; |
|
434 | + $toPost[1] = $toPost[1].'vlan='.$this->getAttributes("managedsp:vlan")[0]['value'].'&'; |
|
435 | + $toPost[1] = $toPost[1].'realmforvlan[]='.implode('&realmforvlan[]=', $allRealms).'&'; |
|
436 | 436 | } |
437 | 437 | } |
438 | 438 | } |
439 | 439 | $toPost[2] = $toPost[1]; |
440 | - $toPost[1] = $toPost[1] . 'port=' . $this->port1; |
|
441 | - $toPost[2] = $toPost[2] . 'port=' . $this->port2; |
|
440 | + $toPost[1] = $toPost[1].'port='.$this->port1; |
|
441 | + $toPost[2] = $toPost[2].'port='.$this->port2; |
|
442 | 442 | $response = array(); |
443 | - for ($idx=1; $idx<=2; $idx++) { |
|
443 | + for ($idx = 1; $idx <= 2; $idx++) { |
|
444 | 444 | $response[$idx] = $this->sendToRADIUS($idx, $toPost[$idx]); |
445 | 445 | } |
446 | 446 | return $response; |
@@ -26,7 +26,7 @@ discard block |
||
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 |
||
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 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | } |
53 | 53 | $addParam = ''; |
54 | 54 | foreach ($response as $idx=>$val) { |
55 | - $addParam = $addParam . "&res[$idx]=$val"; |
|
55 | + $addParam = $addParam."&res[$idx]=$val"; |
|
56 | 56 | } |
57 | - header("Location: overview_sp.php?inst_id=" . $my_inst->identifier . $addParam); |
|
57 | + header("Location: overview_sp.php?inst_id=".$my_inst->identifier.$addParam); |
|
58 | 58 | exit(0); |
59 | 59 | } |
60 | 60 | |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | } |
66 | 66 | $addParam = ''; |
67 | 67 | foreach ($response as $idx=>$val) { |
68 | - $addParam = $addParam . "&res[$idx]=$val"; |
|
68 | + $addParam = $addParam."&res[$idx]=$val"; |
|
69 | 69 | } |
70 | - header("Location: overview_sp.php?inst_id=" . $my_inst->identifier . $addParam); |
|
70 | + header("Location: overview_sp.php?inst_id=".$my_inst->identifier.$addParam); |
|
71 | 71 | exit(0); |
72 | 72 | } |
73 | 73 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $res = $deployment->setRADIUSconfig(); |
90 | 90 | $addParam = "&res=$res"; |
91 | 91 | } |
92 | - header("Location: overview_sp.php?inst_id=" . $my_inst->identifier . $addParam); |
|
92 | + header("Location: overview_sp.php?inst_id=".$my_inst->identifier.$addParam); |
|
93 | 93 | exit(0); |
94 | 94 | } |
95 | 95 | } |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | echo $uiElements->instLevelInfoBoxes($my_inst); |
118 | 118 | $deploymentOptions = $deployment->getAttributes(); |
119 | 119 | echo "<form enctype='multipart/form-data' action='edit_hotspot.php?inst_id=$my_inst->identifier&deployment_id=$deployment->identifier' method='post' accept-charset='UTF-8'> |
120 | - <input type='hidden' name='MAX_FILE_SIZE' value='" . \config\Master::MAX_UPLOAD_SIZE . "'>"; |
|
120 | + <input type='hidden' name='MAX_FILE_SIZE' value='".\config\Master::MAX_UPLOAD_SIZE."'>"; |
|
121 | 121 | $optionDisplay = new \web\lib\admin\OptionDisplay($deploymentOptions, "Profile"); |
122 | 122 | ?> |
123 | 123 | <?php |
124 | 124 | echo "<fieldset class='option_container' id='managedsp_override'> |
125 | - <legend><strong>" . _("Options for this deployment") . "</strong></legend>"; |
|
125 | + <legend><strong>" . _("Options for this deployment")."</strong></legend>"; |
|
126 | 126 | ?> |
127 | 127 | <table> |
128 | 128 | <tr> |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | <!-- input for VLAN identifier for home users--> |
141 | 141 | <td> |
142 | 142 | <span id='vlan_label'> |
143 | - <?php echo sprintf(_("VLAN tag for own users%s:"), ($vlan === NULL ? "" : " " . _("(unset with '0')"))); ?> |
|
143 | + <?php echo sprintf(_("VLAN tag for own users%s:"), ($vlan === NULL ? "" : " "._("(unset with '0')"))); ?> |
|
144 | 144 | </span> |
145 | 145 | </td> |
146 | 146 | <td> |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | </table> |
156 | 156 | <?php |
157 | 157 | echo $optionDisplay->prefilledOptionTable("managedsp"); |
158 | - echo "<button type='button' class='newoption' onclick='getXML(\"managedsp\")'>" . _("Add new option") . "</button>"; |
|
158 | + echo "<button type='button' class='newoption' onclick='getXML(\"managedsp\")'>"._("Add new option")."</button>"; |
|
159 | 159 | echo "</fieldset>"; |
160 | 160 | |
161 | 161 | |
162 | - 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>"; |
|
162 | + 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>"; |
|
163 | 163 | echo $deco->footer(); |
164 | 164 |