/** * Insert statistic to a temporary table * * @param array $recRec Statistic array * * @return void */ function storeRecRec(array $recRec) { if (is_array($recRec)) { $recRec['pings_first'] = intval(@min($recRec['pings'])); $recRec['pings_last'] = intval(@max($recRec['pings'])); $recRec['pings'] = count($recRec['pings']); $recRec['html_links_first'] = intval(@min($recRec['html_links'])); $recRec['html_links_last'] = intval(@max($recRec['html_links'])); $recRec['html_links'] = count($recRec['html_links']); $recRec['plain_links_first'] = intval(@min($recRec['plain_links'])); $recRec['plain_links_last'] = intval(@max($recRec['plain_links'])); $recRec['plain_links'] = count($recRec['plain_links']); $recRec['links_first'] = intval(@min($recRec['links'])); $recRec['links_last'] = intval(@max($recRec['links'])); $recRec['links'] = count($recRec['links']); $recRec['response_first'] = DirectMailUtility::intInRangeWrapper(intval(@min($recRec['response'])) - $recRec['tstamp'], 0); $recRec['response_last'] = DirectMailUtility::intInRangeWrapper(intval(@max($recRec['response'])) - $recRec['tstamp'], 0); $recRec['response'] = count($recRec['response']); $recRec['time_firstping'] = DirectMailUtility::intInRangeWrapper($recRec['pings_first'] - $recRec['tstamp'], 0); $recRec['time_lastping'] = DirectMailUtility::intInRangeWrapper($recRec['pings_last'] - $recRec['tstamp'], 0); $recRec['time_first_link'] = DirectMailUtility::intInRangeWrapper($recRec['links_first'] - $recRec['tstamp'], 0); $recRec['time_last_link'] = DirectMailUtility::intInRangeWrapper($recRec['links_last'] - $recRec['tstamp'], 0); $res = $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_sys_dmail_stat', $recRec); $GLOBALS["TYPO3_DB"]->sql_free_result($res); } }
/** * Breaks content lines into a bullet list * * @param string $str: Content string to make into a bullet list * @return string Processed value */ function breakBulletlist($str) { $type = $this->cObj->data['layout']; $type = DirectMailUtility::intInRangeWrapper($type, 0, 3); $tConf = $this->conf['bulletlist.'][$type . '.']; $cParts = explode(LF, $str); $lines = array(); $c = 0; foreach ($cParts as $substrs) { if (!strlen($substrs)) { continue; } $c++; $bullet = $tConf['bullet'] ? $this->getString($tConf['bullet']) : ' - '; $bLen = strlen($bullet); $bullet = substr(str_replace('#', $c, $bullet), 0, $bLen); $secondRow = substr($tConf['secondRow'] ? $this->getString($tConf['secondRow']) : str_pad('', strlen($bullet), ' '), 0, $bLen); $lines[] = $bullet . $this->breakLines($substrs, LF . $secondRow, $this->charWidth - $bLen); $blanks = DirectMailUtility::intInRangeWrapper($tConf['blanks'], 0, 1000); if ($blanks) { $lines[] = str_pad('', $blanks - 1, LF); } } return implode(LF, $lines); }
/** * Renders the author and date columns of the tt_news record * * @param string $row: The tt_news record * @param int $type: * @return string Content */ public function renderAuthor($row, $type = 0) { if ($row['author']) { $hConf = $this->renderPlainText->conf['tt_news_author.']; $str = $this->renderPlainText->getString($hConf['prefix']) . $row['author'] . $this->renderPlainText->getString($hConf['emailPrefix']) . '<' . $row['author_email'] . '>'; $defaultType = DirectMailUtility::intInRangeWrapper($hConf['defaultType'], 1, 5); $type = DirectMailUtility::intInRangeWrapper($type, 0, 6); if (!$type) { $type = $defaultType; } if ($type != 6) { // not hidden $tConf = $hConf[$type . '.']; $lines = array(); $blanks = DirectMailUtility::intInRangeWrapper($tConf['preBlanks'], 0, 1000); if ($blanks) { $lines[] = str_pad('', $blanks - 1, LF); } $lines = $this->renderPlainText->pad($lines, $tConf['preLineChar'], $tConf['preLineLen']); $blanks = DirectMailUtility::intInRangeWrapper($tConf['preLineBlanks'], 0, 1000); if ($blanks) { $lines[] = str_pad('', $blanks - 1, LF); } if ($row['datetime']) { $lConf = $this->conf['displaySingle.']; $lines[] = $this->renderPlainText->getString($hConf['datePrefix']) . $this->cObj->stdWrap($row['datetime'], $lConf['date_stdWrap.']) . ' ' . $this->cObj->stdWrap($row['datetime'], $lConf['time_stdWrap.']); } $lines[] = $this->cObj->stdWrap($str, $tConf['stdWrap.']); $blanks = DirectMailUtility::intInRangeWrapper($tConf['postLineBlanks'], 0, 1000); if ($blanks) { $lines[] = str_pad('', $blanks - 1, LF); } $lines = $this->renderPlainText->pad($lines, $tConf['postLineChar'], $tConf['postLineLen']); $blanks = DirectMailUtility::intInRangeWrapper($tConf['postBlanks'], 0, 1000); if ($blanks) { $lines[] = str_pad('', $blanks - 1, LF); } return implode(LF, $lines); } } return ""; }
/** * Preparing the Email. Headers are set in global variables * * @param array $row: Record from the sys_dmail table * @return void */ function dmailer_prepare($row) { global $LANG; $sys_dmail_uid = $row['uid']; if ($row['flowedFormat']) { $this->flowedFormat = 1; } if ($row['charset']) { if ($row['type'] == 0) { $this->charset = "utf-8"; } else { $this->charset = $row['charset']; } } $this->encoding = $row['encoding']; $this->theParts = unserialize(base64_decode($row['mailContent'])); $this->messageid = $this->theParts['messageid']; $this->subject = $LANG->csConvObj->conv($row['subject'], $LANG->charSet, $this->charset); $this->from_email = $row['from_email']; $this->from_name = $row['from_name'] ? $LANG->csConvObj->conv($row['from_name'], $LANG->charSet, $this->charset) : ''; $this->replyto_email = $row['replyto_email'] ? $row['replyto_email'] : ''; $this->replyto_name = $row['replyto_name'] ? $LANG->csConvObj->conv($row['replyto_name'], $LANG->charSet, $this->charset) : ''; $this->organisation = $row['organisation'] ? $LANG->csConvObj->conv($row['organisation'], $LANG->charSet, $this->charset) : ''; $this->priority = DirectMailUtility::intInRangeWrapper($row['priority'], 1, 5); $this->mailer = 'TYPO3 Direct Mail module'; $this->authCode_fieldList = $row['authcode_fieldList'] ? $row['authcode_fieldList'] : 'uid'; $this->dmailer['sectionBoundary'] = '<!--DMAILER_SECTION_BOUNDARY'; $this->dmailer['html_content'] = $this->theParts['html']['content']; $this->dmailer['plain_content'] = $this->theParts['plain']['content']; $this->dmailer['messageID'] = $this->messageid; $this->dmailer['sys_dmail_uid'] = $sys_dmail_uid; $this->dmailer['sys_dmail_rec'] = $row; $this->dmailer['boundaryParts_html'] = explode($this->dmailer['sectionBoundary'], '_END-->' . $this->dmailer['html_content']); foreach ($this->dmailer['boundaryParts_html'] as $bKey => $bContent) { $this->dmailer['boundaryParts_html'][$bKey] = explode('-->', $bContent, 2); // Remove useless HTML comments if (substr($this->dmailer['boundaryParts_html'][$bKey][0], 1) == 'END') { $this->dmailer['boundaryParts_html'][$bKey][1] = $this->removeHTMLComments($this->dmailer['boundaryParts_html'][$bKey][1]); } // Now, analyzing which media files are used in this part of the mail: $mediaParts = explode('cid:part', $this->dmailer['boundaryParts_html'][$bKey][1]); reset($mediaParts); next($mediaParts); while (list(, $part) = each($mediaParts)) { $this->dmailer['boundaryParts_html'][$bKey]['mediaList'] .= ',' . strtok($part, '.'); } } $this->dmailer['boundaryParts_plain'] = explode($this->dmailer['sectionBoundary'], '_END-->' . $this->dmailer['plain_content']); foreach ($this->dmailer['boundaryParts_plain'] as $bKey => $bContent) { $this->dmailer['boundaryParts_plain'][$bKey] = explode('-->', $bContent, 2); } $this->flag_html = $this->theParts['html']['content'] ? 1 : 0; $this->flag_plain = $this->theParts['plain']['content'] ? 1 : 0; $this->includeMedia = $row['includeMedia']; }