| @@ -129,7 +129,7 @@ discard block | ||
| 129 | 129 | $this->test_result = []; | 
| 130 | 130 | $this->test_result['global'] = 0; | 
| 131 | 131 | // parse the schema file to find out the number of expected rows... | 
| 132 | - $schema = file(dirname(dirname(__FILE__)) . "/schema/schema.sql"); | |
| 132 | + $schema = file(dirname(dirname(__FILE__))."/schema/schema.sql"); | |
| 133 | 133 | $this->profileOptionCount = 0; | 
| 134 | 134 | $passedTheWindmill = FALSE; | 
| 135 | 135 |          foreach ($schema as $schemaLine) { | 
| @@ -156,7 +156,7 @@ discard block | ||
| 156 | 156 |      { | 
| 157 | 157 | $this->out[$test] = []; | 
| 158 | 158 | $this->name = $test; | 
| 159 | - $m_name = 'test' . $test; | |
| 159 | + $m_name = 'test'.$test; | |
| 160 | 160 | $this->test_result[$test] = 0; | 
| 161 | 161 |          if (!method_exists($this, $m_name)) { | 
| 162 | 162 | $this->storeTestResult(\core\common\Entity::L_ERROR, "Configuration error, no test configured for <strong>$test</strong>."); | 
| @@ -269,9 +269,9 @@ discard block | ||
| 269 | 269 | private function testPhp() | 
| 270 | 270 |      { | 
| 271 | 271 |          if (version_compare(phpversion(), $this->needversionPHP, '>=')) { | 
| 272 | - $this->storeTestResult(\core\common\Entity::L_OK, "<strong>PHP</strong> is sufficiently recent. You are running " . phpversion() . "."); | |
| 272 | + $this->storeTestResult(\core\common\Entity::L_OK, "<strong>PHP</strong> is sufficiently recent. You are running ".phpversion()."."); | |
| 273 | 273 |          } else { | 
| 274 | - $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>PHP</strong> is too old. We need at least $this->needversionPHP, but you only have " . phpversion() . "."); | |
| 274 | + $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>PHP</strong> is too old. We need at least $this->needversionPHP, but you only have ".phpversion()."."); | |
| 275 | 275 | } | 
| 276 | 276 | } | 
| 277 | 277 | |
| @@ -284,12 +284,12 @@ discard block | ||
| 284 | 284 | */ | 
| 285 | 285 | private function runConstantsTest($config) | 
| 286 | 286 |      { | 
| 287 | - $templateConfig = file_get_contents(ROOT . "/config/$config-template.php"); | |
| 288 | -        $newTemplateConfig = preg_replace("/class *$config/", "class $config" . "_template", $templateConfig); | |
| 289 | - file_put_contents(ROOT . "/var/tmp/$config-template.php", $newTemplateConfig); | |
| 290 | - include(ROOT . "/var/tmp/$config-template.php"); | |
| 291 | - unlink(ROOT . "/var/tmp/$config-template.php"); | |
| 292 | -        $rft = new \ReflectionClass("\config\\$config" . "_template"); | |
| 287 | + $templateConfig = file_get_contents(ROOT."/config/$config-template.php"); | |
| 288 | +        $newTemplateConfig = preg_replace("/class *$config/", "class $config"."_template", $templateConfig); | |
| 289 | + file_put_contents(ROOT."/var/tmp/$config-template.php", $newTemplateConfig); | |
| 290 | + include(ROOT."/var/tmp/$config-template.php"); | |
| 291 | + unlink(ROOT."/var/tmp/$config-template.php"); | |
| 292 | +        $rft = new \ReflectionClass("\config\\$config"."_template"); | |
| 293 | 293 | $templateConstants = $rft->getConstants(); | 
| 294 | 294 | $failResults = []; | 
| 295 | 295 |          foreach ($templateConstants as $constant => $value) { | 
| @@ -306,7 +306,7 @@ discard block | ||
| 306 | 306 | * Check if all required constants are set | 
| 307 | 307 | */ | 
| 308 | 308 |      private function testConfigConstants() { | 
| 309 | -        set_error_handler(function ($severity, $message, $file, $line) { | |
| 309 | +        set_error_handler(function($severity, $message, $file, $line) { | |
| 310 | 310 | throw new \ErrorException($message, $severity, $severity, $file, $line); | 
| 311 | 311 | }); | 
| 312 | 312 | |
| @@ -317,7 +317,7 @@ discard block | ||
| 317 | 317 | $failCount = $failCount + count($failResults); | 
| 318 | 318 |              if (count($failResults) > 0) { | 
| 319 | 319 | $this->storeTestResult(\core\common\Entity::L_ERROR, | 
| 320 | -                    "<strong>The following constants are not set:</strong>" . implode(', ', $failResults)); | |
| 320 | +                    "<strong>The following constants are not set:</strong>".implode(', ', $failResults)); | |
| 321 | 321 | } | 
| 322 | 322 | } | 
| 323 | 323 | |
| @@ -341,7 +341,7 @@ discard block | ||
| 341 | 341 | $this->storeTestResult(\core\common\Entity::L_OK, "<strong>cat_base_url</strong> set correctly"); | 
| 342 | 342 |          } else { | 
| 343 | 343 | $rootFromScript = $m[1] === '' ? '/' : $m[1]; | 
| 344 | - $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>cat_base_url</strong> is set to <strong>" . \config\Master::PATHS['cat_base_url'] . "</strong> and should be <strong>$rootFromScript</strong>"); | |
| 344 | + $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>cat_base_url</strong> is set to <strong>".\config\Master::PATHS['cat_base_url']."</strong> and should be <strong>$rootFromScript</strong>"); | |
| 345 | 345 | } | 
| 346 | 346 | } | 
| 347 | 347 | |
| @@ -362,7 +362,7 @@ discard block | ||
| 362 | 362 |          if (count($probeReturns) == 0) { | 
| 363 | 363 | $this->storeTestResult(common\Entity::L_OK, "All configured RADIUS/UDP probes are reachable."); | 
| 364 | 364 |          } else { | 
| 365 | -            $this->storeTestResult(common\Entity::L_ERROR, "The following RADIUS probes are NOT reachable: " . implode(', ', $probeReturns)); | |
| 365 | +            $this->storeTestResult(common\Entity::L_ERROR, "The following RADIUS probes are NOT reachable: ".implode(', ', $probeReturns)); | |
| 366 | 366 | } | 
| 367 | 367 | } | 
| 368 | 368 | |
| @@ -380,9 +380,9 @@ discard block | ||
| 380 | 380 | $SSPconfig = \SimpleSAML\Configuration::getInstance(); | 
| 381 | 381 |              $sspVersion = explode('.', $SSPconfig->getVersion()); | 
| 382 | 382 |              if ((int) $sspVersion[0] >= $this->needversionSSP['major'] && (int) $sspVersion[1] >= $this->needversionSSP['minor']) { | 
| 383 | -                $this->storeTestResult(\core\common\Entity::L_OK, "<strong>simpleSAMLphp</strong> is sufficiently recent. You are running " . implode('.', $sspVersion)); | |
| 383 | +                $this->storeTestResult(\core\common\Entity::L_OK, "<strong>simpleSAMLphp</strong> is sufficiently recent. You are running ".implode('.', $sspVersion)); | |
| 384 | 384 |              } else { | 
| 385 | -                $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>simpleSAMLphp</strong> is too old. We need at least " . implode('.', $this->needversionSSP)); | |
| 385 | +                $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>simpleSAMLphp</strong> is too old. We need at least ".implode('.', $this->needversionSSP)); | |
| 386 | 386 | } | 
| 387 | 387 | } | 
| 388 | 388 | } | 
| @@ -409,7 +409,7 @@ discard block | ||
| 409 | 409 |          $A = $this->getExecPath('zip'); | 
| 410 | 410 |          if ($A['exec'] != "") { | 
| 411 | 411 | $fullOutput = []; | 
| 412 | - $t = exec($A['exec'] . ' --version', $fullOutput); | |
| 412 | + $t = exec($A['exec'].' --version', $fullOutput); | |
| 413 | 413 |              if ($A['exec_is'] == "EXPLICIT") { | 
| 414 | 414 | $this->storeTestResult(\core\common\Entity::L_OK, "<strong>".$fullOutput[1]."</strong> was found and is configured explicitly in your config."); | 
| 415 | 415 |              } else { | 
| @@ -447,8 +447,8 @@ discard block | ||
| 447 | 447 | */ | 
| 448 | 448 | private function testLogdir() | 
| 449 | 449 |      { | 
| 450 | -        if (fopen(\config\Master::PATHS['logdir'] . "/debug.log", "a") == FALSE) { | |
| 451 | - $this->storeTestResult(\core\common\Entity::L_WARN, "Log files in <strong>" . \config\Master::PATHS['logdir'] . "</strong> are not writable!"); | |
| 450 | +        if (fopen(\config\Master::PATHS['logdir']."/debug.log", "a") == FALSE) { | |
| 451 | + $this->storeTestResult(\core\common\Entity::L_WARN, "Log files in <strong>".\config\Master::PATHS['logdir']."</strong> are not writable!"); | |
| 452 | 452 |          } else { | 
| 453 | 453 | $this->storeTestResult(\core\common\Entity::L_OK, "Log directory is writable."); | 
| 454 | 454 | } | 
| @@ -576,7 +576,7 @@ discard block | ||
| 576 | 576 |      { | 
| 577 | 577 |          $A = $this->getExecPath('openssl'); | 
| 578 | 578 |          if ($A['exec'] != "") { | 
| 579 | - $t = exec($A['exec'] . ' version'); | |
| 579 | + $t = exec($A['exec'].' version'); | |
| 580 | 580 |              if ($A['exec_is'] == "EXPLICIT") { | 
| 581 | 581 | $this->storeTestResult(\core\common\Entity::L_OK, "<strong>$t</strong> was found and is configured explicitly in your config."); | 
| 582 | 582 |              } else { | 
| @@ -598,13 +598,13 @@ discard block | ||
| 598 | 598 |          if ($A['exec'] != "" && $A['exec_is'] == "EXPLICIT" && !file_exists($A['exec'])) {  | 
| 599 | 599 | $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>sslscan</strong> is configured explicitly and was not found on your system!"); | 
| 600 | 600 |          } else { | 
| 601 | - exec($A['exec'] . ' --version --xml=-', $output, $res); | |
| 601 | + exec($A['exec'].' --version --xml=-', $output, $res); | |
| 602 | 602 |              if ($res == 0) { | 
| 603 | 603 | $xml = simplexml_load_string(implode($output)); | 
| 604 | - $resarray = json_decode(json_encode((array)$xml),true); | |
| 604 | + $resarray = json_decode(json_encode((array) $xml), true); | |
| 605 | 605 | $t = 'sslscan'; | 
| 606 | 606 |                  if (isset($resarray['@attributes']) and isset($resarray['@attributes']['version'])) { | 
| 607 | - $t = 'sslscan ' . $resarray['@attributes']['version']; | |
| 607 | + $t = 'sslscan '.$resarray['@attributes']['version']; | |
| 608 | 608 | } | 
| 609 | 609 |              } else { | 
| 610 | 610 | $t = ''; | 
| @@ -637,14 +637,14 @@ discard block | ||
| 637 | 637 | } | 
| 638 | 638 |          $A = $this->getExecPath('makensis'); | 
| 639 | 639 |          if ($A['exec'] != "") { | 
| 640 | - $t = exec($A['exec'] . ' -VERSION'); | |
| 640 | + $t = exec($A['exec'].' -VERSION'); | |
| 641 | 641 |              if ($A['exec_is'] == "EXPLICIT") { | 
| 642 | 642 | $this->storeTestResult(\core\common\Entity::L_OK, "<strong>makensis $t</strong> was found and is configured explicitly in your config."); | 
| 643 | 643 |              } else { | 
| 644 | 644 | $this->storeTestResult(\core\common\Entity::L_WARN, "<strong>makensis $t</strong> was found, but is not configured with an absolute path in your config."); | 
| 645 | 645 | } | 
| 646 | 646 | $outputArray = []; | 
| 647 | - exec($A['exec'] . ' -HELP', $outputArray); | |
| 647 | + exec($A['exec'].' -HELP', $outputArray); | |
| 648 | 648 |              $t1 = count(preg_grep('/INPUTCHARSET/', $outputArray)); | 
| 649 | 649 |              if ($t1 == 1 && \config\ConfAssistant::NSIS_VERSION == 2) { | 
| 650 | 650 | $this->storeTestResult(\core\common\Entity::L_ERROR, "Declared NSIS_VERSION does not seem to match the file pointed to by PATHS['makensis']!"); | 
| @@ -674,7 +674,7 @@ discard block | ||
| 674 | 674 | $NSIS_Module_status = []; | 
| 675 | 675 |          foreach ($this->NSISModules as $module) { | 
| 676 | 676 | unset($out); | 
| 677 | - exec(\config\ConfAssistant::PATHS['makensis'] . " -V1 '-X!include $module' '-XOutFile $exe' '-XSection X' '-XSectionEnd'", $out, $retval); | |
| 677 | + exec(\config\ConfAssistant::PATHS['makensis']." -V1 '-X!include $module' '-XOutFile $exe' '-XSection X' '-XSectionEnd'", $out, $retval); | |
| 678 | 678 |              if ($retval > 0) { | 
| 679 | 679 | $NSIS_Module_status[$module] = 0; | 
| 680 | 680 |              } else { | 
| @@ -741,8 +741,8 @@ discard block | ||
| 741 | 741 |          $locales = shell_exec("locale -a"); | 
| 742 | 742 | $allthere = ""; | 
| 743 | 743 |          foreach (\config\Master::LANGUAGES as $onelanguage) { | 
| 744 | -            if (preg_match("/" . $onelanguage['locale'] . "/", $locales) == 0) { | |
| 745 | - $allthere .= $onelanguage['locale'] . " "; | |
| 744 | +            if (preg_match("/".$onelanguage['locale']."/", $locales) == 0) { | |
| 745 | + $allthere .= $onelanguage['locale']." "; | |
| 746 | 746 | } | 
| 747 | 747 | } | 
| 748 | 748 |          if ($allthere == "") { | 
| @@ -756,47 +756,47 @@ discard block | ||
| 756 | 756 | ["SETTING" => \config\Master::APPEARANCE['from-mail'], | 
| 757 | 757 | "DEFVALUE" => "[email protected]", | 
| 758 | 758 | "COMPLAINTSTRING" => "APPEARANCE/from-mail ", | 
| 759 | - "REQUIRED" => FALSE,], | |
| 759 | + "REQUIRED" => FALSE, ], | |
| 760 | 760 | ["SETTING" => \config\Master::APPEARANCE['support-contact']['url'], | 
| 761 | 761 | "DEFVALUE" => "[email protected]?body=Only%20English%20language%20please!", | 
| 762 | 762 | "COMPLAINTSTRING" => "APPEARANCE/support-contact/url ", | 
| 763 | - "REQUIRED" => FALSE,], | |
| 763 | + "REQUIRED" => FALSE, ], | |
| 764 | 764 | ["SETTING" => \config\Master::APPEARANCE['support-contact']['display'], | 
| 765 | 765 | "DEFVALUE" => "[email protected]", | 
| 766 | 766 | "COMPLAINTSTRING" => "APPEARANCE/support-contact/display ", | 
| 767 | - "REQUIRED" => FALSE,], | |
| 767 | + "REQUIRED" => FALSE, ], | |
| 768 | 768 | ["SETTING" => \config\Master::APPEARANCE['support-contact']['developer-mail'], | 
| 769 | 769 | "DEFVALUE" => "[email protected]", | 
| 770 | 770 | "COMPLAINTSTRING" => "APPEARANCE/support-contact/mail ", | 
| 771 | - "REQUIRED" => FALSE,], | |
| 771 | + "REQUIRED" => FALSE, ], | |
| 772 | 772 | ["SETTING" => \config\Master::APPEARANCE['abuse-mail'], | 
| 773 | 773 | "DEFVALUE" => "[email protected]", | 
| 774 | 774 | "COMPLAINTSTRING" => "APPEARANCE/abuse-mail ", | 
| 775 | - "REQUIRED" => FALSE,], | |
| 775 | + "REQUIRED" => FALSE, ], | |
| 776 | 776 | ["SETTING" => \config\Master::APPEARANCE['MOTD'], | 
| 777 | 777 | "DEFVALUE" => "Release Candidate. All bugs to be shot on sight!", | 
| 778 | 778 | "COMPLAINTSTRING" => "APPEARANCE/MOTD ", | 
| 779 | - "REQUIRED" => FALSE,], | |
| 779 | + "REQUIRED" => FALSE, ], | |
| 780 | 780 | ["SETTING" => \config\Master::APPEARANCE['webcert_CRLDP'], | 
| 781 | 781 | "DEFVALUE" => ['list', 'of', 'CRL', 'pointers'], | 
| 782 | 782 | "COMPLAINTSTRING" => "APPEARANCE/webcert_CRLDP ", | 
| 783 | - "REQUIRED" => TRUE,], | |
| 783 | + "REQUIRED" => TRUE, ], | |
| 784 | 784 | ["SETTING" => \config\Master::APPEARANCE['webcert_OCSP'], | 
| 785 | 785 | "DEFVALUE" => ['list', 'of', 'OCSP', 'pointers'], | 
| 786 | 786 | "COMPLAINTSTRING" => "APPEARANCE/webcert_OCSP ", | 
| 787 | - "REQUIRED" => TRUE,], | |
| 787 | + "REQUIRED" => TRUE, ], | |
| 788 | 788 | ["SETTING" => \config\Master::DB['INST']['host'], | 
| 789 | 789 | "DEFVALUE" => "db.host.example", | 
| 790 | 790 | "COMPLAINTSTRING" => "DB/INST ", | 
| 791 | - "REQUIRED" => TRUE,], | |
| 791 | + "REQUIRED" => TRUE, ], | |
| 792 | 792 | ["SETTING" => \config\Master::DB['INST']['host'], | 
| 793 | 793 | "DEFVALUE" => "db.host.example", | 
| 794 | 794 | "COMPLAINTSTRING" => "DB/USER ", | 
| 795 | - "REQUIRED" => TRUE,], | |
| 795 | + "REQUIRED" => TRUE, ], | |
| 796 | 796 | ["SETTING" => \config\Master::DB['EXTERNAL']['host'], | 
| 797 | 797 | "DEFVALUE" => "customerdb.otherhost.example", | 
| 798 | 798 | "COMPLAINTSTRING" => "DB/EXTERNAL ", | 
| 799 | - "REQUIRED" => FALSE,], | |
| 799 | + "REQUIRED" => FALSE, ], | |
| 800 | 800 | ]; | 
| 801 | 801 | |
| 802 | 802 | /** | 
| @@ -825,11 +825,11 @@ discard block | ||
| 825 | 825 |          if (isset(\config\Diagnostics::RADIUSTESTS['TLS-clientcerts'])) { | 
| 826 | 826 |              foreach (\config\Diagnostics::RADIUSTESTS['TLS-clientcerts'] as $cadata) { | 
| 827 | 827 |                  foreach ($cadata['certificates'] as $cert_files) { | 
| 828 | -                    if (file_get_contents(ROOT . "/config/cli-certs/" . $cert_files['public']) === FALSE) { | |
| 829 | - $defaultvalues .= "CERTIFICATE/" . $cert_files['public'] . " "; | |
| 828 | +                    if (file_get_contents(ROOT."/config/cli-certs/".$cert_files['public']) === FALSE) { | |
| 829 | + $defaultvalues .= "CERTIFICATE/".$cert_files['public']." "; | |
| 830 | 830 | } | 
| 831 | -                    if (file_get_contents(ROOT . "/config/cli-certs/" . $cert_files['private']) === FALSE) { | |
| 832 | - $defaultvalues .= "CERTIFICATE/" . $cert_files['private'] . " "; | |
| 831 | +                    if (file_get_contents(ROOT."/config/cli-certs/".$cert_files['private']) === FALSE) { | |
| 832 | + $defaultvalues .= "CERTIFICATE/".$cert_files['private']." "; | |
| 833 | 833 | } | 
| 834 | 834 | } | 
| 835 | 835 | } | 
| @@ -922,14 +922,14 @@ discard block | ||
| 922 | 922 |          if ($global_no_cache) { | 
| 923 | 923 |              foreach ($Devs as $dev => $D) { | 
| 924 | 924 |                  if (empty($D['options']['no_cache']) || $D['options']['no_cache'] != 0) { | 
| 925 | - $no_cache_dev .= $dev . " "; | |
| 925 | + $no_cache_dev .= $dev." "; | |
| 926 | 926 | $no_cache_dev_count++; | 
| 927 | 927 | } | 
| 928 | 928 | } | 
| 929 | 929 |          } else { | 
| 930 | 930 |              foreach ($Devs as $dev => $D) { | 
| 931 | 931 |                  if (!empty($D['options']['no_cache']) && $D['options']['no_cache'] != 0) { | 
| 932 | - $no_cache_dev .= $dev . " "; | |
| 932 | + $no_cache_dev .= $dev." "; | |
| 933 | 933 | $no_cache_dev_count++; | 
| 934 | 934 | } | 
| 935 | 935 | } | 
| @@ -968,13 +968,13 @@ discard block | ||
| 968 | 968 | $mail->isHTML(FALSE); | 
| 969 | 969 | $mail->CharSet = 'UTF-8'; | 
| 970 | 970 | $mail->From = \config\Master::APPEARANCE['from-mail']; | 
| 971 | - $mail->FromName = \config\Master::APPEARANCE['productname'] . " Invitation System"; | |
| 971 | + $mail->FromName = \config\Master::APPEARANCE['productname']." Invitation System"; | |
| 972 | 972 | $mail->addAddress(\config\Master::APPEARANCE['abuse-mail']); | 
| 973 | 973 | $mail->Subject = "testing CAT configuration mail"; | 
| 974 | 974 | $mail->Body = "Testing CAT mailing\n"; | 
| 975 | 975 | $sent = $mail->send(); | 
| 976 | 976 |          if ($sent) { | 
| 977 | - $this->storeTestResult(\core\common\Entity::L_OK, "mailer settings appear to be working, check " . \config\Master::APPEARANCE['abuse-mail'] . " mailbox if the message was receiced."); | |
| 977 | + $this->storeTestResult(\core\common\Entity::L_OK, "mailer settings appear to be working, check ".\config\Master::APPEARANCE['abuse-mail']." mailbox if the message was receiced."); | |
| 978 | 978 |          } else { | 
| 979 | 979 | $this->storeTestResult(\core\common\Entity::L_ERROR, "mailer settings failed, check the Config::MAILSETTINGS"); | 
| 980 | 980 | } |