示例#1
0
<?php 
    $forum_id = $fid;
    $tpl_temp = forum_trim(ob_get_contents());
    $tpl_main = str_replace('<!-- forum_main -->', $tpl_temp, $tpl_main);
    ob_end_clean();
    // END SUBST - <!-- forum_main -->
    require FORUM_ROOT . 'footer.php';
}
if (isset($_POST['move_posts_to'])) {
    $move_to_topic = isset($_POST['move_to_topic']) && !empty($_POST['move_to_topic']) ? $_POST['move_to_topic'] : array();
    if (empty($posts)) {
        message($lang_misc['No posts selected']);
    }
    if (!defined('OM_MOVE_POSTS_FUNCTIONS_LOADED')) {
        require $ext_info['path'] . '/functions.php';
    }
    $om_move_posts_max = om_move_posts_load_cache() + 1;
    om_move_posts_generate_cache($om_move_posts_max);
    // Move the posts
    $query = array('UPDATE' => 'posts', 'SET' => 'topic_id=' . $move_to_topic . ', om_move_posts=' . $om_move_posts_max, 'WHERE' => 'id IN(' . implode(',', $posts) . ')');
    if (isset($_POST['change_time'])) {
        $query['SET'] .= ', posted=' . time();
    }
    ($hook = get_hook('move_post_qr_update_post')) ? eval($hook) : null;
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
    sync_topic($tid);
    sync_topic($move_to_topic);
    sync_forum($fid);
    ($hook = get_hook('move_post_end_pre_redirect')) ? eval($hook) : null;
    redirect(forum_link($forum_url['topic'], array($tid, sef_friendly($cur_topic['subject']))), 'Move posts');
}
示例#2
0
     // Merge the posts into the topic
     $query = array('UPDATE' => 'posts', 'SET' => 'topic_id=' . $merge_to_tid, 'WHERE' => 'topic_id IN(' . implode(',', $topics) . ')');
     ($hook = get_hook('mr_confirm_merge_topics_qr_merge_posts')) ? eval($hook) : null;
     $forum_db->query_build($query) or error(__FILE__, __LINE__);
     // Delete any subscriptions
     $query = array('DELETE' => 'subscriptions', 'WHERE' => 'topic_id IN(' . implode(',', $topics) . ') AND topic_id != ' . $merge_to_tid);
     ($hook = get_hook('mr_confirm_merge_topics_qr_delete_subscriptions')) ? eval($hook) : null;
     $forum_db->query_build($query) or error(__FILE__, __LINE__);
     if (!isset($_POST['with_redirect'])) {
         // Delete the topics that have been merged
         $query = array('DELETE' => 'topics', 'WHERE' => 'id IN(' . implode(',', $topics) . ') AND id != ' . $merge_to_tid);
         ($hook = get_hook('mr_confirm_merge_topics_qr_delete_merged_topics')) ? eval($hook) : null;
         $forum_db->query_build($query) or error(__FILE__, __LINE__);
     }
     // Synchronize the topic we merged to and the forum where the topics were merged
     sync_topic($merge_to_tid);
     sync_forum($fid);
     $forum_flash->add_info($lang_misc['Merge topics redirect']);
     ($hook = get_hook('mr_confirm_merge_topics_pre_redirect')) ? eval($hook) : null;
     redirect(forum_link($forum_url['forum'], array($fid, sef_friendly($cur_forum['forum_name']))), $lang_misc['Merge topics redirect']);
 }
 // Setup form
 $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0;
 $forum_page['form_action'] = forum_link($forum_url['moderate_forum'], $fid);
 $forum_page['hidden_fields'] = array('csrf_token' => '<input type="hidden" name="csrf_token" value="' . generate_form_token($forum_page['form_action']) . '" />', 'topics' => '<input type="hidden" name="topics" value="' . implode(',', $topics) . '" />');
 // Setup breadcrumbs
 $forum_page['crumbs'] = array(array($forum_config['o_board_title'], forum_link($forum_url['index'])), array($cur_forum['forum_name'], forum_link($forum_url['forum'], array($fid, sef_friendly($cur_forum['forum_name'])))), array($lang_misc['Moderate forum'], forum_link($forum_url['moderate_forum'], $fid)), $lang_misc['Merge topics']);
 ($hook = get_hook('mr_merge_topics_pre_header_load')) ? eval($hook) : null;
 define('FORUM_PAGE', 'dialogue');
 require FORUM_ROOT . 'header.php';
 // START SUBST - <!-- forum_main -->
 public function comimport_as_topics($mid, $forum_id)
 {
     $db =& $this->mRoot->mController->mDB;
     $mReq = $this->mRoot->mContext->mRequest;
     $mydirname = $this->mDirname;
     // check forum_id
     $frs = $db->query("SELECT * FROM " . $db->prefix($mydirname . "_forums") . " WHERE forum_id={$forum_id}");
     if (!$frs) {
         import_errordie();
     }
     if ($db->getRowsNum($frs) != 1) {
         die('Invalid forum_id');
     }
     // get comments configs from xoops_version.php of the module
     $module_handler =& xoops_gethandler('module');
     $module_obj =& $module_handler->get($mid);
     if (!is_object($module_obj)) {
         die('Invalid mid');
     }
     $com_configs = $module_obj->getInfo('comments');
     // get exparams (consider it as "static" like "page=article&")
     $ers = $db->query("SELECT distinct com_exparams FROM " . $db->prefix("xoopscomments") . " WHERE com_modid={$mid} AND LENGTH(`com_exparams`) > 5 LIMIT 1");
     list($exparam) = $db->fetchRow($ers);
     if (empty($exparam)) {
         $exparam = '';
     } else {
         $exparam = str_replace('&amp;', '&', $exparam);
     }
     if (substr($exparam, -1) != '&') {
         $exparam .= '&';
     }
     // import it into the forum record as format
     $format = '{XOOPS_URL}/modules/' . $module_obj->getVar('dirname') . '/' . $com_configs['pageName'] . '?' . $exparam . $com_configs['itemName'] . '=%s';
     $frs = $db->query("UPDATE " . $db->prefix($mydirname . "_forums") . " SET forum_external_link_format='" . addslashes($format) . "' WHERE forum_id={$forum_id}");
     if (!$frs) {
         import_errordie();
     }
     // import topics
     $to_table = $db->prefix($mydirname . '_topics');
     $from_table = $db->prefix('xoopscomments');
     $crs = $db->query("SELECT com_id,com_itemid,com_title FROM `{$from_table}` WHERE com_modid={$mid} AND com_pid=0");
     if (!$crs) {
         import_errordie();
     }
     while ($row = $db->fetchArray($crs)) {
         $trs = $db->query("INSERT INTO `{$to_table}` SET forum_id={$forum_id},topic_external_link_id=" . intval($row['com_itemid']) . ",topic_title='" . addslashes($row['com_title']) . "'");
         if (!$trs) {
             import_errordie();
         }
         $topic_id = $db->getInsertId();
         comimport_posts_recursive($mydirname, $topic_id, intval($row['com_id']));
         sync_topic($mydirname, $topic_id);
     }
 }