changelog.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. /**
  9. * Gets core libraries and defines some variables
  10. */
  11. require 'libraries/common.inc.php';
  12. $response = PMA_Response::getInstance();
  13. $response->disable();
  14. $filename = CHANGELOG_FILE;
  15. /**
  16. * Read changelog.
  17. */
  18. // Check if the file is available, some distributions remove these.
  19. if (is_readable($filename)) {
  20. // Test if the if is in a compressed format
  21. if (substr($filename, -3) == '.gz') {
  22. ob_start();
  23. readgzfile($filename);
  24. $changelog = ob_get_contents();
  25. ob_end_clean();
  26. } else {
  27. $changelog = file_get_contents($filename);
  28. }
  29. } else {
  30. printf(
  31. __('The %s file is not available on this system, please visit www.phpmyadmin.net for more information.'),
  32. $filename
  33. );
  34. exit;
  35. }
  36. /**
  37. * Whole changelog in variable.
  38. */
  39. $changelog = htmlspecialchars($changelog);
  40. $tracker_url = 'https://sourceforge.net/support/tracker.php?aid=\\1';
  41. $tracker_url_bug = 'https://sourceforge.net/p/phpmyadmin/bugs/\\1/';
  42. $tracker_url_rfe = 'https://sourceforge.net/p/phpmyadmin/feature-requests/\\1/';
  43. $tracker_url_patch = 'https://sourceforge.net/p/phpmyadmin/patches/\\1/';
  44. $github_url = 'https://github.com/phpmyadmin/phpmyadmin/';
  45. $replaces = array(
  46. '@(http://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@'
  47. => '<a href="./url.php?url=\\1">\\1</a>',
  48. // sourceforge users
  49. '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*)@users.sourceforge.net&gt;/i'
  50. => '\\1 <a href="./url.php?url=https://sourceforge.net/users/\\3/">\\2</a>',
  51. '/thanks to ([^\(\r\n]+) \(([-\w]+)\)/i'
  52. => 'thanks to <a href="./url.php?url=https://sourceforge.net/users/\\2/">\\1</a>',
  53. '/thanks to ([^\(\r\n]+) -\s+([-\w]+)/i'
  54. => 'thanks to <a href="./url.php?url=https://sourceforge.net/users/\\2/">\\1</a>',
  55. // mail address
  56. '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*@.*)&gt;/i'
  57. => '\\1 <a href="mailto:\\3">\\2</a>',
  58. // linking patches
  59. '/patch\s*#?([0-9]{6,})/i'
  60. => '<a href="./url.php?url=' . $tracker_url . '">patch #\\1</a>',
  61. // linking RFE
  62. '/(?:rfe|feature)\s*#?([0-9]{6,})/i'
  63. => '<a href="./url.php?url=https://sourceforge.net/support/tracker.php?aid=\\1">RFE #\\1</a>',
  64. // linking files
  65. '/(\s+)([\\/a-z_0-9\.]+\.(?:php3?|html|pl|js|sh))/i'
  66. => '\\1<a href="./url.php?url=' . $github_url . 'commits/HEAD/\\2">\\2</a>',
  67. // FAQ entries
  68. '/FAQ ([0-9]+)\.([0-9a-z]+)/i'
  69. => '<a href="./url.php?url=https://docs.phpmyadmin.net/en/latest/faq.html#faq\\1-\\2">FAQ \\1.\\2</a>',
  70. // linking bugs
  71. '/bug\s*#?([0-9]{6,})/i'
  72. => '<a href="./url.php?url=https://sourceforge.net/support/tracker.php?aid=\\1">bug #\\1</a>',
  73. // all other 6+ digit numbers are treated as bugs
  74. '/(?<!bug|RFE|patch) #?([0-9]{6,})/i'
  75. => '<a href="./url.php?url=' . $tracker_url . '">bug #\\1</a>',
  76. // transitioned SF.net project bug/rfe/patch links
  77. // by the time we reach 6-digit numbers, we can probably retire the above links
  78. '/patch\s*#?([0-9]{4,5}) /i'
  79. => '<a href="./url.php?url=' . $tracker_url_patch . '">patch #\\1</a> ',
  80. '/(?:rfe|feature)\s*#?([0-9]{4,5}) /i'
  81. => '<a href="./url.php?url=' . $tracker_url_rfe . '">RFE #\\1</a> ',
  82. '/bug\s*#?([0-9]{4,5}) /i'
  83. => '<a href="./url.php?url=' . $tracker_url_bug . '">bug #\\1</a> ',
  84. '/(?<!bug|RFE|patch) #?([0-9]{4,5}) /i'
  85. => '<a href="./url.php?url=' . $tracker_url_bug . '">bug #\\1</a> ',
  86. // CVE/CAN entries
  87. '/((CAN|CVE)-[0-9]+-[0-9]+)/'
  88. => '<a href="./url.php?url=http://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
  89. // PMASAentries
  90. '/(PMASA-[0-9]+-[0-9]+)/'
  91. => '<a href="./url.php?url=https://www.phpmyadmin.net/security/\\1/">\\1</a>',
  92. // Highlight releases (with links)
  93. '/([0-9]+)\.([0-9]+)\.([0-9]+)\.0 (\([0-9-]+\))/'
  94. => '<a name="\\1_\\2_\\3"></a>'
  95. . '<a href="./url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3">'
  96. . '\\1.\\2.\\3.0 \\4</a>',
  97. '/([0-9]+)\.([0-9]+)\.([0-9]+)\.([1-9][0-9]*) (\([0-9-]+\))/'
  98. => '<a name="\\1_\\2_\\3_\\4"></a>'
  99. . '<a href="./url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3_\\4">'
  100. . '\\1.\\2.\\3.\\4 \\5</a>',
  101. // Highlight releases (not linkable)
  102. '/( ### )(.*)/'
  103. => '\\1<b>\\2</b>',
  104. );
  105. header('Content-type: text/html; charset=utf-8');
  106. ?>
  107. <!DOCTYPE HTML>
  108. <html lang="en" dir="ltr">
  109. <head>
  110. <link rel="icon" href="favicon.ico" type="image/x-icon" />
  111. <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
  112. <title>phpMyAdmin - ChangeLog</title>
  113. <meta charset="utf-8" />
  114. </head>
  115. <body>
  116. <h1>phpMyAdmin - ChangeLog</h1>
  117. <?php
  118. echo '<pre>';
  119. echo preg_replace(array_keys($replaces), $replaces, $changelog);
  120. echo '</pre>';
  121. ?>
  122. <script type="text/javascript">
  123. var links = document.getElementsByTagName("a");
  124. for(var i = 0; i < links.length; i++) {
  125. links[i].target = "_blank";
  126. links[i].rel = "noopener noreferrer";
  127. }
  128. </script>
  129. </body>
  130. </html>