예제 #1
0
 foreach ($readdb as $key => $read) {
     $tpc_pid = $read['pid'];
     $tpc_author = $read['author'];
     $read['lou'] = ++$lou;
     $db_menuinit .= ",'read_{$read['lou']}' : 'read_1_{$read['lou']}'";
     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'] = $pwSystem['viewip'] ? 'IP:' . $read['userip'] : '';
     if ($db_iftag && $read['tags']) {
         list($read['tag'], $tpc_tag) = getReadTag($read['tags']);
     }
     $tpc_shield = 0;
     $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br />", $read['content']));
     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;
예제 #2
0
파일: read.php 프로젝트: jechiy/PHPWind
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, $_MEDALDB, $rewardtype, $db_shield, $db_iftag, $db_md_ifopen;
    global $ping_logs, $buyAids, $creditdb, $admincheck;
    if ($read['istop'] == 'topped') {
        $read['lou'] = $read['floor'];
    } elseif ($read['robfloor']) {
        $read['lou'] = $read['robfloor'];
    } 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>";
    $orderby == 'desc' && ($read['jupend'] = $start_limit == 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 = array();
    $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'] ? trim($read['ipfrom']) == 'Unknown' ? '未知IP' : $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');
    //list(,,$originalWidth,$originalHeight,,) = explode('|', $read['micon']);
    if ($httpWidth > 120 || $httpHeight > 120 || $read['facesize'] == '') {
        $read['facesize'] = ' width="120" height="120"';
    }
    list($read['posttime']) = getLastDate($read['postdate']);
    $read['postdate'] = get_date($read['postdate'], 'Y-m-d H:i:s');
    $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=\"absmiddle\" />";
    } else {
        $read['icon'] = '';
    }
    if ($db_md_ifopen && $read['medals']) {
        $read['medals'] = getMedals($read['authorid'], $read['medals']) . '<br />';
    } else {
        $read['medals'] = '';
    }
    $read['leaveword'] && ($read['content'] .= leaveword($read['leaveword'], $read['pid']));
    if ($db_iftag && $read['tags']) {
        list($read['tag'], $tpc_tag) = getReadTag($read['tags']);
    }
    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['aid']) {
            if ($GLOBALS['attachShow']->isShow($read['ifhide'], $tid)) {
                $read += $GLOBALS['attachShow']->parseAttachs($read['pid'], $read['content'], $winduid == $read['authorid']);
                $read['isAllowViewTucool'] = $admincheck || $read['authorid'] == $winduid || ($winduid || !$forumset['viewpic']);
            } else {
                $read['content'] = $GLOBALS['attachShow']->clearAttachTags($read['content']);
            }
        }
        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']));
        }
    }
    /**
     * 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;
}