Пример #1
0
 function session_extraction()
 {
     $superCage = Inspekt::makeSuperCage();
     if ($superCage->cookie->keyExists($this->cookie_name . '_sid')) {
         $this->session_id = $superCage->cookie->getEscaped($this->cookie_name . '_sid');
         $sql = "SELECT user_id, user_password, group_id FROM {$this->sessionstable} INNER JOIN {$this->usertable} ON session_user_id = user_id WHERE session_id = '{$this->session_id}'";
         $result = $this->query($sql);
         if (cpg_db_num_rows($result)) {
             $row = cpg_db_fetch_array($result);
             $this->primary_group = array_pop($row);
             return $row['user_id'] == 1 ? false : $row;
         } else {
             return false;
         }
         $result->free();
     }
 }
 function get_groups($row)
 {
     $data[0] = in_array($row['group_id'] - 100, $this->admingroups) ? 1 : 2;
     if ($this->use_post_based_groups) {
         $sql = "SELECT g.{$this->field['usertbl_group_id']}+100 AS group_id, u.* FROM {$this->usertable} AS u, {$this->groupstable} as g WHERE g.{$this->field['grouptbl_group_id']} = u.{$this->field['usertbl_group_id']} AND u.{$this->field['user_id']} = '{$row['id']}'";
         $result = $this->query($sql);
         $row = cpg_db_fetch_array($result);
         $result->free();
         $data[0] = $row['group_id'];
         if ($row['membergroupids']) {
             $groups = explode(',', $row['membergroupids']);
             foreach ($groups as $id => $group) {
                 $data[] = $group + 100;
             }
         }
     }
     return $data;
 }