/**
  * Get the localization of the select field items (right-hand part of form)
  * Referenced by TCA
  *
  * @param	array $params Array of searched translation
  *
  * @return	void
  */
 function get_localized_categories(array $params)
 {
     global $LANG;
     /*
     		$params['items'] = &$items;
     		$params['config'] = $config;
     		$params['TSconfig'] = $iArray;
     		$params['table'] = $table;
     		$params['row'] = $row;
     		$params['field'] = $field;
     */
     $config = $params['config'];
     $table = $config['itemsProcFunc_config']['table'];
     // initialize backend user language
     if ($LANG->lang && ExtensionManagementUtility::isLoaded('static_info_tables')) {
         $sysPage = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_language.uid', 'sys_language LEFT JOIN static_languages ON sys_language.static_lang_isocode = static_languages.uid', 'static_languages.lg_typo3 = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($LANG->lang, 'static_languages') . $sysPage->enableFields('sys_language') . $sysPage->enableFields('static_languages'));
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $this->sys_language_uid = $row['uid'];
             $this->collate_locale = $row['lg_collate_locale'];
         }
         $GLOBALS['TYPO3_DB']->sql_free_result($res);
     }
     if (is_array($params['items']) && !empty($params['items'])) {
         foreach ($params['items'] as $k => $item) {
             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid=' . intval($item[1]));
             while ($rowCat = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                 if ($localizedRowCat = DirectMailUtility::getRecordOverlay($table, $rowCat, $this->sys_language_uid, '')) {
                     $params['items'][$k][0] = $localizedRowCat['category'];
                 }
             }
             $GLOBALS['TYPO3_DB']->sql_free_result($res);
         }
     }
 }
Esempio n. 2
0
 /**
  * Initializing global variables
  *
  * @return	void
  */
 function init()
 {
     $this->MCONF = $GLOBALS['MCONF'];
     parent::init();
     // initialize IconFactory
     $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     $temp = BackendUtility::getModTSconfig($this->id, 'mod.web_modules.dmail');
     if (!is_array($temp['properties'])) {
         $temp['properties'] = array();
     }
     $this->params = $temp['properties'];
     $this->implodedParams = DirectMailUtility::implodeTSParams($this->params);
     if ($this->params['userTable'] && is_array($GLOBALS["TCA"][$this->params['userTable']])) {
         $this->userTable = $this->params['userTable'];
         $this->allowedTables[] = $this->userTable;
     }
     $this->MOD_MENU['dmail_mode'] = BackendUtility::unsetMenuItems($this->params, $this->MOD_MENU['dmail_mode'], 'menu.dmail_mode');
     // initialize backend user language
     if ($this->getLanguageService()->lang && ExtensionManagementUtility::isLoaded('static_info_tables')) {
         $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('sys_language.uid', 'sys_language LEFT JOIN static_languages ON sys_language.static_lang_isocode=static_languages.uid', 'static_languages.lg_typo3=' . $GLOBALS["TYPO3_DB"]->fullQuoteStr($this->getLanguageService()->lang, 'static_languages') . BackendUtility::BEenableFields('sys_language') . BackendUtility::deleteClause('sys_language') . BackendUtility::deleteClause('static_languages'));
         while ($row = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {
             $this->sys_language_uid = $row['uid'];
         }
         $GLOBALS["TYPO3_DB"]->sql_free_result($res);
     }
     // load contextual help
     $this->cshTable = '_MOD_' . $this->MCONF['name'];
     if ($GLOBALS["BE_USER"]->uc['edit_showFieldHelp']) {
         $this->getLanguageService()->loadSingleTableDescription($this->cshTable);
     }
 }
 /**
  * If a backend user is logged in and
  * a frontend usergroup is specified in the GET parameters, use this
  * group to simulate access to an access protected page with content to be sent
  *
  * @param $parameters
  * @param \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $typoScriptFrontendController
  *
  * @return void
  */
 public function simulateUsergroup($parameters, \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $typoScriptFrontendController)
 {
     $directMailFeGroup = (int) GeneralUtility::_GET('dmail_fe_group');
     $accessToken = GeneralUtility::_GET('access_token');
     if ($directMailFeGroup > 0 && DirectMailUtility::validateAndRemoveAccessToken($accessToken)) {
         if ($typoScriptFrontendController->fe_user->user) {
             $typoScriptFrontendController->fe_user->user[$typoScriptFrontendController->usergroup_column] = $directMailFeGroup;
         } else {
             $typoScriptFrontendController->fe_user->user = array($typoScriptFrontendController->fe_user->usergroup_column => $directMailFeGroup);
         }
     }
 }
Esempio n. 4
0
 /**
  * Function executed from scheduler.
  * Creates a new newsletter record, and sets the scheduled time to "now"
  *
  * @return	bool
  */
 public function execute()
 {
     if ($this->draftUid > 0) {
         $this->initializeHookObjects();
         $hookParams = array();
         $draftRecord = BackendUtility::getRecord('sys_dmail', $this->draftUid);
         // get some parameters from tsConfig
         $tsConfig = BackendUtility::getModTSconfig($draftRecord['pid'], 'mod.web_modules.dmail');
         $defaultParams = $tsConfig['properties'];
         // make a real record out of it
         unset($draftRecord['uid']);
         $draftRecord['tstamp'] = time();
         // set the right type (3 => 1, 2 => 0)
         $draftRecord['type'] -= 2;
         // check if domain record is set
         if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI && (int) $draftRecord['type'] !== 1 && empty($draftRecord['use_domain'])) {
             throw new \Exception('No domain record set!');
         }
         // Insert the new dmail record into the DB
         $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_dmail', $draftRecord);
         $this->dmailUid = $GLOBALS['TYPO3_DB']->sql_insert_id();
         // Call a hook after insertion of the cloned dmail record
         // This hook can get used to modify fields of the direct mail.
         // For example the current date could get appended to the subject.
         $hookParams['draftRecord'] =& $draftRecord;
         $hookParams['defaultParams'] =& $defaultParams;
         $this->callHooks('postInsertClone', $hookParams);
         // fetch the cloned record
         $mailRecord = BackendUtility::getRecord('sys_dmail', $this->dmailUid);
         // fetch mail content
         $result = DirectMailUtility::fetchUrlContentsForDirectMailRecord($mailRecord, $defaultParams, TRUE);
         if ($result['errors'] !== array()) {
             throw new \Exception('Failed to fetch contents: ' . implode(', ', $result['errors']));
         }
         $mailRecord = BackendUtility::getRecord('sys_dmail', $this->dmailUid);
         if ($mailRecord['mailContent'] && $mailRecord['renderedsize'] > 0) {
             $updateData = array('scheduled' => time(), 'issent' => 1);
             // Call a hook before enqueuing the cloned dmail record into
             // the direct mail delivery queue
             $hookParams['mailRecord'] =& $mailRecord;
             $hookParams['updateData'] =& $updateData;
             $this->callHooks('enqueueClonedDmail', $hookParams);
             // Update the cloned dmail so it will get sent upon next
             // invocation of the mailer engine
             $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_dmail', 'uid = ' . intval($this->dmailUid), $updateData);
         }
     }
     return true;
 }
