|
一个上午查看了多个文件,包括相关函数的定义方法和数据库查询语句等, reply.htm - <div class="post_content">
- <a href="index.php?a=myhome&uid=$ht[authorid]" class="zuoze">$ht[author]</a> $ht[content]<br />
- $ht[aidimgs]</div>
- <div class="section"><a href="index.php?a=myhome&uid=$ht[authorid]">$ht[author]</a>回帖于$ht[postdate]</div>
- …………
- if($nextr['pid'] != 0){print <<<EOT
- -->
- <a href="index.php?a=reply&tid=$tid&pid=$nextr[pid]">下一楼»</a>:$nextr[content]<span class="post_author">(<a href="index.php?a=myhome&uid=$nextr[authorid]">$nextr[author]</a>)</span><br />
- <!--
- EOT;
- }
- if($prer['pid'] != 0){print <<<EOT
- -->
- <a href="index.php?a=reply&tid=$tid&pid=$prer[pid]">«上一楼</a>:$prer[content]<span class="post_author">(<a href="index.php?a=myhome&uid=$prer[authorid]">$prer[author]</a>)</span>
第4行 $ht[author],第8行 $nextr[author],第14行 $prer[author],再看 reply.php- $ht = viewOneReply ( $tid, $pid ,$rt ['ptable'] );
- $nextr = nextReply ( $tid, $pid, $rt ['ptable'], 1 );
- $prer = nextReply ( $tid, $pid, $rt ['ptable'], - 1 );
再看viewOneReply和nextReply函数,在 threadfunction.php文件里 - function viewOneReply($tid, $pid, $ptable) {
- global $db, $db_waplimit, $c_page,$db_anonymousname,$pwAnonyHide,$winduid;
- $pw_posts = GetPtable ( $ptable );
- $sql = "SELECT pid,subject,author,authorid,content,postdate,anonymous,aid FROM $pw_posts WHERE pid=" . pwEscape ( $pid );
- $ct = $db->get_one ( $sql );
- if ($ct) {
- $ct ['subject'] = str_replace ( ' ', '', wap_cv ( $ct ['subject'] ) );
- $content = viewContent ( $ct ['content'] );
- $yxqw = "";
- function nextReply($tid, $pid, $ptable, $order) {
- global $db;
- $pw_posts = GetPtable ( $ptable );
- if ($order == 1) {
- $sql = "SELECT pid,content,author,authorid,content,postdate,anonymous FROM $pw_posts WHERE tid=" . pwEscape ( $tid ) . " AND ifcheck=1 and pid>" . pwEscape ( $pid ) . " ORDER BY postdate limit 1";
- } else {
- $sql = "SELECT pid,subject,author,authorid,content,postdate,anonymous FROM $pw_posts WHERE tid=" . pwEscape ( $tid ) . " AND ifcheck=1 and pid<" . pwEscape ( $pid ) . " ORDER BY postdate desc limit 1";
- }
- $ct = $db->get_one ( $sql );
- if ($ct) {
- $ct ['content'] = replySubject ( $ct ['content'] );
- } else {
- $ct = array ("pid" => 0, "content" => "" );
- }
- return $ct;
- }
终于在主题阅读面read.php文件中发现了有价值的代码: $rt['author'] = $rt['anonymous'] ? $db_anonymousname : $rt['author'];也许这正是我想要的!只要把匿名作者格式化成后台设置的匿名名称(匿名)或者直接显示为空就可以了。于是,稍微修改后在上面reply.php代码的后面添加: - $nextr['author'] = $nextr['anonymous'] ? $db_anonymousname : $nextr['author'];
匿名作者就显示为“匿名”了,不过空间链接地址还是真实作者的,所以同样的需要格式化下(指定uid=0): - $nextr['authorid'] = $nextr['anonymous'] ? '0' : $nextr['authorid'];
[ 此帖被zhangjingyu在2016-11-08 13:17重新编辑 ]
|