/** * Formats an alliance tag as a link. * * @param string $tag * @param string $name * @param int $aid * * @return string Formatted alliance tag */ protected function formatAllyTag($tag, $name, $aid) { $class = $this->relation->getAllyRelationClass($aid); if ($this->tagAsLink) { return Link::get("game/" . SID . "/Alliance/Page/" . $aid, $tag, $name, $class); } return "<span class=\"" . $class . "\">" . $tag . "</span>"; }
/** * Executes an invitation. * * @param integer $eventid * @param string $name * @param string $username * * @return Bengine_Game_Controller_Mission */ protected function invite($eventid, $name, $username) { $this->noAction = true; $where = Core::getDB()->quoteInto("(mode = ? OR mode = ?) AND user = ? AND eventid = ?", array(10, 12, Core::getUser()->get("userid"), $eventid)); $result = Core::getQuery()->select("events", "time", "", $where); if ($row = $result->fetchRow()) { $result->closeCursor(); $error = ""; $time = $row["time"]; $result = Core::getQuery()->select("user u", array("u.userid", "u2a.aid"), "LEFT JOIN " . PREFIX . "user2ally u2a ON (u2a.userid = u.userid)", Core::getDB()->quoteInto("u.username = ?", $username)); $row = $result->fetchRow(); $userid = $row["userid"]; $aid = $row["aid"]; $Relation = new Bengine_Game_User_Relation(Core::getUser()->get("userid"), Core::getUser()->get("aid")); if (!$Relation->hasRelation($userid, $aid)) { $error[] = "UNABLE_TO_INVITE_USER"; } unset($Relation); if (Str::length($name) > 0 && Str::length($name) <= 128) { $name = Str::validateXHTML($name); Core::getQuery()->update("attack_formation", array("name" => $name), "eventid = ?", array($eventid)); } else { $error[] = "ENTER_FORMATION_NAME"; } if (empty($error)) { Core::getQuery()->insert("formation_invitation", array("eventid" => $eventid, "userid" => $userid)); } else { foreach ($error as $_error) { Logger::addMessage($_error); } } } $this->formation($eventid); return $this; }