function rex_generateArticle($id, $refresh = 0) { global $PHP_SELF, $module_id, $FORM, $REX_USER, $REX, $I18N; // artikel generieren // vorraussetzung: articel steht schon in der datenbank // // -> infos schreiben -> abhaengig von clang // --> artikel infos / einzelartikel metadaten // --> artikel content / einzelartikel content // --> listen generieren // wenn startpage = 1 // ---> artikel liste // ---> category liste // --> cache loeschen // --------------------------------------------------- generiere generated/articles/xx.article $CL = $REX[CLANG]; reset($CL); for ($i = 0; $i < count($CL); $i++) { $clang = key($CL); $REX[RC] = true; // keine Ausgabe als eval(CONTENT) sondern nur speichern in datei $CONT = new article(); $CONT->setCLang($clang); $CONT->setArticleId($id); $article_content = "?>" . $CONT->getArticle(); // --------------------------------------------------- Artikelparameter speichern $article = "<?\n" . "\n\$REX[ART][{$id}][article_id][{$clang}] = \"{$id}\";" . "\n\$REX[ART][{$id}][re_id][{$clang}] = \"" . rex_addslashes($CONT->getValue("re_id")) . "\";" . "\n\$REX[ART][{$id}][name][{$clang}] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX[ART][{$id}][catname][{$clang}] = \"" . rex_addslashes($CONT->getValue("catname")) . "\";" . "\n\$REX[ART][{$id}][cattype][{$clang}] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX[ART][{$id}][alias][{$clang}] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX[ART][{$id}][description][{$clang}] = \"" . rex_addslashes($CONT->getValue("description")) . "\";" . "\n\$REX[ART][{$id}][attribute][{$clang}] = \"" . rex_addslashes($CONT->getValue("attribute")) . "\";" . "\n\$REX[ART][{$id}][file][{$clang}] = \"" . rex_addslashes($CONT->getValue("file")) . "\";" . "\n\$REX[ART][{$id}][type_id][{$clang}] = \"" . rex_addslashes($CONT->getValue("type_id")) . "\";" . "\n\$REX[ART][{$id}][teaser][{$clang}] = \"" . rex_addslashes($CONT->getValue("teaser")) . "\";" . "\n\$REX[ART][{$id}][startpage][{$clang}] = \"" . rex_addslashes($CONT->getValue("startpage")) . "\";" . "\n\$REX[ART][{$id}][prior][{$clang}] = \"" . rex_addslashes($CONT->getValue("prior")) . "\";" . "\n\$REX[ART][{$id}][path][{$clang}] = \"" . rex_addslashes($CONT->getValue("path")) . "\";" . "\n\$REX[ART][{$id}][status][{$clang}] = \"" . rex_addslashes($CONT->getValue("status")) . "\";" . "\n\$REX[ART][{$id}][online_from][{$clang}] = \"" . rex_addslashes($CONT->getValue("online_from")) . "\";" . "\n\$REX[ART][{$id}][online_to][{$clang}] = \"" . rex_addslashes($CONT->getValue("online_to")) . "\";" . "\n\$REX[ART][{$id}][createdate][{$clang}] = \"" . rex_addslashes($CONT->getValue("createdate")) . "\";" . "\n\$REX[ART][{$id}][updatedate][{$clang}] = \"" . rex_addslashes($CONT->getValue("updatedate")) . "\";" . "\n\$REX[ART][{$id}][keywords][{$clang}] = \"" . rex_addslashes($CONT->getValue("keywords")) . "\";" . "\n\$REX[ART][{$id}][template_id][{$clang}] = \"" . rex_addslashes($CONT->getValue("template_id")) . "\";" . "\n\$REX[ART][{$id}][createuser][{$clang}] = \"" . rex_addslashes($CONT->getValue("createuser")) . "\";" . "\n\$REX[ART][{$id}][updateuser][{$clang}] = \"" . rex_addslashes($CONT->getValue("updateuser")) . "\";" . "\n\$REX[ART][{$id}][last_update_stamp][{$clang}] = \"" . time() . "\";" . "\n?>"; if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.article", "w")) { fputs($fp, $article); fclose($fp); @chmod($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.article", 0777); } else { $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "/generated/articles/"; } // --------------------------------------------------- Artikelcontent speichern if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.content", "w")) { fputs($fp, $article_content); fclose($fp); @chmod($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.content", 0777); } else { $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "/generated/articles/"; } if ($MSG != "") { echo "<table border=0 cellpadding=5 cellspacing=1 width=770><tr><td class=warning>{$MSG}</td></tr></table>"; } $REX[RC] = false; // --------------------------------------------------- Listen generieren if ($CONT->getValue("startpage") == 1) { rex_generateLists($id); rex_generateLists($CONT->getValue("re_id")); } else { rex_generateLists($CONT->getValue("re_id")); } next($CL); } // --------------------------------------------------- recache all $Cache = new Cache(); $Cache->removeAllCacheFiles(); }
/** * Generiert alle *.article u. *.content Dateien eines Artikels/einer Kategorie * * @param $id ArtikelId des Artikels, der generiert werden soll * @param $refreshall Boolean Bei True wird der Inhalte auch komplett neu generiert, bei False nur die Metainfos */ function rex_generateArticle($id, $refreshall = true) { global $PHP_SELF, $module_id, $FORM, $REX_USER, $REX, $I18N; // artikel generieren // vorraussetzung: articel steht schon in der datenbank // // -> infos schreiben -> abhaengig von clang // --> artikel infos / einzelartikel metadaten // --> artikel content / einzelartikel content // --> listen generieren // wenn startpage = 1 // ---> artikel liste // ---> category liste // --------------------------------------------------- generiere generated/articles/xx.article $CL = $REX['CLANG']; reset($CL); for ($i = 0; $i < count($CL); $i++) { $clang = key($CL); $REX['RC'] = true; // keine Ausgabe als eval(CONTENT) sondern nur speichern in datei $CONT = new article(); $CONT->setCLang($clang); $CONT->setArticleId($id); // --------------------------------------------------- Artikelparameter speichern $article = "<?php\n" . "\n\$REX['ART']['{$id}']['article_id']['{$clang}'] = \"{$id}\";" . "\n\$REX['ART']['{$id}']['re_id']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("re_id")) . "\";" . "\n\$REX['ART']['{$id}']['name']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX['ART']['{$id}']['catname']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("catname")) . "\";" . "\n\$REX['ART']['{$id}']['cattype']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX['ART']['{$id}']['alias']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX['ART']['{$id}']['description']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("description")) . "\";" . "\n\$REX['ART']['{$id}']['attribute']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("attribute")) . "\";" . "\n\$REX['ART']['{$id}']['file']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("file")) . "\";" . "\n\$REX['ART']['{$id}']['type_id']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("type_id")) . "\";" . "\n\$REX['ART']['{$id}']['teaser']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("teaser")) . "\";" . "\n\$REX['ART']['{$id}']['startpage']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("startpage")) . "\";" . "\n\$REX['ART']['{$id}']['prior']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("prior")) . "\";" . "\n\$REX['ART']['{$id}']['path']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("path")) . "\";" . "\n\$REX['ART']['{$id}']['status']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("status")) . "\";" . "\n\$REX['ART']['{$id}']['online_from']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("online_from")) . "\";" . "\n\$REX['ART']['{$id}']['online_to']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("online_to")) . "\";" . "\n\$REX['ART']['{$id}']['createdate']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("createdate")) . "\";" . "\n\$REX['ART']['{$id}']['updatedate']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("updatedate")) . "\";" . "\n\$REX['ART']['{$id}']['keywords']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("keywords")) . "\";" . "\n\$REX['ART']['{$id}']['template_id']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("template_id")) . "\";" . "\n\$REX['ART']['{$id}']['createuser']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("createuser")) . "\";" . "\n\$REX['ART']['{$id}']['updateuser']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("updateuser")) . "\";" . "\n\$REX['ART']['{$id}']['last_update_stamp']['{$clang}'] = \"" . time() . "\";" . "\n?>"; if ($fp = @fopen($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.article", "w")) { fputs($fp, $article); fclose($fp); @chmod($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.article", 0777); } else { $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX['INCLUDE_PATH'] . "/generated/articles/"; } // --------------------------------------------------- Artikelcontent speichern if ($refreshall) { if ($fp = @fopen($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.content", "w")) { $article_content = "?>" . $CONT->getArticle(); fputs($fp, $article_content); fclose($fp); @chmod($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.content", 0777); } else { $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX['INCLUDE_PATH'] . "/generated/articles/"; } } if (isset($MSG) and $MSG != "") { echo "<table border=0 cellpadding=5 cellspacing=1 width=770><tr><td class=warning>{$MSG}</td></tr></table>"; } $REX['RC'] = false; // --------------------------------------------------- Listen generieren if ($CONT->getValue("startpage") == 1) { rex_generateLists($id); rex_generateLists($CONT->getValue("re_id")); } else { rex_generateLists($CONT->getValue("re_id")); } next($CL); } }
if ($REX[CACHING_DEBUG]) { print "<br>CachedVersion<br>"; } if ($REX[CACHING_DEBUG]) { print "Script time: " . showScripttime(); } $SHOWARTICLE = false; } else { // start caching $Cache->startCacheFile(); } } } if ($SHOWARTICLE) { $REX_ARTICLE = new article(); $REX_ARTICLE->setCLang($clang); if ($REX_ARTICLE->setArticleId($article_id)) { $REX_ARTICLE->getArticleTemplate(); } elseif ($REX_ARTICLE->setArticleId($REX[STARTARTIKEL_ID])) { $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; } ////////////////////////////////////////////// // advanced caching ////////////////////////////////////////////// if ($Cache->makeCacheFile) { $Cache->writeCacheFile(); if ($REX[CACHING_DEBUG]) { print "<br>MadeCache<br>";
echo "<tr><td align=center class=warning><img src=pics/warning.gif width=16 height=16 vspace=4></td><td class=warning> " . $_REQUEST["msg"] . "</td><td class=lgrey> </td></tr>"; } echo " <tr>\n <td class=lgrey> </td>\n <td valign=top class=lblue>"; if ($mode == "edit") { if (!isset($slice_id)) { $slice_id = ''; } if (!isset($function)) { $function = ''; } // ------------------------------------------ START: MODULE EDITIEREN/ADDEN ETC. $CONT = new article(); $CONT->setArticleId($article_id); $CONT->setSliceId($slice_id); $CONT->setMode($mode); $CONT->setCLang($clang); $CONT->setCType($ctype); $CONT->setEval(TRUE); $CONT->setFunction($function); eval("?>" . $CONT->getArticle()); // ------------------------------------------ END: MODULE EDITIEREN/ADDEN ETC. } elseif ($mode == "meta") { // ------------------------------------------ START: META VIEW $extens = ""; if (isset($save) and $save == "1") { $meta_sql = new sql(); $meta_sql->setTable($REX['TABLE_PREFIX'] . "article"); // $meta_sql->debugsql = 1; $meta_sql->where("id='{$article_id}' and clang={$clang}"); $meta_sql->setValue("online_from", mktime(0, 0, 0, $monat_von, $tag_von, $jahr_von)); $meta_sql->setValue("online_to", mktime(0, 0, 0, $monat_bis, $tag_bis, $jahr_bis));
if ($mail_reply != "" and $mail_subject != "" and $mail_aid > 0 and $test_email != "" and $test_name != "" and $test_firstname != "") { // $mail_reply // $mail_subject // $mail_aid // $test_email // $test_name // $test_firstname // $content $to_email = $test_email; $to_name = $test_name; $to_firstname = $test_firstname; // Testmail verschicken.. $REX['GG'] = true; $REX['REDAXO'] = true; $REX_ARTICLE = new article(); $REX_ARTICLE->setCLang(0); $REX_ARTICLE->setArticleId($mail_aid); // $REX_ARTICLE->setTemplateId(xx); $content = $REX_ARTICLE->getArticleTemplate(); $REX['GG'] = false; $REX['REDAXO'] = true; // Allgemeine Initialisierung $mail = new MyMailer(); $mail->AddAddress($to_email); $mail->From = $mail_reply; $mail->FromName = $mail_reply; // Subject $subject = $mail_subject; $subject = str_replace("###EMAIL###", "{$to_email}", $subject); $subject = str_replace("###NAME###", "{$to_name}", $subject); $subject = str_replace("###FIRSTNAME###", "{$to_firstname}", $subject);