[ Index ]

PHP Cross Reference of Nuke-Evolution v2.0.5

title

Body

[close]

/blocks/ -> block-Groups.php (source)

   1  <?php
   2  
   3  if(!defined('NUKE_EVO')) exit;
   4  
   5  if (!is_active('Groups')) {
   6      $content = 'ERROR: Groups module is inactive';
   7      return $content;
   8  }
   9  
  10  global $db, $prefix, $lang, $userinfo;
  11  
  12  $in_group = array();
  13  // Select all groups where the user is a member
  14  if (isset($userinfo['groups'])) {
  15      $s_member_groups = '';
  16      foreach ($userinfo['groups'] as $id => $name) {
  17          $in_group[] = $id;
  18          if (!empty($name)){
  19              $s_member_groups .= '&nbsp;&nbsp;&nbsp;&nbsp;<a title="'.$name.'" href="modules.php?name=Groups&amp;g='.$id . '">&nbsp;<img src="images/arrow.gif" alt="'.$name.'" border="0" height="9" width="9" /> ' . $name . '</a><br />';
  20          }
  21      }
  22  }
  23  // Select all groups where the user has a pending membership.
  24  if (is_user()) {
  25      $result = $db->sql_query('SELECT g.group_id, g.group_name, g.group_type
  26              FROM ' . $prefix.'_bbgroups g, ' . $prefix.'_bbuser_group ug
  27              WHERE ug.user_id = ' . $userinfo['user_id'] . '
  28                  AND ug.group_id = g.group_id
  29                  AND ug.user_pending = 1
  30                  AND g.group_single_user = 0
  31              ORDER BY g.group_name, ug.user_id');
  32      if ($db->sql_numrows($result)) {
  33          $s_pending_groups = '';
  34          while ( $row = $db->sql_fetchrow($result) ) {
  35              $in_group[] = $row['group_id'];
  36              $s_pending_groups .= '&nbsp;&nbsp;&nbsp;&nbsp;<a title="'.$row['group_name'].'" href="modules.php?name=Groups&amp;g='.$row['group_id'] . '"> <img src="images/arrow.gif" alt="'.$row['group_name'].'" border="0" height="9" width="9" /> ' . $row['group_name'] . '</a><br />';
  37          }
  38          
  39      }
  40      $db->sql_freeresult($result);
  41  }
  42  
  43  // Select all other groups i.e. groups that this user is not a member of
  44  $ignore_group_sql = ( count($in_group) ) ? "AND group_id NOT IN (" . implode(', ', $in_group) . ")" : '';
  45  $result = $db->sql_query("SELECT group_id, group_name, group_type
  46          FROM " . $prefix."_bbgroups
  47          WHERE group_single_user = 0
  48              $ignore_group_sql
  49          ORDER BY group_name");
  50  
  51  $s_group_list = '';
  52  while ($row = $db->sql_fetchrow($result)) {
  53      if ($row['group_type'] != 2 || is_admin()) {
  54          $s_group_list .='&nbsp;&nbsp;&nbsp;&nbsp;<a title="'.$row['group_name'].'" href="modules.php?name=Groups&amp;g='.$row['group_id'] . '"> <img src="images/arrow.gif" alt="'.$row['group_name'].'" border="0" height="9" width="9" /> ' . $row['group_name'] . '</a><br />';
  55      }
  56  }
  57  $db->sql_freeresult($result);
  58  
  59  $content = '';
  60  if (isset($s_member_groups)) {
  61      $content .= '<img src="images/blocks/group-1.gif" alt="'.$lang['Current_memberships'].'" border="0" height="14" width="17" /> '.$lang['Current_memberships'].'<br />'.$s_member_groups;
  62  }
  63  if (isset($s_pending_groups)) {
  64      $content .= '<img src="images/blocks/group-3.gif" alt="'.$lang['Memberships_pending'].'" border="0" height="14" width="17" /> '.$lang['Memberships_pending'].'<br />'.$s_pending_groups;
  65  }
  66  if ($s_group_list != '') {
  67      $content .= '<img src="images/blocks/group-4.gif" alt="'.$lang['Group_member_join'].'" border="0" height="14" width="17" /> '.$lang['Group_member_join'].'<br />'.$s_group_list;
  68  }
  69  if (!is_user()) {
  70      $content .= '<br />'.$lang['Login_to_join'];
  71  }
  72  
  73  ?>


Generated: Wed Jun 6 11:38:01 2007 Cross-referenced by PHPXref 0.7