[ Index ]

PHP Cross Reference of MyBB 1.8.12

title

Body

[close]

/ -> showteam.php (source)

   1  <?php
   2  /**
   3   * MyBB 1.8
   4   * Copyright 2014 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://www.mybb.com
   7   * License: http://www.mybb.com/about/license
   8   *
   9   */
  10  
  11  define("IN_MYBB", 1);
  12  define('THIS_SCRIPT', 'showteam.php');
  13  
  14  $templatelist = 'showteam,postbit_email,postbit_pm,showteam_usergroup_user,showteam_usergroup,showteam_moderators_mod,showteam_moderators,showteam_moderators_forum';
  15  require_once  "./global.php";
  16  
  17  // Load global language phrases
  18  $lang->load('showteam');
  19  
  20  add_breadcrumb($lang->nav_showteam);
  21  
  22  $plugins->run_hooks('showteam_start');
  23  
  24  $timecut = TIME_NOW - $mybb->settings['wolcutoff'];
  25  
  26  $usergroups = array();
  27  $moderators = array();
  28  $users = array();
  29  
  30  // Fetch the list of groups which are to be shown on the page
  31  $query = $db->simple_select("usergroups", "gid, title, usertitle", "showforumteam=1", array('order_by' => 'disporder'));
  32  while($usergroup = $db->fetch_array($query))
  33  {
  34      $usergroups[$usergroup['gid']] = $usergroup;
  35  }
  36  
  37  if(empty($usergroups))
  38  {
  39      error($lang->error_noteamstoshow);
  40  }
  41  
  42  // Fetch specific forum moderator details
  43  if($usergroups[6]['gid'])
  44  {
  45      $query = $db->query("
  46          SELECT m.*, f.name
  47          FROM ".TABLE_PREFIX."moderators m
  48          LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=m.id)
  49          LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=m.fid)
  50          WHERE f.active = 1 AND m.isgroup = 0
  51          ORDER BY u.username
  52      ");
  53      while($moderator = $db->fetch_array($query))
  54      {
  55          $moderators[$moderator['id']][] = $moderator;
  56      }
  57  }
  58  
  59  // Now query the users of those specific groups
  60  $groups_in = implode(",", array_keys($usergroups));
  61  $users_in = implode(",", array_keys($moderators));
  62  if(!$groups_in)
  63  {
  64      $groups_in = 0;
  65  }
  66  if(!$users_in)
  67  {
  68      $users_in = 0;
  69  }
  70  $forum_permissions = forum_permissions();
  71  
  72  $query = $db->simple_select("users", "uid, username, displaygroup, usergroup, ignorelist, hideemail, receivepms, lastactive, lastvisit, invisible, away", "displaygroup IN ($groups_in) OR (displaygroup='0' AND usergroup IN ($groups_in)) OR uid IN ($users_in)", array('order_by' => 'username'));
  73  while($user = $db->fetch_array($query))
  74  {
  75      // If this user is a moderator
  76      if(isset($moderators[$user['uid']]))
  77      {
  78          foreach($moderators[$user['uid']] as $forum)
  79          {
  80              if($forum_permissions[$forum['fid']]['canview'] == 1)
  81              {
  82                  $forum_url = get_forum_link($forum['fid']);
  83                  eval("\$forumlist .= \"".$templates->get("showteam_moderators_forum")."\";");
  84              }
  85          }
  86          $user['forumlist'] = $forumlist;
  87          $forumlist = '';
  88          $usergroups[6]['user_list'][$user['uid']] = $user;
  89      }
  90  
  91      if($user['displaygroup'] == '6' || $user['usergroup'] == '6')
  92      {
  93          $usergroups[6]['user_list'][$user['uid']] = $user;
  94      }
  95  
  96      // Are they also in another group which is being shown on the list?
  97      if($user['displaygroup'] != 0)
  98      {
  99          $group = $user['displaygroup'];
 100      }
 101      else
 102      {
 103          $group = $user['usergroup'];
 104      }
 105  
 106      if($usergroups[$group] && $group != 6)
 107      {
 108          $usergroups[$group]['user_list'][$user['uid']] = $user;
 109      }
 110  }
 111  
 112  // Now we have all of our user details we can display them.
 113  $grouplist = '';
 114  foreach($usergroups as $usergroup)
 115  {
 116      $usergrouprows = $modrows = '';
 117  
 118      // If we have no users - don't show this group
 119      if(!isset($usergroup['user_list']))
 120      {
 121          continue;
 122      }
 123  
 124      $bgcolor = '';
 125      foreach($usergroup['user_list'] as $user)
 126      {
 127          $user['username'] = format_name(htmlspecialchars_uni($user['username']), $user['usergroup'], $user['displaygroup']);
 128          $user['profilelink'] = get_profile_link($user['uid']);
 129  
 130          // For the postbit templates
 131          $post['uid'] = $user['uid'];
 132          $emailcode = $pmcode = '';
 133          if($user['hideemail'] != 1)
 134          {
 135              eval("\$emailcode = \"".$templates->get("postbit_email")."\";");
 136          }
 137  
 138          if($user['receivepms'] != 0 && $mybb->settings['enablepms'] != 0 && my_strpos(",".$user['ignorelist'].",", ",".$mybb->user['uid'].",") === false)
 139          {
 140              eval("\$pmcode = \"".$templates->get("postbit_pm")."\";");
 141          }
 142  
 143          // For the online image
 144          if($user['lastactive'] > $timecut && ($user['invisible'] == 0 || $mybb->usergroup['canviewwolinvis'] == 1) && $user['lastvisit'] != $user['lastactive'])
 145          {
 146              $status = "online";
 147          }
 148          elseif($user['away'] == 1 && $mybb->settings['allowaway'] != 0)
 149          {
 150              $status = "away";
 151          }
 152          else
 153          {
 154              $status = "offline";
 155          }
 156  
 157          if($user['invisible'] == 1 && $mybb->usergroup['canviewwolinvis'] != 1 && $user['uid'] != $mybb->user['uid'])
 158          {
 159              if($user['lastactive'])
 160              {
 161                  $user['lastvisit'] = $lang->lastvisit_hidden;
 162              }
 163              else
 164              {
 165                  $user['lastvisit'] = $lang->lastvisit_never;
 166              }
 167          }
 168          else
 169          {
 170              $user['lastvisit'] = my_date('relative', $user['lastactive']);
 171          }
 172  
 173          $bgcolor = alt_trow();
 174  
 175          $plugins->run_hooks('showteam_user');
 176  
 177          // If the current group is a moderator group
 178          if($usergroup['gid'] == 6 && !empty($user['forumlist']))
 179          {
 180              $forumslist = $user['forumlist'];
 181              eval("\$modrows .= \"".$templates->get("showteam_moderators_mod")."\";");
 182          }
 183          else
 184          {
 185              eval("\$usergrouprows .= \"".$templates->get("showteam_usergroup_user")."\";");
 186          }
 187      }
 188  
 189      if($modrows && $usergroup['gid'] == 6)
 190      {
 191          eval("\$grouplist .= \"".$templates->get("showteam_moderators")."\";");
 192      }
 193  
 194      if($usergrouprows)
 195      {
 196          eval("\$grouplist .= \"".$templates->get("showteam_usergroup")."\";");
 197      }
 198  }
 199  
 200  if(empty($grouplist))
 201  {
 202      error($lang->error_noteamstoshow);
 203  }
 204  
 205  $plugins->run_hooks("showteam_end");
 206  
 207  eval("\$showteam = \"".$templates->get("showteam")."\";");
 208  output_page($showteam);


2005 - 2016 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref 0.7.1