Exemplo n.º 1
0
function display_topic($forum, $topic_id, $content_only = 1)
{
    global $db, $myts, $xoopsUser, $xoopsModule, $forumTable, $meta;
    if ($content_only == 0) {
        include_once XOOPS_ROOT_PATH . "/header.php";
    }
    $q = "select * from " . $forumTable['forums'] . " WHERE forum_id=" . $forum;
    $result = $db->query($q);
    $forumdata = $db->fetch_array($result);
    $q = "select * from " . $forumTable['topics'] . " WHERE topic_id=" . $topic_id;
    $result = $db->query($q);
    $topicdata = $db->fetch_array($result);
    echo "<table border='0' width='100%' cellpadding='5'>";
    echo "<tr><td align='left'>" . newbb_displayImage('f_open') . "&nbsp;&nbsp;<a href='" . $forumPath['url'] . "archive.php'>";
    echo _MD_FORUM_ARCHIVE . "</a>";
    if ($forumdata['parent_forum'] == 0) {
        echo "<br />&nbsp;&nbsp;&nbsp;" . newbb_displayImage('f_open') . "&nbsp;&nbsp;<a href='archive.php?forum={$forum}'>" . $myts->htmlSpecialChars($forumdata['forum_name']) . "</a>";
        echo "<br />" . newbb_displayImage('f_content') . "&nbsp;&nbsp;<strong>" . $myts->htmlSpecialChars($topicdata['topic_title']) . "</strong><br />";
    } else {
        $q = "select forum_name from " . $forumTable['forums'] . " WHERE forum_id=" . $forumdata['parent_forum'];
        $row = $db->fetch_array($db->query($q));
        echo "<br />&nbsp;&nbsp;&nbsp;" . newbb_displayImage('f_open') . "&nbsp;&nbsp;<a href='" . $forumPath['url'] . "archive.php?forum=" . $forumdata['parent_forum'] . "'>" . $myts->htmlSpecialChars($row['forum_name']) . "</a>";
        echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . newbb_displayImage('f_open') . "&nbsp;&nbsp;<a href='archive.php?forum={$forum}'>" . $myts->htmlSpecialChars($forumdata['forum_name']) . "</a>";
        echo "<br />&nbsp;&nbsp;&nbsp;" . newbb_displayImage('f_content') . "&nbsp;&nbsp;<strong>" . $myts->htmlSpecialChars($topicdata['topic_title']) . "</strong><br />";
    }
    echo "</td></tr></table><br />";
    // =============== LINK HEADER ===============
    echo "<table border='0' width='640' cellpadding='5' cellspacing='0' bgcolor='#FFFFFF' align=center><tr><td>";
    echo "<h3>" . _MD_FORUM . " : " . $forumdata['forum_name'] . "</h3>";
    echo "<h3>" . _MD_SUBJECT . " : " . $topicdata['topic_title'] . "</h3>";
    echo "<i><strong>" . $meta['copyright'] . "<br /><a href=" . XOOPS_URL . ">" . XOOPS_URL . "</a>\r\n<br /><br />" . _MD_PRINT_TOPIC_LINK . "<br />\r\n<a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/viewtopic.php?topic_id={$topic_id}&amp;forum={$forum}'>" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/viewtopic.php?topic_id={$topic_id}&amp;forum={$forum}</a>\r\n</strong></i><br /><br />";
    // ============= END LINK HEADER =============
    $forumpost = new ForumPosts();
    $forumpost->setOrder("post_time ASC");
    $forumpost->setTopicId($topic_id);
    $forumpost->setParent(0);
    $postsArray = $forumpost->getAllPosts();
    $count = 0;
    echo "<table border='0' width='100%' cellpadding='5' cellspacing='0' bgcolor='#FFFFFF'><tr><td>";
    foreach ($postsArray as $obj) {
        if (!($count % 2)) {
            $row_color = 1;
        } else {
            $row_color = 2;
        }
        echo "<tr><td>";
        $forumpost->setType($obj->type);
        $obj->showPostForPrint($order);
        $count++;
        echo "</td></tr>";
    }
    echo "</table>";
    echo "</td></tr></table>";
    if ($content_only == 0) {
        include_once XOOPS_ROOT_PATH . "/footer.php";
    }
}
Exemplo n.º 2
0
     } else {
         if ($forumdata['forum_access'] == 2) {
             $uid = 0;
         } else {
             if (!empty($topic_id)) {
                 redirect_header("viewtopic.php?topic_id=" . $topic_id . "&order=" . $order . "&viewmode=" . $viewmode . "&pid=" . $pid . "&forum=" . $forum, 2, _MD_ANONNOTALLOWED);
             } else {
                 redirect_header("viewforum.php?forum=" . $forum, 2, _MD_ANONNOTALLOWED);
             }
             exit;
         }
     }
     $forumpost = new ForumPosts();
     $forumpost->setForum($forum);
     if (isset($pid) && $pid != "") {
         $forumpost->setParent($pid);
     }
     if (!empty($topic_id)) {
         $forumpost->setTopicId($topic_id);
         $isreply = 1;
     }
     $forumpost->setIp($HTTP_SERVER_VARS['REMOTE_ADDR']);
     $forumpost->setUid($uid);
 }
 $subject = xoops_trim($HTTP_POST_VARS['subject']);
 $subject = $subject == '' ? _NOTITLE : $subject;
 $forumpost->setSubject($subject);
 $forumpost->setText($HTTP_POST_VARS['message']);
 $forumpost->setNohtml($HTTP_POST_VARS['nohtml']);
 $forumpost->setNosmiley($HTTP_POST_VARS['nosmiley']);
 $forumpost->setIcon($HTTP_POST_VARS['icon']);