📄 post.php
字号:
}else $user_groups = ''; if ($xoopsModuleConfig['show_realname'] && $eachposter->getVar('name')) { $name = $eachposter->getVar('name'); } else { $name = $eachposter->getVar('uname'); } if ($forumdata['allow_sig'] && ($this->getVar('attachsig') || $eachposter->attachsig())) { $poster_sig = $myts->displayTarea($eachposter->getVar("user_sig", "N"), 0, 1, 1); }else $poster_sig = ''; $posterarr = array('poster_uid' => $eachposter->getVar('uid'), 'poster_name' => $name, 'poster_uname' => '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $eachposter->getVar('uid') . '">' . $name . '</a>', 'poster_avatar' => $eachposter->getVar('user_avatar'), 'poster_from' => $eachposter->getVar('user_from'), 'poster_regdate' => formatTimestamp($eachposter->getVar('user_regdate'), 's'), 'poster_postnum' => $RPG . $RPG_HP . $RPG_MP . $RPG_EXP, 'poster_sendpmtext' => sprintf(_SENDPMTO, $eachposter->getVar('uname')), 'poster_rank_title' => $poster_rank['title'], 'poster_rank_image' => $poster_rank['image'], 'poster_status' => $poster_status, 'poster_groups' => $user_groups, // To avoid extra queries 'poster_userbar' => $userbar, 'poster_sig' => $poster_sig ); } else { $posterarr = array('poster_uid' => 0, 'poster_name' => $this->getVar('poster_name')?$this->getVar('poster_name'):$xoopsConfig['anonymous'], 'poster_uname' => $this->getVar('poster_name')?$this->getVar('poster_name'):$xoopsConfig['anonymous'], 'poster_avatar' => '', 'poster_from' => '', 'poster_regdate' => '', 'poster_postnum' => '', 'poster_sendpmtext' => '', 'poster_rank_title' => '', 'poster_rank_image' => '', 'poster_status' => '', 'poster_groups' => '', 'poster_userbar' => '', 'poster_sig' => '' ); } $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>'; if ($isadmin && $xoopsModuleConfig['show_ip']) $poster_ip = long2ip($this->getVar('poster_ip')); else $poster_ip = ''; if (isset($viewtopic_users[$this->getVar('uid')]['is_forumadmin']) && $xoopsModuleConfig['allow_moderator_html']) $post_title = $myts->undoHtmlSpecialChars($this->getVar('subject')); else $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'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode=$viewmode&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'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode=$viewmode&order=$order&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'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode=$viewmode&order=$order&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'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode=" . $viewmode . "&start=$start&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'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode=$viewmode&order=$order&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'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode=$viewmode&order=$order&start=$start&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'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode=$viewmode&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&pageid=0&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&forum=". $forumdata['forum_id']."&topic_id=" . $this->getVar('topic_id'); $thread_action['print']['name'] = _MD_PRINT; $xoopsTpl->append('topic_posts', array_merge($posterarr, array('post_id' => $this->getVar('post_id'), 'post_parent_id' => $this->getVar('pid'), 'post_date' => formatTimestamp($this->getVar('post_time'), 'm'), 'post_image' => $post_image, 'post_title' => $post_title, 'post_text' => $post_text, 'post_attachment' => $post_attachment, 'post_edit' => $this->displayPostEdit(), 'post_no' => $post_no, 'poster_ip' => $poster_ip, 'thread_action' => $thread_action, 'thread_buttons' => $thread_buttons ))); unset($thread_buttons); unset($eachposter); $xoopsTpl->assign('poster_ip', $poster_ip); }}class NewbbPostHandler extends XoopsObjectHandler { function &get($id) { $sql = 'SELECT p.*, t.*, tp.topic_status FROM ' . $this->db->prefix('bb_posts') . ' p LEFT JOIN ' . $this->db->prefix('bb_posts_text') . ' t ON p.post_id=t.post_id LEFT JOIN ' . $this->db->prefix('bb_topics') . ' tp ON tp.topic_id=p.topic_id WHERE p.post_id=' . $id; $array = $this->db->fetchArray($this->db->query($sql)); $post = &$this->create(false); $post->assignVars($array); return $post; } function &getByLimit($topic_id, $limit, $approved = 1) { $sql = 'SELECT p.*, t.*, tp.topic_status FROM ' . $this->db->prefix('bb_posts') . ' p LEFT JOIN ' . $this->db->prefix('bb_posts_text') . ' t ON p.post_id=t.post_id LEFT JOIN ' . $this->db->prefix('bb_topics') . ' tp ON tp.topic_id=p.topic_id WHERE p.topic_id=' . $topic_id . ' AND p.approved ='. $approved .' ORDER BY p.post_time DESC'; $result = $this->db->query($sql, $limit, 0); $ret = array(); while ($myrow = $this->db->fetchArray($result)) { $post = &$this->create(false); $post->assignVars($myrow); $ret[$myrow['post_id']] = $post; unset($post); } return $ret; } function &create($isNew = true) { $post = new Post(); if ($isNew) { $post->setNew(); } return $post; } function getPostForPDF(&$post) { return $post->getPostBody(true); } function getPostForPrint(&$post) { return $post->getPostBody(); } function approve($post_id) { $post = &$this->get($post_id); if (!is_object($post)) { echo "<br />post not exist:" . $post_id; return false; } $sql = "UPDATE " . $this->db->prefix("bb_posts") . " SET approved = 1 WHERE post_id = $post_id"; if (!$result = $this->db->queryF($sql)) { echo "<br />approve post error:" . $sql;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -