Skip to content

Commit

Permalink
Fix several PHP warnings for vB4 module
Browse files Browse the repository at this point in the history
  • Loading branch information
Sama34 committed Aug 13, 2024
1 parent b08e92a commit d599fd9
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
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.
10 changes: 8 additions & 2 deletions boards/vbulletin4/privatemessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ function convert_data($data)
if(!is_array($touserarray))
{
$touserarray = unserialize(mb_convert_encoding($data['touserarray'], 'ISO-8859-1', 'UTF-8'));
array_walk_recursive($touserarray, function (&$value, &$key) {

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

array_walk_recursive($touserarray, function (&$value, $key) {
$value = mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1');
});
}
Expand Down Expand Up @@ -97,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
2 changes: 1 addition & 1 deletion boards/vbulletin4/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function convert_data($data)
}
$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

0 comments on commit d599fd9

Please sign in to comment.