user-pic

[求助]老大~!看看这个呀~!我修改老出错~!

Vote 0 Votes



老大~!看看这个呀~!我修改老出错~!

首頁顯示最新的精華文章 最新文章 最新回覆

——————以下内容由Tsefai在2005年08月30日 06:59pm时添加———————



############################################
#
# 首頁顯示最新的精華文章/最新文章/最新回覆 V 1.4 Final
#
# 作者:tsefai
#
#
############################################
#
# 使用方法:
#
# 注:為了安全起見,進行修改前請先備份有關的檔案!
#
############################################

1. 開啟 leobbs.cgi

找到
代码:
--------------------------------------------------------------------------------
$output .= qq~$todaypostlist
</td></tr></form></table></td></tr></table>
<SCRIPT LANGUAGE="javascript">
function surfto(list) { var myindex1 = list.selectedIndex; var newwindow = list.options[myindex1].value; if (newwindow != "") { var msgwindow = window.open("profile.cgi?action=show&member="+newwindow,"",""); }}
</SCRIPT>
~;



加上
代码:
--------------------------------------------------------------------------------
### 首頁顯示最新精華/最新文章/最新回覆 S
$output .= qq~
<br>
<SCRIPT>valigntop()</SCRIPT>
<table cellpadding=0 cellspacing=0 width=$tablewidth bgcolor=$tablebordercolor align=center>
<tr><td><table cellspacing=1 cellpadding=6 width=100%>
<tr>
<td bgcolor=$titlecolor align=center width=33% $catbackpic><font color=$catfontcolor><b>精華文章 10</b></font></td>
<td bgcolor=$titlecolor align=center width=34% $catbackpic><font color=$catfontcolor><b>最新文章 10</b></font></td>
<td bgcolor=$titlecolor align=center width=33% $catbackpic><font color=$catfontcolor><b>最新回覆 10</b></font></td>
</tr>
<tr>
<td bgcolor=$miscbackone width=33%>~;eval{ require "${lbdir}data/recentjinghua.pl"; }; $output.=qq~$alljh</td>
<td bgcolor=$miscbackone width=34%>~;eval{ require "${lbdir}data/recentpost.pl"; }; $output.=qq~$allnew</td>
<td bgcolor=$miscbackone width=33%>~;eval{ require "${lbdir}data/recentreply.pl"; }; $output.=qq~$allreply</td>
</tr>
</table>
</td></tr></table>
~;
### 首頁顯示最新精華/最新文章/最新回覆 E






2. 開啟 doaddnewtopic.pl

找到
代码:
--------------------------------------------------------------------------------
$recentposts=@recentposts;
 $maxpostreport = 31;
 if ($recentposts<$maxpostreport) { $maxpostreport=$recentposts;} else { $maxpostreport--; }
 
 if (open (FILE, ">$filetomakeopen")) {
flock (FILE, 2) if ($OS_USED eq "Unix");
print FILE "$inforum\t$newthreadnumber\t$intopictitletemp\t$currenttime\t$inposticon\t$inmembername\t\n";
for ($i=0;$i<$maxpostreport;$i++) { print FILE $recentposts[$i]; }
close(FILE);
 }
 &winunlock($filetomakeopen) if ($OS_USED eq "Nt");
} else {
       if (open (FILE, ">$filetomakeopen")) {
   print FILE "$inforum\t$newthreadnumber\t$intopictitletemp\t$currenttime\t$inposticon\t$inmembername\t\n";
   close(FILE);
       }
}
 }
 else {
 unlink ("$filetoopens.lck") if ((-M "$filetoopens.lck") *86400 > 30);
 }
}