Esempio n. 5
0
 /**
  * Update the pageTS
  * No return value: sent header to the same page
  *
  * @return void
  */
 public function updatePageTS()
 {
     if ($GLOBALS["BE_USER"]->doesUserHaveAccess(BackendUtility::getRecord('pages', $this->id), 2)) {
         $pageTypoScript = GeneralUtility::_GP('pageTS');
         if (is_array($pageTypoScript)) {
             DirectMailUtility::updatePagesTSconfig($this->id, $pageTypoScript, $this->TSconfPrefix);
             header('Location: ' . GeneralUtility::locationHeaderUrl(GeneralUtility::getIndpEnv('REQUEST_URI')));
         }
     }
 }
Esempio n. 6
0
 /**
  * Show the compact information of a direct mail record
  *
  * @param array $row Direct mail record
  *
  * @return string The compact infos of the direct mail record
  */
 function directMail_compactView($row)
 {
     // Render record:
     if ($row['type']) {
         $dmailData = $row['plainParams'] . ', ' . $row['HTMLParams'];
     } else {
         $page = BackendUtility::getRecord('pages', $row['page'], 'title');
         $dmailData = $row['page'] . ', ' . htmlspecialchars($page['title']);
         $dmailInfo = DirectMailUtility::fName('plainParams') . ' ' . htmlspecialchars($row['plainParams'] . LF . DirectMailUtility::fName('HTMLParams') . $row['HTMLParams']) . '; ' . LF;
     }
     $dmailInfo .= $this->getLanguageService()->getLL('view_media') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'includeMedia', $row['includeMedia']) . '; ' . LF . $this->getLanguageService()->getLL('view_flowed') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'flowedFormat', $row['flowedFormat']);
     $dmailInfo = '<span title="' . $dmailInfo . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL) . '</span>';
     $fromInfo = $this->getLanguageService()->getLL('view_replyto') . ' ' . htmlspecialchars($row['replyto_name'] . ' <' . $row['replyto_email'] . '>') . '; ' . LF . DirectMailUtility::fName('organisation') . ' ' . htmlspecialchars($row['organisation']) . '; ' . LF . DirectMailUtility::fName('return_path') . ' ' . htmlspecialchars($row['return_path']);
     $fromInfo = '<span title="' . $fromInfo . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL) . '</span>';
     $mailInfo = DirectMailUtility::fName('priority') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'priority', $row['priority']) . '; ' . LF . DirectMailUtility::fName('encoding') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'encoding', $row['encoding']) . '; ' . LF . DirectMailUtility::fName('charset') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'charset', $row['charset']);
     $mailInfo = '<span title="' . $mailInfo . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL) . '</span>';
     $delBegin = $row["scheduled_begin"] ? BackendUtility::datetime($row["scheduled_begin"]) : '-';
     $delEnd = $row["scheduled_end"] ? BackendUtility::datetime($row["scheduled_begin"]) : '-';
     // count total recipient from the query_info
     $totalRecip = 0;
     $idLists = unserialize($row['query_info']);
     foreach ($idLists['id_lists'] as $idArray) {
         $totalRecip += count($idArray);
     }
     $sentRecip = $GLOBALS['TYPO3_DB']->sql_num_rows($GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_dmail_maillog', 'mid=' . $row['uid'] . ' AND response_type = 0', '', 'rid ASC'));
     $out = '<table class="table table-striped table-hover">';
     $out .= '<tr class="t3-row-header"><td colspan="3">' . $this->iconFactory->getIconForRecord('sys_dmail', $row)->render() . htmlspecialchars($row['subject']) . '</td></tr>';
     $out .= '<tr class="db_list_normal"><td>' . $this->getLanguageService()->getLL('view_from') . '</td>' . '<td>' . htmlspecialchars($row['from_name'] . ' <' . htmlspecialchars($row['from_email']) . '>') . '</td>' . '<td>' . $fromInfo . '</td></tr>';
     $out .= '<tr class="db_list_normal"><td>' . $this->getLanguageService()->getLL('view_dmail') . '</td>' . '<td>' . BackendUtility::getProcessedValue('sys_dmail', 'type', $row['type']) . ': ' . $dmailData . '</td>' . '<td>' . $dmailInfo . '</td></tr>';
     $out .= '<tr class="db_list_normal"><td>' . $this->getLanguageService()->getLL('view_mail') . '</td>' . '<td>' . BackendUtility::getProcessedValue('sys_dmail', 'sendOptions', $row['sendOptions']) . ($row['attachment'] ? '; ' : '') . BackendUtility::getProcessedValue('sys_dmail', 'attachment', $row['attachment']) . '</td>' . '<td>' . $mailInfo . '</td></tr>';
     $out .= '<tr class="db_list_normal"><td>' . $this->getLanguageService()->getLL('view_delivery_begin_end') . '</td>' . '<td>' . $delBegin . ' / ' . $delEnd . '</td>' . '<td>&nbsp;</td></tr>';
     $out .= '<tr class="db_list_normal"><td>' . $this->getLanguageService()->getLL('view_recipient_total_sent') . '</td>' . '<td>' . $totalRecip . ' / ' . $sentRecip . '</td>' . '<td>&nbsp;</td></tr>';
     $out .= '</table>';
     $out .= '<div style="padding-top: 5px;"></div>';
     return $out;
 }
 /**
  * Updates Page TSconfig for a page with $id
  * The function seems to take $pageTS as an array with properties
  * and compare the values with those that already exists for the "object string",
  * $TSconfPrefix, for the page, then sets those values which were not present.
  * $impParams can be supplied as already known Page TSconfig, otherwise it's calculated.
  *
  * THIS DOES NOT CHECK ANY PERMISSIONS. SHOULD IT?
  * More documentation is needed.
  *
  * @param int $id Page id
  * @param array $pageTs Page TS array to write
  * @param string $tsConfPrefix Prefix for object paths
  * @param array|string $impParams [Description needed.]
  *
  * @return	void
  *
  * @see implodeTSParams(), getPagesTSconfig()
  */
 public static function updatePagesTSconfig($id, array $pageTs, $tsConfPrefix, $impParams = '')
 {
     $id = intval($id);
     if (is_array($pageTs) && $id > 0) {
         if (!is_array($impParams)) {
             $impParams = DirectMailUtility::implodeTSParams(BackendUtility::getPagesTSconfig($id));
         }
         $set = array();
         foreach ($pageTs as $f => $v) {
             $f = $tsConfPrefix . $f;
             if (!isset($impParams[$f]) && trim($v) || strcmp(trim($impParams[$f]), trim($v))) {
                 $set[$f] = trim($v);
             }
         }
         if (count($set)) {
             // Get page record and TS config lines
             $pRec = BackendUtility::getRecord('pages', $id);
             $tsLines = explode(LF, $pRec['TSconfig']);
             $tsLines = array_reverse($tsLines);
             // Reset the set of changes.
             foreach ($set as $f => $v) {
                 $inserted = 0;
                 foreach ($tsLines as $ki => $kv) {
                     if (substr($kv, 0, strlen($f) + 1) == $f . '=') {
                         $tsLines[$ki] = $f . '=' . $v;
                         $inserted = 1;
                         break;
                     }
                 }
                 if (!$inserted) {
                     $tsLines = array_reverse($tsLines);
                     $tsLines[] = $f . '=' . $v;
                     $tsLines = array_reverse($tsLines);
                 }
             }
             $tsLines = array_reverse($tsLines);
             // store those changes
             $tsConf = implode(LF, $tsLines);
             $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'uid=' . intval($id), array('TSconfig' => $tsConf));
         }
     }
 }
