setQuery($query); $all= $db->loadResultArray(); // Create toon objects foreach ($all as $toon_id) { $toon= new GuildMasterToon($db); $toon->load((int) $toon_id); if (! $hide_time || (strtotime($toon->lastonline) > (time() - $hide_time * 86400))) { // echo "LastOn:" . $toon->lastonline; // echo "HideDate:" . time() + $hide_time; $toons[]= $toon; } } return $toons; } function claim($user_id) { if (is_null($user_id)) { return null; } $k= $this->_tbl_key; $toon_id= $this-> $k; if ($this->get_user_id()) { $sql= "UPDATE #__guild_master_user SET user_id=$user_id WHERE toon_id=$toon_id;"; } else { $sql= "INSERT INTO #__guild_master_user (user_id, toon_id) VALUES($user_id, $toon_id);"; } $this->_db->setQuery($sql); $this->_db->query(); return null; } function release() { $k= $this->_tbl_key; $toon_id= $this-> $k; $sql= "DELETE FROM #__guild_master_user WHERE toon_id=$toon_id;"; $this->_db->setQuery($sql); $this->_db->query(); return null; } function get_user_id() { $k= $this->_tbl_key; $toon_id= $this-> $k; $sql= "SELECT user_id FROM #__guild_master_user WHERE toon_id=$toon_id;"; $this->_db->setQuery($sql); $this->_db->query(); $temp= $this->_db->loadRow(); return $temp[0]; } function exists($id= NULL) { if (!$id) { $k= $this->_tbl_key; $id= $this-> $k; if (!$id) { return false; } } $sql= "SELECT $this->_tbl_key FROM $this->_tbl WHERE $this->_tbl_key=$id"; $this->_db->setQuery($sql); $this->_db->query(); return $this->_db->getAffectedRows(); } function store($updateNulls= false) { $this->Last_Updated= null; $k= $this->_tbl_key; global $migrate; if ($this->exists() && !$migrate) { $ret= $this->_db->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls); } else { $ret= $this->_db->insertObject($this->_tbl, $this, $this->_tbl_key); } if (!$ret) { $this->_error= strtolower(get_class($this)) . "::store failed
" . $this->_db->getErrorMsg(); return false; } else { return true; } } } ?>