www.gusucode.com > weenCompany闻名企业网站系统 4.0.0 繁体中英文 UTF8源码程序 > modules/m9_topposters/topposters.php

    <?php
// +---------------------------------------------+
// |     Copyright  2003 - 2005 weenCompany      |
// |     http://www.weentech.com                 |
// |     This file may not be redistributed.     |
// +---------------------------------------------+

if(!defined('IN_WEENCOMPANY'))
{
  die("File not found!");
}



function m9_TopPosters($usersystem)
{
  global $DB, $dbname, $weenurl;

  $forumdbname = $usersystem['dbname'];
  $forumname   = $usersystem['name'];
  $forumpath   = $usersystem['folderpath'];
  $tableprefix = $usersystem['tblprefix'];

  // get language
  $language = GetLanguage(9);

  $getsettings = $DB->query("SELECT value FROM " . TABLE_PREFIX . "modulesettings WHERE moduleid = 9 ORDER BY displayorder");

  while($setting = $DB->fetch_array($getsettings))
  {
    $settings[] = $setting['value'];
  }

  $postlimit   = $settings[0];

  // switch to forum database
  if($dbname != $forumdbname)
  {
    $DB->select_db($forumdbname);
  }

  //start printing tables
  echo '<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td>' . $language['user'] . '</td>
          <td align="right">' . $language['posts'] . '</td>
        </tr>';

  if( ($forumname == 'vBulletin 2') || ($forumname == 'vBulletin 3') )
  {
    $getusers = $DB->query("SELECT userid, username, posts FROM ".$tableprefix."user ORDER BY posts DESC LIMIT $postlimit");

    while($user = $DB->fetch_array($getusers))
    {
      echo '<tr>
              <td><a href=' . $weenurl . $forumpath . 'member.php?action=getinfo&userid=' . $user['userid'] . '>' . $user['username'] . '</a></td>
              <td align="right">' . $user['posts'] . '</td>
            </tr>';
    }
  }
  else if($forumname == 'phpBB2')
  {
    $getusers = $DB->query("SELECT user_id, username, user_posts FROM ".$tableprefix."users WHERE username != 'Anonymous' ORDER BY user_posts DESC LIMIT $postlimit");

    while($user = $DB->fetch_array($getusers))
    {
      echo '<tr>
              <td><a href=' . $weenurl . $forumpath . 'profile.php?mode=viewprofile&u=' . $user['user_id'] . '>' . $user['username'] . '</a></td>
              <td align="right">' . $user['user_posts'] . '</td>
            </tr>';
    }
  }
  else if($forumname == 'Invision Power Board 2')
  {
    $getusers = $DB->query("SELECT id, name, posts FROM " . $tableprefix . "members ORDER BY posts DESC LIMIT $postlimit");

    while($user = $DB->fetch_array($getusers))
    {
      echo '<tr>
              <td><a href=' . $weenurl . $forumpath . 'index.php?showuser=' . $user['id'] . '>' . $user['name'] . '</a></td>
              <td align="right">' . $user['posts'] . '</td>
            </tr>';
    }
  }
  else if($forumname == 'Simple Machines Forum 1')
  {
    $getusers = $DB->query("SELECT ID_MEMBER, memberName, posts FROM " . $tableprefix . "members ORDER BY posts DESC LIMIT $postlimit");

    while($user = $DB->fetch_array($getusers))
    {
      echo '<tr>
              <td><a href=' . $weenurl . $forumpath . 'index.php?action=profile;u=' . $user['ID_MEMBER'] . '>' . $user['memberName'] . '</a></td>
              <td align="right">' . $user['posts'] . '</td>
            </tr>';
    }
  }

  echo '</table>';

  // switch back to weencompany database
  if($dbname != $forumdbname)
  {
    $DB->select_db($dbname);
  }

}


if($usersystem)
{
  if($usersystem['name'] != 'weenCompany')
  {
    m9_TopPosters($usersystem);
  }
  else
  {
    echo '此模塊是基於論壇而設置的, 需要安裝論壇同時實現網站與論壇接口後方能使用!';
  }
}
else
{
  echo '網站用戶系統已關閉, 此模塊無法正常使用!';
}
?>