Esempio n. 8
0
    /**
     * Shows the infos of a directmail record in a table
     *
     * @param array $row DirectMail DB record
     *
     * @return string the HTML output
     */
    protected function renderRecordDetailsTable(array $row)
    {
        if (!$row['issent']) {
            if ($GLOBALS['BE_USER']->check('tables_modify', 'sys_dmail')) {
                // $requestUri = rawurlencode(GeneralUtility::linkThisScript(array('sys_dmail_uid' => $row['uid'], 'createMailFrom_UID' => '', 'createMailFrom_URL' => '')));
                $requestUri = BackendUtility::getModuleUrl('DirectMailNavFrame_DirectMail') . '&id=' . $this->id . '&CMD=info&sys_dmail_uid=' . $row['uid'] . '&fetchAtOnce=1';
                $editParams = BackendUtility::editOnClick('&edit[sys_dmail][' . $row['uid'] . ']=edit', $GLOBALS['BACK_PATH'], $requestUri);
                $content = '<a href="#" onClick="' . $editParams . '" title="' . $this->getLanguageService()->getLL("dmail_edit") . '">' . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL) . '<b>' . $this->getLanguageService()->getLL('dmail_edit') . '</b></a>';
            } else {
                $content = $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL) . ' (' . $this->getLanguageService()->getLL('dmail_noEdit_noPerms') . ')';
            }
        } else {
            $content = $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL) . '(' . $this->getLanguageService()->getLL('dmail_noEdit_isSent') . ')';
        }
        $content = '<thead >
			<th>' . DirectMailUtility::fName('subject') . ' <b>' . GeneralUtility::fixed_lgd_cs(htmlspecialchars($row['subject']), 60) . '</b></th>
			<th style="text-align: right;">' . $content . '</th>
		</thead>';
        $nameArr = explode(',', 'from_name,from_email,replyto_name,replyto_email,organisation,return_path,priority,attachment,type,page,sendOptions,includeMedia,flowedFormat,sys_language_uid,plainParams,HTMLParams,encoding,charset,issent,renderedsize');
        foreach ($nameArr as $name) {
            $content .= '
			<tr class="db_list_normal">
				<td>' . DirectMailUtility::fName($name) . '</td>
				<td>' . htmlspecialchars(BackendUtility::getProcessedValue('sys_dmail', $name, $row[$name])) . '</td>
			</tr>';
        }
        $content = '<table width="460" class="table table-striped table-hover">' . $content . '</table>';
        $sectionTitle = $this->iconFactory->getIconForRecord('sys_dmail', $row, Icon::SIZE_SMALL)->render() . '&nbsp;' . htmlspecialchars($row['subject']);
        return $this->doc->section($sectionTitle, $content, 1, 1, 0, true);
    }
