⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 post.php

📁 在综合英文版XOOPS 2.09, 2.091, 2.092 的基础上正式发布XOOPS 2.09中文版 XOOPS 2.09x 版主要是PHP5升级、bug修正和安全补正: 1 全面兼容PHP 5.
💻 PHP
📖 第 1 页 / 共 4 页
字号:
    }    // attachment functions    // ////////////////////////////////////////////////////////////////////////////////////    function setPostEdit($poster_name = '')    {        global $xoopsConfig, $xoopsModuleConfig, $xoopsUser;        if( (time()-$this->getVar('post_time'))<$xoopsModuleConfig['recordedit_timelimit'] || $this->getVar('approved')==0 ) return true;        if (is_object($xoopsUser) && $xoopsUser->isActive()) {            if ($xoopsModuleConfig['show_realname'] && $xoopsUser->getVar('name')) {                $edit_user = $xoopsUser->getVar('name');            } else {                $edit_user = $xoopsUser->getVar('uname');            }        }        $post_edit = array();        $post_edit['edit_user'] = $edit_user; // The proper way is to store uid instead of name. However, to save queries when displaying, the current way is ok.        $post_edit['edit_time'] = time();        $post_edits = $this->getVar('post_edit');        if (!empty($post_edits)) $post_edits = unserialize(base64_decode($post_edits));        if (!is_array($post_edits)) $post_edits = array();        $post_edits[] = $post_edit;        $post_edit = base64_encode(serialize($post_edits));        unset($post_edits);        $this->setVar('post_edit', $post_edit);        return true;    }    function displayPostEdit()    {        global $myts;        $post_edit = '';        $post_edits = $this->getVar('post_edit');        if (!empty($post_edits)) $post_edits = unserialize(base64_decode($post_edits));        if (!isset($post_edits) || !is_array($post_edits)) $post_edits = array();        if (is_array($post_edits) && count($post_edits) > 0) {            foreach($post_edits as $postedit) {                $edit_time = intval($postedit['edit_time']);                $edit_user = $myts->stripSlashesGPC($postedit['edit_user']);                $post_edit .= _MD_EDITEDBY . " " . $edit_user . " " . _MD_ON . " " . formatTimestamp(intval($edit_time)) . "<br/>";            }        }        return $post_edit;    }    function &getPostBody($imageAsSource = false)    {        global $xoopsConfig, $xoopsModuleConfig, $xoopsUser, $myts;        $uid = is_object($xoopsUser)? $xoopsUser->getVar('uid'):0;		$karma_handler =& xoops_getmodulehandler('karma', 'newbb');		$user_karma = $karma_handler->getUserKarma();		$post=array();		$post['attachment'] = false;		$post_text = newbb_displayTarea($this->vars['post_text']['value'], $this->getVar('dohtml'), $this->getVar('dosmiley'), $this->getVar('doxcode'), $this->getVar('doimage'), $this->getVar('dobr'));        if (newbb_isAdmin($this->getVar('forum_id')) or $this->checkIdentity()) {            $post['text'] = $post_text. '<br />' .$this->displayAttachment($imageAsSource);        } elseif ($xoopsModuleConfig['enable_karma'] && $this->getVar('post_karma') > $user_karma) {            $post['text'] = sprintf(_MD_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma'));        } elseif ($xoopsModuleConfig['allow_require_reply'] && $this->getVar('require_reply') && (!$uid || !isset($viewtopic_users[$uid]))) {            $post['text'] = _MD_REPLY_REQUIREMENT;        } else {            $post['text'] = $post_text. '<br />' .$this->displayAttachment($imageAsSource);        }		$member_handler =& xoops_gethandler('member');        $eachposter = &$member_handler->getUser($this->getVar('uid'));        if (is_object($eachposter) && $eachposter->isActive()) {            if ($xoopsModuleConfig['show_realname'] && $eachposter->getVar('name')) {                $post['author'] = $eachposter->getVar('name');            } else {                $post['author'] = $eachposter->getVar('uname');            }        	unset($eachposter);        } else {           	$post['author'] = $this->getVar('poster_name')?$this->getVar('poster_name'):$xoopsConfig['anonymous'];        }        if (newbb_isAdmin($this->getVar('forum_id')) && $xoopsModuleConfig['allow_moderator_html']) $post['subject'] = $myts->undoHtmlSpecialChars($this->getVar('subject'));        else $post['subject'] = newbb_htmlSpecialChars($this->vars['subject']['value']);        $post['date'] = $this->getVar('post_time');        return $post;    }    function isTopic()    {        if ($this->getVar('pid') == 0) {            return true;        }        return false;    }    function checkTimelimit($action_tag = 'edit_timelimit')    {        return newbb_checkTimelimit($this->getVar('post_time'), $action_tag);    }    function checkIdentity($uid = -1)    {        global $xoopsUser;        $uid = ($uid > -1)?$uid:(is_object($xoopsUser)? $xoopsUser->getVar('uid'):0);        if ($this->getVar('uid') > 0) {            $user_ok = ($uid == $this->getVar('uid'))?true:false;        } else {            static $user_ip;            if (!isset($user_ip)) {                $user_ip = (isset($_SERVER['HTTP_X_FORWARDED_FOR']))?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR'];                $user_ip = ip2long($user_ip);            }            $user_ok = ($user_ip == $this->getVar('poster_ip'))?true:false;        }        return $user_ok;    }    function showPost($isadmin, $forumdata)    {        global $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $myts, $xoopsTpl, $forumUrl, $forumImage, $viewtopic_users, $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;        $online_png = newbb_displayImage($forumImage['online'], _MD_ONLINE);        $offline_png = newbb_displayImage($forumImage['offline'],_MD_OFFLINE);        $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 || !isset($viewtopic_users[$uid]))) {            $post_text = "<div class='karma'>" . _MD_REPLY_REQUIREMENT . "</div>";            $post_attachment = '';        } else {            $post_text = $this->getVar('post_text');            $post_attachment = $this->displayAttachment();        }        $eachposter = (($this->getVar('uid') > 0) && isset($viewtopic_users[$this->getVar('uid')]))? $viewtopic_users[$this->getVar('uid')]['user']:false;        if (is_object($eachposter) && $eachposter->isActive()) {            if ($viewtopic_users[$this->getVar('uid')]['rank']['image'] != "") {                $poster_rank['image'] = "<img src='" . XOOPS_UPLOAD_URL . "/" . $viewtopic_users[$this->getVar('uid')]['rank']['image'] . "' alt='' />";            }          	$poster_rank['title'] = $viewtopic_users[$this->getVar('uid')]['rank']['title'];            if ($xoopsModuleConfig['wol_enabled']) {                $poster_status = isset($online[$this->getVar('uid')]) ? $online_png : $offline_png;            } else {                $poster_status = '';            }            $profile_image = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $eachposter->getVar('uid') . "'><img src=\"" . XOOPS_URL . "/images/icons/profile.gif\" alt='" . _PROFILE . "' /></a>";            $RPG = $eachposter->getVar('posts');            if ($xoopsModuleConfig['levels_enabled']) {                $level = $viewtopic_users[$this->getVar('uid')]['level'];                $RPG_HP = "<br />" . _MD_LEVEL . " " . $level['LEVEL'] . "<br />" . _MD_HP . " " . $level['HP'] . " / " . $level['HP_MAX'] . "<br /><table width='99px' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'><tr><td width='3' height='13'><img height='13' src='" . $forumUrl['images_set'] . "/rpg/img_left.gif' width='3' alt='' /></td><td width='100%' background='" . $forumUrl['images_set'] . "/rpg/img_backing.gif' height='13'><img src='" . $forumUrl['images_set'] . "/rpg/orange.gif' width='" . $level['HP_WIDTH'] . "%' height='12' alt='' /></td><td width='3' height='13'><img height='13' src='" . $forumUrl['images_set'] . "/rpg/img_right.gif' width='3' alt='' /></td></tr></table>";                $RPG_MP = _MD_MP . " " . $level['MP'] . " / " . $level['MP_MAX'] . "<br /><table width='99px' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'><tr><td width='3' height='13'><img height='13' src='" . $forumUrl['images_set'] . "/rpg/img_left.gif' width='3' alt='' /></td><td width='100%' background='" . $forumUrl['images_set'] . "/rpg/img_backing.gif' height='13'><img src='" . $forumUrl['images_set'] . "/rpg/green.gif' width='" . $level['MP_WIDTH'] . "%' height='12'></td><td width='3' height='13'><img height='13' src='" . $forumUrl['images_set'] . "/rpg/img_right.gif' width='3' alt='' /></td></tr></table>";                $RPG_EXP = _MD_EXP . " " . $level['EXP'] . "<br /><table width='99px' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'><tr><td width='3' height='13'><img height='13' src='" . $forumUrl['images_set'] . "/rpg/img_left.gif' width='3' alt='' /></td><td width='100%' background='" . $forumUrl['images_set'] . "/rpg/img_backing.gif' height='13'><img src='" . $forumUrl['images_set'] . "/rpg/blue.gif' width='" . $level['EXP'] . "%' height='12' alt='' /></td><td width='3' height='13'><img height='13' src='" . $forumUrl['images_set'] . "/rpg/img_right.gif' width='3' alt='' /></td></tr></table>";            } else {                $RPG_HP = "";                $RPG_MP = "";                $RPG_EXP = "";            }            if ($xoopsModuleConfig['userbar_enabled']) {                /*                $profile_png = newbb_displayImage($forumImage['personal'], _PROFILE);                $pm_png = newbb_displayImage($forumImage['pm'], sprintf(_SENDPMTO, $eachposter->uname()));                $icq_png = newbb_displayImage($forumImage['icq'], _MD_ICQ);                $email_png = newbb_displayImage($forumImage['email'], sprintf(_SENDEMAILTO, $eachposter->uname('E')));                $aim_png = newbb_displayImage($forumImage['aim'], _MD_AIM);                $home_png = newbb_displayImage($forumImage['home'], _VISITWEBSITE);                $yim_png = newbb_displayImage($forumImage['yahoo'], _MD_YIM);                $msnm_png = newbb_displayImage($forumImage['msnm'], _MD_MSNM);                $userbar = (is_object($xoopsUser))? "<tr><td class='head'><small><a class='newbb_link' href='" . XOOPS_URL . "/userinfo.php?uid=" . $eachposter->getVar('uid') . "' />" . $profile_png . "&nbsp;" . _PROFILE . "</a></small></td></tr> ":" ";                $userbar .= (is_object($xoopsUser))? "<tr><td class='head'><small><a class='newbb_link' href=\"javascript:openWithSelfMain('" . XOOPS_URL . "/pmlite.php?send2=1&amp;to_userid=" . $eachposter->getVar('uid') . "', 'pmlite', 450, 380);\">" . $pm_png . "&nbsp;" . sprintf(_SENDPMTO, $eachposter->uname()) . "</a></small></td></tr> ":" ";                $userbar .= ($isadmin || (is_object($xoopsUser) && $eachposter->getVar('user_viewemail')))? "<tr><td class='head' ><small><a class='newbb_link' href='mailto:" . $eachposter->getVar('email') . "'>" . $email_png . "&nbsp;" . sprintf(_SENDEMAILTO, $eachposter->uname('E')) . "</a></small></td></tr> ":" ";                $userbar .= ($eachposter->getVar('url'))? "<tr><td class='head' ><small><a class='newbb_link' href='" . $eachposter->getVar('url') . "' target='_blank'>" . $home_png . "&nbsp;" . _VISITWEBSITE . "</a></small></td></tr> ":" ";                $userbar .= (is_object($xoopsUser) && $eachposter->getVar('user_icq'))? "<tr><td class='head' ><small><a class='newbb_link' href='http://wwp.icq.com/scripts/search.dll?to=" . $eachposter->getVar('user_icq') . "' target='_blank'/>" . $icq_png . "&nbsp;" . _MD_ICQ . "</a></small></td></tr> ":" ";                $userbar .= (is_object($xoopsUser) && $eachposter->getVar('user_aim'))? "<tr><td class='head' ><small><a class='newbb_link' href='aim:goim?screenname=" . $eachposter->getVar('user_aim') . "&message=Hi+" . $eachposter->getVar('user_aim') . "+Are+you+there?' target='_blank'>" . $aim_png . "&nbsp;" . _MD_AIM . "</a></small></td></tr> ":" ";                $userbar .= (is_object($xoopsUser) && $eachposter->getVar('user_yim'))? "<tr><td class='head' ><small><a class='newbb_link' href='http://edit.yahoo.com/config/send_webmesg?.target=" . $eachposter->getVar('user_yim') . "&.src=pg' target='_blank'>" . $yim_png . "&nbsp;" . _MD_YIM . "</a></small></td></tr> ":" ";                $userbar .= (is_object($xoopsUser) && $eachposter->getVar('user_msnm'))? "<tr><td class='head' ><small><a class='newbb_link' href='http://members.msn.com?mem=" . $eachposter->getVar('user_msnm') . "' target='_blank'>" . $msnm_png . "&nbsp;" . _MD_MSNM . "</a></small></td></tr> ":" ";                */                // For Chinese Version                $userbar = (is_object($xoopsUser))? "<tr><td class='head'><small><a class='newbb_link' href='" . XOOPS_URL . "/userinfo.php?uid=" . $eachposter->getVar('uid') . "' />" . "&nbsp;" . _PROFILE . "</a></small></td></tr> ":" ";                $userbar .= (is_object($xoopsUser))? "<tr><td class='head'><small><a class='newbb_link' href=\"javascript:openWithSelfMain('" . XOOPS_URL . "/pmlite.php?send2=1&amp;to_userid=" . $eachposter->getVar('uid') . "', 'pmlite', 450, 380);\">" . "&nbsp;" . sprintf(_SENDPMTO, $eachposter->uname()) . "</a></small></td></tr> ":" ";                $userbar .= ($isadmin || (is_object($xoopsUser) && $eachposter->getVar('user_viewemail')))? "<tr><td class='head' ><small><a class='newbb_link' href='mailto:" . $eachposter->getVar('email') . "'>" . "&nbsp;" . sprintf(_SENDEMAILTO, $eachposter->uname('E')) . "</a></small></td></tr> ":" ";                $userbar .= ($eachposter->getVar('url'))? "<tr><td class='head' ><small><a class='newbb_link' href='" . $eachposter->getVar('url') . "' target='_blank'>" . "&nbsp;" . _VISITWEBSITE . "</a></small></td></tr> ":" ";                $userbar .= (is_object($xoopsUser) && $eachposter->getVar('user_icq'))? "<tr><td class='head' ><small><a class='newbb_link' href='http://friend.qq.com/cgi-bin/friend/user_show_info?ln=" . $eachposter->getVar('user_icq') . "' target='_blank'/>" . "&nbsp;" . _MD_ICQ . "</a></small></td></tr> ":" ";                $userbar .= (is_object($xoopsUser) && $eachposter->getVar('user_aim'))? "<tr><td class='head' ><small><a class='newbb_link' href='aim:goim?screenname=" . $eachposter->getVar('user_aim') . "&message=Hi+" . $eachposter->getVar('user_aim') . "+Are+you+there?' target='_blank'>" . "&nbsp;" . _MD_AIM . "</a></small></td></tr> ":" ";                $userbar .= (is_object($xoopsUser) && $eachposter->getVar('user_yim'))? "<tr><td class='head' ><small><a class='newbb_link' href='http://edit.yahoo.com/config/send_webmesg?.target=" . $eachposter->getVar('user_yim') . "&.src=pg' target='_blank'>" . "&nbsp;" . _MD_YIM . "</a></small></td></tr> ":" ";                $userbar .= (is_object($xoopsUser) && $eachposter->getVar('user_msnm'))? "<tr><td class='head' ><small><a class='newbb_link' href='http://members.msn.com?mem=" . $eachposter->getVar('user_msnm') . "' target='_blank'>" . "&nbsp;" . _MD_MSNM . "</a></small></td></tr> ":" ";            }else{	            $userbar = '';            }			if($xoopsModuleConfig['groupbar_enabled'] && isset($viewtopic_users[$this->getVar('uid')]['groups'])){                $user_groups = implode("<br />", $viewtopic_users[$this->getVar('uid')]['groups']);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -