changelog.php 4.7 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. $faq_url = 'http://docs.phpmyadmin.net/en/latest/faq.html';
  46. $replaces = array(
  47. '@(http://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@'
  48. => '<a href="\\1">\\1</a>',
  49. // sourceforge users
  50. '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*)@users.sourceforge.net&gt;/i'
  51. => '\\1 <a href="https://sourceforge.net/users/\\3/">\\2</a>',
  52. '/thanks to ([^\(\r\n]+) \(([-\w]+)\)/i'
  53. => 'thanks to <a href="https://sourceforge.net/users/\\2/">\\1</a>',
  54. '/thanks to ([^\(\r\n]+) -\s+([-\w]+)/i'
  55. => 'thanks to <a href="https://sourceforge.net/users/\\2/">\\1</a>',
  56. // mail address
  57. '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*@.*)&gt;/i'
  58. => '\\1 <a href="mailto:\\3">\\2</a>',
  59. // linking patches
  60. '/patch\s*#?([0-9]{6,})/i'
  61. => '<a href="' . $tracker_url . '">patch #\\1</a>',
  62. // linking RFE
  63. '/(?:rfe|feature)\s*#?([0-9]{6,})/i'
  64. => '<a href="https://sourceforge.net/support/tracker.php?aid=\\1">RFE #\\1</a>',
  65. // linking files
  66. '/(\s+)([\\/a-z_0-9\.]+\.(?:php3?|html|pl|js|sh))/i'
  67. => '\\1<a href="' . $github_url . 'commits/HEAD/\\2">\\2</a>',
  68. // FAQ entries
  69. '/FAQ ([0-9]+)\.([0-9a-z]+)/i'
  70. => '<a href="' . $faq_url . '#faq\\1-\\2">FAQ \\1.\\2</a>',
  71. // linking bugs
  72. '/bug\s*#?([0-9]{6,})/i'
  73. => '<a href="https://sourceforge.net/support/tracker.php?aid=\\1">bug #\\1</a>',
  74. // all other 6+ digit numbers are treated as bugs
  75. '/(?<!bug|RFE|patch) #?([0-9]{6,})/i'
  76. => '<a href="' . $tracker_url . '">bug #\\1</a>',
  77. // transitioned SF.net project bug/rfe/patch links
  78. // by the time we reach 6-digit numbers, we can probably retire the above links
  79. '/patch\s*#?([0-9]{4,5}) /i'
  80. => '<a href="' . $tracker_url_patch . '">patch #\\1</a> ',
  81. '/(?:rfe|feature)\s*#?([0-9]{4,5}) /i'
  82. => '<a href="' . $tracker_url_rfe . '">RFE #\\1</a> ',
  83. '/bug\s*#?([0-9]{4,5}) /i'
  84. => '<a href="' . $tracker_url_bug . '">bug #\\1</a> ',
  85. '/(?<!bug|RFE|patch) #?([0-9]{4,5}) /i'
  86. => '<a href="' . $tracker_url_bug . '">bug #\\1</a> ',
  87. // CVE/CAN entries
  88. '/((CAN|CVE)-[0-9]+-[0-9]+)/'
  89. => '<a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
  90. // PMASAentries
  91. '/(PMASA-[0-9]+-[0-9]+)/'
  92. => '<a href="http://www.phpmyadmin.net/home_page/security/\\1.php">\\1</a>',
  93. // Highlight releases (with links)
  94. '/([0-9]+)\.([0-9]+)\.([0-9]+)\.0 (\([0-9-]+\))/'
  95. => '<a name="\\1_\\2_\\3"></a>'
  96. . '<a href="' . $github_url . 'commits/RELEASE_\\1_\\2_\\3">'
  97. . '\\1.\\2.\\3.0 \\4</a>',
  98. '/([0-9]+)\.([0-9]+)\.([0-9]+)\.([1-9][0-9]*) (\([0-9-]+\))/'
  99. => '<a name="\\1_\\2_\\3_\\4"></a>'
  100. . '<a href="' . $github_url . 'commits/RELEASE_\\1_\\2_\\3_\\4">'
  101. . '\\1.\\2.\\3.\\4 \\5</a>',
  102. // Highlight releases (not linkable)
  103. '/( ### )(.*)/'
  104. => '\\1<b>\\2</b>',
  105. );
  106. header('Content-type: text/html; charset=utf-8');
  107. ?>
  108. <!DOCTYPE HTML>
  109. <html lang="en" dir="ltr">
  110. <head>
  111. <link rel="icon" href="favicon.ico" type="image/x-icon" />
  112. <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
  113. <title>phpMyAdmin - ChangeLog</title>
  114. <meta charset="utf-8" />
  115. </head>
  116. <body>
  117. <h1>phpMyAdmin - ChangeLog</h1>
  118. <?php
  119. echo '<pre>';
  120. echo preg_replace(array_keys($replaces), $replaces, $changelog);
  121. echo '</pre>';
  122. ?>
  123. <script type="text/javascript">
  124. var links = document.getElementsByTagName("a");
  125. for(var i = 0; i < links.length; i++) {
  126. links[i].target = "_blank";
  127. }
  128. </script>
  129. </body>
  130. </html>