function rex_newsletter_sendmail($userinfo, $aid, $mail_reply, $mail_subject) { global $REX; $tmp_redaxo = $REX['REDAXO']; $REX['REDAXO'] = true; // ***** HTML VERSION KOMPLETT $REX_ARTICLE = new rex_article(); $REX_ARTICLE->setCLang(0); $REX_ARTICLE->setArticleId($aid); $REX_ARTICLE->getContentAsQuery(TRUE); // $REX_ARTICLE->setTemplateId(xx); $REX['ADDON']['NEWSLETTER_TEXT'] = FALSE; $html_body = $REX_ARTICLE->getArticleTemplate(); // ***** TEXT VERSION $REX_ARTICLE = new rex_article(); $REX_ARTICLE->setCLang(0); $REX_ARTICLE->setArticleId($aid); $REX_ARTICLE->getContentAsQuery(TRUE); // $REX_ARTICLE->setTemplateId(xx); $REX['ADDON']['NEWSLETTER_TEXT'] = TRUE; // FILTERN VERSION KOMPLETT $text_body = $REX_ARTICLE->getArticle(); $text_body = str_replace("<br />", "<br />", $text_body); $text_body = str_replace("<p>", "\n\n</p>", $text_body); $text_body = str_replace("<ul>", "\n\n</ul>", $text_body); $text_body = preg_replace("#(\\<)(.*)(\\>)#imsU", "", $text_body); $text_body = html_entity_decode($text_body); $REX['REDAXO'] = true; // ***** MAIL VERSAND // Allgemeine Initialisierung // $mail = new PHPMailer(); $mail = new rex_mailer(); $mail->AddAddress($userinfo["email"]); $mail->From = $mail_reply; $mail->FromName = $mail_reply; $subject = $mail_subject; // Subject // Bodies // html foreach ($userinfo as $k => $v) { $subject = str_replace("###" . $k . "###", $v, $subject); $html_body = str_replace("###" . $k . "###", $v, $html_body); $text_body = str_replace("###" . $k . "###", $v, $text_body); $subject = str_replace("###" . strtoupper($k) . "###", $v, $subject); $html_body = str_replace("###" . strtoupper($k) . "###", $v, $html_body); $text_body = str_replace("###" . strtoupper($k) . "###", $v, $text_body); } // text // echo "<pre>$text_body</pre>"; $mail->Subject = $subject; $mail->AltBody = $text_body; $mail->Body = $html_body; $mail->Send(); $REX['REDAXO'] = $tmp_redaxo; }
/** * Indexes a certain article. * * @param int $_id * @param mixed $_clang * * @return int */ function indexArticle($_id, $_clang = false) { global $REX; if ($_clang === false) { $langs = $this->languages; } else { $langs = array(intval($_clang) => $this->languages[intval($_clang)]); } $return = array(); $keywords = array(); foreach ($langs as $langID => $v) { if (in_array($_id, $this->excludeIDs)) { $return[$v] = A587_ART_EXCLUDED; continue; } $REX['CUR_CLANG'] = $langID; $delete = new rex_sql(); $where = sprintf("ftable = '%s' AND fid = %d AND clang = %d", $delete->escape($this->tablePrefix . 'article'), $_id, $langID); // delete from cache $select = new rex_sql(); $select->setTable($this->tablePrefix . '587_searchindex'); $select->setWhere($where); $select->select('id'); $indexIds = array(); foreach ($select->getArray() as $result) { $indexIds[] = $result['id']; } $this->deleteCache($indexIds); // delete old $delete->setTable($this->tablePrefix . '587_searchindex'); $delete->setWhere($where); $delete->delete(); // index article $article = OOArticle::getArticleById(intval($_id), $langID); if (is_object($article) and ($article->isOnline() or $this->indexOffline)) { $this->beginFrontendMode(); if (ini_get('allow_url_fopen') and $this->indexViaHTTP) { $articleText = @file_get_contents('http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '/redaxo/') + 1) . rex_geturl($_id, $langID, '', '&')); } elseif ($_id != 0 and $this->dontIndexRedirects) { $rex_article = new rex_article(intval($_id), $langID); $article_content_file = $this->generatedPath . '/articles/' . $_id . '.' . $langID . '.content'; if (!file_exists($article_content_file)) { include_once $this->includePath . "/functions/function_rex_generate.inc.php"; $generated = rex_generateArticleContent($_id, $langID); if ($generated !== true) { $return[$v] = A587_ART_IDNOTFOUND; continue; } } if (file_exists($article_content_file) and preg_match($this->encodeRegex('~(header\\s*\\(\\s*["\']\\s*Location\\s*:)|(rex_redirect\\s*\\()~is'), rex_get_file_contents($article_content_file))) { $return[$v] = A587_ART_REDIRECT; continue; } if ($this->indexWithTemplate) { $articleText = $rex_article->getArticleTemplate(); } else { $articleText = $rex_article->getArticle(); } if ($this->ep_outputfilter) { $tmp = array('artid' => $REX['ARTICLE_ID'], 'clang' => $REX['CUR_CLANG']); $REX['ARTICLE_ID'] = $_id; $REX['CUR_CLANG'] = $langID; $articleText = rex_register_extension_point('OUTPUT_FILTER', $articleText, array('environment' => 'frontend', 'sendcharset' => false)); $REX['ARTICLE_ID'] = $tmp['artid']; $REX['CUR_CLANG'] = $tmp['clang']; } } $insert = new rex_sql(); $articleData = array(); $articleData['texttype'] = 'article'; $articleData['ftable'] = $this->tablePrefix . 'article'; $articleData['fcolumn'] = NULL; $articleData['clang'] = $article->getClang(); $articleData['fid'] = intval($_id); $articleData['catid'] = $article->getCategoryId(); $articleData['unchangedtext'] = $insert->escape($articleText); $articleData['plaintext'] = $insert->escape($plaintext = $this->getPlaintext($articleText)); if (array_key_exists($REX['TABLE_PREFIX'] . 'article', $this->includeColumns)) { $additionalValues = array(); $select->flush(); $select->setTable($REX['TABLE_PREFIX'] . 'article'); $select->setWhere('id = ' . $_id . ' AND clang = ' . $langID); $select->select('`' . implode('`,`', $this->includeColumns[$REX['TABLE_PREFIX'] . 'article']) . '`'); foreach ($this->includeColumns[$REX['TABLE_PREFIX'] . 'article'] as $col) { $additionalValues[$col] = $select->getValue($col); } $articleData['values'] = $insert->escape(serialize($additionalValues)); } foreach (preg_split($this->encodeRegex('~[[:punct:][:space:]]+~ism'), $plaintext) as $keyword) { if ($this->significantCharacterCount <= mb_strlen($keyword, 'UTF-8')) { $keywords[] = array('search' => $keyword, 'clang' => $langID); } } $articleData['teaser'] = $insert->escape($this->getTeaserText($plaintext)); $insert->setTable($this->tablePrefix . '587_searchindex'); $insert->setValues($articleData); $insert->insert(); $this->endFrontendMode(); $return[$langID] = A587_ART_GENERATED; } } $this->storeKeywords($keywords, false); return $return; }
} } else { // redaxo $nl_from_email = $redaxo_nl_from_email; $nl_from_name = $redaxo_nl_from_name; $nl_subject = $redaxo_nl_subject; if ($nl_from_email == "" || $nl_from_name == "" || $nl_subject == "" || $redaxo_nl_article_id == 0) { $error[] = "Bitte prüfen Sie ob alle Infos eingetragen sind"; } else { $tmp_redaxo = $REX['REDAXO']; // ***** HTML VERSION KOMPLETT $REX['REDAXO'] = true; $REX_ARTICLE = new rex_article($redaxo_nl_article_id, 0); $REX_ARTICLE->getContentAsQuery(TRUE); $REX['ADDON']['NEWSLETTER_TEXT'] = FALSE; $nl_body_html = $REX_ARTICLE->getArticleTemplate(); // ***** TEXT VERSION $REX['REDAXO'] = true; $REX_ARTICLE = new rex_article($redaxo_nl_article_id, 0); $REX_ARTICLE->getContentAsQuery(TRUE); $REX['ADDON']['NEWSLETTER_TEXT'] = TRUE; // FILTERN VERSION KOMPLETT $nl_body_text = $REX_ARTICLE->getArticle(); $nl_body_text = str_replace("<br />", "<br />", $nl_body_text); $nl_body_text = str_replace("<p>", "\n\n</p>", $nl_body_text); $nl_body_text = str_replace("<ul>", "\n\n</ul>", $nl_body_text); $nl_body_text = preg_replace("#(\\<)(.*)(\\>)#imsU", "", $nl_body_text); $nl_body_text = html_entity_decode($nl_body_text); $REX['REDAXO'] = $tmp_redaxo; $send = TRUE; }
// Kann wichtig für die Darstellung sein // Sollte immer false bleiben $REX['REDAXO'] = false; // Wenn $REX[GG] = true; dann wird der // Content aus den redaxo/include/generated/ // genommen $REX['GG'] = true; // setzte pfad und includiere klassen und funktionen $REX['HTDOCS_PATH'] = './'; include './redaxo/include/master.inc.php'; // Starte einen neuen Artikel und setzte die aktuelle // artikel id. wenn nicht vorhanden, nimm einen // speziellen artikel. z.b. fehler seite oder home seite $REX_ARTICLE = new rex_article(); $REX_ARTICLE->setCLang($clang); if ($REX['SETUP']) { header('Location: redaxo/index.php'); exit; } elseif ($REX_ARTICLE->setArticleId($article_id)) { echo $REX_ARTICLE->getArticleTemplate(); } elseif ($REX_ARTICLE->setArticleId($REX['NOTFOUND_ARTICLE_ID'])) { echo $REX_ARTICLE->getArticleTemplate(); } else { echo 'Kein Startartikel selektiert / No starting Article selected. Please click here to enter <a href="redaxo/index.php">redaxo</a>'; $REX['STATS'] = 0; } // ----- caching end für output filter $CONTENT = ob_get_contents(); ob_end_clean(); // ----- inhalt ausgeben rex_send_content($REX_ARTICLE, $CONTENT, 'frontend');