function SEUser($user_unique = array('0', '', ''), $select_fields = array('*', '*', '*', '*')) { global $database; // SET VARS $this->is_error = 0; $this->user_exists = 0; $this->user_info['user_id'] = 0; $this->user_info['user_subnet_id'] = 0; $this->moderation_privacy = 1; $user_unique_id = !empty($user_unique[0]) ? $user_unique[0] : NULL; $user_unique_username = !empty($user_unique[1]) ? $user_unique[1] : NULL; $user_unique_email = !empty($user_unique[2]) ? $user_unique[2] : NULL; // VERIFY USER_ID/USER_USERNAME/USER_EMAIL IS VALID AND SET APPROPRIATE OBJECT VARIABLES if ($user_unique_id || $user_unique_username || $user_unique_email) { // SET USERNAME AND EMAIL TO LOWERCASE $user_username = strtolower($user_unique_username); $user_email = strtolower($user_unique_email); // SELECT USER USING SPECIFIED SELECTION PARAMETER $sql_array = array(); if (!empty($user_unique[0])) { $sql_array[] = "SELECT {$select_fields[0]} FROM se_users WHERE user_id='{$user_unique_id}' LIMIT 1"; } if (!empty($user_unique[1])) { $sql_array[] = "SELECT {$select_fields[0]} FROM se_users WHERE LOWER(user_username)='{$user_username}' LIMIT 1"; } if (!empty($user_unique[2])) { $sql_array[] = "SELECT {$select_fields[0]} FROM se_users WHERE LOWER(user_email)='{$user_email}' LIMIT 1"; } if (count($sql_array) > 1) { $sql = '(' . join(') UNION (', $sql_array) . ')'; } else { $sql = $sql_array[0]; } $user = $database->database_query($sql); if ($database->database_num_rows($user) == 1) { $this->user_exists = 1; $this->user_info = $database->database_fetch_assoc($user); // SET USER SALT $this->user_salt = $this->user_info['user_code']; // SET DISPLAY NAME (BACKWARDS COMPAT) //$this->user_displayname = $this->user_info['user_displayname']; $this->user_displayname(); // SELECT PROFILE CATEGORY INFO if (!empty($this->user_info['user_profilecat_id'])) { $this->profilecat_info =& SEUser::getProfileCategoryInfo($this->user_info['user_profilecat_id']); } //if(isset($this->user_info[user_profilecat_id])) { $this->profilecat_info = $database->database_fetch_assoc($database->database_query("SELECT profilecat_id, profilecat_title FROM se_profilecats WHERE profilecat_id=".$this->user_info[user_profilecat_id]." LIMIT 1")); } // SELECT PROFILE INFO if (!empty($select_fields[1])) { $this->profile_info =& SEUser::getProfileValues($this->user_info['user_id']); } //if($select_fields[1] != "") { $this->profile_info = $database->database_fetch_assoc($database->database_query("SELECT $select_fields[1] FROM se_profilevalues WHERE profilevalue_user_id='".$this->user_info[user_id]."'")); } // SELECT LEVEL INFO if (!empty($select_fields[2])) { $this->level_info =& SEUser::getLevelSettings($this->user_info['user_level_id']); } //if($select_fields[2] != "") { $this->level_info = $database->database_fetch_assoc($database->database_query("SELECT * FROM se_levels WHERE level_id='".$this->user_info[user_level_id]."'")); } // GET USER SETTINGS $this->usersetting_info =& SEUser::getUserSettings($this->user_info['user_id']); // SELECT SUBNET INFO if ($this->user_info['user_subnet_id']) { if (!empty($select_fields[3])) { $this->subnet_info =& SECore::getSubnetworkInfo($this->user_info['user_subnet_id']); } //if($select_fields[3] != "") { $this->subnet_info = $database->database_fetch_assoc($database->database_query("SELECT subnet_id, subnet_name FROM se_subnets WHERE subnet_id='".$this->user_info[user_subnet_id]."'")); } } else { $this->subnet_info['subnet_id'] = 0; $this->subnet_info['subnet_name'] = 152; } SE_Language::_preload($this->subnet_info['subnet_name']); } } }