2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Simple script to set correct charset for changelog
8 declare(strict_types
=1);
10 use PhpMyAdmin\Response
;
12 if (! defined('ROOT_PATH')) {
13 define('ROOT_PATH', __DIR__
. DIRECTORY_SEPARATOR
);
17 * Gets core libraries and defines some variables
19 require ROOT_PATH
. 'libraries/common.inc.php';
21 $response = Response
::getInstance();
23 $response->getHeader()->sendHttpHeaders();
25 $filename = CHANGELOG_FILE
;
30 // Check if the file is available, some distributions remove these.
31 if (@is_readable
($filename)) {
32 // Test if the if is in a compressed format
33 if (substr($filename, -3) == '.gz') {
35 readgzfile($filename);
36 $changelog = ob_get_contents();
39 $changelog = file_get_contents($filename);
44 'The %s file is not available on this system, please visit ' .
45 '%s for more information.'
48 '<a href="https://www.phpmyadmin.net/">phpmyadmin.net</a>'
54 * Whole changelog in variable.
56 $changelog = htmlspecialchars($changelog);
58 $github_url = 'https://github.com/phpmyadmin/phpmyadmin/';
59 $faq_url = 'https://docs.phpmyadmin.net/en/latest/faq.html';
62 '@(https?://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@'
63 => '<a href="url.php?url=\\1">\\1</a>',
66 '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +<(.*@.*)>/i'
67 => '\\1 <a href="mailto:\\3">\\2</a>',
70 '/FAQ ([0-9]+)\.([0-9a-z]+)/i'
71 => '<a href="url.php?url=' . $faq_url . '#faq\\1-\\2">FAQ \\1.\\2</a>',
74 '/issue\s*#?([0-9]{4,5}) /i'
75 => '<a href="url.php?url=' . $github_url . 'issues/\\1">issue #\\1</a> ',
78 '/((CAN|CVE)-[0-9]+-[0-9]+)/'
79 => '<a href="url.php?url=https://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
82 '/(PMASA-[0-9]+-[0-9]+)/'
83 => '<a href="url.php?url=https://www.phpmyadmin.net/security/\\1/">\\1</a>',
85 // Highlight releases (with links)
86 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.0 (\([0-9-]+\))/'
87 => '<a name="\\1_\\2_\\3"></a>'
88 . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3">'
89 . '\\1.\\2.\\3.0 \\4</a>',
90 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.([1-9][0-9]*) (\([0-9-]+\))/'
91 => '<a name="\\1_\\2_\\3_\\4"></a>'
92 . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3_\\4">'
93 . '\\1.\\2.\\3.\\4 \\5</a>',
95 // Highlight releases (not linkable)
99 // Links target and rel
100 '/a href="/' => 'a target="_blank" rel="noopener noreferrer" href="'
104 header('Content-type: text/html; charset=utf-8');
107 <html lang
="en" dir
="ltr">
109 <link rel
="icon" href
="favicon.ico" type
="image/x-icon">
110 <link rel
="shortcut icon" href
="favicon.ico" type
="image/x-icon">
111 <title
>phpMyAdmin
- ChangeLog
</title
>
112 <meta charset
="utf-8">
115 <h1
>phpMyAdmin
- ChangeLog
</h1
>
118 echo preg_replace(array_keys($replaces), $replaces, $changelog);