Test Failed
Push — master ( b19cbe...190f6b )
by Maja
11:18
created
core/DeploymentManaged.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
                 $serverCandidates[IdPlist::geoDistance($adminLocation, ['lat' => $iterator->location_lat, 'lon' => $iterator->location_lon])] = $iterator->server_id;
317 317
             }
318 318
             if ($clients > $maxSupportedClients * 0.9) {
319
-                $this->loggerInstance->debug(1, "A RADIUS server for Managed SP (" . $iterator->server_id . ") is serving at more than 90% capacity!");
319
+                $this->loggerInstance->debug(1, "A RADIUS server for Managed SP (".$iterator->server_id.") is serving at more than 90% capacity!");
320 320
             }
321 321
         }
322 322
         if (count($serverCandidates) == 0 && $federation != "DEFAULT") {
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
      */
341 341
     private function createTLScredentials()
342 342
     {
343
-        $clientName = "SP_" . $this->identifier . '-' . $this->institution;
343
+        $clientName = "SP_".$this->identifier.'-'.$this->institution;
344 344
         $dn = array(
345 345
                     "organizationName" => "eduroam",
346 346
                     "organizationalUnitName" => "eduroam Managed SP",
@@ -354,13 +354,13 @@  discard block
 block discarded – undo
354 354
         openssl_pkey_export($privkey, $this->radsec_priv);
355 355
         // Generate a certificate signing request
356 356
         $csr = openssl_csr_new($dn, $privkey,
357
-                               array('digest_alg' => 'sha256', 'config' => ROOT . "/config/ManagedSPCerts/openssl.cnf"));
357
+                               array('digest_alg' => 'sha256', 'config' => ROOT."/config/ManagedSPCerts/openssl.cnf"));
358 358
         // get CA certificate and private key
359
-        $caprivkey = array(file_get_contents(ROOT . "/config/ManagedSPCerts/eduroamSP-CA.key"),
359
+        $caprivkey = array(file_get_contents(ROOT."/config/ManagedSPCerts/eduroamSP-CA.key"),
360 360
                             \config\Master::MANAGEDSP['capass']);
361
-        $cacert = file_get_contents(ROOT .  "/config/ManagedSPCerts/eduroamSP-CA.pem");
361
+        $cacert = file_get_contents(ROOT."/config/ManagedSPCerts/eduroamSP-CA.pem");
362 362
         $clientcert = openssl_csr_sign($csr, $cacert, $caprivkey, \config\Master::MANAGEDSP['daystoexpiry'],
363
-                          array('digest_alg'=>'sha256', 'config' => ROOT . "/config/ManagedSPCerts/openssl.cnf"), rand());
363
+                          array('digest_alg'=>'sha256', 'config' => ROOT."/config/ManagedSPCerts/openssl.cnf"), rand());
364 364
         openssl_x509_export($clientcert, $this->radsec_cert);
365 365
     } 
366 366
     /**
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
             $conditional1 = "AND activity_time > DATE_SUB(NOW(), INTERVAL $backlog SECOND)";
386 386
             $conditional2 = "";
387 387
         }
388
-        $stats = $this->databaseHandle->exec("SELECT activity_time, realm, mac, cui, result, ap_id FROM activity WHERE operatorname = ? $conditional1 ORDER BY activity_time $conditional2", "s", $opName );
388
+        $stats = $this->databaseHandle->exec("SELECT activity_time, realm, mac, cui, result, ap_id FROM activity WHERE operatorname = ? $conditional1 ORDER BY activity_time $conditional2", "s", $opName);
389 389
         return mysqli_fetch_all($stats, \MYSQLI_ASSOC);
390 390
     }
391 391
         
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
     {
517 517
         $customAttrib = $this->getAttributes("managedsp:operatorname");
518 518
         if (count($customAttrib) == 0) {
519
-            return "1sp." . $this->identifier . "-" . $this->institution . \config\ConfAssistant::SILVERBULLET['realm_suffix'];
519
+            return "1sp.".$this->identifier."-".$this->institution.\config\ConfAssistant::SILVERBULLET['realm_suffix'];
520 520
         }
521 521
         return $customAttrib[0]["value"];
522 522
     }
@@ -531,14 +531,14 @@  discard block
 block discarded – undo
531 531
     private function sendToRADIUS(int $idx, $post)
532 532
     {
533 533
         $hostname = "radius_hostname_$idx";
534
-        $ch = curl_init("http://" . $this->$hostname . ':' . \config\Master::MANAGEDSP['radiusconfigport']);
534
+        $ch = curl_init("http://".$this->$hostname.':'.\config\Master::MANAGEDSP['radiusconfigport']);
535 535
         if ($ch === FALSE) {
536 536
             $res = 'FAILURE';
537 537
         } else {
538 538
             curl_setopt($ch, CURLOPT_USERAGENT, "CAT-ManagedSP");
539 539
             curl_setopt($ch, CURLOPT_POST, 1);
540 540
             curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
541
-            $this->loggerInstance->debug(1, "Posting to http://" . $this->$hostname . ':' . \config\Master::MANAGEDSP['radiusconfigport'] . "/$post\n");
541
+            $this->loggerInstance->debug(1, "Posting to http://".$this->$hostname.':'.\config\Master::MANAGEDSP['radiusconfigport']."/$post\n");
542 542
             curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
543 543
             curl_setopt($ch, CURLOPT_HEADER, 0);
544 544
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@@ -577,19 +577,19 @@  discard block
 block discarded – undo
577 577
         } else {
578 578
             $txt = $remove ? _('Profile deactivation failed') : _('Profile activation/modification failed');
579 579
         }
580
-        $txt = $txt . ' ';
580
+        $txt = $txt.' ';
581 581
         if (array_count_values($response)[$status] == 2) {
582
-            $txt = $txt . _('on both RADIUS servers: primary and backup') . '.';
582
+            $txt = $txt._('on both RADIUS servers: primary and backup').'.';
583 583
         } else {
584 584
             if ($response['res[1]'] == $status) {
585
-                $txt = $txt . _('on primary RADIUS server') . '.';
585
+                $txt = $txt._('on primary RADIUS server').'.';
586 586
             } else {
587
-                $txt = $txt . _('on backup RADIUS server') . '.';
587
+                $txt = $txt._('on backup RADIUS server').'.';
588 588
             }
589 589
         }
590 590
         $mail = \core\common\OutsideComm::mailHandle();
591 591
         $email = $this->getAttributes("support:email")[0]['value'];
592
-        $mail->FromName = \config\Master::APPEARANCE['productname'] . " Notification System";
592
+        $mail->FromName = \config\Master::APPEARANCE['productname']." Notification System";
593 593
         $mail->addAddress($email);
594 594
         if ($status == 'OK') {
595 595
             $mail->Subject = _('RADIUS profile update problem fixed');
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
             return NULL;
624 624
         }
625 625
         $timeout = 10;
626
-        curl_setopt($ch, CURLOPT_URL, 'http://' . $host);
626
+        curl_setopt($ch, CURLOPT_URL, 'http://'.$host);
627 627
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
628 628
         curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
629 629
         curl_exec($ch);
@@ -715,41 +715,41 @@  discard block
 block discarded – undo
715 715
     {
716 716
         $remove = ($this->status == \core\AbstractDeployment::INACTIVE) ? 0 : 1;
717 717
         $toPost = ($onlyone ? array($onlyone => '') : array(1 => '', 2 => ''));
718
-        $toPostTemplate = 'instid=' . $this->institution . '&deploymentid=' . $this->identifier . 
719
-                '&secret=' . $this->secret .
720
-                '&country=' . $this->getAttributes("internal:country")[0]['value'] .
721
-                '&pskkey=' . $this->pskkey . '&';
718
+        $toPostTemplate = 'instid='.$this->institution.'&deploymentid='.$this->identifier. 
719
+                '&secret='.$this->secret.
720
+                '&country='.$this->getAttributes("internal:country")[0]['value'].
721
+                '&pskkey='.$this->pskkey.'&';
722 722
         if ($remove) {
723
-            $toPostTemplate = $toPostTemplate . 'remove=1&';
723
+            $toPostTemplate = $toPostTemplate.'remove=1&';
724 724
         } else {
725
-            $toPostTemplate = $toPostTemplate . 'operatorname=' . $this->getOperatorName() . '&'; 
725
+            $toPostTemplate = $toPostTemplate.'operatorname='.$this->getOperatorName().'&'; 
726 726
             if ($this->getAttributes("managedsp:vlan")[0]['value'] ?? NULL) {
727 727
                 $allRealms = $this->getAllRealms();
728 728
                 if (!empty($allRealms)) {
729
-                    $toPostTemplate = $toPostTemplate . 'vlan=' . $this->getAttributes("managedsp:vlan")[0]['value'] . '&';
730
-                    $toPostTemplate = $toPostTemplate . 'realmforvlan[]=' . implode('&realmforvlan[]=', $allRealms) . '&';
729
+                    $toPostTemplate = $toPostTemplate.'vlan='.$this->getAttributes("managedsp:vlan")[0]['value'].'&';
730
+                    $toPostTemplate = $toPostTemplate.'realmforvlan[]='.implode('&realmforvlan[]=', $allRealms).'&';
731 731
                 }
732 732
             }
733 733
         }
734 734
         foreach (array_keys($toPost) as $key) {
735
-            $elem = 'port' . $key;
736
-            $toPost[$key] = $toPostTemplate . 'port=' . $this->$elem;
735
+            $elem = 'port'.$key;
736
+            $toPost[$key] = $toPostTemplate.'port='.$this->$elem;
737 737
         }
738 738
         $response = array();
739 739
         foreach ($toPost as $key => $value) {
740
-            $this->loggerInstance->debug(1, 'toPost ' . $toPost[$key] . "\n");
740
+            $this->loggerInstance->debug(1, 'toPost '.$toPost[$key]."\n");
741 741
             // temporarly one server $response['res[' . $key . ']'] = $this->sendToRADIUS($key, $toPost[$key]);
742 742
             //if ($key == 2) {
743 743
             //    $response['res[2]'] = 'OK'; 
744 744
             //} else {
745
-                $response['res[' . $key . ']'] = $this->sendToRADIUS($key, $toPost[$key]);
745
+                $response['res['.$key.']'] = $this->sendToRADIUS($key, $toPost[$key]);
746 746
             //}
747 747
         }
748 748
         if ($onlyone) {
749
-            $response['res[' . ($onlyone == 1) ? 2 : 1 . ']'] = \core\AbstractDeployment::RADIUS_OK;
749
+            $response['res['.($onlyone == 1) ? 2 : 1.']'] = \core\AbstractDeployment::RADIUS_OK;
750 750
         }
751 751
         foreach (array('OK', 'FAILURE') as $status) {
752
-            if ( ( ($status == 'OK' && $notify) || ($status == 'FAILURE') ) && ( in_array($status, $response) ) ) {
752
+            if ((($status == 'OK' && $notify) || ($status == 'FAILURE')) && (in_array($status, $response))) {
753 753
                 $this->sendMailtoAdmin($remove, $response, $status);
754 754
             }
755 755
         }
Please login to merge, or discard this patch.