Merge remote-tracking branch 'origin/QA_4_6' into QA_4_6
[phpmyadmin.git] / changelog.php
blobc19bcf53d5c1d6703c173e8ccf9d7d0847e4662a
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Simple script to set correct charset for changelog
6 * @package PhpMyAdmin
7 */
9 /**
10 * Gets core libraries and defines some variables
12 require 'libraries/common.inc.php';
14 $response = PMA\libraries\Response::getInstance();
15 $response->disable();
16 $response->getHeader()->sendHttpHeaders();
18 $filename = CHANGELOG_FILE;
20 /**
21 * Read changelog.
23 // Check if the file is available, some distributions remove these.
24 if (@is_readable($filename)) {
26 // Test if the if is in a compressed format
27 if (substr($filename, -3) == '.gz') {
28 ob_start();
29 readgzfile($filename);
30 $changelog = ob_get_contents();
31 ob_end_clean();
32 } else {
33 $changelog = file_get_contents($filename);
35 } else {
36 printf(
37 __(
38 'The %s file is not available on this system, please visit '
39 . 'www.phpmyadmin.net for more information.'
41 $filename
43 exit;
46 /**
47 * Whole changelog in variable.
49 $changelog = htmlspecialchars($changelog);
51 $tracker_url = 'https://sourceforge.net/support/tracker.php?aid=\\1';
52 $tracker_url_bug = 'https://sourceforge.net/p/phpmyadmin/bugs/\\1/';
53 $tracker_url_rfe = 'https://sourceforge.net/p/phpmyadmin/feature-requests/\\1/';
54 $tracker_url_patch = 'https://sourceforge.net/p/phpmyadmin/patches/\\1/';
55 $github_url = 'https://github.com/phpmyadmin/phpmyadmin/';
56 $faq_url = 'https://docs.phpmyadmin.net/en/latest/faq.html';
58 $replaces = array(
59 '@(https?://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@'
60 => '<a href="url.php?url=\\1">\\1</a>',
62 // sourceforge users
63 '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*)@users.sourceforge.net&gt;/i'
64 => '\\1 <a href="url.php?url=https://sourceforge.net/users/\\3/">\\2</a>',
65 '/thanks to ([^\(\r\n]+) \(([-\w]+)\)/i'
66 => 'thanks to <a href="url.php?url=https://sourceforge.net/users/\\2/">\\1</a>',
67 '/thanks to ([^\(\r\n]+) -\s+([-\w]+)/i'
68 => 'thanks to <a href="url.php?url=https://sourceforge.net/users/\\2/">\\1</a>',
70 // mail address
71 '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*@.*)&gt;/i'
72 => '\\1 <a href="mailto:\\3">\\2</a>',
74 // linking patches
75 '/patch\s*#?([0-9]{6,})/i'
76 => '<a href="url.php?url=' . $tracker_url . '">patch #\\1</a>',
78 // linking RFE
79 '/(?:rfe|feature)\s*#?([0-9]{6,})/i'
80 => '<a href="url.php?url=https://sourceforge.net/support/tracker.php?aid=\\1">RFE #\\1</a>',
82 // linking files
83 '/(\s+)([\\/a-z_0-9\.]+\.(?:php3?|html|pl|js|sh))/i'
84 => '\\1<a href="url.php?url=' . $github_url . 'commits/HEAD/\\2">\\2</a>',
86 // FAQ entries
87 '/FAQ ([0-9]+)\.([0-9a-z]+)/i'
88 => '<a href="url.php?url=' . $faq_url . '#faq\\1-\\2">FAQ \\1.\\2</a>',
90 // linking bugs
91 '/bug\s*#?([0-9]{6,})/i'
92 => '<a href="url.php?url=https://sourceforge.net/support/tracker.php?aid=\\1">bug #\\1</a>',
94 // all other 6+ digit numbers are treated as bugs
95 '/(?<!bug|RFE|patch) #?([0-9]{6,})/i'
96 => '<a href="url.php?url=' . $tracker_url . '">bug #\\1</a>',
98 // GitHub issues
99 '/issue\s*#?([0-9]{4,5}) /i'
100 => '<a href="url.php?url=' . $github_url . 'issues/\\1">issue #\\1</a> ',
102 // transitioned SF.net project bug/rfe/patch links
103 // by the time we reach 6-digit numbers, we can probably retire the above links
104 '/patch\s*#?([0-9]{4,5}) /i'
105 => '<a href="url.php?url=' . $tracker_url_patch . '">patch #\\1</a> ',
106 '/(?:rfe|feature)\s*#?([0-9]{4,5}) /i'
107 => '<a href="url.php?url=' . $tracker_url_rfe . '">RFE #\\1</a> ',
108 '/bug\s*#?([0-9]{4,5}) /i'
109 => '<a href="url.php?url=' . $tracker_url_bug . '">bug #\\1</a> ',
110 '/(?<!bug|RFE|patch) #?([0-9]{4,5}) /i'
111 => '<a href="url.php?url=' . $tracker_url_bug . '">bug #\\1</a> ',
113 // CVE/CAN entries
114 '/((CAN|CVE)-[0-9]+-[0-9]+)/'
115 => '<a href="url.php?url=https://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
117 // PMASAentries
118 '/(PMASA-[0-9]+-[0-9]+)/'
119 => '<a href="url.php?url=https://www.phpmyadmin.net/security/\\1/">\\1</a>',
121 // Highlight releases (with links)
122 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.0 (\([0-9-]+\))/'
123 => '<a name="\\1_\\2_\\3"></a>'
124 . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3">'
125 . '\\1.\\2.\\3.0 \\4</a>',
126 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.([1-9][0-9]*) (\([0-9-]+\))/'
127 => '<a name="\\1_\\2_\\3_\\4"></a>'
128 . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3_\\4">'
129 . '\\1.\\2.\\3.\\4 \\5</a>',
131 // Highlight releases (not linkable)
132 '/( ### )(.*)/'
133 => '\\1<b>\\2</b>',
137 header('Content-type: text/html; charset=utf-8');
139 <!DOCTYPE HTML>
140 <html lang="en" dir="ltr">
141 <head>
142 <link rel="icon" href="favicon.ico" type="image/x-icon" />
143 <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
144 <title>phpMyAdmin - ChangeLog</title>
145 <meta charset="utf-8" />
146 </head>
147 <body>
148 <h1>phpMyAdmin - ChangeLog</h1>
149 <?php
150 echo '<pre>';
151 echo preg_replace(array_keys($replaces), $replaces, $changelog);
152 echo '</pre>';
154 <script type="text/javascript">
155 var links = document.getElementsByTagName("a");
156 for(var i = 0; i < links.length; i++) {
157 links[i].target = "_blank";
158 links[i].rel = "noopener noreferrer";
160 </script>
161 </body>
162 </html>