@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | use \Exception; |
| 36 | 36 | |
| 37 | -require_once dirname(dirname(__DIR__)) . "/config/_config.php"; |
|
| 37 | +require_once dirname(dirname(__DIR__))."/config/_config.php"; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Test suite to verify that an EAP setup is actually working as advertised in |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $this->loggerInstance->debug(4, "RADIUSTests is in opMode " . $this->opMode . ", parameters were: $realm, $outerUsernameForChecks, " . print_r($supportedEapTypes, true)); |
|
| 168 | + $this->loggerInstance->debug(4, "RADIUSTests is in opMode ".$this->opMode.", parameters were: $realm, $outerUsernameForChecks, ".print_r($supportedEapTypes, true)); |
|
| 169 | 169 | $this->loggerInstance->debug(4, print_r($expectedServerNames, true)); |
| 170 | 170 | $this->loggerInstance->debug(4, print_r($expectedCABundle, true)); |
| 171 | 171 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $returnarray[] = RADIUSTests::CERTPROB_WILDCARD_IN_NAME; |
| 253 | 253 | continue; // otherwise we'd ALSO complain that it's not a real hostname |
| 254 | 254 | } |
| 255 | - if ($onename != "" && filter_var("foo@" . idn_to_ascii($onename), FILTER_VALIDATE_EMAIL) === FALSE) { |
|
| 255 | + if ($onename != "" && filter_var("foo@".idn_to_ascii($onename), FILTER_VALIDATE_EMAIL) === FALSE) { |
|
| 256 | 256 | $returnarray[] = RADIUSTests::CERTPROB_NOT_A_HOSTNAME; |
| 257 | 257 | } |
| 258 | 258 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | if (preg_match("/sha1/i", $intermediateCa['full_details']['signatureTypeSN'])) { |
| 278 | 278 | $returnarray[] = RADIUSTests::CERTPROB_SHA1_SIGNATURE; |
| 279 | 279 | } |
| 280 | - $this->loggerInstance->debug(4, "CERT IS: " . print_r($intermediateCa, TRUE)); |
|
| 280 | + $this->loggerInstance->debug(4, "CERT IS: ".print_r($intermediateCa, TRUE)); |
|
| 281 | 281 | if ($intermediateCa['basicconstraints_set'] == 0) { |
| 282 | 282 | $returnarray[] = RADIUSTests::CERTPROB_NO_BASICCONSTRAINTS; |
| 283 | 283 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | public function udpReachability($probeindex, $opnameCheck = TRUE, $frag = TRUE) { |
| 325 | 325 | // for EAP-TLS to be a viable option, we need to pass a random client cert to make eapol_test happy |
| 326 | 326 | // the following PEM data is one of the SENSE EAPLab client certs (not secret at all) |
| 327 | - $clientcert = file_get_contents(dirname(__FILE__) . "/clientcert.p12"); |
|
| 327 | + $clientcert = file_get_contents(dirname(__FILE__)."/clientcert.p12"); |
|
| 328 | 328 | if ($clientcert === FALSE) { |
| 329 | 329 | throw new Exception("A dummy client cert is part of the source distribution, but could not be loaded!"); |
| 330 | 330 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | if ($this->opMode == self::RADIUS_TEST_OPERATION_MODE_THOROUGH) { |
| 334 | 334 | return $this->udpLogin($probeindex, $this->supportedEapTypes[0]->getArrayRep(), $this->outerUsernameForChecks, 'eaplab', $opnameCheck, $frag, $clientcert); |
| 335 | 335 | } |
| 336 | - return $this->udpLogin($probeindex, \core\common\EAP::EAPTYPE_ANY, "cat-connectivity-test@" . $this->realm, 'eaplab', $opnameCheck, $frag, $clientcert); |
|
| 336 | + return $this->udpLogin($probeindex, \core\common\EAP::EAPTYPE_ANY, "cat-connectivity-test@".$this->realm, 'eaplab', $opnameCheck, $frag, $clientcert); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | return RADIUSTests::CERTPROB_NO_CDP_HTTP; |
| 354 | 354 | } |
| 355 | 355 | // first and second sub-match is the full URL... check it |
| 356 | - $crlcontent = \core\common\OutsideComm::downloadFile(trim($crlUrl[1] . $crlUrl[2])); |
|
| 356 | + $crlcontent = \core\common\OutsideComm::downloadFile(trim($crlUrl[1].$crlUrl[2])); |
|
| 357 | 357 | if ($crlcontent === FALSE) { |
| 358 | 358 | return RADIUSTests::CERTPROB_NO_CRL_AT_CDP_URL; |
| 359 | 359 | } |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | fclose($pipes[1]); |
| 385 | 385 | fclose($pipes[2]); |
| 386 | 386 | $retval = proc_close($process); |
| 387 | - if ($retval != 0 || !preg_match("/BEGIN X509 CRL/",$pem)) { |
|
| 387 | + if ($retval != 0 || !preg_match("/BEGIN X509 CRL/", $pem)) { |
|
| 388 | 388 | // this was not a real CRL |
| 389 | 389 | return RADIUSTests::CERTPROB_NO_CRL_AT_CDP_URL; |
| 390 | 390 | } |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | $origLength = strlen($hex); |
| 407 | 407 | for ($i = 1; $i < $origLength; $i++) { |
| 408 | 408 | if ($i % 2 == 1 && $i != strlen($hex)) { |
| 409 | - $spaced .= $hex[$i] . " "; |
|
| 409 | + $spaced .= $hex[$i]." "; |
|
| 410 | 410 | } else { |
| 411 | 411 | $spaced .= $hex[$i]; |
| 412 | 412 | } |
@@ -489,19 +489,19 @@ discard block |
||
| 489 | 489 | $eapText = \core\common\EAP::eapDisplayName($eaptype); |
| 490 | 490 | $config = ' |
| 491 | 491 | network={ |
| 492 | - ssid="' . CONFIG['APPEARANCE']['productname'] . ' testing" |
|
| 492 | + ssid="' . CONFIG['APPEARANCE']['productname'].' testing" |
|
| 493 | 493 | key_mgmt=WPA-EAP |
| 494 | 494 | proto=WPA2 |
| 495 | 495 | pairwise=CCMP |
| 496 | 496 | group=CCMP |
| 497 | 497 | '; |
| 498 | 498 | // phase 1 |
| 499 | - $config .= 'eap=' . $eapText['OUTER'] . "\n"; |
|
| 499 | + $config .= 'eap='.$eapText['OUTER']."\n"; |
|
| 500 | 500 | $logConfig = $config; |
| 501 | 501 | // phase 2 if applicable; all inner methods have passwords |
| 502 | 502 | if (isset($eapText['INNER']) && $eapText['INNER'] != "") { |
| 503 | - $config .= ' phase2="auth=' . $eapText['INNER'] . "\"\n"; |
|
| 504 | - $logConfig .= ' phase2="auth=' . $eapText['INNER'] . "\"\n"; |
|
| 503 | + $config .= ' phase2="auth='.$eapText['INNER']."\"\n"; |
|
| 504 | + $logConfig .= ' phase2="auth='.$eapText['INNER']."\"\n"; |
|
| 505 | 505 | } |
| 506 | 506 | // all methods set a password, except EAP-TLS |
| 507 | 507 | if ($eaptype != \core\common\EAP::EAPTYPE_TLS) { |
@@ -517,11 +517,11 @@ discard block |
||
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | // inner identity |
| 520 | - $config .= ' identity="' . $inner . "\"\n"; |
|
| 521 | - $logConfig .= ' identity="' . $inner . "\"\n"; |
|
| 520 | + $config .= ' identity="'.$inner."\"\n"; |
|
| 521 | + $logConfig .= ' identity="'.$inner."\"\n"; |
|
| 522 | 522 | // outer identity, may be equal |
| 523 | - $config .= ' anonymous_identity="' . $outer . "\"\n"; |
|
| 524 | - $logConfig .= ' anonymous_identity="' . $outer . "\"\n"; |
|
| 523 | + $config .= ' anonymous_identity="'.$outer."\"\n"; |
|
| 524 | + $logConfig .= ' anonymous_identity="'.$outer."\"\n"; |
|
| 525 | 525 | // done |
| 526 | 526 | $config .= "}"; |
| 527 | 527 | $logConfig .= "}"; |
@@ -582,13 +582,13 @@ discard block |
||
| 582 | 582 | * @return string the command-line for eapol_test |
| 583 | 583 | */ |
| 584 | 584 | private function eapolTestConfig($probeindex, $opName, $frag) { |
| 585 | - $cmdline = CONFIG_DIAGNOSTICS['PATHS']['eapol_test'] . |
|
| 586 | - " -a " . CONFIG_DIAGNOSTICS['RADIUSTESTS']['UDP-hosts'][$probeindex]['ip'] . |
|
| 587 | - " -s " . CONFIG_DIAGNOSTICS['RADIUSTESTS']['UDP-hosts'][$probeindex]['secret'] . |
|
| 588 | - " -o serverchain.pem" . |
|
| 589 | - " -c ./udp_login_test.conf" . |
|
| 590 | - " -M 22:44:66:CA:20:" . sprintf("%02d", $probeindex) . " " . |
|
| 591 | - " -t " . CONFIG_DIAGNOSTICS['RADIUSTESTS']['UDP-hosts'][$probeindex]['timeout'] . " "; |
|
| 585 | + $cmdline = CONFIG_DIAGNOSTICS['PATHS']['eapol_test']. |
|
| 586 | + " -a ".CONFIG_DIAGNOSTICS['RADIUSTESTS']['UDP-hosts'][$probeindex]['ip']. |
|
| 587 | + " -s ".CONFIG_DIAGNOSTICS['RADIUSTESTS']['UDP-hosts'][$probeindex]['secret']. |
|
| 588 | + " -o serverchain.pem". |
|
| 589 | + " -c ./udp_login_test.conf". |
|
| 590 | + " -M 22:44:66:CA:20:".sprintf("%02d", $probeindex)." ". |
|
| 591 | + " -t ".CONFIG_DIAGNOSTICS['RADIUSTESTS']['UDP-hosts'][$probeindex]['timeout']." "; |
|
| 592 | 592 | if ($opName) { |
| 593 | 593 | $cmdline .= '-N126:s:"1cat.eduroam.org" '; |
| 594 | 594 | } |
@@ -617,10 +617,10 @@ discard block |
||
| 617 | 617 | * @throws Exception |
| 618 | 618 | */ |
| 619 | 619 | private function createCArepository($tmpDir, &$intermOdditiesCAT, $servercert, $eapIntermediates, $eapIntermediateCRLs) { |
| 620 | - if (!mkdir($tmpDir . "/root-ca-allcerts/", 0700, true)) { |
|
| 620 | + if (!mkdir($tmpDir."/root-ca-allcerts/", 0700, true)) { |
|
| 621 | 621 | throw new Exception("unable to create root CA directory (RADIUS Tests): $tmpDir/root-ca-allcerts/\n"); |
| 622 | 622 | } |
| 623 | - if (!mkdir($tmpDir . "/root-ca-eaponly/", 0700, true)) { |
|
| 623 | + if (!mkdir($tmpDir."/root-ca-eaponly/", 0700, true)) { |
|
| 624 | 624 | throw new Exception("unable to create root CA directory (RADIUS Tests): $tmpDir/root-ca-eaponly/\n"); |
| 625 | 625 | } |
| 626 | 626 | // make a copy of the EAP-received chain and add the configured intermediates, if any |
@@ -634,15 +634,15 @@ discard block |
||
| 634 | 634 | } |
| 635 | 635 | if ($decoded['ca'] == 1) { |
| 636 | 636 | if ($decoded['root'] == 1) { // save CAT roots to the root directory |
| 637 | - file_put_contents($tmpDir . "/root-ca-eaponly/configuredroot" . count($catRoots) . ".pem", $decoded['pem']); |
|
| 638 | - file_put_contents($tmpDir . "/root-ca-allcerts/configuredroot" . count($catRoots) . ".pem", $decoded['pem']); |
|
| 637 | + file_put_contents($tmpDir."/root-ca-eaponly/configuredroot".count($catRoots).".pem", $decoded['pem']); |
|
| 638 | + file_put_contents($tmpDir."/root-ca-allcerts/configuredroot".count($catRoots).".pem", $decoded['pem']); |
|
| 639 | 639 | $catRoots[] = $decoded['pem']; |
| 640 | 640 | } else { // save the intermediates to allcerts directory |
| 641 | - file_put_contents($tmpDir . "/root-ca-allcerts/cat-intermediate" . count($catIntermediates) . ".pem", $decoded['pem']); |
|
| 641 | + file_put_contents($tmpDir."/root-ca-allcerts/cat-intermediate".count($catIntermediates).".pem", $decoded['pem']); |
|
| 642 | 642 | $intermOdditiesCAT = array_merge($intermOdditiesCAT, $this->propertyCheckIntermediate($decoded)); |
| 643 | 643 | if (isset($decoded['CRL']) && isset($decoded['CRL'][0])) { |
| 644 | 644 | $this->loggerInstance->debug(4, "got an intermediate CRL; adding them to the chain checks. (Remember: checking end-entity cert only, not the whole chain"); |
| 645 | - file_put_contents($tmpDir . "/root-ca-allcerts/crl_cat" . count($catIntermediates) . ".pem", $decoded['CRL'][0]); |
|
| 645 | + file_put_contents($tmpDir."/root-ca-allcerts/crl_cat".count($catIntermediates).".pem", $decoded['CRL'][0]); |
|
| 646 | 646 | } |
| 647 | 647 | $catIntermediates[] = $decoded['pem']; |
| 648 | 648 | } |
@@ -651,26 +651,26 @@ discard block |
||
| 651 | 651 | // save all intermediate certificates and CRLs to separate files in |
| 652 | 652 | // both root-ca directories |
| 653 | 653 | foreach ($eapIntermediates as $index => $onePem) { |
| 654 | - file_put_contents($tmpDir . "/root-ca-eaponly/intermediate$index.pem", $onePem); |
|
| 655 | - file_put_contents($tmpDir . "/root-ca-allcerts/intermediate$index.pem", $onePem); |
|
| 654 | + file_put_contents($tmpDir."/root-ca-eaponly/intermediate$index.pem", $onePem); |
|
| 655 | + file_put_contents($tmpDir."/root-ca-allcerts/intermediate$index.pem", $onePem); |
|
| 656 | 656 | } |
| 657 | 657 | foreach ($eapIntermediateCRLs as $index => $onePem) { |
| 658 | - file_put_contents($tmpDir . "/root-ca-eaponly/intermediateCRL$index.pem", $onePem); |
|
| 659 | - file_put_contents($tmpDir . "/root-ca-allcerts/intermediateCRL$index.pem", $onePem); |
|
| 658 | + file_put_contents($tmpDir."/root-ca-eaponly/intermediateCRL$index.pem", $onePem); |
|
| 659 | + file_put_contents($tmpDir."/root-ca-allcerts/intermediateCRL$index.pem", $onePem); |
|
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | $checkstring = ""; |
| 663 | 663 | if (isset($servercert['CRL']) && isset($servercert['CRL'][0])) { |
| 664 | 664 | $this->loggerInstance->debug(4, "got a server CRL; adding them to the chain checks. (Remember: checking end-entity cert only, not the whole chain"); |
| 665 | 665 | $checkstring = "-crl_check_all"; |
| 666 | - file_put_contents($tmpDir . "/root-ca-eaponly/crl-server.pem", $servercert['CRL'][0]); |
|
| 667 | - file_put_contents($tmpDir . "/root-ca-allcerts/crl-server.pem", $servercert['CRL'][0]); |
|
| 666 | + file_put_contents($tmpDir."/root-ca-eaponly/crl-server.pem", $servercert['CRL'][0]); |
|
| 667 | + file_put_contents($tmpDir."/root-ca-allcerts/crl-server.pem", $servercert['CRL'][0]); |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | |
| 671 | 671 | // now c_rehash the root CA directory ... |
| 672 | - system(CONFIG_DIAGNOSTICS['PATHS']['c_rehash'] . " $tmpDir/root-ca-eaponly/ > /dev/null"); |
|
| 673 | - system(CONFIG_DIAGNOSTICS['PATHS']['c_rehash'] . " $tmpDir/root-ca-allcerts/ > /dev/null"); |
|
| 672 | + system(CONFIG_DIAGNOSTICS['PATHS']['c_rehash']." $tmpDir/root-ca-eaponly/ > /dev/null"); |
|
| 673 | + system(CONFIG_DIAGNOSTICS['PATHS']['c_rehash']." $tmpDir/root-ca-allcerts/ > /dev/null"); |
|
| 674 | 674 | return $checkstring; |
| 675 | 675 | } |
| 676 | 676 | |
@@ -701,12 +701,12 @@ discard block |
||
| 701 | 701 | // the error log will complain if we run this test against an empty file of certs |
| 702 | 702 | // so test if there's something PEMy in the file at all |
| 703 | 703 | if (filesize("$tmpDir/serverchain.pem") > 10) { |
| 704 | - exec(CONFIG['PATHS']['openssl'] . " verify $crlCheckString -CApath $tmpDir/root-ca-eaponly/ -purpose any $tmpDir/incomingserver.pem", $verifyResultEaponly); |
|
| 705 | - $this->loggerInstance->debug(4, CONFIG['PATHS']['openssl'] . " verify $crlCheckString -CApath $tmpDir/root-ca-eaponly/ -purpose any $tmpDir/serverchain.pem\n"); |
|
| 706 | - $this->loggerInstance->debug(4, "Chain verify pass 1: " . print_r($verifyResultEaponly, TRUE) . "\n"); |
|
| 707 | - exec(CONFIG['PATHS']['openssl'] . " verify $crlCheckString -CApath $tmpDir/root-ca-allcerts/ -purpose any $tmpDir/incomingserver.pem", $verifyResultAllcerts); |
|
| 708 | - $this->loggerInstance->debug(4, CONFIG['PATHS']['openssl'] . " verify $crlCheckString -CApath $tmpDir/root-ca-allcerts/ -purpose any $tmpDir/serverchain.pem\n"); |
|
| 709 | - $this->loggerInstance->debug(4, "Chain verify pass 2: " . print_r($verifyResultAllcerts, TRUE) . "\n"); |
|
| 704 | + exec(CONFIG['PATHS']['openssl']." verify $crlCheckString -CApath $tmpDir/root-ca-eaponly/ -purpose any $tmpDir/incomingserver.pem", $verifyResultEaponly); |
|
| 705 | + $this->loggerInstance->debug(4, CONFIG['PATHS']['openssl']." verify $crlCheckString -CApath $tmpDir/root-ca-eaponly/ -purpose any $tmpDir/serverchain.pem\n"); |
|
| 706 | + $this->loggerInstance->debug(4, "Chain verify pass 1: ".print_r($verifyResultEaponly, TRUE)."\n"); |
|
| 707 | + exec(CONFIG['PATHS']['openssl']." verify $crlCheckString -CApath $tmpDir/root-ca-allcerts/ -purpose any $tmpDir/incomingserver.pem", $verifyResultAllcerts); |
|
| 708 | + $this->loggerInstance->debug(4, CONFIG['PATHS']['openssl']." verify $crlCheckString -CApath $tmpDir/root-ca-allcerts/ -purpose any $tmpDir/serverchain.pem\n"); |
|
| 709 | + $this->loggerInstance->debug(4, "Chain verify pass 2: ".print_r($verifyResultAllcerts, TRUE)."\n"); |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | // we are UNHAPPY if no names match! |
| 773 | 773 | $happiness = "UNHAPPY"; |
| 774 | 774 | foreach ($this->expectedServerNames as $expectedName) { |
| 775 | - $this->loggerInstance->debug(4, "Managing expectations for $expectedName: " . print_r($servercert['CN'], TRUE) . print_r($servercert['sAN_DNS'], TRUE)); |
|
| 775 | + $this->loggerInstance->debug(4, "Managing expectations for $expectedName: ".print_r($servercert['CN'], TRUE).print_r($servercert['sAN_DNS'], TRUE)); |
|
| 776 | 776 | if (array_search($expectedName, $servercert['CN']) !== FALSE && array_search($expectedName, $servercert['sAN_DNS']) !== FALSE) { |
| 777 | 777 | $this->loggerInstance->debug(4, "Totally happy!"); |
| 778 | 778 | $happiness = "TOTALLY"; |
@@ -816,11 +816,11 @@ discard block |
||
| 816 | 816 | $theconfigs = $this->wpaSupplicantConfig($eaptype, $finalInner, $finalOuter, $password); |
| 817 | 817 | // the config intentionally does not include CA checking. We do this |
| 818 | 818 | // ourselves after getting the chain with -o. |
| 819 | - file_put_contents($tmpDir . "/udp_login_test.conf", $theconfigs[0]); |
|
| 819 | + file_put_contents($tmpDir."/udp_login_test.conf", $theconfigs[0]); |
|
| 820 | 820 | |
| 821 | 821 | $cmdline = $this->eapolTestConfig($probeindex, $opnameCheck, $frag); |
| 822 | 822 | $this->loggerInstance->debug(4, "Shallow reachability check cmdline: $cmdline\n"); |
| 823 | - $this->loggerInstance->debug(4, "Shallow reachability check config: $tmpDir\n" . $theconfigs[1] . "\n"); |
|
| 823 | + $this->loggerInstance->debug(4, "Shallow reachability check config: $tmpDir\n".$theconfigs[1]."\n"); |
|
| 824 | 824 | $time_start = microtime(true); |
| 825 | 825 | $pflow = []; |
| 826 | 826 | exec($cmdline, $pflow); |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | if ($packetflow[count($packetflow) - 1] == 3 && $this->checkLineparse($packetflow_orig, self::LINEPARSE_CHECK_REJECTIGNORE)) { |
| 864 | 864 | array_pop($packetflow); |
| 865 | 865 | } |
| 866 | - $this->loggerInstance->debug(5, "Packetflow: " . print_r($packetflow, TRUE)); |
|
| 866 | + $this->loggerInstance->debug(5, "Packetflow: ".print_r($packetflow, TRUE)); |
|
| 867 | 867 | $packetcount = array_count_values($packetflow); |
| 868 | 868 | $testresults['packetcount'] = $packetcount; |
| 869 | 869 | $testresults['packetflow'] = $packetflow; |
@@ -941,7 +941,7 @@ discard block |
||
| 941 | 941 | $x509 = new \core\common\X509(); |
| 942 | 942 | $eapCertArray = []; |
| 943 | 943 | // $eap_certarray holds all certs received in EAP conversation |
| 944 | - $incomingData = file_get_contents($tmpDir . "/serverchain.pem"); |
|
| 944 | + $incomingData = file_get_contents($tmpDir."/serverchain.pem"); |
|
| 945 | 945 | if ($incomingData !== FALSE) { |
| 946 | 946 | $eapCertArray = $x509->splitCertificate($incomingData); |
| 947 | 947 | } |
@@ -968,10 +968,10 @@ discard block |
||
| 968 | 968 | case RADIUSTests::SERVER_CA_SELFSIGNED: |
| 969 | 969 | $servercert[] = $cert; |
| 970 | 970 | if (count($servercert) == 1) { |
| 971 | - if (file_put_contents($tmpDir . "/incomingserver.pem", $certPem . "\n") === FALSE) { |
|
| 971 | + if (file_put_contents($tmpDir."/incomingserver.pem", $certPem."\n") === FALSE) { |
|
| 972 | 972 | $this->loggerInstance->debug(4, "The (first) server certificate could not be written to $tmpDir/incomingserver.pem!\n"); |
| 973 | 973 | } |
| 974 | - $this->loggerInstance->debug(4, "This is the (first) server certificate, with CRL content if applicable: " . print_r($servercert[0], true)); |
|
| 974 | + $this->loggerInstance->debug(4, "This is the (first) server certificate, with CRL content if applicable: ".print_r($servercert[0], true)); |
|
| 975 | 975 | } elseif (!in_array(RADIUSTests::CERTPROB_TOO_MANY_SERVER_CERTS, $testresults['cert_oddities'])) { |
| 976 | 976 | $testresults['cert_oddities'][] = RADIUSTests::CERTPROB_TOO_MANY_SERVER_CERTS; |
| 977 | 977 | } |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | chdir($tmpDir); |
| 1052 | 1052 | $this->loggerInstance->debug(4, "temp dir: $tmpDir\n"); |
| 1053 | 1053 | if ($clientcertdata !== NULL) { |
| 1054 | - file_put_contents($tmpDir . "/client.p12", $clientcertdata); |
|
| 1054 | + file_put_contents($tmpDir."/client.p12", $clientcertdata); |
|
| 1055 | 1055 | } |
| 1056 | 1056 | $testresults = []; |
| 1057 | 1057 | // initialise the sub-array for cleaner parsing |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | 'issuer' => $this->printDN($certdata['issuer']), |
| 1148 | 1148 | 'validFrom' => $this->printTm($certdata['validFrom_time_t']), |
| 1149 | 1149 | 'validTo' => $this->printTm($certdata['validTo_time_t']), |
| 1150 | - 'serialNumber' => $certdata['serialNumber'] . sprintf(" (0x%X)", $certdata['serialNumber']), |
|
| 1150 | + 'serialNumber' => $certdata['serialNumber'].sprintf(" (0x%X)", $certdata['serialNumber']), |
|
| 1151 | 1151 | 'sha1' => $certdata['sha1'], |
| 1152 | 1152 | 'extensions' => $certdata['extensions'] |
| 1153 | 1153 | ]; |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | $this->possibleFailureReasons = $_SESSION["SUSPECTS"] ?? []; // if we know nothing, don't talk to anyone |
| 105 | 105 | $this->additionalFindings = $_SESSION["EVIDENCE"] ?? []; |
| 106 | 106 | |
| 107 | - $this->subjectPrefix = _("[eduroam Diagnostics]") . " "; |
|
| 107 | + $this->subjectPrefix = _("[eduroam Diagnostics]")." "; |
|
| 108 | 108 | $this->finalGreeting = "\n" |
| 109 | 109 | . _("(This service is in an early stage. We apologise if this is a false alert. If this is the case, please send an email report to [email protected], forwarding the entire message (including the 'SUSPECTS' and 'EVIDENCE' data at the end), and explain why this is a false positive.)") |
| 110 | 110 | . "\n" |
| 111 | - . _("Yours sincerely,") . "\n" |
|
| 111 | + . _("Yours sincerely,")."\n" |
|
| 112 | 112 | . "\n" |
| 113 | 113 | . _("Ed U. Roam, the eduroam diagnostics algorithm"); |
| 114 | 114 | |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | "bcc" => [], |
| 120 | 120 | "reply-to" => [Logopath::EDUROAM_OT], |
| 121 | 121 | "subject" => _("[POLICYVIOLATION NATIONAL] IdP with no entry in eduroam database"), |
| 122 | - "body" => _("Dear NRO administrator,") . "\n" |
|
| 122 | + "body" => _("Dear NRO administrator,")."\n" |
|
| 123 | 123 | . "\n" |
| 124 | - . wordwrap(sprintf(_("an end-user requested diagnostics for realm %s. Real-time connectivity checks determined that the realm exists, but we were unable to find an IdP with that realm in the eduroam database."), "foo.bar")) . "\n" |
|
| 124 | + . wordwrap(sprintf(_("an end-user requested diagnostics for realm %s. Real-time connectivity checks determined that the realm exists, but we were unable to find an IdP with that realm in the eduroam database."), "foo.bar"))."\n" |
|
| 125 | 125 | . "\n" |
| 126 | - . _("By not listing IdPs in the eduroam database, you are violating the eduroam policy.") . "\n" |
|
| 126 | + . _("By not listing IdPs in the eduroam database, you are violating the eduroam policy.")."\n" |
|
| 127 | 127 | . "\n" |
| 128 | - . _("Additionally, this creates operational issues. In particular, we are unable to direct end users to their IdP for further diagnosis/instructions because there are no contact points for that IdP in the database.") . "\n" |
|
| 128 | + . _("Additionally, this creates operational issues. In particular, we are unable to direct end users to their IdP for further diagnosis/instructions because there are no contact points for that IdP in the database.")."\n" |
|
| 129 | 129 | . "\n" |
| 130 | 130 | . "Please stop the policy violation ASAP by listing the IdP which is associated to this realm.", |
| 131 | 131 | ], |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | $handle = \core\common\OutsideComm::mailHandle(); |
| 281 | 281 | // let's identify outselves |
| 282 | - $handle->FromName = CONFIG['APPEARANCE']['productname'] . " Real-Time Diagnostics System"; |
|
| 282 | + $handle->FromName = CONFIG['APPEARANCE']['productname']." Real-Time Diagnostics System"; |
|
| 283 | 283 | // add recipients |
| 284 | 284 | foreach (Logopath::CATEGORYBINDING as $arrayName => $functionName) { |
| 285 | 285 | foreach ($theMail[$arrayName] as $onePrincipal) { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | use \Exception; |
| 25 | 25 | |
| 26 | -require_once dirname(dirname(__DIR__)) . "/config/_config.php"; |
|
| 26 | +require_once dirname(dirname(__DIR__))."/config/_config.php"; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * This class talks to end users, asking them annoying questions to get to the |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | 2 => ["AREA" => AbstractTest::INFRA_DEVICE, |
| 74 | 74 | "TXT" => _("Did the device previously work when roaming, i.e. at other hotspots away from your home institution?"), |
| 75 | 75 | "FACTOR" => 0.33, |
| 76 | - "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at your home organisation, but can not be used when roaming. %s"),$confAssistantText)], |
|
| 76 | + "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at your home organisation, but can not be used when roaming. %s"), $confAssistantText)], |
|
| 77 | 77 | 3 => ["AREA" => AbstractTest::INFRA_DEVICE, |
| 78 | 78 | "TXT" => _("Did you recently change the configuration on your device?"), |
| 79 | 79 | "FACTOR" => 3, |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | $questionDetails = $this->qaArray[$questionNumber]; |
| 114 | 114 | if ($answer === TRUE) { |
| 115 | 115 | $this->possibleFailureReasons[$questionDetails['AREA']] = $this->possibleFailureReasons[$questionDetails['AREA']] * $questionDetails["FACTOR"]; |
| 116 | - $this->loggerInstance->debug(3,"Adjusting ".$questionDetails['AREA']." by ".$questionDetails["FACTOR"]."\n"); |
|
| 116 | + $this->loggerInstance->debug(3, "Adjusting ".$questionDetails['AREA']." by ".$questionDetails["FACTOR"]."\n"); |
|
| 117 | 117 | $factor = $questionDetails["FACTOR"]; |
| 118 | 118 | } elseif ($answer === FALSE) { |
| 119 | 119 | $this->possibleFailureReasons[$questionDetails['AREA']] = $this->possibleFailureReasons[$questionDetails['AREA']] / $questionDetails["FACTOR"]; |
| 120 | - $this->loggerInstance->debug(3,"Adjusting ".$questionDetails['AREA']." by 1/".$questionDetails["FACTOR"]."\n"); |
|
| 121 | - $factor = 1/$questionDetails["FACTOR"]; |
|
| 120 | + $this->loggerInstance->debug(3, "Adjusting ".$questionDetails['AREA']." by 1/".$questionDetails["FACTOR"]."\n"); |
|
| 121 | + $factor = 1 / $questionDetails["FACTOR"]; |
|
| 122 | 122 | } else { |
| 123 | 123 | $factor = 1; |
| 124 | 124 | } |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | $this->additionalFindings["QUESTIONSASKED"] = $this->previousQuestions; |
| 128 | 128 | $_SESSION["SUSPECTS"] = $this->possibleFailureReasons; |
| 129 | 129 | $_SESSION["EVIDENCE"] = $this->additionalFindings; |
| 130 | - $this->loggerInstance->debug(3,$_SESSION['SUSPECTS']); |
|
| 131 | - $this->loggerInstance->debug(3,$_SESSION['EVIDENCE']); |
|
| 130 | + $this->loggerInstance->debug(3, $_SESSION['SUSPECTS']); |
|
| 131 | + $this->loggerInstance->debug(3, $_SESSION['EVIDENCE']); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | // if both are identical, take any of the questions in the pool of both |
| 148 | 148 | foreach ($this->qaArray as $questionNumber => $questionDetails) { |
| 149 | 149 | // if we find a question we didn't ask before AND it is related to our currently high-scoring problem area, ask it |
| 150 | - if (!array_key_exists($questionNumber, $this->previousQuestions) && ( $questionDetails["AREA"] == $highestCategory || $questionDetails["AREA"] == $nextCategory) ) { |
|
| 150 | + if (!array_key_exists($questionNumber, $this->previousQuestions) && ($questionDetails["AREA"] == $highestCategory || $questionDetails["AREA"] == $nextCategory)) { |
|
| 151 | 151 | return json_encode(["NEXTEXISTS" => TRUE, "NUMBER" => $questionNumber, "TEXT" => $questionDetails["TXT"]]); |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @return string JSON encoded array with all the info we have |
| 161 | 161 | */ |
| 162 | 162 | public function getCurrentGuessState() { |
| 163 | - return json_encode([ "SUSPECTS" => $this->possibleFailureReasons, "EVIDENCE" => $this->additionalFindings ]); |
|
| 163 | + return json_encode(["SUSPECTS" => $this->possibleFailureReasons, "EVIDENCE" => $this->additionalFindings]); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | use \Exception; |
| 25 | 25 | |
| 26 | -require_once dirname(dirname(__DIR__)) . "/config/_config.php"; |
|
| 26 | +require_once dirname(dirname(__DIR__))."/config/_config.php"; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * The overall coordination class that runs all kinds of tests to find out where |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | if ($this->idPFederation === NULL && preg_match("/\.(..)$/", $realm, $matches)) { |
| 76 | 76 | $this->idPFederation = strtoupper($matches[1]); |
| 77 | 77 | } |
| 78 | - $this->loggerInstance->debug(4, "XYZ: IdP-side NRO is " . $this->idPFederation . "\n"); |
|
| 78 | + $this->loggerInstance->debug(4, "XYZ: IdP-side NRO is ".$this->idPFederation."\n"); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /* The eduroam OT monitoring has the following return codes: |
@@ -397,12 +397,12 @@ discard block |
||
| 397 | 397 | break; |
| 398 | 398 | case \core\AbstractProfile::READINESS_LEVEL_NOTREADY: |
| 399 | 399 | $this->additionalFindings[AbstractTest::INFRA_IDP_RADIUS][] = ["Profile" => "UNCONCLUSIVE"]; |
| 400 | - $this->testsuite = new RADIUSTests($this->realm, "anonymous@" . $this->realm); |
|
| 400 | + $this->testsuite = new RADIUSTests($this->realm, "anonymous@".$this->realm); |
|
| 401 | 401 | break; |
| 402 | 402 | default: |
| 403 | 403 | } |
| 404 | 404 | } else { |
| 405 | - $this->testsuite = new RADIUSTests($this->realm, "anonymous@" . $this->realm); |
|
| 405 | + $this->testsuite = new RADIUSTests($this->realm, "anonymous@".$this->realm); |
|
| 406 | 406 | } |
| 407 | 407 | } |
| 408 | 408 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | use \Exception; |
| 25 | 25 | |
| 26 | -require_once dirname(dirname(__DIR__)) . "/config/_config.php"; |
|
| 26 | +require_once dirname(dirname(__DIR__))."/config/_config.php"; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Test suite to verify that a given NAI realm has NAPTR records according to |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $this->TLS_clients_checks_result[$host]['ca'][$type]['certificate'][$k]['status'] = $cert['status']; |
| 145 | 145 | $this->TLS_clients_checks_result[$host]['ca'][$type]['certificate'][$k]['message'] = $this->TLS_certkeys[$cert['status']]; |
| 146 | 146 | $this->TLS_clients_checks_result[$host]['ca'][$type]['certificate'][$k]['expected'] = $cert['expected']; |
| 147 | - $add = ' -cert ' . ROOT . '/config/cli-certs/' . $cert['public'] . ' -key ' . ROOT . '/config/cli-certs/' . $cert['private']; |
|
| 147 | + $add = ' -cert '.ROOT.'/config/cli-certs/'.$cert['public'].' -key '.ROOT.'/config/cli-certs/'.$cert['private']; |
|
| 148 | 148 | if (!isset($this->TLS_clients_checks_result[$host]['ca'][$type]['certificate'][$k])) { |
| 149 | 149 | $this->TLS_clients_checks_result[$host]['ca'][$type]['certificate'][$k] = []; |
| 150 | 150 | } |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | // but code analysers want this more explicit, so here is this extra |
| 189 | 189 | // call to escapeshellarg() |
| 190 | 190 | $escapedHost = escapeshellarg($host); |
| 191 | - $this->loggerInstance->debug(4, CONFIG['PATHS']['openssl'] . " s_client -connect " . $escapedHost . " -tls1 -CApath " . ROOT . "/config/ca-certs/ $arg 2>&1\n"); |
|
| 191 | + $this->loggerInstance->debug(4, CONFIG['PATHS']['openssl']." s_client -connect ".$escapedHost." -tls1 -CApath ".ROOT."/config/ca-certs/ $arg 2>&1\n"); |
|
| 192 | 192 | $time_start = microtime(true); |
| 193 | 193 | $opensslbabble = []; |
| 194 | 194 | $result = 999; // likely to become zero by openssl; don't want to initialise to zero, could cover up exec failures |
| 195 | - exec(CONFIG['PATHS']['openssl'] . " s_client -connect " . $escapedHost . " -tls1 -CApath " . ROOT . "/config/ca-certs/ $arg 2>&1", $opensslbabble, $result); |
|
| 195 | + exec(CONFIG['PATHS']['openssl']." s_client -connect ".$escapedHost." -tls1 -CApath ".ROOT."/config/ca-certs/ $arg 2>&1", $opensslbabble, $result); |
|
| 196 | 196 | $time_stop = microtime(true); |
| 197 | 197 | $testresults['time_millisec'] = floor(($time_stop - $time_start) * 1000); |
| 198 | 198 | $testresults['returncode'] = $result; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | namespace core\diag; |
| 23 | 23 | |
| 24 | -require_once dirname(dirname(__DIR__)) . "/config/_config.php"; |
|
| 24 | +require_once dirname(dirname(__DIR__))."/config/_config.php"; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Test suite to verify that a given NAI realm has NAPTR records according to |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $this->NAPTR_executed = RADIUSTests::RETVAL_NOTCONFIGURED; |
| 170 | 170 | return RADIUSTests::RETVAL_NOTCONFIGURED; |
| 171 | 171 | } |
| 172 | - $NAPTRs = dns_get_record($this->realm . ".", DNS_NAPTR); |
|
| 172 | + $NAPTRs = dns_get_record($this->realm.".", DNS_NAPTR); |
|
| 173 | 173 | if ($NAPTRs === FALSE || count($NAPTRs) == 0) { |
| 174 | 174 | $this->NAPTR_executed = RFC7585Tests::RETVAL_NONAPTR; |
| 175 | 175 | return RFC7585Tests::RETVAL_NONAPTR; |
@@ -142,17 +142,17 @@ discard block |
||
| 142 | 142 | foreach (array_keys($this->typeDb) as $name) { |
| 143 | 143 | if ($className === 0) { |
| 144 | 144 | $tempArray[] = $name; |
| 145 | - } elseif (preg_match('/^' . $className . ':/', $name) > 0) { |
|
| 145 | + } elseif (preg_match('/^'.$className.':/', $name) > 0) { |
|
| 146 | 146 | $tempArray[] = $name; |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | $returnArray = $tempArray; |
| 150 | 150 | // remove silverbullet-specific options if this deployment is not SB |
| 151 | 151 | foreach ($tempArray as $key => $val) { |
| 152 | - if (( CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_SILVERBULLET'] != 'LOCAL') && (preg_match('/^fed:silverbullet/', $val) > 0)) { |
|
| 152 | + if ((CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_SILVERBULLET'] != 'LOCAL') && (preg_match('/^fed:silverbullet/', $val) > 0)) { |
|
| 153 | 153 | unset($returnArray[$key]); |
| 154 | 154 | } |
| 155 | - if (( CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_RADIUS'] != 'LOCAL') && (preg_match('/^fed:minted_ca_file/', $val) > 0)) { |
|
| 155 | + if ((CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_RADIUS'] != 'LOCAL') && (preg_match('/^fed:minted_ca_file/', $val) > 0)) { |
|
| 156 | 156 | unset($returnArray[$key]); |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | if (isset($this->typeDb[$optionname])) { |
| 172 | 172 | return $this->typeDb[$optionname]; |
| 173 | 173 | } |
| 174 | - throw new Exception("Metadata about an option was requested, but the option name does not exist in the system: " . htmlentities($optionname)); |
|
| 174 | + throw new Exception("Metadata about an option was requested, but the option name does not exist in the system: ".htmlentities($optionname)); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | parent::__construct(); |
| 59 | 59 | $Dev = \devices\Devices::listDevices(); |
| 60 | 60 | if (isset($Dev[$blueprint])) { |
| 61 | - $this->loggerInstance->debug(4, "loaded: devices/" . $Dev[$blueprint]['directory'] . "/" . $Dev[$blueprint]['module'] . ".php\n"); |
|
| 62 | - $class_name = "\devices\\".$Dev[$blueprint]['directory']."\Device_" . $Dev[$blueprint]['module']; |
|
| 61 | + $this->loggerInstance->debug(4, "loaded: devices/".$Dev[$blueprint]['directory']."/".$Dev[$blueprint]['module'].".php\n"); |
|
| 62 | + $class_name = "\devices\\".$Dev[$blueprint]['directory']."\Device_".$Dev[$blueprint]['module']; |
|
| 63 | 63 | $this->device = new $class_name(); |
| 64 | 64 | if (!$this->device) { |
| 65 | 65 | $this->loggerInstance->debug(2, "module loading failed"); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } else { |
| 69 | 69 | print("unknown devicename:$blueprint\n"); |
| 70 | 70 | } |
| 71 | - $this->device->module_path = ROOT . '/devices/' . $Dev[$blueprint]['directory']; |
|
| 71 | + $this->device->module_path = ROOT.'/devices/'.$Dev[$blueprint]['directory']; |
|
| 72 | 72 | $this->device->signer = isset($Dev[$blueprint]['signer']) ? $Dev[$blueprint]['signer'] : 0; |
| 73 | 73 | $this->device->device_id = $blueprint; |
| 74 | 74 | $options = \devices\Devices::$Options; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | use \Exception; |
| 34 | 34 | |
| 35 | -require_once dirname(__DIR__) . "/config/_config.php"; |
|
| 35 | +require_once dirname(__DIR__)."/config/_config.php"; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * This class is a singleton for establishing a connection to the database |
@@ -59,14 +59,14 @@ discard block |
||
| 59 | 59 | case "USER": |
| 60 | 60 | case "EXTERNAL": |
| 61 | 61 | case "FRONTEND": |
| 62 | - if (!isset(self::${"instance" . $theDb})) { |
|
| 62 | + if (!isset(self::${"instance".$theDb})) { |
|
| 63 | 63 | $class = __CLASS__; |
| 64 | - self::${"instance" . $theDb} = new $class($database); |
|
| 65 | - DBConnection::${"instance" . $theDb}->databaseInstance = $theDb; |
|
| 64 | + self::${"instance".$theDb} = new $class($database); |
|
| 65 | + DBConnection::${"instance".$theDb}->databaseInstance = $theDb; |
|
| 66 | 66 | } |
| 67 | - return self::${"instance" . $theDb}; |
|
| 67 | + return self::${"instance".$theDb}; |
|
| 68 | 68 | default: |
| 69 | - throw new Exception("This type of database (" . strtoupper($database) . ") is not known!"); |
|
| 69 | + throw new Exception("This type of database (".strtoupper($database).") is not known!"); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
@@ -105,18 +105,18 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | // log exact query to debug log, if log level is at 5 |
| 108 | - $this->loggerInstance->debug(5, "DB ATTEMPT: " . $querystring . "\n"); |
|
| 108 | + $this->loggerInstance->debug(5, "DB ATTEMPT: ".$querystring."\n"); |
|
| 109 | 109 | if ($types !== NULL) { |
| 110 | - $this->loggerInstance->debug(5, "Argument type sequence: $types, parameters are: " . print_r($arguments, true)); |
|
| 110 | + $this->loggerInstance->debug(5, "Argument type sequence: $types, parameters are: ".print_r($arguments, true)); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if ($this->connection->connect_error) { |
| 114 | - throw new Exception("ERROR: Cannot send query to $this->databaseInstance database (no connection, error number" . $this->connection->connect_error . ")!"); |
|
| 114 | + throw new Exception("ERROR: Cannot send query to $this->databaseInstance database (no connection, error number".$this->connection->connect_error.")!"); |
|
| 115 | 115 | } |
| 116 | 116 | if ($types === NULL) { |
| 117 | 117 | $result = $this->connection->query($querystring); |
| 118 | 118 | if ($result === FALSE) { |
| 119 | - throw new Exception("DB: Unable to execute simple statement! Error was --> " . $this->connection->error . " <--"); |
|
| 119 | + throw new Exception("DB: Unable to execute simple statement! Error was --> ".$this->connection->error." <--"); |
|
| 120 | 120 | } |
| 121 | 121 | } else { |
| 122 | 122 | // fancy! prepared statement with dedicated argument list |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | $prepResult = $statementObject->prepare($querystring); |
| 131 | 131 | if ($prepResult === FALSE) { |
| 132 | - throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> " . $statementObject->error . " <--."); |
|
| 132 | + throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> ".$statementObject->error." <--."); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | // we have a variable number of arguments packed into the ... array |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | array_unshift($localArray, $types); |
| 142 | 142 | $retval = call_user_func_array([$statementObject, "bind_param"], $localArray); |
| 143 | 143 | if ($retval === FALSE) { |
| 144 | - throw new Exception("DB: Unable to bind parameters to prepared statement! Argument array was --> " . var_export($localArray, TRUE) . " <--. Error was --> " . $statementObject->error . " <--"); |
|
| 144 | + throw new Exception("DB: Unable to bind parameters to prepared statement! Argument array was --> ".var_export($localArray, TRUE)." <--. Error was --> ".$statementObject->error." <--"); |
|
| 145 | 145 | } |
| 146 | 146 | $result = $statementObject->execute(); |
| 147 | 147 | if ($result === FALSE) { |
| 148 | - throw new Exception("DB: Unable to execute prepared statement! Error was --> " . $statementObject->error . " <--"); |
|
| 148 | + throw new Exception("DB: Unable to execute prepared statement! Error was --> ".$statementObject->error." <--"); |
|
| 149 | 149 | } |
| 150 | 150 | $selectResult = $statementObject->get_result(); |
| 151 | 151 | if ($selectResult !== FALSE) { |
@@ -157,14 +157,14 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | // all cases where $result could be FALSE have been caught earlier |
| 159 | 159 | if ($this->connection->errno) { |
| 160 | - throw new Exception("ERROR: Cannot execute query in $this->databaseInstance database - (hopefully escaped) query was '$querystring', errno was " . $this->connection->errno . "!"); |
|
| 160 | + throw new Exception("ERROR: Cannot execute query in $this->databaseInstance database - (hopefully escaped) query was '$querystring', errno was ".$this->connection->errno."!"); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
| 164 | 164 | if ($isMoreThanSelect) { |
| 165 | - $this->loggerInstance->writeSQLAudit("[DB: " . strtoupper($this->databaseInstance) . "] " . $querystring); |
|
| 165 | + $this->loggerInstance->writeSQLAudit("[DB: ".strtoupper($this->databaseInstance)."] ".$querystring); |
|
| 166 | 166 | if ($types !== NULL) { |
| 167 | - $this->loggerInstance->writeSQLAudit("Argument type sequence: $types, parameters are: " . print_r($arguments, true)); |
|
| 167 | + $this->loggerInstance->writeSQLAudit("Argument type sequence: $types, parameters are: ".print_r($arguments, true)); |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | return $result; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $databaseCapitalised = strtoupper($database); |
| 242 | 242 | $this->connection = new \mysqli(CONFIG['DB'][$databaseCapitalised]['host'], CONFIG['DB'][$databaseCapitalised]['user'], CONFIG['DB'][$databaseCapitalised]['pass'], CONFIG['DB'][$databaseCapitalised]['db']); |
| 243 | 243 | if ($this->connection->connect_error) { |
| 244 | - throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ")."); |
|
| 244 | + throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number ".$this->connection->connect_errno.")."); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | if ($databaseCapitalised == "EXTERNAL" && CONFIG_CONFASSISTANT['CONSORTIUM']['name'] == "eduroam" && isset(CONFIG_CONFASSISTANT['CONSORTIUM']['deployment-voodoo']) && CONFIG_CONFASSISTANT['CONSORTIUM']['deployment-voodoo'] == "Operations Team") { |