Skip to content

Commit

Permalink
Update functions.php for PHP8
Browse files Browse the repository at this point in the history
  • Loading branch information
orynider authored Apr 14, 2024
1 parent 2694948 commit 00ac9b7
Showing 1 changed file with 37 additions and 23 deletions.
60 changes: 37 additions & 23 deletions includes/shared/phpbb2/includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: functions.php,v 1.7 2023/10/17 15:40:14 orynider Exp $
*
* $Id: functions.php,v 1.7 2024/04/14 05:40:14 orynider Exp $
* link http://github.com/MX-Publisher
*
***************************************************************************/

Expand All @@ -27,11 +27,11 @@
class phpBB2
{
protected $template;
protected $mx_user;
protected $user;
protected $db;
protected $mx_request_vars;
protected $mx_cache;
protected $board_config;
protected $request;
protected $cache;
protected $config;
protected $php_ext;
protected $root_path;
protected $mx_root_path;
Expand All @@ -42,14 +42,14 @@ public function __construct()
{
global $template, $mx_user, $db, $mx_cache, $mx_request_vars, $board_config, $phpEx, $phpbb_root_path, $mx_root_path, $module_root_path;

$this->template = $template;
$this->user = $mx_user;
$this->db = $db;
$this->request = $mx_request_vars;
$this->cache = $mx_cache;
$this->config = $board_config;
$this->php_ext = $phpEx;
$this->root_path = $mx_root_path;
$this->template = $template;
$this->user = $mx_user;
$this->db = $db;
$this->request = $mx_request_vars;
$this->cache = $mx_cache;
$this->config = $board_config;
$this->php_ext = $phpEx;
$this->root_path = $mx_root_path;
$this->mx_root_path = $mx_root_path;
$this->module_root_path = $module_root_path;
$this->phpbb_root_path = $phpbb_root_path;
Expand Down Expand Up @@ -510,10 +510,10 @@ function phpbb_rtrim($str, $charlist = false)
{
return rtrim($str);
}

$php_version = explode('.', PHP_VERSION);

// php version < 4.1.0
// If we are on PHP >= 4.1 we do not need some code
if ((int) $php_version[0] < 4 || ((int) $php_version[0] == 4 && (int) $php_version[1] < 1))
{
while ($str[strlen($str)-1] == $charlist)
Expand Down Expand Up @@ -854,6 +854,7 @@ function mx_chmod($files, $perms = null, $recursive = false, $force_chmod_link =
}
}
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -2612,16 +2613,22 @@ function setup_style($style)
}

$img_lang = (file_exists(@phpbb_realpath($phpbb_root_path . $current_template_path . '/images/lang_' . $board_config['default_lang']))) ? $board_config['default_lang'] : 'english';

while(list($key, $value) = @each($images))

/* start Migrating from php5 to php7+ value
while(list($key, $value) = @each($images))
{
with
foreach ($images as $key => $value)
{
ends Migrating */
foreach ($images as $key => $value)
{
if (!is_array($value))
{
$images[$key] = str_replace('{LANG}', $mx_user->img_lang_dir, $value);
}
}
}

return $row;
}

Expand Down Expand Up @@ -2745,17 +2752,24 @@ function create_date($format, $gmepoch, $tz)

if (empty($translate) && $board_config['default_lang'] != 'english')
{
@reset($lang['datetime']);
while (list($match, $replace) = @each($lang['datetime']))
reset($lang['datetime']);
foreach ($lang['datetime'] as $match => $replace)
{
$translate[$match] = $replace;
}
}

if (empty($translate))
{
@reset($lang['datetime']);
while (list($match, $replace) = @each($lang['datetime']))
reset($lang['datetime']);
/* start Migrating from php5 to php7+ replace
foreach ($lang['datetime'] as $match => $replace)
{
with
while (list($match, $replace) = each($lang['datetime']))
{
ends Migrating */
foreach ($lang['datetime'] as $match => $replace)
{
$translate[$match] = $replace;
}
Expand Down

0 comments on commit 00ac9b7

Please sign in to comment.