Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix several PHP8 deprecated issues #301

Open
wants to merge 11 commits into
base: feature
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boards/bbpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class BBPRESS_Converter extends Converter
* @param string $gids A serialized list of original roles
* @return string group id(s)
*/
function get_group_id($gids)
function get_group_id($gids, $remove=array())
{
// bbPress saves roles as ["name" => true]
$roles = array_keys(unserialize($gids));
Expand Down
2 changes: 1 addition & 1 deletion boards/fluxbb/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function convert_data($data)
$insert_data['timezone'] = str_replace(array('.0', '.00'), array('', ''), $data['timezone']);

$insert_data['lastpost'] = (int)$data['last_post'];
$insert_data['icq'] = $data['icq'];
//$insert_data['icq'] = $data['icq'];
$insert_data['hideemail'] = $data['email_setting'];
$insert_data['allownotices'] = $data['notify_with_post'];
$insert_data['regip'] = my_inet_pton($data['registration_ip']);
Expand Down
2 changes: 1 addition & 1 deletion boards/ipb3/polls.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function convert_data($data)
$insert_data['import_tid'] = $data['tid'];
$insert_data['import_pid'] = $data['pid'];
$insert_data['tid'] = $this->get_import->tid($data['tid']);
$choices = unserialize(utf8_decode($data['choices']));
$choices = unserialize(mb_convert_encoding($data['choices'], 'ISO-8859-1', 'UTF-8'));
$choices = $choices[1];

$seperator = '';
Expand Down
2 changes: 1 addition & 1 deletion boards/ipb3/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function convert_data($data)
{
$insert_data['birthday'] = $data['bday_day'].'-'.$data['bday_month'].'-'.$data['bday_year'];
}
$insert_data['icq'] = $data['field_4'];
//$insert_data['icq'] = $data['field_4'];
$insert_data['skype'] = $data['field_10'];
$insert_data['timezone'] = str_replace(array('.0', '.00'), array('', ''), $data['time_offset']);
$insert_data['timezone'] = ((!strstr($insert_data['timezone'], '+') && !strstr($insert_data['timezone'], '-')) ? '+'.$insert_data['timezone'] : $insert_data['timezone']);
Expand Down
2 changes: 1 addition & 1 deletion boards/mybb.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class MYBB_Converter extends Converter
var $column_length_to_check = array(
'users' => array(
'users' => array(
'icq' => 'icq'
//'icq' => 'icq'
)
)
);
Expand Down
2 changes: 1 addition & 1 deletion boards/phpbb3/threads.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function get_poll_pid($tid)
$results = $this->old_db->fetch_field($query, "poll_option_id");
$this->old_db->free_result($query);

$this->get_poll_pid_cache[$tid] = $results;
$this->get_poll_pid_cache[$tid] = (int)$results;

return $results;
}
Expand Down
6 changes: 3 additions & 3 deletions boards/phpbb3/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function convert_data($data)
$insert_data['regdate'] = $data['user_regdate'];
$insert_data['lastactive'] = $data['user_lastvisit'];
$insert_data['lastvisit'] = $data['user_lastvisit'];
$insert_data['website'] = $data['user_website'];
$insert_data['website'] = $data['user_website'] ?? '';
$insert_data['lastpost'] = $data['user_lastpost_time'];

$birthday = '';
Expand All @@ -96,7 +96,7 @@ function convert_data($data)
}