改為
代码:
--------------------------------------------------------------------------------
### 首頁顯示最新文章 S
 $recentposts=@recentposts;
 $maxpostreport = 31;
 if ($recentposts<$maxpostreport) { $maxpostreport=$recentposts;} else { $maxpostreport--; }

 $topictitle3 = "$intopictitletemp";
 $topictitle3 =~ s/~/\.\./g;
 $topictitle3 =~ s/\'/\`/;
 $topictitle3 =~ s/\&/\&/g;
 $topictitle3 =~ s/\&\#/\&\#/isg;
 $topictitle3 =~ s/\&\;(.{1,6})\&\#59\;/\&$1\;/isg;
 $topictitle3 =~ s/\&\#(Ύ-9]{1,6})\&\#59\;/\&\#$1\;/isg;
 $topictitle3 =~ s/\"/\"/g;
 $topictitle3 =~ s/</\</g;
 $topictitle3 =~ s/>/\>/g;
 $topictitle3 =~ s/ /\ /g;

 $topictitle2=&lbhz("$topictitle3",25);

    $postdate = $currenttime;
    $postdate = &shortdate($postdate+$addtimes);
    if (open (FILE, ">$filetomakeopen")) {
        $topictitle2 =~ s/~/\.\./g;
        open(PSF2,">$lbdir/data/recentpost.pl");
        print PSF2 "\$allnew=qq~<ol>";
        flock (FILE, 2) if ($OS_USED eq "Unix");
        print FILE "$inforum\t$newthreadnumber\t$topictitle2\t$currenttime\t\t$inmembername\t$topictitle3\t\n";
        print PSF2 "<li><a href=topic.cgi?forum=$inforum&topic=$newthreadnumber target=_blank title='主題:$topictitle3\n作者:$membername\n發表時間:$postdate'>$topictitle2</a> $inmembername<font color=red> $postdate</font></li>";
        for ($i=0;$i<9;$i++) {
            if ($recentposts[$i] ne '') {
               my ($d1,$d2,$d3,$d4,$no,$d5,$d6)=split(/\t/,$recentposts[$i]);
               $d4 = &shortdate($d4+$addtimes);
               print PSF2 "<li><a href=topic.cgi?forum=$d1&topic=$d2 target=_blank title='主題:$d6\n作者:$d5\n發表時間:$d4'>$d3</a> $d5 <font color=red> $d4</font></li>";
               print FILE $recentposts[$i];
            }
        }
        print PSF2 "</ol>~;\n1;";
        close(PSF2);
        close(FILE);
    }
    &winunlock($filetomakeopen) if ($OS_USED eq "Nt");
 } else {
       if (open (FILE, ">$filetomakeopen")) {
          print FILE "$inforum\t$newthreadnumber\t$topictitle2\t$currenttime\t$inposticon\t$inmembername\t\n";
          close(FILE);
       }
 }
 }
 else {
 unlink ("$filetoopens.lck") if ((-M "$filetoopens.lck") *86400 > 30);
 }
}
### 首頁顯示最新文章 E




3. 開啟 dotopicreply.pl

找到
代码:
--------------------------------------------------------------------------------
   my $nowtime = &shortdate($currenttime + $timezone*3600);

  my $filetoopens = "$lbdir/data/todaypost.cgi";
  $filetoopens = &lockfilename($filetoopens);



上面加上
代码:
--------------------------------------------------------------------------------
### 首頁顯示最新回覆 S
if ($privateforum ne "yes") {
  $filetomakeopen = "$lbdir" . "data/recentreply.cgi";
  my $filetoopens = &lockfilename($filetomakeopen);
  if (!(-e "$filetoopens.lck")) {
if (-e $filetomakeopen) {
  &winlock($filetomakeopen) if ($OS_USED eq "Nt");
  open(FILE, "$filetomakeopen");
  flock (FILE, 1) if ($OS_USED eq "Unix");
  my @recentreplys=<FILE>;
  close(FILE);

  if (($membercode ne "ad")&&($membercode ne "smo")&&($membercode ne "cmo")&&($membercode ne "mo")&&($membercode ne "amo")&&($membercode !~ /^rz/)) {
      foreach (@recentreplys) {
  (my $no,$no,my $temptopic,$no,$no,my $tempmembername) = split(/\t/,$_);
  $temptopic =~ s/^*#!&*//;
  $checknumber ++ if (($intopictitletemp eq $temptopic)&&(lc($tempmembername) eq lc($inmembername)));
      }
  }

 $recentreplys=@recentreplys;

 $topictitle3 = "$topictitletemp";
 $topictitle3 =~ s/~/\.\./g;
 $topictitle3 =~ s/\'/\`/;
 $topictitle3 =~ s/\&/\&/g;
 $topictitle3 =~ s/\&\#/\&\#/isg;
 $topictitle3 =~ s/\&\;(.{1,6})\&\#59\;/\&$1\;/isg;
 $topictitle3 =~ s/\&\#(Ύ-9]{1,6})\&\#59\;/\&\#$1\;/isg;
 $topictitle3 =~ s/\"/\"/g;
 $topictitle3 =~ s/</\</g;
 $topictitle3 =~ s/>/\>/g;
 $topictitle3 =~ s/ /\ /g;

 $topictitle2=&lbhz("$topictitle3",25);

    $postdate = $currenttime;
    $postdate = &shortdate($postdate+$addtimes);
    if (open (FILE, ">$filetomakeopen")) {
        $topictitle2 =~ s/~/\.\./g;
        open(PSF2,">$lbdir/data/recentreply.pl");
        print PSF2 "\$allreply=qq~<ol>";
        flock (FILE, 2) if ($OS_USED eq "Unix");
        print FILE "$inforum\t$intopic\t$topictitle2\t$currenttime\t\t$inmembername\t$threadposts\t$topictitle3\t\n";
        print PSF2 "<li><a href=topic.cgi?forum=$inforum&topic=$intopic&replynum=last#bottom target=_blank title='主題:$topictitle3\n最後回覆者:$membername\n最後更新:$postdate\n回覆:$threadposts篇'>$topictitle2</a> $inmembername<font color=red> $postdate</font></li>";
       for ($i=0;$i<9;$i++) {
            if ($recentreplys[$i] ne '') {
               my ($d1,$d2,$d3,$d4,$no,$d5,$d6,$d7)=split(/\t/,$recentreplys[$i]);
               $d4 = &shortdate($d4+$addtimes);
               print PSF2 "<li><a href=topic.cgi?forum=$d1&topic=$d2&replynum=last#bottom target=_blank title='主題:$d7\n最後回覆者:$d5\n最後更新:$d4\n回覆:$d6篇'>$d3</a> $d5 <font color=red> $d4</font></li>";
               print FILE $recentreplys[$i];
            }
        }

        print PSF2 "</ol>~;\n1;";
        close(PSF2);
        close(FILE);
    }
    &winunlock($filetomakeopen) if ($OS_USED eq "Nt");
 } else {
       if (open (FILE, ">$filetomakeopen")) {
          print FILE "$inforum\t$topic\t$topictitle2\t$currenttime\t$inposticon\t$inmembername\t$threadposts\t\n";
          close(FILE);
       }
 }

 }
 else {
 unlink ("$filetoopens.lck") if ((-M "$filetoopens.lck") *86400 > 30);
 }
}
### 首頁顯示最新回覆 E