Esempio n. 9
0
    /**
     * shows the infos of a directmail
     * record in a table
     *
     * @param	array	$row: DirectMail DB record
     * @return	string	the HTML output
     */
    protected function renderRecordDetailsTable($row)
    {
        if (!$row['issent']) {
            if ($GLOBALS['BE_USER']->check('tables_modify', 'sys_dmail')) {
                $retUrl = 'returnUrl=' . rawurlencode(GeneralUtility::linkThisScript(array('sys_dmail_uid' => $row['uid'], 'createMailFrom_UID' => '', 'createMailFrom_URL' => '')));
                $Eparams = '&edit[sys_dmail][' . $row['uid'] . ']=edit';
                $editOnClick = 'document.location=\'' . $GLOBALS['BACK_PATH'] . 'alt_doc.php?' . $retUrl . $Eparams . '\'; return false;';
                $content = '<a href="#" onClick="' . $editOnClick . '"><img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/edit2.gif', 'width="12" height="12"') . ' alt="' . $GLOBALS['LANG']->getLL("dmail_edit") . '" width="12" height="12" style="margin: 2px 3px; vertical-align:top;" title="' . $GLOBALS['LANG']->getLL("dmail_edit") . '" />' . '<b>' . $GLOBALS['LANG']->getLL('dmail_edit') . '</b>' . '</a>';
            } else {
                $content = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/edit2.gif', 'width="12" height="12"') . ' alt="' . $GLOBALS['LANG']->getLL("dmail_edit") . '" width="12" height="12" style="margin: 2px 3px; vertical-align:top;" title="' . $GLOBALS['LANG']->getLL("dmail_edit") . '" />' . '(' . $GLOBALS['LANG']->getLL('dmail_noEdit_noPerms') . ')';
            }
        } else {
            $content = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/edit2.gif', 'width="12" height="12"') . ' alt="' . $GLOBALS['LANG']->getLL("dmail_edit") . '" width="12" height="12" style="margin: 2px 3px; vertical-align:top;" title="' . $GLOBALS['LANG']->getLL("dmail_edit") . '" />' . '(' . $GLOBALS['LANG']->getLL('dmail_noEdit_isSent') . ')';
        }
        $content = '<tr>
			<td class="t3-row-header">' . DirectMailUtility::fName('subject') . ' <b>' . GeneralUtility::fixed_lgd_cs(htmlspecialchars($row['subject']), 60) . '</b></td>
			<td class="t3-row-header" style="text-align: right;">' . $content . '</td>
		</tr>';
        $nameArr = explode(',', 'from_name,from_email,replyto_name,replyto_email,organisation,return_path,priority,attachment,type,page,sendOptions,includeMedia,flowedFormat,plainParams,HTMLParams,encoding,charset,issent,renderedsize');
        foreach ($nameArr as $name) {
            $content .= '
			<tr>
				<td>' . DirectMailUtility::fName($name) . '</td>
				<td>' . htmlspecialchars(BackendUtility::getProcessedValue('sys_dmail', $name, $row[$name])) . '</td>
			</tr>';
        }
        $content = '<table border="0" cellpadding="1" cellspacing="1" width="460" class="typo3-dblist">' . $content . '</table>';
        $sectionTitle = IconUtility::getSpriteIconForRecord('sys_dmail', $row) . '&nbsp;' . htmlspecialchars($row['subject']);
        return $this->doc->section($sectionTitle, $content, 1, 1, 0, TRUE);
    }
