d3forum_sync_post_votes($mydirname, $post_id, false); } d3forum_sync_topic_votes($mydirname, $topic_id, false); d3forum_sync_topic($mydirname, $topic_id, false); redirect_header(XOOPS_URL . "/modules/{$mydirname}/index.php?topic_id={$topic_id}", 2, _MD_D3FORUM_TOPICMANAGERDONE); exit; } if (!empty($_POST['topicman_export_copy']) || !empty($_POST['topicman_export_move'])) { require_once dirname(dirname(__FILE__)) . '/include/import_functions.php'; if (!$xoopsGTicket->check(true, 'd3forum')) { redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors()); } $export_mid = intval(@$_POST['export_mid']); $export_forum_id = intval(@$_POST['export_forum_id'][$export_mid]); if (!empty($exportable_modules[$export_mid]) && $export_forum_id > 0) { d3forum_export_topic_to_d3forum($mydirname, $export_mid, $export_forum_id, $forum_id, $topic_id, !empty($_POST['topicman_export_move'])); redirect_header(XOOPS_URL . "/modules/{$mydirname}/index.php?forum_id={$forum_id}", 2, _MD_D3FORUM_TOPICMANAGERDONE); exit; } } // get target forums $jump_box_forums = array(); foreach ($forum_permissions as $forum_id => $perms) { if ($perms['is_moderator']) { $jump_box_forums[] = $forum_id; } } $whr4forum_jump_box = empty($jump_box_forums) ? '0' : 'f.forum_id IN (' . implode(',', $jump_box_forums) . ')'; // FORM PART $xoopsOption['template_main'] = $mydirname . '_main_topicmanager.html'; include XOOPS_ROOT_PATH . "/header.php";
function d3forum_export_forum_to_d3forum($mydirname, $export_mid, $export_cat_id, $cat_id, $forum_id, $is_move = false) { $db =& Database::getInstance(); $module_handler =& xoops_gethandler('module'); $to_module =& $module_handler->get($export_mid); $export_mydirname = $to_module->getVar('dirname'); // forums table $table_name = 'forums'; $from_table = $db->prefix($mydirname . '_' . $table_name); $to_table = $db->prefix($export_mydirname . '_' . $table_name); $columns = array_diff($GLOBALS['d3forum_tables'][$table_name], array('forum_id', 'cat_id')); $columns4sql = implode(',', $columns); $sql = "INSERT INTO `{$to_table}` ({$columns4sql},`cat_id`) SELECT {$columns4sql},{$export_cat_id} FROM `{$from_table}` WHERE forum_id={$forum_id}"; $ers = $db->query($sql); $export_forum_id = $db->getInsertId(); if ($is_move) { $db->query("DELETE FROM `{$from_table}` WHERE forum_id={$forum_id}"); } // forum_access table $table_name = 'forum_access'; $from_table = $db->prefix($mydirname . '_' . $table_name); $to_table = $db->prefix($export_mydirname . '_' . $table_name); $columns = array_diff($GLOBALS['d3forum_tables'][$table_name], array('forum_id')); $columns4sql = implode(',', $columns); $sql = "INSERT INTO `{$to_table}` ({$columns4sql},`forum_id`) SELECT {$columns4sql},{$export_forum_id} FROM `{$from_table}` WHERE forum_id={$forum_id}"; $ers = $db->query($sql); if ($is_move) { $db->query("DELETE FROM `{$from_table}` WHERE forum_id={$forum_id}"); } // topics etc. $table_name = 'topics'; $from_table = $db->prefix($mydirname . '_' . $table_name); $trs = $db->query("SELECT topic_id FROM `{$from_table}` WHERE forum_id={$forum_id} ORDER BY topic_id"); while (list($topic_id) = $db->fetchRow($trs)) { d3forum_export_topic_to_d3forum($mydirname, $export_mid, $export_forum_id, $forum_id, $topic_id, $is_move); } }