mirror of
https://github.com/Cacti/cacti.git
synced 2026-10-23 03:27:02 +09:00
* cleanup: remove unreachable defensive error logs in aggregate graph item validation * fix: replace strtolower/strtoupper with locale-independent wrappers PHP 8.5 deprecates locale-sensitive strtolower() and strtoupper(). Add cacti_strtolower() and cacti_strtoupper() wrappers that use mb_strtolower/mb_strtoupper with explicit UTF-8 encoding, then replace all 185 call sites across 65 files. Existing mb_strtolower() calls (email normalization) are left as-is since they already specify encoding explicitly. Includes 18 Pest tests covering ASCII, UTF-8, protocol names, config values, hex strings, NaN detection, and file extension patterns. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * fix: correct docblock references and month_shift() strpos check Fix docblocks to reference strtolower()/strtoupper() (the deprecated PHP builtins) instead of the wrapper names. Fix month_shift() to use strpos() !== false instead of > 0 so 'month' at position 0 is matched. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * chore: drop unrelated lib/api_aggregate changes Keep PR scope focused on the issue for this branch. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: TheWitness <thewitness@cacti.net>
235 lines
6.2 KiB
PHP
235 lines
6.2 KiB
PHP
<?php
|
|
/*
|
|
+-------------------------------------------------------------------------+
|
|
| Copyright (C) 2004-2026 The Cacti Group |
|
|
| |
|
|
| This program is free software; you can redistribute it and/or |
|
|
| modify it under the terms of the GNU General Public License |
|
|
| as published by the Free Software Foundation; either version 2 |
|
|
| of the License, or (at your option) any later version. |
|
|
| |
|
|
| This program is distributed in the hope that it will be useful, |
|
|
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
| GNU General Public License for more details. |
|
|
+-------------------------------------------------------------------------+
|
|
| Cacti: The Complete RRDtool-based Graphing Solution |
|
|
+-------------------------------------------------------------------------+
|
|
| This code is designed, written, and maintained by the Cacti Group. See |
|
|
| about.php and/or the AUTHORS file for specific developer information. |
|
|
+-------------------------------------------------------------------------+
|
|
| http://www.cacti.net/ |
|
|
+-------------------------------------------------------------------------+
|
|
*/
|
|
|
|
require('./include/auth.php');
|
|
require_once(CACTI_PATH_LIBRARY . '/api_data_source.php');
|
|
require_once(CACTI_PATH_LIBRARY . '/boost.php');
|
|
require_once(CACTI_PATH_LIBRARY . '/rrd.php');
|
|
require_once(CACTI_PATH_LIBRARY . '/clog_webapi.php');
|
|
require_once(CACTI_PATH_LIBRARY . '/poller.php');
|
|
require_once(CACTI_PATH_LIBRARY . '/utility.php');
|
|
|
|
// set default action
|
|
set_default_action();
|
|
|
|
switch (grv('action')) {
|
|
default:
|
|
if (!api_plugin_hook_function('changelog_action', grv('action'))) {
|
|
top_header();
|
|
changelog_view();
|
|
bottom_footer();
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
function changelog_view() : void {
|
|
global $database_default, $rrdtool_versions, $poller_options, $input_types, $local_db_cnn_id;
|
|
|
|
// ================= input validation =================
|
|
gfrv('tab', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^([a-z_A-Z]+)$/']]);
|
|
// ====================================================
|
|
|
|
top_header();
|
|
|
|
// present a tabbed interface
|
|
$tabs = [
|
|
'highlights' => __('Highlights'),
|
|
'full' => __('Full'),
|
|
];
|
|
|
|
// set the default tab
|
|
load_current_session_value('tab', 'sess_cl_tabs', 'summary');
|
|
$current_tab = gnrv('tab');
|
|
|
|
$page = 'changelog.php?tab=' . $current_tab;
|
|
|
|
$refresh = [
|
|
'seconds' => 999999,
|
|
'page' => $page,
|
|
'logout' => 'false'
|
|
];
|
|
|
|
set_page_refresh($refresh);
|
|
$i = 0;
|
|
|
|
// draw the tabs
|
|
print "<div class='tabs'><nav><ul role='tablist'>";
|
|
|
|
foreach (array_keys($tabs) as $tab_short_name) {
|
|
print "<li class='subTab'><a class='tab" . (($tab_short_name == $current_tab) ? " selected'" : "'") .
|
|
" href='" . htmle(CACTI_PATH_URL .
|
|
'changelog.php?tab=' . $tab_short_name) .
|
|
"'>" . $tabs[$tab_short_name] . '</a></li>';
|
|
|
|
$i++;
|
|
}
|
|
|
|
api_plugin_hook('changelog_tab');
|
|
|
|
print '</ul></nav></div>';
|
|
|
|
$tab = grv('tab');
|
|
|
|
if (empty($tabs[$tab])) {
|
|
$tab_keys = array_keys($tabs);
|
|
$tab = reset($tab_keys);
|
|
}
|
|
$header_label = __esc('Change Log [%s]', $tabs[$tab]);
|
|
|
|
// Display tech information
|
|
$changelog = file(CACTI_PATH_BASE . '/CHANGELOG');
|
|
|
|
$full = $current_tab == 'full';
|
|
|
|
array_shift($changelog);
|
|
array_shift($changelog);
|
|
|
|
$ver = '';
|
|
$vers = [];
|
|
$details = [];
|
|
$first = '';
|
|
|
|
foreach ($changelog as $line) {
|
|
$line = trim($line);
|
|
|
|
if (isset($line[0]) && ($line[0] == '*' || $line[0] == '-')) {
|
|
$detail = false;
|
|
|
|
if (preg_match('/-(issue|feature|security): (.*)/i', $line, $parts)) {
|
|
$detail = ['desc' => $parts[2]];
|
|
} elseif (preg_match('/-(issue|feature|security)#(\d+)\: (.*)/i', $line, $parts)) {
|
|
$detail = ['desc' => $parts[3], 'issue' => $parts[2]];
|
|
}
|
|
|
|
$type = 'unknown';
|
|
|
|
if (isset($parts[1])) {
|
|
$type = cacti_strtolower($parts[1]);
|
|
|
|
if ($type == 'security') {
|
|
$type = ' security';
|
|
}
|
|
}
|
|
|
|
if (!empty($detail)) {
|
|
if (empty($details[$type])) {
|
|
$details[$type] = [];
|
|
}
|
|
$details[$type][] = $detail;
|
|
}
|
|
} elseif (!empty($line)) {
|
|
if (!empty($ver)) {
|
|
$vers[$ver] = $details;
|
|
$first = true;
|
|
$details = [];
|
|
}
|
|
|
|
if (count($vers) > 4) {
|
|
break;
|
|
}
|
|
$ver = $line;
|
|
}
|
|
}
|
|
|
|
krsort($vers);
|
|
|
|
foreach ($vers as $ver => $changelog) {
|
|
if ($ver != '') {
|
|
html_start_box(__('Version %s', $ver), '100%', false, 3, 'center', '');
|
|
ksort($changelog);
|
|
|
|
foreach ($changelog as $type => $details) {
|
|
$output = false;
|
|
|
|
foreach ($details as $detail) {
|
|
$highlight = false;
|
|
|
|
switch ($type) {
|
|
case 'issue':
|
|
$icon = '<i class="ti ti-tool"></i>';
|
|
|
|
break;
|
|
case 'feature':
|
|
$icon = '<i class="ti ti-rocket"></i>';
|
|
$highlight = true;
|
|
|
|
break;
|
|
case ' security':
|
|
$icon = '<i class="ti ti-shield-half"></i>';
|
|
$highlight = true;
|
|
|
|
break;
|
|
default:
|
|
$icon = '<i class="ti ti-help"></i>';
|
|
|
|
break;
|
|
}
|
|
|
|
if ($current_tab == 'full' || $highlight) {
|
|
if (!$output) {
|
|
html_section_header(htmle($type), 4);
|
|
$output = true;
|
|
}
|
|
|
|
form_alternate_row();
|
|
|
|
print '<td>' . $icon . '</td><td>' . htmle($type) . '</td><td>';
|
|
|
|
if (!empty($detail['issue'])) {
|
|
print '<a target="_blank" href="https://github.com/cacti/cacti/issues/' . htmle($detail['issue']) . '">' . htmle($detail['issue']) . '</a>';
|
|
}
|
|
print '</td><td>' . htmle($detail['desc']) . '</td>';
|
|
|
|
form_end_row();
|
|
}
|
|
}
|
|
}
|
|
html_end_box();
|
|
|
|
if ($current_tab !== 'full') {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|
|
<script type='text/javascript'>
|
|
$(function() {
|
|
$('#tables').tablesorter({
|
|
widgets: ['zebra'],
|
|
widgetZebra: { css: ['even', 'odd'] },
|
|
headerTemplate: '<div class="textSubHeaderDark">{content} {icon}</div>',
|
|
cssIconAsc: 'fa-sort-up',
|
|
cssIconDesc: 'fa-sort-down',
|
|
cssIconNone: 'fa-sort',
|
|
cssIcon: 'fa'
|
|
});
|
|
});
|
|
</script>
|
|
<?php
|
|
|
|
bottom_footer();
|
|
}
|