Commit Graph
215 Commits
Author SHA1 Message Date
3e1dc3c886 fix: replace strtolower/strtoupper with locale-independent wrappers (#6717)
* 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>
2026-03-05 19:51:02 -05:00
Thomas VincentandCopilot 6bc77e58fa refactor: extract get_current_script_name() helper (#6731)
* cleanup: remove unreachable defensive error logs in aggregate graph item validation

* refactor: extract get_current_script_name() helper

DRY the basename($_SERVER['SCRIPT_NAME']) pattern into a dedicated
helper that guarantees a string return type. Replaces 4 call sites in
html.php, installer.php, and global_session.php. The existing
get_current_page() implementation body and the multi-source fallback
chain in get_selective_log_level() are intentionally unchanged.

Adds Pest unit tests covering existence, return type, path stripping,
and the empty-string fallback when no server vars are present.

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>
2026-03-05 19:40:23 -05:00
TheWitness 27919c50d7 Updating Copyrights to 2026 (#6578) 2026-01-28 16:11:10 -05:00
TheWitnessandCopilot b993471579 Fix #6539 - Allow Standard Cacti Log Files to be Rotated on Demand,PHPdoc, and Typing (#6540)
* Fix #6539 - Allow Standard Cacti Log Files to be Rotated on Demand from the Cacti UI

* QA: php-cs-fixer updates and documentation for lib/database.php

* QA: Update .gitignore for composer files

* QA: Update .gitignore for composer files

* QA: Back off .gitignore change its duplicated

* QA: Fix typing of db_has_permissions

* QA: Fixing typing issue in db_format_index_create

* Update lib/clog_webapi.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* QA: Fix additional code issues

* QA: Applying more defaults to add device

* QA: Fix at the database layer

* QA: Fixes based upon automated testing

* QA: Fix at the database layer

* QA: After new SQL checking

* QA: Skip MacTrack oui database download warnings

* QA: Fixing type issue

* QA: Recommendation from Copilot

* QA: Recommendation from Copilot

* QA: Recommendation from Copilot

* QA: Recommendation from Copilot

* QA: Some minor changes to avoid errors in testing

* QA: Unused variable

* QA: Recommendation from Copilot

* QA: Recommendation from Copilot

* QA: Recommendation from Copilot

* QA: Minor introduced code defect

* QA: Adding some unifying space around concatination

* QA: Consistent comments and new function alias'

* QA: Multi-line comment corrections

* QA: Fix SQL Style

* QA: Missed one function alias

* QA: PHPStan Level 2 and PHPDoc fixes

* QA: PHPStan Level 2 and PHPDoc Fixes

* QA: PHPStan Level 6 Fixes

* QA: Fix lib/xml.php to PHPStan Level 6

* QA: Wrong grep -v

* PHPStan Level 6 for lib/vdef.php

* PHPStan Level 8 for lib/time.php

* QA: Raise PHPStan to Level 6 for lib/database.php

* QA: Remove @deprecated tag from grv()

* QA: Switch to htmle() alias over html_escape()

* QA: More addressing PHPStan issues at Level 6

* QA: Change recommended by Copilot for Readability

* QA: More PHPStan fixes

* QA: More PHPStan fixes

* QA: More PHPStan fixes for lib/utility.php

* QA: More PHPStan fixes at Level 6

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: More PHPStan fixes at Level 6

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: More PHPStan fixes at Level 6

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: More PHPStan fixes at Level 6

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: Raise PHPStan to Level 6 More Functions

* QA: More PHPStan fixes at Level 6

* QA: Some phpseclib3 fixups to update to latest

* QA: More fixups for graphing for magic strings

* QA: More PHPStan fixes at Level 6

* QA: Fixing order string type on get_allowed_graphs()

* QA: Fixing improper use of print

* QA: Optimization of color_templates

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Raise PHPStan to Level 6 More Functions

* QA: Issues insalling Cacti

* QA: Issues insalling Cacti

* QA: Issues insalling Cacti

* QA: Issues insalling Cacti

* QA: Issues insalling Cacti

* QA: Issues testing Cacti

* QA: Copilot recommendation

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: Installer failing

* Undo ownership changes to remove tar errors

* QA: Updates after php-cs-fixer

* QA: Adding code checks to syntax checking

* QA Change syntax flow language

* QA: Reduce the number of cures

* QA: Use sequentional option

* Change runner to self-hosted for check job

* Fix typo in OS version in workflow file

* Add Git installation step in workflow

Added step to install Git if not already installed.

* Add '-y' flag to apt-get install and update commands

Updated apt-get commands to include '-y' for automatic confirmation.

* Change workflow OS version to 'ubuntu-latest'

Updated the workflow to use 'ubuntu-latest' instead of 'ubuntu:latest' and modified the 'runs-on' configuration.

* Remove sequential option from phpcsfixer script

* Remove PHPCS fixer step from workflow

Removed PHP coding standards check from workflow.

* Move code checks to before plugins

Moving these core checks to before the plugins are installed as we really want to check only the base Cacti here.

* Add Composer validation and caching to start of workflow

* QA: Addressing PHPStan additional

* QA: Restore composer lock file

* QA: Addressing PHPStan additional

* QA: Addressing PHPStan additional

* QA: Complete LDAP Project

* QA: php-cs-fixer doing it's thing

* QA: Syntax is already happening in PHPStan

* QA: The md5 function no longer exists

* QA: Update after ldap changes

* QA: Undo that last password hack

* QA: Attempting to switch to MariaDB 11.8

* QA: Attempting to switch to MariaDB 11.8

* QA: Resolving some issues with PHP8.4

* QA: Resolving some issues with PHP8.4

* QA: Add PHP8.5 to the matrix

* QA: Removing PHP8.5 due to dependency issues

* QA: Add the DB version to the testing output

* QA: Switch back to MySQL for the moment

* QA: More fidelity in reporting

* QA: The pipe must be mixed

* QA: Moving audit_schema.php changes from 1.2.x

* QA: Moving audit_schema.php changes from 1.2.x

* QA: Restore mysql monitoring

* QA: php-cs-fixer issues

* QA: Attempt to roll back to MariaDB 10.6

* QA: Attempt to fix check_all_pages.sh

* QA: Make installer functional again

* QA: Fix installer php-cs-fixer issues

* QA: Type to a string

* QA: Get the database version correctly

* QA: Fix issue with reports in check_all_pages.sh

* QA: Check the server version in the right place

* Feature: Support SHA256 as a new hash for passwords

* QA: Function definition and return typing audit

* QA: Refinement of form types

* QA: Refinement of form types

* QA: Consistency of comments

* QA: Issues with php-cs-fixer and more comments

* QA: More typing issues

* QA: php-cs-fixer on merge conflict resolution

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-25 10:13:56 -05:00
Petr Macek 15cad13fc4 snmpv3 info and small css fix - icons are not visible in modern theme (#6512) 2026-01-04 18:06:13 -05:00
Browniebraun 1627c7a150 Font Awesome Icons to Tabler Icons migration 2025-12-16 20:27:05 +01:00
TheWitness b9334a15d9 QA: Updates for files for php-cs-fixer and some php-doc changes 2025-11-18 21:01:15 -05:00
TheWitness e2cf22a587 QA: Fixing issue with installer 2025-08-17 17:16:12 -04:00
Petr Macek 3afe04fdb3 add profiles with longer retention (#6287) 2025-07-14 19:49:31 -04:00
Petr Macek 62b512ca59 feature #6228 - add admin's email to installer, enable Notify admin (#6274)
* feature #6228 - add admin's email to installer and enable Notify primary admin of issues

* update
2025-06-25 15:32:00 -04:00
TheWitness 685d4b9357 Start addressing PHPStan Issues 2025-03-23 14:09:11 -04:00
TheWitness 44bdd44466 Minor Lint Checking Fixes 2025-03-23 12:51:35 -04:00
TheWitness e5c4015e0e QA: Remove most references to $config
This removes most entries to $config in the base code.  A few new constants were defined to achieve this:

* CACTI_CONNECTION - The status of the current connection
* CACTI_CSRF_SECRET - The path to the csrf secret file
* CACTI_PHP_SNMP - True if php-snmp is installed
* CACTI_WHITELIST - The path to the Cacti Whitelist file if defined

I also moved several $config['poller_id'] to the existing POLLER_ID and move a number of $config['is_web'] to the existing CACTI_WEB constants.

There remain a few artifacts in the code.  They will be handled in a separate commit.
2025-03-22 16:48:59 -04:00
TheWitness f96425ba96 QA: Match function does not work with Class Constants 2025-03-09 15:50:50 -04:00
TheWitness 2c779273f9 Copyright Updates and PHP-CS-Fixer updates 2025-03-09 14:34:19 -04:00
Jimmy Conner 1e7cbdda3e Add JPs fix back in 2025-02-23 22:52:38 -06:00
Jimmy ConnerandTheWitness 65ab16f5cf Start converting to newer PHP Syntax and Functions (#6103)
* Add Rector

* Add Rector

* Fix "Cashed" misspelling

Also harmonize the phrase with the one below it

* Fix implode error in db_table_create

Only relevant when multiple primary keys

* Fix auth issue, parentheses in the wrong location

Was causing too many arguments to be sent to cacti_sizeof which only take 1, instead of get_allowed_devices.

* Fix issue with session_var not properly using class variable

* Fix pass by reference error in get_allowed_devices

get_allowed_devices has a pass by reference on the "total_rows" field.  It is used in several places to pass the total_rows back to a counter.  Here though, we are passing a number directly to the function, which errors out with "Uncaught Error: get_allowed_devices(): Argument #4 ($total_rows) cannot be passed by reference".  So we will just place a dummy variable in front to catch the pass.

This wasn't caught before because the previous parentheses issue.

* Fix undefined variable "field_array" in html_filter

* Fix undefined function 'get_nfilter_filter_request_var'

* Fix undefined variable 'resizable'

I corrected the function parameter, as that was technically the incorrect spelling

* Fix invalid variable $user_id

* Fix undefined vars in spikekill class

* Fix copy and paste error

Oops

* Forgot to use the dummy variables

* Add missing $

Oops

* Start converting to newer PHP Syntax and Functions

* Test fixing the workflow by install composer

* Lets not valid the composer file right now
Seems we have a few things to fix it in

* Validate composer

* Lite formating changes

* lite formatting

* lite formatting

* lite format changes

* lite format changes

* lite format changes

* lite format changes

* lite format changes

* lite format changes

* lite format changes

* lite format changes

---------

Co-authored-by: TheWitness <thewitness@cacti.net>
2025-02-23 15:14:54 -05:00
Linegod 048f2abcc8 typos 2025-02-23 00:13:55 -06:00
TheWitness fb05ea4a45 QA: Restore inline tooltip help links 2025-02-19 16:59:51 -05:00
Mark Brugnoli-Vinten fe54541e2c QA: Fix issues with layout on confirmation screen 2025-01-29 18:08:52 +00:00
Mark Brugnoli-Vinten 9cb39b0437 QA: Fix issue with suggested ownership commands 2025-01-29 17:49:41 +00:00
Petr Macek b17d3f3c66 installer - Notices and recommendations (#6069)
* change installer page to Notices and recommendations

* update
2025-01-19 15:18:54 -05:00
Browniebraun d88d3acd30 reverting FontAwesome till better solution has been identified. 2025-01-15 23:04:14 +01:00
Browniebraun 5be7d7f18b Migrating icons from FontAwesome to Tabler 2025-01-05 20:58:36 +01:00
Petr Macek a8397087d1 fix href (#6026) 2024-12-29 16:44:00 -05:00
TheWitness 773a5a7c6c QA: Security audit sweep results 2024-12-24 11:56:28 -05:00
TheWitness 853a8621be QA: Fix: #5998 - Excess Logging during install/upgrade 2024-12-22 09:36:12 -05:00
Sean Mancini b74f5e7207 Update install logging around poller sync (#6008)
* Update installer.php

Add missing case for poller installation

* Better messaging around poller sync logging
2024-12-16 22:44:30 -05:00
Sean Mancini c2b20534d8 Update installer.php (#6007)
Add missing case for poller installation
2024-12-16 13:08:57 -05:00
TheWitness d60b57def5 QA: Light re-arrangement of installation summary 2024-12-16 10:25:50 -05:00
TheWitness e2e012df2b QA: Installer language tense 2024-12-12 11:23:52 -05:00
TheWitness b9e9bfe705 QA: Fix: #5972 - Due to empty snmp_options variable
* Resolved by adding debug logic to the installer.
2024-12-09 13:51:23 -05:00
TheWitness 6aa0a901ee QA: Issue #1585 - Template count not correct 2024-12-05 21:54:02 -05:00
TheWitness 8b83acd1cd Fix: #1585 - Install Confirm Screen
* Confirmation screen should show what options have been picked
2024-12-05 19:05:18 -05:00
TheWitness 075b02cdca QA: Clearing errors in php's error_log 2024-11-29 12:01:34 -05:00
Linegod c3b176780f typos 2024-11-24 23:22:15 -06:00
TheWitness 9591bc37ee QA: Fixing #5845 - Templates fail to install 2024-10-08 14:55:58 -04:00
Petr Macek cbd8fe8724 add missing http/https (#5816) 2024-09-09 10:14:34 -04:00
TheWitness 9f82109fbb Fixing #5754 and #5759 - Installer Issues
-issue#5754: Installer replication loop for. Plugin realms
-issue#5759: Remote poller attempts to sync with other pollers during install
2024-07-04 19:33:20 -04:00
TheWitness 5f78605e28 Fixing #5723 - Remote poller install does not finish
Remote Poller installation is finished successfully but no "finish" button
2024-04-15 18:28:31 -04:00
TheWitness 8333ed6005 Fixing #5720 - Remote Database Mysql Time Zone check
mysql.time_zone_name table DB check isn't being made on Remote Poller installation
2024-04-15 18:22:03 -04:00
TheWitness 1aa72d24c9 QA: Update Copyright to 2024 2024-02-03 14:18:57 -05:00
Mark Brugnoli-Vinten 2c1df01b77 Make installer allow default template as an option (#5583)
Closes #5583
2023-11-27 11:04:18 +00:00
TheWitness dc394ac956 QA: Make #5583 work on PHP5.4 2023-11-24 13:43:04 -05:00
TheWitness ed69ff0abb QA: #5583 - Missed on file - adding more logging 2023-11-24 13:38:12 -05:00
TheWitness 28c70c9562 QA: #5583 - Rework default process a little 2023-11-24 12:36:48 -05:00
TheWitness e6057000a0 Fixing #5583 - Default Device Template Preset
On install ensure Default Device is either Net-SNMP or Cisco Router or allow user to define during install
2023-11-24 09:28:19 -05:00
Jing Chen 1626fdd7cf Upgrade flag-icon-css v3.1.0 to flag-icons v6.11.1 (#5497) 2023-09-27 20:56:42 -04:00
TheWitness 236d1ab392 Fixing #5495 - Upgrade language inacurate
Upon upgrade, cacti falsely assumes that a plugin is not compatible, when it could simply not be present
2023-09-23 13:21:55 -04:00
TheWitness b31d198b47 QA: Remove Image Format Hack
* Removing since we now have SVG working in Windows
2023-08-20 10:14:32 -04:00