示例#1
0
                        $dfurl = '<br>' . cvpic($a_url[0], 1, $db_windpost['picwidth'], $db_windpost['picheight'], $at['ifthumb']);
                        $rat = array('aid' => $at['aid'], '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]}{$db_hash}"));
                    }
                } else {
                    $atype = 'downattach';
                    if ($at['needrvrc'] > 0) {
                        !$at['ctype'] && ($at['ctype'] = $at['special'] == 2 ? 'money' : 'rvrc');
                        $at['special'] == 2 && $db_sellset['price'] > 0 && ($at['needrvrc'] = min($at['needrvrc'], $db_sellset['price']));
                    }
                    $rat = array('aid' => $at['aid'], 'name' => $at['name'], 'size' => $at['size'], 'hits' => $at['hits'], 'needrvrc' => $at['needrvrc'], 'special' => $at['special'], 'cname' => $creditnames[$at['ctype']], 'type' => $at['type'], 'dfadmin' => $dfadmin, 'desc' => $at['descrip'], 'ext' => strtolower(substr(strrchr($at['name'], '.'), 1)));
                }
                if ($atype) {
                    $content = attcontent($content, $atype, $rat);
                }
            }
        }
        $alterinfo && ($content .= "<div id=\"alert_{$pid}\" style=\"color:gray;margin-top:30px\">[ {$alterinfo} ]</div>");
        $atcdb['icon'] = $atcdb['icon'] ? "<img src=\"{$imgpath}/post/emotion/{$atcdb['icon']}.gif\" align=\"left\" border=\"0\" />" : '';
        echo "success\t" . stripslashes($atcdb['icon'] . "&nbsp;" . $atc_title) . "\t" . str_replace(array("\r", "\t"), array("", ""), stripslashes($content));
        ajax_footer();
    }
} elseif ($action == 'quote') {
    if (!$pwpost->admincheck && !$pwforum->allowreply($pwpost->user, $pwpost->groupid)) {
        Showmsg('reply_forum_right');
    }
    if (!$pwforum->foruminfo['allowrp'] && !$pwpost->admincheck && $_G['allowrp'] == 0) {
        Showmsg('reply_group_right');
    }
示例#2
0
function htmread($read, $start_limit)
{
    global $tpc_author, $count, $timestamp, $db_onlinetime, $db_bbsurl, $attachdir, $attachpath, $_G, $tablecolor, $readcolorone, $readcolortwo, $lpic, $ltitle, $imgpath, $db_ipfrom, $db_showonline, $stylepath, $db_windpost, $db_windpic, $fid, $tid, $attachments, $aids, $db_signwindcode, $db_md_ifopen, $_MEDALDB, $db_shield;
    //* include_once pwCache::getPath(D_P.'data/bbscache/level.php');
    extract(pwCache::getData(D_P . 'data/bbscache/level.php', false));
    $read['lou'] = $start_limit;
    $start_limit == $count - 1 && ($read['jupend'] = '<a name=lastatc></a>');
    $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br>", $read['content']));
    $read['groupid'] == '-1' && ($read['groupid'] = $read['memberid']);
    $anonymous = $read['anonymous'] ? 1 : 0;
    if ($read['groupid'] != '' && $anonymous == 0) {
        !$lpic[$read['groupid']] && ($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['aurvrc'] = floor($read['rvrc'] / 10);
        $read['author'] = $read['username'];
        $read['ontime'] = (int) ($read['onlinetime'] / 3600);
        $tpc_author = $read['author'];
        $read['face'] = showfacedesign($read['micon']);
        if ($db_ipfrom == 1) {
            $read['ipfrom'] = ' From:' . $read['ipfrom'];
        }
        if ($db_md_ifopen && $read['medals']) {
            $medals = '';
            $md_a = explode(',', $read['medals']);
            foreach ($md_a as $key => $value) {
                if ($value) {
                    $medals .= "<img src=\"{$_MEDALDB[$value][smallimage]}\" title=\"{$_MEDALDB[$value][name]}\" /> ";
                }
            }
            $read['medals'] = $medals . '<br />';
        } else {
            $read['medals'] = '';
        }
        if ($read['ifsign'] == 1 || $read['ifsign'] == 3) {
            global $sign;
            if (!$sign[$read['author']]) {
                global $db_signmoney, $db_signgroup, $tdtime;
                if (strpos($db_signgroup, ",{$read['groupid']},") !== false && $db_signmoney && (!getstatus($read['userstatus'], PW_USERSTATUS_SHOWSIGN) || (!$read['starttime'] || $read['currency'] < ($tdtime - $read['starttime']) / 86400 * $db_signmoney))) {
                    $read['signature'] = '';
                } else {
                    if ($db_signwindcode && getstatus($read['userstatus'], PW_USERSTATUS_SIGNCHANGE)) {
                        $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['face'] = "<br>";
        $read['lpic'] = '8';
        $read['level'] = $read['digests'] = $read['postnum'] = $read['money'] = $read['regdate'] = $read['lastlogin'] = $read['aurvrc'] = $read['credit'] = '*';
        if ($anonymous) {
            $read['signature'] = $read['honor'] = $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['postdate'] = get_date($read['postdate']);
    $read['mark'] = '';
    if ($read['ifmark']) {
        $markdb = explode("\t", $read['ifmark']);
        foreach ($markdb as $key => $value) {
            $read['mark'] .= "<li>{$value}</li>";
        }
    }
    if ($read['icon']) {
        $read['icon'] = "<img src=\"{$imgpath}/post/emotion/{$read['icon']}.gif\" align=left border=0>";
    } else {
        $read['icon'] = '';
    }
    /**
     * 动态判断发帖是否需要转换
     */
    $tpc_shield = 0;
    if ($read['ifshield'] || $read['groupid'] == 6 && $db_shield) {
        $read['subject'] = $read['icon'] = '';
        $read['content'] = shield($read['ifshield'] ? $read['ifshield'] == 1 ? 'shield_article' : 'shield_del_article' : 'ban_article');
        $tpc_shield = 1;
    }
    $creditnames = pwCreditNames();
    if (!$tpc_shield) {
        $attachs = $aids = array();
        if ($read['aid'] && !$read['ifhide']) {
            $attachs = unserialize($read['aid']);
            if (is_array($attachs)) {
                $aids = attachment($read['content']);
            }
        }
        $wordsfb = L::loadClass('FilterUtil', 'filter');
        if (!$wordsfb->equal($read['ifwordsfb'])) {
            $read['content'] = $wordsfb->convert($read['content']);
        }
        if ($read['ifconvert'] == 2) {
            $read['content'] = preg_replace("/\\[sell=(.+?)\\]/is", "", $read['content']);
            $read['content'] = preg_replace("/\\[hide=(.+?)\\]/is", "", $read['content']);
            $read['content'] = str_replace(array('[/hide]', '[/sell]', '[post]', '[/post]'), '', $read['content']);
            $read['content'] = convert($read['content'], $db_windpost);
        } else {
            strpos($read['content'], '[s:') !== false && ($read['content'] = showface($read['content']));
        }
        if ($attachs && is_array($attachs) && !$read['ifhide']) {
            foreach ($attachs as $at) {
                $atype = '';
                $rat = array();
                if ($at['type'] == 'img' && $at['needrvrc'] == 0) {
                    $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'], 'img' => $dfurl, 'dfadmin' => 0, 'desc' => $at['desc']);
                    } elseif ($a_url == 'imgurl') {
                        $atype = 'picurl';
                        $rat = array('aid' => $at['aid'], 'name' => $at['name'], 'dfadmin' => 0, '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' => $creditnames[$at['ctype']], 'type' => $at['type'], 'dfadmin' => 0, 'desc' => $at['desc'], '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;
                }
            }
        }
    }
    $GLOBALS['foruminfo']['copyctrl'] && ($read['content'] = preg_replace("/<br>/eis", "copyctrl('{$read['colour']}')", $read['content']));
    $read['alterinfo'] && ($read['content'] .= "<br><br><br><font color=gray>[ {$read['alterinfo']} ]</font>");
    return $read;
}
示例#3
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;
}
示例#4
0
                    foreach ($attachs as $at) {
                        $atype = '';
                        $rat = array();
                        if ($at['type'] == 'img') {
                            $a_url = geturl('diary/' . $at['attachurl'], 'show');
                            if (is_array($a_url)) {
                                $atype = 'pic';
                                $dfurl = '<br>' . cvpic($a_url[0], 1, 450, 338, $at['ifthumb']);
                                $rat = array('aid' => $at['aid'], 'img' => $dfurl, 'dfadmin' => $dfadmin, 'desc' => $at['desc']);
                            }
                        }
                        if (!$atype) {
                            continue;
                        }
                        if (in_array($at['aid'], $aids)) {
                            $rt['content'] = attcontent($rt['content'], $atype, $rat);
                        } else {
                            $rt[$atype][$at['aid']] = $rat;
                        }
                    }
                }
                $rt['link'] = "{$db_bbsurl}/{$basename}q=diary&u={$rt['uid']}&did={$rt['did']}";
                $rt['title'] = "({$rt['link']})";
                if ($rt['uid'] != $winduid) {
                    list($rt['icon']) = showfacedesign($rt['icon'], 1);
                }
                $diarydb[] = $rt;
            }
        }
    }
} elseif ($a == 'write') {