/** * Short description * * Long description * * @param * @return */ protected function fetch_member() { try { $this->loadSSI(); } catch (Exception $e) { throw new \Exception($e->getMessage()); } $this->member_ids = unserialize($this->member_ids); if ('echo' == $this->output_method) { ob_start(); ssi_fetchMember($this->member_ids, $this->output_method); $this->data = ob_get_contents(); ob_end_clean(); } else { $this->data = ssi_fetchMember($this->member_ids, $this->output_method); } }
if (empty($userinfo)) { die($error[2]); } //SMF "helpfully" keys the result by user ID. Which is the whole point of this search: we don't know it.. reset($userinfo); $id = key($userinfo); } if (!isset($_GET['user'])) { $id = (int) $_GET['trainer']; } $userdata = userdata($id); $userdata = $userdata[0]; if (empty($userdata)) { die($error[2]); } $smfdata = ssi_fetchMember($member_ids = $id, $output_method = 'array'); $smfdata = $smfdata[$id]; //print_r($smfdata); $trainer = array(); if (empty($userdata['lastcaught'])) { $userdata['lastcaught'] = 0; } //First, simple stuff like their name and details. $trainer['response_time'] = time(); $trainer['name'] = $smfdata['name']; $trainer['id'] = $id; empty($smfdata['gender']['name']) ? $trainer['gender'] = null : ($trainer['gender'] = strtolower($smfdata['gender']['name'])); $trainer['member_since'] = $smfdata['registered_timestamp']; $trainer['trainer_since'] = (int) $userdata['starttime']; $trainer['last_login'] = $smfdata['last_login_timestamp']; $trainer['last_caught'] = (int) $userdata['lastcaught'];
$trainer1['id'] = $context['user']['id']; $is_owner = true; } else { $trainer1data = userdata($tradedata[0]['trainer1']); $trainer1smfdata = ssi_fetchMember($member_ids = $tradedata[0]['trainer1'], $output_method = 'array'); $trainer1['name'] = $trainer1smfdata[$tradedata[0]['trainer1']]['name']; $trainer1['id'] = $tradedata[0]['trainer1']; } if ($context['user']['id'] == $tradedata[0]['trainer2']) { $trainer2data = $userdata; $trainer2['name'] = $context['user']['name']; $trainer2['id'] = $context['user']['id']; $is_owner = false; } else { $trainer2data = userdata($tradedata[0]['trainer2']); $trainer2smfdata = ssi_fetchMember($member_ids = $tradedata[0]['trainer2'], $output_method = 'array'); $trainer2['name'] = $trainer2smfdata[$tradedata[0]['trainer2']]['name']; $trainer2['id'] = $tradedata[0]['trainer2']; } $trainer1_owned = count(explode(',', $trainer1data[0]['pokemon'])); $trainer1_seen = count(explode(',', $trainer1data[0]['seen'])); $trainer2_owned = count(explode(',', $trainer2data[0]['pokemon'])); $trainer2_seen = count(explode(',', $trainer2data[0]['seen'])); //Not much use trading if each user can't pick a pokemon. if (isset($_GET['pick'])) { //Who are you? if ($context['user']['id'] == $trainer1['id']) { $owned_pokemon = explode(',', $trainer1data[0]['pokemon']); } elseif ($context['user']['id'] == $trainer2['id']) { $owned_pokemon = explode(',', $trainer2data[0]['pokemon']); } else {