Add ChangeLog entry for #15592
[phpmyadmin.git] / changelog.php
blobb0f8b0124b1942ae24a2d45750d18ad2d81347fa
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 */
8 use PhpMyAdmin\Response;
10 /**
11 * Gets core libraries and defines some variables
13 require 'libraries/common.inc.php';
15 $response = Response::getInstance();
16 $response->disable();
17 $response->getHeader()->sendHttpHeaders();
19 $filename = CHANGELOG_FILE;
21 /**
22 * Read changelog.
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') {
29 ob_start();
30 readgzfile($filename);
31 $changelog = ob_get_contents();
32 ob_end_clean();
33 } else {
34 $changelog = file_get_contents($filename);
36 } else {
37 printf(
38 __(
39 'The %s file is not available on this system, please visit ' .
40 '%s for more information.'
42 $filename,
43 '<a href="https://www.phpmyadmin.net/">phpmyadmin.net</a>'
45 exit;
48 /**
49 * Whole changelog in variable.
51 $changelog = htmlspecialchars($changelog);
53 $github_url = 'https://github.com/phpmyadmin/phpmyadmin/';
54 $faq_url = 'https://docs.phpmyadmin.net/en/latest/faq.html';
56 $replaces = array(
57 '@(https?://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@'
58 => '<a href="url.php?url=\\1">\\1</a>',
60 // mail address
61 '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*@.*)&gt;/i'
62 => '\\1 <a href="mailto:\\3">\\2</a>',
64 // FAQ entries
65 '/FAQ ([0-9]+)\.([0-9a-z]+)/i'
66 => '<a href="url.php?url=' . $faq_url . '#faq\\1-\\2">FAQ \\1.\\2</a>',
68 // GitHub issues
69 '/issue\s*#?([0-9]{4,5}) /i'
70 => '<a href="url.php?url=' . $github_url . 'issues/\\1">issue #\\1</a> ',
72 // CVE/CAN entries
73 '/((CAN|CVE)-[0-9]+-[0-9]+)/'
74 => '<a href="url.php?url=https://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
76 // PMASAentries
77 '/(PMASA-[0-9]+-[0-9]+)/'
78 => '<a href="url.php?url=https://www.phpmyadmin.net/security/\\1/">\\1</a>',
80 // Highlight releases (with links)
81 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.0 (\([0-9-]+\))/'
82 => '<a name="\\1_\\2_\\3"></a>'
83 . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3">'
84 . '\\1.\\2.\\3.0 \\4</a>',
85 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.([1-9][0-9]*) (\([0-9-]+\))/'
86 => '<a name="\\1_\\2_\\3_\\4"></a>'
87 . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3_\\4">'
88 . '\\1.\\2.\\3.\\4 \\5</a>',
90 // Highlight releases (not linkable)
91 '/( ### )(.*)/'
92 => '\\1<b>\\2</b>',
94 // Links target and rel
95 '/a href="/' => 'a target="_blank" rel="noopener noreferrer" href="'
99 header('Content-type: text/html; charset=utf-8');
101 <!DOCTYPE HTML>
102 <html lang="en" dir="ltr">
103 <head>
104 <link rel="icon" href="favicon.ico" type="image/x-icon" />
105 <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
106 <title>phpMyAdmin - ChangeLog</title>
107 <meta charset="utf-8" />
108 </head>
109 <body>
110 <h1>phpMyAdmin - ChangeLog</h1>
111 <?php
112 echo '<pre>';
113 echo preg_replace(array_keys($replaces), $replaces, $changelog);
114 echo '</pre>';
116 </body>
117 </html>