@@ -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 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | if (in_array('OK', $response)) { |
| 51 | 51 | $deployment->deactivate(); |
| 52 | 52 | } |
| 53 | - header("Location: overview_sp.php?inst_id=" . $my_inst->identifier . '&' . urldecode(http_build_query($response))); |
|
| 53 | + header("Location: overview_sp.php?inst_id=".$my_inst->identifier.'&'.urldecode(http_build_query($response))); |
|
| 54 | 54 | exit(0); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if (in_array('OK', $response)) { |
| 60 | 60 | $deployment->activate(); |
| 61 | 61 | } |
| 62 | - header("Location: overview_sp.php?inst_id=" . $my_inst->identifier . '&' . urldecode(http_build_query($response))); |
|
| 62 | + header("Location: overview_sp.php?inst_id=".$my_inst->identifier.'&'.urldecode(http_build_query($response))); |
|
| 63 | 63 | exit(0); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | if (in_array(2, $_POST['update']) && !in_array(1, $_POST['update'])) { |
| 75 | 75 | $which = 2; |
| 76 | 76 | } |
| 77 | - $response = $deployment->setRADIUSconfig(($deployment->status == 0)? 1 : 0, $which); |
|
| 77 | + $response = $deployment->setRADIUSconfig(($deployment->status == 0) ? 1 : 0, $which); |
|
| 78 | 78 | } else { |
| 79 | 79 | $response = array(); |
| 80 | 80 | } |
| 81 | - header("Location: overview_sp.php?inst_id=" . $my_inst->identifier . '&' . urldecode(http_build_query($response))); |
|
| 81 | + header("Location: overview_sp.php?inst_id=".$my_inst->identifier.'&'.urldecode(http_build_query($response))); |
|
| 82 | 82 | exit(0); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | if ($deployment->status == core\DeploymentManaged::ACTIVE) { |
| 99 | 99 | $response = $deployment->setRADIUSconfig(); |
| 100 | 100 | } |
| 101 | - header("Location: overview_sp.php?inst_id=" . $my_inst->identifier . '&' . urldecode(http_build_query($response))); |
|
| 101 | + header("Location: overview_sp.php?inst_id=".$my_inst->identifier.'&'.urldecode(http_build_query($response))); |
|
| 102 | 102 | exit(0); |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -126,12 +126,12 @@ discard block |
||
| 126 | 126 | echo $uiElements->instLevelInfoBoxes($my_inst); |
| 127 | 127 | $deploymentOptions = $deployment->getAttributes(); |
| 128 | 128 | 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'> |
| 129 | - <input type='hidden' name='MAX_FILE_SIZE' value='" . \config\Master::MAX_UPLOAD_SIZE . "'>"; |
|
| 129 | + <input type='hidden' name='MAX_FILE_SIZE' value='".\config\Master::MAX_UPLOAD_SIZE."'>"; |
|
| 130 | 130 | $optionDisplay = new \web\lib\admin\OptionDisplay($deploymentOptions, "Profile"); |
| 131 | 131 | ?> |
| 132 | 132 | <?php |
| 133 | 133 | echo "<fieldset class='option_container' id='managedsp_override'> |
| 134 | - <legend><strong>" . _("Options for this deployment") . "</strong></legend>"; |
|
| 134 | + <legend><strong>" . _("Options for this deployment")."</strong></legend>"; |
|
| 135 | 135 | ?> |
| 136 | 136 | <table> |
| 137 | 137 | <tr> |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | <!-- input for VLAN identifier for home users--> |
| 150 | 150 | <td> |
| 151 | 151 | <span id='vlan_label'> |
| 152 | - <?php echo sprintf(_("VLAN tag for own users%s:"), ($vlan === NULL ? "" : " " . _("(unset with '0')"))); ?> |
|
| 152 | + <?php echo sprintf(_("VLAN tag for own users%s:"), ($vlan === NULL ? "" : " "._("(unset with '0')"))); ?> |
|
| 153 | 153 | </span> |
| 154 | 154 | </td> |
| 155 | 155 | <td> |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | </table> |
| 165 | 165 | <?php |
| 166 | 166 | echo $optionDisplay->prefilledOptionTable("managedsp"); |
| 167 | - echo "<button type='button' class='newoption' onclick='getXML(\"managedsp\")'>" . _("Add new option") . "</button>"; |
|
| 167 | + echo "<button type='button' class='newoption' onclick='getXML(\"managedsp\")'>"._("Add new option")."</button>"; |
|
| 168 | 168 | echo "</fieldset>"; |
| 169 | 169 | |
| 170 | 170 | |
| 171 | - 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>"; |
|
| 171 | + 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>"; |
|
| 172 | 172 | echo $deco->footer(); |
| 173 | 173 | |
@@ -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(); |
@@ -38,7 +38,7 @@ discard block |
||
| 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)); |
@@ -75,18 +75,18 @@ discard block |
||
| 75 | 75 | <?php echo $mapCode->bodyTagCode(); ?>> |
| 76 | 76 | <?php |
| 77 | 77 | echo $deco->productheader("ADMIN-SP"); |
| 78 | - function check_url ($host) { |
|
| 78 | + function check_url($host) { |
|
| 79 | 79 | $ch = curl_init(); |
| 80 | 80 | $timeout = 10; |
| 81 | 81 | if ($ch === FALSE) { |
| 82 | 82 | return NULL; |
| 83 | 83 | } |
| 84 | - curl_setopt ( $ch, CURLOPT_URL, 'http://'.$host ); |
|
| 85 | - curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
| 86 | - curl_setopt ( $ch, CURLOPT_TIMEOUT, $timeout ); |
|
| 84 | + curl_setopt($ch, CURLOPT_URL, 'http://'.$host); |
|
| 85 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 86 | + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
| 87 | 87 | $http_respond = curl_exec($ch); |
| 88 | - $http_respond = trim( strip_tags( $http_respond ) ); |
|
| 89 | - $http_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); |
|
| 88 | + $http_respond = trim(strip_tags($http_respond)); |
|
| 89 | + $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
|
| 90 | 90 | if ($http_code == 200) { |
| 91 | 91 | return 1; |
| 92 | 92 | } |
@@ -131,21 +131,21 @@ discard block |
||
| 131 | 131 | <?php |
| 132 | 132 | if (\config\Master::FUNCTIONALITY_LOCATIONS['DIAGNOSTICS'] !== NULL) { |
| 133 | 133 | echo "<tr> |
| 134 | - <td>" . _("Check another realm's reachability") . "</td> |
|
| 134 | + <td>" . _("Check another realm's reachability")."</td> |
|
| 135 | 135 | <td><form method='post' action='../diag/action_realmcheck.php?inst_id=$my_inst->identifier' accept-charset='UTF-8'> |
| 136 | 136 | <input type='text' name='realm' id='realm'> |
| 137 | 137 | <input type='hidden' name='comefrom' id='comefrom' value='$link'/> |
| 138 | - <button type='submit'>" . _("Go!") . "</button> |
|
| 138 | + <button type='submit'>"._("Go!")."</button> |
|
| 139 | 139 | </form> |
| 140 | 140 | </td> |
| 141 | 141 | </tr>"; |
| 142 | 142 | } |
| 143 | 143 | if (\config\ConfAssistant::CONSORTIUM['name'] == "eduroam") { // SW: APPROVED |
| 144 | 144 | echo "<tr> |
| 145 | - <td>" . sprintf(_("Check %s server status"), $uiElements->nomenclatureFed) . "</td> |
|
| 145 | + <td>" . sprintf(_("Check %s server status"), $uiElements->nomenclatureFed)."</td> |
|
| 146 | 146 | <td> |
| 147 | 147 | <form action='https://monitor.eduroam.org/mon_direct.php' accept-charset='UTF-8'> |
| 148 | - <button type='submit'>" . _("Go!") . "</button> |
|
| 148 | + <button type='submit'>" . _("Go!")."</button> |
|
| 149 | 149 | </form> |
| 150 | 150 | </td> |
| 151 | 151 | </tr>"; |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | <?php |
| 157 | 157 | $hotspotProfiles = $my_inst->listDeployments(); |
| 158 | 158 | if (count($hotspotProfiles) == 0) { // no profiles yet. |
| 159 | - echo "<h2>" . sprintf(_("There are not yet any known deployments for your %s."), $uiElements->nomenclatureHotspot) . "</h2>"; |
|
| 159 | + echo "<h2>".sprintf(_("There are not yet any known deployments for your %s."), $uiElements->nomenclatureHotspot)."</h2>"; |
|
| 160 | 160 | } |
| 161 | 161 | if (count($hotspotProfiles) > 0) { // no profiles yet. |
| 162 | - echo "<h2>" . sprintf(_("Deployments for this %s"), $uiElements->nomenclatureHotspot) . "</h2>"; |
|
| 162 | + echo "<h2>".sprintf(_("Deployments for this %s"), $uiElements->nomenclatureHotspot)."</h2>"; |
|
| 163 | 163 | // display an info box with the connection data |
| 164 | 164 | } |
| 165 | 165 | |
@@ -171,19 +171,19 @@ discard block |
||
| 171 | 171 | ?> |
| 172 | 172 | <div style='display: table-row; margin-bottom: 20px;'> |
| 173 | 173 | <div class='profilebox' style='display: table-cell;'> |
| 174 | - <h2><?php echo core\DeploymentManaged::PRODUCTNAME . " (<span style='color:" . ( $deploymentObject->status == \core\AbstractDeployment::INACTIVE ? "red;'>" . _("inactive") : "green;'>" . _("active") ) . "</span>)"; ?></h2> |
|
| 174 | + <h2><?php echo core\DeploymentManaged::PRODUCTNAME." (<span style='color:".($deploymentObject->status == \core\AbstractDeployment::INACTIVE ? "red;'>"._("inactive") : "green;'>"._("active"))."</span>)"; ?></h2> |
|
| 175 | 175 | <table> |
| 176 | 176 | <tr> |
| 177 | 177 | <td><strong><?php echo _("Your primary RADIUS server") ?></strong><br/> |
| 178 | 178 | <?php |
| 179 | 179 | if ($deploymentObject->host1_v4 !== NULL) { |
| 180 | - echo _("IPv4") . ": " . $deploymentObject->host1_v4; |
|
| 180 | + echo _("IPv4").": ".$deploymentObject->host1_v4; |
|
| 181 | 181 | } |
| 182 | 182 | if ($deploymentObject->host1_v4 !== NULL && $deploymentObject->host1_v6 !== NULL) { |
| 183 | 183 | echo "<br/>"; |
| 184 | 184 | } |
| 185 | 185 | if ($deploymentObject->host1_v6 !== NULL) { |
| 186 | - echo _("IPv6") . ": " . $deploymentObject->host1_v6; |
|
| 186 | + echo _("IPv6").": ".$deploymentObject->host1_v6; |
|
| 187 | 187 | } |
| 188 | 188 | ?> |
| 189 | 189 | </td> |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | <td><?php echo $deploymentObject->port1; ?></td> |
| 192 | 192 | <td> |
| 193 | 193 | <?php |
| 194 | - echo "<img src='" . $radiusMessages[$deploymentObject->radius_status_1]['icon'] . |
|
| 195 | - "' alt='" . $radiusMessages[$deploymentObject->radius_status_1]['text'] . |
|
| 196 | - "' title='" . $radiusMessages[$deploymentObject->radius_status_1]['text'] . "'>"; |
|
| 194 | + echo "<img src='".$radiusMessages[$deploymentObject->radius_status_1]['icon']. |
|
| 195 | + "' alt='".$radiusMessages[$deploymentObject->radius_status_1]['text']. |
|
| 196 | + "' title='".$radiusMessages[$deploymentObject->radius_status_1]['text']."'>"; |
|
| 197 | 197 | ?> |
| 198 | 198 | </td> |
| 199 | 199 | </tr> |
@@ -201,22 +201,22 @@ discard block |
||
| 201 | 201 | <td><strong><?php echo _("Your backup RADIUS server") ?><br/></strong> |
| 202 | 202 | <?php |
| 203 | 203 | if ($deploymentObject->host2_v4 !== NULL) { |
| 204 | - echo _("IPv4") . ": " . $deploymentObject->host2_v4; |
|
| 204 | + echo _("IPv4").": ".$deploymentObject->host2_v4; |
|
| 205 | 205 | } |
| 206 | 206 | if ($deploymentObject->host2_v4 !== NULL && $deploymentObject->host2_v6 !== NULL) { |
| 207 | 207 | echo "<br/>"; |
| 208 | 208 | } |
| 209 | 209 | if ($deploymentObject->host2_v6 !== NULL) { |
| 210 | - echo _("IPv6") . ": " . $deploymentObject->host2_v6; |
|
| 210 | + echo _("IPv6").": ".$deploymentObject->host2_v6; |
|
| 211 | 211 | } |
| 212 | 212 | ?></td> |
| 213 | 213 | <td><?php echo _("RADIUS port number: ") ?></td> |
| 214 | 214 | <td><?php echo $deploymentObject->port2; ?></td> |
| 215 | 215 | <td> |
| 216 | 216 | <?php |
| 217 | - echo "<img src='" . $radiusMessages[$deploymentObject->radius_status_2]['icon'] . |
|
| 218 | - "' alt='" . $radiusMessages[$deploymentObject->radius_status_2]['text'] . |
|
| 219 | - "' title='" . $radiusMessages[$deploymentObject->radius_status_2]['text'] . "'>"; |
|
| 217 | + echo "<img src='".$radiusMessages[$deploymentObject->radius_status_2]['icon']. |
|
| 218 | + "' alt='".$radiusMessages[$deploymentObject->radius_status_2]['text']. |
|
| 219 | + "' title='".$radiusMessages[$deploymentObject->radius_status_2]['text']."'>"; |
|
| 220 | 220 | ?> |
| 221 | 221 | </td> |
| 222 | 222 | </tr> |
@@ -267,12 +267,12 @@ discard block |
||
| 267 | 267 | if ($res['FAILURE'] > 0) { |
| 268 | 268 | echo '<br>'; |
| 269 | 269 | if ($res['FAILURE'] == 2) { |
| 270 | - echo ' <span style="color: red;">' . _("Activation failure.") . '</span>'; |
|
| 270 | + echo ' <span style="color: red;">'._("Activation failure.").'</span>'; |
|
| 271 | 271 | } else { |
| 272 | 272 | if (isset($_GET['res'][1]) && $_GET['res']['1'] == 'FAILURE') { |
| 273 | - echo ' <span style="color: red;">' . _("Activation failure for your primary RADIUS server.") . '</span>'; |
|
| 273 | + echo ' <span style="color: red;">'._("Activation failure for your primary RADIUS server.").'</span>'; |
|
| 274 | 274 | } else { |
| 275 | - echo ' <span style="color: red;">' . _("Activation failure for your backup RADIUS server.") . '</span>'; |
|
| 275 | + echo ' <span style="color: red;">'._("Activation failure for your backup RADIUS server.").'</span>'; |
|
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | } |
@@ -292,12 +292,12 @@ discard block |
||
| 292 | 292 | if ($res['FAILURE'] > 0) { |
| 293 | 293 | echo '<br>'; |
| 294 | 294 | if ($res['FAILURE'] == 2) { |
| 295 | - echo ' <span style="color: red;">' . _("Failure during deactivation, your request is queued for handling") . '</span>'; |
|
| 295 | + echo ' <span style="color: red;">'._("Failure during deactivation, your request is queued for handling").'</span>'; |
|
| 296 | 296 | } else { |
| 297 | 297 | if (isset($_GET['res'][1]) && $_GET['res']['1'] == 'FAILURE') { |
| 298 | - echo ' <span style="color: red;">' . _("Deactivation failure for your primary RADIUS server, your request is queued.") . '</span>'; |
|
| 298 | + echo ' <span style="color: red;">'._("Deactivation failure for your primary RADIUS server, your request is queued.").'</span>'; |
|
| 299 | 299 | } else { |
| 300 | - echo ' <span style="color: red;">' . _("Deactivation failure for your backup RADIUS server, your request is queued.") . '</span>'; |
|
| 300 | + echo ' <span style="color: red;">'._("Deactivation failure for your backup RADIUS server, your request is queued.").'</span>'; |
|
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | foreach ($retry as $key => $value) { |
| 317 | 317 | if ($value == 1) { |
| 318 | 318 | ?> |
| 319 | - <input type="hidden" name='update[]' value='<?php echo $key;?>'> |
|
| 319 | + <input type="hidden" name='update[]' value='<?php echo $key; ?>'> |
|
| 320 | 320 | <?php |
| 321 | 321 | } |
| 322 | 322 | } |
@@ -447,8 +447,8 @@ |
||
| 447 | 447 | if ($onlyone) { |
| 448 | 448 | $toPost[$onlyone] = ''; |
| 449 | 449 | } else { |
| 450 | - $toPost[1] = ''; |
|
| 451 | - $toPost[2] = ''; |
|
| 450 | + $toPost[1] = ''; |
|
| 451 | + $toPost[2] = ''; |
|
| 452 | 452 | } |
| 453 | 453 | $toPostTemplate = 'instid=' . $this->institution . '&deploymentid=' . $this->identifier . '&secret=' . $this->secret . '&country=' . $this->getAttributes("internal:country")[0]['value'] . '&'; |
| 454 | 454 | if ($remove) { |
@@ -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 | } |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | } else { |
| 399 | 399 | $res = 'FAILURE'; |
| 400 | 400 | } |
| 401 | - $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 | + $this->databaseHandle->exec("UPDATE deployment SET radius_status_$idx = ".($res == 'OK' ? \core\AbstractDeployment::RADIUS_OK : \core\AbstractDeployment::RADIUS_FAILURE)." WHERE deployment_id = $this->identifier"); |
|
| 402 | 402 | return $res; |
| 403 | 403 | } |
| 404 | 404 | /** |
@@ -412,28 +412,28 @@ discard block |
||
| 412 | 412 | private function sendMailtoAdmin($remove, $response) { |
| 413 | 413 | $txt = ''; |
| 414 | 414 | if ($remove) { |
| 415 | - $txt = _('Profile dectivation failed' . ' '); |
|
| 415 | + $txt = _('Profile dectivation failed'.' '); |
|
| 416 | 416 | } else { |
| 417 | - $txt = _('Profile activation/modification failed' . ' '); |
|
| 417 | + $txt = _('Profile activation/modification failed'.' '); |
|
| 418 | 418 | } |
| 419 | 419 | if (array_count_values($response)['FAILURE'] == 2) { |
| 420 | - $txt = $txt . _('on both RADIUS servers: primary and backup') . '.'; |
|
| 420 | + $txt = $txt._('on both RADIUS servers: primary and backup').'.'; |
|
| 421 | 421 | } else { |
| 422 | 422 | if ($response['res[1]'] == 'FAILURE') { |
| 423 | - $txt = $txt . _('on primary RADIUS server') . '.'; |
|
| 423 | + $txt = $txt._('on primary RADIUS server').'.'; |
|
| 424 | 424 | } else { |
| 425 | - $txt = $txt . _('on backup RADIUS server') . '.'; |
|
| 425 | + $txt = $txt._('on backup RADIUS server').'.'; |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | $mail = \core\common\OutsideComm::mailHandle(); |
| 429 | 429 | $email = $this->getAttributes("support:email")[0]['value']; |
| 430 | - $mail->FromName = \config\Master::APPEARANCE['productname'] . " Notification System"; |
|
| 430 | + $mail->FromName = \config\Master::APPEARANCE['productname']." Notification System"; |
|
| 431 | 431 | $mail->addAddress($email); |
| 432 | 432 | $mail->Subject = _('RADIUS profile update problem'); |
| 433 | 433 | $mail->Body = $txt; |
| 434 | 434 | |
| 435 | 435 | $sent = $mail->send(); |
| 436 | - if ( $sent === FALSE) |
|
| 436 | + if ($sent === FALSE) |
|
| 437 | 437 | $this->loggerInstance->debug(1, 'Mailing on RADIUS problem failed'); |
| 438 | 438 | } |
| 439 | 439 | /** |
@@ -445,17 +445,17 @@ discard block |
||
| 445 | 445 | public function setRADIUSconfig($remove = 0, $onlyone = 0) { |
| 446 | 446 | $toPost = array(); |
| 447 | 447 | if ($onlyone) { |
| 448 | - $toPost[$onlyone] = ''; |
|
| 448 | + $toPost[$onlyone] = ''; |
|
| 449 | 449 | } else { |
| 450 | 450 | $toPost[1] = ''; |
| 451 | 451 | $toPost[2] = ''; |
| 452 | 452 | } |
| 453 | - $toPostTemplate = 'instid=' . $this->institution . '&deploymentid=' . $this->identifier . '&secret=' . $this->secret . '&country=' . $this->getAttributes("internal:country")[0]['value'] . '&'; |
|
| 453 | + $toPostTemplate = 'instid='.$this->institution.'&deploymentid='.$this->identifier.'&secret='.$this->secret.'&country='.$this->getAttributes("internal:country")[0]['value'].'&'; |
|
| 454 | 454 | if ($remove) { |
| 455 | - $toPostTemplate = $toPostTemplate . 'remove=1&'; |
|
| 455 | + $toPostTemplate = $toPostTemplate.'remove=1&'; |
|
| 456 | 456 | } else { |
| 457 | 457 | if ($this->getAttributes("managedsp:operatorname")[0]['value'] ?? NULL) { |
| 458 | - $toPostTemplate = $toPostTemplate . 'operatorname=' . $this->getAttributes("managedsp:operatorname")[0]['value'] . '&'; |
|
| 458 | + $toPostTemplate = $toPostTemplate.'operatorname='.$this->getAttributes("managedsp:operatorname")[0]['value'].'&'; |
|
| 459 | 459 | } |
| 460 | 460 | if ($this->getAttributes("managedsp:vlan")[0]['value'] ?? NULL) { |
| 461 | 461 | $idp = new IdP($this->institution); |
@@ -472,25 +472,25 @@ discard block |
||
| 472 | 472 | } |
| 473 | 473 | } |
| 474 | 474 | if (!empty($allRealms)) { |
| 475 | - $toPostTemplate = $toPostTemplate . 'vlan=' . $this->getAttributes("managedsp:vlan")[0]['value'] . '&'; |
|
| 476 | - $toPostTemplate = $toPostTemplate . 'realmforvlan[]=' . implode('&realmforvlan[]=', $allRealms) . '&'; |
|
| 475 | + $toPostTemplate = $toPostTemplate.'vlan='.$this->getAttributes("managedsp:vlan")[0]['value'].'&'; |
|
| 476 | + $toPostTemplate = $toPostTemplate.'realmforvlan[]='.implode('&realmforvlan[]=', $allRealms).'&'; |
|
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | } |
| 480 | 480 | foreach (array_keys($toPost) as $key) { |
| 481 | 481 | if ($key == 1) { |
| 482 | - $toPost[$key] = $toPostTemplate . 'port=' . $this->port1; |
|
| 482 | + $toPost[$key] = $toPostTemplate.'port='.$this->port1; |
|
| 483 | 483 | } else { |
| 484 | - $toPost[$key] = $toPostTemplate . 'port=' . $this->port2; |
|
| 484 | + $toPost[$key] = $toPostTemplate.'port='.$this->port2; |
|
| 485 | 485 | } |
| 486 | 486 | } |
| 487 | 487 | $response = array(); |
| 488 | 488 | foreach ($toPost as $key => $value) { |
| 489 | - $this->loggerInstance->debug(1, 'toPost ' . $toPost[$key] ."\n"); |
|
| 489 | + $this->loggerInstance->debug(1, 'toPost '.$toPost[$key]."\n"); |
|
| 490 | 490 | $response['res['.$key.']'] = $this->sendToRADIUS($key, $toPost[$key]); |
| 491 | 491 | } |
| 492 | 492 | if ($onlyone) { |
| 493 | - $response['res['.($onlyone==1)? 2 : 1 . ']'] = \core\AbstractDeployment::RADIUS_OK; |
|
| 493 | + $response['res['.($onlyone == 1) ? 2 : 1.']'] = \core\AbstractDeployment::RADIUS_OK; |
|
| 494 | 494 | } |
| 495 | 495 | if (in_array('FAILURE', $response)) { |
| 496 | 496 | $this->sendMailtoAdmin($remove, $response); |