コード例 #1
0
 function session_extraction()
 {
     $superCage = Inspekt::makeSuperCage();
     $row = false;
     //array('id' => 0, 'username' => 'Guest', 'status' => -1);
     //if (isset($_COOKIE[$this->cookie_name])) {
     //  list($username, $pass_hash) = unserialize($_COOKIE[$this->cookie_name]);
     if ($superCage->cookie->keyExists($this->cookie_name)) {
         list($username, $pass_hash) = unserialize($superCage->cookie->getRaw($this->cookie_name));
         if (strcasecmp($username, 'Guest')) {
             $result = $this->query("SELECT id, username, status+100 AS status FROM {$this->usertable} WHERE username = '******' AND password = '******'");
             $row = cpg_db_fetch_assoc($result);
             $result->free();
         }
     }
     return $row;
 }
コード例 #2
0
 function get_users($options = array())
 {
     global $CONFIG;
     // Copy UDB fields and config variables (just to make it easier to read)
     $f =& $this->field;
     $C =& $CONFIG;
     // Sort codes
     $sort_codes = array('name_a' => 'user_name ASC', 'name_d' => 'user_name DESC', 'group_a' => 'group_name ASC', 'group_d' => 'group_name DESC', 'reg_a' => 'user_regdate ASC', 'reg_d' => 'user_regdate DESC', 'pic_a' => 'pic_count ASC', 'pic_d' => 'pic_count DESC', 'disku_a' => 'disk_usage ASC', 'disku_d' => 'disk_usage DESC', 'lv_a' => 'user_lastvisit ASC', 'lv_d' => 'user_lastvisit DESC');
     // Fix the group id, if bridging is enabled
     if ($CONFIG['bridge_enable']) {
         $f['usertbl_group_id'] .= '+100';
     }
     // Build WHERE clause, if this is a username search
     if ($options['search']) {
         $options['search'] = 'WHERE u.' . $f['username'] . ' LIKE "' . $options['search'] . '" ';
     }
     // Build SQL table, should work with all bridges
     $sql = "SELECT u.{$f['user_id']} as user_id, {$f['username']} as user_name, {$f['email']} as user_email, {$f['regdate']} as user_regdate, {$f['lastvisit']} as user_lastvisit, '' as user_active, " . "COUNT(pid) as pic_count, ROUND(SUM(total_filesize)/1024) as disk_usage, group_name, group_quota " . "FROM {$this->usertable} AS u " . "INNER JOIN {$this->usergroupstable} AS ug ON u.uid = ug.uid " . " INNER JOIN {$C['TABLE_USERGROUPS']} AS g " . "ON  g.group_id = ug.{$f['grouptbl_group_id']} LEFT JOIN {$C['TABLE_PICTURES']} AS p ON p.owner_id = u.{$f['user_id']} " . $options['search'] . "GROUP BY user_id " . "ORDER BY " . $sort_codes[$options['sort']] . " " . "LIMIT {$options['lower_limit']}, {$options['users_per_page']};";
     $result = $this->query($sql);
     // If no records, return empty value
     if (!$result) {
         return array();
     }
     // Extract user list to an array
     while ($user = cpg_db_fetch_assoc($result)) {
         $userlist[] = $user;
     }
     $result->free();
     return $userlist;
 }
コード例 #3
0
 function collect_groups()
 {
     $sql = "SELECT * FROM {$this->groupstable}";
     $result = $this->query($sql);
     $udb_groups = array(1 => 'Administrators', 2 => 'Registered', 3 => 'Guests');
     while ($row = cpg_db_fetch_assoc($result)) {
         $udb_groups[$row[$this->field['grouptbl_group_id']] + 100] = utf_ucfirst(utf_strtolower($row[$this->field['grouptbl_group_name']]));
     }
     $result->free();
     return $udb_groups;
 }
コード例 #4
0
 function collect_groups()
 {
     // Use this version to exclude true post based groups
     //$sql ="SELECT * FROM {$this->groupstable} WHERE minposts=-1";
     // Use this version to include all SMF groups
     $sql = "SELECT * FROM {$this->groupstable}";
     $result = $this->query($sql);
     $udb_groups = array(100 => 'Guests');
     while ($row = cpg_db_fetch_assoc($result)) {
         $udb_groups[$row[$this->field['grouptbl_group_id']] + 100] = utf_ucfirst(utf_strtolower($row[$this->field['grouptbl_group_name']]));
     }
     $result->free();
     return $udb_groups;
 }