LicenseController.php 968 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Simple script to set correct charset for the license
  4. */
  5. declare(strict_types=1);
  6. namespace PhpMyAdmin\Controllers;
  7. use function is_readable;
  8. use function printf;
  9. use function readfile;
  10. /**
  11. * Simple script to set correct charset for the license
  12. */
  13. class LicenseController extends AbstractController
  14. {
  15. public function index(): void
  16. {
  17. $this->response->disable();
  18. $this->response->header('Content-type: text/plain; charset=utf-8');
  19. $filename = LICENSE_FILE;
  20. // Check if the file is available, some distributions remove these.
  21. if (@is_readable($filename)) {
  22. readfile($filename);
  23. } else {
  24. printf(
  25. __(
  26. 'The %s file is not available on this system, please visit ' .
  27. '%s for more information.'
  28. ),
  29. $filename,
  30. 'https://www.phpmyadmin.net/'
  31. );
  32. }
  33. }
  34. }