Translated using Weblate (Chinese (China))
[phpmyadmin.git] / changelog.php
blobdb654c08e78e93fb48943c848e3fbcdd3c5c15ed
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 '%s for more information.'
41 $filename,
42 '<a href="https://www.phpmyadmin.net/">phpmyadmin.net</a>'
44 exit;
47 /**
48 * Whole changelog in variable.
50 $changelog = htmlspecialchars($changelog);
52 $tracker_url = 'https://sourceforge.net/support/tracker.php?aid=\\1';
53 $tracker_url_bug = 'https://sourceforge.net/p/phpmyadmin/bugs/\\1/';
54 $tracker_url_rfe = 'https://sourceforge.net/p/phpmyadmin/feature-requests/\\1/';
55 $tracker_url_patch = 'https://sourceforge.net/p/phpmyadmin/patches/\\1/';
56 $github_url = 'https://github.com/phpmyadmin/phpmyadmin/';
57 $faq_url = 'https://docs.phpmyadmin.net/en/latest/faq.html';
59 $replaces = array(
60 '@(https?://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@'
61 => '<a href="url.php?url=\\1">\\1</a>',
63 // sourceforge users
64 '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*)@users.sourceforge.net&gt;/i'
65 => '\\1 <a href="url.php?url=https://sourceforge.net/users/\\3/">\\2</a>',
66 '/thanks to ([^\(\r\n]+) \(([-\w]+)\)/i'
67 => 'thanks to <a href="url.php?url=https://sourceforge.net/users/\\2/">\\1</a>',
68 '/thanks to ([^\(\r\n]+) -\s+([-\w]+)/i'
69 => 'thanks to <a href="url.php?url=https://sourceforge.net/users/\\2/">\\1</a>',
71 // mail address
72 '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*@.*)&gt;/i'
73 => '\\1 <a href="mailto:\\3">\\2</a>',
75 // linking patches
76 '/patch\s*#?([0-9]{6,})/i'
77 => '<a href="url.php?url=' . $tracker_url . '">patch #\\1</a>',
79 // linking RFE
80 '/(?:rfe|feature)\s*#?([0-9]{6,})/i'
81 => '<a href="url.php?url=https://sourceforge.net/support/tracker.php?aid=\\1">RFE #\\1</a>',
83 // linking files
84 '/(\s+)([\\/a-z_0-9\.]+\.(?:php3?|html|pl|js|sh))/i'
85 => '\\1<a href="url.php?url=' . $github_url . 'commits/HEAD/\\2">\\2</a>',
87 // FAQ entries
88 '/FAQ ([0-9]+)\.([0-9a-z]+)/i'
89 => '<a href="url.php?url=' . $faq_url . '#faq\\1-\\2">FAQ \\1.\\2</a>',
91 // linking bugs
92 '/bug\s*#?([0-9]{6,})/i'
93 => '<a href="url.php?url=https://sourceforge.net/support/tracker.php?aid=\\1">bug #\\1</a>',
95 // all other 6+ digit numbers are treated as bugs
96 '/(?<!bug|RFE|patch) #?([0-9]{6,})/i'
97 => '<a href="url.php?url=' . $tracker_url . '">bug #\\1</a>',
99 // GitHub issues
100 '/issue\s*#?([0-9]{4,5}) /i'
101 => '<a href="url.php?url=' . $github_url . 'issues/\\1">issue #\\1</a> ',
103 // transitioned SF.net project bug/rfe/patch links
104 // by the time we reach 6-digit numbers, we can probably retire the above links
105 '/patch\s*#?([0-9]{4,5}) /i'
106 => '<a href="url.php?url=' . $tracker_url_patch . '">patch #\\1</a> ',
107 '/(?:rfe|feature)\s*#?([0-9]{4,5}) /i'
108 => '<a href="url.php?url=' . $tracker_url_rfe . '">RFE #\\1</a> ',
109 '/bug\s*#?([0-9]{4,5}) /i'
110 => '<a href="url.php?url=' . $tracker_url_bug . '">bug #\\1</a> ',
111 '/(?<!bug|RFE|patch) #?([0-9]{4,5}) /i'
112 => '<a href="url.php?url=' . $tracker_url_bug . '">bug #\\1</a> ',
114 // CVE/CAN entries
115 '/((CAN|CVE)-[0-9]+-[0-9]+)/'
116 => '<a href="url.php?url=https://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
118 // PMASAentries
119 '/(PMASA-[0-9]+-[0-9]+)/'
120 => '<a href="url.php?url=https://www.phpmyadmin.net/security/\\1/">\\1</a>',
122 // Highlight releases (with links)
123 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.0 (\([0-9-]+\))/'
124 => '<a name="\\1_\\2_\\3"></a>'
125 . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3">'
126 . '\\1.\\2.\\3.0 \\4</a>',
127 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.([1-9][0-9]*) (\([0-9-]+\))/'
128 => '<a name="\\1_\\2_\\3_\\4"></a>'
129 . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3_\\4">'
130 . '\\1.\\2.\\3.\\4 \\5</a>',
132 // Highlight releases (not linkable)
133 '/( ### )(.*)/'
134 => '\\1<b>\\2</b>',
138 header('Content-type: text/html; charset=utf-8');
140 <!DOCTYPE HTML>
141 <html lang="en" dir="ltr">
142 <head>
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" />
147 </head>
148 <body>
149 <h1>phpMyAdmin - ChangeLog</h1>
150 <?php
151 echo '<pre>';
152 echo preg_replace(array_keys($replaces), $replaces, $changelog);
153 echo '</pre>';
155 <script type="text/javascript">
156 var links = document.getElementsByTagName("a");
157 for(var i = 0; i < links.length; i++) {
158 links[i].target = "_blank";
159 links[i].rel = "noopener noreferrer";
161 </script>
162 </body>
163 </html>