/** * index action for the module controller * This will render the HTML needed for ExtJS application * * @return void */ public function indexAction() { $pageType = ''; $record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('doktype', 'pages', 'uid =' . $this->pageId); if (!empty($record['doktype']) && $record['doktype'] == 254) { $pageType = 'folder'; } elseif (!empty($record['doktype'])) { $pageType = 'page'; } $configuration = array('pageId' => $this->pageId, 'pageType' => $pageType, 'emailShowUrl' => Tx_Newsletter_Tools::buildFrontendUri('show', array(), 'Email')); $this->view->assign('configuration', $configuration); }
/** * Return HTML code showing an extract of recipients (first X recipients) */ public function getExtract($limit = 30) { if ($this->getError()) { $out = "Error: " . $this->getError(); } else { $i = 0; while ($row = $this->getRecipient()) { // Dump formatted table header if ($i == 0) { $out .= '<tr>'; foreach (array_keys($row) as $key) { $out .= '<th style="padding-right: 1em;">' . $this->getFieldTitle($key) . "</th>"; } $out .= '</tr>'; } $out .= '<tr style="border: 1px grey solid; border-collapse: collapse;">'; foreach ($row as $field) { $out .= '<td style="padding-right: 1em;">' . $field . '</td>'; } $out .= '</tr>'; if (++$i == $limit) { break; } } $out = '<table style="border: 1px grey solid; border-collapse: collapse;">' . $out . '</table>'; $authCode = \TYPO3\CMS\Core\Utility\GeneralUtility::stdAuthCode($this->_getCleanProperties()); $uriXml = Tx_Newsletter_Tools::buildFrontendUri('export', array('uidRecipientList' => $this->getUid(), 'authCode' => $authCode, 'format' => 'xml'), 'RecipientList'); $uriCsv = Tx_Newsletter_Tools::buildFrontendUri('export', array('uidRecipientList' => $this->getUid(), 'authCode' => $authCode, 'format' => 'csv'), 'RecipientList'); $out .= '<p><strong>' . $i . '/' . $this->getCount() . '</strong> recipients (<a href="' . $uriXml . "\">export XML</a>, " . '<a href="' . $uriCsv . "\">export CSV</a>" . ')</p>'; } $out = '<h4>' . $this->getTitle() . '</h4>' . $out; return $out; }
private function getLinkAuthCode(Tx_Newsletter_Domain_Model_Email $email, $url, $isPreview, $isPlainText = false) { global $TYPO3_DB; $url = html_entity_decode($url); // First check in our local cache if (isset($this->linksCache[$url])) { $linkId = $this->linksCache[$url]; } elseif ($isPreview) { $linkId = count($this->linksCache); } else { // Look for the link database, it may already exist $res = $TYPO3_DB->sql_query('SELECT uid FROM tx_newsletter_domain_model_link WHERE url = "' . $url . '" AND newsletter = ' . $this->newsletter->getUid() . ' LIMIT 1'); $row = $TYPO3_DB->sql_fetch_row($res); if ($row) { $linkId = $row[0]; } else { $TYPO3_DB->exec_INSERTquery('tx_newsletter_domain_model_link', array('pid' => $this->newsletter->getPid(), 'url' => $url, 'newsletter' => $this->newsletter->getUid())); $linkId = $TYPO3_DB->sql_insert_id(); } } // Store link in cache $this->linksCache[$url] = $linkId; $authCode = md5($email->getAuthCode() . $linkId); $newUrl = Tx_Newsletter_Tools::buildFrontendUri('clicked', array(), 'Link') . '&url=' . urlencode($url) . '&n=' . $this->newsletter->getUid() . '&l=' . $authCode . ($isPlainText ? '&p=1' : ''); return $newUrl; }