diff --git a/boards/bbpress.php b/boards/bbpress.php index 8fc9de3..56cbcdf 100644 --- a/boards/bbpress.php +++ b/boards/bbpress.php @@ -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)); diff --git a/boards/fluxbb/users.php b/boards/fluxbb/users.php index 0506b21..6b8c894 100644 --- a/boards/fluxbb/users.php +++ b/boards/fluxbb/users.php @@ -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']); diff --git a/boards/ipb3/polls.php b/boards/ipb3/polls.php index 633d8f7..7c81e39 100644 --- a/boards/ipb3/polls.php +++ b/boards/ipb3/polls.php @@ -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 = ''; diff --git a/boards/ipb3/users.php b/boards/ipb3/users.php index 5d08869..2a53d38 100644 --- a/boards/ipb3/users.php +++ b/boards/ipb3/users.php @@ -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']); diff --git a/boards/mybb.php b/boards/mybb.php index eee6e0d..44b704b 100644 --- a/boards/mybb.php +++ b/boards/mybb.php @@ -92,7 +92,7 @@ class MYBB_Converter extends Converter var $column_length_to_check = array( 'users' => array( 'users' => array( - 'icq' => 'icq' + //'icq' => 'icq' ) ) ); diff --git a/boards/phpbb3/threads.php b/boards/phpbb3/threads.php index 81dc980..bc13a6a 100644 --- a/boards/phpbb3/threads.php +++ b/boards/phpbb3/threads.php @@ -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; } diff --git a/boards/phpbb3/users.php b/boards/phpbb3/users.php index e9bbd00..b4653ba 100644 --- a/boards/phpbb3/users.php +++ b/boards/phpbb3/users.php @@ -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 = ''; @@ -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']; @@ -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']); diff --git a/boards/punbb/users.php b/boards/punbb/users.php index cad1873..93b6cb5 100644 --- a/boards/punbb/users.php +++ b/boards/punbb/users.php @@ -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']); diff --git a/boards/smf/users.php b/boards/smf/users.php index a4b87cf..7653b40 100644 --- a/boards/smf/users.php +++ b/boards/smf/users.php @@ -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']; diff --git a/boards/smf2/users.php b/boards/smf2/users.php index 59891bc..9a393d7 100644 --- a/boards/smf2/users.php +++ b/boards/smf2/users.php @@ -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']; diff --git a/boards/vbulletin3.php b/boards/vbulletin3.php index 0a1cc16..bf320f5 100644 --- a/boards/vbulletin3.php +++ b/boards/vbulletin3.php @@ -115,7 +115,7 @@ class VBULLETIN3_Converter extends Converter ), 'user' => array( 'users' => array( - 'icq' => 'icq' + //'icq' => 'icq' ) ) ); diff --git a/boards/vbulletin3/privatemessages.php b/boards/vbulletin3/privatemessages.php index fad704c..ff897f6 100644 --- a/boards/vbulletin3/privatemessages.php +++ b/boards/vbulletin3/privatemessages.php @@ -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 diff --git a/boards/vbulletin3/users.php b/boards/vbulletin3/users.php index 969811e..405fded 100644 --- a/boards/vbulletin3/users.php +++ b/boards/vbulletin3/users.php @@ -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']; diff --git a/boards/vbulletin4.php b/boards/vbulletin4.php index 4d8329e..614ab04 100644 --- a/boards/vbulletin4.php +++ b/boards/vbulletin4.php @@ -103,7 +103,7 @@ class VBULLETIN4_Converter extends Converter ), 'user' => array( 'users' => array( - 'icq' => 'icq' + //'icq' => 'icq' ) ) ); diff --git a/boards/vbulletin4/moderators.php b/boards/vbulletin4/moderators.php index 38920c1..38f4d65 100644 --- a/boards/vbulletin4/moderators.php +++ b/boards/vbulletin4/moderators.php @@ -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); diff --git a/boards/vbulletin4/polls.php b/boards/vbulletin4/polls.php index b60a367..98b0b8c 100644 --- a/boards/vbulletin4/polls.php +++ b/boards/vbulletin4/polls.php @@ -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)."'"); } } @@ -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']); @@ -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() diff --git a/boards/vbulletin4/posts.php b/boards/vbulletin4/posts.php index 01a35dd..a5643b2 100644 Binary files a/boards/vbulletin4/posts.php and b/boards/vbulletin4/posts.php differ diff --git a/boards/vbulletin4/privatemessages.php b/boards/vbulletin4/privatemessages.php index c48e90b..cd22a55 100644 --- a/boards/vbulletin4/privatemessages.php +++ b/boards/vbulletin4/privatemessages.php @@ -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 @@ -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]; diff --git a/boards/vbulletin4/settings.php b/boards/vbulletin4/settings.php index 3e3c41e..e582403 100644 --- a/boards/vbulletin4/settings.php +++ b/boards/vbulletin4/settings.php @@ -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"; } diff --git a/boards/vbulletin4/users.php b/boards/vbulletin4/users.php index c10dc59..afb8e68 100644 --- a/boards/vbulletin4/users.php +++ b/boards/vbulletin4/users.php @@ -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']); diff --git a/boards/vbulletin5.php b/boards/vbulletin5.php index 927c018..2b1d751 100644 --- a/boards/vbulletin5.php +++ b/boards/vbulletin5.php @@ -103,7 +103,7 @@ class VBULLETIN5_Converter extends Converter ), 'user' => array( 'users' => array( - 'icq' => 'icq' + //'icq' => 'icq' ) ) ); diff --git a/boards/vbulletin5/privatemessages.php b/boards/vbulletin5/privatemessages.php index 6757aa5..5a22ddb 100644 --- a/boards/vbulletin5/privatemessages.php +++ b/boards/vbulletin5/privatemessages.php @@ -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 diff --git a/boards/vbulletin5/users.php b/boards/vbulletin5/users.php index c562afe..077be33 100644 --- a/boards/vbulletin5/users.php +++ b/boards/vbulletin5/users.php @@ -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; diff --git a/boards/wbb3.php b/boards/wbb3.php index d2ec81a..a4e459d 100644 --- a/boards/wbb3.php +++ b/boards/wbb3.php @@ -151,7 +151,7 @@ function db_extra() - input['installationnumber'])."\" /> + get_input('installationnumber'))."\" /> "; diff --git a/boards/wbb4.php b/boards/wbb4.php index 2920cf6..d5bb2ff 100644 --- a/boards/wbb4.php +++ b/boards/wbb4.php @@ -151,7 +151,7 @@ function db_extra() - input['installationnumber'])."\" /> + get_input('installationnumber'))."\" /> "; diff --git a/boards/wbb4/users.php b/boards/wbb4/users.php index 7a19718..6e9ce75 100644 --- a/boards/wbb4/users.php +++ b/boards/wbb4/users.php @@ -29,7 +29,7 @@ class WBB4_Converter_Module_Users extends Converter_Module_Users { "homepage", "birthday", "timezone", - "icq", + //"icq", "skype", "googlePlus", ); @@ -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']; diff --git a/index.php b/index.php index 2f9922b..5426315 100644 --- a/index.php +++ b/index.php @@ -188,20 +188,20 @@ $start_timer = microtime(true); // Get the import session cache if exists -$import_session = $cache->read("import_cache", 1); +$import_session = $cache->read("import_cache", true); // Setup our arrays if they don't exist yet -if(!$import_session['resume_module']) +if(empty($import_session['resume_module'])) { $import_session['resume_module'] = array(); } -if(!$import_session['disabled']) +if(empty($import_session['disabled'])) { $import_session['disabled'] = array(); } -if(!$import_session['resume_module']) +if(empty($import_session['resume_module'])) { $import_session['resume_module'] = array(); } @@ -278,16 +278,17 @@ $year = gmdate("Y"); - $debug->log->trace2("Generating report in {$mybb->input['reportgen']} format"); + $debug->log->trace2("Generating report in {$mybb->get_input('reportgen')} format"); // Did we request it in plain txt format? - if($mybb->input['reportgen'] == "txt") + if($mybb->get_input('reportgen') == "txt") { $ext = "txt"; $mime = "text/plain"; // Generate the list of all the modules we ran (Threads, Posts, Users, etc) $module_list = ""; + foreach($board->modules as $key => $module) { if(in_array($key, $import_session['completed'])) @@ -356,6 +357,8 @@ } } + $import_totals = ""; + // Generate the list of stats we have (Amount of threads imported, amount of posts imported, etc) foreach($import_stats as $key => $title) { @@ -386,11 +389,13 @@ } // Ah, our users requests our pretty html format! - if($mybb->input['reportgen'] == "html") + if($mybb->get_input('reportgen') == "html") { $ext = "html"; $mime = "text/html"; + $module_list = ""; + // Generate the list of all the modules we ran (Threads, Posts, Users, etc) foreach($board->modules as $key => $module) { @@ -405,6 +410,8 @@ $module_list = "
  • {$lang->none}
  • \n"; } + $import_totals = ""; + // Generate the list of stats we have (Amount of threads imported, amount of posts imported, etc) foreach($import_stats as $key => $title) { @@ -502,7 +509,7 @@ // The Report Generations are run right above this piece of code which we "exit;" before we reach this code so we don't clear out // our statistics we've got saved. This will only run the next time someone visits the merge system script after we visit the // 'finished' page and we're not downloading a report for the last merge. -if($import_session['finished_convert'] == '1') +if(!empty($import_session['finished_convert'])) { $debug->log->event("Running import session cleanup"); @@ -511,23 +518,23 @@ update_import_session(); } -if($mybb->input['board']) +if($mybb->get_input('board')) { - $debug->log->event("Setting up board merge classes: {$mybb->input['board']}"); + $debug->log->event("Setting up board merge classes: {$mybb->get_input('board')}"); // Sanatize and check if it exists. - $mybb->input['board'] = str_replace(".", "", $mybb->input['board']); + $mybb->input['board'] = str_replace(".", "", $mybb->get_input('board')); - $debug->log->trace1("Loading board module {$mybb->input['board']}"); + $debug->log->trace1("Loading board module {$mybb->get_input('board')}"); - if(!file_exists(MERGE_ROOT."boards/".$mybb->input['board'].".php")) + if(!file_exists(MERGE_ROOT."boards/".$mybb->get_input('board').".php")) { $output->print_error($lang->error_invalid_board); } // Get the converter up. - require_once MERGE_ROOT."boards/{$mybb->input['board']}.php"; - $class_name = strtoupper($mybb->input['board'])."_Converter"; + require_once MERGE_ROOT."boards/{$mybb->get_input('board')}.php"; + $class_name = strtoupper($mybb->get_input('board'))."_Converter"; $board = new $class_name; @@ -556,13 +563,13 @@ echo $lang->loginconvert_message; - echo " input['board'])."\" />"; + echo " get_input('board'))."\" />"; $output->print_footer(); } $plugins_cache = $cache->read("plugins", true); - $active_plugins = $plugins_cache['active']; + $active_plugins = isset($plugins_cache['active']) ? $plugins_cache['active'] : array(); $active_plugins['loginconvert'] = "loginconvert"; @@ -573,29 +580,29 @@ } // Save it to the import session so we don't have to carry it around in the url/source. - $import_session['board'] = $mybb->input['board']; + $import_session['board'] = $mybb->get_input('board'); } // Did we just start running a specific module (user import, thread import, post import, etc) -if($mybb->input['module']) +if($mybb->get_input('module')) { - $debug->log->event("Setting up board module specific classes: {$mybb->input['module']}"); + $debug->log->event("Setting up board module specific classes: {$mybb->get_input('module')}"); // Set our $resume_module variable to the last module we were working on (if there is one) // incase we come back to it at a later time. - $resume_module = $import_session['module']; + $resume_module = isset($import_session['module']) ? $import_session['module'] : ''; - if(!array_search($import_session['module'], $import_session['resume_module'])) + if(isset($import_session['module']) && !array_search($import_session['module'], $import_session['resume_module'])) { $import_session['resume_module'][] = $resume_module; } // Save our new module we're working on to the import session - $import_session['module'] = $mybb->input['module']; + $import_session['module'] = $mybb->get_input('module'); } // Otherwise show them the agreement and ask them to agree to it to continue. -if(!$import_session['first_page'] && !$mybb->input['first_page']) +if(empty($import_session['first_page']) && empty($mybb->input['first_page'])) { $debug->log->event("Showing first agreement/welcome page"); @@ -622,7 +629,7 @@ // Did we just pass the requirements check? -if($mybb->input['requirements_check'] == 1 && $import_session['requirements_pass'] == 1 && $mybb->request_method == "post") +if(isset($mybb->input['requirements_check']) && $import_session['requirements_pass'] == 1 && $mybb->request_method == "post") { $debug->log->event("Passed requirements check"); @@ -632,15 +639,15 @@ update_import_session(); } // Otherwise show our requirements check to our user -else if(!$import_session['requirements_check'] || ($mybb->input['first_page'] == 1 && $mybb->request_method == "post") || !$import_session['requirements_pass']) +else if(empty($import_session['requirements_check']) || (!empty($mybb->input['first_page']) && $mybb->request_method == "post") || !$import_session['requirements_pass']) { $debug->log->event("Showing requirements check page"); - $import_session['allow_anonymous_info'] = intval($mybb->input['allow_anonymous_info']); + $import_session['allow_anonymous_info'] = $mybb->get_input('allow_anonymous_info', \MyBB::INPUT_INT); $import_session['first_page'] = 1; // We should close the board - which shouldn't be necessary if they would do the merge locally... - if((int)$mybb->input['close_board'] == 1) + if($mybb->get_input('close_board', \MyBB::INPUT_INT) == 1) { $db->update_query("settings", array("value" => 1), "name='boardclosed'"); rebuild_settings(); @@ -672,7 +679,7 @@ } } - // Uh oh, problemos mi amigo? + // Uh oh, problemas mi amigo? if(!$contents || !$latest_code) { $checks['version_check_status'] = ''.$lang->requirementspage_unabletocheck.''; @@ -741,13 +748,13 @@ } // If no board is selected then we show the main page where users can select a board -if(!$import_session['board']) +if(empty($import_session['board'])) { $debug->log->event("Show the board listing page"); $output->board_list(); } // Show the completion page -elseif(isset($mybb->input['action']) && $mybb->input['action'] == 'completed') +elseif($mybb->get_input('action') == 'completed') { $debug->log->event("Show the merge competion page"); @@ -758,7 +765,7 @@ $output->finish_conversion(); } // Perhaps we have selected to stop converting or we are actually finished -elseif(isset($mybb->input['action']) && $mybb->input['action'] == 'finish') +elseif($mybb->get_input('action') == 'finish') { $debug->log->event("Show the merge cleanup page"); @@ -912,7 +919,7 @@ exit; } // Otherwise that means we've selected a module to run or we're in one -elseif($import_session['module'] && $mybb->input['action'] != 'module_list') +elseif(!empty($import_session['module']) && $mybb->get_input('action') != 'module_list') { $debug->log->event("Running a specific module"); @@ -968,7 +975,7 @@ // Get number of posts per screen from the form if it was just submitted if(isset($mybb->input[$module_name.'_per_screen'])) { - $import_session[$module_name.'_per_screen'] = intval($mybb->input[$module_name.'_per_screen']); + $import_session[$module_name.'_per_screen'] = $mybb->get_input($module_name.'_per_screen', \MyBB::INPUT_INT); // This needs to be here so if we "Pause" (aka terminate script execution) our "per screen" amount will still be saved update_import_session(); @@ -981,7 +988,7 @@ update_import_session(); // Have we set our "per screen" amount yet? - if($import_session[$module_name.'_per_screen'] <= 0 || $module->is_errors) + if(isset($import_session[$module_name.'_per_screen']) && $import_session[$module_name.'_per_screen'] <= 0 || $module->is_errors) { // Print our header $output->print_header($module->board->modules[$import_session['module']]['name']); @@ -1072,7 +1079,7 @@ $debug->log->event("Show the module selection list page."); // Set the start date for the end report. - if(!$import_session['start_date']) + if(empty($import_session['start_date'])) { $import_session['start_date'] = time(); } diff --git a/language/global.lang.php b/language/global.lang.php index 89f6881..84444e9 100644 --- a/language/global.lang.php +++ b/language/global.lang.php @@ -29,6 +29,7 @@ $l['found_error'] = "Error Encountered"; $l['loading_data'] = "Loading data from database..."; $l['done'] = "Done"; +$l['size_mb'] = "MB"; // Modules, english names are hardcoded. Uncomment this for your language // Descriptions are added as "module_{key}_desc, however the current ones doesn't have a description @@ -246,6 +247,7 @@ $l['error_column_length_table'] = 'In the {1} table the following columns contain data that will be stripped'; $l['error_column_length'] = '- {1} (Maximum length: {2})'; +$l['loginconvert_header'] = "MyBB Merge System - Setup Password Conversion"; $l['loginconvert_title'] = "MyBB Merge System - Setup Password Conversion"; $l['loginconvert_message'] = "
    \n

    Error

    diff --git a/loginconvert.php b/loginconvert.php index aa58bdb..40994e8 100644 --- a/loginconvert.php +++ b/loginconvert.php @@ -160,9 +160,12 @@ function loginconvert_convert(&$login) $check = $function($login->data['password'], $user); // If the password was wrong, an utf8 password and we want to check utf8 passwords we call the function again - if(!$check && in_array($login_type, $utf8_recheck) && utf8_decode($login->data['password']) != $login->data['password']) + if(!$check && in_array($login_type, $utf8_recheck) && mb_convert_encoding( + $login->data['password'], + 'ISO-8859-1', + 'UTF-8') !== $login->data['password']) { - $check = $function(utf8_decode($login->data['password']), $user); + $check = $function(mb_convert_encoding($login->data['password'], 'ISO-8859-1', 'UTF-8'), $user); } if(!$check) @@ -331,6 +334,11 @@ function check_punbb($password, $user) { return true; } + elseif(function_exists('hash') && $is_sha1 && (hash('sha1', $password) === $user['passwordconvert'] || hash('sha1', $user['passwordconvertsalt'].hash('sha1', $password)) === $user['passwordconvert'])) + { + return true; + } + // mhash() is deprecated as of PHP8.1 elseif(function_exists('mhash') && $is_sha1 && (bin2hex(mhash(MHASH_SHA1, $password)) == $user['passwordconvert'] || bin2hex(mhash(MHASH_SHA1, $user['passwordconvertsalt'].bin2hex(mhash(MHASH_SHA1, $password)))) == $user['passwordconvert'])) { return true; diff --git a/resources/class_cache_handler.php b/resources/class_cache_handler.php index 3a4bde2..898d9a3 100644 --- a/resources/class_cache_handler.php +++ b/resources/class_cache_handler.php @@ -337,7 +337,7 @@ function fid($old_fid) $this->cache_forums(); } - return $this->cache_fids[$old_fid]; + return isset($this->cache_fids[$old_fid]) ? $this->cache_fids[$old_fid] : 0; } /** @@ -448,7 +448,7 @@ function tid($old_tid) $this->cache_threads(); } - return $this->cache_tids[$old_tid]; + return isset($this->cache_tids[$old_tid]) ? $this->cache_tids[$old_tid] : 0; } /** diff --git a/resources/class_converter.php b/resources/class_converter.php index 340c031..e1d4c39 100644 --- a/resources/class_converter.php +++ b/resources/class_converter.php @@ -192,24 +192,24 @@ function db_configuration() global $mybb, $output, $import_session, $tableprefix, $lang; // Just posted back to this form? - if($mybb->input['dbengine']) + if($mybb->get_input('dbengine')) { - $config_data = $mybb->input['config'][$mybb->input['dbengine']]; + $config_data = $mybb->input['config'][$mybb->get_input('dbengine')]; - if(strstr($mybb->input['dbengine'], "sqlite") !== false && (strstr($config_data['dbname'], "./") !== false || strstr($config_data['dbname'], "../") !== false)) + if(strstr($mybb->get_input('dbengine'), "sqlite") !== false && (strstr($config_data['dbname'], "./") !== false || strstr($config_data['dbname'], "../") !== false)) { $errors[] = $lang->error_database_relative; } - else if(!file_exists(MYBB_ROOT."inc/db_{$mybb->input['dbengine']}.php")) + else if(!file_exists(MYBB_ROOT."inc/db_{$mybb->get_input('dbengine')}.php")) { $errors[] = $lang->error_database_invalid_engine; } else { // Attempt to connect to the db - require_once MYBB_ROOT."inc/db_{$mybb->input['dbengine']}.php"; + require_once MYBB_ROOT."inc/db_{$mybb->get_input('dbengine')}.php"; - switch($mybb->input['dbengine']) + switch($mybb->get_input('dbengine')) { case "sqlite": $this->old_db = new DB_SQLite; @@ -231,7 +231,7 @@ function db_configuration() } $this->old_db->error_reporting = 0; - $connect_config['type'] = $mybb->input['dbengine']; + $connect_config['type'] = $mybb->get_input('dbengine'); $connect_config['database'] = $config_data['dbname']; $connect_config['table_prefix'] = $config_data['tableprefix']; $connect_config['hostname'] = $config_data['dbhost']; @@ -266,14 +266,14 @@ function db_configuration() echo "
    \n{$lang->database_check_success}

    \n"; flush(); - $import_session['old_db_engine'] = $mybb->input['dbengine']; + $import_session['old_db_engine'] = $mybb->get_input('dbengine'); $import_session['old_db_host'] = $config_data['dbhost']; $import_session['old_db_user'] = $config_data['dbuser']; $import_session['old_db_pass'] = $config_data['dbpass']; $import_session['old_db_name'] = $config_data['dbname']; $import_session['old_tbl_prefix'] = $config_data['tableprefix']; $import_session['connect_config'] = serialize($connect_config); - $import_session['encode_to_utf8'] = intval($mybb->input['encode_to_utf8']); + $import_session['encode_to_utf8'] = $mybb->get_input('encode_to_utf8', \MyBB::INPUT_INT); // Create temporary import data fields create_import_fields(); @@ -305,7 +305,7 @@ function db_configuration() else { echo "

    ".$lang->sprintf($lang->database_details, $this->plain_bbname)."

    "; - if($import_session['old_db_engine']) + if(!empty($import_session['old_db_engine'])) { $mybb->input['dbengine'] = $import_session['old_db_engine']; } @@ -314,16 +314,16 @@ function db_configuration() $mybb->input['dbengine'] = $mybb->config['database']['type']; } - if($import_session['old_db_host']) + if(!empty($import_session['old_db_host'])) { - $mybb->input['config'][$mybb->input['dbengine']]['dbhost'] = $import_session['old_db_host']; + $mybb->input['config'][$mybb->get_input('dbengine')]['dbhost'] = $import_session['old_db_host']; } else { - $mybb->input['config'][$mybb->input['dbengine']]['dbhost'] = 'localhost'; + $mybb->input['config'][$mybb->get_input('dbengine')]['dbhost'] = 'localhost'; } - if($import_session['old_tbl_prefix']) + if(!empty($import_session['old_tbl_prefix'])) { $tableprefix = $import_session['old_tbl_prefix']; } @@ -331,32 +331,34 @@ function db_configuration() { $tableprefix = $this->prefix_suggestion; } + // This looks probably odd, but we want that the table prefix is shown everywhere correctly foreach($this->supported_databases as $dbs) { $mybb->input['config'][$dbs]['tableprefix'] = $tableprefix; } + // Handling mysqli, mysql_pdo and pgsql_pdo separately. $mybb->input['config']["mysqli"]['tableprefix'] = $tableprefix; $mybb->input['config']["mysql_pdo"]['tableprefix'] = $tableprefix; $mybb->input['config']["pgsql_pdo"]['tableprefix'] = $tableprefix; - if($import_session['old_db_user']) + if(!empty($import_session['old_db_user'])) { - $mybb->input['config'][$mybb->input['dbengine']]['dbuser'] = $import_session['old_db_user']; + $mybb->input['config'][$mybb->get_input('dbengine')]['dbuser'] = $import_session['old_db_user']; } else { - $mybb->input['config'][$mybb->input['dbengine']]['dbuser'] = ''; + $mybb->input['config'][$mybb->get_input('dbengine')]['dbuser'] = ''; } - if($import_session['old_db_name']) + if(!empty($import_session['old_db_name'])) { - $mybb->input['config'][$mybb->input['dbengine']]['dbname'] = $import_session['old_db_name']; + $mybb->input['config'][$mybb->get_input('dbengine')]['dbname'] = $import_session['old_db_name']; } else { - $mybb->input['config'][$mybb->input['dbengine']]['dbname'] = ''; + $mybb->input['config'][$mybb->get_input('dbengine')]['dbname'] = ''; } } @@ -506,10 +508,12 @@ function check_if_done() $module_name = str_replace(array("import_", ".", ".."), "", $import_session['module']); - $this->debug->log->datatrace("total_{$module_name}, start_{$module_name}", array($import_session['total_'.$module_name], $this->trackers['start_'.$module_name])); + $start_module = isset($this->trackers['start_'.$module_name]) ? $this->trackers['start_'.$module_name] : 0; + + $this->debug->log->datatrace("total_{$module_name}, start_{$module_name}", array($import_session['total_'.$module_name], $start_module)); // If there are more work to do, continue, or else, move onto next module - if($import_session['total_'.$module_name] - $this->trackers['start_'.$module_name] <= 0 || $import_session['total_'.$module_name] == 0) + if($import_session['total_'.$module_name] - $start_module <= 0 || $import_session['total_'.$module_name] == 0) { $import_session['disabled'][] = 'import_'.$module_name; $import_session['flash_message'] = $lang->sprintf($lang->import_successfully, $this->settings['friendly_name']); diff --git a/resources/class_converter_module.php b/resources/class_converter_module.php index 9602040..ba552dc 100644 --- a/resources/class_converter_module.php +++ b/resources/class_converter_module.php @@ -412,8 +412,8 @@ public function prepare_insert_array($values, $table='') { $this->board->set_column_warning_in_progress( 'entry', $table, $key, - $lang->sprintf($lang->warning_prepare_data_mismatched_column, $import_session['module'], TABLE_PREFIX.$table, $key, $column['def_type'], 'STRING'), - $lang->sprintf($lang->warning_prepare_data_mismatched_column, $import_session['module'], TABLE_PREFIX.$table, $key, $column['def_type'], 'STRING') + $lang->sprintf($lang->warning_prepare_data_mismatched_column, $import_session['module'], TABLE_PREFIX.$table, $key, $column['def_type'] ?? '', 'STRING'), + $lang->sprintf($lang->warning_prepare_data_mismatched_column, $import_session['module'], TABLE_PREFIX.$table, $key, $column['def_type'] ?? '', 'STRING') ); } diff --git a/resources/class_debug.php b/resources/class_debug.php index ec75fb4..b2e874f 100644 --- a/resources/class_debug.php +++ b/resources/class_debug.php @@ -276,9 +276,21 @@ function generate_plain_backtrace($shift=1) foreach($trace as $call) { - if(!$call['file']) $call['file'] = "[PHP]"; - if(!$call['line']) $call['line'] = " "; - if($call['class']) $call['function'] = $call['class'].$call['type'].$call['function']; + if(empty($call['file'])) + { + $call['file'] = "[PHP]"; + } + + if(empty($call['line'])) + { + $call['line'] = " "; + } + + if(isset($call['class'])) + { + $call['function'] = $call['class'].$call['type'].$call['function']; + } + $call['file'] = str_replace(substr(MYBB_ROOT, 0, -1), "", $call['file']); $backtrace .= "File: {$call['file']} Line: {$call['line']} Function: {$call['function']} -> \r\n"; } diff --git a/resources/class_error.php b/resources/class_error.php index bf9d0d5..43329c0 100644 --- a/resources/class_error.php +++ b/resources/class_error.php @@ -46,15 +46,24 @@ function error($type, $message, $file=null, $line=0, $allow_output=true) $file = str_replace(MYBB_ROOT, "", $file); + if(is_array($message)) + { + $message_string = "[SQL] [{$message['error_no']}]{$message['error']}
    {$message['query']}"; + } + else + { + $message_string = $message; + } + // Do we have a PHP error? if(my_strpos(my_strtolower($this->error_types[$type]), 'warning') === false) { - $this->debug->log->error("\$type: {$type} \$message: {$message} \$file: {$file} \$line: {$line}"); + $this->debug->log->error("\$type: {$type} \$message: {$message_string} \$file: {$file} \$line: {$line}"); } // PHP Warning else { - $this->debug->log->warning("\$type: {$type} \$message: {$message} \$file: {$file} \$line: {$line}"); + $this->debug->log->warning("\$type: {$type} \$message: {$message_string} \$file: {$file} \$line: {$line}"); } return parent::error($type, $message, $file, $line, $allow_output); diff --git a/resources/functions.php b/resources/functions.php index 6a3a83c..980fff6 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -21,11 +21,12 @@ function update_import_session() { global $import_session, $cache, $board, $db; - if(!$import_session['completed']) + if(empty($import_session['completed'])) { $import_session['completed'] = array(); } - if(!$import_session['disabled']) + + if(empty($import_session['disabled'])) { $import_session['disabled'] = array(); } @@ -33,10 +34,33 @@ function update_import_session() // Stats if(!empty($board->old_db->query_count)) { - $import_session['olddb_query_count'] += $board->old_db->query_count; + if(empty($import_session['olddb_query_count'])) + { + $import_session['olddb_query_count'] = $board->old_db->query_count; + } + else + { + $import_session['olddb_query_count'] += $board->old_db->query_count; + } + } + + if(empty($import_session['newdb_query_count'])) + { + $import_session['newdb_query_count'] = $db->query_count; + } + else + { + $import_session['newdb_query_count'] += $db->query_count; + } + + if(empty($import_session['total_query_time'])) + { + $import_session['total_query_time'] = $db->query_time; + } + else + { + $import_session['total_query_time'] += $db->query_time; } - $import_session['newdb_query_count'] += $db->query_count; - $import_session['total_query_time'] += $db->query_time; $import_session['completed'] = array_unique($import_session['completed']); $import_session['disabled'] = array_unique($import_session['disabled']); @@ -231,28 +255,11 @@ function delete_import_fields($text=true) $progress += $increment; } - $columns_to_drop = array(); foreach($columns as $column) { if($db->field_exists($column, $table)) { - $columns_to_drop[] = $column; - } - } - if(!empty($columns_to_drop)) - { - if($db->type == "sqlite") - { - // Can be achieved in a transaction if we'd finally support it. - foreach($columns_to_drop as $column) - { - $db->write_query("ALTER TABLE ".TABLE_PREFIX.$table." DROP {$column}"); - } - } - else - { - $columns_sql = implode(", DROP ", $columns_to_drop); - $db->write_query("ALTER TABLE ".TABLE_PREFIX.$table." DROP {$columns_sql}"); + $db->drop_column($table, $column); } } } @@ -459,12 +466,12 @@ function encode_to_utf8($text, $old_table_name, $new_table_name) { if(!function_exists('iconv')) { - if(fetch_iconv_encoding($import_session['table_charset_old'][$old_table_name]) != 'iso-8859-1' || !function_exists("utf8_encode")) + if(fetch_iconv_encoding($import_session['table_charset_old'][$old_table_name]) != 'iso-8859-1' || !function_exists("mb_convert_encoding")) { return $text; } - return utf8_encode($text); + return mb_convert_encoding($text, 'UTF-8', 'ISO-8859-1'); } $converted_str = iconv(fetch_iconv_encoding($import_session['table_charset_old'][$old_table_name]), fetch_iconv_encoding($import_session['table_charset_new'][$new_table_name]).'//TRANSLIT', $text); @@ -781,8 +788,12 @@ function htmlspecialchars_decode($text) function utf8_unhtmlentities($string) { // Replace numeric entities - $string = preg_replace_callback('~&#x([0-9a-f]+);~i', create_function('$matches', 'return unichr(hexdec($matches[1]));'), $string); - $string = preg_replace_callback('~&#([0-9]+);~', create_function('$matches', 'return unichr($matches[1]);'), $string); + $string = preg_replace_callback('~&#x([0-9a-f]+);~i', function($matches) { + return unichr(hexdec($matches[1])); + }, $string); + $string = preg_replace_callback('~&#([0-9]+);~', function($matches) { + return unichr($matches[1]); + }, $string); // Replace literal entities $trans_tbl = get_html_translation_table(HTML_ENTITIES); diff --git a/resources/modules/attachments.php b/resources/modules/attachments.php index 2aad870..ba90c7c 100644 --- a/resources/modules/attachments.php +++ b/resources/modules/attachments.php @@ -183,22 +183,22 @@ public function test_readability() $this->debug->log->trace0("Checking readability of attachments from specified path"); - if($mybb->input['uploadspath']) + if($mybb->get_input('uploadspath')) { - $import_session['uploadspath'] = $mybb->input['uploadspath']; + $import_session['uploadspath'] = $mybb->get_input('uploadspath'); if(!empty($import_session['uploadspath']) && my_substr($import_session['uploadspath'], -1) != '/') { $import_session['uploadspath'] .= '/'; } } - if(strpos($mybb->input['uploadspath'], "localhost") !== false) + if(strpos($mybb->get_input('uploadspath'), "localhost") !== false) { $this->errors[] = "

    {$lang->attmodule_ipadress}

    "; $import_session['uploads_test'] = 0; } - if(strpos($mybb->input['uploadspath'], "127.0.0.1") !== false) + if(strpos($mybb->get_input('uploadspath'), "127.0.0.1") !== false) { $this->errors[] = "

    {$lang->attmodule_ipadress2}

    "; $import_session['uploads_test'] = 0; diff --git a/resources/modules/avatars.php b/resources/modules/avatars.php index 088c1ab..bb2f81d 100644 --- a/resources/modules/avatars.php +++ b/resources/modules/avatars.php @@ -148,22 +148,22 @@ public function test_readability() $this->debug->log->trace0("Checking readability of avatars from specified path"); - if($mybb->input['avatarspath']) + if($mybb->get_input('avatarspath')) { - $import_session['avatarspath'] = $mybb->input['avatarspath']; + $import_session['avatarspath'] = $mybb->get_input('avatarspath'); if(!empty($import_session['avatarspath']) && my_substr($import_session['avatarspath'], -1) != '/') { $import_session['avatarspath'] .= '/'; } } - if(strpos($mybb->input['avatarspath'], "localhost") !== false) + if(strpos($mybb->get_input('avatarspath'), "localhost") !== false) { $this->errors[] = "

    {$lang->attmodule_ipadress}

    "; $import_session['uploads_avatars_test'] = 0; } - if(strpos($mybb->input['avatarspath'], "127.0.0.1") !== false) + if(strpos($mybb->get_input('avatarspath'), "127.0.0.1") !== false) { $this->errors[] = "

    {$lang->attmodule_ipadress2}

    "; $import_session['uploads_avatars_test'] = 0; diff --git a/resources/modules/users.php b/resources/modules/users.php index cb6b167..251184e 100644 --- a/resources/modules/users.php +++ b/resources/modules/users.php @@ -34,7 +34,7 @@ abstract class Converter_Module_Users extends Converter_Module 'lastvisit' => TIME_NOW, 'lastpost' => 0, 'website' => '', - 'icq' => '', + //'icq' => '', 'skype' => '', 'google' => '', 'birthday' => '', @@ -245,7 +245,9 @@ public function check_for_duplicates(&$user) // Using strtolower and my_strtolower to check, instead of in the query, is exponentially faster // If we used LOWER() function in the query the index wouldn't be used by MySQL - if(strtolower($duplicate_user['username']) == strtolower($username) || my_strtolower($duplicate_user['username']) == strtolower($encoded_username)) + if(is_array($duplicate_user) && ( + strtolower($duplicate_user['username']) == strtolower($username) || my_strtolower($duplicate_user['username']) == strtolower($encoded_username) + )) { if($user[$this->settings['email_column']] == $duplicate_user['email']) { diff --git a/resources/output.php b/resources/output.php index 67e70f4..ef4b929 100644 --- a/resources/output.php +++ b/resources/output.php @@ -84,6 +84,7 @@ class converterOutput var $_progress_bar_constructed = 0; var $_last_left = 0; + private $trackers = array(); /** * Method to print the converter header @@ -280,7 +281,7 @@ function module_list() $this->print_header($lang->module_selection, "", 0); - if($import_session['flash_message']) + if(!empty($import_session['flash_message'])) { echo "

    {$import_session['flash_message']}

    \n"; $import_session['flash_message'] = null; @@ -349,7 +350,7 @@ function module_list() echo "\n"; echo "
    ".$module['name']."
    \n"; - if($module['description']) + if(!empty($module['description'])) { echo "
    ".$module['description']."
    \n"; } @@ -369,7 +370,7 @@ function module_list() echo "\n"; echo "
    script}\">\n"; - if($import_session['module'] == $key || in_array($key, $import_session['resume_module'])) + if(isset($import_session['module']) && $import_session['module'] == $key || in_array($key, $import_session['resume_module'])) { echo "resume} »\" />\n"; } @@ -485,7 +486,7 @@ function print_database_details_table($name, $extra="") // Loop through database engines foreach($dboptions as $dbfile => $dbtype) { - if($mybb->input['dbengine'] == $dbfile) + if($mybb->get_input('dbengine') == $dbfile) { $dbengines .= ""; } @@ -519,9 +520,16 @@ function updateDBSettings() }); "; + $config = $mybb->get_input('config', \MyBB::INPUT_ARRAY); + $db_info = array(); foreach($dboptions as $dbfile => $dbtype) { + if(!isset($config[$dbfile])) + { + $config[$dbfile] = array(); + } + require_once MYBB_ROOT."inc/db_{$dbfile}.php"; if(!class_exists($dbtype['class'])) { @@ -532,26 +540,26 @@ function updateDBSettings() $db = new $dbtype['class']; $encodings = $db->fetch_db_charsets(); - if(!$mybb->input['config'][$dbfile]['dbhost']) + if(!isset($config[$dbfile]['dbhost'])) { - $mybb->input['config'][$dbfile]['dbhost'] = "localhost"; + $config[$dbfile]['dbhost'] = "localhost"; } - if(!isset($mybb->input['config'][$dbfile]['tableprefix'])) + if(!isset($config[$dbfile]['tableprefix'])) { - $mybb->input['config'][$dbfile]['tableprefix'] = "mybb_"; + $config[$dbfile]['tableprefix'] = "mybb_"; } - if(!$mybb->input['config'][$dbfile]['encoding']) + if(!isset($config[$dbfile]['encoding'])) { - $mybb->input['config'][$dbfile]['encoding'] = "utf8"; + $config[$dbfile]['encoding'] = "utf8"; } $class = ''; - if(!isset($first) && !$mybb->input['dbengine']) + if(!isset($first) && !$mybb->get_input('dbengine')) { $mybb->input['dbengine'] = $dbfile; $first = true; } - if($dbfile == $mybb->input['dbengine']) + if($dbfile == $mybb->get_input('dbengine')) { $class = "_selected"; } @@ -568,7 +576,7 @@ function updateDBSettings() $db_info[$dbfile] .= " - input['config'][$dbfile]['dbname'])."\" /> + "; } // Others get db host, username, password etc @@ -577,19 +585,19 @@ function updateDBSettings() $db_info[$dbfile] .= " - input['config'][$dbfile]['dbhost'])."\" /> + - input['config'][$dbfile]['dbuser'])."\" /> + - input['config'][$dbfile]['dbpass'])."\" /> + - input['config'][$dbfile]['dbname'])."\" /> + "; } @@ -606,14 +614,14 @@ function updateDBSettings() $db_info[$dbfile] .= " - input['config'][$dbfile]['tableprefix'])."\" /> + "; } else { $db_info[$dbfile] .= " - input['config'][$dbfile]['tableprefix'])."\" /> + "; } @@ -623,7 +631,7 @@ function updateDBSettings() $select_options = ""; foreach($encodings as $encoding => $title) { - if($mybb->input['config'][$dbfile]['encoding'] == $encoding) + if($config[$dbfile]['encoding'] == $encoding) { $select_options .= ""; } @@ -643,7 +651,7 @@ function updateDBSettings() } $dbconfig = implode("", $db_info); - if($mybb->input['encode_to_utf8'] === 0) + if($mybb->get_input('encode_to_utf8', \MyBB::INPUT_INT) === 0) { $encoding_checked_no = "checked=\"checked\""; $encoding_checked_yes = ""; @@ -763,9 +771,9 @@ function print_footer($next_action="", $name="", $do_session=1, $override_form=f if($this->opened_form && $override_form != true) { - if($mybb->input['autorefresh'] == "yes" || $mybb->input['autorefresh'] == "no") + if($mybb->get_input('autorefresh') == "yes" || $mybb->get_input('autorefresh') == "no") { - $import_session['autorefresh'] = $mybb->input['autorefresh']; + $import_session['autorefresh'] = $mybb->get_input('autorefresh'); } if(defined("IN_MODULE") && IN_MODULE == 1) @@ -774,9 +782,9 @@ function print_footer($next_action="", $name="", $do_session=1, $override_form=f echo "\n script."\">\n"; } - if($import_session['autorefresh'] == "yes" && !$conf_global_not_found) + if(isset($import_session['autorefresh']) && $import_session['autorefresh'] == "yes" && !$conf_global_not_found) { - echo "\n "; + echo "\n "; echo "\n
    redirecting} »\" alt=\"{$lang->dont_wait}\" {$button_extra} />
    "; } else @@ -788,7 +796,7 @@ function print_footer($next_action="", $name="", $do_session=1, $override_form=f echo "\n
    \n"; // Only if we're in a module - if($import_session['module'] && (!defined('BACK_BUTTON') || BACK_BUTTON != false)) + if(isset($import_session['module']) && (!defined('BACK_BUTTON') || BACK_BUTTON != false)) { echo "\n
    script."\">\n"; if($import_session['module'] == 'db_configuration') @@ -890,7 +898,7 @@ function print_per_screen_page($per_screen=10) // TODO: $this->trackers is never defined and will always be 0 therefore $replacements = array( - "count" => (int) $this->trackers['start_'.$module_name], + "count" => isset($this->trackers['start_'.$module_name]) ? (int) $this->trackers['start_'.$module_name] : 0, "type" => $db->escape_string($module_name) ); $db->replace_query("trackers", $replacements); @@ -949,6 +957,12 @@ function calculate_stats($in_progress_stats=true) $module_name = str_replace(array("import_", ".", ".."), "", $import_session['module']); + $import_session['total_'.$module_name] = isset($import_session['total_'.$module_name]) ? $import_session['total_'.$module_name] : 0; + + $module->trackers['start_'.$module_name] = isset($module->trackers['start_'.$module_name]) ? $module->trackers['start_'.$module_name] : 0; + + $import_session[$module_name.'_per_screen'] = isset($import_session[$module_name.'_per_screen']) ? $import_session[$module_name.'_per_screen'] : 0; + $left = $import_session['total_'.$module_name]-$module->trackers['start_'.$module_name]-$import_session[$module_name.'_per_screen']; if($import_session[$module_name.'_per_screen'] <= 0)