本文整理匯總了PHP中ImpExData類的典型用法代碼示例。如果您正苦於以下問題:PHP ImpExData類的具體用法?PHP ImpExData怎麽用?PHP ImpExData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ImpExData類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: resume
function resume(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
// Setup some working variables
$displayobject->update_basic('displaymodules', 'FALSE');
$target_db_type = $sessionobject->get_session_var('targetdatabasetype');
$target_table_prefix = $sessionobject->get_session_var('targettableprefix');
$source_db_type = $sessionobject->get_session_var('sourcedatabasetype');
$source_table_prefix = $sessionobject->get_session_var('sourcetableprefix');
$class_num = substr(get_class($this), -3);
$databasedone = true;
if (!$sessionobject->get_session_var($class_num . '_start')) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
$displayobject->update_basic('title', $displayobject->phrases['altering_tables']);
$displayobject->display_now("<h4>{$displayobject->phrases['altering_tables']}</h4>");
$displayobject->display_now($displayobject->phrases['alter_desc_1']);
$displayobject->display_now($displayobject->phrases['alter_desc_2']);
$displayobject->display_now($displayobject->phrases['alter_desc_3']);
$displayobject->display_now($displayobject->phrases['alter_desc_4']);
// Add an importids now
foreach ($this->_import_ids as $id => $table_array) {
foreach ($table_array as $tablename => $column) {
if ($this->add_import_id($Db_target, $target_db_type, $target_table_prefix, $tablename, $column)) {
$displayobject->display_now("\n<br /><b>{$tablename}</b> - {$column} <i>{$displayobject->phrases['completed']}</i>");
} else {
$sessionobject->add_error(substr(get_class($this), -3), $displayobject->phrases['table_alter_fail'], $displayobject->phrases['table_alter_fail_rem']);
}
}
}
// Add the importpostid for the attachment imports and the users for good measure
$this->add_index($Db_target, $target_db_type, $target_table_prefix, 'post');
$this->add_index($Db_target, $target_db_type, $target_table_prefix, 'user');
if ($sessionobject->get_session_var('added_default_unknown_group') != 'yup') {
$try = new ImpExData($Db_target, $sessionobject, 'usergroup');
$try->set_value('mandatory', 'importusergroupid', '69');
$try->set_value('nonmandatory', 'title', "{$displayobject->phrases['imported']} {$displayobject->phrases['users']}");
$try->import_usergroup($Db_target, $target_db_type, $target_table_prefix);
$sessionobject->add_session_var('added_default_unknown_group', 'yup');
unset($try);
}
// Check the database connection
$result = $this->check_database($Db_source, $source_db_type, $source_table_prefix, $sessionobject->get_session_var('sourceexists'));
$displayobject->display_now($result['text']);
if ($result['code']) {
$sessionobject->timing($class_num, 'stop', $sessionobject->get_session_var('autosubmit'));
$sessionobject->remove_session_var($class_num . '_start');
$displayobject->update_html($displayobject->module_finished($this->_modulestring, $sessionobject->return_stats($class_num, '_time_taken'), $sessionobject->return_stats($class_num, '_objects_done'), $sessionobject->return_stats($class_num, '_objects_failed')));
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
$sessionobject->set_session_var(substr(get_class($this), -3), 'FINISHED');
$sessionobject->set_session_var('module', '000');
$displayobject->update_basic('displaymodules', 'FALSE');
$displayobject->update_html($displayobject->print_redirect_001('index.php', $sessionobject->get_session_var('pagespeed')));
} else {
$displayobject->update_html($displayobject->make_description("{$displayobject->phrases['failed']} {$displayobject->phrases['check_db_permissions']}"));
$displayobject->update_html($displayobject->make_hidden_code('pathdata', 'done'));
$sessionobject->set_session_var('001', 'FAILED');
$sessionobject->set_session_var('module', '000');
$displayobject->update_html($displayobject->print_redirect_001('index.php', $sessionobject->get_session_var('pagespeed')));
}
}
示例2: resume
function resume(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
// Set up working variables.
$displayobject->update_basic('displaymodules', 'FALSE');
$target_database_type = $sessionobject->get_session_var('targetdatabasetype');
$target_table_prefix = $sessionobject->get_session_var('targettableprefix');
$source_database_type = $sessionobject->get_session_var('sourcedatabasetype');
$source_table_prefix = $sessionobject->get_session_var('sourcetableprefix');
$over_write_smilies = $sessionobject->get_session_var('over_write_smilies');
$smilie_array = $this->get_details($Db_source, $source_database_type, $source_table_prefix, 0, -1, 'smilie', 'smilieid');
$class_num = substr(get_class($this), -3);
if (!$sessionobject->get_session_var($class_num . '_start')) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
// If the image category dosn't exsist for the imported smilies, create it
$imported_smilie_group = new ImpExData($Db_target, $sessionobject, 'imagecategory');
$imported_smilie_group->set_value('nonmandatory', 'title', 'Imported Smilies');
$imported_smilie_group->set_value('nonmandatory', 'imagetype', '3');
$imported_smilie_group->set_value('nonmandatory', 'displayorder', '1');
$smilie_group_id = $imported_smilie_group->import_smilie_image_group($Db_target, $target_database_type, $target_table_prefix);
$displayobject->display_now("<h4>{$displayobject->phrases['importing']} " . count($smilie_array) . " {$displayobject->phrases['smilies']}</h4>");
$smilie_object = new ImpExData($Db_target, $sessionobject, 'smilie');
foreach ($smilie_array as $smilie_id => $details) {
$try = phpversion() < '5' ? $smilie_object : clone $smilie_object;
// Mandatory
$try->set_value('mandatory', 'smilietext', $details['smilietext']);
$try->set_value('mandatory', 'importsmilieid', $smilie_id);
// Non Mandatory
$try->set_value('nonmandatory', 'title', $details['title']);
$try->set_value('nonmandatory', 'smiliepath', substr($details['smiliepath'], strrpos($details['smiliepath'], '/') + 1));
$try->set_value('nonmandatory', 'imagecategoryid', $smilie_group_id);
$try->set_value('nonmandatory', 'displayorder', $details['displayorder']);
if ($try->is_valid()) {
if ($try->import_smilie($Db_target, $target_database_type, $target_table_prefix)) {
$displayobject->display_now('<br /><span class="isucc"><b>' . $try->how_complete() . '%</b></span> :: ' . $displayobject->phrases['smilie'] . ' -> ' . $try->get_value('mandatory', 'smilietext'));
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
} else {
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
$sessionobject->add_error($smilie_id, $displayobject->phrases['smilie_not_imported'], $displayobject->phrases['smilie_not_imported_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['smilie_not_imported']}");
}
} else {
$displayobject->display_now("<br />{$displayobject->phrases['invalid_object']}" . $try->_failedon);
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
}
unset($try);
}
$sessionobject->timing($class_num, 'stop', $sessionobject->get_session_var('autosubmit'));
$sessionobject->remove_session_var($class_num . '_start');
$displayobject->update_html($displayobject->module_finished($this->_modulestring, $sessionobject->return_stats($class_num, '_time_taken'), $sessionobject->return_stats($class_num, '_objects_done'), $sessionobject->return_stats($class_num, '_objects_failed')));
$sessionobject->set_session_var($class_num, 'FINISHED');
$sessionobject->set_session_var('module', '000');
$sessionobject->set_session_var('autosubmit', '0');
$displayobject->update_html($displayobject->print_redirect('index.php', $sessionobject->get_session_var('pagespeed')));
}
示例3: init
function init(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
if ($this->check_order($sessionobject, $this->_dependent)) {
if ($this->_restart) {
if ($this->restart($sessionobject, $displayobject, $Db_target, $Db_source, 'clear_imported_usergroups')) {
$displayobject->display_now("<h4>{$displayobject->phrases['usergroups_cleared']}</h4>");
$this->_restart = true;
} else {
$sessionobject->add_error(substr(get_class($this), -3), $displayobject->phrases['usergroup_restart_failed'], $displayobject->phrases['check_db_permissions']);
}
}
// Start up the table
$displayobject->update_basic('title', $displayobject->phrases['import_usergroup']);
$displayobject->update_html($displayobject->do_form_header('index', substr(get_class($this), -3)));
$displayobject->update_html($displayobject->make_hidden_code(substr(get_class($this), -3), 'WORKING'));
$displayobject->update_html($displayobject->make_table_header($this->_modulestring));
// Ask some questions
$displayobject->update_html($displayobject->make_input_code($displayobject->phrases['usergroups_per_page'], 'usergroupperpage', 50));
// End the table
$displayobject->update_html($displayobject->do_form_footer($displayobject->phrases['continue'], $displayobject->phrases['reset']));
// Incative usergroup
$target_db_type = $sessionobject->get_session_var('targetdatabasetype');
$target_table_prefix = $sessionobject->get_session_var('targettableprefix');
$usergroup_object = new ImpExData($Db_target, $sessionobject, 'usergroup');
$try = phpversion() < '5' ? $usergroup_object : clone $usergroup_object;
$try->set_value('mandatory', 'importusergroupid', '69');
$try->set_value('nonmandatory', 'title', "Active {$displayobject->phrases['imported']} {$displayobject->phrases['users']}");
$try->import_usergroup($Db_target, $target_db_type, $target_table_prefix);
unset($try);
$try = phpversion() < '5' ? $usergroup_object : clone $usergroup_object;
$try = new ImpExData($Db_target, $sessionobject, 'usergroup');
$try->set_value('mandatory', 'importusergroupid', '70');
$try->set_value('nonmandatory', 'title', "Inactive {$displayobject->phrases['imported']} {$displayobject->phrases['users']}");
$try->import_usergroup($Db_target, $target_db_type, $target_table_prefix);
$sessionobject->add_session_var('added_default_unknown_group', 'yup');
unset($try);
// Reset/Setup counters for this
$sessionobject->add_session_var(substr(get_class($this), -3) . '_objects_done', '0');
$sessionobject->add_session_var(substr(get_class($this), -3) . '_objects_failed', '0');
$sessionobject->add_session_var('usergroupstartat', '0');
} else {
// Dependant has not been run
$displayobject->update_html($displayobject->do_form_header('index', ''));
$displayobject->update_html($displayobject->make_description("<p>{$displayobject->phrases['dependant_on']}<i><b> " . $sessionobject->get_module_title($this->_dependent) . "</b> {$displayobject->phrases['cant_run']}</i> ."));
$displayobject->update_html($displayobject->do_form_footer($displayobject->phrases['continue'], ''));
$sessionobject->set_session_var(substr(get_class($this), -3), 'FALSE');
$sessionobject->set_session_var('module', '000');
}
}
示例4: init
function init(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
$class_num = substr(get_class($this), -3);
if ($this->check_order($sessionobject, $this->_dependent)) {
if ($this->_restart) {
if ($this->restart($sessionobject, $displayobject, $Db_target, $Db_source, 'clear_imported_forums')) {
$displayobject->display_now("<h4>{$displayobject->phrases['forums_cleared']}</h4>");
$this->_restart = true;
} else {
$sessionobject->add_error($Db_target, 'fatal', $class_num, 0, $displayobject->phrases['forum_restart_failed'], $displayobject->phrases['check_db_permissions']);
}
}
// Start up the table
$displayobject->update_basic('title', $displayobject->phrases['import_forum']);
$displayobject->update_html($displayobject->do_form_header('index', $class_num));
$displayobject->update_html($displayobject->make_hidden_code($class_num, 'WORKING'));
$displayobject->update_html($displayobject->make_table_header($this->_modulestring));
// Ask some questions
$displayobject->update_html($displayobject->make_input_code($displayobject->phrases['units_per_page'], 'perpage', 1000));
// End the table
$displayobject->update_html($displayobject->do_form_footer($displayobject->phrases['continue'], $displayobject->phrases['reset']));
// Reset/Setup counters for this
$sessionobject->add_session_var("{$class_num}_objects_done", '0');
$sessionobject->add_session_var("{$class_num}_objects_failed", '0');
$sessionobject->add_session_var('startat', '0');
$t_db_type = $sessionobject->get_session_var('targetdatabasetype');
$t_tb_prefix = $sessionobject->get_session_var('targettableprefix');
// Default Category
$try = new ImpExData($Db_target, $sessionobject, 'forum');
$try->set_value('mandatory', 'title', 'ImpEx');
$try->set_value('mandatory', 'displayorder', '1');
$try->set_value('mandatory', 'parentid', '-1');
$try->set_value('mandatory', 'importforumid', '0');
$try->set_value('mandatory', 'importcategoryid', '1');
$try->set_value('mandatory', 'options', $this->_default_cat_permissions);
$try->set_value('nonmandatory', 'description', 'This is a default category for imported forums');
$try->import_category($Db_target, $t_db_type, $t_tb_prefix);
unset($try);
} else {
// Dependant has not been run
$displayobject->update_html($displayobject->do_form_header('index', ''));
$displayobject->update_html($displayobject->make_description("<p>{$displayobject->phrases['dependant_on']}<i><b> " . $sessionobject->get_module_title($this->_dependent) . "</b> {$displayobject->phrases['cant_run']}</i> ."));
$displayobject->update_html($displayobject->do_form_footer($displayobject->phrases['continue'], ''));
$sessionobject->set_session_var($class_num, 'FALSE');
$sessionobject->set_session_var('module', '000');
}
}
示例5: resume
function resume(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
// Set up working variables.
$displayobject->update_basic('displaymodules', 'FALSE');
$target_database_type = $sessionobject->get_session_var('targetdatabasetype');
$target_table_prefix = $sessionobject->get_session_var('targettableprefix');
$source_database_type = $sessionobject->get_session_var('sourcedatabasetype');
$source_table_prefix = $sessionobject->get_session_var('sourcetableprefix');
// Per page vars
$smilie_start_at = $sessionobject->get_session_var('smiliestartat');
$smilie_per_page = $sessionobject->get_session_var('smilieperpage');
$class_num = substr(get_class($this), -3);
// Start the timing
if (!$sessionobject->get_session_var($class_num . '_start')) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
// Get an array of smilie details
$smilie_array = $this->get_PNphpBB_smilie_details($Db_source, $source_database_type, $source_table_prefix, $smilie_start_at, $smilie_per_page);
// If the image category dosn't exsist for the imported smilies, create it
$imported_smilie_group = new ImpExData($Db_target, $sessionobject, 'imagecategory');
$imported_smilie_group->set_value('nonmandatory', 'title', 'Imported Smilies');
$imported_smilie_group->set_value('nonmandatory', 'imagetype', '3');
$imported_smilie_group->set_value('nonmandatory', 'displayorder', '1');
$smilie_group_id = $imported_smilie_group->import_smilie_image_group($Db_target, $target_database_type, $target_table_prefix);
// Display count and pass time
$displayobject->display_now('<h4>Importing ' . count($smilie_array) . ' smilies</h4><p><b>From</b> : ' . $smilie_start_at . ' :: <b>To</b> : ' . ($smilie_start_at + count($smilie_array)) . '</p>');
$smilie_object = new ImpExData($Db_target, $sessionobject, 'smilie');
foreach ($smilie_array as $smilie_id => $smilie_details) {
$try = phpversion() < '5' ? $smilie_object : clone $smilie_object;
$import_smilie = false;
// Set the correct key names to pass.
$pass_array = array('title' => $smilie_details['emoticon'], 'smilietext' => $smilie_details['code'], 'smiliepath' => $smilie_details['smile_url']);
// Check the lenght of it
if (strlen($pass_array['smilietext']) > 20) {
$truncation = substr($pass_array['smilietext'], 0, 19) . ':';
$displayobject->display_now("<br /><font color=\"red\"><b>Too long</font></b> ' " . $pass_array['smilietext'] . "'" . "<br /><font color=\"red\"><b>Truncating to</font></b> '" . $truncation . "'");
$pass_array['smilietext'] = $truncation;
}
$pass_array['smilietext'] = addslashes($pass_array['smilietext']);
// Is it a duplicate ?
$it_is_a_duplicate = $this->does_smilie_exists($Db_target, $target_database_type, $target_table_prefix, addslashes($pass_array['smilietext']));
if ($it_is_a_duplicate) {
if ($over_write_smilies) {
$import_smilie = true;
}
} else {
$import_smilie = true;
}
$try->set_value('mandatory', 'smilietext', $pass_array['smilietext']);
$try->set_value('nonmandatory', 'title', $pass_array['title']);
$try->set_value('nonmandatory', 'smiliepath', $pass_array['smiliepath']);
$try->set_value('nonmandatory', 'imagecategoryid', $smilie_group_id);
$try->set_value('nonmandatory', 'displayorder', '1');
$try->set_value('mandatory', 'importsmilieid', $smilie_id);
if ($try->is_valid()) {
if ($import_smilie) {
if ($try->import_smilie($Db_target, $target_database_type, $target_table_prefix)) {
$displayobject->display_now("<br /><span class=\"isucc\"><b>" . $try->how_complete() . "%</b></span> :: Smilie -> " . $try->get_value('mandatory', 'smilietext'));
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
$imported = true;
} else {
$sessionobject->add_error('warning', $this->_modulestring, get_class($this) . "::import_smilie failed for " . $pass_array['smilietext'] . ".", 'Check database permissions and smilie table');
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
$displayobject->display_now("<br />Got smilie " . $pass_array['smilietext'] . " and <b>DID NOT</b> imported to the " . $target_database_type . " database");
}
} else {
$displayobject->display_now("<br /><font color=\"orange\"><b>Duplicate</span> ' " . $pass_array['smilietext'] . "' -> '" . $pass_array['title'] . "'");
}
} else {
$displayobject->display_now("<br />Invalid smilie object, skipping." . $try->_failedon);
}
unset($try);
}
// End foreach
// Check for page end
if (count($smilie_array) == 0 or count($smilie_array) < $smilie_per_page) {
$sessionobject->timing($class_num, 'stop', $sessionobject->get_session_var('autosubmit'));
$sessionobject->remove_session_var($class_num . '_start');
$displayobject->update_html($displayobject->module_finished($this->_modulestring, $sessionobject->return_stats($class_num, '_time_taken'), $sessionobject->return_stats($class_num, '_objects_done'), $sessionobject->return_stats($class_num, '_objects_failed')));
$sessionobject->set_session_var($class_num, 'FINISHED');
$sessionobject->set_session_var('import_smilie', 'done');
$sessionobject->set_session_var('module', '000');
$sessionobject->set_session_var('autosubmit', '0');
$displayobject->update_html($displayobject->print_redirect('index.php', '1'));
}
$sessionobject->set_session_var('smiliestartat', $smilie_start_at + $smilie_per_page);
$displayobject->update_html($displayobject->print_redirect('index.php'));
}
示例6: resume
function resume(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
// Set up working variables.
$displayobject->update_basic('displaymodules', 'FALSE');
$target_database_type = $sessionobject->get_session_var('targetdatabasetype');
$target_table_prefix = $sessionobject->get_session_var('targettableprefix');
$source_database_type = $sessionobject->get_session_var('sourcedatabasetype');
$source_table_prefix = $sessionobject->get_session_var('sourcetableprefix');
// Per page vars
$forum_start_at = $sessionobject->get_session_var('forumstartat');
$forum_per_page = $sessionobject->get_session_var('forumperpage');
$class_num = substr(get_class($this), -3);
// Start the timing
if (!$sessionobject->get_session_var($class_num . '_start')) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
######################################
# Temp
######################################
$forum_object = new ImpExData($Db_target, $sessionobject, 'forum');
$try = phpversion() < '5' ? $forum_object : clone $forum_object;
$try->set_value('mandatory', 'title', 'Default Yahoo Category');
$try->set_value('mandatory', 'displayorder', '1');
$try->set_value('mandatory', 'parentid', '-1');
$try->set_value('mandatory', 'importforumid', '0');
$try->set_value('mandatory', 'importcategoryid', '1');
$try->set_value('mandatory', 'options', $this->_default_cat_permissions);
$try->set_value('nonmandatory', 'description', 'Default Yahoo Category Description');
$cat_id = $try->import_category($Db_target, $target_database_type, $target_table_prefix);
$displayobject->display_now("<br /><span class=\"isucc\"><b>" . $try->how_complete() . "%</b></span> :: " . $try->get_value('mandatory', 'title'));
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
unset($try);
$try = phpversion() < '5' ? $forum_object : clone $forum_object;
$try->set_value('mandatory', 'title', 'Default Yahoo Forum');
$try->set_value('mandatory', 'displayorder', '1');
$try->set_value('mandatory', 'parentid', $cat_id);
$try->set_value('mandatory', 'importforumid', '1');
$try->set_value('mandatory', 'importcategoryid', '0');
$try->set_value('nonmandatory', 'description', 'Default Yahoo Forum');
$try->set_value('nonmandatory', 'visible', '1');
$try->set_value('mandatory', 'options', $this->_default_forum_permissions);
$forum_id = $try->import_forum($Db_target, $target_database_type, $target_table_prefix);
$displayobject->display_now("<br /><span class=\"isucc\"><b>" . $try->how_complete() . "%</b></span> :: " . $try->get_value('mandatory', 'title'));
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
unset($try);
$try = new ImpExData($Db_target, $sessionobject, 'thread');
$try->set_value('mandatory', 'title', 'Yahoo catchments thread');
$try->set_value('mandatory', 'forumid', $forum_id);
$try->set_value('mandatory', 'importthreadid', '2');
$try->set_value('mandatory', 'importforumid', '1');
// Non Mandatory
$try->set_value('nonmandatory', 'visible', '1');
$try->set_value('nonmandatory', 'open', '1');
$try->set_value('nonmandatory', 'dateline', time());
$displayobject->display_now("<br /><span class=\"isucc\"><b>" . $try->how_complete() . "%</b></span> :: " . $try->get_value('mandatory', 'title'));
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
$thread_id = $try->import_thread($Db_target, $target_database_type, $target_table_prefix);
$sessionobject->set_session_var('catch_thread', $thread_id);
######################################
# Temp
######################################
// Check for page end
if (count($forum_array) == 0 or count($forum_array) < $forum_per_page) {
$sessionobject->timing($class_num, 'stop', $sessionobject->get_session_var('autosubmit'));
$sessionobject->remove_session_var($class_num . '_start');
$forum_ids_array = $this->get_forum_ids($Db_target, $target_database_type, $target_table_prefix);
$this->clean_nested_forums($Db_target, $target_database_type, $target_table_prefix, $forum_ids_array);
$this->build_forum_child_lists($Db_target, $target_database_type, $target_table_prefix);
$displayobject->update_html($displayobject->module_finished($this->_modulestring, $sessionobject->return_stats($class_num, '_time_taken'), $sessionobject->return_stats($class_num, '_objects_done'), $sessionobject->return_stats($class_num, '_objects_failed')));
$sessionobject->set_session_var($class_num, 'FINISHED');
$sessionobject->set_session_var('import_forum', 'done');
$sessionobject->set_session_var('module', '000');
$sessionobject->set_session_var('autosubmit', '0');
$displayobject->update_html($displayobject->print_redirect('index.php', '1'));
}
$sessionobject->set_session_var('forumstartat', $forum_start_at + $forum_per_page);
$displayobject->update_html($displayobject->print_redirect('index.php'));
}
示例7: resume
function resume(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
// Set up working variables.
$displayobject->update_basic('displaymodules', 'FALSE');
$target_database_type = $sessionobject->get_session_var('targetdatabasetype');
$target_table_prefix = $sessionobject->get_session_var('targettableprefix');
$source_database_type = $sessionobject->get_session_var('sourcedatabasetype');
$source_table_prefix = $sessionobject->get_session_var('sourcetableprefix');
// Per page vars
$forum_start_at = $sessionobject->get_session_var('forumstartat');
$forum_per_page = $sessionobject->get_session_var('forumperpage');
$class_num = substr(get_class($this), -3);
// Start the timing
if (!$sessionobject->get_session_var($class_num . '_start')) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
// Get an array of forum details
$forum_array = $this->get_freethreads_forum_details($Db_source, $source_database_type, $source_table_prefix, $forum_start_at, $forum_per_page);
if ($sessionobject->get_session_var('categoriesfinished') == 'FALSE') {
$category_object = new ImpExData($Db_target, $sessionobject, 'forum');
$category_object->set_value('mandatory', 'title', 'free threads category');
$category_object->set_value('mandatory', 'displayorder', '1');
$category_object->set_value('mandatory', 'parentid', '-1');
$category_object->set_value('mandatory', 'importforumid', '0');
$category_object->set_value('mandatory', 'importcategoryid', '1');
$category_object->set_value('mandatory', 'options', $this->_default_cat_permissions);
$category_object->import_category($Db_target, $target_database_type, $target_table_prefix);
$sessionobject->add_session_var('categoriesfinished', 'TRUE');
}
$cat_ids_array = $this->get_category_ids($Db_target, $target_database_type, $target_table_prefix);
// Display count and pass time
$displayobject->display_now('<h4>Importing ' . count($forum_array) . ' forums</h4><p><b>From</b> : ' . $forum_start_at . ' :: <b>To</b> : ' . ($forum_start_at + count($forum_array)) . '</p>');
$forum_object = new ImpExData($Db_target, $sessionobject, 'forum');
foreach ($forum_array as $forum_id => $forum_details) {
$try = phpversion() < '5' ? $forum_object : clone $forum_object;
// Mandatory
$try->set_value('mandatory', 'title', $forum_details['NAME']);
$try->set_value('mandatory', 'displayorder', $forum_details['RANK']);
$try->set_value('mandatory', 'parentid', $cat_ids_array[1]);
$try->set_value('mandatory', 'importforumid', $forum_id);
$try->set_value('mandatory', 'importcategoryid', '1');
$try->set_value('mandatory', 'options', $this->_default_forum_permissions);
// Non Mandatory
$try->set_value('nonmandatory', 'description', $forum_details['DESCRIPTION']);
$try->set_value('nonmandatory', 'replycount', $forum_details['TOTAL']);
$try->set_value('nonmandatory', 'lastpost', $forum_details['LAST']);
// Check if forum object is valid
if ($try->is_valid()) {
if ($try->import_forum($Db_target, $target_database_type, $target_table_prefix)) {
$displayobject->display_now('<br /><span class="isucc"><b>' . $try->how_complete() . '%</b></span> :: forum -> ' . $forum_details['NAME']);
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
} else {
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
$sessionobject->add_error('warning', $this->_modulestring, get_class($this) . '::import_custom_profile_pic failed.', 'Check database permissions and database table');
$displayobject->display_now("<br />Found avatar forum and <b>DID NOT</b> imported to the {$target_database_type} database");
}
} else {
$displayobject->display_now("<br />Invalid forum object, skipping." . $try->_failedon);
}
unset($try);
}
// End foreach
// Check for page end
if (count($forum_array) == 0 or count($forum_array) < $forum_per_page) {
$sessionobject->timing($class_num, 'stop', $sessionobject->get_session_var('autosubmit'));
$sessionobject->remove_session_var($class_num . '_start');
$forum_ids_array = $this->get_forum_ids($Db_target, $target_database_type, $target_table_prefix);
$this->build_forum_child_lists($Db_target, $target_database_type, $target_table_prefix);
$displayobject->update_html($displayobject->module_finished($this->_modulestring, $sessionobject->return_stats($class_num, '_time_taken'), $sessionobject->return_stats($class_num, '_objects_done'), $sessionobject->return_stats($class_num, '_objects_failed')));
$sessionobject->set_session_var($class_num, 'FINISHED');
$sessionobject->set_session_var('import_forum', 'done');
$sessionobject->set_session_var('module', '000');
$sessionobject->set_session_var('autosubmit', '0');
$displayobject->update_html($displayobject->print_redirect('index.php', '1'));
}
$sessionobject->set_session_var('forumstartat', $forum_start_at + $forum_per_page);
$displayobject->update_html($displayobject->print_redirect('index.php'));
}
示例8: resume
function resume(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
// Set up working variables.
$displayobject->update_basic('displaymodules', 'FALSE');
$t_db_type = $sessionobject->get_session_var('targetdatabasetype');
$t_tb_prefix = $sessionobject->get_session_var('targettableprefix');
$s_db_type = $sessionobject->get_session_var('sourcedatabasetype');
$s_tb_prefix = $sessionobject->get_session_var('sourcetableprefix');
// Per page vars
$start_at = $sessionobject->get_session_var('startat');
$per_page = $sessionobject->get_session_var('perpage');
$class_num = substr(get_class($this), -3);
$ImpExData_object = new ImpExData($Db_target, $sessionobject, 'pmtext');
$pm_object = new ImpExData($Db_target, $sessionobject, 'pm');
$idcache = new ImpExCache($Db_target, $t_db_type, $t_tb_prefix);
// Start the timing
if (!$sessionobject->get_session_var("{$class_num}_start")) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
// Get an array data
$data_array = $this->get_source_data($Db_source, $s_db_type, "{$s_tb_prefix}pm", 'pmID', 0, $start_at, $per_page);
// Display count and pass time
$displayobject->print_per_page_pass($data_array['count'], $displayobject->phrases['pms'], $start_at);
foreach ($data_array['data'] as $pm_id => $pm) {
$pm_text_object = phpversion() < '5' ? $ImpExData_object : clone $ImpExData_object;
$pm_recipt = $this->get_wbb3_pm_recipt($Db_source, $s_db_type, $s_tb_prefix, $pm_id);
if (empty($pm_recipt)) {
$displayobject->display_now('<br />Empty recipt skipping.');
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
continue;
}
$userid = $idcache->get_id('user', $pm_recipt['recipientID']);
$username = $idcache->get_id('username', $pm_recipt['recipientID']);
unset($touserarray);
$touserarray[$userid] = $username;
$pm_text_object->set_value('mandatory', 'fromuserid', $idcache->get_id('user', $pm['userID']));
$pm_text_object->set_value('mandatory', 'title', $pm['subject']);
$pm_text_object->set_value('mandatory', 'message', $this->html_2_bb($pm['message']));
$pm_text_object->set_value('mandatory', 'importpmid', $pm_id);
$pm_text_object->set_value('mandatory', 'touserarray', addslashes(serialize($touserarray)));
$pm_text_object->set_value('nonmandatory', 'fromusername', $idcache->get_id('username', $pm['userID']));
$pm_text_object->set_value('nonmandatory', 'iconid', '');
$pm_text_object->set_value('nonmandatory', 'dateline', $pm['time']);
$pm_text_object->set_value('nonmandatory', 'showsignature', $pm['showSignature']);
$pm_text_object->set_value('nonmandatory', 'allowsmilie', $pm['enableSmilies']);
if ($pm_text_object->is_valid()) {
$pm_text_id = $pm_text_object->import_pm_text($Db_target, $t_db_type, $t_tb_prefix);
$vB_pm_to = phpversion() < '5' ? $pm_object : clone $pm_object;
$vB_pm_from = phpversion() < '5' ? $pm_object : clone $pm_object;
if ($pm_text_id) {
$vB_pm_to = phpversion() < '5' ? $pm_object : clone $pm_object;
$vB_pm_from = phpversion() < '5' ? $pm_object : clone $pm_object;
// The touser pm
$vB_pm_to->set_value('mandatory', 'pmtextid', $pm_text_id);
$vB_pm_to->set_value('mandatory', 'userid', $idcache->get_id('user', $pm_recipt['recipientID']));
$vB_pm_to->set_value('mandatory', 'importpmid', $pm_recipt['pmID']);
$vB_pm_to->set_value('nonmandatory', 'folderid', '1');
$vB_pm_to->set_value('nonmandatory', 'messageread', '0');
// The fromuser pm
$vB_pm_from->set_value('mandatory', 'pmtextid', $pm_text_id);
$vB_pm_from->set_value('mandatory', 'userid', $idcache->get_id('user', $pm['userID']));
$vB_pm_from->set_value('mandatory', 'importpmid', $pm_recipt['pmID']);
$vB_pm_from->set_value('nonmandatory', 'folderid', '-1');
$vB_pm_from->set_value('nonmandatory', 'messageread', '0');
if ($pm_text_object->is_valid()) {
if ($vB_pm_to->import_pm($Db_target, $t_db_type, $t_tb_prefix) and $vB_pm_from->import_pm($Db_target, $t_db_type, $t_tb_prefix)) {
if (shortoutput) {
$displayobject->display_now('.');
} else {
$displayobject->display_now('<br /><span class="isucc"><b>' . $pm_object->how_complete() . '%</b></span> ' . $displayobject->phrases['pm'] . ' -> ' . $pm_text_object->get_value('nonmandatory', 'fromusername'));
}
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
} else {
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
$sessionobject->add_error($Db_target, 'warning', $class_num, $pm_id, $displayobject->phrases['pm_not_imported'], $displayobject->phrases['pm_not_imported_rem_1']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['pm_not_imported']}");
}
} else {
$sessionobject->add_error($Db_target, 'invalid', $class_num, $pm_id, $displayobject->phrases['invalid_object'], $pm_text_object->_failedon);
$displayobject->display_now("<br />{$displayobject->phrases['invalid_object']}" . $pm_text_object->_failedon);
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
}
} else {
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
$sessionobject->add_error($Db_target, 'warning', $class_num, $pm_id, $displayobject->phrases['pm_not_imported'], $displayobject->phrases['pm_not_imported_rem_2']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['pm_not_imported']}");
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
}
} else {
$sessionobject->add_error($Db_target, 'invalid', $class_num, $pm_id, $displayobject->phrases['invalid_object'], $pm_text_object->_failedon);
$displayobject->display_now("<br />{$displayobject->phrases['invalid_object']}" . $pm_text_object->_failedon);
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
}
unset($pm_text_object, $vB_pm_to, $vB_pm_from);
}
// End foreach
// Check for page end
if ($data_array['count'] == 0 or $data_array['count'] < $per_page) {
$sessionobject->timing($class_num, 'stop', $sessionobject->get_session_var('autosubmit'));
$sessionobject->remove_session_var("{$class_num}_start");
//.........這裏部分代碼省略.........
示例9: parse_message
function parse_message($data)
{
if ($discussion =& $this->get_first_tag('discussion')) {
/*
echo str_repeat('--', sizeof($this->stack)) . " message<br />\n";
flush();
*/
$user_names = $this->get_username($this->Db_object, $this->target_db_type, $this->target_db_prefix);
$users_ids = $this->get_user_ids($Db_target, $target_database_type, $target_table_prefix);
$userid = hexdec($data['attributes']['author']);
$post_object = new ImpExData($this->Db_object, $this->session, 'post');
$post_object->set_value('mandatory', 'threadid', $this->session->get_session_var('currentthread'));
$post_object->set_value('mandatory', 'userid', $users_ids[$userid]);
$post_object->set_value('mandatory', 'importthreadid', '1');
$post_object->set_value('nonmandatory', 'visible', '1');
$post_object->set_value('nonmandatory', 'dateline', strtotime(str_replace('.', ' ', $data['attributes']['date'])));
$post_object->set_value('nonmandatory', 'allowsmilie', '1');
$post_object->set_value('nonmandatory', 'showsignature', '1');
$post_object->set_value('nonmandatory', 'username', $user_names[$userid]);
$post_object->set_value('nonmandatory', 'ipaddress', $data['attributes']['sourceIp']);
$post_object->set_value('nonmandatory', 'title', htmlspecialchars($data['attributes']['title']));
$post_object->set_value('nonmandatory', 'pagetext', $this->html_2_bb($data['attributes']['body']));
$post_object->set_value('nonmandatory', 'importpostid', '1');
if ($post_object->import_post($this->Db_object, $this->target_db_type, $this->target_db_prefix)) {
echo "<br /><span class=\"isucc\">Post -- <b>" . $post_object->how_complete() . "%</b></span> :: Post from - " . $post_object->get_value('nonmandatory', 'username');
flush();
} else {
echo "<br />Post not imported";
}
unset($post_object);
}
}
示例10: resume
function resume(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
// Set up working variables.
$displayobject->update_basic('displaymodules', 'FALSE');
$target_database_type = $sessionobject->get_session_var('targetdatabasetype');
$target_table_prefix = $sessionobject->get_session_var('targettableprefix');
$source_database_type = $sessionobject->get_session_var('sourcedatabasetype');
$source_table_prefix = $sessionobject->get_session_var('sourcetableprefix');
// Per page vars
$smilie_start_at = $sessionobject->get_session_var('smiliestartat');
$smilie_per_page = $sessionobject->get_session_var('smilieperpage');
$class_num = substr(get_class($this), -3);
// Start the timing
if (!$sessionobject->get_session_var($class_num . '_start')) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
// Get an array of smilie details
$smilie_array = $this->get_smf_smilie_details($Db_source, $source_database_type, $source_table_prefix, $smilie_start_at, $smilie_per_page);
// Display count and pass time
$displayobject->display_now("<h4>{$displayobject->phrases['importing']} " . count($smilie_array) . " {$displayobject->phrases['smilies']}</h4>");
// If the image category dosn't exsist for the imported smilies, create it
$imported_smilie_group = new ImpExData($Db_target, $sessionobject, 'imagecategory');
$imported_smilie_group->set_value('nonmandatory', 'title', 'Imported Smilies');
$imported_smilie_group->set_value('nonmandatory', 'imagetype', '3');
$imported_smilie_group->set_value('nonmandatory', 'displayorder', '1');
$smilie_group_id = $imported_smilie_group->import_smilie_image_group($Db_target, $target_database_type, $target_table_prefix);
$smilie_object = new ImpExData($Db_target, $sessionobject, 'smilie');
foreach ($smilie_array as $smilie_id => $smilie_details) {
$try = phpversion() < '5' ? $smilie_object : clone $smilie_object;
// Mandatory
$try->set_value('mandatory', 'smilietext', $smilie_details['code']);
$try->set_value('mandatory', 'importsmilieid', $smilie_id);
// Non Mandatory
$try->set_value('nonmandatory', 'title', $smilie_details['description']);
$try->set_value('nonmandatory', 'smiliepath', $smilie_details['filename']);
$try->set_value('nonmandatory', 'imagecategoryid', $smilie_group_id);
$try->set_value('nonmandatory', 'displayorder', $smilie_details['smileyOrder']);
// Is it a duplicate ?
$it_is_a_duplicate = $this->does_smilie_exists($Db_target, $target_database_type, $target_table_prefix, addslashes($pass_array['smilietext']));
if ($it_is_a_duplicate) {
if ($over_write_smilies) {
$import_smilie = true;
}
} else {
$import_smilie = true;
}
// Check if smilie object is valid
if ($try->is_valid()) {
if ($import_smilie) {
if ($try->import_smilie($Db_target, $target_database_type, $target_table_prefix)) {
$displayobject->display_now('<br /><span class="isucc"><b>' . $try->how_complete() . '%</b></span> :: ' . $displayobject->phrases['smilie'] . ' -> ' . $try->get_value('mandatory', 'smilietext'));
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
} else {
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
$sessionobject->add_error($smilie_id, $displayobject->phrases['smilie_not_imported'], $displayobject->phrases['smilie_not_imported_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['smilie_not_imported']}");
}
}
} else {
$displayobject->display_now("<br />{$displayobject->phrases['invalid_object']}" . $try->_failedon);
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
}
unset($try);
}
// End resume
// Check for page end
if (count($smilie_array) == 0 or count($smilie_array) < $smilie_per_page) {
$sessionobject->timing($class_num, 'stop', $sessionobject->get_session_var('autosubmit'));
$sessionobject->remove_session_var($class_num . '_start');
$displayobject->update_html($displayobject->module_finished($this->_modulestring, $sessionobject->return_stats($class_num, '_time_taken'), $sessionobject->return_stats($class_num, '_objects_done'), $sessionobject->return_stats($class_num, '_objects_failed')));
$sessionobject->set_session_var($class_num, 'FINISHED');
$sessionobject->set_session_var('import_smilie', 'done');
$sessionobject->set_session_var('module', '000');
$sessionobject->set_session_var('autosubmit', '0');
}
$sessionobject->set_session_var('smiliestartat', $smilie_start_at + $smilie_per_page);
$displayobject->update_html($displayobject->print_redirect('index.php', $sessionobject->get_session_var('pagespeed')));
}