Fix #16325 Editing geometry data throws error on using the GUI
[phpmyadmin.git] / changelog.php
blobc706dd512850417ac50a70e0eff8fcb661ac7cfd
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 declare(strict_types=1);
10 use PhpMyAdmin\Response;
11 use PhpMyAdmin\Template;
13 if (! defined('ROOT_PATH')) {
14 define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
17 /**
18 * Gets core libraries and defines some variables
20 require ROOT_PATH . 'libraries/common.inc.php';
22 /** @var Template $template */
23 $template = $containerBuilder->get('template');
25 $response = Response::getInstance();
26 $response->disable();
27 $response->getHeader()->sendHttpHeaders();
29 $filename = CHANGELOG_FILE;
31 /**
32 * Read changelog.
34 // Check if the file is available, some distributions remove these.
35 if (@is_readable($filename)) {
36 // Test if the if is in a compressed format
37 if (substr($filename, -3) == '.gz') {
38 ob_start();
39 readgzfile($filename);
40 $changelog = ob_get_contents();
41 ob_end_clean();
42 } else {
43 $changelog = file_get_contents($filename);
45 } else {
46 printf(
47 __(
48 'The %s file is not available on this system, please visit ' .
49 '%s for more information.'
51 $filename,
52 '<a href="https://www.phpmyadmin.net/">phpmyadmin.net</a>'
54 exit;
57 /**
58 * Whole changelog in variable.
60 $changelog = htmlspecialchars($changelog);
62 $github_url = 'https://github.com/phpmyadmin/phpmyadmin/';
63 $faq_url = 'https://docs.phpmyadmin.net/en/latest/faq.html';
65 $replaces = [
66 '@(https?://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@'
67 => '<a href="url.php?url=\\1">\\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 // FAQ entries
74 '/FAQ ([0-9]+)\.([0-9a-z]+)/i'
75 => '<a href="url.php?url=' . $faq_url . '#faq\\1-\\2">FAQ \\1.\\2</a>',
77 // GitHub issues
78 '/issue\s*#?([0-9]{4,5}) /i'
79 => '<a href="url.php?url=' . $github_url . 'issues/\\1">issue #\\1</a> ',
81 // CVE/CAN entries
82 '/((CAN|CVE)-[0-9]+-[0-9]+)/'
83 => '<a href="url.php?url=https://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
85 // PMASAentries
86 '/(PMASA-[0-9]+-[0-9]+)/'
87 => '<a href="url.php?url=https://www.phpmyadmin.net/security/\\1/">\\1</a>',
89 // Highlight releases (with links)
90 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.0 (\([0-9-]+\))/'
91 => '<a id="\\1_\\2_\\3"></a>'
92 . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3">'
93 . '\\1.\\2.\\3.0 \\4</a>',
94 '/([0-9]+)\.([0-9]+)\.([0-9]+)\.([1-9][0-9]*) (\([0-9-]+\))/'
95 => '<a id="\\1_\\2_\\3_\\4"></a>'
96 . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3_\\4">'
97 . '\\1.\\2.\\3.\\4 \\5</a>',
99 // Highlight releases (not linkable)
100 '/( ### )(.*)/'
101 => '\\1<b>\\2</b>',
103 // Links target and rel
104 '/a href="/' => 'a target="_blank" rel="noopener noreferrer" href="',
108 header('Content-type: text/html; charset=utf-8');
110 echo $template->render('changelog', [
111 'changelog' => preg_replace(array_keys($replaces), $replaces, $changelog),