⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.php

📁 很好的一套PHP树形论坛程序
💻 PHP
📖 第 1 页 / 共 2 页
字号:
if($gp_alloworder){
	if($orderway!='lastpost' && $orderway!='postdate' && $orderway!='hits' && $orderway!='replies'){
		$orderway='lastpost';
	}
	$ordersel[$orderway]='selected';
	$asc!='DESC' && $asc!='ASC' && $asc = 'DESC';
	$ascsel[$asc]='selected';
} else{
	$asc = 'DESC';
	$orderway='lastpost';
}

$numofpage=ceil($count/$db_perpage);
$totlepage=$numofpage;
if ($numofpage && $page>$numofpage){
	$page=$numofpage;
}

$start_limit = ($page - 1) * $db_perpage;

$R=0;
if($db_topped && $foruminfo['top1']){
	$rows=$foruminfo['top1']+$foruminfo['top2'];
	if($start_limit < $rows){
		$L=min($rows-$start_limit,$db_perpage);
		$limit="LIMIT $start_limit,$L";
		if($L == $db_perpage){
			$limit2="";
		} else{
			$limit2="LIMIT 0,".($db_perpage-$L);
		}
		$fids=getfids($fid);
		$query=$db->query("SELECT * FROM pw_threads WHERE topped=3 OR (topped=2 AND fid IN($fids)) OR (topped=1 AND fid='$fid') ORDER BY topped DESC,lastpost DESC $limit");
		while($rt=$db->fetch_array($query)){
			$tpcdb[]=$rt;
		}
	} else{
		$limit2="LIMIT ".($start_limit-$rows).",$db_perpage";
	}
} else{
	$limit2="LIMIT $start_limit,$db_perpage";
}

 $pages = numofpage ($count, $page, $numofpage, 'index.php?fid=' . $fid . '&search=' . $search . '&' . $w_add . $typeadd, $db_maxpage);
  $orderway .= ' ' . $asc;
  $attachtype = array ('1' => 'img', '2' => 'txt', '3' => 'zip');
  if ($limit2)
  {
    $query = $db->query ('SELECT * FROM pw_threads WHERE ' . $sql . ' ' . $searchadd . ' ORDER BY ' . $topadd . ' ' . $orderway . ' ' . $limit2);
    while ($thread = $db->fetch_array ($query))
    {
      $tpcdb[] = $thread;
    }
  }

  $threaddb = array ();
  $tidin = '';
  foreach ($tpcdb as $key => $thread)
  {
    $tidin .= ($tidin ? ',\'' . $thread['tid'] . '\'' : '\'' . $thread['tid'] . '\'');
    ($foruminfo['allowhtm'] == 1 AND $htmurl = $htmdir . '/' . $fid . '/' . date ('ym', $thread['postdate']) . '/' . $thread['tid'] . '.html');
    $thread['tpcurl'] = 'read.php?tid=' . $thread['tid'] . (1 < $page ? '&fpage=' . $page : '');
    if ($managemode == 1)
    {
      $thread['tpcurl'] .= '&toread=1';
    }
    else
    {
      if (!($foruminfo['cms']))
      {
        if ($foruminfo['allowhtm'] == 1)
        {
          if (file_exists (R_P . $htmurl))
          {
            $thread['tpcurl'] = $htmurl . '';
          }
        }
      }
    }

    if ($forumset['cutnums'])
    {
      $thread['subject'] = substrs ($thread['subject'], $forumset['cutnums']);
    }
    
    if ($thread['titlefont'])
    {
      $titledetail = explode ('~', $thread['titlefont']);
      if ($titledetail[0])
      {
        $thread['subject'] = '<font color=' . $titledetail['0'] . '>' . $thread['subject'] . '</font>';
      }

      if ($titledetail[1])
      {
        $thread['subject'] = '<b>' . $thread['subject'] . '</b>';
      }

      if ($titledetail[2])
      {
        $thread['subject'] = '<i>' . $thread['subject'] . '</i>';
      }

      if ($titledetail[3])
      {
        $thread['subject'] = '<u>' . $thread['subject'] . '</u>';
      }

      if ($titledetail[4])
      {
        $thread['subject'] = '<font style=\'behavior:url(require/font/rainbow.htc);\'>' . $thread['subject'] . '</font>';
      }

      if ($titledetail[5])
      {
        $thread['subject'] = '<font textcolor1=\'' . $titledetail['0'] . '\' textbkcolor1=\'transparent\' textcolor2=\'#FFCC99\' textbkcolor2=\'transparent\' speed=\'100\' letters1=\'1\' letters2=\'1\' pause=\'500\' style=\'behavior:url(require/font/flashtext.htc);\'>' . $thread['subject'] . '</font>';
      }

      if ($titledetail[6])
      {
        $thread['subject'] = '<font textoffset1=\'-4\' textoffset2=\'-2\' speed=\'100\' letters1=\'1\' letters2=\'1\' pause=\'1000\' style=\'behavior:url(require/font/wavetext.htc); color:' . $titledetail['0'] . ';\'>' . $thread['subject'] . '</font>';
      }

      if ($titledetail[7])
      {
        $thread['subject'] = '<font textcolor=\'' . $titledetail['0'] . '\' basesize=\'12\' textsize1=\'20\' textsize2=\'14\' speed=\'100\' letters1=\'1\' letters2=\'1\' pause=\'500\' style=\'behavior:url(require/font/resizetext.htc);\'>' . $thread['subject'] . '</font>';
      }

      if ($titledetail[8])
      {
        $thread['subject'] = '<span style=\'border:solid 1px orange;border-left-width:5px;border-left-color:orange;background:#FFFFFF;padding:1px 5px 2px 5px;font-size: 8pt\'>' . $thread['subject'] . '</span>';
      }

      if ($titledetail[9])
      {
        $thread['subject'] = '<font style=\'background-color: orange;\'>' . $thread['subject'] . '</font>';
      }
    }

    if ($thread['ifmark'])
    {
      $thread['ifmark'] = (0 < $thread['ifmark'] ? ' ( +' . $thread['ifmark'] . ' ) ' : ' ( ' . $thread['ifmark'] . ' ) ');
    }
    else
    {
      unset ($thread[ifmark]);
    }

    if ($thread['topped'] == 3)
    {
      $thread['status'] = '<img src=\'' . $imgpath . '/' . $stylepath . '/index/pin_' . $thread['topped'] . '.gif\' alt=\'公告主题\' align=\'absmiddle\'>';
    }
    else
    {
      if ($thread['topped'] == 2)
      {
        $thread['status'] = '<img src=\'' . $imgpath . '/' . $stylepath . '/index/pin_' . $thread['topped'] . '.gif\' alt=\'推荐主题\' align=\'absmiddle\'>';
      }
      else
      {
        if ($thread['topped'] == 1)
        {
          $thread['status'] = '<img src=\'' . $imgpath . '/' . $stylepath . '/index/pin_' . $thread['topped'] . '.gif\' alt=\'置顶主题\' align=\'absmiddle\'>';
        }
        else
        {
          if ($thread['digest'] == 2)
          {
            $thread['status'] = '<img src=\'' . $imgpath . '/' . $stylepath . '/index/digest_' . $thread['digest'] . '.gif\' alt=\'精彩主题\' align=\'absmiddle\'>';
          }
          else
          {
            if ($thread['digest'] == 1)
            {
              $thread['status'] = '<img src=\'' . $imgpath . '/' . $stylepath . '/index/digest_' . $thread['digest'] . '.gif\' alt=\'精华主题\' align=\'absmiddle\'>';
            }
            else
            {
              if ($thread['pollid'])
              {
                if ($thread['locked'] == 0)
                {
                  $thread['status'] = '<img src=\'' . $imgpath . '/' . $stylepath . '/index/vote.gif\' alt=\'投票主题\' align=\'absmiddle\'>';
                }
              }
              else
              {
                if ($thread['pollid'])
                {
                  if (0 < $thread['locked'])
                  {
                    $thread['status'] = '<img src=\'' . $imgpath . '/' . $stylepath . '/index/votelock.gif\' alt=\'锁定投票\' align=\'absmiddle\'>';
                  }
                }
                else
                {
                  if ($thread['locked'] == 1)
                  {
                    $thread['status'] = '<img src=\'' . $imgpath . '/' . $stylepath . '/index/topiclock.gif\' alt=\'锁定主题\' align=\'absmiddle\'>';
                  }
                  else
                  {
                    if ($thread['locked'] == 2)
                    {
                      $thread['status'] = '<img src=\'' . $imgpath . '/' . $stylepath . '/index/topicclose.gif\' alt=\'关闭主题\' align=\'absmiddle\'>';
                    }
                    else
                    {
                      if (10 <= $thread['replies'])
                      {
                        $thread['status'] = '<img src=\'' . $imgpath . '/' . $stylepath . '/index/topichot.gif\' alt=\'热门主题\' align=\'absmiddle\'>';
                      }
                      else
                      {
                        $thread['status'] = '<img src=\'' . $imgpath . '/' . $stylepath . '/index/topicnew.gif\' alt=\'开放主题\' align=\'absmiddle\'>';
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }

    if ($thread['topped'])
    {
      if ($thread['toolinfo'] != '')
      {
        if ($thread['toolfield'])
        {
          if ($thread['toolfield'] < $timestamp)
          {
            $db->update ('UPDATE pw_threads SET toolinfo=\'\',toolfield=0,topped=0 WHERE tid=\'' . $thread['tid'] . '\'');
          }
        }
      }
    }

    if ($thread['topped'])
    {
      $ifsort = 1;
    }
    
    $thread['ispage'] = '';
    if ($db_readperpage < $thread['replies'] + 1)
    {
      if (($thread['replies'] + 1) % $db_readperpage == 0)
      {
        $numofpage = ($thread['replies'] + 1) / $db_readperpage;
      }
      else
      {
        $numofpage = floor (($thread['replies'] + 1) / $db_readperpage) + 1;
      }

      $thread['ispage'] = ' ';
      $thread['ispage'] .= ' <img src=\'' . $imgpath . '/' . $stylepath . '/index/repaly.gif\' border=0> <span style=\'font-size:7pt;font-family:verdana;\'>';
      for ($j = 1; $j <= $numofpage; ++$j)
      {
        if ($j == 6)
        {
          if ($j + 1 < $numofpage)
          {
            $thread['ispage'] .= ' .. <a href=\'read.php?tid=' . $thread['tid'] . '&page=' . $numofpage . '&fpage=' . $page . '\'>' . $numofpage . '</a>';
            break;
          }
        }

        $thread['ispage'] .= ' <a href=\'read.php?tid=' . $thread['tid'] . '&page=' . $j . '&fpage=' . $page . '\'>' . $j . '</a>';
      }

      $thread['ispage'] .= '</span>';
    }

    $thread['postdate'] = get_date ($thread['postdate']);
    $postdetail = explode (',', $thread['lastpost']);
    if ($thread['ifupload'])
    {
      $atype = $attachtype[$thread['ifupload']];
      $thread['titleadd'] = ' <img src=\'' . $imgpath . '/' . $stylepath . '/file/' . $atype . '.gif\' align=\'absbottom\' align=\'absmiddle\'>';
    }
    else
    {
      $thread['titleadd'] = '';
    }

    $thread['lstptime'] = get_date ($thread['lastpost']);
    if ($admincheck)
    {
      if ($thread['fid'] == $fid)
      {
        $thread['adminbox'] = '<input type=\'checkbox\' name=\'tidarray[]\' value=' . $thread['tid'] . '>';
      }
      else
      {
        $thread['adminbox'] = '<input type=\'checkbox\' name=\'tidarray[]\' value=' . $thread['tid'] . ' disabled>';
      }
    }

    if ($db_threademotion)
    {
      if (!((!($thread['icon'] == 'R') AND $thread['icon'])))
      {
        $thread['useriocn'] = '';
      }
      else
      {
        $thread['useriocn'] = '<img src=\'' . $imgpath . '/post/emotion/' . $thread['icon'] . '.gif\' align=\'absmiddle\'> ';
      }
    }

    $threaddb[] = $thread;
  }

  $db->free_result ($query);
  @include_once D_P . 'data/bbscache/forumcache.php';
  if ($db_indexlink == 1)
  {
    @extract (@$db->get_one ('SELECT * FROM pw_bbsinfo WHERE id=1'));
    $rawnewuser = rawurlencode ($newmember);
    list (, $logingd) = explode ('	', $db_gdcheck);
    include_once D_P . 'data/bbscache/index_cache.php';
    if ($db_indexmqshare)
    {
      $sharelink = '<marquee scrolldelay=100 scrollamount=4 onmouseout=\'if (document.all!=null){this.start()}\' onmouseover=\'if (document.all!=null){this.stop()}\' behavior=alternate>' . $sharelink . '</marquee>';
    }

    @include_once D_P . 'data/bbscache/olcache.php';
    $usertotal = $guestinbbs + $userinbbs;
    $mostinbbstime = get_date ($higholtime);
    if ($db_onlinelmt != 0)
    {
      if ($db_onlinelmt <= $usertotal)
      {
        if (!($ol_offset))
        {
          cookie ('ol_offset', '', 0);
          showmsg ('most_online');
        }
      }
    }

    if (!((!$c_htm AND !$db_hithour)))
    {
      if ($db_hithour == 0)
      {
        $db_hithour = 4;
      }
      
      $hit_wtime = $hit_control * $db_hithour;
      if (24 < $hit_wtime)
      {
        $hit_wtime = 0;
      }

      $hitsize = @filesize (D_P . 'data/bbscache/hits.txt');
      if (!((!($hit_wtime * 3600 < $timestamp - $hit_tdtime) AND !(1024 < $hitsize))))
      {
        require_once R_P . 'require/hitupdate.php';
      }
    }

    if ($higholnum < $usertotal)
    {
      $db->update ('UPDATE pw_bbsinfo SET higholnum=\'' . $usertotal . '\',higholtime=\'' . $timestamp . '\' WHERE id=1');
      $higholnum = $usertotal;
    }
  }

  unset ($thread);
  $posts = array ();
  if ($tidin)
  {
    $query = $db->query ('SELECT pid,fid,tid,author,authorid,postdate,subject,ifmark FROM pw_posts WHERE tid IN(' . $tidin . ') AND ifcheck=1 ORDER BY postdate ASC');
    while ($rt = $db->fetch_array ($query))
    {
      $rt['postdate'] = get_date ($rt['postdate']);
      $posts[$rt['tid']][] = $rt;
    }
  }

  require_once printeot ('pw_header');
  require_once printeot ('pw_index');
  footer ();
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -