コード例 #1
0
        $thread_buttons['delete']['link'] = "delete.php?forum=" . $post->getVar('forum_id') . "&topic_id=" . $post->getVar('topic_id');
        $thread_buttons['delete']['name'] = _DELETE;
        $thread_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT);
        $thread_buttons['edit']['link'] = "edit.php?forum=" . $post->getVar('forum_id') . "&topic_id=" . $post->getVar('topic_id');
        $thread_buttons['edit']['name'] = _EDIT;
        $thread_buttons['reply']['image'] = newbb_displayImage('p_reply', _MD_REPLY);
        $thread_buttons['reply']['link'] = "reply.php?forum=" . $post->getVar('forum_id') . "&topic_id=" . $post->getVar('topic_id');
        $thread_buttons['reply']['name'] = _MD_REPLY;
    }
    if (!$isadmin && $xoopsModuleConfig['reportmod_enabled']) {
        $thread_buttons['report']['image'] = newbb_displayImage('p_report', _MD_REPORT);
        $thread_buttons['report']['link'] = "report.php?forum=" . $post->getVar('forum_id') . "&topic_id=" . $post->getVar('topic_id');
        $thread_buttons['report']['name'] = _MD_REPORT;
    }
    $thread_action = array();
    $xoopsTpl->append('posts', array('post_id' => $post->getVar('post_id'), 'topic_id' => $post->getVar('topic_id'), 'forum_id' => $post->getVar('forum_id'), 'post_date' => newbb_formatTimestamp($post->getVar('post_time')), 'post_image' => $post_image, 'post_title' => $post_title, 'post_text' => $post_text, 'post_attachment' => $post_attachment, 'post_edit' => $post->displayPostEdit(), 'post_no' => $start + $pn, 'post_signature' => $post->getVar('attachsig') ? @$poster["signature"] : "", 'poster_ip' => $isadmin && $xoopsModuleConfig['show_ip'] ? long2ip($post->getVar('poster_ip')) : "", 'thread_action' => $thread_action, 'thread_buttons' => $thread_buttons, 'poster' => $poster));
    unset($thread_buttons);
    unset($poster);
}
unset($viewtopic_users);
unset($forums);
if (!empty($xoopsModuleConfig['show_jump'])) {
    mod_loadFunctions("forum", "newbb");
    $xoopsTpl->assign('forum_jumpbox', newbb_make_jumpbox($forum_id));
}
if ($postCount > $post_perpage) {
    include XOOPS_ROOT_PATH . '/class/pagenav.php';
    $nav = new XoopsPageNav($postCount, $post_perpage, $start, "start", 'forum=' . $forum_id . '&viewmode=' . $viewmode . '&status=' . $status . '&uid=' . $uid . '&order=' . $order . "&mode=" . $mode);
    $xoopsTpl->assign('pagenav', $nav->renderNav(4));
} else {
    $xoopsTpl->assign('pagenav', '');
コード例 #2
0
ファイル: user.php プロジェクト: BackupTheBerlios/soopa
 function getInfo()
 {
     global $xoopsModuleConfig, $myts;
     $userinfo = array();
     $user =& $this->user;
     if (!is_object($user) || !$user->isActive()) {
         return null;
     }
     $userinfo["uid"] = $user->getVar("uid");
     $name = $user->getVar('name');
     $name = empty($xoopsModuleConfig['show_realname']) || empty($name) ? $user->getVar('uname') : $name;
     $userinfo["name"] = $name;
     $userinfo["link"] = "<a href=\"" . XOOPS_URL . "/userinfo.php?uid=" . $user->getVar("uid") . "\">" . $name . "</a>";
     $userinfo["avatar"] = is_file(XOOPS_UPLOAD_PATH . "/" . $user->getVar('user_avatar')) ? $user->getVar('user_avatar') : "";
     $userinfo["from"] = $user->getVar('user_from');
     $userinfo["regdate"] = newbb_formatTimestamp($user->getVar('user_regdate'), 'reg');
     $userinfo["posts"] = $user->getVar('posts');
     $userinfo["groups_id"] = $user->getGroups();
     if (!empty($xoopsModuleConfig['user_level'])) {
         $userinfo["level"] = $this->getLevel();
     }
     if (!empty($xoopsModuleConfig['userbar_enabled'])) {
         $userinfo["userbar"] =& $this->getUserbar();
     }
     $rank =& $user->rank();
     $userinfo['rank']["title"] = $rank['title'];
     if (is_file(XOOPS_UPLOAD_PATH . "/" . $rank['image'])) {
         $userinfo['rank']['image'] = "<img src='" . XOOPS_UPLOAD_URL . "/" . $rank['image'] . "' alt='' />";
     }
     if ($user->attachsig()) {
         //$userinfo["signature"] = $myts->displayTarea($user->getVar("user_sig", "N"), 0, 1, 1);
         $userinfo["signature"] = $user->user_sig();
     }
     return $userinfo;
 }
コード例 #3
0
ファイル: user.php プロジェクト: trabisdementia/xuups
 function getInfo(&$user)
 {
     global $xoopsModuleConfig, $myts;
     static $name_anonymous;
     if (!is_object($user) || !$user->isActive()) {
         if (!isset($name_anonymous)) {
             $name_anonymous = $myts->HtmlSpecialChars($GLOBALS["xoopsConfig"]['anonymous']);
         }
         return array("name" => $name_anonymous, "link" => $name_anonymous);
     }
     $this->user = $user;
     $userinfo["uid"] = $user->getVar("uid");
     $name = empty($xoopsModuleConfig['show_realname']) ? $user->getVar('uname') : $user->getVar('name');
     $userinfo["name"] = $name ? $name : $user->getVar('uname');
     $userinfo["link"] = "<a href=\"" . XOOPS_URL . "/userinfo.php?uid=" . $user->getVar("uid") . "\" title=''>" . $userinfo["name"] . "</a>";
     $userinfo["avatar"] = $user->getVar('user_avatar');
     $userinfo["from"] = $user->getVar('user_from');
     require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.time.php";
     $userinfo["regdate"] = newbb_formatTimestamp($user->getVar('user_regdate'), 'reg');
     $userinfo["posts"] = $user->getVar('posts');
     if (!empty($xoopsModuleConfig['user_level'])) {
         $userinfo["level"] = $this->getLevel();
     }
     if (!empty($xoopsModuleConfig['userbar_enabled'])) {
         $userinfo["userbar"] = $this->getUserbar();
     }
     $userinfo["signature"] = $user->getVar('user_sig');
     return $userinfo;
 }
コード例 #4
0
ファイル: rss.php プロジェクト: BackupTheBerlios/haxoo-svn
         continue;
     }
     if ($xoopsModuleConfig['allow_require_reply'] && $topic['require_reply']) {
         continue;
     }
     if (!empty($users[$topic['uid']])) {
         $topic['uname'] = $users[$topic['uid']];
     } else {
         $topic['uname'] = $topic['poster_name'] ? $myts->htmlSpecialChars($topic['poster_name']) : $myts->htmlSpecialChars($GLOBALS["xoopsConfig"]["anonymous"]);
     }
     $description = $topic["forum_name"] . "::";
     $topic['topic_subject'] = empty($type_list[$topic["type_id"]]) ? "" : "[" . $type_list[$topic["type_id"]] . "] ";
     $description .= $topic['topic_subject'] . $topic['topic_title'] . "<br />\n";
     $description .= $myts->displayTarea($topic['post_text'], $topic['dohtml'], $topic['dosmiley'], $topic['doxcode'], $topic['dobr']);
     $label = _MD_BY . " " . $topic['uname'];
     $time = newbb_formatTimestamp($topic['post_time'], "rss");
     $link = XOOPS_URL . "/modules/" . $xoopsModule->getVar('dirname') . '/viewtopic.php?post_id=' . $topic['post_id'] . '';
     if (!empty($xoopsModuleConfig['do_rewrite'])) {
         $oldurl = "<a href=\"" . $link . "\">";
         $newurl = seo_urls($oldurl);
         $newurl = str_replace("<a href=\"", "", $newurl);
         $newurl = str_replace("\">", "", $newurl);
         $link = $newurl;
     }
     $title = $topic['subject'];
     if (!$rss->addItem($title, $link, $description, $label, $time)) {
         break;
     }
 }
 $rss_feed = $xmlrss_handler->get($rss);
 $tpl->assign('rss', $rss_feed);
