/** * @see Page::readData() */ public function readData() { parent::readData(); // Lade Content $uwp = new UserWantedPosterData($this->userID); $this->uwpData = $uwp->readEntry(); // Wandle BBCode um und newlines if (isset($this->uwpData['text'])) { $bbcode = new MessageParser(); $this->uwpData['text'] = $bbcode->parse($this->uwpData['text'], $this->uwpData['enableSmilies'], $this->uwpData['enableHtml'], $this->uwpData['enableBBCodes']); } }
/** * Returns the formatted content. * * @return string */ public function getFormattedContent() { require_once(WCF_DIR.'lib/data/message/bbcode/MessageParser.class.php'); MessageParser::getInstance()->setOutputType('text/html'); return MessageParser::getInstance()->parse($this->content, true, false, true, false); }
/** * Returns an instance of MessageParser class. * * @return MessageParser */ public static function getInstance() { if (self::$instance == null) { self::$instance = new MessageParser(); } return self::$instance; }
/** * Returns the text of this message. * * @return string */ public function getFormattedMessage() { // parse message $parser = MessageParser::getInstance(); $parser->setOutputType('text/html'); return $parser->parse($this->message, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes, !$this->messagePreview); }
/** * @see Tagged::getDescription() */ public function getDescription() { require_once WCF_DIR . 'lib/data/message/bbcode/MessageParser.class.php'; $parser = MessageParser::getInstance(); $parser->setOutputType('text/html'); return $parser->parse($this->firstPostPreview, true, false, true, false); }
/** * Returns the formatted jurytalk. * * @return string */ public function getFormattedMessage() { $enableSmilies = 1; $enableHtml = 0; $enableBBCodes = 1; MessageParser::getInstance()->setOutputType('text/html'); return MessageParser::getInstance()->parse($this->message, $enableSmilies, $enableHtml, $enableBBCodes); }
/** * Returns the formatted message. * * @return string */ public function getFormattedMessage() { require_once WCF_DIR . 'lib/data/message/bbcode/MessageParser.class.php'; MessageParser::getInstance()->setOutputType('text/html'); require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php'; AttachmentBBCode::setMessageID($this->contestID); return MessageParser::getInstance()->parse($this->message, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes, !$this->messagePreview); }
/** * @see Module::readData() */ public function readData() { parent::readData(); // parse text require_once WCF_DIR . 'lib/data/message/bbcode/MessageParser.class.php'; $parser = MessageParser::getInstance(); $this->getOptions()->getGroup('general')->getOption('content')->setValue($parser->parse($this->getOptions()->getGroup('general')->getOption('content')->getValue(), true, false, true)); }
public function getFormattedContent() { $this->formattedContent = WCF::getLanguage()->getDynamicVariable('wcf.sketchbook.sketchContents.' . SketchbookUtil::nameToLangVar($this->name)); EventHandler::fireAction($this, 'shouldParseMessage'); MessageParser::getInstance()->setOutputType('text/html'); $this->formattedContent = MessageParser::getInstance()->parse($this->formattedContent, $this->enableSmilies, $this->enableHTML, $this->enableBBCodes); EventHandler::fireAction($this, 'didParseMessage'); return $this->formattedContent; }
/** * @see Form::submit() */ public function submit() { EventHandler::fireAction($this, 'submit'); $this->readFormParameters(); try { $this->preview = MessageParser::getInstance()->parse($this->text, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes, false); $this->validate(); } catch (UserInputException $e) { $this->errorField = $e->getField(); $this->errorType = $e->getType(); } }
/** * Returns an excerpt of the message. * * @return string */ public function getExcerpt() { $enableSmilies = 1; $enableHtml = 0; $enableBBCodes = 1; MessageParser::getInstance()->setOutputType('text/plain'); $message = MessageParser::getInstance()->parse($this->comment, $enableSmilies, $enableHtml, $enableBBCodes); // get abstract if (StringUtil::length($message) > 50) { $message = StringUtil::substring($message, 0, 47) . '...'; } return $message; }
/** * @see ViewablePost::getFormattedMessage() */ public function getFormattedMessage($outputType = 'text/html') { if ($outputType === 'text/html') { return parent::getFormattedMessage(); } if ($outputType == 'text/plain') { $message = StringUtil::stripHTML($this->message); } else { $message = $this->message; } require_once WCF_DIR . 'lib/data/message/bbcode/MessageParser.class.php'; MessageParser::getInstance()->setOutputType($outputType); return MessageParser::getInstance()->parse($message, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes, false); }
/** * Returns the signature of the message author. * * @return string */ public function getSignature() { if ($this->signature === null) { $this->signature = ''; if ($this->showSignature && (!WCF::getUser()->userID || WCF::getUser()->showSignature) && !$this->user->disableSignature) { if ($this->user->signatureCache) { $this->signature = $this->user->signatureCache; } else { if ($this->user->signature) { $parser = MessageParser::getInstance(); $parser->setOutputType('text/html'); $this->signature = $parser->parse($this->user->signature, $this->user->enableSignatureSmilies, $this->user->enableSignatureHtml, $this->user->enableSignatureBBCodes, false); } } } } return $this->signature; }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if (MODULE_USER_SIGNATURE == 1) { if ((!WCF::getUser()->userID || WCF::getUser()->showSignature) && !$eventObj->frame->getUser()->disableSignature) { $signature = ''; if ($eventObj->frame->getUser()->signatureCache) { $signature = $eventObj->frame->getUser()->signatureCache; } else { if ($eventObj->frame->getUser()->signature) { require_once WCF_DIR . 'lib/data/message/bbcode/MessageParser.class.php'; $parser = MessageParser::getInstance(); $parser->setOutputType('text/html'); $signature = $parser->parse($eventObj->frame->getUser()->signature, $eventObj->frame->getUser()->enableSignatureSmilies, $eventObj->frame->getUser()->enableSignatureHtml, $eventObj->frame->getUser()->enableSignatureBBCodes, false); } } if (!empty($signature)) { WCF::getTPL()->append('additionalAboutMeContent', '<div class="signature">' . $signature . '</div>'); } } } }
/** * Sends e-mail notifications to all given recipients. * * @param array<User> */ public function sendNotifications($recipients) { require_once WCF_DIR . 'lib/data/mail/Mail.class.php'; require_once WCF_DIR . 'lib/system/language/Language.class.php'; // get attachments if ($this->attachments > 0) { require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php'; require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php'; $attachmentList = new MessageAttachmentList($this->pmID, 'pm'); AttachmentBBCode::setAttachments($attachmentList->getSortedAttachments()); } // get parsed text require_once WCF_DIR . 'lib/data/message/bbcode/MessageParser.class.php'; $parser = MessageParser::getInstance(); $parser->setOutputType('text/plain'); $parsedText = $parser->parse($this->message, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes, false); // send notifications $languages = array(); $languages[0] = $languages[WCF::getLanguage()->getLanguageID()] = WCF::getLanguage(); foreach ($recipients as $recipient) { // no notification for the author if ($recipient->userID == $this->userID) { continue; } // get language if (!isset($languages[$recipient->languageID])) { $languages[$recipient->languageID] = Language::getLanguageObjectByID($recipient->languageID); } // enable language $languages[$recipient->languageID]->setLocale(); // send mail $subjectData = array('$author' => $this->username, 'PAGE_TITLE' => $languages[$recipient->languageID]->get(PAGE_TITLE)); $messageData = array('PAGE_TITLE' => $languages[$recipient->languageID]->get(PAGE_TITLE), '$recipient' => $recipient->username, '$author' => $this->username, 'PAGE_URL' => PAGE_URL, '$subject' => $this->subject, '$text' => $parsedText); $mail = new Mail(array($recipient->username => $recipient->email), $languages[$recipient->languageID]->get('wcf.pm.notification.subject', $subjectData), $languages[$recipient->languageID]->get('wcf.pm.notification.mail', $messageData)); $mail->send(); } // enable user language WCF::getLanguage()->setLocale(); }
Crear una nueva tabla donde se almacenaran los mensajes. "message_sender = 1" message_id, message_owner, message_sender, message_type, message_time, message_subject,y message_text */ $error = 0; if (!$_POST["subject"]) { $error++; $page .= "<center><br><font color=#FF0000>{$lang['No_Subject']}<br></font></center>"; } if (!$_POST["text"]) { $error++; $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'; $recipentID = intval($_GET['id']); $subject = escapeString(StringUtil::encodeHTML($_POST['subject'])); MessageEditor::create($recipentID, $subject, $message); /*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']))."',
/** * Returnes the html version of the bash content * @return string */ public function getFormatedText() { require_once WCF_DIR . 'lib/data/message/bbcode/MessageParser.class.php'; $parser = MessageParser::getInstance(); return $parser->parse($this->text, $this->enableSmilies, $this->enableHTML, $this->enableBBCodes); }
/** * Sends the email notification. */ public function sendNotification($post = null, $attachmentList = null) { $sql = "SELECT\t\tuser.*\n\t\t\tFROM\t\twbb" . WBB_N . "_board_subscription subscription\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_user user\n\t\t\tON\t\t(user.userID = subscription.userID)\n\t\t\tWHERE\t\tsubscription.boardID = " . $this->boardID . "\n\t\t\t\t\tAND subscription.enableNotification = 1\n\t\t\t\t\tAND subscription.emails = 0\n\t\t\t\t\tAND subscription.userID <> " . $this->userID . "\n\t\t\t\t\tAND user.userID IS NOT NULL"; $result = WCF::getDB()->sendQuery($sql); if (WCF::getDB()->countRows($result)) { // get first post if ($post === null) { require_once WBB_DIR . 'lib/data/post/Post.class.php'; $post = new Post($this->firstPostID); } // get attachments if ($attachmentList === null) { require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php'; $attachmentList = new MessageAttachmentList($this->firstPostID); $attachmentList->readObjects(); } // set attachments require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php'; AttachmentBBCode::setAttachments($attachmentList->getSortedAttachments()); // parse text require_once WCF_DIR . 'lib/data/message/bbcode/MessageParser.class.php'; $parser = MessageParser::getInstance(); $parser->setOutputType('text/plain'); $parsedText = $parser->parse($post->message, $post->enableSmilies, $post->enableHtml, $post->enableBBCodes, false); // truncate message if (!POST_NOTIFICATION_SEND_FULL_MESSAGE && StringUtil::length($parsedText) > 500) { $parsedText = StringUtil::substring($parsedText, 0, 500) . '...'; } // send notifications $languages = array(); $languages[WCF::getLanguage()->getLanguageID()] = WCF::getLanguage(); $languages[0] = WCF::getLanguage(); require_once WCF_DIR . 'lib/data/mail/Mail.class.php'; require_once WCF_DIR . 'lib/data/user/User.class.php'; require_once WBB_DIR . 'lib/data/board/Board.class.php'; $board = Board::getBoard($this->boardID); while ($row = WCF::getDB()->fetchArray($result)) { $recipient = new User(null, $row); // get language if (!isset($languages[$recipient->languageID])) { $languages[$recipient->languageID] = new Language($recipient->languageID); } // enable language $languages[$recipient->languageID]->setLocale(); // send mail $data = array('PAGE_TITLE' => $languages[$recipient->languageID]->get(PAGE_TITLE), 'PAGE_URL' => PAGE_URL, '$recipient' => $recipient->username, '$author' => $this->username, '$boardTitle' => $languages[$recipient->languageID]->get($board->title), '$topic' => $this->topic, '$threadID' => $this->threadID, '$text' => $parsedText); $mail = new Mail(array($recipient->username => $recipient->email), $languages[$recipient->languageID]->get('wbb.threadAdd.notification.subject', array('$title' => $languages[$recipient->languageID]->get($board->title))), $languages[$recipient->languageID]->get('wbb.threadAdd.notification.mail', $data)); $mail->send(); } // enable user language WCF::getLanguage()->setLocale(); // update notification count $sql = "UPDATE\twbb" . WBB_N . "_board_subscription\n\t\t\t\tSET \temails = emails + 1\n\t\t\t\tWHERE\tboardID = " . $this->boardID . "\n\t\t\t\t\tAND enableNotification = 1\n\t\t\t\t\tAND emails = 0"; WCF::getDB()->registerShutdownUpdate($sql); } }
/** * 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 require_once LW_DIR . 'lib/data/message/MessageEditor.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); } } }
/** * Starts the download of the specified messages. * * @param string $pmIDs */ public static function downloadAll($pmIDs) { // count messages $sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twcf" . WCF_N . "_pm\n\t\t\tWHERE\tpmID IN (" . $pmIDs . ")"; $row = WCF::getDB()->getFirstRow($sql); $count = $row['count']; // get recipients $recpients = array(); $sql = "SELECT\t\t*\n\t\t\tFROM\t\twcf" . WCF_N . "_pm_to_user\n\t\t\tWHERE\t\tpmID IN (" . $pmIDs . ")\n\t\t\t\t\tAND isBlindCopy = 0\n\t\t\tORDER BY\trecipient"; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { if (!isset($recpients[$row['pmID']])) { $recpients[$row['pmID']] = array(); } $recpients[$row['pmID']][] = new PMRecipient(null, null, $row); } // get messages if ($count > 1) { $zip = new ZipWriter(); } $sql = "SELECT\t\trecipient.*,\n\t\t\t\t\tpm.*\n\t\t\tFROM\t\twcf" . WCF_N . "_pm pm\n\t\t\tLEFT JOIN \twcf" . WCF_N . "_pm_to_user recipient\n\t\t\tON \t\t(recipient.pmID = pm.pmID\n\t\t\t\t\tAND recipient.recipientID = " . WCF::getUser()->userID . "\n\t\t\t\t\tAND recipient.isDeleted < 2)\n\t\t\tWHERE\t\tpm.pmID IN (" . $pmIDs . ")\n\t\t\tGROUP BY\tpm.pmID\n\t\t\tORDER BY\tpm.time DESC"; $result = WCF::getDB()->sendQuery($sql); $messageNo = 1; while ($row = WCF::getDB()->fetchArray($result)) { $pm = new PM(null, $row); $pm->setRecipients(isset($recpients[$row['pmID']]) ? $recpients[$row['pmID']] : array()); // get parsed text require_once WCF_DIR . 'lib/data/message/bbcode/MessageParser.class.php'; $parser = MessageParser::getInstance(); $parser->setOutputType('text/plain'); $parsedText = $parser->parse($pm->message, $pm->enableSmilies, $pm->enableHtml, $pm->enableBBCodes, false); $data = array('$author' => $pm->username ? $pm->username : WCF::getLanguage()->get('wcf.pm.author.system'), '$date' => DateUtil::formatTime(null, $pm->time), '$recipient' => implode(', ', $pm->getRecipients()), '$subject' => $pm->subject, '$text' => $parsedText); if ($count == 1) { // send headers // file type @header('Content-Type: text/plain'); // file name @header('Content-disposition: attachment; filename="' . $pm->pmID . '-' . preg_replace('~[^a-z0-9_ -]+~i', '', $pm->subject) . '.txt"'); // no cache headers @header('Pragma: no-cache'); @header('Expires: 0'); // output message echo (CHARSET == 'UTF-8' ? "" : '') . WCF::getLanguage()->get('wcf.pm.download.message', $data); exit; } else { $zip->addFile((CHARSET == 'UTF-8' ? "" : '') . WCF::getLanguage()->get('wcf.pm.download.message', $data), $pm->pmID . '-' . preg_replace('~[^a-z0-9_ -]+~i', '', $pm->subject) . '.txt', $pm->time); } $messageNo++; } if ($messageNo > 1) { // send headers // file type @header('Content-Type: application/octet-stream'); // file name @header('Content-disposition: attachment; filename="messages-' . ($messageNo - 1) . '.zip"'); // no cache headers @header('Pragma: no-cache'); @header('Expires: 0'); // output file echo $zip->getFile(); exit; } }
/** * @see Form::submit() */ public function submit() { $this->readFormParameters(); try { // preview if ($this->preview) { $this->guestbookPreview = MessageParser::getInstance()->parse($this->text, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes); $this->validate(); } else { $this->validate(); $this->save(); } } catch (UserInputException $e) { $this->errorField = $e->getField(); $this->errorType = $e->getType(); } }
/** * @see Form::submit() */ public function submit() { EventHandler::fireAction($this, 'submit'); $this->readFormParameters(); try { // attachment handling if ($this->showAttachments) { $this->attachmentsEditor->handleRequest(); } // preview if ($this->preview || $this->upload) { require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php'; AttachmentBBCode::setAttachments($this->attachmentsEditor->getSortedAttachments()); $this->wantedPosterPreview = MessageParser::getInstance()->parse($this->text, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes, false); if ($this->preview) { $this->validate(); } } else { $this->validate(); $this->save(); } } catch (UserInputException $e) { $this->errorField = $e->getField(); $this->errorType = $e->getType(); } }
/** * @see Form::save() */ public function save() { parent::save(); // save changes $this->signatureCache = MessageParser::getInstance()->parse($this->text, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes, false); $fields = array('signature' => $this->text, 'signatureCache' => $this->signatureCache, 'enableSignatureSmilies' => $this->enableSmilies, 'enableSignatureHtml' => $this->enableHtml, 'enableSignatureBBCodes' => $this->enableBBCodes); $editor = WCF::getUser()->getEditor(); $editor->updateFields($fields); $editor->updateOptions(array('wysiwygEditorMode' => $this->wysiwygEditorMode, 'wysiwygEditorHeight' => $this->wysiwygEditorHeight)); $this->saved(); // show success message WCF::getTPL()->assign('success', true); }
/** * @see UserOptionOutput::getOutput() */ public function getOutput(User $user, $optionData, $value) { require_once WCF_DIR . 'lib/data/message/bbcode/MessageParser.class.php'; MessageParser::getInstance()->setOutputType('text/html'); return MessageParser::getInstance()->parse($value); }
/** * @see Page::readData() */ public function readData() { parent::readData(); // Löschen if (isset($_REQUEST['action'])) { if ($_REQUEST['action'] == 'delete' && !empty($_REQUEST['id'])) { if ($this->user->userID != WCF::getUser()->userID && !WCF::getUser()->getPermission('mod.guestbook.canDeleteEntrys')) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } else { $userGB = new UserGuestbookData($this->userID); $userGB->deleteEntry($_REQUEST['id']); } } else { if ($_REQUEST['action'] == 'deleteComment' && !empty($_REQUEST['id'])) { if ($this->user->userID != WCF::getUser()->userID || !WCF::getUser()->getPermission('user.guestbook.canComment')) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } else { $userGB = new UserGuestbookData($this->userID); $userGB->deleteComment($_REQUEST['id']); } } else { if (($_REQUEST['action'] == 'lock' || $_REQUEST['action'] == 'unlock') && !empty($_REQUEST['userID'])) { if (!WCF::getUser()->getPermission('mod.guestbook.canLock')) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } else { $userGB = new UserGuestbookData($this->userID); $userGB->lockEntry($_REQUEST['userID'], $_REQUEST['action']); } } } } } // Statistiken if ($this->user->userID && WCF::getUser()->userID && (empty($this->pageNo) || $this->pageNo < 2)) { if ($this->user->userID != WCF::getUser()->userID) { UserGuestbookData::updateStatsVisitor(WCF::getUser()->userID); } else { UserGuestbookData::updateStatsUser(); } } $stats = UserGuestbookData::getStats(); $this->cntEntries = $stats['entries']; $this->cntViews = $stats['views']; $this->lastVisitor = $stats['lastVisitor']; $this->visitorLastVisit = $stats['visitorLastVisit']; // Lade Gästebuchdaten $userGB = new UserGuestbookData($this->userID); $this->gbData = $userGB->getEntries($this->pageNo, $this->itemsPerPage); // Wandle BBCode um und newlines $bbcode = new MessageParser(); foreach ($this->gbData as $p => $v) { $this->gbData[$p]['text'] = $bbcode->parse($v['text'], $v['enableSmilies'], $v['enableHtml'], $v['enableBBCodes']); if (!empty($v['comment'])) { $this->gbData[$p]['comment'] = $bbcode->parse($v['comment'], $v['enableSmilies'], $v['enableHtml'], $v['enableBBCodes']); } // permissions $editTime = intval(WCF::getUser()->getPermission('user.guestbook.canEditOwnEntries')); if (WCF::getUser()->getPermission('mod.guestbook.canDeleteEntrys') || $v['userID'] == WCF::getUser()->userID) { $this->gbData[$p]['permDelete'] = true; } else { $this->gbData[$p]['permDelete'] = false; } if (WCF::getUser()->getPermission('mod.guestbook.canEditAll') || WCF::getUser()->getPermission('user.guestbook.canEditOwnGuestbook') && $v['userID'] == WCF::getUser()->userID || $editTime != 0 && $v['fromUserID'] == WCF::getUser()->userID && ($editTime == -1 || $v['entryTime'] > TIME_NOW - $editTime)) { $this->gbData[$p]['permEdit'] = true; } else { $this->gbData[$p]['permEdit'] = false; } if (WCF::getUser()->getPermission('user.guestbook.canComment') && $v['userID'] == WCF::getUser()->userID) { $this->gbData[$p]['permComment'] = true; } else { $this->gbData[$p]['permComment'] = false; } } }
/** * Returns formatted message. */ public function getFormattedMessage() { $parser = MessageParser::getInstance(); $parser->setOutputType('text/html'); return $parser->parse($this->text, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes, false); }
/** * 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); }