Esempio n. 10
0
 /**
  * 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 "";
 }
Esempio n. 11
0
 /**
  * Shows user's info and categories
  *
  * @return	string HTML showing user's info and the categories
  */
 public function cmd_displayUserInfo()
 {
     $uid = intval(GeneralUtility::_GP('uid'));
     $indata = GeneralUtility::_GP('indata');
     $table = GeneralUtility::_GP('table');
     $mmTable = $GLOBALS['TCA'][$table]['columns']['module_sys_dmail_category']['config']['MM'];
     if (GeneralUtility::_GP('submit')) {
         $indata = GeneralUtility::_GP('indata');
         if (!$indata) {
             $indata['html'] = 0;
         }
     }
     switch ($table) {
         case 'tt_address':
             // see fe_users
         // see fe_users
         case 'fe_users':
             if (is_array($indata)) {
                 $data = array();
                 if (is_array($indata['categories'])) {
                     reset($indata['categories']);
                     foreach ($indata['categories'] as $recValues) {
                         reset($recValues);
                         $enabled = array();
                         foreach ($recValues as $k => $b) {
                             if ($b) {
                                 $enabled[] = $k;
                             }
                         }
                         $data[$table][$uid]['module_sys_dmail_category'] = implode(',', $enabled);
                     }
                 }
                 $data[$table][$uid]['module_sys_dmail_html'] = $indata['html'] ? 1 : 0;
                 /* @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler*/
                 $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
                 $tce->stripslashes_values = 0;
                 $tce->start($data, array());
                 $tce->process_datamap();
             }
             break;
         default:
             // do nothing
     }
     switch ($table) {
         case 'tt_address':
             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tt_address.*', 'tt_address LEFT JOIN pages ON pages.uid=tt_address.pid', 'tt_address.uid=' . intval($uid) . ' AND ' . $this->perms_clause . BackendUtility::deleteClause('pages') . BackendUtility::BEenableFields('tt_address') . BackendUtility::deleteClause('tt_address'));
             $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
             break;
         case 'fe_users':
             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('fe_users.*', 'fe_users LEFT JOIN pages ON pages.uid=fe_users.pid', 'fe_users.uid=' . intval($uid) . ' AND ' . $this->perms_clause . BackendUtility::deleteClause('pages') . BackendUtility::BEenableFields('fe_users') . BackendUtility::deleteClause('fe_users'));
             $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
             break;
         default:
             // do nothing
     }
     $theOutput = '';
     if (is_array($row)) {
         $resCat = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid_foreign', $mmTable, 'uid_local=' . $row['uid']);
         while ($rowCat = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resCat)) {
             $categoriesArray[] = $rowCat['uid_foreign'];
         }
         $categories = implode($categoriesArray, ",");
         $editParams = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
         $out = '';
         $out .= $this->iconFactory->getIconForRecord($table, $row)->render() . htmlspecialchars($row['name']) . htmlspecialchars(' <' . $row['email'] . '>');
         $out .= '&nbsp;&nbsp;<a href="#" onClick="' . BackendUtility::editOnClick($editParams, $GLOBALS['BACK_PATH'], '') . '" title="' . $this->getLanguageService()->getLL("dmail_edit") . '">' . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL) . '<b>' . $this->getLanguageService()->getLL('dmail_edit') . '</b></a>';
         $theOutput = $this->doc->section($this->getLanguageService()->getLL('subscriber_info'), $out);
         $out = '';
         $outCheckBox = '';
         $this->categories = DirectMailUtility::makeCategories($table, $row, $this->sys_language_uid);
         reset($this->categories);
         foreach ($this->categories as $pKey => $pVal) {
             $outCheckBox .= '<input type="hidden" name="indata[categories][' . $row['uid'] . '][' . $pKey . ']" value="0" />' . '<input type="checkbox" name="indata[categories][' . $row['uid'] . '][' . $pKey . ']" value="1"' . (GeneralUtility::inList($categories, $pKey) ? ' checked="checked"' : '') . ' /> ' . htmlspecialchars($pVal) . '<br />';
         }
         $outCheckBox .= '<br /><br /><input type="checkbox" name="indata[html]" value="1"' . ($row['module_sys_dmail_html'] ? ' checked="checked"' : '') . ' /> ';
         $outCheckBox .= $this->getLanguageService()->getLL('subscriber_profile_htmlemail') . '<br />';
         $out .= $outCheckBox;
         $out .= '<input type="hidden" name="table" value="' . $table . '" />' . '<input type="hidden" name="uid" value="' . $uid . '" />' . '<input type="hidden" name="CMD" value="' . $this->CMD . '" />' . '<br /><input type="submit" name="submit" value="' . htmlspecialchars($this->getLanguageService()->getLL('subscriber_profile_update')) . '" />';
         $theOutput .= '<div style="padding-top: 20px;"></div>';
         $theOutput .= $this->doc->section($this->getLanguageService()->getLL('subscriber_profile'), $this->getLanguageService()->getLL('subscriber_profile_instructions') . '<br /><br />' . $out);
     }
     return $theOutput;
 }
