克隆虚拟形象怎么没办法用啊,点击无效啊.........
下面是我改过的viewthread.php的代码
麻烦看一下,谢谢,形象是AL8的最新版的.
- <?php
- /*
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: [DISCUZ!] Crossday Discuz! Board ::
- :: (c) 2001-2005 Comsenz Technology Ltd (www.discuz.com) ::
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: Author: Crossday (tech@discuz.com) Cnteacher (cnteacher@discuz.com) ::
- :: Version: 2.5F 2004/10/01 05:15 ::
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- */
- //fix: BY pk0909
- /*
- 1 发帖数衡量级别
- 2 转入最新帖
- */
- define('CURRSCRIPT', 'viewthread');
- require_once './include/common.php';
- require_once DISCUZ_ROOT.'./include/forum.php';
- require_once DISCUZ_ROOT.'./include/discuzcode.php';
- $discuz_action = 3;
- if ($tid && $forum){
- $thread = $forum;
- }elseif($fid && defined('ViewLastPost')) {
- $followforum = '';
- foreach($_DCACHE['forums'] as $ffid => $fforum) {
- if($fforum['fup'] == $fid && $fforum['type'] == 'sub') {
- $followforum .= ','.$ffid;
- }
- }
- $followforumadd = $followforum ? "fid in ($fid{$followforum})" : "fid=$fid";
- $query = $db->query("SELECT * FROM $table_threads WHERE $followforumadd ORDER BY lastpost DESC LIMIT 1");
- if(!$thread = $db->fetch_array($query)) {
- showmessage('thread_nonexistence');
- }
- $page = @ceil(($thread['replies'] + 1) / $ppp);
- header("Location: {$boardurl}viewthread.php?tid=$thread[tid]&page=$page&sid=$sid");
- exit();
- } else {
- showmessage('thread_nonexistence');
- }
- // ----------------------------------------------------------------
- // Shop By FY
- // ----------------------------------------------------------------
- @require DISCUZ_ROOT.'./forumdata/cache/cache_shop.php';
- $query=$db->query("SELECT * FROM $table_useritems WHERE uid='$discuz_uid'");
- $temp=$db->fetch_array($query);
- $myitemlist = $_DCACHE[item];
- for($i=0;$i<$_DCACHE[itemnum];){
- $myitemlist[$i++][num]=$temp["item".$i];
- }
- $useitem = (
- ( $myitemlist[4][num]>0 && $myitemlist[4]['use'] ) ||
- ( $myitemlist[2][num]>0 && $myitemlist[2]['use'] ) ||
- ( $myitemlist[5][num]>0 && $myitemlist[5]['use'] ) ||
- ( $myitemlist[6][num]>0 && $myitemlist[6]['use'] ) ||
- ( $myitemlist[7][num]>0 && $myitemlist[7]['use'] )
- )? 1:0;
- $randnum = rand(1,4);
- if($thread['alerted']){
- $query = $db->query("SELECT alertmsg FROM $table_threadsalert WHERE tid='$tid'");
- $alertmsg = $db->result($query,0);
-
- if($alertmsg && !$_COOKIE[alert."$tid"]){
- $alertmsg = str_replace("\r\n","\\n",$alertmsg);
- setcookie("alert".$tid, 1, $timestamp + 86400, $cookiepath, $cookiedomain);
- }else{
- $alertmsg = NULL;
- }
- }
- // ----------------------------------------------------------------
- if (defined('ViewLastPost')) {
- $page = @ceil(($thread['replies'] + 1) / $ppp);
- }
- $tid = $thread['tid'];
- $codecount = 0;
- $oldtopics = $_COOKIE['oldtopics'] ? $_COOKIE['oldtopics'] : "\t";
- if(!strstr($oldtopics, "\t$tid\t")) {
- $oldtopics .= "$tid\t";
- setcookie('oldtopics', $oldtopics, $timestamp + 900, $cookiepath, $cookiedomain);
- }
- if($forum['type'] == 'forum') {
- $navigation .= "» <a href="forumdisplay.php?fid=$fid&page=$fpage"> $forum[name]</a> » $thread[subject]";
- $navtitle .= ' - '.strip_tags($forum['name']).' - '.$thread['subject'];
- } else {
- $query = $db->query("SELECT fid, name, moderator FROM $table_forums WHERE fid='$forum[fup]'");
- $fup = $db->fetch_array($query);
- $navigation .= "» <a href="forumdisplay.php?fid=$fup[fid]">$fup[name]</a> » <a href="forumdisplay.php?fid=$fid&page=$fpage"> $forum[name]</a> » $thread[subject]";
- $navtitle .= ' - '.strip_tags($fup['name']).' - '.strip_tags($forum['name']).' - '.$thread['subject'];
- }
- $ismoderator = modcheck($discuz_user);
- if(!$forum['allowview']) {
- if(!$forum['viewperm'] && !$allowview) {
- showmessage('group_nopermission', NULL, 'NOPERM');
- } elseif($forum['viewperm'] && !strstr($forum['viewperm'], "\t$groupid\t")) {
- showmessage('forum_nopermission', NULL, 'NOPERM');
- }
- }
- if($thread['creditsrequire'] && $thread['creditsrequire'] > $credit && !$ismoderator && ($thread['authorid'] !=$discuz_uid)) {
- showmessage('thread_nopermission', NULL, 'NOPERM');
- }
- if($forum['password'] && $forum['password'] != $_COOKIE["fidpw$fid"]) {
- header("Location: {$boardurl}forumdisplay.php?fid=$fid&sid=$sid");
- exit();
- }
- if(!$action && $tid) {
- if($discuz_uid && $newpm) {
- require DISCUZ_ROOT.'./include/pmprompt.php';
- }
- $highlightstatus = str_replace('+', '', $highlight) ? 1 : 0;
- /*评分*/
-
- $pageMax = ceil(($thread['replies']+1) / $ppp);
- $page = intval($page) ? intval($page) : 1;
- $page = $page > $pageMax ? $pageMax : $page;
- $start_limit = ($page - 1) * $ppp;
- $fpage = intval($fpage);
- $multipage = multi($thread['replies'] + 1, $ppp, $page, "viewthread.php?tid=$tid&fpage=$fpage&highlight=".rawurlencode($highlight));
- $thread[subject] = cutstr($thread[subject],77);
- $polloptions = array();
- if($thread['poll']) {
- $query = $db->query("SELECT pollopts FROM $table_polls WHERE tid='$tid'");
- $pollopts = unserialize($db->result($query, 0));
- if (is_array($pollopts) && count($pollopts)){
- foreach($pollopts['options'] as $key=>$option) {
- $polloptions[] = array(
- 'option' => dhtmlspecialchars(stripslashes($option[0])),
- 'votes' => $option[1],
- 'width' => @round($option[1] * 300 / $pollopts['max']) + 2,
- 'percent' => @sprintf ("%01.2f", $option[1] * 100 / $pollopts['total']),
- 'voters' => $pollopts['votersdetail'][$key]
- );
- }
- $allowvote = $allowvote && $discuz_uid && (empty($thread['closed']) || $alloweditpoll) && !in_array($discuz_user, $pollopts['voters']);
- $optiontype = $pollopts['multiple'] ? 'checkbox' : 'radio';
- }else{
- unset ($pollopts);
- }
- }
- $query = $db->query("SELECT * FROM $table_medal where medalid <> '0';");
- while($medalist = $db->fetch_array($query)) {
- $medalshow[$medalist[medalid]]="<img src="$medalist[medalpic]" title="$medalist[medalname]\n$medalist[medalexpl]">";
- }
- $altbg1 = ALTBG1;
- $altbg2 = ALTBG2;
-
- $postlist = $attachelist = array();
- $newpostanchor = $topiccount = $have_attachment = 0;
- $postcount = $start_limit;
- //-----------------------------形象
- require_once './forumdata/cache/cache_plugins.php';
- $imagesset = $_DCACHE['plugins_settings'][virtualimage];
- if($imagesset[openalpha]){$alpha = "FILTER: alpha(opacity="+WearArray[i]+")";}
- //-----------------------------
-
- $post_phpcodecount = -1;
- $post_user_info_sql = 'm.username, m.uid, m.gender, m.groupid, m.adminid, m.regdate, m.lastactivity, m.postnum, m.userdigests,m.medals, m.credit, m.email, m.site, m.icq, m.oicq, m.yahoo, m.msn, m.location, m.avatar, m.avatarwidth, m.avatarheight, m.signature, m.customstatus, m.showemail,m.warning, m.onlinetime, m.bank, m.money, m.bankmimi, m.bankstatus, m.useimages';
- $query = $db->query("
- SELECT p.*, $post_user_info_sql
- FROM $table_posts p
- LEFT JOIN $table_members m ON m.uid=p.authorid
- WHERE p.tid='$tid' ORDER BY dateline LIMIT $start_limit, $ppp");
- while($post = $db->fetch_array($query)) {
- if($post['medals']){
- $medalid = strtok($post['medals'],",");
- $medalout='';
- while($medalid){
- $medalout.= $medalshow[$medalid];
- $medalid = strtok(",");
- }
- $post['medals'] = $medalout;
- }
- if(!$newpostanchor && $post['dateline'] > $lastvisit) {
- $post['newpostanchor'] = '<a name="newpost"></a>';
- $newpostanchor = 1;
- } else {
- $post['newpostanchor'] = '';
- }
- $topiccount ++;
- $post['postcount'] = $postcount+1;
- $post['thisbg'] = $postcolor = ${'altbg'.($postcount++ % 2 + 1)};
- $post['dateline'] = gmdate("$dateformat $timeformat", $post['dateline'] + $timeoffset * 3600);
- $post['onlinehour'] = intval($post['onlinetime']/3600);
- $post['onlinemin'] = intval($post['onlinetime']%3600/60);
- $change = 1; //兑换比率,即N点换一颗星
- $changebase = $post['onlinehour']; //兑换基数,要小时为$post['onlinehour'],分钟为intval($post['onlinetime']/60),秒为$post['onlinetime']
- $post['onlinestars'] = $changebase/$change; //计算方法:基数的数值除以兑换比率,得到星星数
- if($post['username']) {
-
- if($userstatusby > 0 ){
- if($userstatusby == 2 && $post['adminid'] == 0) {
- foreach($_DCACHE['ranks'] as $rank) {
- if($post['postnum'] > $rank['postshigher']) {
- $post['authortitle'] = $rank['ranktitle'];
- $post['stars'] = $rank['stars'];
- break;
- }
- }
- }else{
- $post['authortitle'] = $_DCACHE['usergroups'][$post['groupid']]['grouptitle'];
- $post['stars'] = $_DCACHE['usergroups'][$post['groupid']]['stars'];
- }
- }
- $post['uid'] = sprintf("%06d", $post['uid']);
- $post['regdate'] = gmdate($dateformat, $post['regdate'] + $timeoffset * 3600);
- $post['userdigests'] = $post['userdigests'] ? "<a href="digest.php?authorid=".$post['authorid']."">".$post['userdigests']."</a>" : "0";
- if($_DCACHE['usergroups'][$post['groupid']]['groupavatar']) {
- $post['avatar'] = '<img src="'.$_DCACHE['usergroups'][$post['groupid']]['groupavatar'].'" border="0">';
- } elseif($_DCACHE['usergroups'][$post['groupid']]['allowavatar'] && $post['avatar']) {
- $post['avatar'] = '<img src="'.$post['avatar'].'" width="'.$post['avatarwidth'].'" height="'.$post['avatarheight'].'" border="0">';
- } else {
- $post['avatar'] = '';
- }
- } else {
- if(!$post['authorid']) {
- $post['useip'] = substr($post['useip'], 0, strrpos($post['useip'], '.')).'.x';
- }
- $post['postnum'] = $post['credit'] = $post['regdate'] = 'N/A';
- }
- //------------------------------------------------------------形象
- if ($imagesset['orderuse']!='1' && ($post['useimages'] != 1 || $post[gender]==0)){
- $post['avatar'] = $post['avatar'];
- }else{
- if ($post[gender]==1){
- $tempequip = '0-0-0-0-0-0-0-0-init-init-0-init-0-init-init-0-0-0-init-0-0-0-0-0-0-0'; //
- $sex = "m";
- $upid = "init";
- }else if ($post[gender]==2){
- $tempequip = '0-0-0-0-0-0-0-0-initf-initf-0-initf-0-initf-initf-0-0-0-initf-0-0-0-0-0-0-0'; //女性
- $sex = "f";
- $upid = "initf";
- }
- $userwearip = '400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-40 0-400-400';//商品
- $cookiearray = split('-', $tempequip);
- $weararray = split('-', $userwearip);
- $imagescookie = $db->query("SELECT * FROM $tablepre"."images_user where userid = '$post[uid]' and dafaultuse = '1' and (suitable = '$sex' or suitable = 't')");
- while ($userimages = $db->fetch_array($imagescookie)){
- $tempi = $userimages[classid];
- $cookiearray[$tempi] = $userimages[picid];
- if($imagesset[beold]){
- $images_weardate = $userimages[endurance] - (time() - $userimages[lastuse]);
- $images_weardate = ceil($images_weardate/8640);
- if ($images_weardate <= 0){
- $db->query("UPDATE $tablepre"."images_user SET dafaultuse = '3' WHERE userid='$post[uid]' and picid = '$userimages[facepicid]' and classid= '$userimages[classid]' and dafaultuse='1'");
- if($userimages[classid] == 8||$userimages[classid]==9||$userimages[classid]==11||$userimages[classid] ==13||$userimages[classid]==14||$userimages[classid]==18){
- $userupid = $upid;
- }else{
- $userupid = "0";
- }
- $cookiearray[$tempi] = $userupid;
- }else{
- $weararray[$tempi] = $images_weardate;
- }
- }else{
- $weararray[$tempi] = 100;
- }
- }
- if ($post[gender]==0){
- $userimages = "";//形象
- }else{$userimages = implode("-", $cookiearray);}
- $userwear = implode("-", $weararray);
- if ($myitemlist[9]['num']>0 && $myitemlist[9]['use'] && $post['authorid']!=$discuz_uid)$post['avatar']="<a onClick='var truthBeTold = window.confirm("要克隆这个虚拟形象吗?");if (truthBeTold) window.open("plugins.php?p=shop&action=use&id=10&uid={$post['authorid']}");'>";
- $post['avatar'] = "
- <!-- 形象開始-->
- <DIV id=Show{$post['pid']}
- style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; LEFT: 0px; PADDING-BOTTOM: 0px; WIDTH: 140px; PADDING-TOP: 0px; POSITION: relative; TOP: 0px; HEIGHT: 226px"></DIV>
- <SCRIPT language=JavaScript>
- var currface = "$userimages";
- if (currface =="") {
- currface = "0";
- }
- var currwear = "$userwear";
- var showArray = currface.split('-');
- var WearArray = currwear.split('-');
- if (showArray[6] != '0'){
- showArray[8] = 0;
- showArray[9] = 0;
- }
- var s="";
- for (var i=0; i<26; i++){
- if(showArray[i] != '0'){
- if((showArray[i] == 'init') || (showArray[i] == 'initf')){
- s+="<IMG src=images/virtualimage/"+i+"/"+showArray[i]+".gif style='padding:0;position:absolute;top:0;left:0;width:140;height:226;z-index:"+i+";'>";
- }else{
- s+="<IMG src=images/virtualimage/"+i+"/"+showArray[i]+".gif style='padding:0;position:absolute;top:0;left:0;width:140;height:226;z-index:"+i+";".$alpha." '>";
- }
- }
- }
- s+="<IMG src=images/virtualimage/blank.gif style='padding:0;position:absolute;top:0;left:0;width:140;height:226;z-index:50'>";
- if (currface=='0'){
- s="<IMG src=images/virtualimage/noface.gif style='padding:0;position:absolute;top:0;left:0;width:154;height:94;'>";
- }
- Show{$post['pid']}.innerHTML=s;
- </SCRIPT>
- </a>
- <!--{/if}-->
- <!-- 形象結束-->
- ";
- if ($myitemlist[9]['num']>0 && $myitemlist[9]['use'])$post['avatar'].="</a>";
- }
- //--------------------------------------------------------------
- $post['karma'] = '';
- if($post['rate'] && $post['ratetimes']) {
- $rateimg = $post['rate'] > 0 ? 'agree.gif' : 'disagree.gif';
- for($i = 0; $i < round(abs($post['rate']) / $post['ratetimes']); $i++) {
- $post['karma'] .= '<img src="'.IMGDIR.'/'.$rateimg.'" align="right">';
- }
- }
- $post['subject'] = $post['subject'] ? $post['subject'] : NULL;
- if($post[hidepost] == '1') {
- $post['message'] = '<b>****本貼已被版主隱藏****</b>';
- $post['message'] .= $post['wnmessagepost'];
- } else {
- $post['message'] = postify($post['message'], $post['smileyoff'], $post['bbcodeoff'], $forum['allowsmilies'], $forum['allowhtml'], $forum['allowbbcode'], $forum['allowimgcode']);
- $post['message'] = $post['message'] ;
- $post['message'] .=$post['wnmessagepost'];
- }
- $post['signature'] = $post['usesig'] && $post['signature'] ? postify($post['signature'], 1, 0, 0, 0, $_DCACHE['usergroups'][$post['groupid']]['allowsigbbcode'], $_DCACHE['usergroups'][$post['groupid']]['allowsigimgcode']) : NULL;
- if(!$have_attachment && $post['aid']) $have_attachment = 1 ;
- $postlist[] = $post;
- }
-
- if (empty($postlist)) {
- showmessage('undefined_action', NULL, 'NOPERM');
- }
- if ($have_attachment) {
- require_once DISCUZ_ROOT.'./include/attachment.php';
- $query = $db->query("select * from $table_attachments where tid='$tid' ORDER BY aid");
- while($attach = $db->fetch_array($query)) {
- $attach[checkid] = substr(md5($attach['filesize']),0,5);
- $extension = strtolower(fileext($attach['filename']));
- $attach['attachicon'] = attachtype($extension."\t".$attach['filetype']);
- if($attachimgpost && in_array($extension, array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp'))) {
- $attach['attachimg'] = 1;
- } else {
- $attach['attachimg'] = 0;
- }
- $attach['attachsize'] = sizecount($attach['filesize']);
- $attach['dateline'] = $attach['dateline']?gmdate("$dateformat $timeformat", $attach['dateline'] + $timeoffset * 3600): '';
- $attachelist["$attach[pid]"][] = $attach;
- }
- }
- $typearray = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
- if($thread['badge']) {
- $string = sprintf('%02d', $thread['badge']);
- $stylestr = sprintf('%03b', $string[0]);
- //$thread['badge'] .= $string[1];
- } else {
- $thread['badge'] = '';
- }
- $forumselect = $forumjump ? forumselect() : NULL;
- $useframecheck = 'checked';
- $usesigcheck = $signature ? 'checked' : NULL;
- $allowpost = (!$forum['postperm'] && $allowpost) || ($forum['postperm'] && strstr($forum['postperm'], "\t$groupid\t")) || $forum['allowpost'];
- $allowpostreply = (!$thread['closed'] || $ismoderator) && (!$delayreply || ($delayreply && (($timestamp - $thread[dateline] ) < $delayreply * 86400)) || $ismoderator) && ((!$forum['replyperm'] && $allowpost) || ($forum['replyperm'] && strstr($forum['replyperm'], "\t$groupid\t")) || $forum['allowreply']);
- if($delayviewcount) {
- $logfile = DISCUZ_ROOT.'./forumdata/viewcount.log';
- if(substr($timestamp, -2) == '00') {
- require DISCUZ_ROOT.'./include/misc.php';
- updateviews();
- }
- if(@$fp = fopen($logfile, 'a')) {
- fwrite($fp, "$tid\n");
- fclose($fp);
- }elseif($adminid == 1) {
- showmessage('view_log_invalid');
- }
- } else {
- $db->query("UPDATE LOW_PRIORITY $table_threads SET views=views+1 WHERE tid='$tid'", 'UNBUFFERED'); /* 修改点击次数 */
- }
- if($smileyinsert && $fastpost && is_array($_DCACHE['smilies'])) {
- $smileyinsert = 1;
- $simlieslist = 20;
- $smcols = $smcols ? $smcols : 3;
- $smilies .= '<tr>';
- foreach(array_reverse($_DCACHE['smilies']) as $key => $smiley) {
- if ($key < $simlieslist){
- $smilies .= '<td align="center" valign="top"><img src="'.SMDIR.'/'.$smiley['url'].'" border="0" onmouseover="this.style.cursor=\'hand\';" onclick="AddText(\''.htmlspecialchars(addcslashes($smiley['code'], '\\\'')).'\');"></td>'."\n";
- $smilies .= !(++$key % $smcols) ? '</tr><tr>' : NULL;
- }
- $smiliesextra= "<tr><td align=center colspan=$smcols>共有 $key 个图象 [<a href="javascript:popUp('misc.php?action=smilies','230','430','1')">显示更多</a>]</td></tr>";
-
- $smilies_overstep = 0;
- $smilies_overstep = $simlieslist / $smcols;
- $smilies_overstep = ($smilies_overstep > 5) ? 1 : 0;
- }
- } else {
- $smileyinsert = 0;
- }
- include template('viewthread');
- } elseif($action == 'printable' && $tid) {
- require DISCUZ_ROOT.'./include/printable.php';
- }
- ?>
复制代码 |