本文整理匯總了PHP中ImpExData::import_thread方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImpExData::import_thread方法的具體用法?PHP ImpExData::import_thread怎麽用?PHP ImpExData::import_thread使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImpExData
的用法示例。
在下文中一共展示了ImpExData::import_thread方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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');
// 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'));
}
示例2: sizeof
function parse_discussion($data)
{
if (!($forum =& $this->get_first_tag('folder'))) {
// not in a forum
return;
} else {
if (!empty($forum['__ignorechildren'])) {
// in an ignored forum
return;
}
}
if ($data['type'] == 'open') {
/*
echo str_repeat('--', sizeof($this->stack)) . " <i>discussion</i><br />\n";
flush();
*/
$this->push_stack($data);
$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);
### Import the thread first ####
// Thread
$thread_object = new ImpExData($this->Db_object, $this->session, 'thread');
$thread_object->set_value('mandatory', 'title', htmlspecialchars($data['attributes']['title']));
$thread_object->set_value('mandatory', 'forumid', $this->session->get_session_var('currentforum'));
$thread_object->set_value('mandatory', 'importthreadid', hexdec($data['attributes']['unique']));
$thread_object->set_value('mandatory', 'importforumid', $this->session->get_session_var('currentforum'));
$userid = hexdec($data['attributes']['author']);
$thread_object->set_value('nonmandatory', 'postusername', $user_names[$userid]);
$thread_object->set_value('nonmandatory', 'postuserid', $users_ids[$userid]);
$thread_object->set_value('nonmandatory', 'dateline', strtotime($data['attributes']['created']));
$thread_object->set_value('nonmandatory', 'visible', '1');
$thread_object->set_value('nonmandatory', 'open', '1');
$thread_object->set_value('nonmandatory', 'sticky', '0');
if ($thread_id = $thread_object->import_thread($this->Db_object, $this->target_db_type, $this->target_db_prefix)) {
echo "<br /><span class=\"isucc\">Thread -- <b>" . $thread_object->how_complete() . "%</b></span> :: thread " . $thread_object->get_value('mandatory', 'title');
$this->session->add_session_var('currentthread', $thread_id);
flush();
} else {
echo "<br />'" . trim($data['attributes']['title']) . " not imported";
}
### Put the data in the first post ###
// Post
$post_object = new ImpExData($this->Db_object, $this->session, 'post');
$post_object->set_value('mandatory', 'threadid', $thread_id);
$post_object->set_value('mandatory', 'userid', $users_ids[$userid]);
$post_object->set_value('mandatory', 'importthreadid', hexdec($data['attributes']['unique']));
$post_object->set_value('nonmandatory', 'visible', '1');
$post_object->set_value('nonmandatory', 'dateline', strtotime(str_replace('.', ' ', $data['attributes']['created'])));
$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']['heading']));
$post_object->set_value('nonmandatory', 'importpostid', hexdec($data['attributes']['unique']));
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 />'" . trim($data['attributes']['title']) . " not imported";
}
unset($post_object, $thread_object);
} else {
if ($data['type'] == 'close') {
if ($popdata = $this->pop_first_tag($data['tag_name'])) {
//echo "popped $data[tag_name] off<br />\n"; flush();
}
}
}
}