/** * Set up URL variables for this $row. * * @param array $row DB records * * @return void */ function setURLs(array $row) { // Finding the domain to use $this->urlbase = DirectMailUtility::getUrlBase($row['use_domain']); // Finding the url to fetch content from switch ((string) $row['type']) { case 1: $this->url_html = $row['HTMLParams']; $this->url_plain = $row['plainParams']; break; default: $this->url_html = $this->urlbase . '?id=' . $row['page'] . $row['HTMLParams']; $this->url_plain = $this->urlbase . '?id=' . $row['page'] . $row['plainParams']; } // plain if (!($row['sendOptions'] & 1) || !$this->url_plain) { $this->url_plain = ''; } else { $urlParts = @parse_url($this->url_plain); if (!$urlParts['scheme']) { $this->url_plain = 'http://' . $this->url_plain; } } // html if (!($row['sendOptions'] & 2) || !$this->url_html) { $this->url_html = ''; } else { $urlParts = @parse_url($this->url_html); if (!$urlParts['scheme']) { $this->url_html = 'http://' . $this->url_html; } } }
/** * Creates a directmail entry in th DB. * used only for quickmail. * * @param array $indata Quickmail data (quickmail content, etc.) * * @return string error or warning message produced during the process */ public function createDMail_quick(array $indata) { $theOutput = ""; // Set default values: $dmail = array(); $dmail['sys_dmail']['NEW'] = array('from_email' => $indata['senderEmail'], 'from_name' => $indata['senderName'], 'replyto_email' => $this->params['replyto_email'], 'replyto_name' => $this->params['replyto_name'], 'return_path' => $this->params['return_path'], 'priority' => $this->params['priority'], 'use_domain' => $this->params['use_domain'], 'use_rdct' => $this->params['use_rdct'], 'long_link_mode' => $this->params['long_link_mode'], 'organisation' => $this->params['organisation'], 'authcode_fieldList' => $this->params['authcode_fieldList'], 'plainParams' => ''); // always plaintext $dmail['sys_dmail']['NEW']['sendOptions'] = 1; $dmail['sys_dmail']['NEW']['long_link_rdct_url'] = DirectMailUtility::getUrlBase($this->params['use_domain']); $dmail['sys_dmail']['NEW']['subject'] = $indata['subject']; $dmail['sys_dmail']['NEW']['type'] = 1; $dmail['sys_dmail']['NEW']['pid'] = $this->pageinfo['uid']; $dmail['sys_dmail']['NEW']['charset'] = isset($this->params['quick_mail_charset']) ? $this->params['quick_mail_charset'] : 'utf-8'; // If params set, set default values: if (isset($this->params['includeMedia'])) { $dmail['sys_dmail']['NEW']['includeMedia'] = $this->params['includeMedia']; } if (isset($this->params['flowedFormat'])) { $dmail['sys_dmail']['NEW']['flowedFormat'] = $this->params['flowedFormat']; } if (isset($this->params['direct_mail_encoding'])) { $dmail['sys_dmail']['NEW']['encoding'] = $this->params['direct_mail_encoding']; } if ($dmail['sys_dmail']['NEW']['pid'] && $dmail['sys_dmail']['NEW']['sendOptions']) { /* @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */ $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); $tce->stripslashes_values = 0; $tce->start($dmail, array()); $tce->process_datamap(); $this->sys_dmail_uid = $tce->substNEWwithIDs['NEW']; $row = BackendUtility::getRecord('sys_dmail', intval($this->sys_dmail_uid)); // link in the mail $message = '<!--DMAILER_SECTION_BOUNDARY_-->' . $indata['message'] . '<!--DMAILER_SECTION_BOUNDARY_END-->'; if (trim($this->params['use_rdct'])) { $message = GeneralUtility::substUrlsInPlainText($message, $this->params['long_link_mode'] ? 'all' : '76', DirectMailUtility::getUrlBase($this->params['use_domain'])); } if ($indata['breakLines']) { $message = wordwrap($message, 76, "\n"); } // fetch functions $theOutput = $this->compileQuickMail($row, $message); /* end fetch function*/ } else { if (!$dmail['sys_dmail']['NEW']['sendOptions']) { $this->error = 'no_valid_url'; } } return $theOutput; }