diff --git a/protokolle.php b/protokolle.php index 319ffe2..a304353 100644 --- a/protokolle.php +++ b/protokolle.php @@ -11,29 +11,34 @@ $autoloadPath = '/home/meeehgru/vendor/autoload.php'; // Check if autoload.php file exists if (!file_exists($autoloadPath)) { echo "

PHP Configuration changed. The autoload.php file is missing. Please run composer install or composer require vstelmakh/url-highlight. Please inform the osamc.de staff about this problem.

"; -} else { - require $autoloadPath; - - // Check if UrlHighlight class exists - if (!class_exists(\VStelmakh\UrlHighlight\UrlHighlight::class)) { - echo "

PHP Configuration changed. Run composer require vstelmakh/url-highlight. Please inform the osamc.de staff about this problem.

"; - } else { - // Your existing code goes here - use VStelmakh\UrlHighlight\UrlHighlight; - $urlHighlight = new UrlHighlight(); - - $files = glob("./protokolle/osamc_*.txt"); - foreach(array_reverse($files) as $file){ - $path_parts = pathinfo($file); - echo "

" . $path_parts['filename'] . "

"; - echo "\n"; - echo $urlHighlight->highlightUrls(file_get_contents($file)); - echo "\n"; - } - // Remove fclose($out); as $out is not defined - } + exit; // Stop script execution } +require $autoloadPath; + +// Check if UrlHighlight class exists using its fully qualified name +if (!class_exists('VStelmakh\UrlHighlight\UrlHighlight')) { + echo "

PHP Configuration changed. Run composer require vstelmakh/url-highlight. Please inform the osamc.de staff about this problem.

"; + exit; // Stop script execution +} + +// Now we can use the use statement +use VStelmakh\UrlHighlight\UrlHighlight; + + +// Main logic of the script starts here +$urlHighlight = new UrlHighlight(); + +$files = glob("./protokolle/osamc_*.txt"); +foreach(array_reverse($files) as $file){ + $path_parts = pathinfo($file); + echo "

" . $path_parts['filename'] . "

"; + echo "\n"; + echo $urlHighlight->highlightUrls(file_get_contents($file)); + echo "\n"; +} +// Remove fclose($out); as $out is not defined + ?>