$insert_data['birthday'] = $birthday;
$insert_data['icq'] = $data['user_icq'];
//$insert_data['icq'] = $data['user_icq'] ?? '';
$insert_data['hideemail'] = $data['user_allow_viewemail'];
$insert_data['invisible'] = int_to_01($data['user_allow_viewonline']);
$insert_data['allownotices'] = $data['user_notify'];
Expand Down Expand Up @@ -125,7 +125,7 @@ function convert_data($data)
// phpBB 3.1
$insert_data['timezone'] = get_timezone($data['user_timezone']);
}
$insert_data['dst'] = $data['user_dst'];
$insert_data['dst'] = $data['user_dst'] ?? 0;
$insert_data['signature'] = encode_to_utf8($this->bbcode_parser->convert($data['user_sig'], $data['user_sig_bbcode_uid']), "users", "users");
$insert_data['regip'] = my_inet_pton($data['user_ip']);
$insert_data['lastip'] = my_inet_pton($data['user_ip']);
Expand Down
2 changes: 1 addition & 1 deletion boards/punbb/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function convert_data($data)
$insert_data['timezone'] = str_replace(array('.0', '.00'), array('', ''), $data['timezone']);

$insert_data['lastpost'] = $data['last_post'];
$insert_data['icq'] = $data['icq'];
//$insert_data['icq'] = $data['icq'];
$insert_data['hideemail'] = $data['email_setting'];
$insert_data['allownotices'] = $data['notify_with_post'];
$insert_data['regip'] = my_inet_pton($data['registration_ip']);
Expand Down
2 changes: 1 addition & 1 deletion boards/smf/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function convert_data($data)
{
$insert_data['birthday'] = date("j-n-Y", strtotime($data['birthdate']));
}
$insert_data['icq'] = $data['ICQ'];
//$insert_data['icq'] = $data['ICQ'];
$insert_data['hideemail'] = $data['hideEmail'];
$insert_data['invisible'] = int_to_01($data['showOnline']);
$insert_data['pmnotify'] = $data['pm_email_notify'];
Expand Down
2 changes: 1 addition & 1 deletion boards/smf2/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function convert_data($data)
{
$insert_data['birthday'] = date("j-n-Y", strtotime($data['birthdate']));
}
$insert_data['icq'] = $data['icq'];
//$insert_data['icq'] = $data['icq'];
$insert_data['hideemail'] = $data['hide_email'];
$insert_data['invisible'] = int_to_01($data['show_online']);
$insert_data['pmnotify'] = $data['pm_email_notify'];
Expand Down
2 changes: 1 addition & 1 deletion boards/vbulletin3.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class VBULLETIN3_Converter extends Converter
),
'user' => array(
'users' => array(
'icq' => 'icq'
//'icq' => 'icq'
)
)
);
Expand Down
6 changes: 4 additions & 2 deletions boards/vbulletin3/privatemessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ function convert_data($data)
// However afterwards we need to properly encode all elements again, otherwise we'd get other issues again
if(!is_array($touserarray))
{
$touserarray = unserialize(utf8_decode($data['touserarray']));
array_walk_recursive($touserarray, create_function('&$value, $key', '$value = utf8_encode($value);'));
$touserarray = unserialize(mb_convert_encoding($data['touserarray'], 'ISO-8859-1', 'UTF-8'));
array_walk_recursive($touserarray, function (&$value, &$key) {
$value = mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1');
});
}

// This is the original check in vB
Expand Down
2 changes: 1 addition & 1 deletion boards/vbulletin3/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function convert_data($data)
{
$insert_data['birthday'] = $data['birthday'];
}
$insert_data['icq'] = $data['icq'];
//$insert_data['icq'] = $data['icq'];
$insert_data['timezone'] = str_replace(array('.0', '.00'), array('', ''), $insert_data['timezone']);
$insert_data['style'] = 0;
$insert_data['referrer'] = $data['referrerid'];
Expand Down
2 changes: 1 addition & 1 deletion boards/vbulletin4.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class VBULLETIN4_Converter extends Converter
),
'user' => array(
'users' => array(
'icq' => 'icq'
//'icq' => 'icq'
)
)
);
Expand Down
15 changes: 14 additions & 1 deletion boards/vbulletin4/moderators.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,20 @@ function import()
{
global $import_session;

$query = $this->old_db->simple_select("moderator", "*", "forumid != '-1'", array('limit_start' => $this->trackers['start_mods'], 'limit' => $import_session['mods_per_screen']));
$query_options = array();

if(isset($this->trackers['start_mods']))
{
$query_options['limit_start'] = $this->trackers['start_mods'];
}

if(isset($import_session['mods_per_screen']))
{
$query_options['limit'] = $import_session['mods_per_screen'];
}

$query = $this->old_db->simple_select("moderator", "*", "forumid != '-1'", $query_options);

while($moderator = $this->old_db->fetch_array($query))
{
$this->insert($moderator);
Expand Down
9 changes: 5 additions & 4 deletions boards/vbulletin4/polls.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ function import()

// Restore connections
$thread = $this->get_import_tid_poll($poll['pollid']);
$db->update_query("threads", array('poll' => $pid), "import_tid = '".$thread['import_tid']."'");

$db->update_query("threads", array('poll' => $pid), "import_tid = '".(isset($thread['import_tid']) ? $thread['import_tid'] : 0)."'");
}
}

