public function init($cObj, $extKey, $conf, $scriptRelPath) { global $TSFE; if ($TSFE->config['config']['language']) { $this->LLkey = $TSFE->config['config']['language']; if ($TSFE->config['config']['language_alt']) { $this->altLLkey = $TSFE->config['config']['language_alt']; } } $this->cObj = $cObj; $this->extKey = $extKey; $this->conf = $conf; $this->scriptRelPath = $scriptRelPath; $this->typoVersion = tx_div2007_core::getTypoVersion(); }
/** * Logs message to the system log. * This should be implemented around the source code, including the Core and both frontend and backend, logging serious errors. * If you want to implement the sysLog in your applications, simply add lines like: * tx_div2007_div::sysLog('[write message in English here]', 'extension_key', 'severity'); * * @param string $msg Message (in English). * @param string $extKey Extension key (from which extension you are calling the log) or "Core" * @param integer $severity Severity: 0 is info, 1 is notice, 2 is warning, 3 is error, 4 is fatal error * @return void */ public static function sysLog($msg, $extKey, $severity = 0) { $severity = tx_div2007_core::intInRange($severity, 0, 4); // is message worth logging? if (intval($GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel']) > $severity) { return; } // initialize logging if (!$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogInit']) { self::initSysLog(); } // do custom logging if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'])) { $params = array('msg' => $msg, 'extKey' => $extKey, 'backTrace' => debug_backtrace(), 'severity' => $severity); $fakeThis = FALSE; foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'] as $hookMethod) { self::callUserFunction($hookMethod, $params, $fakeThis); } } // TYPO3 logging enabled? if (!$GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLog']) { return; } $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']; $timeFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm']; // use all configured logging options foreach (explode(';', $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLog'], 2) as $log) { list($type, $destination, $level) = explode(',', $log, 4); // is message worth logging for this log type? if (intval($level) > $severity) { continue; } $msgLine = ' - ' . $extKey . ': ' . $msg; // write message to a file if ($type == 'file') { $lockObject = self::makeInstance('t3lib_lock', $destination, $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode']); /** @var t3lib_lock $lockObject */ $lockObject->setEnableLogging(FALSE); $lockObject->acquire(); $file = fopen($destination, 'a'); if ($file) { fwrite($file, date($dateFormat . ' ' . $timeFormat) . $msgLine . LF); fclose($file); self::fixPermissions($destination); } $lockObject->release(); } elseif ($type == 'mail') { list($to, $from) = explode('/', $destination); if (!self::validEmail($from)) { $from = t3lib_utility_Mail::getSystemFrom(); } /** @var $mail t3lib_mail_Message */ $mail = self::makeInstance('t3lib_mail_Message'); $mail->setTo($to)->setFrom($from)->setSubject('Warning - error in TYPO3 installation')->setBody('Host: ' . $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] . LF . 'Extension: ' . $extKey . LF . 'Severity: ' . $severity . LF . LF . $msg); $mail->send(); } elseif ($type == 'error_log') { error_log($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] . $msgLine, 0); } elseif ($type == 'syslog') { $priority = array(LOG_INFO, LOG_NOTICE, LOG_WARNING, LOG_ERR, LOG_CRIT); syslog($priority[(int) $severity], $msgLine); } } }
/** * loadTcaAdditions($ext_keys) * * It has been copied here in order not to depend on the div extension only for this function. * * @param array extension keys which have TCA additions to load * @return void * @see div extension */ public static function loadTcaAdditions($ext_keys) { global $_EXTKEY, $TCA; $typoVersion = tx_div2007_core::getTypoVersion(); if ($typoVersion < 6002000) { //Merge all ext_keys if (is_array($ext_keys)) { foreach ($ext_keys as $_EXTKEY) { if (t3lib_extMgm::isLoaded($_EXTKEY)) { //Include the ext_table include t3lib_extMgm::extPath($_EXTKEY) . 'ext_tables.php'; } } } } }
/** * Returns a results browser. This means a bar of page numbers plus a "previous" and "next" link. For each entry in the bar the piVars "pointer" will be pointing to the "result page" to show. * Using $this->piVars['pointer'] as pointer to the page to display. Can be overwritten with another string ($pointerName) to make it possible to have more than one pagebrowser on a page) * Using $this->internal['res_count'], $this->internal['results_at_a_time'] and $this->internal['maxPages'] for count number, how many results to show and the max number of pages to include in the browse bar. * Using $this->internal['dontLinkActivePage'] as switch if the active (current) page should be displayed as pure text or as a link to itself * Using $this->internal['showFirstLast'] as switch if the two links named "<< First" and "LAST >>" will be shown and point to the first or last page. * Using $this->internal['pagefloat']: this defines were the current page is shown in the list of pages in the Pagebrowser. If this var is an integer it will be interpreted as position in the list of pages. If its value is the keyword "center" the current page will be shown in the middle of the pagelist. * Using $this->internal['showRange']: this var switches the display of the pagelinks from pagenumbers to ranges f.e.: 1-5 6-10 11-15... instead of 1 2 3... * Using $this->pi_isOnlyFields: this holds a comma-separated list of fieldnames which - if they are among the GETvars - will not disable caching for the page with pagebrowser. * * The third parameter is an array with several wraps for the parts of the pagebrowser. The following elements will be recognized: * disabledLinkWrap, inactiveLinkWrap, activeLinkWrap, browseLinksWrap, showResultsWrap, showResultsNumbersWrap, browseBoxWrap. * * If $wrapArr['showResultsNumbersWrap'] is set, the formatting string is expected to hold template markers (###FROM###, ###TO###, ###OUT_OF###, ###FROM_TO###, ###CURRENT_PAGE###, ###TOTAL_PAGES###) * otherwise the formatting string is expected to hold sprintf-markers (%s) for from, to, outof (in that sequence) * * @param object tslib_pibase object * @param integer determines how the results of the pagerowser will be shown. See description below * @param string Attributes for the table tag which is wrapped around the table cells containing the browse links * @param array Array with elements to overwrite the default $wrapper-array. * @param string varname for the pointer. * @param boolean enable htmlspecialchars() for the pi_getLL function (set this to FALSE if you want f.e use images instead of text for links like 'previous' and 'next'). * @return string Output HTML-Table, wrapped in <div>-tags with a class attribute (if $wrapArr is not passed, */ function list_browseresults_fh001(&$pObject, $showResultCount = 1, $tableParams = '', $wrapArr = array(), $pointerName = 'pointer', $hscText = TRUE) { // Initializing variables: $pointer = intval($pObject->piVars[$pointerName]); $count = intval($pObject->internal['res_count']); $results_at_a_time = tx_div2007_core::intInRange($pObject->internal['results_at_a_time'], 1, 1000); $totalPages = ceil($count / $results_at_a_time); $maxPages = tx_div2007_core::intInRange($pObject->internal['maxPages'], 1, 100); $pi_isOnlyFields = $pObject->pi_isOnlyFields($pObject->pi_isOnlyFields); // $showResultCount determines how the results of the pagerowser will be shown. // If set to 0: only the result-browser will be shown // 1: (default) the text "Displaying results..." and the result-browser will be shown. // 2: only the text "Displaying results..." will be shown $showResultCount = intval($showResultCount); // if this is set, two links named "<< First" and "LAST >>" will be shown and point to the very first or last page. $showFirstLast = $pObject->internal['showFirstLast']; // if this has a value the "previous" button is always visible (will be forced if "showFirstLast" is set) $alwaysPrev = $showFirstLast ? 1 : $pObject->pi_alwaysPrev; if (isset($pObject->internal['pagefloat'])) { if (strtoupper($pObject->internal['pagefloat']) == 'CENTER') { $pagefloat = ceil(($maxPages - 1) / 2); } else { // pagefloat set as integer. 0 = left, value >= $pObject->internal['maxPages'] = right $pagefloat = tx_div2007_core::intInRange($pObject->internal['pagefloat'], -1, $maxPages - 1); } } else { $pagefloat = -1; // pagefloat disabled } // default values for "traditional" wrapping with a table. Can be overwritten by vars from $wrapArr $wrapper['disabledLinkWrap'] = '<td nowrap="nowrap"><p>|</p></td>'; $wrapper['inactiveLinkWrap'] = '<td nowrap="nowrap"><p>|</p></td>'; $wrapper['activeLinkWrap'] = '<td' . $pObject->pi_classParam('browsebox-SCell') . ' nowrap="nowrap"><p>|</p></td>'; $wrapper['browseLinksWrap'] = trim('<table ' . $tableParams) . '><tr>|</tr></table>'; if ($pObject->internal['imagePath']) { $onMouseOver = $pObject->internal['imageOnMouseOver'] ? 'onmouseover="' . $pObject->internal['imageOnMouseOver'] . '" ' : ''; $onMouseOut = $pObject->internal['imageOnMouseOut'] ? 'onmouseout="' . $pObject->internal['imageOnMouseOut'] . '" ' : ''; $onMouseOverActive = $pObject->internal['imageActiveOnMouseOver'] ? 'onmouseover="' . $pObject->internal['imageActiveOnMouseOver'] . '" ' : ''; $onMouseOutActive = $pObject->internal['imageActiveOnMouseOut'] ? 'onmouseout="' . $pObject->internal['imageActiveOnMouseOut'] . '" ' : ''; $wrapper['browseTextWrap'] = '<img src="' . $pObject->internal['imagePath'] . $pObject->internal['imageFilemask'] . '" ' . $onMouseOver . $onMouseOut . '>'; $wrapper['activeBrowseTextWrap'] = '<img src="' . $pObject->internal['imagePath'] . $pObject->internal['imageActiveFilemask'] . '" ' . $onMouseOverActive . $onMouseOutActive . '>'; } $wrapper['showResultsWrap'] = '<p>|</p>'; $wrapper['browseBoxWrap'] = ' <!-- List browsing box: --> <div ' . $pObject->pi_classParam('browsebox') . '> | </div>'; // now overwrite all entries in $wrapper which are also in $wrapArr $wrapper = array_merge($wrapper, $wrapArr); if ($showResultCount != 2) { //show pagebrowser if ($pagefloat > -1) { $lastPage = min($totalPages, max($pointer + 1 + $pagefloat, $maxPages)); $firstPage = max(0, $lastPage - $maxPages); } else { $firstPage = 0; $lastPage = tx_div2007_core::intInRange($totalPages, 1, $maxPages); } $links = array(); // Make browse-table/links: if ($showFirstLast) { // Link to first page if ($pointer > 0) { $links[] = $pObject->cObj->wrap($pObject->pi_linkTP_keepPIvars(htmlspecialchars($pObject->pi_getLL('pi_list_browseresults_first', '<< First', $hscText)), array($pointerName => null), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']); } else { $links[] = $pObject->cObj->wrap(htmlspecialchars($pObject->pi_getLL('pi_list_browseresults_first', '<< First', $hscText)), $wrapper['disabledLinkWrap']); } } if ($alwaysPrev >= 0) { // Link to previous page $previousText = $pObject->pi_getLL('pi_list_browseresults_prev', '< Previous', $hscText); if ($pointer > 0) { $links[] = $pObject->cObj->wrap($pObject->pi_linkTP_keepPIvars($previousText, array($pointerName => $pointer - 1 ? $pointer - 1 : ''), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']); } elseif ($alwaysPrev) { $links[] = $pObject->cObj->wrap($previousText, $wrapper['disabledLinkWrap']); } } for ($a = $firstPage; $a < $lastPage; $a++) { // Links to pages if ($pObject->internal['showRange']) { $pageText = $a * $results_at_a_time + 1 . '-' . min($count, ($a + 1) * $results_at_a_time); } else { if ($totalPages > 1) { if ($wrapper['browseTextWrap']) { if ($pointer == $a) { // current page $pageText = $pObject->cObj->wrap($a + 1, $wrapper['activeBrowseTextWrap']); } else { $pageText = $pObject->cObj->wrap($a + 1, $wrapper['browseTextWrap']); } } else { $pageText = trim($pObject->pi_getLL('pi_list_browseresults_page', 'Page', $hscText)) . ' ' . ($a + 1); } } } if ($pointer == $a) { // current page if ($pObject->internal['dontLinkActivePage']) { $links[] = $pObject->cObj->wrap($pageText, $wrapper['activeLinkWrap']); } else { $linkArray = array($pointerName => $a ? $a : ''); $link = $pObject->pi_linkTP_keepPIvars($pageText, $linkArray, $pi_isOnlyFields); $links[] = $pObject->cObj->wrap($link, $wrapper['activeLinkWrap']); } } else { $links[] = $pObject->cObj->wrap($pObject->pi_linkTP_keepPIvars($pageText, array($pointerName => $a ? $a : ''), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']); } } if ($pointer < $totalPages - 1 || $showFirstLast) { $nextText = $pObject->pi_getLL('pi_list_browseresults_next', 'Next >', $hscText); if ($pointer == $totalPages - 1) { // Link to next page $links[] = $pObject->cObj->wrap($nextText, $wrapper['disabledLinkWrap']); } else { $links[] = $pObject->cObj->wrap($pObject->pi_linkTP_keepPIvars($nextText, array($pointerName => $pointer + 1), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']); } } if ($showFirstLast) { // Link to last page if ($pointer < $totalPages - 1) { $links[] = $pObject->cObj->wrap($pObject->pi_linkTP_keepPIvars($pObject->pi_getLL('pi_list_browseresults_last', 'Last >>', $hscText), array($pointerName => $totalPages - 1), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']); } else { $links[] = $pObject->cObj->wrap($pObject->pi_getLL('pi_list_browseresults_last', 'Last >>', $hscText), $wrapper['disabledLinkWrap']); } } $theLinks = $pObject->cObj->wrap(implode(chr(10), $links), $wrapper['browseLinksWrap']); } else { $theLinks = ''; } $pR1 = $pointer * $results_at_a_time + 1; $pR2 = $pointer * $results_at_a_time + $results_at_a_time; if ($showResultCount) { if (isset($wrapper['showResultsNumbersWrap'])) { // this will render the resultcount in a more flexible way using markers (new in TYPO3 3.8.0). // the formatting string is expected to hold template markers (see function header). Example: 'Displaying results ###FROM### to ###TO### out of ###OUT_OF###' $markerArray['###FROM###'] = $pObject->cObj->wrap($pObject->internal['res_count'] > 0 ? $pR1 : 0, $wrapper['showResultsNumbersWrap']); $markerArray['###TO###'] = $pObject->cObj->wrap(min($pObject->internal['res_count'], $pR2), $wrapper['showResultsNumbersWrap']); $markerArray['###OUT_OF###'] = $pObject->cObj->wrap($pObject->internal['res_count'], $wrapper['showResultsNumbersWrap']); $markerArray['###FROM_TO###'] = $pObject->cObj->wrap(($pObject->internal['res_count'] > 0 ? $pR1 : 0) . ' ' . $pObject->pi_getLL('pi_list_browseresults_to', 'to') . ' ' . min($pObject->internal['res_count'], $pR2), $wrapper['showResultsNumbersWrap']); $markerArray['###CURRENT_PAGE###'] = $pObject->cObj->wrap($pointer + 1, $wrapper['showResultsNumbersWrap']); $markerArray['###TOTAL_PAGES###'] = $pObject->cObj->wrap($totalPages, $wrapper['showResultsNumbersWrap']); $pi_list_browseresults_displays = $pObject->pi_getLL('pi_list_browseresults_displays', 'Displaying results ###FROM### to ###TO### out of ###OUT_OF###'); // substitute markers $resultCountMsg = $pObject->cObj->substituteMarkerArray($pi_list_browseresults_displays, $markerArray); } else { // render the resultcount in the "traditional" way using sprintf $resultCountMsg = sprintf(str_replace('###SPAN_BEGIN###', '<span' . $pObject->pi_classParam('browsebox-strong') . '>', $pObject->pi_getLL('pi_list_browseresults_displays', 'Displaying results ###SPAN_BEGIN###%s to %s</span> out of ###SPAN_BEGIN###%s</span>')), $count > 0 ? $pR1 : 0, min($count, $pR2), $count); } $resultCountMsg = $pObject->cObj->wrap($resultCountMsg, $wrapper['showResultsWrap']); } else { $resultCountMsg = ''; } $sTables = $pObject->cObj->wrap($resultCountMsg . $theLinks, $wrapper['browseBoxWrap']); return $sTables; }
/** * sends the email in plaintext or HTML format or both * * @param string $toEMail: recipients email address * @param string $subject: subject of the message * @param string $PLAINContent: plain version of the message * @param string $HTMLContent: HTML version of the message * @param string $fromEmail: email address * @param string $fromName: name * @param string $attachment: file name * @param string $cc: CC * @param string $bcc: BCC * @param string $returnPath: return path * @param string $replyTo: email address * @param string $extKey: extension key * @param string $hookVar: name of the hook * @return void */ public static function sendMail($toEMail, $subject, $PLAINContent, $HTMLContent, $fromEMail, $fromName, $attachment = '', $cc = '', $bcc = '', $returnPath = '', $replyTo = '', $extKey = '', $hookVar = '', $defaultSubject = '') { $result = TRUE; if (!is_array($toEMail) && trim($toEMail)) { $emailArray = t3lib_div::trimExplode(',', $toEMail); $toEMail = array(); foreach ($emailArray as $email) { $toEMail[] = $email; } } if (is_array($toEMail) && count($toEMail)) { $emailArray = $toEMail; $errorEmailArray = array(); foreach ($toEMail as $k => $v) { if (!is_numeric($k) && !t3lib_div::validEmail($k) && ($v == '' || !t3lib_div::validEmail($v))) { unset($emailArray[$k]); $errorEmailArray[$k] = $v; } } $toEMail = $emailArray; if (count($errorEmailArray)) { foreach ($errorEmailArray as $k => $v) { $email = $k; if (is_numeric($k)) { $email = $v; } debug('t3lib_div::sendMail invalid email address: to "' . $email . '"'); // keep this } } if (!count($toEMail)) { debug('t3lib_div::sendMail exited with error 1'); // keep this return FALSE; } } else { debug('t3lib_div::sendMail exited with error 2'); // keep this return FALSE; } if (!t3lib_div::validEmail($fromEMail)) { debug('t3lib_div::sendMail invalid email address: from "' . $fromEMail . '"'); // keep this debug('t3lib_div::sendMail exited with error 3'); // keep this return FALSE; } $fromName = str_replace('"', '\'', $fromName); $fromNameSlashed = tx_div2007_alpha5::slashName($fromName); if ($subject == '') { if ($defaultSubject == '') { $defaultSubject = 'message from ' . $fromNameSlashed . ($fromNameSlashed != '' ? '<' : '') . $fromEMail . ($fromNameSlashed != '' ? '>' : ''); } // First line is subject if ($HTMLContent) { $parts = preg_split('/<title>|<\\/title>/i', $HTMLContent, 3); $subject = trim($parts[1]) ? strip_tags(trim($parts[1])) : $defaultSubject; } else { // First line is subject $parts = explode(chr(10), $PLAINContent, 2); $subject = trim($parts[0]) ? trim($parts[0]) : $defaultSubject; $PLAINContent = trim($parts[1]); } } $typo3Version = tx_div2007_core::getTypoVersion(); debug($typo3Version, '$typo3Version'); if ($typo3Version >= 4007000 || isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']) && isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery']) && array_search('t3lib_mail_SwiftMailerAdapter', $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery']) !== FALSE) { if (preg_match('#[/\\(\\)\\<>,;:@\\.\\]\\[]#', $fromName)) { $fromName = '"' . $fromName . '"'; } $mail = tx_div2007_core::newMailMessage(); $mail->setTo($toEMail)->setFrom(array($fromEMail => $fromName))->setReturnPath($returnPath)->setSubject($subject)->setBody($HTMLContent, 'text/HTMLContent', $GLOBALS['TSFE']->renderCharset)->addPart($PLAINContent, 'text/plain', $GLOBALS['TSFE']->renderCharset); if ($replyTo) { $mail->setReplyTo(array($replyTo => $fromEmail)); } if (isset($attachment)) { if (is_array($attachment)) { $attachmentArray = $attachment; } else { $attachmentArray = array($attachment); } foreach ($attachmentArray as $theAttachment) { if (file_exists($theAttachment)) { $mail->attach(Swift_Attachment::fromPath($theAttachment)); } } } // HTML if (trim($HTMLContent)) { $HTMLContent = self::embedMedia($mail, $HTMLContent); $mail->setBody($HTMLContent, 'text/html', $GLOBALS['TSFE']->renderCharset); } if ($bcc != '') { $mail->addBcc($bcc); } } else { if (class_exists('t3lib_htmlmail')) { $fromName = tx_div2007_alpha5::slashName($fromName); if (is_array($toEMail)) { $emailArray = array(); foreach ($toEMail as $k => $v) { if (!is_numeric($k) && $v != '') { $emailArray[] = tx_div2007_alpha5::slashName($v) . ' <' . $k . '>'; } else { if (is_numeric($k)) { $emailArray[] = $v; } else { $emailArray[] = $k; } } } $toEMail = implode(',', $emailArray); } $mail = t3lib_div::makeInstance('t3lib_htmlmail'); $mail->start(); $mail->mailer = 'TYPO3 HTMLMail'; // $mail->useBase64(); TODO $PLAINContent = html_entity_decode($PLAINContent); if ($mail->linebreak == chr(10)) { $PLAINContent = str_replace(chr(13) . chr(10), $mail->linebreak, $PLAINContent); } $mail->subject = $subject; $mail->from_email = $fromEMail; if ($returnPath != '') { $mail->returnPath = $returnPath; } $mail->from_name = $fromName; if ($replyTo) { $mail->replyto_email = $replyTo; $mail->replyto_name = $mail->from_name; } $mail->organisation = ''; if (isset($attachment)) { if (is_array($attachment)) { $attachmentArray = $attachment; } else { $attachmentArray = array($attachment); } foreach ($attachmentArray as $theAttachment) { if (file_exists($theAttachment)) { $mail->attach(Swift_Attachment::fromPath($theAttachment)); } } } if ($HTMLContent) { $mail->theParts['HTMLContent']['content'] = $HTMLContent; $mail->theParts['HTMLContent']['path'] = t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST') . '/'; $mail->extractMediaLinks(); $mail->extractHyperLinks(); $mail->fetchHTMLMedia(); $mail->substMediaNamesInHTML(0); // 0 = relative $mail->substHREFsInHTML(); $mail->setHTML($mail->encodeMsg($mail->theParts['HTMLContent']['content'])); } if ($PLAINContent) { $mail->addPlain($PLAINContent); } $mail->setHeaders(); if ($bcc != '') { $mail->add_header('Bcc: ' . $bcc); } if (isset($attachment) && is_array($attachment) && count($attachment)) { if (isset($mail->theParts) && is_array($mail->theParts) && isset($mail->theParts['attach']) && is_array($mail->theParts['attach'])) { foreach ($mail->theParts['attach'] as $k => $media) { $mail->theParts['attach'][$k]['filename'] = basename($media['filename']); } } } $mail->setContent(); $mail->setRecipient(explode(',', $toEMail)); } else { $result = FALSE; debug('t3lib_div::sendMail exited with error 4'); // keep this debug($result, '$result'); } } if (isset($mail) && is_object($mail) && $extKey && $hookVar && isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]) && isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey][$hookVar]) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey][$hookVar])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey][$hookVar] as $classRef) { $hookObj = t3lib_div::getUserObj($classRef); if (method_exists($hookObj, 'init')) { $hookObj->init($mail); } if (method_exists($hookObj, 'sendMail')) { $result = $hookObj->sendMail($toEMail, $subject, $PLAINContent, $HTMLContent, $fromEMail, $fromName, $attachment, $cc, $bcc, $returnPath, $replyTo, $extKey, $hookVar, $result); if ($result === FALSE) { debug('t3lib_div::sendMail exited with error 5'); // keep this break; } } } } if ($result !== FALSE && isset($mail) && is_object($mail)) { $mailClass = get_class($mail); if (method_exists($mail, 'sendTheMail')) { $mail->sendTheMail(); } else { $mail->send(); } } return $result; }
/** * Returns part of $sheetArray pointed to by the keys in $fieldNameArray * * @param array Multidimensiona array, typically FlexForm contents * @param array Array where each value points to a key in the FlexForms content - the input array will have the value returned pointed to by these keys. All integer keys will not take their integer counterparts, but rather traverse the current position in the array an return element number X (whether this is right behavior is not settled yet...) * @param string Value for outermost key, typ. "vDEF" depending on language. * @return mixed The value, typ. string. private */ function _getFFValueFromSheetArray($sheetArray, $fieldNameArr, $value) { $tempArr = $sheetArray; foreach ($fieldNameArr as $k => $v) { if (tx_div2007_core::testInt($v)) { if (is_array($tempArr)) { $c = 0; foreach ($tempArr as $values) { if ($c == $v) { $tempArr = $values; break; } $c++; } } } else { $tempArr = $tempArr[$v]; } } return $tempArr[$value]; }
public static function loadTcaAdditions_fh002($ext_keys) { global $_EXTKEY, $TCA; $typoVersion = tx_div2007_core::getTypoVersion(); if ($typoVersion < '6002000') { $loadTcaAdditions = TRUE; debug($ext_keys, '$ext_keys'); //Merge all ext_keys if (is_array($ext_keys)) { foreach ($ext_keys as $_EXTKEY) { if (t3lib_extMgm::isLoaded($_EXTKEY)) { debug($_EXTKEY, '$_EXTKEY'); //Include the ext_table require_once t3lib_extMgm::extPath($_EXTKEY) . 'ext_tables.php'; } } } // ext-script if (TYPO3_extTableDef_script) { require_once PATH_typo3conf . TYPO3_extTableDef_script; } } }