Fix PHP 8.x compatibility issues across the codebase

Co-authored-by: magicbug <84308+magicbug@users.noreply.github.com>
这个提交包含在:
copilot-swe-agent[bot] 2025-08-25 15:14:21 +00:00
父节点 02b11de709
当前提交 759c7b31f2
共有 3 个文件被更改,包括 19 次插入8 次删除

查看文件

@ -107,8 +107,8 @@
?> ?>
<td><span data-bs-toggle="tooltip" title="<?php if ($rove['mhz'] != '') { <td><span data-bs-toggle="tooltip" title="<?php if ($rove['mhz'] != '') {
printf("%.3f", $rove['mhz']); printf("%.3f", $rove['mhz']);
echo " " . $direction ?? ''; echo " " . ($direction ?? '');
} ?>"><?= $rove['satellite']['name'] ?></span></td> } ?>"><?php echo $rove['satellite']['name']; ?></span></td>
<td><span title="<?php echo $rove['mode']; ?>" class="badge <?php echo $modeclass; ?>"><?php echo $rove['mode']; ?></span></td> <td><span title="<?php echo $rove['mode']; ?>" class="badge <?php echo $modeclass; ?>"><?php echo $rove['mode']; ?></span></td>
<td> <td>

查看文件

@ -21,8 +21,8 @@ if (!isset($options->operator)) {
?> ?>
</script> </script>
<script> <script>
const CSRF_NAME = '<?= $this->security->get_csrf_token_name(); ?>'; const CSRF_NAME = '<?php echo $this->security->get_csrf_token_name(); ?>';
const CSRF_HASH = '<?= $this->security->get_csrf_hash(); ?>'; const CSRF_HASH = '<?php echo $this->security->get_csrf_hash(); ?>';
</script> </script>
<style> <style>
/*Legend specific*/ /*Legend specific*/

查看文件

@ -152,7 +152,7 @@ class CI_Encryption {
public function __construct(array $params = array()) public function __construct(array $params = array())
{ {
$this->_drivers = array( $this->_drivers = array(
'mcrypt' => defined('MCRYPT_DEV_URANDOM'), 'mcrypt' => defined('MCRYPT_DEV_URANDOM') && function_exists('mcrypt_encrypt'),
'openssl' => extension_loaded('openssl') 'openssl' => extension_loaded('openssl')
); );
@ -203,9 +203,20 @@ class CI_Encryption {
if (empty($this->_driver)) if (empty($this->_driver))
{ {
$this->_driver = ($this->_drivers['openssl'] === TRUE) // Prefer OpenSSL on modern PHP versions where mcrypt is not available
? 'openssl' if ($this->_drivers['openssl'] === TRUE)
: 'mcrypt'; {
$this->_driver = 'openssl';
}
elseif ($this->_drivers['mcrypt'] === TRUE)
{
$this->_driver = 'mcrypt';
}
else
{
// This shouldn't happen as we check both drivers in constructor
show_error('Encryption: No available encryption driver found.');
}
log_message('debug', "Encryption: Auto-configured driver '".$this->_driver."'."); log_message('debug', "Encryption: Auto-configured driver '".$this->_driver."'.");
} }