Expand All @@ -47,8 +48,8 @@ function convert_data($data)
$votes = @explode('|||', $data['votes']);

$insert_data['import_pid'] = $data['pollid'];
$insert_data['import_tid'] = $thread['import_tid'];
$insert_data['tid'] = $thread['tid'];
$insert_data['import_tid'] = isset($thread['import_tid']) ? $thread['import_tid'] : 0;
$insert_data['tid'] = isset($thread['tid']) ? $thread['tid'] : 0;
$insert_data['question'] = $data['question'];
$insert_data['dateline'] = $data['dateline'];
$insert_data['options'] = str_replace('|||', '||~|~||', $data['options']);
Expand Down Expand Up @@ -76,7 +77,7 @@ function get_import_tid_poll($import_pid)
$db->free_result($query);
}

return $this->cache_tid_polls[$import_pid];
return isset($this->cache_tid_polls[$import_pid]) ? $this->cache_tid_polls[$import_pid] : 0;
}

function fetch_total()
Expand Down
Binary file modified boards/vbulletin4/posts.php
Binary file not shown.
14 changes: 11 additions & 3 deletions boards/vbulletin4/privatemessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,16 @@ function convert_data($data)
// However afterwards we need to properly encode all elements again, otherwise we'd get other issues again
if(!is_array($touserarray))
{
$touserarray = unserialize(utf8_decode($data['touserarray']));
array_walk_recursive($touserarray, create_function('&$value, $key', '$value = utf8_encode($value);'));
$touserarray = unserialize(mb_convert_encoding($data['touserarray'], 'ISO-8859-1', 'UTF-8'));

if(!is_array($touserarray))
{
$touserarray = array();
}

array_walk_recursive($touserarray, function (&$value, $key) {
$value = mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1');
});
}

// This is the original check in vB
Expand Down Expand Up @@ -95,7 +103,7 @@ function convert_data($data)
// Inserting a pm for one of the recipients so the toid is our id
$insert_data['toid'] = $insert_data['uid'];
}
elseif(count($recipients['to']) == 1)
elseif(isset($recipients['to']) && count($recipients['to']) == 1)
{
// Inserting a pm for the sender with only one recipient so we can set the toid
$insert_data['toid'] = $recipients['to'][0];
Expand Down
2 changes: 1 addition & 1 deletion boards/vbulletin4/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function import()

if($setting['varname'] == "moderatenewmembers")
{
if($setting['config_value'] == 1)
if(isset($setting['config_value']) && $setting['config_value'] == 1)
{
$value = "admin";
}
Expand Down
4 changes: 2 additions & 2 deletions boards/vbulletin4/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ function convert_data($data)
list($bmonth, $bday, $byear) = explode("-", $data['birthday']);
$insert_data['birthday'] = $bday."-".$bmonth."-".$byear;
}
$insert_data['icq'] = $data['icq'];
//$insert_data['icq'] = $data['icq'];
$insert_data['skype'] = $data['skype'];
$insert_data['timezone'] = str_replace(array('.0', '.00'), array('', ''), $insert_data['timezone']);
$insert_data['timezone'] = isset($insert_data['timezone']) ? str_replace(array('.0', '.00'), array('', ''), $insert_data['timezone']) : '';
$insert_data['style'] = 0;
$insert_data['referrer'] = $data['referrerid'];
$insert_data['regip'] = my_inet_pton($data['ipaddress']);
Expand Down
2 changes: 1 addition & 1 deletion boards/vbulletin5.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class VBULLETIN5_Converter extends Converter
),
'user' => array(
'users' => array(
'icq' => 'icq'
//'icq' => 'icq'
)
)
);
Expand Down
6 changes: 4 additions & 2 deletions boards/vbulletin5/privatemessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ function convert_data($data)
// However afterwards we need to properly encode all elements again, otherwise we'd get other issues again
if(!is_array($touserarray))
{
$touserarray = unserialize(utf8_decode($data['touserarray']));
array_walk_recursive($touserarray, create_function('&$value, $key', '$value = utf8_encode($value);'));
$touserarray = unserialize(mb_convert_encoding($data['touserarray'], 'ISO-8859-1', 'UTF-8'));
array_walk_recursive($touserarray, function (&$value, &$key) {
$value = mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1');
});
}

