本文整理汇总了PHP中ImpExCache类的典型用法代码示例。如果您正苦于以下问题:PHP ImpExCache类的具体用法?PHP ImpExCache怎么用?PHP ImpExCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImpExCache类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
$custom_pics_start_at = $sessionobject->get_session_var('custompicsstartat');
$custom_pics_per_page = $sessionobject->get_session_var('custompicsperpage');
$class_num = substr(get_class($this), -3);
$idcache = new ImpExCache($Db_target, $target_database_type, $target_table_prefix);
// Start the timing
if (!$sessionobject->get_session_var($class_num . '_start')) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
$customprofilepic_array = $this->get_details($Db_source, $source_database_type, $source_table_prefix, $custom_pics_start_at, $custom_pics_per_page, 'customprofilepic', 'userid');
$customprofilepic_object = new ImpExData($Db_target, $sessionobject, 'customprofilepic');
$displayobject->display_now("<h4>{$displayobject->phrases['importing']} " . count($customprofilepic_array) . " {$displayobject->phrases['cust_pics']}</h4>");
foreach ($customprofilepic_array as $cust_pic_id => $cus_pic) {
$try = phpversion() < '5' ? $customprofilepic_object : clone $customprofilepic_object;
$try->set_value('mandatory', 'importcustomprofilepicid', $cust_pic_id);
$userid = $idcache->get_id('user', $cus_pic['userid']);
if (!$userid) {
$displayobject->display_now("<br />Userid error");
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
continue;
}
$try->set_value('nonmandatory', 'userid', $userid);
$try->set_value('nonmandatory', 'filedata', $Db_target->escape_string($cus_pic['profilepicdata']));
$try->set_value('nonmandatory', 'dateline', $cus_pic['dateline']);
$try->set_value('nonmandatory', 'filename', $cus_pic['filename']);
$try->set_value('nonmandatory', 'visible', $cus_pic['visible']);
if ($try->is_valid()) {
if ($try->import_custom_profile_pic($Db_target, $target_database_type, $target_table_prefix)) {
$displayobject->display_now('<br /><span class="isucc"><b>' . $try->how_complete() . '%</b></span> ' . $displayobject->phrases['cus_pic'] . ' -> ' . $try->get_value('nonmandatory', 'filename'));
$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($cust_pic_id, $displayobject->phrases['custom_profile_pic_not_imported'], $displayobject->phrases['custom_profile_pic_not_imported_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['custom_profile_pic_not_imported']}");
}
} else {
$displayobject->display_now("<br />Invalid avatar object, skipping." . $try->_failedon);
}
unset($try);
}
if (count($customprofilepic_array) == 0 or count($customprofilepic_array) < $custom_pics_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('module', '000');
$sessionobject->set_session_var('autosubmit', '0');
$displayobject->update_html($displayobject->print_redirect('index.php', $sessionobject->get_session_var('pagespeed')));
} else {
$displayobject->update_html($displayobject->print_redirect('index.php', $sessionobject->get_session_var('pagespeed')));
$sessionobject->set_session_var('custompicsstartat', $custom_pics_start_at + $custom_pics_per_page);
}
}
示例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');
$user_start_at = $sessionobject->get_session_var('modsstartat');
$user_per_page = $sessionobject->get_session_var('modsperpage');
$idcache = new ImpExCache($Db_target, $target_database_type, $target_table_prefix);
$ubbcgipath = $sessionobject->get_session_var('ubbcgipath');
$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'));
}
$mod_array = $this->get_moderators_list($ubbcgipath, $user_start_at, $user_per_page);
$forum_ids_array = $this->get_forum_ids($Db_target, $target_database_type, $target_table_prefix);
$moderator_object = new ImpExData($Db_target, $sessionobject, 'moderator');
$displayobject->display_now("<h4>Importing " . (count($mod_array) - 1) . " Forums</h4><p><b>From</b> : " . $user_start_at . " :: <b>To</b> : " . ($user_start_at + count($mod_array)) . "</p>");
foreach ($mod_array as $forumid => $user_array) {
foreach ($user_array as $userid) {
$try = phpversion() < '5' ? $moderator_object : clone $moderator_object;
$userid = intval($userid) == 0 ? 1 : intval($userid);
$try->set_value('mandatory', 'userid', $idcache->get_id('user', $userid));
$try->set_value('mandatory', 'forumid', $forum_ids_array[$forumid]);
$try->set_value('mandatory', 'importmoderatorid', $userid);
$try->set_value('nonmandatory', 'permissions', $this->_default_mod_permissions);
if ($try->is_valid()) {
if ($result = $try->import_moderator($Db_target, $target_database_type, $target_table_prefix)) {
$displayobject->display_now("<br /><span class=\"isucc\"><b>" . $try->how_complete() . "%</b></span> :: " . $idcache->get_id('username', $userid));
flush;
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
} else {
$sessionobject->add_error('warning', $this->_modulestring, get_class($this) . "::import_user failed for " . trim($userarray[0]) . ". getUserDetails was ok.", 'Check database permissions and user table');
$displayobject->display_now("<br />Got user " . $try->get_value('mandatory', 'username') . " and <b>DID NOT</b> imported to the " . $target_database_type . " database");
}
} else {
$displayobject->display_now("<br />Invalid user object, skipping." . $try->_failedon);
}
unset($try);
}
}
$timetaken = date('s', time() - $start);
if (count($user_array) == 0 or count($user_array) < $user_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_users', 'done');
$sessionobject->set_session_var('module', '000');
$sessionobject->set_session_var('autosubmit', '0');
$displayobject->update_html($displayobject->print_redirect('index.php', '1'));
} else {
$sessionobject->add_session_var('totalusersdone', $sessionobject->get_session_var('totalusersdone') + $doneperpass);
$displayobject->update_html($displayobject->print_redirect('index.php', ''));
$sessionobject->set_session_var('usersstartat', $user_start_at + $user_per_page);
}
}
示例3: 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);
$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_fireboard_posts($Db_source, $s_db_type, $s_tb_prefix, $start_at, $per_page);
// Display count and pass time
$displayobject->print_per_page_pass($data_array['count'], $displayobject->phrases['posts'], $start_at);
$ImpExData_object = new ImpExData($Db_target, $sessionobject, 'post');
foreach ($data_array['data'] as $import_id => $data) {
$try = phpversion() < '5' ? $ImpExData_object : clone $ImpExData_object;
// Mandatory
$try->set_value('mandatory', 'threadid', $idcache->get_id('thread', $data['thread']));
$try->set_value('mandatory', 'importthreadid', $data['thread']);
$try->set_value('mandatory', 'userid', $idcache->get_id('user', $data['userid']));
// Non mandatory
$try->set_value('nonmandatory', 'visible', '1');
$try->set_value('nonmandatory', 'ipaddress', $data['ip']);
$try->set_value('nonmandatory', 'showsignature', '1');
$try->set_value('nonmandatory', 'allowsmilie', '1');
$try->set_value('nonmandatory', 'pagetext', $this->html_2_bb($data['post_text']));
$try->set_value('nonmandatory', 'dateline', $data['time']);
$try->set_value('nonmandatory', 'title', $data['subject']);
$try->set_value('nonmandatory', 'username', $data['name']);
$try->set_value('nonmandatory', 'parentid', $idcache->get_id('post', $data['parent']));
$try->set_value('nonmandatory', 'importpostid', $import_id);
// Check if object is valid
if ($try->is_valid()) {
if ($try->import_post($Db_target, $t_db_type, $t_tb_prefix)) {
if (shortoutput) {
$displayobject->display_now('.');
} else {
$displayobject->display_now('<br /><span class="isucc">' . $import_id . ' :: <b>' . $try->how_complete() . '%</b></span> ' . $displayobject->phrases['post'] . ' -> ' . $data['subject']);
}
$sessionobject->add_session_var("{$class_num}_objects_done", intval($sessionobject->get_session_var("{$class_num}_objects_done")) + 1);
} else {
$sessionobject->add_session_var("{$class_num}_objects_failed", intval($sessionobject->get_session_var("{$class_num}_objects_failed")) + 1);
$sessionobject->add_error($Db_target, 'warning', $class_num, $import_id, $displayobject->phrases['post_not_imported'], $displayobject->phrases['post_not_imported_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['post_not_imported']}");
}
// $try->import_post
} else {
$sessionobject->add_session_var("{$class_num}_objects_failed", intval($sessionobject->get_session_var("{$class_num}_objects_failed")) + 1);
$sessionobject->add_error($Db_target, 'invalid', $class_num, $import_id, $displayobject->phrases['invalid_object'] . ' ' . $try->_failedon, $displayobject->phrases['invalid_object_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['invalid_object']}" . $try->_failedon);
}
// is_valid
unset($try);
}
// 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");
if ($this->update_post_parent_ids($Db_target, $t_db_type, $t_tb_prefix)) {
$displayobject->display_now($displayobject->phrases['successful']);
} else {
$displayobject->display_now($displayobject->phrases['failed']);
}
$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');
}
$sessionobject->set_session_var('startat', $data_array['lastid']);
$displayobject->update_html($displayobject->print_redirect('index.php', $sessionobject->get_session_var('pagespeed')));
}
示例4: 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);
$idcache = new ImpExCache($Db_target, $t_db_type, $t_tb_prefix);
$ImpExData = new ImpExData($Db_target, $sessionobject, 'moderator');
// 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_phpBB3_mods($Db_source, $s_db_type, $s_tb_prefix, $start_at, $per_page);
$forum_ids_array = $this->get_forum_ids($Db_target, $t_db_type, $t_tb_prefix);
// Display count and pass time
$displayobject->print_per_page_pass($data_array['count'], $displayobject->phrases['moderators'], $start_at);
if ($data_array['count'] > 0) {
foreach ($data_array['data'] as $import_id => $data) {
$try = phpversion() < '5' ? $ImpExData : clone $ImpExData;
// Mandatory
if ($idcache->get_id('user', $data['user_id']) > 0) {
$try->set_value('mandatory', 'userid', $idcache->get_id('user', $data['user_id']));
} else {
continue;
}
$try->set_value('mandatory', 'forumid', $forum_ids_array["{$data['forum_id']}"]);
$this->_dupe_checking = false;
// No unique id's
$try->set_value('mandatory', 'importmoderatorid', $import_id);
// Non mandatory
$try->set_value('mandatory', 'permissions', $this->_default_mod_permissions);
// Check if object is valid
if ($try->is_valid()) {
if ($try->import_moderator($Db_target, $t_db_type, $t_tb_prefix)) {
$displayobject->display_now('<br /><span class="isucc"><b>' . $try->how_complete() . '%</b></span> ' . $displayobject->phrases['moderator'] . ' -> ' . $data['username']);
$sessionobject->add_session_var("{$class_num}_objects_done", intval($sessionobject->get_session_var("{$class_num}_objects_done")) + 1);
} else {
$sessionobject->add_session_var("{$class_num}_objects_failed", intval($sessionobject->get_session_var("{$class_num}_objects_failed")) + 1);
$sessionobject->add_error($Db_target, 'warning', $class_num, $import_id, $displayobject->phrases['moderator_import_error'], $displayobject->phrases['moderator_error_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['moderator_not_imported']}");
}
// $try->import_moderator
} else {
$sessionobject->add_session_var("{$class_num}_objects_failed", intval($sessionobject->get_session_var("{$class_num}_objects_failed")) + 1);
$sessionobject->add_error($Db_target, 'invalid', $class_num, $import_id, $displayobject->phrases['invalid_object'] . ' ' . $try->_failedon, $displayobject->phrases['invalid_object_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['invalid_object']}" . $try->_failedon);
}
// is_valid
unset($try);
}
// End foreach
}
// End if
// Check for page end
if ($data['count'] == 0 or $data['count'] < $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('module', '000');
$sessionobject->set_session_var('autosubmit', '0');
}
$sessionobject->set_session_var('startat', $data_array['lastid']);
$displayobject->update_html($displayobject->print_redirect('index.php', $sessionobject->get_session_var('pagespeed')));
}
示例5: 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);
$idcache = new ImpExCache($Db_target, $t_db_type, $t_tb_prefix);
$pm_text_object = new ImpExData($Db_target, $sessionobject, 'pmtext');
$pm_object = new ImpExData($Db_target, $sessionobject, 'pm');
// 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}tx_mmforum_pminbox", 'uid', 0, $start_at, $per_page);
// Get some refrence arrays (use and delete as nessesary).
// User info
#$this->get_vb_userid($Db_target, $t_db_type, $t_tb_prefix, $importuserid);
#$this->get_one_username($Db_target, $t_db_type, $t_tb_prefix, $theuserid, $id='importuserid');
#$users_array = $this->get_user_array($Db_target, $t_db_type, $t_tb_prefix, $startat = null, $perpage = null);
#$done_user_ids = $this->get_done_user_ids($Db_target, $t_db_type, $t_tb_prefix);
#$user_ids_array = $this->get_user_ids($Db_target, $t_db_type, $t_tb_prefix, $do_int_val = false);
#$user_name_array = $this->get_username_to_ids($Db_target, $t_db_type, $t_tb_prefix);
// Groups info
#$user_group_ids_array = $this->get_imported_group_ids($Db_target, $t_db_type, $t_tb_prefix);
#$user_group_ids_by_name_array = $this->get_imported_group_ids_by_name($Db_target, $t_db_type, $t_tb_prefix);
#$bannded_groupid = $this->get_banned_group($Db_target, $t_db_type, $t_tb_prefix);
// Thread info
#$this->get_thread_id($Db_target, $t_db_type, $t_tb_prefix, &$importthreadid, &$forumid); // & left to show refrence
#$thread_ids_array = $this->get_threads_ids($Db_target, $t_db_type, $t_tb_prefix);
// Post info
#$this->get_posts_ids($Db_target, $t_db_type, $t_tb_prefix);
// Category info
#$cat_ids_array = $this->get_category_ids($Db_target, $t_db_type, $t_tb_prefix);
#$style_ids_array = $this->get_style_ids($Db_target, $t_db_type, $t_tb_prefix, $pad=0);
// Forum info
#$forum_ids_array = $this->get_forum_ids($Db_target, $t_db_type, $t_tb_prefix, $pad=0);
// 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) {
$vB_pm_text = phpversion() < '5' ? $pm_text_object : clone $pm_text_object;
$userid = $idcache->get_id('user', $pm['to_uid']);
$username = $idcache->get_id('username', $pm['to_uid']);
unset($touserarray);
$touserarray[$userid] = $username;
$vB_pm_text->set_value('mandatory', 'fromuserid', $idcache->get_id('user', $pm['from_uid']));
$vB_pm_text->set_value('mandatory', 'title', $pm['subject']);
$vB_pm_text->set_value('mandatory', 'message', $pm['message']);
$vB_pm_text->set_value('mandatory', 'importpmid', $pm_id);
$vB_pm_text->set_value('mandatory', 'touserarray', addslashes(serialize($touserarray)));
$vB_pm_text->set_value('nonmandatory', 'fromusername', $idcache->get_id('username', $pm['from_uid']));
$vB_pm_text->set_value('nonmandatory', 'iconid', '');
$vB_pm_text->set_value('nonmandatory', 'dateline', $pm['tstamp']);
$vB_pm_text->set_value('nonmandatory', 'showsignature', '1');
$vB_pm_text->set_value('nonmandatory', 'allowsmilie', '1');
if ($vB_pm_text->is_valid()) {
$pm_text_id = $vB_pm_text->import_pm_text($Db_target, $t_db_type, $t_tb_prefix);
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['to_uid']));
$vB_pm_to->set_value('mandatory', 'importpmid', $pm_id);
$vB_pm_to->set_value('nonmandatory', 'folderid', '0');
$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['from_uid']));
$vB_pm_from->set_value('mandatory', 'importpmid', $pm_id);
$vB_pm_from->set_value('nonmandatory', 'folderid', '-1');
$vB_pm_from->set_value('nonmandatory', 'messageread', '0');
if ($vB_pm_text->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>' . $vB_pm_to->how_complete() . '%</b></span> ' . $displayobject->phrases['pm'] . ' -> ' . $vB_pm_text->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'], $vB_pm_from->_failedon);
$displayobject->display_now("<br />{$displayobject->phrases['invalid_object']}" . $vB_pm_from->_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, $vB_pm_from, $displayobject->phrases['pm_not_imported'], $displayobject->phrases['pm_not_imported_rem_2']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['pm_not_imported']}");
//.........这里部分代码省略.........
示例6: 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);
$idcache = new ImpExCache($Db_target, $t_db_type, $t_tb_prefix);
// Clone and cache
$poll_object = new ImpExData($Db_target, $sessionobject, 'poll');
$idcache = new ImpExCache($Db_target, $target_database_type, $target_table_prefix);
if (!$sessionobject->get_session_var($class_num . '_start')) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
if (intval($poll_per_page) == 0) {
$poll_per_page = 150;
}
// Get an array of poll details
$poll_array = $this->get_fusionbb_polls_details($Db_source, $s_db_type, $s_tb_prefix, $start_at, $per_page);
// Display count and pass time
$displayobject->display_now("<h4>{$displayobject->phrases['importing']} " . count($poll_array) . " {$displayobject->phrases['polls']}</h4><p><b>{$displayobject->phrases['from']}</b> : " . $poll_start_at . " :: <b>{$displayobject->phrases['to']}</b> : " . ($poll_start_at + count($poll_array)) . "</p>");
foreach ($poll_array as $poll_id => $poll) {
$try = phpversion() < '5' ? $poll_object : clone $poll_object;
unset($polls_results_array, $poll_voters, $numberoptions, $voters, $options, $votes);
$poll_options = $this->get_fusionbb_poll_options($Db_source, $s_db_type, $s_tb_prefix, $poll_id);
$poll_voters = $this->get_fusionbb_poll_results_details($Db_source, $s_db_type, $s_tb_prefix, $poll_id);
// Get the total number of options
$number_of_options = substr_count($poll_options, '|||') + 1;
// Use that to build an empty votes array
$votes = array();
for ($i = 1; $i <= $number_of_options; $i++) {
$votes[$i] = 0;
}
foreach ($poll_voters as $id => $details) {
$voter = $idcache->get_id('user', $details['user_id']);
$poll_option = $details['poll_option'];
$poll_voters_array[$voter] = $poll_option;
$votes[$poll_option]++;
}
$total_vote_count = array_sum($votes);
$votes = implode('|||', $votes);
// Mandatory
$try->set_value('mandatory', 'importpollid', $poll_id);
$try->set_value('mandatory', 'question', $poll['poll_title']);
$try->set_value('mandatory', 'dateline', $poll['poll_created']);
$try->set_value('mandatory', 'options', $poll_options);
$try->set_value('mandatory', 'votes', $votes);
// Non Mandatory
$try->set_value('nonmandatory', 'active', '1');
$try->set_value('nonmandatory', 'numberoptions', $number_of_options);
$try->set_value('nonmandatory', 'timeout', $poll['poll_stop']);
// TODO: Is it ? $poll['vote_length']
$try->set_value('nonmandatory', 'multiple', '0');
$try->set_value('nonmandatory', 'voters', $total_vote_count);
$try->set_value('nonmandatory', 'public', '1');
if ($try->is_valid()) {
$result = $try->import_poll($Db_target, $t_db_type, $t_tb_prefix);
$vb_poll_id = $Db_target->insert_id();
if ($result) {
if ($try->import_poll_to_thread($Db_target, $t_db_type, $t_tb_prefix, $vb_poll_id, $this->get_fusionbb_threadid($Db_source, $s_db_type, $s_tb_prefix, $poll['post_id']))) {
if ($try->import_poll_voters($Db_target, $t_db_type, $t_tb_prefix, $poll_voters_array, $vb_poll_id)) {
$displayobject->display_now('<br /><span class="isucc"><b>' . $try->how_complete() . '%</b></span> ' . $displayobject->phrases['poll'] . ' -> ' . $try->get_value('mandatory', 'question'));
$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, $poll_id, $displayobject->phrases['poll_not_imported_3'], $displayobject->phrases['poll_not_imported_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['poll_not_imported']}");
}
} 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, $poll_id, $displayobject->phrases['poll_not_imported_1'], $displayobject->phrases['poll_not_imported_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['poll_not_imported']}");
}
} 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, $poll_id, $displayobject->phrases['poll_not_imported_2'], $displayobject->phrases['poll_not_imported_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['poll_not_imported']}");
}
} else {
$sessionobject->add_error($Db_target, 'invalid', $class_num, $poll_id, $displayobject->phrases['invalid_object'], $try->_failedon);
$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 foreach
// The real end
if (count($poll_array) == 0 or count($poll_array) < $poll_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('module', '000');
$sessionobject->set_session_var('autosubmit', '0');
}
//.........这里部分代码省略.........
示例7: 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, 'cms_layout', 'cms');
$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}cms_layout", 'layoutid', 0, $start_at, $per_page);
// Display count and pass time
$displayobject->print_per_page_pass($data_array['count'], $displayobject->phrases['cms_layouts'], $start_at);
foreach ($data_array['data'] as $import_id => $data) {
$try = phpversion() < '5' ? $ImpExData_object : clone $ImpExData_object;
// mandatory
$try->set_value('mandatory', 'importcmslayoutid', $import_id);
$try->set_value('mandatory', 'title', $data['title']);
$try->set_value('mandatory', 'gridid', $idcache->get_id('grid', $data['gridid']));
// non
$try->set_value('nonmandatory', 'template', $data['template']);
$try->set_value('nonmandatory', 'status', $data['status']);
$try->set_value('nonmandatory', 'contentcolumn', $data['contentcolumn']);
$try->set_value('nonmandatory', 'contentindex', $data['contentindex']);
// Check if object is valid
if ($try->is_valid()) {
if ($try->import_cms_layout($Db_target, $t_db_type, $t_tb_prefix)) {
if (shortoutput) {
$displayobject->display_now('.');
} else {
$displayobject->display_now("<br /><span class=\"isucc\">{$import_id} :: <b>" . $try->how_complete() . '%</b></span> ' . $displayobject->phrases['cms_layout'] . ' -> ' . $data['title']);
}
$sessionobject->add_session_var("{$class_num}_objects_done", intval($sessionobject->get_session_var("{$class_num}_objects_done")) + 1);
} else {
$sessionobject->add_session_var("{$class_num}_objects_failed", intval($sessionobject->get_session_var("{$class_num}_objects_failed")) + 1);
$sessionobject->add_error($Db_target, 'warning', $class_num, $import_id, $displayobject->phrases['cms_layout_not_imported'], $displayobject->phrases['cms_layout_not_imported_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['cms_layout_not_imported']}");
}
// $try->import_blog_group_membership
} else {
$sessionobject->add_session_var("{$class_num}_objects_failed", intval($sessionobject->get_session_var("{$class_num}_objects_failed")) + 1);
$sessionobject->add_error($Db_target, 'invalid', $class_num, $import_id, $displayobject->phrases['invalid_object'] . ' ' . $try->_failedon, $displayobject->phrases['invalid_object_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['invalid_object']}" . $try->_failedon);
}
// is_valid
unset($try);
}
// 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");
$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');
}
$sessionobject->set_session_var('startat', $data_array['lastid']);
$displayobject->update_html($displayobject->print_redirect('index.php', $sessionobject->get_session_var('pagespeed')));
}
示例8: 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
$moderator_start_at = $sessionobject->get_session_var('moderatorstartat');
$moderator_per_page = $sessionobject->get_session_var('moderatorperpage');
$class_num = substr(get_class($this), -3);
$idcache = new ImpExCache($Db_target, $target_database_type, $target_table_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 of moderator details
$moderator_array = $this->get_details($Db_source, $source_database_type, $source_table_prefix, $moderator_start_at, $moderator_per_page, 'moderator', 'moderatorid');
$forum_ids_array = $this->get_forum_ids($Db_target, $target_database_type, $target_table_prefix);
// Display count and pass time
$displayobject->display_now("<h4>{$displayobject->phrases['importing']} " . count($moderator_array) . " {$displayobject->phrases['users']}</h4><p><b>{$displayobject->phrases['from']}</b> : " . $moderator_start_at . " :: <b>{$displayobject->phrases['to']}</b> : " . ($moderator_start_at + count($moderator_array)) . "</p>");
$moderator_object = new ImpExData($Db_target, $sessionobject, 'moderator');
foreach ($moderator_array as $moderator_id => $moderator_details) {
$try = phpversion() < '5' ? $moderator_object : clone $moderator_object;
// Mandatory
$try->set_value('mandatory', 'userid', $idcache->get_id('user', $moderator_details['userid']));
$try->set_value('mandatory', 'forumid', $forum_ids_array["{$moderator_details['forumid']}"]);
$try->set_value('mandatory', 'importmoderatorid', $moderator_details['importmoderatorid']);
// Non Mandatory
$permissions = 0;
if ($moderator_details['caneditposts']) {
$permissions += 1;
}
if ($moderator_details['candeleteposts']) {
$permissions += 2;
}
if ($moderator_details['canopenclose']) {
$permissions += 4;
}
if ($moderator_details['caneditthreads']) {
$permissions += 8;
}
if ($moderator_details['canmanagethreads']) {
$permissions += 16;
}
if ($moderator_details['canannounce']) {
$permissions += 32;
}
if ($moderator_details['canmoderateposts']) {
$permissions += 64;
}
if ($moderator_details['canmoderateattachments']) {
$permissions += 128;
}
if ($moderator_details['canmassmove']) {
$permissions += 256;
}
if ($moderator_details['canmassprune']) {
$permissions += 512;
}
if ($moderator_details['canviewips']) {
$permissions += 1024;
}
if ($moderator_details['canbanusers']) {
$permissions += 4096;
}
if ($moderator_details['canunbanusers']) {
$permissions += 8192;
}
if ($moderator_details['newthreademail']) {
$permissions += 16384;
}
if ($moderator_details['newpostemail']) {
$permissions += 32768;
}
$try->set_value('nonmandatory', 'permissions', $permissions);
// Check if moderator object is valid
if ($try->is_valid()) {
if ($try->import_moderator($Db_target, $target_database_type, $target_table_prefix)) {
$displayobject->display_now('<br /><span class="isucc"><b>' . $try->how_complete() . '%</b></span> ' . $displayobject->phrases['moderator'] . ' -> ' . $idcache->get_id('username', $moderator_details['userid']));
$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($moderator_id, $displayobject->phrases['moderator_not_imported'], $displayobject->phrases['moderator_not_imported_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['moderator_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 foreach
// Check for page end
if (count($moderator_array) == 0 or count($moderator_array) < $moderator_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');
//.........这里部分代码省略.........
示例9: 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');
$idcache = new ImpExCache($Db_target, $t_db_type, $t_tb_prefix);
$class_num = substr(get_class($this), -3);
$ID_blog_text = new ImpExData($Db_target, $sessionobject, 'blog_text', 'blog');
$ID_blog = new ImpExData($Db_target, $sessionobject, 'blog', 'blog');
// 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_vBBlog_blog($Db_source, $s_db_type, $s_tb_prefix, $start_at, $per_page);
// Display count and pass time
$displayobject->print_per_page_pass($data_array['count'], $displayobject->phrases['blogs'], $start_at);
$ImpExData_object = new ImpExData($Db_target, $sessionobject, 'blog');
foreach ($data_array['data'] as $import_id => $data) {
$blog_text = phpversion() < '5' ? $ID_blog_text : clone $ID_blog_text;
$blog = phpversion() < '5' ? $ID_blog : clone $ID_blog;
###########
#
# Blog text
#
###########
// Mandatory blog_text
$blog_text->set_value('mandatory', 'blogid', "0");
// Set to 0 then update when the blog is imported
$blog_text->set_value('mandatory', 'bloguserid', $idcache->get_id('user', $data['blog_text']['bloguserid']));
$blog_text->set_value('mandatory', 'pagetext', $this->html_2_bb($data['blog_text']['pagetext']));
$blog_text->set_value('mandatory', 'dateline', $data['blog_text']['dateline']);
$blog_text->set_value('mandatory', 'userid', $idcache->get_id('user', $data['blog_text']['userid']));
$blog_text->set_value('mandatory', 'importblogtextid', $import_id);
// Non mandatory blog_text
$blog_text->set_value('nonmandatory', 'title', $data['blog_text']['title']);
$blog_text->set_value('nonmandatory', 'allowsmilie', $data['blog_text']['allowsmilie']);
$blog_text->set_value('nonmandatory', 'username', $idcache->get_id('username', $data['blog_text']['userid']));
$blog_text->set_value('nonmandatory', 'ipaddress', $data['blog_text']['ipaddress']);
$blog_text->set_value('nonmandatory', 'reportthreadid', "0");
$blog_text->set_value('nonmandatory', 'state', $data['blog_text']['state']);
// enum('moderation', 'visible', 'deleted')
$blog_text->set_value('nonmandatory', 'htmlstate', $data['blog_text']['htmlstate']);
###########
#
# Blog
#
###########
// Mandatory
$blog->set_value('mandatory', 'firstblogtextid', "0");
$blog->set_value('mandatory', 'userid', $idcache->get_id('user', $data['userid']));
$blog->set_value('mandatory', 'postedby_userid', $idcache->get_id('user', $data['postedby_userid']));
$blog->set_value('mandatory', 'dateline', $data['dateline']);
$blog->set_value('mandatory', 'options', $data['options']);
$blog->set_value('mandatory', 'title', $data['title']);
$blog->set_value('mandatory', 'importblogid', $import_id);
// Non mandatory
$blog->set_value('nonmandatory', 'username', $idcache->get_id('username', $data['userid']));
$blog->set_value('nonmandatory', 'postedby_username', $idcache->get_id('username', $data['postedby_userid']));
$blog->set_value('nonmandatory', 'views', $data['views']);
$blog->set_value('nonmandatory', 'state', $data['state']);
$blog->set_value('nonmandatory', 'pending', $data['pending']);
$blog->set_value('nonmandatory', 'taglist', $data['taglist']);
$blog->set_value('nonmandatory', 'categories', $data['categories']);
// Defaults
// // Attachment import sets this field
#$blog->set_value('nonmandatory', 'attach', $data['attach']);
// Check if object is valid
if ($blog_text->is_valid()) {
if ($blog_text_id = $blog_text->import_blog_text($Db_target, $t_db_type, $t_tb_prefix)) {
// Mandatory
$blog->set_value('mandatory', 'firstblogtextid', $blog_text_id);
// Blog text is ok, do blog
if ($blog->is_valid()) {
if ($blog->import_blog($Db_target, $t_db_type, $t_tb_prefix)) {
if (shortoutput) {
$displayobject->display_now('.');
} else {
$displayobject->display_now('<br /><span class="isucc">' . $import_id . ' :: <b>' . $blog->how_complete() . '%</b></span> ' . $displayobject->phrases['blog'] . ' -> ' . $data['title']);
}
$sessionobject->add_session_var("{$class_num}_objects_done", intval($sessionobject->get_session_var("{$class_num}_objects_done")) + 1);
} else {
$sessionobject->add_session_var("{$class_num}_objects_failed", intval($sessionobject->get_session_var("{$class_num}_objects_failed")) + 1);
$sessionobject->add_error($Db_target, 'warning', $class_num, $import_id, $displayobject->phrases['blog_not_imported'], $displayobject->phrases['blog_not_imported_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['blog_not_imported']}");
}
// $blog->import_blog
} else {
$sessionobject->add_session_var("{$class_num}_objects_failed", intval($sessionobject->get_session_var("{$class_num}_objects_failed")) + 1);
$sessionobject->add_error($Db_target, 'invalid', $class_num, $import_id, $displayobject->phrases['invalid_object'] . ' ' . $blog->_failedon, $displayobject->phrases['invalid_object_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['invalid_object']}" . $blog->_failedon);
}
// is_valid
unset($blog);
//.........这里部分代码省略.........
示例10: 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');
$stepping = $sessionobject->get_session_var('stepping');
$class_num = substr(get_class($this), -3);
$idcache = new ImpExCache($Db_target, $t_db_type, $t_tb_prefix);
$current_board = $this->get_next_ultra_forum($Db_source, $s_db_type, $s_tb_prefix, $stepping);
$sessionobject->set_session_var('currentboard', $current_board);
// Start the timing
if (!$sessionobject->get_session_var("{$class_num}_start")) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
$data_array = array();
// Get an array data
if ($current_board) {
$data_array = $this->get_ultraboard_threads($Db_source, $s_db_type, "{$s_tb_prefix}B{$current_board}", $start_at, $per_page);
}
$forum_ids_array = $this->get_forum_ids($Db_target, $t_db_type, $t_tb_prefix);
// Display count and pass time
$displayobject->print_per_page_pass($data_array['count'], $displayobject->phrases['threads'] . " {$s_tb_prefix}B{$current_board}", $start_at);
$ImpExData_object = new ImpExData($Db_target, $sessionobject, 'thread');
foreach ($data_array['data'] as $import_id => $data) {
$try = phpversion() < '5' ? $ImpExData_object : clone $ImpExData_object;
// Mandatory
$try->set_value('mandatory', 'title', $data['SUBJECT']);
$try->set_value('mandatory', 'importforumid', $current_board);
$try->set_value('mandatory', 'importthreadid', $data['ID']);
$try->set_value('mandatory', 'forumid', $forum_ids_array[$current_board]);
// Non mandatory
$try->set_value('nonmandatory', 'views', $data['HITS']);
$try->set_value('nonmandatory', 'visible', '1');
$try->set_value('nonmandatory', 'sticky', '0');
$try->set_value('nonmandatory', 'open', '1');
$try->set_value('nonmandatory', 'replycount', $data['NUMBER_REPLIES']);
$try->set_value('nonmandatory', 'postusername', $data['USERNAME']);
$try->set_value('nonmandatory', 'postuserid', $idcache->get_id('usernametoid', $data['USERNAME']));
$try->set_value('nonmandatory', 'lastposter', $data['LAST_POST_USERNAME']);
$try->set_value('nonmandatory', 'dateline', $data['POST_SECOND']);
// Check if object is valid
if ($try->is_valid()) {
if ($try->import_thread($Db_target, $t_db_type, $t_tb_prefix)) {
if (shortoutput) {
$displayobject->display_now('.');
} else {
$displayobject->display_now('<br /><span class="isucc">' . $import_id . ' :: <b>' . $try->how_complete() . '%</b></span> ' . $displayobject->phrases['thread'] . ' -> ' . $data['SUBJECT']);
}
$sessionobject->add_session_var("{$class_num}_objects_done", intval($sessionobject->get_session_var("{$class_num}_objects_done")) + 1);
} else {
$sessionobject->add_session_var("{$class_num}_objects_failed", intval($sessionobject->get_session_var("{$class_num}_objects_failed")) + 1);
$sessionobject->add_error($Db_target, 'warning', $class_num, $import_id, $displayobject->phrases['thread_not_imported'], $displayobject->phrases['thread_not_imported_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['thread_not_imported']}");
}
// $try->import_thread
} else {
$sessionobject->add_session_var("{$class_num}_objects_failed", intval($sessionobject->get_session_var("{$class_num}_objects_failed")) + 1);
$sessionobject->add_error($Db_target, 'invalid', $class_num, $import_id, $displayobject->phrases['invalid_object'] . ' ' . $try->_failedon, $displayobject->phrases['invalid_object_rem']);
$displayobject->display_now("<br />{$displayobject->phrases['invalid_object']}" . $try->_failedon);
}
// is_valid
unset($try);
}
// End foreach
// Check for page end
if ($data_array['count'] == 0 or $data_array['count'] < $per_page) {
if ($stepping < 0) {
$sessionobject->set_session_var('stepping', 1);
} else {
$stepping++;
$sessionobject->set_session_var('stepping', $stepping);
}
if (!$current_board) {
// All done
$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');
}
$sessionobject->set_session_var('startat', 0);
} else {
$sessionobject->set_session_var('startat', $start_at + $per_page);
}
$displayobject->update_html($displayobject->print_redirect('index.php', $sessionobject->get_session_var('pagespeed')));
}
示例11: import_cms_widget
function import_cms_widget(&$Db_object, &$databasetype, &$tableprefix, &$data, &$widgetconfig, &$layoutwidget)
{
switch ($databasetype) {
// MySQL database
case 'mysql':
$widgettype = $Db_object->query_first("\n\t\t\t\t\tSELECT w.widgettypeid\n\t\t\t\t\tFROM {$tableprefix}cms_widgettype as w\n\t\t\t\t\tINNER JOIN {$tableprefix}package AS p ON (w.packageid = p.packageid)\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tw.class = '" . addslashes($data['widgettype']['class']) . "'\n\t\t\t\t\t\t\tAND\n\t\t\t\t\t\tp.productid = 'vbcms'\n\t\t\t\t");
if (!$widgettype) {
return false;
}
$Db_object->query("\n\t\t\t\t\tINSERT INTO {$tableprefix}cms_widget\n\t\t\t\t\t(\n\t\t\t\t\t\twidgettypeid, varname, title, description, importcmswidgetid\n\t\t\t\t\t)\n\t\t\t\t\tVALUES\n\t\t\t\t\t(\n\t\t\t\t\t\t" . intval($widgettype['widgettypeid']) . ",\n\t\t\t\t\t\t'" . addslashes($this->get_value('nonmandatory', 'varname')) . "',\n\t\t\t\t\t\t'" . addslashes($this->get_value('nonmandatory', 'title')) . "',\n\t\t\t\t\t\t'" . addslashes($this->get_value('nonmandatory', 'description')) . "',\n\t\t\t\t\t\t" . intval($this->get_value('mandatory', 'importcmswidgetid')) . "\n\t\t\t\t\t)\n\t\t\t\t");
$widgetid = $Db_object->insert_id();
if (!$widgetid) {
return false;
} else {
$idcache = new ImpExCache($Db_object, $databasetype, $tableprefix);
foreach ($data['widgetconfig'] as $_widgetconfig) {
$widgetconfig->set_value('mandatory', 'widgetid', $widgetid);
$widgetconfig->set_value('mandatory', 'importid', 1);
$widgetconfig->set_value('mandatory', 'name', $_widgetconfig['name']);
$widgetconfig->set_value('nonmandatory', 'nodeid', $idcache->get_id('cmsnode', $_widgetconfig['nodeid']));
$widgetconfig->set_value('nonmandatory', 'value', $_widgetconfig['value']);
$widgetconfig->set_value('nonmandatory', 'serialized', $_widgetconfig['serialized']);
if (!$widgetconfig->is_valid() or !$widgetconfig->import_cms_widgetconfig($Db_object, $databasetype, $tableprefix)) {
return false;
}
}
foreach ($data['layoutwidget'] as $_layoutwidget) {
$layoutwidget->set_value('mandatory', 'widgetid', $widgetid);
$layoutwidget->set_value('mandatory', 'importid', 1);
$layoutwidget->set_value('mandatory', 'layoutid', $idcache->get_id('layout', $_layoutwidget['layoutid']));
$layoutwidget->set_value('nonmandatory', 'layoutcolumn', $_layoutwidget['layoutcolumn']);
$layoutwidget->set_value('nonmandatory', 'layoutindex', $_layoutwidget['layoutindex']);
if (!$layoutwidget->is_valid() or !$layoutwidget->import_cms_layoutwidget($Db_object, $databasetype, $tableprefix)) {
return false;
}
}
return $widgetid;
}
// Postgres database
// Postgres database
case 'postgresql':
return false;
// other
// other
default:
return false;
}
}