Esempio n. 1
0
function viewread($read)
{
    global $winduid, $isGM, $pwSystem, $_G, $db_windpost, $tpc_buy, $tpc_pid, $tpc_tag, $tpc_author, $tid;
    $tpc_buy = $read['buy'];
    $tpc_pid = $read['pid'];
    $tpc_tag = NULL;
    $tpc_author = '';
    if ($read['anonymous']) {
        $anonymous = !$isGM && $winduid != $read['authorid'] && !$pwSystem['anonyhide'];
    } else {
        $anonymous = false;
    }
    if (!$anonymous) {
        $tpc_author = $read['author'];
    }
    $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br />", $read['content']));
    $read['leaveword'] && ($read['content'] .= leaveword($read['leaveword'], $read['pid']));
    if ($read['ifwordsfb'] != $GLOBALS['db_wordsfb']) {
        $read['content'] = wordsConvert($read['content'], array('id' => $tpc_pid == 'tpc' ? $tid : $tpc_pid, 'type' => $tpc_pid == 'tpc' ? 'topic' : 'posts', 'code' => $read['ifwordsfb']));
    }
    $read['content'] = convert($read['content'], $db_windpost);
    if ($read['aid'] && $GLOBALS['attachShow']->isShow($read['ifhide'], $tid)) {
        $read += $GLOBALS['attachShow']->parseAttachs($read['pid'], $read['content'], $winduid == $read['authorid']);
    }
    return $read;
}
Esempio n. 2
0
function viewread($read, $start_limit)
{
    global $db, $_G, $isGM, $pwSystem, $groupid, $attach_url, $winduid, $tablecolor, $tpc_author, $tpc_buy, $tpc_pid, $tpc_tag, $count, $orderby, $pageinverse, $timestamp, $db_onlinetime, $attachdir, $attachpath, $readcolorone, $readcolortwo, $lpic, $ltitle, $imgpath, $db_ipfrom, $db_showonline, $stylepath, $db_windpost, $db_windpic, $db_signwindcode, $fid, $tid, $pid, $db_md_ifopen, $_MEDALDB, $rewardtype, $db_shield, $db_iftag, $db_readtag, $viewpic;
    global $ping_logs;
    if ($read['istop'] == 'topped') {
        $read['lou'] = $read['floor'];
    } else {
        $read['lou'] = $count - $start_limit;
    }
    $read['jupend'] = $start_limit == $count - 1 ? "<a name=a></a><a name={$read['pid']}></a>" : "<a name={$read['pid']}></a>";
    $tpc_buy = $read['buy'];
    $tpc_pid = $read['pid'];
    $tpc_tag = NULL;
    $tpc_shield = 0;
    $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br />", $read['content']));
    if ($read['anonymous']) {
        $anonymous = !$isGM && $winduid != $read['authorid'] && !$pwSystem['anonyhide'];
        $read['anonymousname'] = $GLOBALS['db_anonymousname'];
    } else {
        $anonymous = false;
        $read['anonymousname'] = $read['username'];
    }
    $read['ipfrom'] = $db_ipfrom == 1 && $_G['viewipfrom'] ? $read['ipfrom'] : '';
    $read['ip'] = $isGM || $pwSystem['viewip'] ? 'IP:' . $read['userip'] : '';
    if ($read['groupid'] && !$anonymous) {
        $read['groupid'] == '-1' && ($read['groupid'] = $read['memberid']);
        !array_key_exists($read['groupid'], (array) $lpic) && ($read['groupid'] = 8);
        $read['lpic'] = $lpic[$read['groupid']];
        $read['level'] = $ltitle[$read['groupid']];
        $read['regdate'] = get_date($read['regdate'], "Y-m-d");
        $read['lastlogin'] = get_date($read['lastvisit'], "Y-m-d");
        $read['rvrc'] = floor($read['rvrc'] / 10);
        $read['author'] = $read['username'];
        $tpc_author = $read['author'];
        if (!empty($GLOBALS['showfield'])) {
            $customdata = $read['customdata'] ? (array) unserialize($read['customdata']) : array();
            $read['customdata'] = array();
            foreach ($customdata as $key => $val) {
                if ($val && in_array($key, $GLOBALS['showfield'])) {
                    $read['customdata'][$key] = $val;
                }
            }
        }
        $read['ontime'] = (int) ($read['onlinetime'] / 3600);
        $read['groupid'] == 6 && ($read['honor'] = '');
        if ($read['groupid'] != 6 && ($read['ifsign'] == 1 || $read['ifsign'] == 3)) {
            global $sign;
            if (!$sign[$read['author']]) {
                global $db_signmoney, $db_signgroup, $tdtime, $db_signcurtype;
                if ($db_signmoney && strpos($db_signgroup, ",{$read['groupid']},") !== false && (!getstatus($read['userstatus'], PW_USERSTATUS_SHOWSIGN) || !$read['starttime'] || $read[$db_signcurtype] < ($tdtime - $read['starttime']) / 86400 * $db_signmoney)) {
                    $read['signature'] = '';
                } else {
                    if ($db_signwindcode && getstatus($read['userstatus'], PW_USERSTATUS_SIGNCHANGE)) {
                        if ($GLOBALS['gp_right'][$read['groupid']]['imgwidth'] && $GLOBALS['gp_right'][$read['groupid']]['imgheight']) {
                            $db_windpic['picwidth'] = $GLOBALS['gp_right'][$read['groupid']]['imgwidth'];
                            $db_windpic['picheight'] = $GLOBALS['gp_right'][$read['groupid']]['imgheight'];
                        }
                        if ($GLOBALS['gp_right'][$read['groupid']]['fontsize']) {
                            $db_windpic['size'] = $GLOBALS['gp_right'][$read['groupid']]['fontsize'];
                        }
                        $read['signature'] = convert($read['signature'], $db_windpic, 2);
                    }
                    $read['signature'] = str_replace("\n", "<br />", $read['signature']);
                }
                $sign[$read['author']] = $read['signature'];
            } else {
                $read['signature'] = $sign[$read['author']];
            }
        } else {
            $read['signature'] = '';
        }
    } else {
        $read['lpic'] = $lpic['2'];
        $read['level'] = $read['digests'] = $read['postnum'] = $read['money'] = $read['currency'] = '*';
        $read['rvrc'] = $read['lastlogin'] = $read['credit'] = $read['regdate'] = '*';
        $read['honor'] = $read['signature'] = $read['micon'] = $read['aliww'] = '';
        if ($anonymous) {
            $read['oicq'] = $read['ip'] = $read['medals'] = $read['ipfrom'] = '';
            $read['author'] = $GLOBALS['db_anonymousname'];
            $read['authorid'] = 0;
            foreach ($GLOBALS['customfield'] as $key => $val) {
                $field = "field_" . (int) $val['id'];
                $read[$field] = '*';
            }
        }
    }
    list($read['face'], , $httpWidth, $httpHeight, , , , $read['facesize']) = showfacedesign($read['micon'], true, 'm');
    if ($httpWidth > 120 || $httpHeight > 120 || $read['facesize'] == '') {
        $read['facesize'] = ' width="120" height="120"';
    }
    list($read['posttime'], $read['postdate']) = getLastDate($read['postdate']);
    $read['mark'] = $read['reward'] = $read['tag'] = NULL;
    if ($read['ifmark']) {
        $ping_logs[$read['pid']] = $read['ifmark'];
    }
    if ($rewardtype != null) {
        if ($read['lou'] == 0 || $read['ifreward'] > 0 || $rewardtype == '0' && $winduid == $GLOBALS['authorid'] && $winduid != $read['authorid']) {
            $read['reward'] = Getrewhtml($read['lou'], $read['ifreward'], $read['pid']);
        }
    }
    if ($read['icon']) {
        $read['icon'] = "<img src=\"{$imgpath}/post/emotion/{$read['icon']}.gif\" align=\"left\" border=\"0\" />";
    } else {
        $read['icon'] = '';
    }
    if ($db_md_ifopen && $read['medals']) {
        $medals = $ifMedalNotExist = '';
        $md_a = explode(',', $read['medals']);
        foreach ($md_a as $key => $value) {
            if ($value && $_MEDALDB[$value]) {
                $medals .= "<a href=\"apps.php?q=medal\" target=\"_blank\"><img src=\"{$_MEDALDB[$value][smallimage]}\" width=\"30\" height=\"30\"  title=\"{$_MEDALDB[$value][name]}\" /></a>";
            } else {
                unset($md_a[$key]);
                $ifMedalNotExist = 1;
            }
        }
        if ($ifMedalNotExist == 1) {
            $newMedalInfo = implode(',', $md_a);
            $userService = L::loadClass('UserService', 'user');
            /* @var $userService PW_UserService */
            $userService->update($read['authorid'], array('medals' => $newMedalInfo));
        }
        $read['medals'] = $medals . '<br />';
    } else {
        $read['medals'] = '';
    }
    $read['leaveword'] && ($read['content'] .= leaveword($read['leaveword'], $read['pid']));
    if ($read['ifshield'] || $read['groupid'] == 6 && $db_shield) {
        if ($read['ifshield'] == 2) {
            $read['content'] = shield('shield_del_article');
            $read['subject'] = '';
            $tpc_shield = 1;
        } else {
            if ($groupid == '3') {
                $read['subject'] = shield('shield_title');
            } else {
                $read['content'] = shield($read['ifshield'] ? 'shield_article' : 'ban_article');
                $read['subject'] = '';
                $tpc_shield = 1;
            }
        }
        $read['icon'] = '';
    }
    if (!$tpc_shield) {
        if ($read['ifwordsfb'] != $GLOBALS['db_wordsfb']) {
            $read['content'] = wordsConvert($read['content'], array('id' => $tpc_pid == 'tpc' ? $tid : $tpc_pid, 'type' => $tpc_pid == 'tpc' ? 'topic' : 'posts', 'code' => $read['ifwordsfb']));
        }
        if ($read['ifconvert'] == 2) {
            $read['content'] = convert($read['content'], $db_windpost);
        } else {
            $tpc_tag && ($read['content'] = relatetag($read['content'], $tpc_tag));
            strpos($read['content'], '[s:') !== false && ($read['content'] = showface($read['content']));
        }
        if ($read['aid'] && $GLOBALS['attachShow']->isShow($read['ifhide'], $tid)) {
            $read += $GLOBALS['attachShow']->parseAttachs($read['pid'], $read['content'], $winduid == $read['authorid']);
        }
    }
    /**
     * convert the post content
     */
    $read['alterinfo'] && ($read['content'] .= "<div id=\"alert_{$read['pid']}\" style=\"color:gray;margin-top:30px\">[ {$read['alterinfo']} ]</div>");
    if ($read['remindinfo']) {
        $remind = explode("\t", $read['remindinfo']);
        $remind[0] = str_replace("\n", "<br />", $remind[0]);
        $remind[2] && ($remind[2] = get_date($remind[2]));
        $read['remindinfo'] = $remind;
    }
    if ($_GET['keyword']) {
        $keywords = explode("|", $_GET['keyword']);
        foreach ($keywords as $key => $value) {
            if ($value) {
                $read['content'] = preg_replace("/(?<=[\\s\"\\]>()]|[-�]|^)(" . preg_quote($value, '/') . ")([.,:;-?!()\\s\"<\\[]|[-�]|\$)/siU", "<u><font color=\"red\">\\1</font></u>\\2", $read['content']);
            }
        }
    }
    //$GLOBALS['foruminfo']['copyctrl'] && $read['content'] = preg_replace("/<br \/>/eis","copyctrl()",$read['content']);
    return $read;
}
Esempio n. 3
0
require_once R_P . 'require/bbscode.php';
S::gp(array('pcid', 'modelid'), 'P', 2);
$fielddb = array();
$data = array();
$atc_content = S::escapeChar(stripslashes(S::getGP('atc_content', 'P')));
$pcinfo = S::escapeChar(stripslashes(S::getGP('pcinfo', 'P')));
if ($modelid > 0) {
    $query = $db->query("SELECT fieldid,fieldname FROM pw_topicfield WHERE modelid=" . S::sqlEscape($modelid));
    while ($rt = $db->fetch_array($query)) {
        $fielddb[$rt['fieldid']] = $rt['fieldname'];
    }
    $pcdb = getPcviewdata($pcinfo, 'topic');
    L::loadClass('posttopic', 'forum', false);
    $postTopic = new postTopic($data);
    $topicvalue = $postTopic->getTopicvalue($modelid, $pcdb);
} elseif ($pcid > 0) {
    $query = $db->query("SELECT fieldid,fieldname FROM pw_pcfield WHERE pcid=" . S::sqlEscape($pcid));
    while ($rt = $db->fetch_array($query)) {
        $fielddb[$rt['fieldname']] = $rt['fieldid'];
    }
    $pcdb = getPcviewdata($pcinfo, 'postcate');
    L::loadClass('postcate', 'forum', false);
    $postCate = new postCate($data);
    list(, $topicvalue) = $postCate->getCatevalue($pcid, $pcdb);
}
$atc_content = wordsConvert($atc_content);
$atc_content = convert($atc_content, $db_windpost);
$preatc = str_replace("\n", "<br>", $atc_content);
require_once R_P . 'require/header.php';
require_once PrintEot('preview');
footer();
Esempio n. 4
0
 $postmodify->execute($postdata);
 extract(L::style());
 $aids = array();
 if ($atcdb['attachs']) {
     $aids = attachment($atc_content);
 }
 $leaveword = $atcdb['leaveword'] ? leaveword($atcdb['leaveword']) : '';
 $content = convert($postdata->data['content'] . $leaveword, $db_windpost);
 if (strpos($content, '[p:') !== false || strpos($content, '[s:') !== false) {
     $content = showface($content);
 }
 if ($atcdb['ifsign'] < 2) {
     $content = str_replace("\n", '<br />', $content);
 }
 if ($postdata->data['ifwordsfb'] == 0) {
     $content = addslashes(wordsConvert(stripslashes($content)));
 }
 $creditnames = pwCreditNames();
 if ($aids) {
     if ($winduid == $atcdb['authorid'] || $pwpost->isGM || pwRights($pwpost->isBM, 'delattach')) {
         $dfadmin = 1;
     } else {
         $dfadmin = 0;
     }
     foreach ($atcdb['attachs'] as $at) {
         if (!in_array($at['aid'], $aids)) {
             continue;
         }
         $atype = '';
         $rat = array();
         if ($at['type'] == 'img' && $at['needrvrc'] == 0 && (!$downloadimg || !$downloadmoney || $_G['allowdownload'] == 2)) {
Esempio n. 5
0
function viewread($read)
{
    global $winduid, $isGM, $pwSystem, $_G, $db_windpost, $tpc_buy, $tpc_pid, $tpc_tag, $tpc_author, $tid;
    $tpc_buy = $read['buy'];
    $tpc_pid = $read['pid'];
    $tpc_tag = NULL;
    $tpc_author = '';
    if ($read['anonymous']) {
        $anonymous = !$isGM && $winduid != $read['authorid'] && !$pwSystem['anonyhide'];
    } else {
        $anonymous = false;
    }
    if (!$anonymous) {
        $tpc_author = $read['author'];
    }
    list($read['face']) = showfacedesign($read['micon'], true, 'm');
    $read['content'] = preg_replace("/\\[quote\\](.*)\\[\\/quote\\]/is", "", $read['content']);
    $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br />", $read['content']));
    $read['leaveword'] && ($read['content'] .= leaveword($read['leaveword'], $read['pid']));
    $read['content'] = preg_replace('/(\\[s:[^]]+\\])+/', '[表情]', $read['content']);
    //face
    $read['content'] = strip_tags(convert($read['content'], '1'));
    if ($read['ifwordsfb'] != $GLOBALS['db_wordsfb']) {
        $read['content'] = wordsConvert($read['content'], array('id' => $tpc_pid == 'tpc' ? $tid : $tpc_pid, 'type' => $tpc_pid == 'tpc' ? 'topic' : 'posts', 'code' => $read['ifwordsfb']));
    }
    $read['content'] = parseReplyContent($read['content']);
    return $read;
}
Esempio n. 6
0
    }
    echo "success\t{$str}";
    ajax_footer();
} elseif ($action == 'readmessage') {
    require_once R_P . 'require/bbscode.php';
    InitGP(array('mid', 'type'));
    if ($type == 'personal' || $type == 'system') {
        $sqladd = $type == 'personal' ? 'm.fromuid<>0' : 'm.fromuid=0';
        $msginfo = $db->get_one("SELECT m.mid,m.fromuid AS withuid,m.touid,m.username,m.ifnew,m.mdate,mc.title,mc.content FROM pw_msg m LEFT JOIN pw_msgc mc USING(mid) WHERE m.mid=" . pwEscape($mid) . " AND m.type='rebox' AND m.touid=" . pwEscape($winduid) . "AND " . $sqladd);
        if ($msginfo) {
            $msginfo['content'] = str_replace("\n", "<br>", $msginfo['content']);
            $msginfo['content'] = convert($msginfo['content'], $db_windpost);
            if (strpos($msginfo['content'], '[s:') !== false) {
                $msginfo['content'] = showface($msginfo['content']);
            }
            $msginfo['content'] = wordsConvert($msginfo['content']);
            $msginfo['title'] = str_replace('&ensp;$', '$', $msginfo['title']);
            $msginfo['content'] = str_replace('&ensp;$', '$', $msginfo['content']);
            $msginfo['mdate'] = get_date($msginfo['mdate']);
            if ($msginfo['ifnew'] > 0) {
                $db->update("UPDATE pw_msg SET ifnew=0 WHERE mid=" . pwEscape($mid));
                updateNewpm($winduid, 'minus');
            }
            $str = '';
            if ($msginfo) {
                $str = pwJsonEncode($msginfo);
            }
            require_once PrintEot('ajax');
            ajax_footer();
        } else {
            Showmsg('msg_error');
Esempio n. 7
0
function viewread($read, $start_limit)
{
    global $db, $_G, $isGM, $pwSystem, $groupid, $attach_url, $winduid, $tablecolor, $tpc_author, $tpc_buy, $tpc_pid, $tpc_tag, $count, $orderby, $pageinverse, $timestamp, $db_onlinetime, $attachdir, $attachpath, $readcolorone, $readcolortwo, $lpic, $ltitle, $imgpath, $db_ipfrom, $db_showonline, $stylepath, $db_windpost, $db_windpic, $db_signwindcode, $fid, $tid, $pid, $md_ifopen, $_MEDALDB, $rewardtype, $db_shield, $db_iftag, $db_readtag;
    global $ping_logs;
    if ($read['istop'] == 'topped') {
        $read['lou'] = $read['floor'];
    } else {
        $read['lou'] = $orderby != 'desc' || $start_limit == 0 ? $start_limit : $count - $start_limit;
    }
    $read['jupend'] = $start_limit == $count - 1 ? "<a name=a></a><a name={$read['pid']}></a>" : "<a name={$read['pid']}></a>";
    $tpc_buy = $read['buy'];
    $tpc_pid = $read['pid'];
    $tpc_tag = NULL;
    $tpc_shield = 0;
    $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br />", $read['content']));
    if ($read['anonymous']) {
        $anonymous = !$isGM && $winduid != $read['authorid'] && !$pwSystem['anonyhide'];
        $read['anonymousname'] = $GLOBALS['db_anonymousname'];
    } else {
        $anonymous = false;
        $read['anonymousname'] = $read['username'];
    }
    $read['ipfrom'] = $db_ipfrom == 1 && $_G['viewipfrom'] ? $read['ipfrom'] : '';
    $read['ip'] = $isGM || $pwSystem['viewip'] ? 'IP:' . $read['userip'] : '';
    if ($read['groupid'] && !$anonymous) {
        $read['groupid'] == '-1' && ($read['groupid'] = $read['memberid']);
        !array_key_exists($read['groupid'], (array) $lpic) && ($read['groupid'] = 8);
        $read['lpic'] = $lpic[$read['groupid']];
        $read['level'] = $ltitle[$read['groupid']];
        $read['regdate'] = get_date($read['regdate'], "Y-m-d");
        $read['lastlogin'] = get_date($read['lastvisit'], "Y-m-d");
        $read['rvrc'] = floor($read['rvrc'] / 10);
        $read['author'] = $read['username'];
        $tpc_author = $read['author'];
        if (!empty($GLOBALS['showfield'])) {
            $customdata = $read['customdata'] ? (array) unserialize($read['customdata']) : array();
            $read['customdata'] = array();
            foreach ($customdata as $key => $val) {
                if ($val && in_array($key, $GLOBALS['showfield'])) {
                    $read['customdata'][$key] = $val;
                }
            }
        }
        $read['ontime'] = (int) ($read['onlinetime'] / 3600);
        $read['groupid'] == 6 && ($read['honor'] = '');
        if ($read['groupid'] != 6 && ($read['ifsign'] == 1 || $read['ifsign'] == 3)) {
            global $sign;
            if (!$sign[$read['author']]) {
                global $db_signmoney, $db_signgroup, $tdtime, $db_signcurtype;
                if ($db_signmoney && strpos($db_signgroup, ",{$read['groupid']},") !== false && (!getstatus($read['userstatus'], 10) || !$read['starttime'] || $read[$db_signcurtype] < ($tdtime - $read['starttime']) / 86400 * $db_signmoney)) {
                    $read['signature'] = '';
                } else {
                    if ($db_signwindcode && getstatus($read['userstatus'], 9)) {
                        if ($_G['right'][$read['groupid']]['imgwidth'] && $_G['right'][$read['groupid']]['imgheight']) {
                            $db_windpic['picwidth'] = $_G['right'][$read['groupid']]['imgwidth'];
                            $db_windpic['picheight'] = $_G['right'][$read['groupid']]['imgheight'];
                        }
                        if ($_G['right'][$read['groupid']]['fontsize']) {
                            $db_windpic['size'] = $_G['right'][$read['groupid']]['fontsize'];
                        }
                        $read['signature'] = convert($read['signature'], $db_windpic, 2);
                    }
                    $read['signature'] = str_replace("\n", "<br />", $read['signature']);
                }
                $sign[$read['author']] = $read['signature'];
            } else {
                $read['signature'] = $sign[$read['author']];
            }
        } else {
            $read['signature'] = '';
        }
    } else {
        $read['lpic'] = '8';
        $read['level'] = $read['digests'] = $read['postnum'] = $read['money'] = $read['currency'] = '*';
        $read['rvrc'] = $read['lastlogin'] = $read['credit'] = $read['regdate'] = '*';
        $read['honor'] = $read['signature'] = $read['micon'] = $read['aliww'] = '';
        if ($anonymous) {
            $read['oicq'] = $read['ip'] = $read['medals'] = $read['ipfrom'] = '';
            $read['author'] = $GLOBALS['db_anonymousname'];
            $read['authorid'] = 0;
            foreach ($GLOBALS['customfield'] as $key => $val) {
                $field = "field_" . (int) $val['id'];
                $read[$field] = '*';
            }
        }
    }
    $read['face'] = showfacedesign($read['micon']);
    list($read['posttime'], $read['postdate']) = getLastDate($read['postdate']);
    $read['mark'] = $read['reward'] = $read['tag'] = NULL;
    if ($read['ifmark']) {
        $ping_logs[$read['pid']] = $read['ifmark'];
    }
    if ($rewardtype != null) {
        if ($read['lou'] == 0 || $read['ifreward'] > 0 || $rewardtype == '0' && $winduid == $GLOBALS['authorid'] && $winduid != $read['authorid']) {
            $read['reward'] = Getrewhtml($read['lou'], $read['ifreward'], $read['pid']);
        }
    }
    if ($read['icon']) {
        $read['icon'] = "<img src=\"{$imgpath}/post/emotion/{$read['icon']}.gif\" align=\"left\" border=\"0\" />";
    } else {
        $read['icon'] = '';
    }
    if ($md_ifopen && $read['medals']) {
        $medals = $ifMedalNotExist = '';
        $md_a = explode(',', $read['medals']);
        foreach ($md_a as $key => $value) {
            if ($value && $_MEDALDB[$value]) {
                $medals .= "<img src=\"hack/medal/image/{$_MEDALDB[$value][picurl]}\" title=\"{$_MEDALDB[$value][name]}\" /> ";
            } else {
                unset($md_a[$key]);
                $ifMedalNotExist = 1;
            }
        }
        if ($ifMedalNotExist == 1) {
            $newMedalInfo = implode(',', $md_a);
            $db->update("UPDATE pw_members SET medals=" . pwEscape($newMedalInfo) . " WHERE uid=" . pwEscape($read['authorid']));
        }
        $read['medals'] = $medals . '<br />';
    } else {
        $read['medals'] = '';
    }
    $read['leaveword'] && ($read['content'] .= leaveword($read['leaveword'], $read['pid']));
    if ($db_iftag && $read['tags']) {
        list($tagdb, $tpc_tag) = explode("\t", $read['tags']);
        $tagdb = explode(' ', $tagdb);
        foreach ($tagdb as $key => $tag) {
            $tag && ($read['tag'] .= "<a href=\"job.php?action=tag&tagname=" . rawurlencode($tag) . "\"><span class=\"s3\">{$tag}</span></a> ");
        }
    }
    if ($read['ifshield'] || $read['groupid'] == 6 && $db_shield) {
        if ($read['ifshield'] == 2) {
            $read['content'] = shield('shield_del_article');
            $read['subject'] = '';
            $tpc_shield = 1;
        } else {
            if ($groupid == '3') {
                $read['subject'] = shield('shield_title');
            } else {
                $read['content'] = shield($read['ifshield'] ? 'shield_article' : 'ban_article');
                $read['subject'] = '';
                $tpc_shield = 1;
            }
        }
        $read['icon'] = '';
    }
    if (!$tpc_shield) {
        $aids = array();
        if ($read['aid']) {
            $attachs = $GLOBALS['attachdb'][$read['pid']];
            $read['ifhide'] > 0 && ifpost($tid) >= 1 && ($read['ifhide'] = 0);
            if (is_array($attachs) && !$read['ifhide']) {
                $aids = attachment($read['content']);
            }
        }
        if ($read['ifwordsfb'] != $GLOBALS['db_wordsfb']) {
            $read['content'] = wordsConvert($read['content'], array('id' => $tpc_pid == 'tpc' ? $tid : $tpc_pid, 'type' => $tpc_pid == 'tpc' ? 'topic' : 'posts', 'code' => $read['ifwordsfb']));
        }
        if ($read['ifconvert'] == 2) {
            $read['content'] = convert($read['content'], $db_windpost);
        } else {
            $tpc_tag && $db_readtag && ($read['content'] = relatetag($read['content'], $tpc_tag));
            strpos($read['content'], '[s:') !== false && ($read['content'] = showface($read['content']));
        }
        if ($attachs && is_array($attachs) && !$read['ifhide']) {
            if ($winduid == $read['authorid'] || $isGM || $pwSystem['delattach']) {
                $dfadmin = 1;
            } else {
                $dfadmin = 0;
            }
            foreach ($attachs as $at) {
                $atype = '';
                $rat = array();
                if ($at['type'] == 'img' && $at['needrvrc'] == 0 && (!$GLOBALS['downloadimg'] || !$GLOBALS['downloadmoney'] || $_G['allowdownload'] == 2)) {
                    $a_url = geturl($at['attachurl'], 'show');
                    if (is_array($a_url)) {
                        $atype = 'pic';
                        $dfurl = '<br>' . cvpic($a_url[0], 1, $db_windpost['picwidth'], $db_windpost['picheight'], $at['ifthumb']);
                        $rat = array('aid' => $at['aid'], 'name' => $at['name'], 'img' => $dfurl, 'dfadmin' => $dfadmin, 'desc' => $at['descrip']);
                    } elseif ($a_url == 'imgurl') {
                        $atype = 'picurl';
                        $rat = array('aid' => $at['aid'], 'name' => $at['name'], 'dfadmin' => $dfadmin, 'verify' => md5("showimg{$tid}{$read[pid]}{$fid}{$at[aid]}{$GLOBALS[db_hash]}"));
                    }
                } else {
                    $atype = 'downattach';
                    if ($at['needrvrc'] > 0) {
                        !$at['ctype'] && ($at['ctype'] = $at['special'] == 2 ? 'money' : 'rvrc');
                        $at['special'] == 2 && $GLOBALS['db_sellset']['price'] > 0 && ($at['needrvrc'] = min($at['needrvrc'], $GLOBALS['db_sellset']['price']));
                    }
                    $rat = array('aid' => $at['aid'], 'name' => $at['name'], 'size' => $at['size'], 'hits' => $at['hits'], 'needrvrc' => $at['needrvrc'], 'special' => $at['special'], 'cname' => $GLOBALS['creditnames'][$at['ctype']], 'type' => $at['type'], 'dfadmin' => $dfadmin, 'desc' => $at['descrip'], 'ext' => strtolower(substr(strrchr($at['name'], '.'), 1)));
                }
                if (!$atype) {
                    continue;
                }
                if (in_array($at['aid'], $aids)) {
                    $read['content'] = attcontent($read['content'], $atype, $rat);
                } else {
                    $read[$atype][$at['aid']] = $rat;
                }
            }
        }
    }
    /**
     * convert the post content
     */
    $read['alterinfo'] && ($read['content'] .= "<div id=\"alert_{$read['pid']}\" style=\"color:gray;margin-top:30px\">[ {$read['alterinfo']} ]</div>");
    if ($read['remindinfo']) {
        $remind = explode("\t", $read['remindinfo']);
        $remind[0] = str_replace("\n", "<br />", $remind[0]);
        $remind[2] && ($remind[2] = get_date($remind[2]));
        $read['remindinfo'] = $remind;
    }
    if ($_GET['keyword']) {
        $keywords = explode("|", $_GET['keyword']);
        foreach ($keywords as $key => $value) {
            if ($value) {
                $read['content'] = preg_replace("/(?<=[\\s\"\\]>()]|[-�]|^)(" . preg_quote($value, '/') . ")([.,:;-?!()\\s\"<\\[]|[-�]|\$)/siU", "<u><font color=\"red\">\\1</font></u>\\2", $read['content']);
            }
        }
    }
    $GLOBALS['foruminfo']['copyctrl'] && ($read['content'] = preg_replace("/<br \\/>/eis", "copyctrl()", $read['content']));
    return $read;
}
Esempio n. 8
0
    $u_name = array('send' => $windid, 'receive' => $m['username']);
    if ($numofpage > 1) {
        $pages = numofpage($rt['sum'], $page, $numofpage, "message.php?action={$action}&withuid={$withuid}&");
        $limit = pwLimit(($page - 1) * $permsg, $permsg);
    } else {
        $pages = $limit = '';
    }
    $query = $db->query("SELECT ml.*,mc.title,mc.content FROM pw_msglog ml LEFT JOIN pw_msgc mc ON ml.mid=mc.mid WHERE ml.uid=" . pwEscape($winduid) . " AND ml.withuid=" . pwEscape($withuid) . " ORDER BY ml.mdate DESC {$limit}");
    while ($rt = $db->fetch_array($query)) {
        $rt['mdate'] = get_date($rt['mdate']);
        $rt['content'] = str_replace("\n", "<br>", $rt['content']);
        $rt['content'] = convert($rt['content'], $db_windpost);
        if (strpos($rt['content'], '[s:') !== false) {
            $rt['content'] = showface($rt['content']);
        }
        $rt['content'] = wordsConvert($rt['content']);
        $msgdb[] = $rt;
    }
    $msgdb = array_reverse($msgdb);
} elseif ($action == 'write') {
    /**
     * 写短信
     */
    $_G['allowmessege'] == 0 && Showmsg('msg_group_right');
    if ($_G['postpertime'] || $_G['maxsendmsg']) {
        $rp = $db->get_one('SELECT COUNT(*) AS tdmsg,MAX(mdate) AS lastwrite FROM pw_msg WHERE fromuid=' . pwEscape($winduid) . ' AND mdate>' . pwEscape($tdtime));
        if ($_G['postpertime'] && $timestamp - $rp['lastwrite'] <= $_G['postpertime']) {
            Showmsg('msg_limit');
        } elseif ($_G['maxsendmsg'] && $rp['tdmsg'] >= $_G['maxsendmsg']) {
            Showmsg('msg_num_limit');
        }