コード例 #5
0
ファイル: post.php プロジェクト: BackupTheBerlios/haxoo-svn
 function showPost($isadmin)
 {
     global $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $myts;
     global $forumUrl, $forumImage;
     global $viewtopic_users, $viewtopic_posters, $forum_obj, $topic_obj, $online, $user_karma, $viewmode, $order, $start, $total_posts, $topic_status;
     static $post_NO = 0;
     static $name_anonymous;
     if (!isset($name_anonymous)) {
         $name_anonymous = $myts->HtmlSpecialChars($GLOBALS["xoopsConfig"]['anonymous']);
     }
     mod_loadFunctions("time", "newbb");
     mod_loadFunctions("render", "newbb");
     $post_id = $this->getVar('post_id');
     $topic_id = $this->getVar('topic_id');
     $forum_id = $this->getVar('forum_id');
     $query_vars = array("status", "order", "start", "mode", "viewmode");
     $query_array = array();
     $query_array["topic_id"] = "topic_id={$topic_id}";
     foreach ($query_vars as $var) {
         if (!empty($_GET[$var])) {
             $query_array[$var] = "{$var}={$_GET[$var]}";
         }
     }
     $page_query = htmlspecialchars(implode("&", array_values($query_array)));
     $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
     $post_NO++;
     if (strtolower($order) == "desc") {
         $post_no = $total_posts - ($start + $post_NO) + 1;
     } else {
         $post_no = $start + $post_NO;
     }
     if ($isadmin || $this->checkIdentity()) {
         $post_text = $this->getVar('post_text');
         $post_attachment = $this->displayAttachment();
     } elseif ($xoopsModuleConfig['enable_karma'] && $this->getVar('post_karma') > $user_karma) {
         $post_text = "<div class='karma'>" . sprintf(_MD_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')) . "</div>";
         $post_attachment = '';
     } elseif ($xoopsModuleConfig['allow_require_reply'] && $this->getVar('require_reply') && (!$uid || !in_array($uid, $viewtopic_posters))) {
         $post_text = "<div class='karma'>" . _MD_REPLY_REQUIREMENT . "</div>";
         $post_attachment = '';
     } else {
         $post_text = $this->getVar('post_text');
         $post_attachment = $this->displayAttachment();
     }
     if (isset($viewtopic_users[$this->getVar('uid')])) {
         $poster = $viewtopic_users[$this->getVar('uid')];
     } else {
         $name = ($post_name = $this->getVar('poster_name')) ? $post_name : $name_anonymous;
         $poster = array('poster_uid' => 0, 'name' => $name, 'link' => $name);
     }
     if ($posticon = $this->getVar('icon')) {
         $post_image = '<a name="' . $post_id . '"><img src="' . XOOPS_URL . '/images/subject/' . $posticon . '" alt="" /></a>';
     } else {
         $post_image = '<a name="' . $post_id . '"><img src="' . XOOPS_URL . '/images/icons/posticon.gif" alt="" /></a>';
     }
     $thread_buttons = array();
     $mod_buttons = array();
     if ($isadmin && ($xoopsUser && $xoopsUser->getVar('uid') != $this->getVar('uid')) && $this->getVar('uid') > 0) {
         $mod_buttons['bann']['image'] = newbb_displayImage('p_bann', _MD_SUSPEND_MANAGEMENT);
         $mod_buttons['bann']['link'] = "moderate.php?forum=" . $forum_id . "&amp;fuid=" . $this->getVar('uid');
         $mod_buttons['bann']['name'] = _MD_SUSPEND_MANAGEMENT;
         $thread_buttons['bann']['image'] = newbb_displayImage('p_bann', _MD_SUSPEND_MANAGEMENT);
         $thread_buttons['bann']['link'] = "moderate.php?forum=" . $forum_id . "&amp;fuid=" . $this->getVar('uid');
         $thread_buttons['bann']['name'] = _MD_SUSPEND_MANAGEMENT;
     }
     if ($GLOBALS["xoopsModuleConfig"]['enable_permcheck']) {
         $topic_handler =& xoops_getmodulehandler('topic', 'newbb');
         $topic_status = $topic_obj->getVar('topic_status');
         if ($topic_handler->getPermission($forum_id, $topic_status, "edit")) {
             $edit_ok = $isadmin || $this->checkIdentity() && $this->checkTimelimit('edit_timelimit');
             if ($edit_ok) {
                 $thread_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT);
                 $thread_buttons['edit']['link'] = "edit.php?{$page_query}";
                 $thread_buttons['edit']['name'] = _EDIT;
                 $mod_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT);
                 $mod_buttons['edit']['link'] = "edit.php?{$page_query}";
                 $mod_buttons['edit']['name'] = _EDIT;
             }
         }
         if ($topic_handler->getPermission($forum_id, $topic_status, "delete")) {
             $delete_ok = $isadmin || $this->checkIdentity() && $this->checkTimelimit('delete_timelimit');
             if ($delete_ok) {
                 $thread_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE);
                 $thread_buttons['delete']['link'] = "delete.php?{$page_query}";
                 $thread_buttons['delete']['name'] = _DELETE;
                 $mod_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE);
                 $mod_buttons['delete']['link'] = "delete.php?{$page_query}";
                 $mod_buttons['delete']['name'] = _DELETE;
             }
         }
         if ($topic_handler->getPermission($forum_id, $topic_status, "reply")) {
             $thread_buttons['reply']['image'] = newbb_displayImage('p_reply', _MD_REPLY);
             $thread_buttons['reply']['link'] = "reply.php?{$page_query}";
             $thread_buttons['reply']['name'] = _MD_REPLY;
             $thread_buttons['quote']['image'] = newbb_displayImage('p_quote', _MD_QUOTE);
             $thread_buttons['quote']['link'] = "reply.php?{$page_query}&amp;quotedac=1";
             $thread_buttons['quote']['name'] = _MD_QUOTE;
         }
     } else {
         $mod_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT);
         $mod_buttons['edit']['link'] = "edit.php?{$page_query}";
         $mod_buttons['edit']['name'] = _EDIT;
         $mod_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE);
         $mod_buttons['delete']['link'] = "delete.php?{$page_query}";
         $mod_buttons['delete']['name'] = _DELETE;
         $thread_buttons['reply']['image'] = newbb_displayImage('p_reply', _MD_REPLY);
         $thread_buttons['reply']['link'] = "reply.php?{$page_query}";
         $thread_buttons['reply']['name'] = _MD_REPLY;
     }
     if (!$isadmin && $xoopsModuleConfig['reportmod_enabled']) {
         $thread_buttons['report']['image'] = newbb_displayImage('p_report', _MD_REPORT);
         $thread_buttons['report']['link'] = "report.php?{$page_query}";
         $thread_buttons['report']['name'] = _MD_REPORT;
     }
     $thread_action = array();
     $thread_action['pdf']['image'] = newbb_displayImage('pdf', _MD_PDF);
     $thread_action['pdf']['link'] = "makepdf.php?type=post&amp;pageid=0&amp;scale=0.66";
     $thread_action['pdf']['name'] = _MD_PDF;
     $thread_action['pdf']['target'] = '_blank';
     $thread_action['print']['image'] = newbb_displayImage('printer', _MD_PRINT);
     $thread_action['print']['link'] = "print.php?form=2&amp;forum=" . $forum_id . "&amp;topic_id=" . $topic_id;
     $thread_action['print']['name'] = _MD_PRINT;
     $thread_action['print']['target'] = '_blank';
     $post = array('post_id' => $post_id, 'post_parent_id' => $this->getVar('pid'), 'post_date' => newbb_formatTimestamp($this->getVar('post_time')), 'post_image' => $post_image, 'post_title' => $this->getVar('subject'), 'post_text' => $post_text, 'post_attachment' => $post_attachment, 'post_edit' => $this->displayPostEdit(), 'post_no' => $post_no, 'post_signature' => $this->getVar('attachsig') ? @$poster["signature"] : "", 'poster_ip' => $isadmin && $xoopsModuleConfig['show_ip'] ? long2ip($this->getVar('poster_ip')) : "", 'thread_action' => $thread_action, 'thread_buttons' => $thread_buttons, 'mod_buttons' => $mod_buttons, 'poster' => $poster, 'post_permalink' => '<a href="viewtopic.php?post_id=' . $post_id . '"></a>');
     unset($thread_buttons);
     unset($mod_buttons);
     unset($eachposter);
     return $post;
 }
コード例 #6
0
ファイル: post.php プロジェクト: BackupTheBerlios/soopa
 function showPost($isadmin, $forumdata)
 {
     global $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $myts, $xoopsTpl, $forumUrl, $forumImage, $viewtopic_users, $viewtopic_posters, $viewtopic_forum, $online, $user_karma, $viewmode, $order, $start, $total_posts;
     static $post_NO = 0;
     static $user_ip;
     $post_NO++;
     if (strtolower($order) == "desc") {
         $post_no = $total_posts - ($start + $post_NO) + 1;
     } else {
         $post_no = $start + $post_NO;
     }
     $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
     if ($isadmin or $this->checkIdentity()) {
         $post_text = $this->getVar('post_text');
         $post_attachment = $this->displayAttachment();
     } elseif ($xoopsModuleConfig['enable_karma'] && $this->getVar('post_karma') > $user_karma) {
         $post_text = "<div class='karma'>" . sprintf(_MD_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')) . "</div>";
         $post_attachment = '';
     } elseif ($xoopsModuleConfig['allow_require_reply'] && $this->getVar('require_reply') && (!$uid || !in_array($uid, $viewtopic_posters))) {
         $post_text = "<div class='karma'>" . _MD_REPLY_REQUIREMENT . "</div>";
         $post_attachment = '';
     } else {
         $post_text = $this->getVar('post_text');
         $post_attachment = $this->displayAttachment();
     }
     $poster = $this->getVar('uid') > 0 && isset($viewtopic_users[$this->getVar('uid')]) ? $viewtopic_users[$this->getVar('uid')] : array('poster_uid' => 0, 'name' => $this->getVar('poster_name') ? $this->getVar('poster_name') : $myts->HtmlSpecialChars($xoopsConfig['anonymous']), 'link' => $this->getVar('poster_name') ? $this->getVar('poster_name') : $myts->HtmlSpecialChars($xoopsConfig['anonymous']));
     $posticon = $this->getVar('icon');
     if (isset($posticon) && $posticon != '') {
         $post_image = '<a name="' . $this->getVar('post_id') . '"><img src="' . XOOPS_URL . '/images/subject/' . $this->getVar('icon') . '" alt="" /></a>';
     } else {
         $post_image = '<a name="' . $this->getVar('post_id') . '"><img src="' . XOOPS_URL . '/images/icons/posticon.gif" alt="" /></a>';
     }
     $post_title = $this->getVar('subject');
     $thread_buttons = array();
     $topic_handler =& xoops_getmodulehandler('topic', 'newbb');
     if ($topic_handler->getPermission($viewtopic_forum, $forumdata['topic_status'], "edit")) {
         $edit_ok = false;
         if ($isadmin) {
             $edit_ok = true;
         } elseif ($this->checkIdentity() && $this->checkTimelimit('edit_timelimit')) {
             $edit_ok = true;
         }
         if ($edit_ok) {
             $thread_buttons['edit']['image'] = newbb_displayImage($forumImage['p_edit'], _EDIT);
             $thread_buttons['edit']['link'] = "edit.php?forum=" . $forumdata['forum_id'] . "&amp;topic_id=" . $this->getVar('topic_id') . "&amp;viewmode={$viewmode}&amp;order={$order}";
             $thread_buttons['edit']['name'] = _EDIT;
         } else {
             $thread_buttons['edit']['image'] = "";
             $thread_buttons['edit']['link'] = "";
             $thread_buttons['edit']['name'] = "";
         }
     }
     if ($topic_handler->getPermission($viewtopic_forum, $forumdata['topic_status'], "delete")) {
         $delete_ok = false;
         if ($isadmin) {
             $delete_ok = true;
         } elseif ($this->checkIdentity() && $this->checkTimelimit('delete_timelimit')) {
             $delete_ok = true;
         }
         if ($delete_ok) {
             $thread_buttons['delete']['image'] = newbb_displayImage($forumImage['p_delete'], _DELETE);
             $thread_buttons['delete']['link'] = "delete.php?forum=" . $forumdata['forum_id'] . "&amp;topic_id=" . $this->getVar('topic_id') . "&amp;viewmode={$viewmode}&amp;order={$order}&amp;act=1";
             $thread_buttons['delete']['name'] = _DELETE;
         } else {
             $thread_buttons['delete']['image'] = "";
             $thread_buttons['delete']['link'] = "";
             $thread_buttons['delete']['name'] = "";
         }
         if ($isadmin) {
             $thread_buttons['delete']['image'] = newbb_displayImage($forumImage['p_delete'], _DELETE);
             $thread_buttons['delete']['link'] = "delete.php?forum=" . $forumdata['forum_id'] . "&amp;topic_id=" . $this->getVar('topic_id') . "&amp;viewmode={$viewmode}&amp;order={$order}&amp;act=99";
             $thread_buttons['delete']['name'] = _DELETE;
         }
     }
     if ($topic_handler->getPermission($viewtopic_forum, $forumdata['topic_status'], "reply")) {
         $t_reply = newbb_displayImage($forumImage['t_reply'], _MD_POSTREPLY);
         $xoopsTpl->assign('forum_reply', "<a href=\"reply.php?forum=" . $forumdata['forum_id'] . "&amp;topic_id=" . $this->getVar('topic_id') . "&amp;viewmode=" . $viewmode . "&amp;start={$start}&amp;post_id=" . $forumdata['topic_last_post_id'] . "\">" . $t_reply . "</a>");
         $thread_buttons['reply']['image'] = newbb_displayImage($forumImage['p_reply'], _MD_REPLY);
         $thread_buttons['reply']['link'] = "reply.php?forum=" . $forumdata['forum_id'] . "&amp;topic_id=" . $this->getVar('topic_id') . "&amp;viewmode={$viewmode}&amp;order={$order}&amp;start={$start}";
         $thread_buttons['reply']['name'] = _MD_REPLY;
         $thread_buttons['quote']['image'] = newbb_displayImage($forumImage['p_quote'], _MD_QUOTE);
         $thread_buttons['quote']['link'] = "reply.php?forum=" . $forumdata['forum_id'] . "&amp;topic_id=" . $this->getVar('topic_id') . "&amp;viewmode={$viewmode}&amp;order={$order}&amp;start={$start}&amp;quotedac=1";
         $thread_buttons['quote']['name'] = _MD_QUOTE;
     }
     if (!$isadmin && $xoopsModuleConfig['reportmod_enabled']) {
         $thread_buttons['report']['image'] = newbb_displayImage($forumImage['p_report'], _MD_REPORT);
         $thread_buttons['report']['link'] = "report.php?forum=" . $forumdata['forum_id'] . "&amp;topic_id=" . $this->getVar('topic_id') . "&amp;viewmode={$viewmode}&amp;order={$order}";
         $thread_buttons['report']['name'] = _MD_REPORT;
     }
     if ($isadmin) {
         $thread_action['news']['image'] = newbb_displayImage($forumImage['news'], _MD_POSTTONEWS);
         $thread_action['news']['link'] = "posttonews.php?topic_id=" . $this->getVar('topic_id');
         $thread_action['news']['name'] = _MD_POSTTONEWS;
     }
     $thread_action['pdf']['image'] = newbb_displayImage($forumImage['pdf'], _MD_PDF);
     $thread_action['pdf']['link'] = "makepdf.php?type=post&amp;pageid=0&amp;scale=0.66";
     $thread_action['pdf']['name'] = _MD_PDF;
     $thread_action['print']['image'] = newbb_displayImage($forumImage['printer'], _MD_PRINT);
     $thread_action['print']['link'] = "print.php?form=2&amp;forum=" . $forumdata['forum_id'] . "&amp;topic_id=" . $this->getVar('topic_id');
     $thread_action['print']['name'] = _MD_PRINT;
     if (is_object($xoopsUser) && $this->getVar('uid') > 0 && isset($viewtopic_users[$this->getVar('uid')])) {
         $thread_action['pm']['image'] = $image_url = "<img src=\"" . $forumImage['pm'] . "\" alt=\"" . _MD_PM . "\" align=\"middle\" />";
         $thread_action['pm']['link'] = "posttopm.php?";
         $thread_action['pm']['name'] = _MD_PM;
     }
     $xoopsTpl->append('topic_posts', array('post_id' => $this->getVar('post_id'), 'post_parent_id' => $this->getVar('pid'), 'post_date' => newbb_formatTimestamp($this->getVar('post_time')), 'post_image' => $post_image, 'post_title' => $post_title, 'post_text' => $post_text, 'post_attachment' => $post_attachment, 'post_edit' => $this->displayPostEdit(), 'post_no' => $post_no, 'post_signature' => $this->getVar('attachsig') ? @$poster["signature"] : "", 'poster_ip' => $isadmin && $xoopsModuleConfig['show_ip'] ? long2ip($this->getVar('poster_ip')) : "", 'thread_action' => $thread_action, 'thread_buttons' => $thread_buttons, 'poster' => $poster));
     unset($thread_buttons);
     unset($eachposter);
 }
コード例 #7
0
ファイル: forum.php プロジェクト: BackupTheBerlios/soopa
 function getAllTopics($forum, $startdate, $start, $sortname, $sortorder, $type = '', $excerpt = 0)
 {
     global $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $forumImage, $forumUrl, $myts, $xoopsUser, $viewall_forums;
     $UserUid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : null;
     $topic_lastread = newbb_getcookie('LT', true);
     if (is_object($forum)) {
         $forum_criteria = ' AND t.forum_id = ' . $forum->getVar('forum_id');
         $hot_threshold = $forum->getVar('hot_threshold');
         $allow_subject_prefix = $forum->getVar('allow_subject_prefix');
     } else {
         $hot_threshold = 10;
         $allow_subject_prefix = 0;
         if (is_array($viewall_forums) && count($viewall_forums) > 0) {
             $forum_criteria = ' AND t.forum_id IN (' . implode(',', array_keys($viewall_forums)) . ')';
         } else {
             $forum_criteria = '';
         }
     }
     $sort_sticky = '';
     switch ($type) {
         case 'digest':
             $post_time = ' p.post_time > ' . $startdate;
             $extra_criteria = ' AND topic_digest = 1';
             break;
         case 'unreplied':
             $post_time = ' p.post_time > ' . $startdate;
             $extra_criteria = ' AND topic_replies < 1';
             break;
         case 'unread':
             $post_time = ' p.post_time > ' . max($GLOBALS['last_visit'], $startdate);
             $extra_criteria = '';
             break;
         case 'all':
             // For viewall.php; do not display sticky topics at first
             $post_time = ' p.post_time > ' . $startdate;
             $extra_criteria = '';
             break;
         default:
             $post_time = ' (p.post_time > ' . $startdate . ' OR t.topic_sticky=1)';
             $sort_sticky = ' t.topic_sticky DESC';
             $extra_criteria = '';
             break;
     }
     $sort = $sort_sticky;
     $sort_in = trim($sortname . ' ' . $sortorder);
     if ($sort) {
         if ($sort_in) {
             $sort .= ', ' . $sort_in;
         }
     } elseif ($sort_in) {
         $sort = $sort_in;
     }
     if (!empty($sort)) {
         $sort = ' ORDER BY ' . $sort;
     }
     $approve_criteria = ' AND t.approved = 1 AND p.approved = 1';
     if ($excerpt == 0) {
         $sql = 'SELECT t.*, u.name, u.uname, u2.uid, u2.name as last_post_name, u2.uname as last_poster, p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id FROM ' . $this->db->prefix("bb_topics") . ' t LEFT JOIN ' . $this->db->prefix("users") . ' u ON u.uid = t.topic_poster LEFT JOIN ' . $this->db->prefix('bb_posts') . ' p ON p.post_id = t.topic_last_post_id LEFT JOIN ' . $this->db->prefix("users") . ' u2 ON  u2.uid = p.uid WHERE ';
     } else {
         $sql = 'SELECT t.*, u.name, u.uname, u2.uid, u2.name as last_post_name, u2.uname as last_poster, p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.post_karma, p.require_reply, pt.post_text FROM ' . $this->db->prefix("bb_topics") . ' t LEFT JOIN ' . $this->db->prefix("users") . ' u ON u.uid = t.topic_poster LEFT JOIN ' . $this->db->prefix('bb_posts') . ' p ON p.post_id = t.topic_last_post_id LEFT JOIN ' . $this->db->prefix('bb_posts_text') . ' pt ON pt.post_id = t.topic_last_post_id LEFT JOIN ' . $this->db->prefix("users") . ' u2 ON  u2.uid = p.uid WHERE ';
     }
     $sql .= $post_time . $forum_criteria . $extra_criteria . $approve_criteria . $sort;
     if (!($result = $this->db->query($sql, $xoopsModuleConfig['topics_per_page'], $start))) {
         redirect_header('index.php', 2, _MD_ERROROCCURED . '<br />' . $sql);
         exit;
     }
     $sticky = 0;
     $topics = array();
     while ($myrow = $this->db->fetchArray($result)) {
         // ------------------------------------------------------
         /* Necessary and sufficient conditions for an unread topic:
            	1. the last_post_time must be later than the last_vist;
            	2. the last_post_time must be later than the topic_lastread;
            */
         $is_unread = false;
         $lastread = empty($topic_lastread[$myrow['topic_id']]) ? 0 : $topic_lastread[$myrow['topic_id']];
         if (max($GLOBALS['last_visit'], $lastread) < $myrow['last_post_time']) {
             $is_unread = true;
         }
         // ------------------------------------------------------
         // ------------------------------------------------------
         // topic_icon: priority: sticky -> digest -> regular
         // ------------------------------------------------------
         // type: if 'unread' topics
         if ('unread' == $type) {
             if (!$is_unread) {
                 continue;
             }
         }
         // ------------------------------------------------------
         // topic_icon: priority: sticky -> digest -> regular
         if ($myrow['icon'] && is_file(XOOPS_ROOT_PATH . '/images/subject/' . $myrow['icon'])) {
             $topic_icon = '<img src="' . XOOPS_URL . '/images/subject/' . $myrow['icon'] . '" alt="" />';
             $stick = 1;
         } else {
             $topic_icon = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />';
             $stick = 1;
         }
         if ($myrow['topic_sticky']) {
             $topic_icon = newbb_displayImage($forumImage['folder_sticky'], _MD_TOPICSTICKY);
             $stick = 0;
             $sticky++;
         }
         if ($myrow['topic_haspoll']) {
             $topic_icon = newbb_displayImage($forumImage['poll'], _MD_TOPICHASPOLL);
         }
         if ($myrow['topic_haspoll'] && $myrow['topic_sticky']) {
             $topic_icon = newbb_displayImage($forumImage['folder_sticky'], _MD_TOPICSTICKY) . '<br />' . newbb_displayImage($forumImage['poll'], _MD_TOPICHASPOLL);
             $stick = 0;
             //$sticky++;
         }
         // ------------------------------------------------------
         // topic_folder: priority: newhot -> hot/new -> regular
         if ($myrow['topic_status'] == 1) {
             $topic_folder = $forumImage['locked_topic'];
         } else {
             if ($myrow['topic_digest']) {
                 $topic_folder = $forumImage['folder_digest'];
             } elseif ($myrow['topic_replies'] >= $hot_threshold) {
                 if ($is_unread) {
                     $topic_folder = $forumImage['hot_newposts_topic'];
                 } else {
                     $topic_folder = $forumImage['hot_folder_topic'];
                 }
             } else {
                 if ($is_unread) {
                     $topic_folder = $forumImage['newposts_topic'];
                 } else {
                     $topic_folder = $forumImage['folder_topic'];
                 }
             }
         }
         // ------------------------------------------------------
         // rating_img
         $rating = number_format($myrow['rating'] / 2, 0);
         if ($rating < 1) {
             $rating_img = newbb_displayImage($forumImage['blank']);
         } else {
             $rating_img = newbb_displayImage($forumImage['rate' . $rating]);
         }
         // ------------------------------------------------------
         // topic_page_jump
         if ($myrow['icon']) {
             $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/' . $myrow['icon'] . '" alt="" />';
         } else {
             $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/icon1.gif" alt="" />';
         }
         $topic_page_jump = '';
         $topic_page_jump_icon = '';
         $totalpages = ceil(($myrow['topic_replies'] + 1) / $xoopsModuleConfig['posts_per_page']);
         if ($totalpages > 1) {
             $topic_page_jump .= '&nbsp;&nbsp;&nbsp;<img src="' . XOOPS_URL . '/images/icons/posticon.gif" alt="" /> ';
             $append = false;
             for ($i = 1; $i <= $totalpages; $i++) {
                 if ($i > 3 && $i < $totalpages) {
                     if (!$append) {
                         $topic_page_jump .= "...";
                         $append = true;
                     }
                 } else {
                     $topic_page_jump .= '[<a href="viewtopic.php?topic_id=' . $myrow['topic_id'] . '&amp;start=' . ($i - 1) * $xoopsModuleConfig['posts_per_page'] . '">' . $i . '</a>]';
                     $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=" . $myrow['topic_id'] . "&amp;start=" . ($i - 1) * $xoopsModuleConfig['posts_per_page'] . "#forumpost" . $myrow['post_id'] . "'>" . newbb_displayImage($forumImage['docicon']) . "</a>";
                 }
             }
         } else {
             $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=" . $myrow['topic_id'] . "#forumpost" . $myrow['post_id'] . "'>" . newbb_displayImage($forumImage['docicon']) . "</a>";
         }
         // ------------------------------------------------------
         // topic_poster
         if ($myrow['topic_poster'] != 0 && $myrow['uname']) {
             if ($xoopsModuleConfig['show_realname'] && $myrow['name']) {
                 $topic_poster = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $myrow['topic_poster'] . '">' . $myts->htmlSpecialChars($myrow['name']) . '</a>';
             } else {
                 $topic_poster = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $myrow['topic_poster'] . '">' . $myts->htmlSpecialChars($myrow['uname']) . '</a>';
             }
         } else {
             $topic_poster = $myrow['poster_name'] ? $myts->htmlSpecialChars($myrow['poster_name']) : $xoopsConfig['anonymous'];
         }
         // ------------------------------------------------------
         // topic_last_poster
         if ($xoopsModuleConfig['show_realname'] && $myrow['last_post_name']) {
             $topic_last_poster = $myts->htmlSpecialChars($myrow['last_post_name']);
         } elseif ($myrow['last_poster']) {
             $topic_last_poster = $myts->htmlSpecialChars($myrow['last_poster']);
         } elseif ($myrow['last_poster_name']) {
             $topic_last_poster = $myts->htmlSpecialChars($myrow['last_poster_name']);
         } else {
             $topic_last_poster = $xoopsConfig['anonymous'];
         }
         if ($myrow['uid'] > 0) {
             $topic_last_poster = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $myrow['uid'] . '">' . $topic_last_poster . '</a>';
         }
         // ------------------------------------------------------
         // => topic array
         if (is_object($viewall_forums[$myrow['forum_id']])) {
             $forum_link = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $myrow['forum_id'] . '">' . $myts->htmlSpecialChars($viewall_forums[$myrow['forum_id']]->getVar('forum_name')) . '</a>';
         } else {
             $forum_link = '';
         }
         $topic_title = $myts->htmlSpecialChars($myrow['topic_title']);
         if ($myrow['topic_digest']) {
             $topic_title = "<span class='digest'>" . $topic_title . "</span>";
         }
         $subjectpres = explode(',', $xoopsModuleConfig['subject_prefix']);
         if (count($subjectpres) > 1) {
             foreach ($subjectpres as $subjectpre) {
                 $subject_array[] = $subjectpre;
             }
         }
         $subject_array[0] = null;
         if ($excerpt == 0) {
             $topic_excerpt = "";
         } elseif (($myrow['post_karma'] > 0 || $myrow['require_reply'] > 0) && !newbb_isAdmin($forum)) {
             $topic_excerpt = "";
         } else {
             $topic_excerpt = xoops_substr(newbb_html2text($myrow['post_text']), 0, $excerpt);
             $topic_excerpt = $myts->htmlSpecialChars($topic_excerpt);
         }
         $topic_subject = $allow_subject_prefix ? $subject_array[$myrow['topic_subject']] : "";
         $topics[$myrow['topic_id']] = array('topic_icon' => $topic_icon, 'topic_folder' => newbb_displayImage($topic_folder), 'topic_title' => $topic_subject . $topic_title, 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'] . '&amp;forum=' . $myrow['forum_id'], 'rating_img' => $rating_img, 'topic_page_jump' => $topic_page_jump, 'topic_page_jump_icon' => $topic_page_jump_icon, 'topic_replies' => $myrow['topic_replies'], 'topic_poster' => $topic_poster, 'topic_views' => $myrow['topic_views'], 'topic_time' => newbb_formatTimestamp($myrow['topic_time']), 'topic_last_posttime' => newbb_formatTimestamp($myrow['last_post_time']), 'topic_last_poster' => $topic_last_poster, 'topic_forum_link' => $forum_link, 'topic_excerpt' => $topic_excerpt, 'stick' => $stick);
     }
     if (is_array($topics) && count($topics) > 0) {
         $result2 = $this->db->query("SELECT attachment,topic_id FROM " . $this->db->prefix("bb_posts") . " WHERE topic_id IN (" . implode(',', array_keys($topics)) . ")");
         if ($result2) {
             while ($arr2 = $this->db->fetchArray($result2)) {
                 if ($arr2['attachment']) {
                     $topics[$arr2['topic_id']]['attachment'] = '&nbsp;' . newbb_displayImage($forumImage['clip'], _MD_TOPICSHASATT);
                 }
                 unset($arr2);
             }
         }
     }
     return array($topics, $sticky);
 }
コード例 #8
0
ファイル: viewpost.php プロジェクト: BackupTheBerlios/soopa
        }
        if ($isadmin) {
            $thread_action['news']['image'] = newbb_displayImage($forumImage['news'], _MD_POSTTONEWS);
            $thread_action['news']['link'] = "posttonews.php?topic_id=" . $post->getVar('topic_id');
            $thread_action['news']['name'] = _MD_POSTTONEWS;
        }
        $thread_action['pdf']['image'] = newbb_displayImage($forumImage['pdf'], _MD_PDF);
        $thread_action['pdf']['link'] = "makepdf.php?type=post&amp;pageid=0&amp;scale=0.66";
        $thread_action['pdf']['name'] = _MD_PDF;
        $thread_action['print']['image'] = newbb_displayImage($forumImage['printer'], _MD_PRINT);
        $thread_action['print']['link'] = "print.php?form=2&amp;forum=" . $post->getVar('forum_id') . "&amp;topic_id=" . $post->getVar('topic_id');
        $thread_action['print']['name'] = _MD_PRINT;
        $xoopsTpl->append('posts', array('post_id' => $post->getVar('post_id'), 'topic_id' => $post->getVar('topic_id'), 'forum_id' => $post->getVar('forum_id'), 'post_date' => newbb_formatTimestamp($post->getVar('post_time')), 'post_image' => $post_image, 'post_title' => $post_title, 'post_text' => $post_text, 'post_attachment' => $post_attachment, 'post_edit' => $post->displayPostEdit(), 'post_no' => $start + $pn, 'post_signature' => $post->getVar('attachsig') ? @$poster["signature"] : "", 'poster_ip' => $isadmin && $xoopsModuleConfig['show_ip'] ? long2ip($post->getVar('poster_ip')) : "", 'thread_action' => $thread_action, 'thread_buttons' => $thread_buttons, 'poster' => $poster));
        unset($thread_buttons);
    } else {
        $xoopsTpl->append('posts', array('title' => "<a href=viewtopic.php?post_id=" . $post->getVar('post_id') . "&amp;topic_id=" . $post->getVar('topic_id') . ">" . $post_title . "</a>", 'forum' => "<a href=viewforum.php?forum=" . $post->getVar('forum_id') . ">" . $forums[$post->getVar('forum_id')]->getVar("forum_name") . "</a>", 'time' => newbb_formatTimestamp($post->getVar('post_time')), 'image' => $post_image, 'poster' => $poster['link']));
    }
    unset($poster);
}
unset($viewtopic_users);
unset($forums);
if (!empty($xoopsModuleConfig['show_jump'])) {
    $xoopsTpl->assign('forum_jumpbox', newbb_make_jumpbox($forum_id));
}
if ($postCount > $post_perpage) {
    include XOOPS_ROOT_PATH . '/class/pagenav.php';
    $nav = new XoopsPageNav($postCount, $post_perpage, $start, "start", 'forum=' . $forum_id . '&amp;viewmode=' . $viewmode . '&amp;new=' . $isnew . '&amp;order=' . $order);
    $xoopsTpl->assign('pagenav', $nav->renderNav(4));
} else {
    $xoopsTpl->assign('pagenav', '');
}
コード例 #9
0
ファイル: topic.php プロジェクト: BackupTheBerlios/soopa
 function showTreeItem(&$topic, &$postArray)
 {
     global $xoopsConfig, $xoopsModuleConfig, $viewtopic_users, $myts;
     $postArray['post_time'] = newbb_formatTimestamp($postArray['post_time']);
     if (is_file(XOOPS_ROOT_PATH . "/images/subject/" . $postArray['icon'])) {
         $postArray['icon'] = "<img src='" . XOOPS_URL . "/images/subject/" . $postArray['icon'] . "' alt='' />";
     } else {
         $postArray['icon'] = '<a name="' . $postArray['post_id'] . '"><img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" /></a>';
     }
     if (isset($viewtopic_users[$postArray['uid']]['is_forumadmin'])) {
         $postArray['subject'] = $myts->undoHtmlSpecialChars($postArray['subject']);
     }
     $postArray['subject'] = '<a href="viewtopic.php?viewmode=thread&amp;topic_id=' . $topic->getVar('topic_id') . '&amp;forum=' . $postArray['forum_id'] . '&amp;post_id=' . $postArray['post_id'] . '">' . $postArray['subject'] . '</a>';
     $isActiveUser = false;
     if (isset($viewtopic_users[$postArray['uid']])) {
         $postArray['poster'] = $viewtopic_users[$postArray['uid']]['name'];
         if ($postArray['uid'] > 0) {
             $postArray['poster'] = "<a href=\"" . XOOPS_URL . "/userinfo.php?uid=" . $postArray['uid'] . "\">" . $viewtopic_users[$postArray['uid']]['name'] . "</a>";
         }
     } else {
         $postArray['poster'] = empty($postArray['poster_name']) ? $myts->HtmlSpecialChars($xoopsConfig['anonymous']) : $postArray['poster_name'];
     }
     return $postArray;
 }
コード例 #10
0
 function renderTopics($xoopsTpl = null)
 {
     global $myts;
     $ret = array();
     //$this->parseVars();
     if ($this->noperm) {
         if (is_object($xoopsTpl)) {
             $xoopsTpl->assign_by_ref("topics", $ret);
             return;
         }
         return $ret;
     }
     $selects = array();
     $froms = array();
     $joins = array();
     $wheres = array();
     // topic fields
     $selects[] = 't.*';
     // post fields
     $selects[] = 'p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.uid';
     $froms[] = $this->handler->db->prefix("bb_topics") . ' AS t ';
     $joins[] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_posts') . ' AS p ON p.post_id = t.topic_last_post_id';
     $wheres[] = "1 = 1";
     if (!empty($this->config['post_excerpt'])) {
         $selects[] = 'p.post_karma, p.require_reply, pt.post_text';
         $this->query["join"][] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_posts_text') . ' AS pt ON pt.post_id = t.topic_last_post_id';
     }
     if (empty($this->query["sort"])) {
         $this->query["sort"][] = 't.topic_last_post_id DESC';
     }
     $GLOBALS['xoopsLogger']->startTime('XOOPS output module - render - topics - query');
     $sql = '    SELECT ' . implode(", ", $selects) . '     FROM ' . implode(", ", $froms) . '        ' . implode(" ", $joins) . '        ' . implode(" ", $this->query["join"]) . '     WHERE ' . implode(" AND ", $wheres) . '        AND ' . @implode(" AND ", @$this->query["where"]) . '     ORDER BY ' . implode(", ", $this->query["sort"]);
     if (!($result = $this->handler->db->query($sql, $this->config['topics_per_page'], @$this->vars["start"]))) {
         if (is_object($xoopsTpl)) {
             $xoopsTpl->assign_by_ref("topics", $ret);
             return;
         }
         return $ret;
     }
     $GLOBALS['xoopsLogger']->stopTime('XOOPS output module - render - topics - query');
     require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.render.php";
     require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.session.php";
     require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.time.php";
     require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.read.php";
     require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.topic.php";
     $sticky = 0;
     $topics = array();
     $posters = array();
     $reads = array();
     $types = array();
     $forums = array();
     $anonymous = $myts->htmlSpecialChars($GLOBALS["xoopsConfig"]['anonymous']);
     $GLOBALS['xoopsLogger']->startTime('XOOPS output module - render - topics - fetch');
     while ($myrow = $this->handler->db->fetchArray($result)) {
         if ($myrow['topic_sticky']) {
             $sticky++;
         }
         // ------------------------------------------------------
         // topic_icon: priority: sticky -> digest -> regular
         if ($myrow['topic_haspoll']) {
             if ($myrow['topic_sticky']) {
                 $topic_icon = newbb_displayImage("topic_sticky", _MD_TOPICSTICKY) . '<br />' . newbb_displayImage("poll", _MD_TOPICHASPOLL);
             } else {
                 $topic_icon = newbb_displayImage('poll', _MD_TOPICHASPOLL);
             }
         } elseif ($myrow['topic_sticky']) {
             $topic_icon = newbb_displayImage('topic_sticky', _MD_TOPICSTICKY);
         } elseif (!empty($myrow['icon'])) {
             $topic_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($myrow['icon']) . '" alt="" />';
         } else {
             $topic_icon = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />';
         }
         // ------------------------------------------------------
         // rating_img
         $rating = number_format($myrow['rating'] / 2, 0);
         $rating_img = newbb_displayImage($rating < 1 ? 'blank' : 'rate' . $rating);
         // ------------------------------------------------------
         // topic_page_jump
         $topic_page_jump = '';
         $topic_page_jump_icon = '';
         $totalpages = ceil(($myrow['topic_replies'] + 1) / $this->config['posts_per_page']);
         if ($totalpages > 1) {
             $topic_page_jump .= '&nbsp;&nbsp;';
             $append = false;
             for ($i = 1; $i <= $totalpages; $i++) {
                 if ($i > 3 && $i < $totalpages) {
                     if (!$append) {
                         $topic_page_jump .= "...";
                         $append = true;
                     }
                 } else {
                     $topic_page_jump .= '[<a href="viewtopic.php?topic_id=' . $myrow['topic_id'] . '&amp;start=' . ($i - 1) * $this->config['posts_per_page'] . '">' . $i . '</a>]';
                     $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=" . $myrow['topic_id'] . "&amp;start=" . ($i - 1) * $this->config['posts_per_page'] . "#forumpost" . $myrow['post_id'] . "'>" . newbb_displayImage('document') . "</a>";
                 }
             }
         } else {
             $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=" . $myrow['topic_id'] . "#forumpost" . $myrow['post_id'] . "'>" . newbb_displayImage('document') . "</a>";
         }
         // ------------------------------------------------------
         // => topic array
         $topic_title = $myts->htmlSpecialChars($myrow['topic_title']);
         if ($myrow['topic_digest']) {
             $topic_title = "<span class='digest'>" . $topic_title . "</span>";
         }
         if (empty($this->config["post_excerpt"])) {
             $topic_excerpt = "";
         } elseif (($myrow['post_karma'] > 0 || $myrow['require_reply'] > 0) && !newbb_isAdmin($myrow['forum_id'])) {
             $topic_excerpt = "";
         } else {
             $GLOBALS['xoopsLogger']->startTime('XOOPS output module - render - topics - fetch - substr ' . $myrow['topic_id']);
             $topic_excerpt = xoops_substr(newbb_html2text($myts->displayTarea($myrow['post_text'])), 0, $this->config["post_excerpt"]);
             $GLOBALS['xoopsLogger']->stopTime('XOOPS output module - render - topics - fetch - substr ' . $myrow['topic_id']);
             $topic_excerpt = str_replace("[", "&#91;", $myts->htmlSpecialChars($topic_excerpt));
         }
         $topics[$myrow['topic_id']] = array('topic_id' => $myrow['topic_id'], 'topic_icon' => $topic_icon, 'type_id' => $myrow['type_id'], 'topic_title' => $topic_title, 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'] . '&amp;forum=' . $myrow['forum_id'], 'rating_img' => $rating_img, 'topic_page_jump' => $topic_page_jump, 'topic_page_jump_icon' => $topic_page_jump_icon, 'topic_replies' => $myrow['topic_replies'], 'topic_poster_uid' => $myrow['topic_poster'], 'topic_poster_name' => !empty($myrow['poster_name']) ? $myts->htmlSpecialChars($myrow['poster_name']) : $anonymous, 'topic_views' => $myrow['topic_views'], 'topic_time' => newbb_formatTimestamp($myrow['topic_time']), 'topic_last_posttime' => newbb_formatTimestamp($myrow['last_post_time']), 'topic_last_poster_uid' => $myrow['uid'], 'topic_last_poster_name' => !empty($myrow['last_poster_name']) ? $myts->htmlSpecialChars($myrow['last_poster_name']) : $anonymous, 'topic_forum' => $myrow['forum_id'], 'topic_excerpt' => $topic_excerpt, 'stick' => empty($myrow['topic_sticky']), "stats" => array($myrow['topic_status'], $myrow['topic_digest'], $myrow['topic_replies']));
         /* users */
         $posters[$myrow['topic_poster']] = 1;
         $posters[$myrow['uid']] = 1;
         // reads
         if (!empty($this->config["read_mode"])) {
             $reads[$myrow['topic_id']] = $this->config["read_mode"] == 1 ? $myrow['last_post_time'] : $myrow["topic_last_post_id"];
         }
         // types
         if (!empty($myrow['type_id'])) {
             //$types[$myrow['type_id']] = 1;
         }
         // forums
         $forums[$myrow['forum_id']] = 1;
     }
     $GLOBALS['xoopsLogger']->stopTime('XOOPS output module - render - topics - fetch');
     $posters_name = newbb_getUnameFromIds(array_keys($posters), $this->config['show_realname'], true);
     $topic_isRead = newbb_isRead("topic", $reads);
     /*
     $type_list = array();
     if (count($types) > 0) {
     $type_handler =& xoops_getmodulehandler('type', 'newbb');
     $type_list = $type_handler->getAll(new Criteria("type_id", "(".implode(", ", array_keys($types)).")", "IN"), null, false);
     }
     */
     $type_list = $this->getTypes();
     $forum_handler =& xoops_getmodulehandler('forum', 'newbb');
     $forum_list = $forum_handler->getAll(new Criteria("forum_id", "(" . implode(", ", array_keys($forums)) . ")", "IN"), array("forum_name", "hot_threshold"), false);
     foreach (array_keys($topics) as $id) {
         $topics[$id]["topic_forum_link"] = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $topics[$id]["topic_forum"] . '">' . $forum_list[$topics[$id]["topic_forum"]]["forum_name"] . '</a>';
         if (!empty($topics[$id]["type_id"]) && isset($type_list[$topics[$id]["type_id"]])) {
             $topics[$id]["topic_title"] = newbb_getTopicTitle($topics[$id]["topic_title"], $type_list[$topics[$id]["type_id"]]["type_name"], $type_list[$topics[$id]["type_id"]]["type_color"]);
         }
         $topics[$id]["topic_poster"] = !empty($posters_name[$topics[$id]["topic_poster_uid"]]) ? $posters_name[$topics[$id]["topic_poster_uid"]] : $topics[$id]["topic_poster_name"];
         $topics[$id]["topic_last_poster"] = !empty($posters_name[$topics[$id]["topic_last_poster_uid"]]) ? $posters_name[$topics[$id]["topic_last_poster_uid"]] : $topics[$id]["topic_last_poster_name"];
         // ------------------------------------------------------
         // topic_folder: priority: newhot -> hot/new -> regular
         list($topic_status, $topic_digest, $topic_replies) = $topics[$id]["stats"];
         if ($topic_status == 1) {
             $topic_folder = 'topic_locked';
         } else {
             if ($topic_digest) {
                 $topic_folder = 'topic_digest';
             } elseif ($topic_replies >= $forum_list[$topics[$id]["topic_forum"]]["hot_threshold"]) {
                 $topic_folder = empty($topic_isRead[$id]) ? 'topic_hot_new' : 'topic_hot';
             } else {
                 $topic_folder = empty($topic_isRead[$id]) ? 'topic_new' : 'topic';
             }
         }
         $topics[$id]['topic_folder'] = newbb_displayImage($topic_folder);
         unset($topics[$id]["topic_poster_name"], $topics[$id]["topic_last_poster_name"], $topics[$id]["stats"]);
     }
     if (count($topics) > 0) {
         $sql = " SELECT DISTINCT topic_id FROM " . $this->handler->db->prefix("bb_posts") . " WHERE attachment != ''" . " AND topic_id IN (" . implode(',', array_keys($topics)) . ")";
         if ($result = $this->handler->db->query($sql)) {
             while (list($topic_id) = $this->handler->db->fetchRow($result)) {
                 $topics[$topic_id]['attachment'] = '&nbsp;' . newbb_displayImage('attachment', _MD_TOPICSHASATT);
             }
         }
     }
     if (is_object($xoopsTpl)) {
         $xoopsTpl->assign_by_ref("sticky", $sticky);
         $xoopsTpl->assign_by_ref("topics", $topics);
         return;
     }
     return array($topics, $sticky);
 }
コード例 #11
0
ファイル: forum.php プロジェクト: BackupTheBerlios/haxoo-svn
 function &display($forums, $length_title_index = 30, $count_subforum = 1)
 {
     global $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts;
     $posts = array();
     $posts_obj = array();
     foreach (array_keys($forums) as $id) {
         $posts[] = $forums[$id]["forum_last_post_id"];
     }
     if (!empty($posts)) {
         $post_handler =& xoops_getmodulehandler('post', 'newbb');
         $tags_post = array("uid", "topic_id", "post_time", "poster_name", "icon");
         if (!empty($length_title_index)) {
             $tags_post[] = "subject";
         }
         $posts = $post_handler->getAll(new Criteria("post_id", "(" . implode(", ", $posts) . ")", "IN"), $tags_post, false);
     }
     // Get topic/post stats per forum
     $stats_forum = array();
     if (!empty($count_subforum)) {
         $stats_forum = $this->getSubforumStats(array_keys($forums));
     }
     $users = array();
     $reads = array();
     $topics = array();
     foreach (array_keys($forums) as $id) {
         $forum =& $forums[$id];
         if (!$forum["forum_last_post_id"]) {
             continue;
         }
         if (!($post = @$posts[$forum["forum_last_post_id"]])) {
             $forum["forum_last_post_id"] = 0;
             continue;
         }
         $users[] = $post["uid"];
         if ($moderators[$id] = $forum["forum_moderator"]) {
             $users = array_merge($users, $moderators[$id]);
         }
         // reads
         if (!empty($xoopsModuleConfig["read_mode"])) {
             $reads[$id] = $xoopsModuleConfig["read_mode"] == 1 ? $post['post_time'] : $post['post_id'];
         }
     }
     require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.user.php";
     require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.time.php";
     require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.render.php";
     require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.read.php";
     $forum_isread = newbb_isRead("forum", $reads);
     $users_linked = newbb_getUnameFromIds(array_unique($users), !empty($xoopsModuleConfig['show_realname']), true);
     $forums_array = array();
     $name_anonymous = $myts->htmlSpecialChars($GLOBALS["xoopsConfig"]["anonymous"]);
     foreach (array_keys($forums) as $id) {
         $forum =& $forums[$id];
         $_forum_data = array();
         $_forum_data["forum_order"] = $forum['forum_order'];
         $_forum_data["forum_id"] = $id;
         $_forum_data["forum_cid"] = $forum['cat_id'];
         $_forum_data["forum_name"] = $forum['forum_name'];
         $_forum_data["forum_desc"] = $myts->displayTarea($forum['forum_desc']);
         $_forum_data["forum_topics"] = $forum["forum_topics"] + @$stats_forum[$id]["topics"];
         $_forum_data["forum_posts"] = $forum["forum_posts"] + @$stats_forum[$id]["posts"];
         //$_forum_data["forum_type"]         = $forum['forum_type'];
         $forum_moderators = array();
         if (!empty($moderators[$id])) {
             foreach (@$moderators[$id] as $moderator) {
                 $forum_moderators[] = @$users_linked[$moderator];
             }
         }
         $_forum_data["forum_moderators"] = implode(", ", $forum_moderators);
         if ($post_id = $forum["forum_last_post_id"]) {
             $post =& $posts[$post_id];
             $_forum_data['forum_lastpost_id'] = $post_id;
             $_forum_data['forum_lastpost_time'] = newbb_formatTimestamp($post['post_time']);
             if (!empty($users_linked[$post["uid"]])) {
                 $_forum_data["forum_lastpost_user"] = $users_linked[$post["uid"]];
             } elseif ($poster_name = $post["poster_name"]) {
                 $_forum_data["forum_lastpost_user"] = $poster_name;
             } else {
                 $_forum_data["forum_lastpost_user"] = $name_anonymous;
             }
             if (!empty($length_title_index)) {
                 $subject = $post["subject"];
                 if ($length_title_index < 255) {
                     $subject = xoops_substr($subject, 0, $length_title_index);
                 }
                 $_forum_data['forum_lastpost_subject'] = $subject;
             }
             if ($icon = $post['icon']) {
                 $_forum_data['forum_lastpost_icon'] = $icon;
             } else {
                 $_forum_data['forum_lastpost_icon'] = 'icon1.gif';
             }
         }
         $forum_folder = empty($forum_isread[$id]) ? 'forum_new' : 'forum';
         $_forum_data['forum_folder'] = newbb_displayImage($forum_folder);
         $forums_array[$forum['parent_forum']][] = $_forum_data;
     }
     return $forums_array;
 }
コード例 #12
0
function b_newbb_post_show($options)
{
    global $xoopsConfig;
    global $access_forums;
    mod_loadFunctions("time", "newbb");
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $i = 0;
    $order = "";
    $extra_criteria = "";
    $time_criteria = null;
    if (!empty($options[2])) {
        $time_criteria = time() - newbb_getSinceTime($options[2]);
        $extra_criteria = " AND p.post_time>" . $time_criteria;
    }
    switch ($options[0]) {
        case "text":
            if (!empty($newbbConfig['enable_karma'])) {
                $extra_criteria .= " AND p.post_karma = 0";
            }
            if (!empty($newbbConfig['allow_require_reply'])) {
                $extra_criteria .= " AND p.require_reply = 0";
            }
        default:
            $order = 'p.post_id';
            break;
    }
    $newbbConfig = newbb_load_config();
    if (!isset($access_forums)) {
        $perm_handler =& xoops_getmodulehandler('permission', 'newbb');
        if (!($access_forums = $perm_handler->getForums())) {
            return $block;
        }
    }
    if (!empty($options[6])) {
        $allowedforums = array_filter(array_slice($options, 6), "b_newbb_array_filter");
        // get allowed forums
        $allowed_forums = array_intersect($allowedforums, $access_forums);
    } else {
        $allowed_forums = $access_forums;
    }
    if (empty($allowed_forums)) {
        return $block;
    }
    $forum_criteria = ' AND p.forum_id IN (' . implode(',', $allowed_forums) . ')';
    $approve_criteria = ' AND p.approved = 1';
    $query = 'SELECT';
    $query .= '	p.post_id, p.subject, p.post_time, p.icon, p.uid, p.poster_name,';
    if ($options[0] == "text") {
        $query .= '	pt.dohtml, pt.dosmiley, pt.doxcode, pt.dobr, pt.post_text,';
    }
    $query .= '	f.forum_id, f.forum_name' . '	FROM ' . $GLOBALS["xoopsDB"]->prefix('bb_posts') . ' AS p ' . '	LEFT JOIN ' . $GLOBALS["xoopsDB"]->prefix('bb_forums') . ' AS f ON f.forum_id=p.forum_id';
    if ($options[0] == "text") {
        $query .= '	LEFT JOIN ' . $GLOBALS["xoopsDB"]->prefix('bb_posts_text') . ' AS pt ON pt.post_id=p.post_id';
    }
    $query .= '	WHERE 1=1 ' . $forum_criteria . $approve_criteria . $extra_criteria . ' ORDER BY ' . $order . ' DESC';
    $result = $GLOBALS["xoopsDB"]->query($query, $options[1], 0);
    if (!$result) {
        //xoops_error($GLOBALS["xoopsDB"]->error());
        return $block;
    }
    $block['disp_mode'] = $options[0] == "text" ? 3 : $options[3];
    // 0 - full view; 1 - compact view; 2 - lite view;
    $rows = array();
    $author = array();
    while ($row = $GLOBALS["xoopsDB"]->fetchArray($result)) {
        $rows[] = $row;
        $author[$row["uid"]] = 1;
    }
    if (count($rows) < 1) {
        return $block;
    }
    mod_loadFunctions("user", "newbb");
    $author_name = newbb_getUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true);
    foreach ($rows as $arr) {
        //if ($arr['icon'] && is_file(XOOPS_ROOT_PATH . "/images/subject/" . $arr['icon'])) {
        if (!empty($arr['icon'])) {
            $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($arr['icon']) . '" alt="" />';
        } else {
            $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/icon1.gif" alt="" />';
        }
        //$topic['jump_post'] = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=" . $arr['post_id'] ."#forumpost" . $arr['post_id'] . "'>" . $last_post_icon . "</a>";
        $topic['forum_id'] = $arr['forum_id'];
        $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']);
        //$topic['id'] = $arr['topic_id'];
        $title = $myts->htmlSpecialChars($arr['subject']);
        if ($options[0] != "text" && !empty($options[5])) {
            $title = xoops_substr($title, 0, $options[5]);
        }
        $topic['title'] = $title;
        $topic['post_id'] = $arr['post_id'];
        $topic['time'] = newbb_formatTimestamp($arr['post_time']);
        if (!empty($author_name[$arr['uid']])) {
            $topic_poster = $author_name[$arr['uid']];
        } else {
            $topic_poster = $myts->htmlSpecialChars($arr['poster_name'] ? $arr['poster_name'] : $GLOBALS["xoopsConfig"]["anonymous"]);
        }
        $topic['topic_poster'] = $topic_poster;
        if ($options[0] == "text") {
            $post_text = $myts->displayTarea($arr['post_text'], $arr['dohtml'], $arr['dosmiley'], $arr['doxcode'], 1, $arr['dobr']);
            if (!empty($options[5])) {
                $post_text = xoops_substr(strip_tags($post_text), 0, $options[5]);
            }
            $topic['post_text'] = $post_text;
        }
        $block['topics'][] = $topic;
        unset($topic);
    }
    $block['indexNav'] = intval($options[4]);
    return $block;
}
コード例 #13
0
function b_newbb_post_show($options)
{
    global $xoopsConfig;
    global $newbbConfig, $access_forums;
    $db =& Database::getInstance();
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $i = 0;
    $order = "";
    $extra_criteria = "";
    $time_criteria = null;
    if (!empty($options[2])) {
        $time_criteria = time() - newbb_getSinceTime($options[2]);
        $extra_criteria = " AND p.post_time>" . $time_criteria;
    }
    switch ($options[0]) {
        case "text":
            if (!empty($newbbConfig['enable_karma'])) {
                $extra_criteria .= " AND p.post_karma = 0";
            }
            if (!empty($newbbConfig['allow_require_reply'])) {
                $extra_criteria .= " AND p.require_reply = 0";
            }
        default:
            $order = 'p.post_time';
            break;
    }
    $forum_handler =& xoops_getmodulehandler('forum', 'newbb');
    $module_handler =& xoops_gethandler('module');
    $newbb = $module_handler->getByDirname('newbb');
    if (!isset($newbbConfig)) {
        $config_handler =& xoops_gethandler('config');
        $newbbConfig =& $config_handler->getConfigsByCat(0, $newbb->getVar('mid'));
    }
    if (!isset($access_forums)) {
        $access_forums = $forum_handler->getForums(0, 'access');
        // get all accessible forums
    }
    if (!empty($options[6])) {
        $allowedforums = array_slice($options, 6);
        // get allowed forums
        $allowed_forums = array_intersect($allowedforums, array_keys($access_forums));
    } else {
        $allowed_forums = array_keys($access_forums);
    }
    $forum_criteria = ' AND p.forum_id IN (' . implode(',', $allowed_forums) . ')';
    $approve_criteria = ' AND p.approved = 1';
    $query = 'SELECT';
    $query .= '	p.post_id, p.subject, p.post_time, p.icon, p.uid, p.poster_name,';
    if ($options[0] == "text") {
        $query .= '	p.dohtml, p.dosmiley, p.doxcode, p.dobr, pt.post_text,';
    }
    $query .= '	f.forum_id, f.forum_name, f.allow_subject_prefix' . '	FROM ' . $db->prefix('bb_posts') . ' AS p ' . '	LEFT JOIN ' . $db->prefix('bb_forums') . ' AS f ON f.forum_id=p.forum_id';
    if ($options[0] == "text") {
        $query .= '	LEFT JOIN ' . $db->prefix('bb_posts_text') . ' AS pt ON pt.post_id=p.post_id';
    }
    $query .= '	WHERE 1=1 ' . $forum_criteria . $approve_criteria . $extra_criteria . ' ORDER BY ' . $order . ' DESC';
    $result = $db->query($query, $options[1], 0);
    if (!$result) {
        newbb_message("newbb block query error: " . $query);
        return false;
    }
    $block['disp_mode'] = $options[0] == "text" ? 3 : $options[3];
    // 0 - full view; 1 - compact view; 2 - lite view;
    $rows = array();
    $author = array();
    while ($row = $db->fetchArray($result)) {
        $rows[] = $row;
        $author[$row["uid"]] = 1;
    }
    if (count($rows) < 1) {
        return false;
    }
    $author_name =& newbb_getUnameFromIds(array_keys($author), $newbbConfig['show_realname']);
    foreach ($rows as $arr) {
        if ($arr['icon']) {
            $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/' . $arr['icon'] . '" alt="" />';
        } else {
            $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/icon1.gif" alt="" />';
        }
        $topic['jump_post'] = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=" . $arr['post_id'] . "#forumpost" . $arr['post_id'] . "'>" . $last_post_icon . "</a>";
        $topic['forum_id'] = $arr['forum_id'];
        $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']);
        //$topic['id'] = $arr['topic_id'];
        $title = $myts->htmlSpecialChars($arr['subject']);
        if ($options[0] != "text" && !empty($options[5])) {
            $title = xoops_substr($title, 0, $options[5]);
        }
        $topic['title'] = $title;
        $topic['post_id'] = $arr['post_id'];
        $topic['time'] = newbb_formatTimestamp($arr['post_time']);
        if ($arr['uid'] > 0) {
            $topic_poster = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $arr['uid'] . "'>" . $myts->htmlSpecialChars($author_name[$arr['uid']]) . "</a>";
        } else {
            $topic_poster = $arr['poster_name'] ? $myts->htmlSpecialChars($arr['poster_name']) : $myts->htmlSpecialChars($author_name[$arr['uid']]);
        }
        $topic['topic_poster'] = $topic_poster;
        if ($options[0] == "text") {
            $post_text = $myts->displayTarea($arr['post_text'], $arr['dohtml'], $arr['dosmiley'], $arr['doxcode'], 1, $arr['dobr']);
            if (!empty($options[5])) {
                $post_text = xoops_substr(newbb_html2text($post_text), 0, $options[5]);
            }
            $topic['post_text'] = $post_text;
            newbb_message($post_text);
        }
        $block['topics'][] =& $topic;
        unset($topic);
    }
    $block['indexNav'] = intval($options[4]);
    return $block;
}