@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | use GeoIp2\Database\Reader; |
| 50 | 50 | use \Exception; |
| 51 | 51 | |
| 52 | -require_once dirname(dirname(__FILE__)) . "/config/_config.php"; |
|
| 53 | -require_once dirname(dirname(__FILE__)) . "/core/PHPMailer/src/PHPMailer.php"; |
|
| 54 | -require_once dirname(dirname(__FILE__)) . "/core/PHPMailer/src/SMTP.php"; |
|
| 52 | +require_once dirname(dirname(__FILE__))."/config/_config.php"; |
|
| 53 | +require_once dirname(dirname(__FILE__))."/core/PHPMailer/src/PHPMailer.php"; |
|
| 54 | +require_once dirname(dirname(__FILE__))."/core/PHPMailer/src/SMTP.php"; |
|
| 55 | 55 | |
| 56 | 56 | class SanityTests extends CAT { |
| 57 | 57 | /* in this section set current CAT requirements */ |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $this->test_result = []; |
| 125 | 125 | $this->test_result['global'] = 0; |
| 126 | 126 | // parse the schema file to find out the number of expected rows... |
| 127 | - $schema = file(dirname(dirname(__FILE__)) . "/schema/schema.sql"); |
|
| 127 | + $schema = file(dirname(dirname(__FILE__))."/schema/schema.sql"); |
|
| 128 | 128 | $this->profile_option_ct = 0; |
| 129 | 129 | $passedTheWindmill = FALSE; |
| 130 | 130 | foreach ($schema as $schemaLine) { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | public function runTest($test) { |
| 151 | 151 | $this->out[$test] = []; |
| 152 | 152 | $this->name = $test; |
| 153 | - $m_name = 'test' . $test; |
|
| 153 | + $m_name = 'test'.$test; |
|
| 154 | 154 | $this->test_result[$test] = 0; |
| 155 | 155 | if (!method_exists($this, $m_name)) { |
| 156 | 156 | $this->storeTestResult(\core\common\Entity::L_ERROR, "Configuration error, no test configured for <strong>$test</strong>."); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $matchArray = []; |
| 239 | 239 | preg_match('/([^ ]+) ?/', $config['PATHS'][$pathToCheck], $matchArray); |
| 240 | 240 | $exe = $matchArray[1]; |
| 241 | - $the_path = exec("which " . $config['PATHS'][$pathToCheck]); |
|
| 241 | + $the_path = exec("which ".$config['PATHS'][$pathToCheck]); |
|
| 242 | 242 | if ($the_path == $exe) { |
| 243 | 243 | $exec_is = "EXPLICIT"; |
| 244 | 244 | } else { |
@@ -257,9 +257,9 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | private function testPhp() { |
| 259 | 259 | if (version_compare(phpversion(), $this->php_needversion, '>=')) { |
| 260 | - $this->storeTestResult(\core\common\Entity::L_OK, "<strong>PHP</strong> is sufficiently recent. You are running " . phpversion() . "."); |
|
| 260 | + $this->storeTestResult(\core\common\Entity::L_OK, "<strong>PHP</strong> is sufficiently recent. You are running ".phpversion()."."); |
|
| 261 | 261 | } else { |
| 262 | - $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>PHP</strong> is too old. We need at least $this->php_needversion, but you only have " . phpversion() . "."); |
|
| 262 | + $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>PHP</strong> is too old. We need at least $this->php_needversion, but you only have ".phpversion()."."); |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $this->storeTestResult(\core\common\Entity::L_OK, "<strong>cat_base_url</strong> set correctly"); |
| 276 | 276 | } else { |
| 277 | 277 | $rootFromScript = $m[1] === '' ? '/' : $m[1]; |
| 278 | - $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>cat_base_url</strong> is set to <strong>" . CONFIG['PATHS']['cat_base_url'] . "</strong> and should be <strong>$rootFromScript</strong>"); |
|
| 278 | + $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>cat_base_url</strong> is set to <strong>".CONFIG['PATHS']['cat_base_url']."</strong> and should be <strong>$rootFromScript</strong>"); |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | if (count($probeReturns) == 0) { |
| 296 | 296 | $this->storeTestResult(common\Entity::L_OK, "All configured RADIUS/UDP probes are reachable."); |
| 297 | 297 | } else { |
| 298 | - $this->storeTestResult(common\Entity::L_ERROR, "The following RADIUS probes are NOT reachable: ".implode(', ',$probeReturns)); |
|
| 298 | + $this->storeTestResult(common\Entity::L_ERROR, "The following RADIUS probes are NOT reachable: ".implode(', ', $probeReturns)); |
|
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | |
@@ -312,9 +312,9 @@ discard block |
||
| 312 | 312 | $SSPconfig = \SimpleSAML\Configuration::getInstance(); |
| 313 | 313 | $sspVersion = explode('.', $SSPconfig->getVersion()); |
| 314 | 314 | if ((int) $sspVersion[0] >= $this->ssp_needversion['major'] && (int) $sspVersion[1] >= $this->ssp_needversion['minor']) { |
| 315 | - $this->storeTestResult(\core\common\Entity::L_OK, "<strong>simpleSAMLphp</strong> is sufficently recent. You are running " . implode('.', $sspVersion)); |
|
| 315 | + $this->storeTestResult(\core\common\Entity::L_OK, "<strong>simpleSAMLphp</strong> is sufficently recent. You are running ".implode('.', $sspVersion)); |
|
| 316 | 316 | } else { |
| 317 | - $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>simpleSAMLphp</strong> is too old. We need at least " . implode('.', $this->ssp_needversion)); |
|
| 317 | + $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>simpleSAMLphp</strong> is too old. We need at least ".implode('.', $this->ssp_needversion)); |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | } |
@@ -368,8 +368,8 @@ discard block |
||
| 368 | 368 | * @return void |
| 369 | 369 | */ |
| 370 | 370 | private function testLogdir() { |
| 371 | - if (fopen(CONFIG['PATHS']['logdir'] . "/debug.log", "a") == FALSE) { |
|
| 372 | - $this->storeTestResult(\core\common\Entity::L_WARN, "Log files in <strong>" . CONFIG['PATHS']['logdir'] . "</strong> are not writable!"); |
|
| 371 | + if (fopen(CONFIG['PATHS']['logdir']."/debug.log", "a") == FALSE) { |
|
| 372 | + $this->storeTestResult(\core\common\Entity::L_WARN, "Log files in <strong>".CONFIG['PATHS']['logdir']."</strong> are not writable!"); |
|
| 373 | 373 | } else { |
| 374 | 374 | $this->storeTestResult(\core\common\Entity::L_OK, "Log directory is writable."); |
| 375 | 375 | } |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | private function testOpenssl() { |
| 494 | 494 | $A = $this->getExecPath('openssl'); |
| 495 | 495 | if ($A['exec'] != "") { |
| 496 | - $t = exec($A['exec'] . ' version'); |
|
| 496 | + $t = exec($A['exec'].' version'); |
|
| 497 | 497 | if ($A['exec_is'] == "EXPLICIT") { |
| 498 | 498 | $this->storeTestResult(\core\common\Entity::L_OK, "<strong>$t</strong> was found and is configured explicitly in your config."); |
| 499 | 499 | } else { |
@@ -520,14 +520,14 @@ discard block |
||
| 520 | 520 | } |
| 521 | 521 | $A = $this->getExecPath('makensis'); |
| 522 | 522 | if ($A['exec'] != "") { |
| 523 | - $t = exec($A['exec'] . ' -VERSION'); |
|
| 523 | + $t = exec($A['exec'].' -VERSION'); |
|
| 524 | 524 | if ($A['exec_is'] == "EXPLICIT") { |
| 525 | 525 | $this->storeTestResult(\core\common\Entity::L_OK, "<strong>makensis $t</strong> was found and is configured explicitly in your config."); |
| 526 | 526 | } else { |
| 527 | 527 | $this->storeTestResult(\core\common\Entity::L_WARN, "<strong>makensis $t</strong> was found, but is not configured with an absolute path in your config."); |
| 528 | 528 | } |
| 529 | 529 | $outputArray = []; |
| 530 | - exec($A['exec'] . ' -HELP', $outputArray); |
|
| 530 | + exec($A['exec'].' -HELP', $outputArray); |
|
| 531 | 531 | $t1 = count(preg_grep('/INPUTCHARSET/', $outputArray)); |
| 532 | 532 | if ($t1 == 1 && CONFIG_CONFASSISTANT['NSIS_VERSION'] == 2) { |
| 533 | 533 | $this->storeTestResult(\core\common\Entity::L_ERROR, "Declared NSIS_VERSION does not seem to match the file pointed to by PATHS['makensis']!"); |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | $NSIS_Module_status = []; |
| 557 | 557 | foreach ($this->NSIS_Modules as $module) { |
| 558 | 558 | unset($out); |
| 559 | - exec(CONFIG_CONFASSISTANT['PATHS']['makensis'] . " -V1 '-X!include $module' '-XOutFile $exe' '-XSection X' '-XSectionEnd'", $out, $retval); |
|
| 559 | + exec(CONFIG_CONFASSISTANT['PATHS']['makensis']." -V1 '-X!include $module' '-XOutFile $exe' '-XSection X' '-XSectionEnd'", $out, $retval); |
|
| 560 | 560 | if ($retval > 0) { |
| 561 | 561 | $NSIS_Module_status[$module] = 0; |
| 562 | 562 | } else { |
@@ -619,8 +619,8 @@ discard block |
||
| 619 | 619 | $locales = shell_exec("locale -a"); |
| 620 | 620 | $allthere = ""; |
| 621 | 621 | foreach (CONFIG['LANGUAGES'] as $onelanguage) { |
| 622 | - if (preg_match("/" . $onelanguage['locale'] . "/", $locales) == 0) { |
|
| 623 | - $allthere .= $onelanguage['locale'] . " "; |
|
| 622 | + if (preg_match("/".$onelanguage['locale']."/", $locales) == 0) { |
|
| 623 | + $allthere .= $onelanguage['locale']." "; |
|
| 624 | 624 | } |
| 625 | 625 | } |
| 626 | 626 | if ($allthere == "") { |
@@ -634,47 +634,47 @@ discard block |
||
| 634 | 634 | ["SETTING" => CONFIG['APPEARANCE']['from-mail'], |
| 635 | 635 | "DEFVALUE" => "[email protected]", |
| 636 | 636 | "COMPLAINTSTRING" => "APPEARANCE/from-mail ", |
| 637 | - "REQUIRED" => FALSE,], |
|
| 637 | + "REQUIRED" => FALSE, ], |
|
| 638 | 638 | ["SETTING" => CONFIG['APPEARANCE']['support-contact']['url'], |
| 639 | 639 | "DEFVALUE" => "[email protected]?body=Only%20English%20language%20please!", |
| 640 | 640 | "COMPLAINTSTRING" => "APPEARANCE/support-contact/url ", |
| 641 | - "REQUIRED" => FALSE,], |
|
| 641 | + "REQUIRED" => FALSE, ], |
|
| 642 | 642 | ["SETTING" => CONFIG['APPEARANCE']['support-contact']['display'], |
| 643 | 643 | "DEFVALUE" => "[email protected]", |
| 644 | 644 | "COMPLAINTSTRING" => "APPEARANCE/support-contact/display ", |
| 645 | - "REQUIRED" => FALSE,], |
|
| 645 | + "REQUIRED" => FALSE, ], |
|
| 646 | 646 | ["SETTING" => CONFIG['APPEARANCE']['support-contact']['developer-mail'], |
| 647 | 647 | "DEFVALUE" => "[email protected]", |
| 648 | 648 | "COMPLAINTSTRING" => "APPEARANCE/support-contact/mail ", |
| 649 | - "REQUIRED" => FALSE,], |
|
| 649 | + "REQUIRED" => FALSE, ], |
|
| 650 | 650 | ["SETTING" => CONFIG['APPEARANCE']['abuse-mail'], |
| 651 | 651 | "DEFVALUE" => "[email protected]", |
| 652 | 652 | "COMPLAINTSTRING" => "APPEARANCE/abuse-mail ", |
| 653 | - "REQUIRED" => FALSE,], |
|
| 653 | + "REQUIRED" => FALSE, ], |
|
| 654 | 654 | ["SETTING" => CONFIG['APPEARANCE']['MOTD'], |
| 655 | 655 | "DEFVALUE" => "Release Candidate. All bugs to be shot on sight!", |
| 656 | 656 | "COMPLAINTSTRING" => "APPEARANCE/MOTD ", |
| 657 | - "REQUIRED" => FALSE,], |
|
| 657 | + "REQUIRED" => FALSE, ], |
|
| 658 | 658 | ["SETTING" => CONFIG['APPEARANCE']['webcert_CRLDP'], |
| 659 | 659 | "DEFVALUE" => ['list', 'of', 'CRL', 'pointers'], |
| 660 | 660 | "COMPLAINTSTRING" => "APPEARANCE/webcert_CRLDP ", |
| 661 | - "REQUIRED" => TRUE,], |
|
| 661 | + "REQUIRED" => TRUE, ], |
|
| 662 | 662 | ["SETTING" => CONFIG['APPEARANCE']['webcert_OCSP'], |
| 663 | 663 | "DEFVALUE" => ['list', 'of', 'OCSP', 'pointers'], |
| 664 | 664 | "COMPLAINTSTRING" => "APPEARANCE/webcert_OCSP ", |
| 665 | - "REQUIRED" => TRUE,], |
|
| 665 | + "REQUIRED" => TRUE, ], |
|
| 666 | 666 | ["SETTING" => CONFIG['DB']['INST']['host'], |
| 667 | 667 | "DEFVALUE" => "db.host.example", |
| 668 | 668 | "COMPLAINTSTRING" => "DB/INST ", |
| 669 | - "REQUIRED" => TRUE,], |
|
| 669 | + "REQUIRED" => TRUE, ], |
|
| 670 | 670 | ["SETTING" => CONFIG['DB']['INST']['host'], |
| 671 | 671 | "DEFVALUE" => "db.host.example", |
| 672 | 672 | "COMPLAINTSTRING" => "DB/USER ", |
| 673 | - "REQUIRED" => TRUE,], |
|
| 673 | + "REQUIRED" => TRUE, ], |
|
| 674 | 674 | ["SETTING" => CONFIG['DB']['EXTERNAL']['host'], |
| 675 | 675 | "DEFVALUE" => "customerdb.otherhost.example", |
| 676 | 676 | "COMPLAINTSTRING" => "DB/EXTERNAL ", |
| 677 | - "REQUIRED" => FALSE,], |
|
| 677 | + "REQUIRED" => FALSE, ], |
|
| 678 | 678 | ]; |
| 679 | 679 | |
| 680 | 680 | /** |
@@ -700,11 +700,11 @@ discard block |
||
| 700 | 700 | |
| 701 | 701 | foreach (CONFIG_DIAGNOSTICS['RADIUSTESTS']['TLS-clientcerts'] as $cadata) { |
| 702 | 702 | foreach ($cadata['certificates'] as $cert_files) { |
| 703 | - if (file_get_contents(ROOT . "/config/cli-certs/" . $cert_files['public']) === FALSE) { |
|
| 704 | - $defaultvalues .= "CERTIFICATE/" . $cert_files['public'] . " "; |
|
| 703 | + if (file_get_contents(ROOT."/config/cli-certs/".$cert_files['public']) === FALSE) { |
|
| 704 | + $defaultvalues .= "CERTIFICATE/".$cert_files['public']." "; |
|
| 705 | 705 | } |
| 706 | - if (file_get_contents(ROOT . "/config/cli-certs/" . $cert_files['private']) === FALSE) { |
|
| 707 | - $defaultvalues .= "CERTIFICATE/" . $cert_files['private'] . " "; |
|
| 706 | + if (file_get_contents(ROOT."/config/cli-certs/".$cert_files['private']) === FALSE) { |
|
| 707 | + $defaultvalues .= "CERTIFICATE/".$cert_files['private']." "; |
|
| 708 | 708 | } |
| 709 | 709 | } |
| 710 | 710 | } |
@@ -794,14 +794,14 @@ discard block |
||
| 794 | 794 | if ($global_no_cache) { |
| 795 | 795 | foreach ($Devs as $dev => $D) { |
| 796 | 796 | if (empty($D['options']['no_cache']) || $D['options']['no_cache'] != 0) { |
| 797 | - $no_cache_dev .= $dev . " "; |
|
| 797 | + $no_cache_dev .= $dev." "; |
|
| 798 | 798 | $no_cache_dev_count++; |
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | 801 | } else { |
| 802 | 802 | foreach ($Devs as $dev => $D) { |
| 803 | 803 | if (!empty($D['options']['no_cache']) && $D['options']['no_cache'] != 0) { |
| 804 | - $no_cache_dev .= $dev . " "; |
|
| 804 | + $no_cache_dev .= $dev." "; |
|
| 805 | 805 | $no_cache_dev_count++; |
| 806 | 806 | } |
| 807 | 807 | } |
@@ -839,13 +839,13 @@ discard block |
||
| 839 | 839 | $mail->isHTML(FALSE); |
| 840 | 840 | $mail->CharSet = 'UTF-8'; |
| 841 | 841 | $mail->From = CONFIG['APPEARANCE']['from-mail']; |
| 842 | - $mail->FromName = CONFIG['APPEARANCE']['productname'] . " Invitation System"; |
|
| 842 | + $mail->FromName = CONFIG['APPEARANCE']['productname']." Invitation System"; |
|
| 843 | 843 | $mail->addAddress(CONFIG['APPEARANCE']['abuse-mail']); |
| 844 | 844 | $mail->Subject = "testing CAT configuration mail"; |
| 845 | 845 | $mail->Body = "Testing CAT mailing\n"; |
| 846 | 846 | $sent = $mail->send(); |
| 847 | 847 | if ($sent) { |
| 848 | - $this->storeTestResult(\core\common\Entity::L_OK, "mailer settings appear to be working, check " . CONFIG['APPEARANCE']['abuse-mail'] . " mailbox if the message was receiced."); |
|
| 848 | + $this->storeTestResult(\core\common\Entity::L_OK, "mailer settings appear to be working, check ".CONFIG['APPEARANCE']['abuse-mail']." mailbox if the message was receiced."); |
|
| 849 | 849 | } else { |
| 850 | 850 | $this->storeTestResult(\core\common\Entity::L_ERROR, "mailer settings failed, check the Config::MAILSETTINGS"); |
| 851 | 851 | } |