Esempio n. 12
0
 /**
  * show the compact information of a direct mail record
  *
  * @param	array		$row: direct mail record
  * @return	string		the compact infos of the direct mail record
  */
 function directMail_compactView($row)
 {
     // Render record:
     if ($row['type']) {
         $dmailData = $row['plainParams'] . ', ' . $row['HTMLParams'];
     } else {
         $page = BackendUtility::getRecord('pages', $row['page'], 'title');
         $dmailData = $row['page'] . ', ' . htmlspecialchars($page['title']);
         $dmail_info = DirectMailUtility::fName('plainParams') . ' ' . htmlspecialchars($row['plainParams'] . LF . DirectMailUtility::fName('HTMLParams') . $row['HTMLParams']) . '; ' . LF;
     }
     $dmail_info .= $GLOBALS["LANG"]->getLL('view_media') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'includeMedia', $row['includeMedia']) . '; ' . LF . $GLOBALS["LANG"]->getLL('view_flowed') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'flowedFormat', $row['flowedFormat']);
     $dmail_info = '<img' . IconUtility::skinImg($GLOBALS["BACK_PATH"], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $dmail_info . '">';
     $from_info = $GLOBALS["LANG"]->getLL('view_replyto') . ' ' . htmlspecialchars($row['replyto_name'] . ' <' . $row['replyto_email'] . '>') . '; ' . LF . DirectMailUtility::fName('organisation') . ' ' . htmlspecialchars($row['organisation']) . '; ' . LF . DirectMailUtility::fName('return_path') . ' ' . htmlspecialchars($row['return_path']);
     $from_info = '<img' . IconUtility::skinImg($GLOBALS["BACK_PATH"], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $from_info . '">';
     $mail_info = DirectMailUtility::fName('priority') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'priority', $row['priority']) . '; ' . LF . DirectMailUtility::fName('encoding') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'encoding', $row['encoding']) . '; ' . LF . DirectMailUtility::fName('charset') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'charset', $row['charset']);
     $mail_info = '<img' . IconUtility::skinImg($GLOBALS["BACK_PATH"], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $mail_info . '">';
     $delBegin = $row["scheduled_begin"] ? BackendUtility::datetime($row["scheduled_begin"]) : '-';
     $delEnd = $row["scheduled_end"] ? BackendUtility::datetime($row["scheduled_begin"]) : '-';
     //count total recipient from the query_info
     $totalRecip = 0;
     $id_lists = unserialize($row['query_info']);
     foreach ($id_lists['id_lists'] as $idArray) {
         $totalRecip += count($idArray);
     }
     $sentRecip = $GLOBALS['TYPO3_DB']->sql_num_rows($GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_dmail_maillog', 'mid=' . $row['uid'] . ' AND response_type = 0', '', 'rid ASC'));
     $out = '<table cellpadding="3" cellspacing="0" class="stats-table">';
     $out .= '<tr class="bgColor2"><td colspan="3">' . IconUtility::getSpriteIconForRecord('sys_dmail', $row) . htmlspecialchars($row['subject']) . '</td></tr>';
     $out .= '<tr class="bgColor4"><td>' . $GLOBALS["LANG"]->getLL('view_from') . '</td><td>' . htmlspecialchars($row['from_name'] . ' <' . htmlspecialchars($row['from_email']) . '>') . '</td><td>' . $from_info . '</td></tr>';
     $out .= '<tr class="bgColor4"><td>' . $GLOBALS["LANG"]->getLL('view_dmail') . '</td><td>' . BackendUtility::getProcessedValue('sys_dmail', 'type', $row['type']) . ': ' . $dmailData . '</td><td>' . $dmail_info . '</td></tr>';
     $out .= '<tr class="bgColor4"><td>' . $GLOBALS["LANG"]->getLL('view_mail') . '</td><td>' . BackendUtility::getProcessedValue('sys_dmail', 'sendOptions', $row['sendOptions']) . ($row['attachment'] ? '; ' : '') . BackendUtility::getProcessedValue('sys_dmail', 'attachment', $row['attachment']) . '</td><td>' . $mail_info . '</td></tr>';
     $out .= '<tr class="bgColor4"><td>' . $GLOBALS["LANG"]->getLL('view_delivery_begin_end') . '</td><td>' . $delBegin . ' / ' . $delEnd . '</td><td>&nbsp;</td></tr>';
     $out .= '<tr class="bgColor4"><td>' . $GLOBALS["LANG"]->getLL('view_recipient_total_sent') . '</td><td>' . $totalRecip . ' / ' . $sentRecip . '</td><td>&nbsp;</td></tr>';
     $out .= '</table>';
     $out .= $this->doc->spacer(5);
     return $out;
 }
 /**
  * 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);
 }
Esempio n. 14
0
 /**
  * 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'];
 }
Esempio n. 15
0
 /**
  * shows user's info and categories
  *
  * @return	string		HTML showing user's info and the categories
  */
 function cmd_displayUserInfo()
 {
     $uid = intval(GeneralUtility::_GP('uid'));
     $indata = GeneralUtility::_GP('indata');
     $table = GeneralUtility::_GP('table');
     $mm_table = $GLOBALS['TCA'][$table]['columns']['module_sys_dmail_category']['config']['MM'];
     if (GeneralUtility::_GP('submit')) {
         $indata = GeneralUtility::_GP('indata');
         if (!$indata) {
             $indata['html'] = 0;
         }
     }
     switch ($table) {
         case 'tt_address':
         case 'fe_users':
             if (is_array($indata)) {
                 $data = array();
                 if (is_array($indata['categories'])) {
                     reset($indata['categories']);
                     while (list($recUid, $recValues) = each($indata['categories'])) {
                         reset($recValues);
                         $enabled = array();
                         while (list($k, $b) = each($recValues)) {
                             if ($b) {
                                 $enabled[] = $k;
                             }
                         }
                         $data[$table][$uid]['module_sys_dmail_category'] = implode(',', $enabled);
                     }
                 }
                 $data[$table][$uid]['module_sys_dmail_html'] = $indata['html'] ? 1 : 0;
                 /** @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler*/
                 $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
                 $tce->stripslashes_values = 0;
                 $tce->start($data, array());
                 $tce->process_datamap();
             }
             break;
     }
     switch ($table) {
         case 'tt_address':
             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tt_address.*', 'tt_address LEFT JOIN pages ON pages.uid=tt_address.pid', 'tt_address.uid=' . intval($uid) . ' AND ' . $this->perms_clause . BackendUtility::deleteClause('pages') . BackendUtility::BEenableFields('tt_address') . BackendUtility::deleteClause('tt_address'));
             $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
             break;
         case 'fe_users':
             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('fe_users.*', 'fe_users LEFT JOIN pages ON pages.uid=fe_users.pid', 'fe_users.uid=' . intval($uid) . ' AND ' . $this->perms_clause . BackendUtility::deleteClause('pages') . BackendUtility::BEenableFields('fe_users') . BackendUtility::deleteClause('fe_users'));
             $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
             break;
     }
     if (is_array($row)) {
         $row_categories = '';
         $resCat = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid_foreign', $mm_table, 'uid_local=' . $row['uid']);
         while ($rowCat = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resCat)) {
             $row_categories .= $rowCat['uid_foreign'] . ',';
         }
         $row_categories = rtrim($row_categories, ",");
         $Eparams = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
         $out = '';
         $out .= IconUtility::getSpriteIconForRecord($table, $row, array('title' => BackendUtility::getRecordPath($row['pid'], $this->perms_clause, 40))) . htmlspecialchars($row['name']) . htmlspecialchars(' <' . $row['email'] . '>');
         $out .= '&nbsp;&nbsp;<a href="#" onClick="' . BackendUtility::editOnClick($Eparams, $GLOBALS['BACK_PATH'], '') . '"><img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/edit2.gif', 'width="12" height="12"') . ' alt="' . $GLOBALS['LANG']->getLL("dmail_edit") . '" width="12" height="12" style="margin: 2px 3px; vertical-align:top;" title="' . $GLOBALS['LANG']->getLL("dmail_edit") . '" /><b>' . $GLOBALS['LANG']->getLL('dmail_edit') . '</b></a>';
         $theOutput = $this->doc->section($GLOBALS['LANG']->getLL('subscriber_info'), $out);
         $out = '';
         $out_check = '';
         $this->categories = DirectMailUtility::makeCategories($table, $row, $this->sys_language_uid);
         reset($this->categories);
         while (list($pKey, $pVal) = each($this->categories)) {
             $out_check .= '<input type="hidden" name="indata[categories][' . $row['uid'] . '][' . $pKey . ']" value="0" /><input type="checkbox" name="indata[categories][' . $row['uid'] . '][' . $pKey . ']" value="1"' . (GeneralUtility::inList($row_categories, $pKey) ? ' checked="checked"' : '') . ' /> ' . htmlspecialchars($pVal) . '<br />';
         }
         $out_check .= '<br /><br /><input type="checkbox" name="indata[html]" value="1"' . ($row['module_sys_dmail_html'] ? ' checked="checked"' : '') . ' /> ';
         $out_check .= $GLOBALS['LANG']->getLL('subscriber_profile_htmlemail') . '<br />';
         $out .= $out_check;
         $out .= '<input type="hidden" name="table" value="' . $table . '" /><input type="hidden" name="uid" value="' . $uid . '" /><input type="hidden" name="CMD" value="' . $this->CMD . '" /><br /><input type="submit" name="submit" value="' . htmlspecialchars($GLOBALS['LANG']->getLL('subscriber_profile_update')) . '" />';
         $theOutput .= $this->doc->spacer(20);
         $theOutput .= $this->doc->section($GLOBALS['LANG']->getLL('subscriber_profile'), $GLOBALS['LANG']->getLL('subscriber_profile_instructions') . '<br /><br />' . $out);
     }
     return $theOutput;
 }
Esempio n. 16
0
 /**
  * If the page containing the mail is access protected,
  * access permission can be simulated when fetching the e-mail
  * by adding a special parameter to the URL
  *
  * @param string $url The URL
  *
  * @return string The URL with the added values
  */
 public function addSimulateUsergroup($url)
 {
     if ($this->simulateUsergroup && MathUtility::canBeInterpretedAsInteger($this->simulateUsergroup)) {
         return $url . '&dmail_fe_group=' . (int) $this->simulateUsergroup . '&access_token=' . DirectMailUtility::createAndGetAccessToken();
     }
     return $url;
 }