/**
  * @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);
 }
示例#2
0
         $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);
     }
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     if (WCF::getUser()->hasDiliziumFeature("messageFolders")) {
         $this->folders = MessageFolder::getByUserID(WCF::getUser()->userID);
         if (WCF::getUser()->new_message && $this->active === null && !$this->checked) {
             // show new messages
             $this->messages = NMessage::getByUserID(WCF::getUser()->userID, null, null, true, self::MESSAGES_FOLDERS + 1, ($this->pageNo - 1) * self::MESSAGES_FOLDERS);
             foreach ($this->messages as $message) {
                 if (!isset($this->spare[$message->folderID])) {
                     $this->spare[$message->folderID] = $message->folderID;
                 }
             }
         } else {
             // show requested messages
             if ($this->active === null && !$this->checked) {
                 $this->active = array();
             }
             $this->messages = NMessage::getByUserID(WCF::getUser()->userID, $this->checked, $this->active, false, self::MESSAGES_FOLDERS + 1, ($this->pageNo - 1) * self::MESSAGES_FOLDERS);
         }
         $this->nextPage = count($this->messages) > self::MESSAGES_FOLDERS;
         if ($this->nextPage) {
             array_pop($this->messages);
         }
     } else {
         $this->pageNo = 1;
         $this->messages = NMessage::getByUserID(WCF::getUser()->userID, $this->checked, $this->active, false, self::MESSAGES);
     }
     // update data
     $messageUpdates = array();
     foreach ($this->messages as $message) {
         if (!$message->viewed) {
             $messageUpdates[] = $message->messageID;
         }
     }
     if (count($messageUpdates)) {
         NMessageEditor::view($messageUpdates, WCF::getUser()->userID);
     }
 }
 /**
  * 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']);
     }
 }
示例#7
0
 /**
  * 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);
     }
 }
示例#8
0
 /**
  * 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 Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         die('invalid userID');
     }
     if (!preg_match('/^(?:check(?:|All|Visible)|delete(?:|All|(?:Unc|C)hecked)|notify|uncheck(?:Checked|Visible))$/', $this->command)) {
         die('invalid command');
     }
     // message-related commands
     if (preg_match('/^(?:check|delete|notify)$/', $this->command)) {
         $message = new NMessage($this->messageID);
         if (!$message->messageID || $message->recipentID != WCF::getUser()->userID) {
             die('invalid messageID');
         }
         if ($this->command == 'notify' && !$message->getSender() instanceof UserMessageSender) {
             die('invalid messageID');
         }
         $editor = $message->getEditor();
     }
     if ($this->command == 'check') {
         $editor->check();
     }
     if ($this->command == 'checkAll') {
         NMessageEditor::checkAll(WCF::getUser()->userID);
     }
     if ($this->command == 'checkVisible') {
         NMessageEditor::checkAll(WCF::getUser()->userID, 1, $this->folderIDs);
     }
     if ($this->command == 'delete') {
         $editor->delete();
     }
     if ($this->command == 'deleteAll') {
         NMessageEditor::deleteAll(WCF::getUser()->userID);
     }
     if ($this->command == 'deleteChecked') {
         NMessageEditor::deleteAll(WCF::getUser()->userID, 1);
     }
     if ($this->command == 'deleteUnchecked') {
         NMessageEditor::deleteAll(WCF::getUser()->userID, 0);
     }
     if ($this->command == 'notify') {
         $message->notify();
     }
     if ($this->command == 'uncheckChecked') {
         NMessageEditor::checkAll(WCF::getUser()->userID, 0);
     }
     if ($this->command == 'uncheckVisible') {
         NMessageEditor::checkAll(WCF::getUser()->userID, 0, $this->folderIDs);
     }
     $this->executed();
     // message-related commands
     if (preg_match('/^(?:check|delete|notify)$/', $this->command)) {
         die('done');
     }
     $matches = array();
     $referrer = $_SERVER["HTTP_REFERER"];
     $url = "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
     preg_match('/^https?:(\\/\\/[^\\/]*)\\/[^\\?]*\\??[^\\?]*$/', $url, $matches);
     $base = $matches[1];
     preg_match('/^https?:(\\/\\/[^\\/]*)\\/[^\\?]*\\??[^\\?]*$/', $referrer, $matches);
     $base2 = $matches[1];
     if ($base == $base2) {
         header('Location: ' . $referrer);
     } else {
         header('Location: index.php?page=Messages');
     }
     exit;
 }
 /**
  * @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;
 }