<?php

$query4assign = array();
// EXTERNAL LINK ID (get d3comment_info also)
if (!empty($forum_row['forum_external_link_format']) && !empty($_GET['external_link_id'])) {
    $external_link_id = $myts->stripSlashesGPC($_GET['external_link_id']);
    $query4assign['external_link_id'] = htmlspecialchars($external_link_id, ENT_QUOTES);
    $query4nav .= "&amp;external_link_id=" . rawurlencode($external_link_id);
    $external_link_id4sql = addslashes($external_link_id);
    $whr_external_link_id = "t.topic_external_link_id='{$external_link_id4sql}'";
    $d3comment_info = array('comment_link' => d3forum_get_comment_link($forum_row['forum_external_link_format'], $external_link_id), 'comment_description' => d3forum_get_comment_description($mydirname, $forum_row['forum_external_link_format'], $external_link_id));
    if (is_array($d3comment_info['comment_description'])) {
        $xoops_breadcrumbs[] = array('name' => $d3comment_info['comment_description']['subject']);
    }
} else {
    unset($external_link_id);
    $query4assign['external_link_id'] = '';
    $whr_external_link_id = '1';
    $d3comment_info = array();
}
// TXT
if (!empty($_GET['txt'])) {
    $txt = $myts->stripSlashesGPC($_GET['txt']);
    $query4assign['txt'] = htmlspecialchars($txt, ENT_QUOTES);
    $query4nav .= "&amp;txt=" . rawurlencode($txt);
    $txt4sql = addslashes($txt);
    $whr_txt = "fp.subject LIKE '%{$txt4sql}%' OR fp.post_text LIKE '%{$txt4sql}%'";
} else {
    $query4assign['txt'] = '';
    $whr_txt = '1';
}
<?php

// get this "forum" from given $forum_id
$sql = "SELECT * FROM " . $db->prefix($mydirname . "_forums") . " f WHERE ({$whr_read4forum}) AND f.forum_id={$forum_id}";
if (!($frs = $db->query($sql))) {
    die(_MD_D3FORUM_ERR_SQL . __LINE__);
}
//if( $db->getRowsNum( $frs ) <= 0 ) die( _MD_D3FORUM_ERR_READFORUM ) ;
if ($db->getRowsNum($frs) <= 0) {
    return false;
}
$forum_row = $db->fetchArray($frs);
$cat_id = intval($forum_row['cat_id']);
$isadminormod = (bool) $forum_permissions[$forum_id]['is_moderator'] || $isadmin;
$can_post = (bool) $forum_permissions[$forum_id]['can_post'] || $isadminormod;
$can_edit = (bool) $forum_permissions[$forum_id]['can_edit'] || $isadminormod;
$can_delete = (bool) $forum_permissions[$forum_id]['can_delete'] || $isadminormod;
$need_approve = !(bool) $forum_permissions[$forum_id]['post_auto_approved'] && !$isadminormod;
$forum4assign = array('id' => $forum_row['forum_id'], 'title' => $myts->makeTboxData4Show($forum_row['forum_title']), 'desc' => $myts->displayTarea($forum_row['forum_desc']), 'external_link_format' => htmlspecialchars($forum_row['forum_external_link_format'], ENT_QUOTES), 'topics_count' => intval($forum_row['forum_topics_count']), 'posts_count' => intval($forum_row['forum_posts_count']), 'last_post_time' => intval($forum_row['forum_last_post_time']), 'last_post_time_formatted' => formatTimestamp($forum_row['forum_last_post_time'], 'm'), 'last_post_id' => intval($forum_row['forum_last_post_id']), 'moderate_groups' => d3forum_get_forum_moderate_groups4show($mydirname, $forum_row['forum_id']), 'moderate_users' => d3forum_get_forum_moderate_users4show($mydirname, $forum_row['forum_id']), 'need_approve' => $need_approve, 'can_post' => $can_post, 'isadminormod' => $isadminormod);
// assign link or free description (by class) as comment
if (!empty($external_link_id)) {
    $topic4assign['comment_link'] = d3forum_get_comment_link($forum_row['forum_external_link_format'], $external_link_id);
    $topic4assign['comment_description'] = d3forum_get_comment_description($mydirname, $forum_row['forum_external_link_format'], $external_link_id);
}
// assign breadcrumbs of this forum
array_splice($xoops_breadcrumbs, 1, 0, array(array('url' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?forum_id=' . $forum_id, 'name' => $forum4assign['title'])));