changelog.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Simple script to set correct charset for changelog
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. use PhpMyAdmin\Response;
  9. /**
  10. * Gets core libraries and defines some variables
  11. */
  12. require 'libraries/common.inc.php';
  13. $response = Response::getInstance();
  14. $response->disable();
  15. $response->getHeader()->sendHttpHeaders();
  16. $filename = CHANGELOG_FILE;
  17. /**
  18. * Read changelog.
  19. */
  20. // Check if the file is available, some distributions remove these.
  21. if (@is_readable($filename)) {
  22. // Test if the if is in a compressed format
  23. if (substr($filename, -3) == '.gz') {
  24. ob_start();
  25. readgzfile($filename);
  26. $changelog = ob_get_contents();
  27. ob_end_clean();
  28. } else {
  29. $changelog = file_get_contents($filename);
  30. }
  31. } else {
  32. printf(
  33. __(
  34. 'The %s file is not available on this system, please visit ' .
  35. '%s for more information.'
  36. ),
  37. $filename,
  38. '<a href="https://www.phpmyadmin.net/">phpmyadmin.net</a>'
  39. );
  40. exit;
  41. }
  42. /**
  43. * Whole changelog in variable.
  44. */
  45. $changelog = htmlspecialchars($changelog);
  46. $github_url = 'https://github.com/phpmyadmin/phpmyadmin/';
  47. $faq_url = 'https://docs.phpmyadmin.net/en/latest/faq.html';
  48. $replaces = array(
  49. '@(https?://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@'
  50. => '<a href="url.php?url=\\1">\\1</a>',
  51. // mail address
  52. '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*@.*)&gt;/i'
  53. => '\\1 <a href="mailto:\\3">\\2</a>',
  54. // FAQ entries
  55. '/FAQ ([0-9]+)\.([0-9a-z]+)/i'
  56. => '<a href="url.php?url=' . $faq_url . '#faq\\1-\\2">FAQ \\1.\\2</a>',
  57. // GitHub issues
  58. '/issue\s*#?([0-9]{4,5}) /i'
  59. => '<a href="url.php?url=' . $github_url . 'issues/\\1">issue #\\1</a> ',
  60. // CVE/CAN entries
  61. '/((CAN|CVE)-[0-9]+-[0-9]+)/'
  62. => '<a href="url.php?url=https://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
  63. // PMASAentries
  64. '/(PMASA-[0-9]+-[0-9]+)/'
  65. => '<a href="url.php?url=https://www.phpmyadmin.net/security/\\1/">\\1</a>',
  66. // Highlight releases (with links)
  67. '/([0-9]+)\.([0-9]+)\.([0-9]+)\.0 (\([0-9-]+\))/'
  68. => '<a name="\\1_\\2_\\3"></a>'
  69. . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3">'
  70. . '\\1.\\2.\\3.0 \\4</a>',
  71. '/([0-9]+)\.([0-9]+)\.([0-9]+)\.([1-9][0-9]*) (\([0-9-]+\))/'
  72. => '<a name="\\1_\\2_\\3_\\4"></a>'
  73. . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3_\\4">'
  74. . '\\1.\\2.\\3.\\4 \\5</a>',
  75. // Highlight releases (not linkable)
  76. '/( ### )(.*)/'
  77. => '\\1<b>\\2</b>',
  78. // Links target and rel
  79. '/a href="/' => 'a target="_blank" rel="noopener noreferrer" href="'
  80. );
  81. header('Content-type: text/html; charset=utf-8');
  82. ?>
  83. <!DOCTYPE HTML>
  84. <html lang="en" dir="ltr">
  85. <head>
  86. <link rel="icon" href="favicon.ico" type="image/x-icon" />
  87. <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
  88. <title>phpMyAdmin - ChangeLog</title>
  89. <meta charset="utf-8" />
  90. </head>
  91. <body>
  92. <h1>phpMyAdmin - ChangeLog</h1>
  93. <?php
  94. echo '<pre>';
  95. echo preg_replace(array_keys($replaces), $replaces, $changelog);
  96. echo '</pre>';
  97. ?>
  98. </body>
  99. </html>