// This is the original check in vB
Expand Down
2 changes: 1 addition & 1 deletion boards/vbulletin5/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function convert_data($data)
list($bmonth, $bday, $byear) = explode("-", $data['birthday']);
$insert_data['birthday'] = $bday."-".$bmonth."-".$byear;
}
$insert_data['icq'] = $data['icq'];
//$insert_data['icq'] = $data['icq'];
$insert_data['skype'] = $data['skype'];
$insert_data['timezone'] = str_replace(array('.0', '.00'), array('', ''), $insert_data['timezoneoffset']);
$insert_data['style'] = 0;
Expand Down
2 changes: 1 addition & 1 deletion boards/wbb3.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function db_extra()
</tr>
<tr class=\"last\">
<td class=\"first\"><label for=\"installationnumber\">{$lang->wbb_installationnumber_desc}</label></td>
<td class=\"last alt_col\"><input type=\"text\" class=\"text_input\" name=\"installationnumber\" id=\"installationnumber\" value=\"".htmlspecialchars_uni($mybb->input['installationnumber'])."\" /></td>
<td class=\"last alt_col\"><input type=\"text\" class=\"text_input\" name=\"installationnumber\" id=\"installationnumber\" value=\"".htmlspecialchars_uni($mybb->get_input('installationnumber'))."\" /></td>
</td>
</tr>
</tbody>";
Expand Down
2 changes: 1 addition & 1 deletion boards/wbb4.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function db_extra()
</tr>
<tr class=\"last\">
<td class=\"first\"><label for=\"installationnumber\">{$lang->wbb_installationnumber_desc}</label></td>
<td class=\"last alt_col\"><input type=\"text\" class=\"text_input\" name=\"installationnumber\" id=\"installationnumber\" value=\"".htmlspecialchars_uni($mybb->input['installationnumber'])."\" /></td>
<td class=\"last alt_col\"><input type=\"text\" class=\"text_input\" name=\"installationnumber\" id=\"installationnumber\" value=\"".htmlspecialchars_uni($mybb->get_input('installationnumber'))."\" /></td>
</td>
</tr>
</tbody>";
Expand Down
4 changes: 2 additions & 2 deletions boards/wbb4/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class WBB4_Converter_Module_Users extends Converter_Module_Users {
"homepage",
"birthday",
"timezone",
"icq",
//"icq",
"skype",
"googlePlus",
);
Expand Down Expand Up @@ -150,7 +150,7 @@ function convert_data($data)
}

$insert_data['birthday'] = $birthday;
$insert_data['icq'] = $data['icq'];
//$insert_data['icq'] = $data['icq'];
$insert_data['skype'] = $data['skype'];
$insert_data['google'] = $data['googlePlus'];

Expand Down
Loading
Loading