/** * @see AbstractFleetEventHandler::executeImpact() */ public function executeImpact() { $this->initStandByFleets(); $this->ereport .= '<!-- [planetID#' . $this->targetPlanetID . '] -->'; $this->ereport .= '<a id="ereport' . $this->fleetID . '"></a>'; $this->create(); $this->ereport .= '<div class="ereportbottom" style="text-align: center;">'; $this->destroy(); $this->ereport .= '</div>'; $senderName = $this->parse(WCF::getLanguage()->get('wot.mission.mission6.sender.owner')); $subject = $this->parse(WCF::getLanguage()->get('wot.mission.mission6.impact.owner.subject')); MessageEditor::create($this->ownerID, $subject, $this->ereport, 0, $senderName, 4); NMessageEditor::create($this->ownerID, array(3, 3), $subject, $this->ereport, 1); $this->saveData($this->fight); }
$page .= "<center><br><font color=#FF0000>{$lang['No_Text']}<br></font></center>"; } if ($error == 0) { $page .= "<center><font color=#00FF00>Nachricht erfolgreich verschickt!<br></font></center>"; require_once WCF_DIR . 'lib/data/message/bbcode/MessageParser.class.php'; $parser = MessageParser::getInstance(); $parser->setOutputType('text/html'); $message = MessageUtil::stripCrap(StringUtil::trim($_POST['text'])); $message = $parser->parse($message); //query para agregar un mensaje require_once LW_DIR . 'lib/data/message/MessageEditor.class.php'; require_once LW_DIR . 'lib/data/message/NMessageEditor.class.php'; $recipentID = intval($_GET['id']); $subject = escapeString(StringUtil::encodeHTML($_POST['subject'])); MessageEditor::create($recipentID, $subject, $message); NMessageEditor::create($recipentID, array(1, WCF::getUser()->userID), $subject, $message, 4); /*doquery("INSERT INTO {{table}} SET `message_owner`='".intval($_GET['id'])."', `message_sender`='{$user['id']}', `message_time`='".time()."', `message_type`='1', `message_from`='{$user['username']} [{$user['galaxy']}:{$user['system']}:{$user['planet']}]', `message_subject`='".WCF::getDB()->escapeString(StringUtil::encodeHTML($_POST['subject']))."', `message_text`='".WCF::getDB()->escapeString($message)."'" ,'messages'); $text = ''; //query para agregar un contador al due�o de ese mensaje doquery("UPDATE {{table}} SET new_message = new_message + 1 WHERE id = '".$_GET['id']."'",'users'); */ } }
/** * @see Form::save() */ public function save() { parent::save(); NMessageEditor::create($this->user->userID, array(1, WCF::getUser()->userID), $this->subject, $this->text, 4); }
/** * Save Data: Saves the combat report */ protected function saveDataReport() { // insert report if ($this->winner == 'defender' && $this->roundNo == 1) { $oneRound = true; } else { $oneRound = false; } $users = array(); foreach ($this->navalFormationUsers as $userID => $userObj) { $users[$userID] = $userID; } foreach ($this->standByUsers as $userID => $userObj) { $users[$userID] = $userID; } $report = CombatReport::create($this->impactTime, $this->report, $oneRound, $users); $reportID = $report->reportID; // sending message $subject = $this->parse(WCF::getLanguage()->get('wot.fleet.combat.subject')); $message = $this->summary; $message .= '<a class="thickbox" href="index.php?page=CombatReportView&reportID=' . $reportID; $message .= '&keepThis=true&TB_iframe=true&height=80%&width=80%">'; $message .= WCF::getLanguage()->get('wot.fleet.combat.showReport') . '</a>'; $senderOwner = WCF::getLanguage()->get('wot.fleet.combat.sender.owner'); $senderOfiara = WCF::getLanguage()->get('wot.fleet.combat.sender.ofiara'); foreach ($this->navalFormationUsers as $userID => $userObj) { NMessageEditor::create($userID, array(3, 2), $subject, '<div class="combatSummary attacker">' . $message . '</div>', 2); } foreach ($this->standByUsers as $userID => $userObj) { NMessageEditor::create($userID, array(3, 1), $subject, '<div class="combatSummary defender">' . $message . '</div>', 2); } foreach ($users as $userID) { if ($userID == $this->ofiaraID) { $sender = $senderOfiara; } else { $sender = $senderOwner; } /* if(isset($this->navalFormationUsers[$userID])) { $class = 'combatReport_attacker_'.$this->winner; $senderID = 2; } else { $class = 'combatReport_defender_'.$this->winner; $senderID = 1; } $message = $this->summary.'<br /><br />'.$message; */ MessageEditor::create($userID, $subject, $message, 0, $sender, 3); //NMessageEditor::create($userID, array(3, $senderID), // $subject, $message, 2); } }
/** * Sends the message to the ofiara of the fleet on return event. */ protected function sendReturnMessage() { $messageData = $this->getReturnMessageData(); if ($messageData !== null) { $messageData = $this->parse($messageData); MessageEditor::create($this->ownerID, $messageData['subject'], $messageData['text'], 0, $messageData['sender'], 0); NMessageEditor::create($this->ownerID, array(3, 2), $messageData['subject'], $messageData['text']); } }
/** * Sends a notification to the game operators. */ public function notify() { $sql = "INSERT IGNORE INTO ugml_message_notification\n\t\t\t\t(messageID, notificationTime)\n\t\t\t\tVALUES\n\t\t\t\t(" . $this->messageID . ", " . time() . ")"; WCF::getDB()->sendQuery($sql); $subject = WCF::getLanguage()->get('wot.messages.notification.subject'); $text = WCF::getLanguage()->get('wot.messages.notification.introduction'); $text .= "\n<br />\n"; $text .= "\n<br />\n"; $text .= "messageID: " . $this->messageID . "\n<br />\n"; $text .= "subject: \"" . $this->subject . "\"\n<br />\n"; $text .= "sender/userID: " . $this->senderID . "\n<br />\n"; $text .= "sender/name: \"" . $this->getSender()->getSenderName() . "\"\n<br />\n"; $text .= "time: " . date('r', $this->time) . " (" . $this->time . ")\n<br />\n"; $text .= "text: \n<br />\n"; $text .= "\"" . $this->text . "\""; $sql = "SELECT id\n\t\t\t\tFROM ugml_users\n\t\t\t\tWHERE notifiee = 1"; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { NMessageEditor::create($row['id'], array(1, $this->recipentID), $subject, $text, 4); } }
/** * Sends a message to all member of this alliance * * @param str subject (null for default) * @param str text * @param int rank id (-1 for all, 0 for leader) * @param Alliance startalliance */ public function sendMessageToAll($subject, $message, $rankID = -1, $alliance = null) { if ($alliance === null) { $alliance = $this; } if ($subject === null) { $subject = WCF::getLanguage()->get('wot.alliance.message.defaultSubject', array('alliance' => $alliance, 'username' => WCF::getUser()->username)); } else { $subject = StringUtil::encodeHTML($subject); } require_once WCF_DIR . 'lib/data/message/bbcode/MessageParser.class.php'; $parser = MessageParser::getInstance(); $parser->setOutputType('text/html'); $message = $parser->parse($message, true, false, true); // get members $sql = "SELECT id\n\t\t\t\tFROM ugml_users\n\t\t\t\tWHERE ally_id = " . $this->allianceID; $result = WCF::getDB()->sendQuery($sql); // send $messageBits = ""; require_once LW_DIR . 'lib/data/message/MessageEditor.class.php'; require_once LW_DIR . 'lib/data/message/NMessageEditor.class.php'; while ($row = WCF::getDB()->fetchArray($result)) { if ($rankID == -1 || $rankID > 0 && $row['ally_rank_id'] == $rankID || $rankID == 0 && $row['id'] == $this->ally_owner) { MessageEditor::create($row['id'], $subject, $message, 0, $alliance, 2); // TODO: new message subject $messageObj = NMessageEditor::create($row['id'], array(2, $this->allianceID), "Rundmail", $message, 3); $messageBits .= "(" . $messageObj->messageID . ", " . WCF::getUser()->userID . "),"; // abstract user id? } } $sql = "INSERT INTO ugml_message_circular\n\t\t\t\t(messageID, userID)\n\t\t\t\tVALUES\n\t\t\t\t" . substr($messageBits, 0, -1); WCF::getDB()->sendQuery($sql); }
/** * @see Form::save() */ public function save() { parent::save(); if ($this->agreed) { // send message to alliance if (!empty($this->answerText)) { $message = WCF::getLanguage()->get('wot.alliance.newMember.alliance', array('answer' => $this->answerText, 'username' => $this->user->username)); } else { $message = WCF::getLanguage()->get('wot.alliance.newMember.alliance.noAnswer', array('username' => $this->user->username)); } $this->alliance->sendMessageToAll(null, $message); // insert into alliance $this->alliance->addUser($this->userID); // send message to user if (!empty($this->answerText)) { $message = WCF::getLanguage()->get('wot.alliance.newMember.user', array('answer' => $this->answerText, 'alliance' => $this->alliance)); } else { $message = WCF::getLanguage()->get('wot.alliance.newMember.user.noAnswer', array('alliance' => $this->alliance)); } MessageEditor::create($this->userID, WCF::getLanguage()->get('wot.alliance.application'), $message, 0, $this->alliance, 0); NMessageEditor::create($this->userID, array(2, $this->alliance->allianceID), WCF::getLanguage()->get('wot.alliance.application'), $message, 3); } else { // update user $sql = "UPDATE ugml_users\n\t\t\t\t\tSET ally_request = NULL,\n\t\t\t\t\t\tally_request_text = '',\n\t\t\t\t\t\tally_register_time = 0\n\t\t\t\t\tWHERE id = " . $this->userID; WCF::getDB()->sendQuery($sql); $sql = "DELETE FROM wcf" . WCF_N . "_session\n\t\t\t\t\tWHERE userID = " . $this->userID; WCF::getDB()->sendQuery($sql); // send message to user if (!empty($this->answerText)) { $message = WCF::getLanguage()->get('wot.alliance.application.disagreed', array('answer' => $this->answerText, 'alliance' => $this->alliance)); } else { $message = WCF::getLanguage()->get('wot.alliance.application.disagreed.noAnswer', array('alliance' => $this->alliance)); } MessageEditor::create($this->userID, WCF::getLanguage()->get('wot.alliance.application'), $message, 0, $this->alliance, 0); NMessageEditor::create($this->userID, array(2, $this->alliance->allianceID), WCF::getLanguage()->get('wot.alliance.application'), $message); } header('Location: index.php?page=AllianceApplicationsList'); exit; }