2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Simple script to set correct charset for changelog
8 use PhpMyAdmin\Response
;
11 * Gets core libraries and defines some variables
13 require 'libraries/common.inc.php';
15 $response = Response
::getInstance();
17 $response->getHeader()->sendHttpHeaders();
19 $filename = CHANGELOG_FILE
;
24 // Check if the file is available, some distributions remove these.
25 if (@is_readable
($filename)) {
27 // Test if the if is in a compressed format
28 if (substr($filename, -3) == '.gz') {
30 readgzfile($filename);
31 $changelog = ob_get_contents();
34 $changelog = file_get_contents($filename);
39 'The %s file is not available on this system, please visit ' .
40 '%s for more information.'
43 '<a href="https://www.phpmyadmin.net/">phpmyadmin.net</a>'
49 * Whole changelog in variable.
51 $changelog = htmlspecialchars($changelog);
53 $tracker_url = 'https://sourceforge.net/support/tracker.php?aid=\\1';
54 $tracker_url_bug = 'https://sourceforge.net/p/phpmyadmin/bugs/\\1/';
55 $tracker_url_rfe = 'https://sourceforge.net/p/phpmyadmin/feature-requests/\\1/';
56 $tracker_url_patch = 'https://sourceforge.net/p/phpmyadmin/patches/\\1/';
57 $github_url = 'https://github.com/phpmyadmin/phpmyadmin/';
58 $faq_url = 'https://docs.phpmyadmin.net/en/latest/faq.html';
61 '@(https?://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@'
62 => '<a href="url.php?url=\\1">\\1</a>',
65 '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +<(.*)@users.sourceforge.net>/i'
66 => '\\1 <a href="url.php?url=https://sourceforge.net/users/\\3/">\\2</a>',
67 '/thanks to ([^\(\r\n]+) \(([-\w]+)\)/i'
68 => 'thanks to <a href="url.php?url=https://sourceforge.net/users/\\2/">\\1</a>',
69 '/thanks to ([^\(\r\n]+) -\s+([-\w]+)/i'
70 => 'thanks to <a href="url.php?url=https://sourceforge.net/users/\\2/">\\1</a>',
73 '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +<(.*@.*)>/i'
74 => '\\1 <a href="mailto:\\3">\\2</a>',
77 '/patch\s*#?([0-9]{6,})/i'
78 => '<a href="url.php?url=' . $tracker_url . '">patch #\\1</a>',
81 '/(?:rfe|feature)\s*#?([0-9]{6,})/i'
82 => '<a href="url.php?url=https://sourceforge.net/support/tracker.php?aid=\\1">RFE #\\1</a>',
85 '/FAQ ([0-9]+)\.([0-9a-z]+)/i'
86 => '<a href="url.php?url=' . $faq_url . '#faq\\1-\\2">FAQ \\1.\\2</a>',
89 '/bug\s*#?([0-9]{6,})/i'
90 => '<a href="url.php?url=https://sourceforge.net/support/tracker.php?aid=\\1">bug #\\1</a>',
92 // all other 6+ digit numbers are treated as bugs
93 '/(?<!bug|RFE|patch) #?([0-9]{6,})/i'
94 => '<a href="url.php?url=' . $tracker_url . '">bug #\\1</a>',
97 '/issue\s*#?([0-9]{4,5}) /i'
98 => '<a href="url.php?url=' . $github_url . 'issues/\\1">issue #\\1</a> ',
100 // transitioned SF.net project bug/rfe/patch links
101 // by the time we reach 6-digit numbers, we can probably retire the above links
102 '/patch\s*#?([0-9]{4,5}) /i'
103 => '<a href="url.php?url=' . $tracker_url_patch . '">patch #\\1</a> ',
104 '/(?:rfe|feature)\s*#?([0-9]{4,5}) /i'
105 => '<a href="url.php?url=' . $tracker_url_rfe . '">RFE #\\1</a> ',
106 '/bug\s*#?([0-9]{4,5}) /i'
107 => '<a href="url.php?url=' . $tracker_url_bug . '">bug #\\1</a> ',
108 '/(?<!bug|RFE|patch) #?([0-9]{4,5}) /i'
109 => '<a href="url.php?url=' . $tracker_url_bug . '">bug #\\1</a> ',
112 '/((CAN|CVE)-[0-9]+-[0-9]+)/'
113 => '<a href="url.php?url=https://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
116 '/(PMASA-[0-9]+-[0-9]+)/'
117 => '<a href="url.php?url=https://www.phpmyadmin.net/security/\\1/">\\1</a>',
119 // Highlight releases (with links)
120 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.0 (\([0-9-]+\))/'
121 => '<a name="\\1_\\2_\\3"></a>'
122 . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3">'
123 . '\\1.\\2.\\3.0 \\4</a>',
124 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.([1-9][0-9]*) (\([0-9-]+\))/'
125 => '<a name="\\1_\\2_\\3_\\4"></a>'
126 . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3_\\4">'
127 . '\\1.\\2.\\3.\\4 \\5</a>',
129 // Highlight releases (not linkable)
133 // Links target and rel
134 '/a href="/' => 'a target="_blank" rel="noopener noreferrer" href="'
138 header('Content-type: text/html; charset=utf-8');
141 <html lang
="en" dir
="ltr">
143 <link rel
="icon" href
="favicon.ico" type
="image/x-icon" />
144 <link rel
="shortcut icon" href
="favicon.ico" type
="image/x-icon" />
145 <title
>phpMyAdmin
- ChangeLog
</title
>
146 <meta charset
="utf-8" />
149 <h1
>phpMyAdmin
- ChangeLog
</h1
>
152 echo preg_replace(array_keys($replaces), $replaces, $changelog);