public function renderFile() { $oDocument = new DOMDocument(); $oRoot = $oDocument->createElement("rss"); $oRoot->setAttribute('version', "2.0"); $oDocument->appendChild($oRoot); $oChannel = $oDocument->createElement("channel"); /** * @todo parametrize the argument */ $oQuery = FrontendJournalEntryQuery::create()->mostRecentFirst()->limit(10); if ($this->aJournalIds) { $oQuery->filterByJournalId($this->aJournalIds); } self::addSimpleAttribute($oDocument, $oChannel, 'title', $this->oJournalPage->getPageTitle()); self::addSimpleAttribute($oDocument, $oChannel, 'description', $this->oJournalPage->getDescription()); self::addSimpleAttribute($oDocument, $oChannel, 'link', LinkUtil::absoluteLink(LinkUtil::link($this->oJournalPage->getFullPathArray(), 'FrontendManager'), null, LinkUtil::isSSL())); self::addSimpleAttribute($oDocument, $oChannel, 'language', Session::language()); self::addSimpleAttribute($oDocument, $oChannel, 'ttl', "15"); $oRoot->appendChild($oChannel); $aJournalEntries = $oQuery->find(); foreach ($aJournalEntries as $oJournalEntry) { $oItem = $oDocument->createElement('item'); foreach ($oJournalEntry->getRssAttributes($this->aJournalIds ? $this->oJournalPage : null) as $sAttributeName => $mAttributeValue) { self::attributeToNode($oDocument, $oItem, $sAttributeName, $mAttributeValue); } $oChannel->appendChild($oItem); } print $oDocument->saveXML(); }
/** send() * Description: * • This method is called when NewsletterMailer is instanciated * • All newsletter, sender and recipient info are ready * * @return boolean has_invalid email addresses */ public function send() { // Get newsletter email main template and template body and css by template name $oEmailTemplate = new Template('main', array(DIRNAME_TEMPLATES, 'newsletter')); $oEmailTemplate->replaceIdentifier('newsletter_template_css', new Template("{$this->oNewsletter->getTemplateName()}.css", array(DIRNAME_TEMPLATES, 'newsletter'))); // Parse links differently in text RichtextUtil::$USE_ABSOLUTE_LINKS = LinkUtil::isSSL(); $oEMailContent = RichtextUtil::parseStorageForFrontendOutput(stream_get_contents($this->oNewsletter->getNewsletterBody())); RichtextUtil::$USE_ABSOLUTE_LINKS = null; // Replace add surrounding (body.tmpl) before content if exists. Template needs to contain a newsletter_content identifier if (ResourceFinder::findResource(array(DIRNAME_TEMPLATES, NewsletterDetailWidgetModule::NEWSLETTER_DIRNAME, "{$this->oNewsletter->getTemplateName()}.body.tmpl")) !== null) { $oEmailTemplate->replaceIdentifier('newsletter_content', new Template("{$this->oNewsletter->getTemplateName()}.body", array(DIRNAME_TEMPLATES, NewsletterDetailWidgetModule::NEWSLETTER_DIRNAME)), null, Template::LEAVE_IDENTIFIERS); } $oEmailTemplate->replaceIdentifier('newsletter_content', $oEMailContent, null, Template::LEAVE_IDENTIFIERS); $oEmailTemplate->replaceIdentifier('subject', $this->oNewsletter->getSubject()); $oEmailTemplate->replaceIdentifier('language', $this->oNewsletter->getLanguageId()); $oEmailTemplate->replaceIdentifier('newsletter_link', LinkUtil::absoluteLink($this->oNewsletter->getDisplayLink())); $oEmailTemplate->replaceIdentifier('newsletter_date', LocaleUtil::localizeDate(null, $this->oNewsletter->getLanguageId())); $oEmailTemplate->replaceIdentifier('newsletter_timestamp', time()); // Process templates with each recipient, depending on whether recipient is object and object of Subscriber or string foreach ($this->aRecipients as $mRecipient) { $this->sendNewsletter($mRecipient, clone $oEmailTemplate); } return count($this->aInvalidEmails) === 0; }
public function getRssAttributes($oJournalPage = null, $bIsForRpc = false) { $aResult = array(); $aResult['title'] = $this->getTitle(); $aJournalPageLink = $this->getLink($oJournalPage); $aResult['link'] = LinkUtil::absoluteLink(LinkUtil::link($aJournalPageLink, 'FrontendManager'), null, LinkUtil::isSSL()); if ($bIsForRpc) { $aResult['description'] = RichtextUtil::parseStorageForBackendOutput($this->getText())->render(); } else { $aResult['description'] = RichtextUtil::parseStorageForFrontendOutput($this->getText())->render(); } $aResult['author'] = $this->getUserRelatedByCreatedBy()->getEmail() . ' (' . $this->getUserRelatedByCreatedBy()->getFullName() . ')'; $aTags = TagPeer::tagInstancesForObject($this); $aCategories = array(); foreach ($aTags as $oTag) { $aCategories[] = $oTag->getTagName(); } $aResult[$bIsForRpc ? 'categories' : 'category'] = $aCategories; if ($aJournalPageLink) { $aResult['guid'] = $aResult['link']; } else { $aResult['guid'] = array('isPermaLink' => 'false', '__content' => $this->getId() . "-" . $this->getJournal()->getId()); } $aResult['pubDate'] = date(DATE_RSS, (int) $this->getCreatedAtTimestamp()); if ($bIsForRpc) { $aResult['dateCreated'] = new xmlrpcval(iso8601_encode((int) $this->getCreatedAtTimestamp()), 'dateTime.iso8601'); $aResult['date_created_gmt'] = new xmlrpcval(iso8601_encode((int) $this->getCreatedAtTimestamp(), 1), 'dateTime.iso8601'); $aResult['postid'] = $this->getId(); } else { $aEnclosures = array(); foreach ($this->getImages() as $oImage) { $oDocument = $oImage->getDocument(); $aEnclosures[] = array('length' => $oDocument->getDataSize(), 'type' => $oDocument->getMimetype(), 'url' => LinkUtil::absoluteLink($oDocument->getLink(), null, LinkUtil::isSSL())); } $aResult['enclosure'] = $aEnclosures; } return $aResult; }
private function renderNavigationItem($oNavigationItem) { $oUrl = $this->oXmlDocument->createElement('url'); //Location, absolute url $sAbsoluteLink = LinkUtil::absoluteLink(LinkUtil::link($oNavigationItem->getLink(), 'FrontendManager'), null, LinkUtil::isSSL()); $oUrl->appendChild($this->element('loc', $sAbsoluteLink)); //Last modified if ($oNavigationItem instanceof PageNavigationItem) { $oUrl->appendChild($this->element('lastmod', $oNavigationItem->getMe()->getUpdatedAt('Y-m-d'))); } else { //@todo: figure out how to retrieve last modified for content other then text and configuration: FrontendModules } //Priority $iPriority = 1; if ($oNavigationItem->getCanonical() !== null) { $iPriority = 0.5; } $oUrl->appendChild($this->element('priority', $iPriority)); $this->oUrl->appendChild($oUrl); foreach ($oNavigationItem->getChildren(null, false, true) as $oChild) { $this->renderNavigationItem($oChild); } }
private function contentAction() { $sLanguageId = Manager::usePath(); $sDocumentationKey = Manager::usePath(); $sPartKey = Manager::usePath(); RichtextUtil::$USE_ABSOLUTE_LINKS = LinkUtil::isSSL(); if ($sPartKey) { $oPart = DocumentationPartQuery::create()->filterByLanguageId($sLanguageId)->filterByKeys($sDocumentationKey, $sPartKey)->findOne(); if (!$oPart) { if ($sPartKey === self::TUTORIAL_KEY) { return TranslationPeer::getString('wns.documentation.video_tutorial', $sLanguageId, "Tutorial"); } return null; } return RichtextUtil::parseStorageForFrontendOutput($oPart->getBody())->render(); } else { $oDocumentation = DocumentationQuery::create()->filterByLanguageId($sLanguageId)->filterByKey($sDocumentationKey)->findOne(); if (!$oDocumentation) { return null; } $sHtmlOutput = RichtextUtil::parseStorageForFrontendOutput($oDocumentation->getDescription())->render(); $aParts = $oDocumentation->getDocumentationPartsOrdered(); if (count($aParts) > 0) { $sHtmlOutput .= '<ul class="documentation_parts">'; foreach ($aParts as $i => $oPart) { $sHtmlOutput .= TagWriter::quickTag('li', array(), self::addPartLink($oPart)); } $sHtmlOutput .= '</ul>'; } $bDisplayVideo = false; if ($bDisplayVideo && $oDocumentation->getYoutubeUrl()) { $sHtmlOutput .= $this->embedVideo($oDocumentation->getYoutubeUrl()); } return $sHtmlOutput; } }
/** * Create internal links. * The identifier value signifies the destination. It can be either a path or one of the following special values: “to_self”, “host_only”, “base_href”. * The following additional parameters are allowed: “is_absolute”, “page”, “ignore_request”, “manager” * Implicitly, the value of is_absolute determines the type of absolute link generated. * A value of “false” will not generate absolute links. * Using “auto” will determine server-side whether to use http or https for protocol. * Setting is_absolute to “http” or “https” will set the protocol accordingly. * Any other value (including “true”) will generate a protocol-relative URL (starting with //), meaning the reference is determined on the client-side. * Creating a “base_href” link will always make it absolute and not explicitly setting “is_absolute” will default to “auto” (instead of “true” as is the case with all other link types). */ public function writeLink($oTemplateIdentifier) { $sDestination = $oTemplateIdentifier->getValue(); $aParameters = $oTemplateIdentifier->getParameters(); $bIsAbsolute = false; $bAbsoluteType = $oTemplateIdentifier->getParameter('is_absolute'); if ($bAbsoluteType === 'http' || $bAbsoluteType === 'false') { $bAbsoluteType = false; } else { if ($bAbsoluteType === 'https' || $bAbsoluteType === 'true') { $bAbsoluteType = true; } else { if ($bAbsoluteType === 'auto') { $bAbsoluteType = LinkUtil::isSSL(); } else { if ($oTemplateIdentifier->hasParameter('is_absolute')) { $bAbsoluteType = null; } else { $bAbsoluteType = 'default'; } } } } unset($aParameters['is_absolute']); if ($sDestination === "to_self") { $bIgnoreRequest = $oTemplateIdentifier->getParameter('ignore_request') === 'true'; unset($aParameters['ignore_request']); $sDestination = LinkUtil::linkToSelf(null, $aParameters, $bIgnoreRequest); } else { if ($sDestination === "host_only") { return LinkUtil::absoluteLink(''); } else { if ($sDestination === "base_href") { $sDestination = MAIN_DIR_FE_PHP; $bIsAbsolute = true; if (!$oTemplateIdentifier->hasParameter('is_absolute')) { $bAbsoluteType = LinkUtil::isSSL(); } } elseif ($sPage = $oTemplateIdentifier->getParameter('page')) { $oPage = PageQuery::create()->findOneByIdentifier($sPage); if ($oPage === null) { $oPage = PageQuery::create()->findOneByName($sPage); } $sManager = 'FrontendManager'; if ($oTemplateIdentifier->hasParameter('manager')) { $sManager = $oTemplateIdentifier->getParameter('manager'); } if ($oPage) { $sDestination = LinkUtil::link($oPage->getLink(), $sManager); } } else { $sManager = null; if ($oTemplateIdentifier->hasParameter('manager')) { unset($aParameters['manager']); $sManager = $oTemplateIdentifier->getParameter('manager'); } $sDestination = LinkUtil::link($sDestination, $sManager, $aParameters); } } } return LinkUtil::absoluteLink($sDestination, null, $bAbsoluteType, !$bIsAbsolute); }
/** * notifySubscriberOptIn() * * @param int/array subscriber group * @return void */ public function notifySubscriberOptIn($iSubscriberGroupId) { $oEmailTemplate = $this->constructTemplate('email_subscription_optin_notification'); /** * note: unsubscribe_page is just the main communication page where forms like * • optin confirm or * • unsubscribe optout * can be easily displayed and safely managed */ $oUnsubscribePage = PageQuery::create()->findOneByIdentifier(Settings::getSetting('newsletter', 'unsubscribe_page', 'unsubscribe')); if ($oUnsubscribePage === null) { // Fallback: try searching the page by name $oUnsubscribePage = PageQuery::create()->findOneByName(Settings::getSetting('newsletter', 'unsubscribe_page', 'unsubscribe')); if ($oUnsubscribePage === null) { throw new Exception('Error in' . __METHOD__ . ': a public and hidden page is required for optin subscribe action'); } } $oOptinConfirmLink = LinkUtil::absoluteLink(LinkUtil::link($oUnsubscribePage->getLink(), null, array(self::PARAM_OPT_IN_CONFIRM => Subscriber::getOptInChecksumByEmailAndSubscriberGroupId($this->oSubscriber->getEmail(), $iSubscriberGroupId))), null, LinkUtil::isSSL()); $oEmailTemplate->replaceIdentifier('optin_link', TagWriter::quickTag('a', array('href' => $oOptinConfirmLink), TranslationPeer::getString('newsletter_subscription.optin_link_text'))); $this->sendMail($oEmailTemplate, true); }
private function consolidationStepForResourceType($sType, $bExcludeExternal, $iPriority, $sKey, &$aConsolidatorInfo, &$resource_type, &$file_resource, &$location, &$content, &$template, &$media, $aResourceInfo) { $sSSLMode = 'default'; if ($resource_type !== $sType && $resource_type !== "inline_{$sType}") { return; } //External location (no file_resource given) or location not determinable $bIsExternal = $file_resource === null && $content === null; // Files with external references should only be consolidated if explicitly requested (resource_includer.yml/general/consolidate_resources == 'internal' disables this) $bShouldNotBeConsolidated = $bIsExternal && ($bExcludeExternal || $location === null); // Files with an IE condition can’t be consolidated because the condition (unlike CSS media queries) can only be set in HTML $bShouldNotBeConsolidated = $bShouldNotBeConsolidated || isset($aResourceInfo['ie_condition']); if ($bShouldNotBeConsolidated) { $this->cleanupConsolidator($aConsolidatorInfo); } else { $this->initConsolidator($sType, $iPriority, $sKey, $aConsolidatorInfo); $oCache = new Cache('consolidated-' . $sKey, DIRNAME_PRELOAD, CachingStrategy::fromConfig('file')); if (!$oCache->entryExists()) { $sRelativeLocationRoot = null; $sContents = ''; if ($file_resource !== null) { // We have a file resource $sContents = file_get_contents($file_resource->getFullPath()); $sRelativeLocationRoot = LinkUtil::absoluteLink($file_resource->getFrontendPath(), null, $sSSLMode, true); } else { if ($location !== null) { // No file resource given, we only have a URL to go on if (StringUtil::startsWith($location, '//')) { $location = substr($location, strlen('//')); // The path is a protocol-relative URL. Absolutize for file_get_contents and relativize for linking (according to linking/always_link_absolutely) $sRelativeLocationRoot = LinkUtil::getProtocol() . $location; $mProtocolSetting = 'auto'; $location = LinkUtil::getProtocol($mProtocolSetting) . $location; } else { if (StringUtil::startsWith($location, '/')) { // The path is a domain-relative-URL. Absolutize for file_get_contents and relativize for linking (according to linking/always_link_absolutely) $sRelativeLocationRoot = LinkUtil::absoluteLink($location, null, $sSSLMode, true); $location = LinkUtil::absoluteLink($location, null, LinkUtil::isSSL()); } else { $sRelativeLocationRoot = $location; } } $sContents = file_get_contents($location); } else { if ($content !== null) { if ($content instanceof Template) { $content = $content->render(); } $sContents = $content; } } } if ($sType === self::RESOURCE_TYPE_CSS && $media) { $sContents = "@media {$media} { {$sContents} }"; } // Fix relative locations in CSS if ($sType === self::RESOURCE_TYPE_CSS && $sRelativeLocationRoot !== null) { //Remove the protocol so our slash-detection logic works correctly (because the protocol may also contain slashes) if (preg_match(',^([a-z][a-z.\\-+]*:)?//,', $sRelativeLocationRoot, $sProtocol) === 1) { $sProtocol = $sProtocol[0]; } else { $sProtocol = ''; } $sRelativeLocationRoot = substr($sRelativeLocationRoot, strlen($sProtocol)); $sAbsoluteLocationRoot = $sRelativeLocationRoot; $bHasTruncatedTail = false; $iSlashPosition = null; // Calculate the absolute location root (will be "" most of the time unless the CSS was loaded from an external domain or linking/always_link_absolutely is true) while (($iSlashPosition = strrpos($sAbsoluteLocationRoot, '/')) !== false) { $sAbsoluteLocationRoot = substr($sAbsoluteLocationRoot, 0, $iSlashPosition); if (!$bHasTruncatedTail) { // Remove the last part from the relative location as it’s the resource itself $sRelativeLocationRoot = "{$sAbsoluteLocationRoot}/"; $bHasTruncatedTail = true; } } // Re-add the protocol part $sRelativeLocationRoot = $sProtocol . $sRelativeLocationRoot; $sAbsoluteLocationRoot = $sProtocol . $sAbsoluteLocationRoot; // Find url() tokens $sContents = preg_replace_callback(',url\\s*\\(\\s*(\'[^\']+\'|\\"[^\\"]+\\"|[^(\'\\"]+?)\\s*\\),', function ($aMatches) use($sRelativeLocationRoot, $sAbsoluteLocationRoot) { // Convert /something/../ to / $sQuote = ''; $sUrl = $aMatches[1]; $sFirst = substr($sUrl, 0, 1); if ($sFirst === '"' || $sFirst === "'") { $sQuote = $sFirst; $sUrl = substr($sUrl, 1, -1); } if (StringUtil::startsWith($sUrl, '//')) { // URL is protocol-relative. Do nothing. // If this were pointing to the local host, we’d need to respect linking/ssl_in_absolute_links // but if it did come from a file resource, we’d already have that } else { if (StringUtil::startsWith($sUrl, '/')) { // URL absolute. That means relative to $sAbsoluteLocationRoot $sUrl = $sAbsoluteLocationRoot . $sUrl; } else { if (!preg_match(',^[a-z][a-z.\\-+]*:,', $sUrl)) { // URL is relative to the resource being changed. That means relative to $sRelativeLocationRoot // Absolutize only relative URLs (the ones not starting with a protocol) // Prepend the coomon root for the relative location $sUrl = $sRelativeLocationRoot . $sUrl; // Fix explicit relative URLs (./) $sUrl = preg_replace(',/\\./,', '/', $sUrl); // Resolve Uplinks (/some-place/../) $sParentPattern = ',/[^/]+/\\.\\./,'; while (preg_match($sParentPattern, $sUrl) === 1) { $sUrl = preg_replace($sParentPattern, '/', $sUrl, 1); } } } } return "url({$sQuote}{$sUrl}{$sQuote})"; }, $sContents); } $oCache->setContents($sContents); } $aConsolidatorInfo['contents'][$sKey] = $oCache; } }
private function renderEntry(JournalEntry $oEntry, Template $oEntryTemplate, $bIsAjax = false) { $oCommentQuery = JournalCommentQuery::create()->excludeUnverified(); $oEntryTemplate->replaceIdentifier('journal_title', $oEntry->getJournal()->getName()); $oEntryTemplate->replaceIdentifier('slug', $oEntry->getSlug()); $oEntryTemplate->replaceIdentifier('name', $oEntry->getSlug()); $oEntryTemplate->replaceIdentifier('user_name', $oEntry->getUserRelatedByCreatedBy()->getFullName()); $oEntryTemplate->replaceIdentifier('id', $oEntry->getId()); $oEntryTemplate->replaceIdentifier('date', LocaleUtil::localizeDate($oEntry->getPublishAtTimestamp())); $oEntryTemplate->replaceIdentifier('title', $oEntry->getTitle()); $oEntryTemplate->replaceIdentifier('comment_count', $oEntry->countJournalComments($oCommentQuery)); // Manager in link has to be set manually for the case when it's called asynchroneously in preview $sDetailLink = LinkUtil::link($oEntry->getLink($this->oPage), $this->bIsPreview ? 'PreviewManager' : 'FrontendManager'); $oEntryTemplate->replaceIdentifier('link', LinkUtil::absoluteLink($sDetailLink), null, LinkUtil::isSSL()); $oEntryTemplate->replaceIdentifier('detail_link_title', TranslationPeer::getString('journal_entry.add_comment_title', null, null, array('title' => $oEntry->getTitle()))); if ($oEntryTemplate->hasIdentifier('text')) { $oEntryTemplate->replaceIdentifier('text', RichtextUtil::parseStorageForFrontendOutput($oEntry->getText())); } if ($oEntryTemplate->hasIdentifier('text_short')) { $oEntryTemplate->replaceIdentifier('text_short', RichtextUtil::parseStorageForFrontendOutput($oEntry->getTextShort())); } if ($this->oEntry !== null && $this->oEntry == $oEntry) { $oEntryTemplate->replaceIdentifier('current_class', ' class="current"', null, Template::NO_HTML_ESCAPE); } if ($oEntryTemplate->hasIdentifier('tags')) { $aTagInstances = TagInstanceQuery::create()->filterByModelName('JournalEntry')->filterByTaggedItemId($oEntry->getId())->joinTag()->find(); foreach ($aTagInstances as $i => $oTagInstance) { if ($i > 0) { $oEntryTemplate->replaceIdentifierMultiple('tags', ', ', null, Template::NO_NEWLINE | Template::NO_NEW_CONTEXT); } $oEntryTemplate->replaceIdentifierMultiple('tags', $oTagInstance->getTag()->getReadableName(), null, Template::NO_NEW_CONTEXT | Template::NO_NEWLINE); } } if ($oEntryTemplate->hasIdentifier('journal_comments')) { $oEntryTemplate->replaceIdentifier('journal_comments', $this->renderComments($oEntry->getJournalComments($oCommentQuery), $oEntry, $oEntry === $this->oEntry)); } if ($oEntryTemplate->hasIdentifier('journal_gallery') && $oEntry->countJournalEntryImages() > 0) { $oEntryTemplate->replaceIdentifier('journal_gallery', $this->renderGallery($oEntry)); } if ($this->bIsPreview && !$bIsAjax) { $oEntryTemplate = TagWriter::quickTag('div', array('class' => 'journal_entry-container filled-container', 'data-entry-id' => $oEntry->getId(), 'data-is-not-shown' => $oEntry->isNotShown(), 'data-template' => $oEntryTemplate->getTemplateName()), $oEntryTemplate); } return $oEntryTemplate; }
private function handleNewJournalComment($oPage, $oEntry) { $oFlash = Flash::getFlash(); // Validate form and create new comment and $oComment = new JournalComment(); $oComment->setUsername($_POST['comment_name']); $oFlash->checkForValue('comment_name', 'comment_name_required'); $oComment->setEmail($_POST['comment_email']); $oFlash->checkForEmail('comment_email', 'comment_email_required'); if ($oEntry->getJournal()->getUseCaptcha() && !Session::getSession()->isAuthenticated() && !FormFrontendModule::validateRecaptchaInput() && !isset($_POST['preview'])) { $oFlash->addMessage('captcha_required'); } $oPurifierConfig = HTMLPurifier_Config::createDefault(); $oPurifierConfig->set('Cache.SerializerPath', MAIN_DIR . '/' . DIRNAME_GENERATED . '/' . DIRNAME_CACHES . '/purifier'); $oPurifierConfig->set('HTML.Doctype', 'XHTML 1.0 Transitional'); $oPurifierConfig->set('AutoFormat.AutoParagraph', true); $oPurifier = new HTMLPurifier($oPurifierConfig); $_POST['comment_text'] = $oPurifier->purify($_POST['comment_text']); $oComment->setText($_POST['comment_text']); $oFlash->checkForValue('comment_text', 'comment_required'); $oFlash->finishReporting(); if (isset($_POST['preview'])) { $oComment->setCreatedAt(date('c')); $_POST['preview'] = $oComment; } else { if (Flash::noErrors()) { $oEntry->addJournalComment($oComment); // Post is considered as spam $bIsProblablySpam = isset($_POST['important_note']) && $_POST['important_note'] != null; $sCommentNotificationTemplate = 'e_mail_comment_notified'; // Prevent publication if comments are not enabled or post is spam if (!$oEntry->getJournal()->getEnableComments() || $bIsProblablySpam) { if (!Session::getSession()->isAuthenticated()) { $oComment->setIsPublished(false); $sCommentNotificationTemplate = 'e_mail_comment_moderated'; } } $oComment->save(); // Notify new comment if ($oEntry->getJournal()->getNotifyComments()) { $oEmailContent = JournalPageTypeModule::templateConstruct($sCommentNotificationTemplate, $oPage->getPagePropertyValue('journal:template_set', 'default')); $oEmailContent->replaceIdentifier('email', $oComment->getEmail()); $oEmailContent->replaceIdentifier('user', $oComment->getUsername()); if ($bIsProblablySpam) { $oEmailContent->replaceIdentifier('this_comment_is_spam_note', TranslationPeer::getString('journal.this_comment_is_spam_note', null, null, array('important_note_content' => $_POST['important_note']))); } $oEmailContent->replaceIdentifier('comment', $oComment->getText()); $oEmailContent->replaceIdentifier('entry', $oEntry->getTitle()); $oEmailContent->replaceIdentifier('journal', $oEntry->getJournal()->getName()); $oEmailContent->replaceIdentifier('entry_link', LinkUtil::absoluteLink(LinkUtil::link($oEntry->getLink($oPage)))); $oEmailContent->replaceIdentifier('deactivation_link', LinkUtil::absoluteLink(LinkUtil::link(array('journal_comment_moderation', $oComment->getActivationHash(), 'deactivate'), 'FileManager'), null, LinkUtil::isSSL())); $oEmailContent->replaceIdentifier('activation_link', LinkUtil::absoluteLink(LinkUtil::link(array('journal_comment_moderation', $oComment->getActivationHash(), 'activate'), 'FileManager'), null, LinkUtil::isSSL())); $oEmailContent->replaceIdentifier('deletion_link', LinkUtil::absoluteLink(LinkUtil::link(array('journal_comment_moderation', $oComment->getActivationHash(), 'delete'), 'FileManager'), null, LinkUtil::isSSL())); $sSubject = TranslationPeer::getString('journal.notification_subject', null, null, array('entry' => $oEntry->getTitle())); $oEmail = new EMail($sSubject, $oEmailContent); $oSender = $oEntry->getUserRelatedByCreatedBy(); $oEmail->addRecipient($oSender->getEmail(), $oSender->getFullName()); $oEmail->send(); } $oSession = Session::getSession(); Flash::getFlash()->unfinishReporting()->addMessage('journal.has_new_comment', array(), "journal_entry.new_comment_thank_you" . ($oEntry->getJournal()->getEnableComments() || $oSession->isAuthenticated() ? '' : '.moderated'), 'new_comment_thank_you_message', 'p')->stick(); LinkUtil::redirect(LinkUtil::link($oEntry->getLink($oPage)) . "#comments"); } } }