--- phpbb3.inc.php.orig 2009-03-20 12:40:49.000000000 +0100 +++ phpbb3.inc.php 2009-03-20 14:42:52.000000000 +0100 @@ -65,6 +64,8 @@ $this->use_post_based_groups = $BRIDGE['use_post_based_groups']; } + $this->multigroups = 1; + // Database connection settings $this->db = array( 'name' => $dbname, @@ -78,12 +79,14 @@ $this->table = array( 'users' => 'users', 'groups' => 'groups', + 'user_group' => 'user_group', 'sessions' => 'sessions' ); // Derived full table names $this->usertable = '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['users']; $this->groupstable = '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['groups']; + $this->usergroupstable = '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['user_group']; $this->sessionstable = '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['sessions']; // Table field names @@ -143,6 +146,25 @@ } } + // Get groups of which user is member + function get_groups($row) + { + if ($this->use_post_based_groups){ + $sql = "SELECT ug.{$this->field['usertbl_group_id']}+100 AS group_id FROM {$this->usertable} AS u, {$this->usergroupstable} AS ug, {$this->groupstable} as g WHERE u.{$this->field['user_id']}=ug.{$this->field['user_id']} AND g.{$this->field['grouptbl_group_id']} = u.{$this->field['usertbl_group_id']} AND ug.user_pending = 0 AND u.{$this->field['user_id']} = '{$row['id']}'"; + $result = cpg_db_query($sql, $this->link_id); + while ($row2 = mysql_fetch_array($result)) { + $data[] = $row2[$this->field['usertbl_group_id']]; + } + foreach($data as $group_id) { + if(in_array($group_id-100, $this->admingroups)) { array_unshift($data, $this->admingroups[0]+100); } + } + } else { + $data[0] = in_array($row['group_id'] - 100, $this->admingroups) ? 1 : 2; + } + + return $data; + } + // definition of how to extract an id and password hash from a cookie function cookie_extraction() {