AL8 Forum
»
Discuz 6.0 及 6.1 插件發佈
» 增加動態頭像外部連接(不影響本身DZ6.1上傳頭像功能)更新0606
‹‹ 上一主題
|
下一主題 ››
標題:
[D6.1]
增加動態頭像外部連接(不影響本身DZ6.1上傳頭像功能)更新0606
打印
|
推薦
|
訂閱
|
收藏
本主題被作者加入到個人文集中
uf2004
0001272
頭銜: Moderator
暱稱: macaubbs.com
帖子: 3337
精華:
10
積分: 59749 點
現金: 67 元
存款: 183907 元
閱讀權限: 100
註冊: 2004-4-16
狀態: 離線
#1
大
中
小
發表於 2008-5-31 09:01
資料
個人空間
主頁
短消息
加為好友
增加動態頭像外部連接(不影響本身DZ6.1上傳頭像功能)更新0606
插件: 增加動態頭像外部連接(不影響本身DZ6.1上傳頭像功能)
作者: uf2004(macaubbs.com)
演繹: 附圖
修改文件: memcp.php , viewthread.php , memcp_profile.htm
說明: 增加動態頭像外部連接,不影響本身DZ6.1上傳頭像功能,會員可選擇使用與否.
使用本插件好處,動態外部連接,靜態站內上傳,不影響論壇本身效能,無副作用,可放心使用.
更重要一點,不改變數據結構對日後升級版本不影響...
先備份以上三個文件,以免修改錯誤時還原
修改 memcp.php
找
[Copy to clipboard]
[
-
]
CODE:
$memberfieldsql = "bio='$biohtmlnew', sightml='$sightmlnew'";
改成
[Copy to clipboard]
[
-
]
CODE:
//macaubbs頭像s
if($avatar) {
if(!in_array(strtolower(fileext($avatar)), array('gif', 'jpg', 'png'))) {
showmessage('profile_avatar_invalid');
}
$avatar = dhtmlspecialchars(trim($avatar));
$maxavatarpixel = 150;
$maxsize = max($avatarwidthnew, $avatarheightnew);
if($maxsize > $maxavatarpixel) {
$avatarwidthnew = $maxavatarpixel;
$avatarheightnew = $maxavatarpixel;
}
$avataradd = ", avatar='$avatar', avatarwidth='$avatarwidthnew', avatarheight='$avatarheightnew'";
} else {
$avataradd = ", avatar='', avatarwidth='', avatarheight=''";
}
$memberfieldsql = "bio='$biohtmlnew', sightml='$sightmlnew' $avataradd";
//macaubbs頭像e
修改 memcp_profile.htm
找
[Copy to clipboard]
[
-
]
CODE:
<!--{elseif $typeid == 4}-->
下一行加
[Copy to clipboard]
[
-
]
CODE:
<tr>
<th>
{lang avatar} URL<br />例: [img]http://www.xxx.com/xxx.gif[/img]<br />圖片格式 jpg, gif, png.
</th>
<td>
<img src="$member[avatar]" width="$member[avatarwidth]" height="$member[avatarheight]" />
<div><input type="text" size="60" name="avatar" value="$member[avatar]"></div>
{lang width}: <input type="text" name="avatarwidthnew" size="1" value="$member[avatarwidth]" /> {lang height}: <input type="text" name="avatarheightnew" size="1" value="$member[avatarheight]" />
( {lang width}, {lang height}, 最大150, 設為 0 時只顯示上傳頭像. )
</td>
</tr>
修改 viewthread.php
找(注意符號)
[Copy to clipboard]
[
-
]
CODE:
mf.medals,
改成
[Copy to clipboard]
[
-
]
CODE:
mf.medals, mf.avatar, mf.avatarwidth, mf.avatarheight,
找
[Copy to clipboard]
[
-
]
CODE:
$post['avatar'] = '<div class="avatar">'.discuz_uc_avatar($post['authorid']);
改成
[Copy to clipboard]
[
-
]
CODE:
if($post['avatarwidth'] && $post['avatarheight']){
$post['avatar'] = "<div class=\"avatar\"><img src=\"$post[avatar]\" width=\"$post[avatarwidth]\" height=\"$post[avatarheight]\" />";
} else {
$post['avatar'] = '<div class="avatar">'.discuz_uc_avatar($post['authorid']);
}
完~
有問題請跟帖,沒問題回帖支持.
[
本帖最後由 uf2004 於 2008-6-8 00:17 編輯
]
附件:
您所在的用戶組無法下載或查看附件
澳門論壇,得閒黎吹下水.(utf-8)
if ("支持免費" == "尊重版權") { showmessage("Discuz!"); }
AL8 Forum © All rights reserved.
KennyGoh
0074151
頭銜: Newbie
帖子: 21
精華: 0
積分: 270 點
現金: 100 元
存款: 0 元
閱讀權限: 10
註冊: 2007-4-22
狀態: 離線
#2
大
中
小
發表於 2008-6-1 01:26
資料
個人空間
短消息
加為好友
我有问题,我使用后头像URL能显示,不过为 0 时之前的UC头像上传不显示,显示如下,还加了符号...如何解决呢?
偶6.1文件是最新官方Monkeye在SVN的更新..麻烦大大看下何解...
http://monkeyesvn.googlecode.com/svn/trunk/Discuz!/
[
本帖最後由 KennyGoh 於 2008-6-1 01:45 編輯
]
AL8 Forum © All rights reserved.
uf2004
0001272
頭銜: Moderator
暱稱: macaubbs.com
帖子: 3337
精華:
10
積分: 59749 點
現金: 67 元
存款: 183907 元
閱讀權限: 100
註冊: 2004-4-16
狀態: 離線
#3
大
中
小
發表於 2008-6-1 07:48
資料
個人空間
主頁
短消息
加為好友
QUOTE:
原帖由
KennyGoh
於 2008-6-1 01:26 發表
我有问题,我使用后头像URL能显示,不过为 0 时之前的UC头像上传不显示,显示如下,还加了符号...如何解决呢?
偶6.1文件是 ...
重新修改一次 viewthread.php
注意有些地方代碼不要斷行~
這是改插件經常發生的錯誤~
澳門論壇,得閒黎吹下水.(utf-8)
if ("支持免費" == "尊重版權") { showmessage("Discuz!"); }
AL8 Forum © All rights reserved.
KennyGoh
0074151
頭銜: Newbie
帖子: 21
精華: 0
積分: 270 點
現金: 100 元
存款: 0 元
閱讀權限: 10
註冊: 2007-4-22
狀態: 離線
#4
大
中
小
發表於 2008-6-1 13:03
資料
個人空間
短消息
加為好友
QUOTE:
原帖由
uf2004
於 2008-6-1 07:48 發表
重新修改一次 viewthread.php
注意有些地方代碼不要斷行~
這是改插件經常發生的錯誤~
还是一样,大大看看下...以下是我修改后的代码 , 源代码在这里
http://monkeyesvn.googlecode.com ... load/viewthread.php
[Copy to clipboard]
[
-
]
CODE:
<?php
/*
[Discuz!] (C)2001-2007 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: viewthread.php 13764 2008-05-19 03:14:01Z heyond $
*/
if(!defined('CURSCRIPT')) {
define('CURSCRIPT', 'viewthread');
}
define('SQL_ADD_THREAD', ' t.dateline, t.special, t.lastpost AS lastthreadpost, ');
require_once './include/common.inc.php';
require_once DISCUZ_ROOT.'./include/forum.func.php';
$page = max($page, 1);
if($cachethreadlife && $forum['threadcaches'] && !$discuz_uid && $page == 1 && !$forum['special']) {
viewthread_loadcache();
}
require_once DISCUZ_ROOT.'./include/discuzcode.func.php';
$discuz_action = 3;
$thread = $db->fetch_first("SELECT * FROM {$tablepre}threads t WHERE tid='$tid' AND displayorder>='0'");
if(!$thread) {
showmessage('thread_nonexistence');
}
$oldtopics = isset($_DCOOKIE['oldtopics']) ? $_DCOOKIE['oldtopics'] : 'D';
if(strpos($oldtopics, 'D'.$tid.'D') === FALSE) {
$oldtopics = 'D'.$tid.$oldtopics;
if(strlen($oldtopics) > 3072) {
$oldtopics = preg_replace("((D\d+)+D).*$", "\\1", substr($oldtopics, 0, 3072));
}
dsetcookie('oldtopics', $oldtopics, 3600);
}
if($lastvisit < $thread['lastpost'] && (!isset($_DCOOKIE['fid'.$fid]) || $thread['lastpost'] > $_DCOOKIE['fid'.$fid])) {
dsetcookie('fid'.$fid, $thread['lastpost'], 3600);
}
$thisgid = 0;
$thread['subjectenc'] = rawurlencode($thread['subject']);
$fromuid = $creditspolicy['promotion_visit'] && $discuz_uid ? '&fromuid='.$discuz_uid : '';
$navigation = ' » <a href="forumdisplay.php?fid='.$fid.($extra ? '&'.preg_replace("/^(&)*/", '', $extra) : '').'">'.$forum['name'].'</a> » '.$thread['subject'];
if($thread['digest'] == '-2') {
$campaign = $db->fetch_first("SELECT id, type, status, url, autoupdate, lastupdated FROM {$tablepre}campaigns WHERE tid='$tid'");
if(!$campaign || $campaign['status'] != 2) {
showmessage('thread_nonexistence');
}
$insenz = $db->result_first("SELECT value FROM {$tablepre}settings WHERE variable='insenz'");
$insenz = $insenz ? unserialize($insenz) : array();
if(empty($insenz['authkey'])) {
showmessage('thread_nonexistence');
}
require_once DISCUZ_ROOT.'./include/insenz.func.php';
$member = $db->fetch_first("SELECT regdate FROM {$tablepre}members WHERE uid='$discuz_uid'");
$iframeurl = $campaign[url]."siteid=$insenz[siteid]&cid=$campaign[id]&s=".urlencode(insenz_authcode("sitename=$bbname&siteurl=$boardurl&username=$discuz_userss&uid=$discuz_uid&email=$email&grouptitle=$grouptitle®date=$member[regdate]&ppp=$ppp&tid=$tid", 'ENCODE', $insenz['authkey'])).'&'.$_SERVER['QUERY_STRING'];
$update = $campaign['autoupdate'] && ($timestamp - $campaign['lastupdated']) < 600 ? FALSE : TRUE;
include template('viewthread_iframe');
exit;
}
$navtitle = $thread['subject'].' - '.strip_tags($forum['name']);
if($forum['type'] == 'sub') {
$fup = $db->fetch_first("SELECT fid, name FROM {$tablepre}forums WHERE fid='$forum[fup]'");
$navigation = '» <a href="forumdisplay.php?fid='.$fup['fid'].'">'.$fup['name'].'</a> '.$navigation;
$navtitle = $navtitle.' - '.strip_tags($fup['name']);
}
$navtitle .= ' - ';
$forum['typemodels'] = $forum['typemodels'] ? unserialize($forum['typemodels']) : array();
$threadtype = isset($forum['threadtypes']['types'][$thread['typeid']]) ? 1 : 0;
$typetemplate = $tagscript = '';
$optiondata = $optionlist = array();
if($thread['typeid'] && $threadtype) {
if($forum['threadtypes']['special'][$thread['typeid']]) {
if(@include_once DISCUZ_ROOT.'./forumdata/cache/threadtype_'.$thread['typeid'].'.php') {
$query = $db->query("SELECT optionid, value FROM {$tablepre}typeoptionvars WHERE tid='$tid'");
while($option = $db->fetch_array($query)) {
$optiondata[$option['optionid']] = $option['value'];
}
foreach($_DTYPE as $optionid => $option) {
$optionlist[$option['identifier']]['title'] = $_DTYPE[$optionid]['title'];
if($_DTYPE[$optionid]['type'] == 'checkbox') {
$optionlist[$option['identifier']]['value'] = '';
foreach(explode("\t", $optiondata[$optionid]) as $choiceid) {
$optionlist[$option['identifier']]['value'] .= $_DTYPE[$optionid]['choices'][$choiceid].' ';
}
} elseif(in_array($_DTYPE[$optionid]['type'], array('radio', 'select'))) {
$optionlist[$option['identifier']]['value'] = $_DTYPE[$optionid]['choices'][$optiondata[$optionid]];
} elseif($_DTYPE[$optionid]['type'] == 'image') {
$maxwidth = $_DTYPE[$optionid]['maxwidth'] ? 'width="'.$_DTYPE[$optionid]['maxwidth'].'"' : '';
$maxheight = $_DTYPE[$optionid]['maxheight'] ? 'height="'.$_DTYPE[$optionid]['maxheight'].'"' : '';
$optionlist[$option['identifier']]['value'] = $optiondata[$optionid] ? "<a href=\"$optiondata[$optionid]\" target=\"_blank\"><img src=\"$optiondata[$optionid]\" $maxwidth $maxheight border=\"0\"></a>" : '';
} elseif($_DTYPE[$optionid]['type'] == 'url') {
$optionlist[$option['identifier']]['value'] = $optiondata[$optionid] ? "<a href=\"$optiondata[$optionid]\" target=\"_blank\">$optiondata[$optionid]</a>" : '';
} elseif($_DTYPE[$optionid]['type'] == 'textarea') {
$optionlist[$option['identifier']]['value'] = $optiondata[$optionid] ? nl2br($optiondata[$optionid]) : '';
} else {
$optionlist[$option['identifier']]['value'] = $optiondata[$optionid];
}
}
$typetemplate = $_DTYPETEMPLATE ? preg_replace(array("/\[(.+?)value\]/ies", "/{(.+?)}/ies"), array("showoption('\\1', 'value')", "showoption('\\1', 'title')"), $_DTYPETEMPLATE) : '';
}
}
$thread['subject'] = ($forum['threadtypes']['listable'] ? '<a href="forumdisplay.php?fid='.$fid.'&filter=type&typeid='.$thread['typeid'].'">['.$forum['threadtypes']['types'][$thread['typeid']].']</a>' : '['.$forum['threadtypes']['types'][$thread['typeid']].']').' '.$thread['subject'];
}
if(empty($forum['allowview'])) {
if(!$forum['viewperm'] && !$readaccess) {
showmessage('group_nopermission', NULL, 'NOPERM');
} elseif($forum['viewperm'] && !forumperm($forum['viewperm'])) {
$navtitle = '';
showmessage('forum_nopermission', NULL, 'NOPERM');
}
} elseif($forum['allowview'] == -1) {
$navtitle = '';
showmessage('forum_access_view_disallow');
}
if($forum['formulaperm']) {
formulaperm($forum['formulaperm']);
}
if($forum['password'] && $forum['password'] != $_DCOOKIE['fidpw'.$fid]) {
dheader("Location: {$boardurl}forumdisplay.php?fid=$fid&sid=$sid");
}
if($thread['readperm'] && $thread['readperm'] > $readaccess && !$forum['ismoderator'] && $thread['authorid'] != $discuz_uid) {
showmessage('thread_nopermission', NULL, 'NOPERM');
}
$threadpay = FALSE;
if($thread['price'] > 0 && $thread['special'] == 0) {
if($maxchargespan && $timestamp - $thread['dateline'] >= $maxchargespan * 3600) {
$db->query("UPDATE {$tablepre}threads SET price='0' WHERE tid='$tid'");
$thread['price'] = 0;
} else {
if(!$discuz_uid) {
showmessage('group_nopermission', NULL, 'NOPERM');
}
$exemptvalue = $forum['ismoderator'] ? 128 : 16;
if(!($exempt & $exemptvalue) && $thread['authorid'] != $discuz_uid) {
$query = $db->query("SELECT tid FROM {$tablepre}paymentlog WHERE tid='$tid' AND uid='$discuz_uid'");
if(!$db->num_rows($query)) {
require_once DISCUZ_ROOT.'./include/threadpay.inc.php';
$threadpay = TRUE;
}
}
}
}
$forum['modrecommend'] = $forum['modrecommend'] ? unserialize($forum['modrecommend']) : array();
$raterange = $modratelimit && $adminid == 3 && !$forum['ismoderator'] ? array() : $raterange;
$extra = rawurlencode($extra);
$allowgetattach = !empty($forum['allowgetattach']) || ($allowgetattach && !$forum['getattachperm']) || forumperm($forum['getattachperm']);
$postlist = $attachtags = $attachlist = array();
$attachpids = $announcepm = 0;
$smile = isset($_DCOOKIE['smile']) ? explode('D', $_DCOOKIE['smile']) : array();
$stypeid = intval(!empty($stypeid) ? $stypeid : ($smile[3] != $styleid ? STYPEID : $smile[0]));
$stypeid = isset($_DCACHE['smileytypes'][$stypeid]) ? $stypeid : (isset($_DCACHE['smileytypes'][STYPEID]) ? STYPEID : key($_DCACHE['smileytypes']));
$smilies = $_DCACHE['smilies_display'][$stypeid];
$scrollt = intval(!empty($scrollt) ? $scrollt : $smile[2]);
$sm_page = (!isset($_GET['stypeid']) || $_GET['stypeid'] == $smile[0] ? $smile[1] : 1);
$spp = $smcols * $smrows;
$sm_multipage = multi(count($smilies), $spp, $sm_page, 'post.php?action=smilies&stypeid='.$stypeid.'&inajax=1&scrollt='.$scrollt, 0, 10, FALSE, TRUE);
$smilies = arrayslice($smilies, $spp * ($sm_page - 1), $spp);
dsetcookie('smile', $stypeid.'D'.$sm_page.'D'.$scrollt.'D'.$styleid, 86400 * 365);
if(empty($action) && $tid) {
$thisgid = $forum['type'] == 'forum' ? $forum['fup'] : $_DCACHE['forums'][$forum['fup']]['fup'];
$lastmod = $thread['moderated'] ? viewthread_lastmod() : array();
$showsettings = str_pad(decbin($showsettings), 3, '0', STR_PAD_LEFT);
$customshow = $discuz_uid ? str_pad(base_convert($customshow, 10, 3), 3, '0', STR_PAD_LEFT) : '222';
$showsignatures = $customshow{0} == 2 ? $showsettings{0} : $customshow{0};
$showavatars = $customshow{1} == 2 ? $showsettings{1} : $customshow{1};
$showimages = $customshow{2} == 2 ? $showsettings{2} : $customshow{2};
$highlightstatus = isset($highlight) && str_replace('+', '', $highlight) ? 1 : 0;
$usesigcheck = $discuz_uid && $sigstatus ? 'checked="checked"' : '';
$allowpostreply = ($forum['allowreply'] != -1) && ((!$thread['closed'] && !checkautoclose()) || $forum['ismoderator']) && ((!$forum['replyperm'] && $allowreply) || ($forum['replyperm'] && forumperm($forum['replyperm'])) || $forum['allowreply']);
$allowpost = $forum['allowpost'] != -1 && ((!$forum['postperm'] && $allowpost) || ($forum['postperm'] && forumperm($forum['postperm'])) || $forum['allowpost']);
$addfeedcheck = $customaddfeed & 4 ? 'checked="checked"': '';
if($allowpost) {
$allowpostpoll = $allowpostpoll && ($forum['allowpostspecial'] & 1);
$allowposttrade = $allowposttrade && ($forum['allowpostspecial'] & 2);
$allowpostreward = $allowpostreward && ($forum['allowpostspecial'] & 4) && isset($extcredits[$creditstrans]);
$allowpostactivity = $allowpostactivity && ($forum['allowpostspecial'] & 8);
$allowpostdebate = $allowpostdebate && ($forum['allowpostspecial'] & 16);
$allowpostvideo = $allowpostvideo && ($forum['allowpostspecial'] & 32) && $videoopen;
} else {
$allowpostpoll = $allowposttrade = $allowpostreward = $allowpostactivity = $allowpostdebate = $allowpostvideo = FALSE;
}
$visitedforums = $visitedforums ? visitedforums() : '';
$forumselect = $forummenu = '';
$forumselect = $forummenu = '';
if($forumjump) {
if($jsmenu[1]) {
$forummenu = forumselect(FALSE, 1);
} else {
$forumselect = forumselect(FALSE, 1);
}
}
$relatedthreadlist = array();
$relatedthreadupdate = $tagupdate = FALSE;
$relatedkeywords = $tradekeywords = $metakeywords = $firstpid = '';
$randnum = $qihoo['relate']['webnum'] ? rand(1, 1000) : '';
$statsdata = !empty($statsdata) ? dhtmlspecialchars($statsdata) : '';
if($qihoo['relate']['bbsnum'] || $insenz['topicrelatedad'] || ($insenz['traderelatedad'] && $thread['special'] == 2)) {
$site = site();
$query = $db->query("SELECT type, expiration, keywords, relatedthreads FROM {$tablepre}relatedthreads WHERE tid='$tid'");
if($db->num_rows($query)) {
while($related = $db->fetch_array($query)) {
if($related['expiration'] <= $timestamp) {
$relatedthreadupdate = TRUE;
$qihoo_up = 1;
} elseif($qihoo['relate']['bbsnum'] && $related['type'] == 'general') {
$relatedthreadlist = unserialize($related['relatedthreads']);
if($related['keywords']) {
$keywords = str_replace("\t", ' ', $related['keywords']);
$searchkeywords = rawurlencode($keywords);
$statskeywords = urlencode($keywords);
$statsurl = urlencode($boardurl.'viewthread.php?tid='.$tid);
foreach(explode("\t", $related['keywords']) as $keyword) {
$relatedkeywords .= $keyword ? '<a href="http://www.qihoo.com/wenda.php?kw='.rawurlencode($keyword).'&do=search&noq=q" target="_blank">'.$keyword.'</a> ' : '';
$metakeywords .= $keyword ? $keyword.',' : '';
}
}
} elseif($related['type'] == 'trade') {
$tradekeywords = explode("\t", $related['keywords']);
$tradekeywords = $tradekeywords[array_rand($tradekeywords)];
}
}
} else {
$relatedthreadupdate = TRUE;
$qihoo_up = 0;
}
$relatedthreadupdate && $verifykey = md5($authkey.$tid.$thread['subjectenc'].$charset.$site);
}
$relatedthreads = array();
if(!empty($relatedthreadlist)) {
if(!isset($_COOKIE['discuz_collapse']) || strpos($_COOKIE['discuz_collapse'], 'relatedthreads') === FALSE) {
$relatedthreads['img'] = 'collapsed_no.gif';
$relatedthreads['style'] = '';
} else {
$relatedthreads['img'] = 'collapsed_yes.gif';
$relatedthreads['style'] = 'display: none';
}
}
$threadtag = array();
if($tagstatus) {
$query = $db->query("SELECT tagname FROM {$tablepre}threadtags WHERE tid='$tid'");
$thread['tags'] = '';
while($tags = $db->fetch_array($query)) {
$metakeywords .= $tags['tagname'].',';
$thread['tags'] .= '<a href="tag.php?name='.rawurlencode($tags['tagname']).'" target="_blank">'.$tags['tagname'].'</a> ';
}
if($tagstatus == 2 && !$thread['tags'] || $relatedthreadupdate) {
$tagupdate = TRUE;
}
$relatedthreadupdate && $thread['tagsenc'] = rawurlencode(strip_tags($thread['tags']));
}
viewthread_updateviews();
@extract($_DCACHE['custominfo']);
$infosidestatus['posts'] = $infosidestatus[1] && isset($infosidestatus['f'.$fid]['posts']) ? $infosidestatus['f'.$fid]['posts'] : $infosidestatus['posts'];
$infoside = $infosidestatus[1] && $thread['replies'] > $infosidestatus['posts'];
if($thread['special'] > 0) {
$thread['starttime'] = gmdate("$dateformat $timeformat", $thread['dateline'] + $timeoffset * 3600);
$thread['remaintime'] = '';
if(!empty($do) && $do == 'viewspecialpost') {
include_once DISCUZ_ROOT.'./include/viewthread_special.inc.php';
} else {
switch($thread['special']) {
case 1: include_once DISCUZ_ROOT.'./include/viewthread_poll.inc.php'; break;
case 2: include_once DISCUZ_ROOT.'./include/viewthread_trade.inc.php'; break;
case 3: include_once DISCUZ_ROOT.'./include/viewthread_reward.inc.php'; break;
case 4: include_once DISCUZ_ROOT.'./include/viewthread_activity.inc.php'; break;
case 5: include_once DISCUZ_ROOT.'./include/viewthread_debate.inc.php'; break;
case 6: include_once DISCUZ_ROOT.'./include/viewthread_video.inc.php'; break;
}
}
}
$onlyauthoradd = '';
$authorid = intval($authorid);
if($authorid) {
$thread['replies'] = $db->result_first("SELECT COUNT(*) FROM {$tablepre}posts WHERE tid='$tid' AND invisible='0' AND authorid='$authorid' AND anonymous='0'") - 1;
if($thread['replies'] < 0) {
showmessage('undefined_action');
}
$onlyauthoradd = "AND p.authorid='$authorid' AND p.anonymous='0'";
};
$ppp = $forum['threadcaches'] && !$discuz_uid ? $_DCACHE['settings']['postperpage'] : $ppp;
$totalpage = ceil(($thread['replies'] + 1) / $ppp);
$page > $totalpage && $page = $totalpage;
$pagebydesc = $page > 50 && $page > ($totalpage / 2) ? TRUE : FALSE;
if($pagebydesc) {
$firstpagesize = ($thread['replies'] + 1) % $ppp;
$ppp3 = $ppp2 = $page == $totalpage && $firstpagesize ? $firstpagesize : $ppp;
$realpage = $totalpage - $page + 1;
$start_limit = max(0, ($realpage - 2) * $ppp + $firstpagesize);
$numpost = ($page - 1) * $ppp;
$pageadd = "ORDER BY dateline DESC LIMIT $start_limit, $ppp2";
} else {
$start_limit = $numpost = ($page - 1) * $ppp;
if($start_limit > $thread['replies']) {
$start_limit = $numpost = 0;
$page = 1;
}
$pageadd = "ORDER BY dateline LIMIT $start_limit, $ppp";
}
$multipage = multi($thread['replies'] + 1, $ppp, $page, "viewthread.php?tid=$tid&extra=$extra".(isset($highlight) ? "&highlight=".rawurlencode($highlight) : '').(!empty($authorid) ? "&authorid=$authorid" : ''));
$newpostanchor = $postcount = $ratelogpids = 0;
$onlineauthors = array();
$query = $db->query("SELECT p.*, m.uid, m.username, m.groupid, m.adminid, m.regdate, m.lastactivity, m.posts, m.digestposts, m.oltime,
m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5, m.extcredits6,
m.extcredits7, m.extcredits8, m.email, m.gender, m.showemail, m.invisible, mf.nickname, mf.site,
mf.icq, mf.qq, mf.yahoo, mf.msn, mf.taobao, mf.alipay, mf.location, mf.medals, mf.avatar, mf.avatarwidth, mf.avatarheight,
mf.sightml AS signature, mf.customstatus, mf.spacename $fieldsadd
FROM {$tablepre}posts p
LEFT JOIN {$tablepre}members m ON m.uid=p.authorid
LEFT JOIN {$tablepre}memberfields mf ON mf.uid=m.uid
WHERE p.tid='$tid' AND p.invisible='0' $onlyauthoradd $pageadd");
while($post = $db->fetch_array($query)) {
$postlist[$post['pid']] = viewthread_procpost($post);
}
if($pagebydesc) {
$postlist = array_reverse($postlist, TRUE);
}
if($vtonlinestatus == 2 && $onlineauthors) {
$query = $db->query("SELECT uid FROM {$tablepre}sessions WHERE uid IN(".(implode(',', $onlineauthors)).") AND invisible=0");
$onlineauthors = array();
while($author = $db->fetch_array($query)) {
$onlineauthors[$author['uid']] = 1;
}
} else {
$onlineauthors = array();
}
if($ratelogpids) {
$query = $db->query("SELECT * FROM {$tablepre}ratelog WHERE pid IN ($ratelogpids) ORDER BY dateline DESC");
while($ratelog = $db->fetch_array($query)) {
if(count($postlist[$ratelog['pid']]['ratelog']) < $ratelogrecord) {
$ratelog['dateline'] = gmdate("$dateformat $timeformat", $ratelog['dateline'] + $timeoffset * 3600);
$ratelog['score'] = $ratelog['score'] > 0 ? '+'.$ratelog['score'] : $ratelog['score'];
$ratelog['reason'] = dhtmlspecialchars($ratelog['reason']);
$postlist[$ratelog['pid']]['ratelog'][] = $ratelog;
}
}
}
if($attachpids) {
require_once DISCUZ_ROOT.'./include/attachment.func.php';
parseattach($attachpids, $attachtags, $postlist, $showimages);
}
if(empty($postlist)) {
showmessage('undefined_action', NULL, 'HALTED');
} else {
$seodescription = current($postlist);
$seodescription = cutstr(htmlspecialchars(strip_tags($seodescription['message'])), 150);
}
viewthread_parsetags();
include template('viewthread');
} elseif($action == 'printable' && $tid) {
require_once DISCUZ_ROOT.'./include/printable.inc.php';
}
function viewthread_updateviews() {
global $delayviewcount, $timestamp, $tablepre, $tid, $db, $adminid;
global $thread, $do;
if($thread['special'] && !$do) {
return NULL;
}
if($delayviewcount == 1 || $delayviewcount == 3) {
$logfile = './forumdata/cache/cache_threadviews.log';
if(substr($timestamp, -2) == '00') {
require_once DISCUZ_ROOT.'./include/misc.func.php';
updateviews('threads', 'tid', 'views', $logfile);
}
if(@$fp = fopen(DISCUZ_ROOT.$logfile, 'a')) {
fwrite($fp, "$tid\n");
fclose($fp);
} elseif($adminid == 1) {
showmessage('view_log_invalid');
}
} else {
$db->query("UPDATE LOW_PRIORITY {$tablepre}threads SET views=views+1 WHERE tid='$tid'", 'UNBUFFERED');
}
}
function viewthread_procpost($post, $special = 0) {
global $_DCACHE, $newpostanchor, $numpost, $thisbg, $postcount, $ratelogpids, $onlineauthors, $lastvisit, $thread,
$attachpids, $attachtags, $forum, $dateformat, $timeformat, $timeoffset, $userstatusby, $allowgetattach,
$ratelogrecord, $showimages, $forum, $discuz_uid, $showavatars, $pagebydesc, $ppp, $ppp2, $ppp3,
$firstpid, $videoopen, $threadpay;
if(!$newpostanchor && $post['dateline'] > $lastvisit) {
$post['newpostanchor'] = '<a name="newpost"></a>';
$newpostanchor = 1;
} else {
$post['newpostanchor'] = '';
}
$post['lastpostanchor'] = $numpost == $thread['replies'] ? '<a name="lastpost"></a>' : '';
if($pagebydesc) {
$post['number'] = $numpost + $ppp2--;
$post['count'] = $ppp == $ppp3 ? $ppp - $postcount - 1 : $ppp3 - $postcount - 1;
} else {
$post['number'] = ++$numpost;
$post['count'] = $postcount;
}
$postcount++;
$post['dbdateline'] = $post['dateline'];
$post['dateline'] = gmdate("$dateformat $timeformat", $post['dateline'] + $timeoffset * 3600);
$post['groupid'] = $_DCACHE['usergroups'][$post['groupid']] ? $post['groupid'] : 7;
if($post['username']) {
$onlineauthors[] = $post['authorid'];
$post['usernameenc'] = rawurlencode($post['username']);
!$special && $post['groupid'] = getgroupid($post['authorid'], $_DCACHE['usergroups'][$post['groupid']], $post);
$post['readaccess'] = $_DCACHE['usergroups'][$post['groupid']]['readaccess'];
if($_DCACHE['usergroups'][$post['groupid']]['userstatusby'] == 1) {
$post['authortitle'] = $_DCACHE['usergroups'][$post['groupid']]['grouptitle'];
$post['stars'] = $_DCACHE['usergroups'][$post['groupid']]['stars'];
} elseif($_DCACHE['usergroups'][$post['groupid']]['userstatusby'] == 2) {
foreach($_DCACHE['ranks'] as $rank) {
if($post['posts'] > $rank['postshigher']) {
$post['authortitle'] = $rank['ranktitle'];
$post['stars'] = $rank['stars'];
break;
}
}
}
$post['taobaoas'] = addslashes($post['taobao']);
$post['authoras'] = !$post['anonymous'] ? ' '.addslashes($post['author']) : '';
$post['regdate'] = gmdate($dateformat, $post['regdate'] + $timeoffset * 3600);
$post['lastdate'] = gmdate($dateformat, $post['lastactivity'] + $timeoffset * 3600);
if($post['medals']) {
@include_once DISCUZ_ROOT.'./forumdata/cache/cache_medals.php';
foreach($post['medals'] = explode("\t", $post['medals']) as $key => $medalid) {
list($medalid, $medalexpiration) = explode("|", $medalid);
if(isset($_DCACHE['medals'][$medalid]) && (!$medalexpiration || $medalexpiration > $timestamp)) {
$post['medals'][$key] = $_DCACHE['medals'][$medalid];
} else {
unset($post['medals'][$key]);
}
}
}
if($showavatars) {
if($post['avatarwidth'] && $post['avatarheight']){
$post['avatar'] = "<div class=\"avatar\"><img src=\"$post[avatar]\" width=\"$post[avatarwidth]\" height=\"$post[avatarheight]\" />";
} else {
$post['avatar'] = '<div class="avatar"><img src="'.discuz_uc_avatar($post['authorid']).'" />';
if($_DCACHE['usergroups'][$post['groupid']]['groupavatar']) {
$post['avatar'] .= '<br /><img src="'.$_DCACHE['usergroups'][$post['groupid']]['groupavatar'].'" border="0" alt="" />';
}
}
$post['avatar'] .= '</div>';
} else {
$post['avatar'] = '';
}
$post['banned'] = $post['status'] & 1;
$post['warned'] = $post['status'] & 2;
} else {
if(!$post['authorid']) {
$post['useip'] = substr($post['useip'], 0, strrpos($post['useip'], '.')).'.x';
}
}
$post['attachments'] = array();
if($post['attachment']) {
if($allowgetattach && !$threadpay) {
$attachpids .= ",$post[pid]";
$post['attachment'] = 0;
if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $post['message'], $matchaids)) {
$attachtags[$post['pid']] = $matchaids[1];
}
} else {
$post['message'] = preg_replace("/\[attach\](\d+)\[\/attach\]/i", '', $post['message']);
}
}
$ratelogpids .= ($ratelogrecord && $post['ratetimes']) ? ','.$post['pid'] : '';
$forum['allowbbcode'] = $forum['allowbbcode'] ? ($_DCACHE['usergroups'][$post['groupid']]['allowcusbbcode'] ? 2 : 1) : 0;
$post['ratings'] = karmaimg($post['rate'], $post['ratetimes']);
$post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $forum['allowsmilies'], $forum['allowbbcode'], ($forum['allowimgcode'] && $showimages ? 1 : 0), $forum['allowhtml'], ($forum['jammer'] && $post['authorid'] != $discuz_uid ? 1 : 0), 0, $post['authorid'], $forum['allowmediacode'], $post['pid']);
$videoopen && $post['message'] = videocode($post['message'], $post['tid'], $post['pid']);
$post['signature'] = $post['usesig'] ? $post['signature'] : '';
$post['first'] && $firstpid = $post['pid'];
return $post;
}
function showoption($var, $type) {
global $optionlist;
if($optionlist[$var][$type]) {
return $optionlist[$var][$type];
} else {
return 'none';
}
}
function viewthread_loadcache() {
global $tid, $forum, $thread, $timestamp, $cachethreadlife, $_DCACHE, $gzipcompress, $debug, $styleid;
$forum['livedays'] = ceil(($timestamp - $forum['dateline']) / 86400);
$forum['lastpostdays'] = ceil(($timestamp - $forum['lastthreadpost']) / 86400);
$threadcachemark = 100 - (
$thread['displayorder'] * 15 +
$thread['digest'] * 10 +
min($thread['views'] / max($forum['livedays'], 10) * 2, 50) +
max(-10, (15 - $forum['lastpostdays'])) +
min($thread['replies'] / $_DCACHE['settings']['postperpage'] * 1.5, 15));
if($threadcachemark < $forum['threadcaches']) {
$threadcache = getcacheinfo($tid);
if($timestamp - $threadcache['filemtime'] > $cachethreadlife) {
@unlink($threadcache['filename']);
define('CACHE_FILE', $threadcache['filename']);
$styleid = $_DCACHE['settings']['styleid'];
@include DISCUZ_ROOT.'./forumdata/cache/style_'.$styleid.'.php';
} else {
readfile($threadcache['filename']);
viewthread_updateviews();
$debug && debuginfo();
$debug ? die('<script type="text/javascript">document.getElementById("debuginfo").innerHTML = " '.($debug ? 'Updated at '.gmdate("H:i:s", $threadcache['filemtime'] + 3600 * 8).', Processed in '.$debuginfo['time'].' second(s), '.$debuginfo['queries'].' Queries'.($gzipcompress ? ', Gzip enabled' : '') : '').'";</script>') : die();
}
}
}
function viewthread_lastmod() {
global $db, $tablepre, $dateformat, $timeformat, $timeoffset, $tid;
if($lastmod = $db->fetch_first("SELECT uid AS moduid, username AS modusername, dateline AS moddateline, action AS modaction, magicid
FROM {$tablepre}threadsmod
WHERE tid='$tid' ORDER BY dateline DESC LIMIT 1")) {
include language('modactions');
$lastmod['modusername'] = $lastmod['modusername'] ? $lastmod['modusername'] : 'System';
$lastmod['moddateline'] = gmdate("$dateformat $timeformat", $lastmod['moddateline'] + $timeoffset * 3600);
$lastmod['modaction'] = $modactioncode[$lastmod['modaction']];
if($lastmod['magicid']) {
require_once DISCUZ_ROOT.'./forumdata/cache/cache_magics.php';
$lastmod['magicname'] = $_DCACHE['magics'][$lastmod['magicid']]['name'];
}
} else {
$db->query("UPDATE {$tablepre}threads SET moderated='0' WHERE tid='$tid'", 'UNBUFFERED');
}
return $lastmod;
}
function viewthread_parsetags() {
global $tagstatus, $_DCACHE, $firstpid, $postlist, $forum, $tagscript;
if($firstpid && $tagstatus && $forum['allowtag'] && !($postlist[$firstpid]['htmlon'] & 2) && !empty($_DCACHE['tags'])) {
$tagscript = '<script type="text/javascript">var tagarray = '.$GLOBALS['_DCACHE']['tags'][0].';var tagencarray = '.$GLOBALS['_DCACHE']['tags'][1].';parsetag('.$firstpid.');</script>';
}
}
function remaintime($time) {
$seconds = $time % 60;
$minutes = $time % 3600 / 60;
$hours = $time % 86400 / 3600;
$days = $time / 86400;
return array((int)$days, (int)$hours, (int)$minutes, (int)$seconds);
}
function arrayslice($array, $offset, $length) {
if(PHP_VERSION >= '5.0.2') {
return array_slice($array, $offset, $length, TRUE);
} else {
$array = array_chunk($array, $length, TRUE);
return $array[$offset / $length];
}
}
?>
AL8 Forum © All rights reserved.
aoifhvul
0085086
頭銜: Member
帖子: 59
精華: 0
積分: 550 點
現金: 0 元
存款: 100 元
閱讀權限: 15
註冊: 2007-8-22
狀態: 離線
#5
大
中
小
發表於 2008-6-2 17:22
資料
個人空間
短消息
加為好友
看起來不錯!
先支持...收藏
AL8 Forum © All rights reserved.
Soya
0070881
頭銜: Lord
帖子: 547
精華: 0
積分: 5000 點
現金: 0 元
存款: 9 元
閱讀權限: 25
註冊: 2007-3-23
狀態: 離線
#6
大
中
小
發表於 2008-6-2 19:33
資料
個人空間
短消息
加為好友
thx
支持一下
AL8 Forum © All rights reserved.
tomy49hk
0000291
頭銜: Newbie
帖子: 27
精華: 0
積分: 330 點
現金: 84 元
存款: 124 元
閱讀權限: 10
註冊: 2004-2-1
狀態: 離線
#7
大
中
小
發表於 2008-6-7 02:30
資料
個人空間
短消息
加為好友
D6.1 0606
請把
$post['avatar'] = '<div class="avatar"><img src="'.discuz_uc_avatar($post['authorid']).'" />';
改成
$post['avatar'] = '<div class="avatar">'.discuz_uc_avatar($post['authorid']);
AL8 Forum © All rights reserved.
ctt19870711
0103163
頭銜: Newbie
帖子: 10
精華: 0
積分: 150 點
現金: 100 元
存款: 0 元
閱讀權限: 10
註冊: 2008-6-14
狀態: 離線
#8
大
中
小
發表於 2008-6-16 15:30
資料
個人空間
短消息
加為好友
有修改成功 但是
1. 需要設定圖片大小 才會顯示 弱沒設定 他不會自動跑出圖片 這問題倒是比較不大
2. 若是已經有上傳頭像的 即使有外連頭像網址 依然是顯示上傳的那個圖片 而不會顯示外連的
不曉得要怎麼移除掉上傳的那個頭像
大大能幫我解答嗎 感激 ^^
AL8 Forum © All rights reserved.
ctt19870711
0103163
頭銜: Newbie
帖子: 10
精華: 0
積分: 150 點
現金: 100 元
存款: 0 元
閱讀權限: 10
註冊: 2008-6-14
狀態: 離線
#9
大
中
小
發表於 2008-6-16 15:47
資料
個人空間
短消息
加為好友
阿 抱歉 第二個問題 我重新修改就解決了 應該是剛剛代碼沒有貼好
不過這功能是不是 上傳圖片和外連 同時使用的話 會優先顯示外連的 ?
不過能顯示圖太圖片就很感激了^^
AL8 Forum © All rights reserved.
vr004
0095734
頭銜: Newbie
帖子: 3
精華: 0