fixed bug: print window would open and close right away, take 2. (#349)
[openemr.git] / phpmyadmin / changelog.php
blob6dbd4950593df9f864f50bae8406e9840f2dc21e
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_Response::getInstance();
15 $response->disable();
17 $filename = CHANGELOG_FILE;
19 /**
20 * Read changelog.
22 // Check if the file is available, some distributions remove these.
23 if (is_readable($filename)) {
25 // Test if the if is in a compressed format
26 if (substr($filename, -3) == '.gz') {
27 ob_start();
28 readgzfile($filename);
29 $changelog = ob_get_contents();
30 ob_end_clean();
31 } else {
32 $changelog = file_get_contents($filename);
34 } else {
35 printf(
36 __(
37 'The %s file is not available on this system, please visit '
38 . 'www.phpmyadmin.net for more information.'
40 $filename
42 exit;
45 /**
46 * Whole changelog in variable.
48 $changelog = htmlspecialchars($changelog);
50 $tracker_url = 'https://sourceforge.net/support/tracker.php?aid=\\1';
51 $tracker_url_bug = 'https://sourceforge.net/p/phpmyadmin/bugs/\\1/';
52 $tracker_url_rfe = 'https://sourceforge.net/p/phpmyadmin/feature-requests/\\1/';
53 $tracker_url_patch = 'https://sourceforge.net/p/phpmyadmin/patches/\\1/';
54 $github_url = 'https://github.com/phpmyadmin/phpmyadmin/';
55 $faq_url = 'http://docs.phpmyadmin.net/en/latest/faq.html';
57 $replaces = array(
58 '@(http://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@'
59 => '<a href="\\1">\\1</a>',
61 // sourceforge users
62 '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*)@users.sourceforge.net&gt;/i'
63 => '\\1 <a href="https://sourceforge.net/users/\\3/">\\2</a>',
64 '/thanks to ([^\(\r\n]+) \(([-\w]+)\)/i'
65 => 'thanks to <a href="https://sourceforge.net/users/\\2/">\\1</a>',
66 '/thanks to ([^\(\r\n]+) -\s+([-\w]+)/i'
67 => 'thanks to <a href="https://sourceforge.net/users/\\2/">\\1</a>',
69 // mail address
70 '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*@.*)&gt;/i'
71 => '\\1 <a href="mailto:\\3">\\2</a>',
73 // linking patches
74 '/patch\s*#?([0-9]{6,})/i'
75 => '<a href="' . $tracker_url . '">patch #\\1</a>',
77 // linking RFE
78 '/(?:rfe|feature)\s*#?([0-9]{6,})/i'
79 => '<a href="https://sourceforge.net/support/tracker.php?aid=\\1">RFE #\\1</a>',
81 // linking files
82 '/(\s+)([\\/a-z_0-9\.]+\.(?:php3?|html|pl|js|sh))/i'
83 => '\\1<a href="' . $github_url . 'commits/HEAD/\\2">\\2</a>',
85 // FAQ entries
86 '/FAQ ([0-9]+)\.([0-9a-z]+)/i'
87 => '<a href="' . $faq_url . '#faq\\1-\\2">FAQ \\1.\\2</a>',
89 // linking bugs
90 '/bug\s*#?([0-9]{6,})/i'
91 => '<a href="https://sourceforge.net/support/tracker.php?aid=\\1">bug #\\1</a>',
93 // all other 6+ digit numbers are treated as bugs
94 '/(?<!bug|RFE|patch) #?([0-9]{6,})/i'
95 => '<a href="' . $tracker_url . '">bug #\\1</a>',
97 // GitHub issues
98 '/issue\s*#?([0-9]{4,5}) /i'
99 => '<a href="' . $github_url . 'issues/\\1">issue #\\1</a> ',
101 // transitioned SF.net project bug/rfe/patch links
102 // by the time we reach 6-digit numbers, we can probably retire the above links
103 '/patch\s*#?([0-9]{4,5}) /i'
104 => '<a href="' . $tracker_url_patch . '">patch #\\1</a> ',
105 '/(?:rfe|feature)\s*#?([0-9]{4,5}) /i'
106 => '<a href="' . $tracker_url_rfe . '">RFE #\\1</a> ',
107 '/bug\s*#?([0-9]{4,5}) /i'
108 => '<a href="' . $tracker_url_bug . '">bug #\\1</a> ',
109 '/(?<!bug|RFE|patch) #?([0-9]{4,5}) /i'
110 => '<a href="' . $tracker_url_bug . '">bug #\\1</a> ',
112 // CVE/CAN entries
113 '/((CAN|CVE)-[0-9]+-[0-9]+)/'
114 => '<a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
116 // PMASAentries
117 '/(PMASA-[0-9]+-[0-9]+)/'
118 => '<a href="https://www.phpmyadmin.net/security/\\1/">\\1</a>',
120 // Highlight releases (with links)
121 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.0 (\([0-9-]+\))/'
122 => '<a name="\\1_\\2_\\3"></a>'
123 . '<a href="' . $github_url . 'commits/RELEASE_\\1_\\2_\\3">'
124 . '\\1.\\2.\\3.0 \\4</a>',
125 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.([1-9][0-9]*) (\([0-9-]+\))/'
126 => '<a name="\\1_\\2_\\3_\\4"></a>'
127 . '<a href="' . $github_url . 'commits/RELEASE_\\1_\\2_\\3_\\4">'
128 . '\\1.\\2.\\3.\\4 \\5</a>',
130 // Highlight releases (not linkable)
131 '/( ### )(.*)/'
132 => '\\1<b>\\2</b>',
136 header('Content-type: text/html; charset=utf-8');
138 <!DOCTYPE HTML>
139 <html lang="en" dir="ltr">
140 <head>
141 <link rel="icon" href="favicon.ico" type="image/x-icon" />
142 <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
143 <title>phpMyAdmin - ChangeLog</title>
144 <meta charset="utf-8" />
145 </head>
146 <body>
147 <h1>phpMyAdmin - ChangeLog</h1>
148 <?php
149 echo '<pre>';
150 echo preg_replace(array_keys($replaces), $replaces, $changelog);
151 echo '</pre>';
153 <script type="text/javascript">
154 var links = document.getElementsByTagName("a");
155 for(var i = 0; i < links.length; i++) {
156 links[i].target = "_blank";
158 </script>
159 </body>
160 </html>