4. 開啟 jinghua.cgi

找到
代码:
--------------------------------------------------------------------------------
      $inmembername =~ s/\_/ /g;
     open(FILE, "${lbdir}data/allforums.cgi");



上面加上
代码:
--------------------------------------------------------------------------------

### 首頁顯示最新精華 S
open(FILE, "${lbdir}forum${inforum}/${intopic}.thd.cgi");
my @threads = <FILE>;
close(FILE);
($membername2, $topictitle, $postipaddress, $showemoticons, $showsignature, $postdate, $post) = split(/\t/, $threadsΎ]);
$topictitle =~ s/^*#!&*//;
$topictitle =~ s/~/\.\./g;
$topictitle =~ s/\'/\`/;
$topictitle =~ s/\&/\&/g;
$topictitle =~ s/\&\#/\&\#/isg;
$topictitle =~ s/\&\;(.{1,6})\&\#59\;/\&$1\;/isg;
$topictitle =~ s/\&\#(Ύ-9]{1,6})\&\#59\;/\&\#$1\;/isg;
$topictitle =~ s/\"/\"/g;
$topictitle =~ s/</\</g;
$topictitle =~ s/>/\>/g;
$topictitle =~ s/ /\ /g;

$topictitle2=&lbhz("$topictitle",25);

open(PSF,"$lbdir/data/recentjinghua.cgi");
my @hasPSF=<PSF>;
close(PSF);
open(PSF,">$lbdir/data/recentjinghua.cgi");
open(PSF2,">$lbdir/data/recentjinghua.pl");
print PSF2 "\$alljh=qq~<ol>";
print PSF "$topictitle\t$membername2\t$inforum\t$intopic\t$postdate\t$topictitle2\n";
$postdate = &shortdate($postdate+$addtimes);
print PSF2 "<li><a href=topic.cgi?forum=$inforum&topic=$intopic target=_blank title='主題:$topictitle\n作者:$membername\n發表時間:$postdate>$topictitle2</a> $membername2<font color=red> $postdate</font></li>";
for($j=0;$j<=8;$j++){
if($hasPSF[$j] ne ''){
my ($d1,$d2,$d3,$d4,$d5,$d6)=split(/\t/,$hasPSF[$j]);
$d5 = &shortdate($d5+$addtimes);
print PSF2 "<li><a href=topic.cgi?forum=$d3&topic=$d4 target=_blank title='主題:$d1\n作者:$d2\n發表時間:$d5>$d6</a> $d2 <font color=red> $d5</font></li>";
print PSF "$hasPSF[$j]";}}
print PSF2 "</ol>~;\n1;";
close(PSF2);
close(PSF);
### 首頁顯示最新精華 E

4 Replies

| Add a Reply

Add a Reply

Forum Groups

Good Perl Books

Perl 學習手札

作者:簡信昌

Perl 學習手札 , 一本优秀的中文Perl在线学习资料。

Perl 程序讨论区

12 50

Last Topic: [注意]本区文章归档区 by 路杨 on Oct 16, 2006

事物处理及其他

113 1410

Last Topic: 踩个脚印 by 眼睛oo on Dec 4, 2010

测试私密区

测试私密区

18 88

Notice: 用于测试程序或者不可告人之秘密。不要问我要密码哦。。[此为原LB_ES论坛系统保留项,只限原有权限朋友进入,不再接受注册]

OpenID accepted here Learn more about OpenID