示例#1
0
 /**
  * Indexes a certain column.
  * Returns the number of the indexed rows or false.
  * 
  * @param string $_table
  * @param mixed $_column
  * @param mixed $_idcol
  * @param mixed $_id
  * @param mixed $_start
  * @param mixed $_count
  * 
  * @return mixed
  */
 function indexColumn($_table, $_column, $_idcol = false, $_id = false, $_start = false, $_count = false, $_where = false)
 {
     $delete = new rex_sql();
     $where = sprintf(" `ftable` = '%s' AND `fcolumn` = '%s' AND `texttype` = 'db_column'", $delete->escape($_table), $delete->escape($_column));
     //if(is_string($_idcol) AND ($_id !== false))
     //$where .= sprintf(' AND fid = %d',$_id);
     // delete from cache
     $select = new rex_sql();
     $select->setTable($this->tablePrefix . '587_searchindex');
     $select->setWhere($where);
     $indexIds = array();
     if ($select->select('id')) {
         foreach ($select->getArray() as $result) {
             $indexIds[] = $result['id'];
         }
         $this->deleteCache($indexIds);
     }
     // delete old data
     if ($_start === 0) {
         $delete->setTable($this->tablePrefix . '587_searchindex');
         $delete->setWhere($where);
         $delete->delete();
     }
     $sql = new rex_sql();
     // get primary key column(s)
     $primaryKeys = array();
     foreach ($sql->getArray("SHOW COLUMNS FROM `" . $_table . "` WHERE `KEY` = 'PRI'") as $col) {
         $primaryKeys[] = $col['Field'];
     }
     // index column
     $sql->flush();
     $sql->setTable($_table);
     $where = '1 ';
     if (is_string($_idcol) and $_id) {
         $where .= sprintf(' AND (%s = %d)', $_idcol, $_id);
     }
     if (!empty($_where) and is_string($_where)) {
         $where .= ' AND (' . $_where . ')';
     }
     if (is_numeric($_start) and is_numeric($_count)) {
         $where .= ' LIMIT ' . $_start . ',' . $_count;
     }
     $sql->setWhere($where);
     $count = false;
     if ($sql->select('*')) {
         $this->beginFrontendMode();
         $count = 0;
         $keywords = array();
         foreach ($sql->getArray() as $value) {
             if (!empty($value[$_column]) and ($this->indexOffline or $this->tablePrefix . 'article' != $_table or $value['status'] == '1') and ($this->tablePrefix . 'article' != $_table or !in_array($value['id'], $this->excludeIDs))) {
                 $insert = new rex_sql();
                 $indexData = array();
                 $indexData['texttype'] = 'db_column';
                 $indexData['ftable'] = $_table;
                 $indexData['fcolumn'] = $_column;
                 if (array_key_exists('clang', $value)) {
                     $indexData['clang'] = $value['clang'];
                 } else {
                     $indexData['clang'] = NULL;
                 }
                 $indexData['fid'] = NULL;
                 if (is_string($_idcol) and array_key_exists($_idcol, $value)) {
                     $indexData['fid'] = $value[$_idcol];
                 } elseif ($_table == $this->tablePrefix . 'article') {
                     $indexData['fid'] = $value['id'];
                 } elseif (count($primaryKeys) == 1) {
                     $indexData['fid'] = $value[$primaryKeys[0]];
                 } elseif (count($primaryKeys)) {
                     $fids = array();
                     foreach ($primaryKeys as $pk) {
                         $fids[$pk] = $value[$pk];
                     }
                     $indexData['fid'] = json_encode($fids);
                 }
                 if (is_null($indexData['fid'])) {
                     $indexData['fid'] = $this->getMinFID();
                 }
                 if (array_key_exists('re_id', $value)) {
                     $indexData['catid'] = $value['re_id'];
                     if ($_table == $this->tablePrefix . 'article') {
                         $indexData['catid'] = intval($value['startpage']) ? $value['id'] : $value['re_id'];
                     }
                 } elseif (array_key_exists('category_id', $value)) {
                     $indexData['catid'] = $value['category_id'];
                 } else {
                     $indexData['catid'] = NULL;
                 }
                 $additionalValues = array();
                 foreach ($this->includeColumns[$_table] as $col) {
                     $additionalValues[$col] = $value[$col];
                 }
                 $indexData['values'] = $insert->escape(serialize($additionalValues));
                 $indexData['unchangedtext'] = $insert->escape((string) $value[$_column]);
                 $indexData['plaintext'] = $insert->escape($plaintext = $this->getPlaintext($value[$_column]));
                 foreach (preg_split($this->encodeRegex('~[[:punct:][:space:]]+~ism'), $plaintext) as $keyword) {
                     if ($this->significantCharacterCount <= mb_strlen($keyword, 'UTF-8')) {
                         $keywords[] = array('search' => $keyword, 'clang' => is_null($indexData['clang']) ? false : $indexData['clang']);
                     }
                 }
                 $indexData['teaser'] = '';
                 if ($this->tablePrefix . 'article' == $_table) {
                     $rex_article = new rex_article(intval($value['id']), intval($value['clang']));
                     $teaser = true;
                     $article_content_file = $this->generatedPath . '/articles/' . intval($value['id']) . '.' . intval($value['clang']) . '.content';
                     if (!file_exists($article_content_file)) {
                         include_once $this->includePath . "/functions/function_rex_generate.inc.php";
                         $generated = rex_generateArticleContent(intval($value['id']), intval($value['clang']));
                         if ($generated !== true) {
                             $teaser = false;
                             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))) {
                         $teaser = false;
                     }
                     $indexData['teaser'] = $teaser ? $insert->escape($this->getTeaserText($this->getPlaintext($rex_article->getArticle()))) : '';
                 }
                 $insert->setTable($this->tablePrefix . '587_searchindex');
                 $insert->setValues($indexData);
                 $insert->insert();
                 $count++;
             }
         }
         $this->storeKeywords($keywords, false);
         $this->endFrontendMode();
     } else {
         return false;
     }
     return $count;
 }
/**
 * 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
 *
 * @return TRUE bei Erfolg, FALSE wenn eine ungütlige article_id übergeben wird
 */
function rex_generateArticle($id, $refreshall = true)
{
    global $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
    foreach ($REX['CLANG'] as $clang => $clang_name) {
        $CONT = new rex_article_base();
        $CONT->setCLang($clang);
        $CONT->setEval(false);
        // Content nicht ausführen, damit in Cachedatei gespeichert werden kann
        if (!$CONT->setArticleId($id)) {
            return false;
        }
        // ----------------------- generiere generated/articles/xx.article
        $MSG = rex_generateArticleMeta($id, $clang);
        if ($MSG === false) {
            return false;
        }
        if ($refreshall) {
            // ----------------------- generiere generated/articles/xx.content
            $MSG = rex_generateArticleContent($id, $clang);
            if ($MSG === false) {
                return false;
            }
        }
        // ----- EXTENSION POINT
        $MSG = rex_register_extension_point('CLANG_ARTICLE_GENERATED', '', array('id' => $id, 'clang' => $clang, 'article' => $CONT));
        if ($MSG != '') {
            echo rex_warning($MSG);
        }
        // --------------------------------------------------- Listen generieren
        if ($CONT->getValue('startpage') == 1) {
            rex_generateLists($id);
            rex_generateLists($CONT->getValue('re_id'));
        } else {
            rex_generateLists($CONT->getValue('re_id'));
        }
    }
    // ----- EXTENSION POINT
    $MSG = rex_register_extension_point('ARTICLE_GENERATED', '', array('id' => $id));
    return true;
}
 function getArticle($curctype = -1)
 {
     // bc
     if ($this->viasql) {
         return parent::getArticle($curctype);
     }
     global $REX;
     $this->ctype = $curctype;
     if (!$this->getSlice && $this->article_id != 0) {
         // ----- start: article caching
         ob_start();
         ob_implicit_flush(0);
         $article_content_file = $REX['INCLUDE_PATH'] . '/generated/articles/' . $this->article_id . '.' . $this->clang . '.content';
         if (!file_exists($article_content_file)) {
             include_once $REX["INCLUDE_PATH"] . "/functions/function_rex_generate.inc.php";
             $generated = rex_generateArticleContent($this->article_id, $this->clang);
             if ($generated !== true) {
                 // fehlermeldung ausgeben
                 echo $generated;
             }
         }
         if (file_exists($article_content_file)) {
             eval(rex_get_file_contents($article_content_file));
         }
         // ----- end: article caching
         $CONTENT = ob_get_contents();
         ob_end_clean();
     } else {
         // Inhalt ueber sql generierens
         $CONTENT = parent::getArticle($curctype);
     }
     return $CONTENT;
 }
    function getArticle($curctype = -1)
    {
        global $REX, $I18N;
        if ($this->content != "") {
            echo $this->content;
            return;
        }
        $this->ctype = $curctype;
        $module_id = rex_request('module_id', 'int');
        $sliceLimit = '';
        if ($this->getSlice) {
            $sliceLimit = " AND " . $REX['TABLE_PREFIX'] . "article_slice.id = '" . $this->getSlice . "' ";
        }
        // ----- start: article caching
        ob_start();
        ob_implicit_flush(0);
        if (!$this->viasql && !$this->getSlice) {
            if ($this->article_id != 0) {
                $article_content_file = $REX['INCLUDE_PATH'] . '/generated/articles/' . $this->article_id . '.' . $this->clang . '.content';
                if (!file_exists($article_content_file)) {
                    include_once $REX["INCLUDE_PATH"] . "/functions/function_rex_generate.inc.php";
                    $generated = rex_generateArticleContent($this->article_id, $this->clang);
                    if ($generated !== true) {
                        // fehlermeldung ausgeben
                        echo $generated;
                    }
                }
                if (file_exists($article_content_file)) {
                    eval(rex_get_file_contents($article_content_file));
                }
            }
        } else {
            if ($this->article_id != 0) {
                // ---------- alle teile/slices eines artikels auswaehlen
                $sql = "SELECT " . $REX['TABLE_PREFIX'] . "module.id, " . $REX['TABLE_PREFIX'] . "module.name, " . $REX['TABLE_PREFIX'] . "module.ausgabe, " . $REX['TABLE_PREFIX'] . "module.eingabe, " . $REX['TABLE_PREFIX'] . "article_slice.*, " . $REX['TABLE_PREFIX'] . "article.re_id\r\n          FROM\r\n            " . $REX['TABLE_PREFIX'] . "article_slice\r\n          LEFT JOIN " . $REX['TABLE_PREFIX'] . "module ON " . $REX['TABLE_PREFIX'] . "article_slice.modultyp_id=" . $REX['TABLE_PREFIX'] . "module.id\r\n          LEFT JOIN " . $REX['TABLE_PREFIX'] . "article ON " . $REX['TABLE_PREFIX'] . "article_slice.article_id=" . $REX['TABLE_PREFIX'] . "article.id\r\n          WHERE\r\n            " . $REX['TABLE_PREFIX'] . "article_slice.article_id='" . $this->article_id . "' AND\r\n            " . $REX['TABLE_PREFIX'] . "article_slice.clang='" . $this->clang . "' AND\r\n            " . $REX['TABLE_PREFIX'] . "article.clang='" . $this->clang . "' AND \r\n            " . $REX['TABLE_PREFIX'] . "article_slice.revision='" . $this->slice_revision . "'\r\n            " . $sliceLimit . "\r\n            ORDER BY " . $REX['TABLE_PREFIX'] . "article_slice.re_article_slice_id";
                $this->CONT = new rex_sql();
                if ($this->debug) {
                    $this->CONT->debugsql = 1;
                }
                $this->CONT->setQuery($sql);
                $RE_CONTS = array();
                $RE_CONTS_CTYPE = array();
                $RE_MODUL_OUT = array();
                $RE_MODUL_IN = array();
                $RE_MODUL_ID = array();
                $RE_MODUL_NAME = array();
                $RE_C = array();
                // ---------- SLICE IDS/MODUL SETZEN - speichern der daten
                for ($i = 0; $i < $this->CONT->getRows(); $i++) {
                    $RE_SLICE_ID = $this->CONT->getValue('re_article_slice_id');
                    $RE_CONTS[$RE_SLICE_ID] = $this->CONT->getValue($REX['TABLE_PREFIX'] . 'article_slice.id');
                    $RE_CONTS_CTYPE[$RE_SLICE_ID] = $this->CONT->getValue($REX['TABLE_PREFIX'] . 'article_slice.ctype');
                    $RE_MODUL_IN[$RE_SLICE_ID] = $this->CONT->getValue($REX['TABLE_PREFIX'] . 'module.eingabe');
                    $RE_MODUL_OUT[$RE_SLICE_ID] = $this->CONT->getValue($REX['TABLE_PREFIX'] . 'module.ausgabe');
                    $RE_MODUL_ID[$RE_SLICE_ID] = $this->CONT->getValue($REX['TABLE_PREFIX'] . 'module.id');
                    $RE_MODUL_NAME[$RE_SLICE_ID] = $this->CONT->getValue($REX['TABLE_PREFIX'] . 'module.name');
                    $RE_C[$RE_SLICE_ID] = $i;
                    $this->CONT->next();
                }
                // ---------- moduleselect: nur module nehmen auf die der user rechte hat
                if ($this->mode == 'edit') {
                    $MODULE = new rex_sql();
                    $modules = $MODULE->getArray('select * from ' . $REX['TABLE_PREFIX'] . 'module order by name');
                    $template_ctypes = rex_getAttributes('ctype', $this->template_attributes, array());
                    // wenn keine ctyes definiert sind, gibt es immer den CTYPE=1
                    if (count($template_ctypes) == 0) {
                        $template_ctypes = array(1 => 'default');
                    }
                    $MODULESELECT = array();
                    foreach ($template_ctypes as $ct_id => $ct_name) {
                        $MODULESELECT[$ct_id] = new rex_select();
                        $MODULESELECT[$ct_id]->setName('module_id');
                        $MODULESELECT[$ct_id]->setSize('1');
                        $MODULESELECT[$ct_id]->setStyle('class="rex-form-select"');
                        $MODULESELECT[$ct_id]->setAttribute('onchange', 'this.form.submit();');
                        $MODULESELECT[$ct_id]->addOption('----------------------------  ' . $I18N->msg('add_block'), '');
                        foreach ($modules as $m) {
                            if ($REX['USER']->isAdmin() || $REX['USER']->hasPerm('module[' . $m['id'] . ']')) {
                                if (rex_template::hasModule($this->template_attributes, $ct_id, $m['id'])) {
                                    $MODULESELECT[$ct_id]->addOption(rex_translate($m['name'], NULL, FALSE), $m['id']);
                                }
                            }
                        }
                    }
                }
                // ---------- SLICE IDS SORTIEREN UND AUSGEBEN
                $I_ID = 0;
                $PRE_ID = 0;
                $LCTSL_ID = 0;
                $this->CONT->reset();
                $this->content = "";
                for ($i = 0; $i < $this->CONT->getRows(); $i++) {
                    // ----- ctype unterscheidung
                    if ($this->mode != "edit" && $i == 0) {
                        $this->content = "<?php if (\$this->ctype == '" . $RE_CONTS_CTYPE[$I_ID] . "' || (\$this->ctype == '-1')) { ?>";
                    }
                    // ------------- EINZELNER SLICE - AUSGABE
                    $this->CONT->counter = $RE_C[$I_ID];
                    $slice_content = "";
                    $SLICE_SHOW = TRUE;
                    if ($this->mode == "edit") {
                        $form_url = 'index.php';
                        $this->ViewSliceId = $RE_CONTS[$I_ID];
                        // ----- add select box einbauen
                        if ($this->function == "add" && $this->slice_id == $I_ID) {
                            $slice_content = $this->addSlice($I_ID, $module_id);
                        } else {
                            // ----- BLOCKAUSWAHL - SELECT
                            $MODULESELECT[$this->ctype]->setId("module_id" . $I_ID);
                            $slice_content = '
              <div class="rex-form rex-form-content-editmode">
              <form action="' . $form_url . '" method="get" id="slice' . $RE_CONTS[$I_ID] . '">
                <fieldset class="rex-form-col-1">
                  <legend><span>' . $I18N->msg("add_block") . '</span></legend>
                  <input type="hidden" name="article_id" value="' . $this->article_id . '" />
                  <input type="hidden" name="page" value="content" />
                  <input type="hidden" name="mode" value="' . $this->mode . '" />
                  <input type="hidden" name="slice_id" value="' . $I_ID . '" />
                  <input type="hidden" name="function" value="add" />
                  <input type="hidden" name="clang" value="' . $this->clang . '" />
                  <input type="hidden" name="ctype" value="' . $this->ctype . '" />
                  
                  <div class="rex-form-wrapper">
                    <div class="rex-form-row">
                      <p class="rex-form-col-a rex-form-select">
                        ' . $MODULESELECT[$this->ctype]->get() . '
                        <noscript><input class="rex-form-submit" type="submit" name="btn_add" value="' . $I18N->msg("add_block") . '" /></noscript>
                      </p>
                    </div>
                  </div>
                </fieldset>
              </form>
              </div>';
                        }
                        // ----- EDIT/DELETE BLOCK - Wenn Rechte vorhanden
                        if ($REX['USER']->isAdmin() || $REX['USER']->hasPerm("module[" . $RE_MODUL_ID[$I_ID] . "]")) {
                            $msg = '';
                            if ($this->slice_id == $RE_CONTS[$I_ID]) {
                                if ($this->warning != '') {
                                    $msg .= rex_warning($this->warning);
                                }
                                if ($this->info != '') {
                                    $msg .= rex_info($this->info);
                                }
                            }
                            $sliceUrl = 'index.php?page=content&amp;article_id=' . $this->article_id . '&amp;mode=edit&amp;slice_id=' . $RE_CONTS[$I_ID] . '&amp;clang=' . $this->clang . '&amp;ctype=' . $this->ctype . '%s#slice' . $RE_CONTS[$I_ID];
                            $listElements = array();
                            $listElements[] = '<a href="' . sprintf($sliceUrl, '&amp;function=edit') . '" class="rex-tx3">' . $I18N->msg('edit') . ' <span>' . $RE_MODUL_NAME[$I_ID] . '</span></a>';
                            $listElements[] = '<a href="' . sprintf($sliceUrl, '&amp;function=delete&amp;save=1') . '" class="rex-tx2" onclick="return confirm(\'' . $I18N->msg('delete') . ' ?\')">' . $I18N->msg('delete') . ' <span>' . $RE_MODUL_NAME[$I_ID] . '</span></a>';
                            if ($REX['USER']->hasPerm('moveSlice[]')) {
                                $moveUp = $I18N->msg('move_slice_up');
                                $moveDown = $I18N->msg('move_slice_down');
                                // upd stamp übergeben, da sonst ein block nicht mehrfach hintereindander verschoben werden kann
                                // (Links wären sonst gleich und der Browser lässt das klicken auf den gleichen Link nicht zu)
                                $listElements[] = '<a href="' . sprintf($sliceUrl, '&amp;upd=' . time() . '&amp;function=moveup') . '" title="' . $moveUp . '" class="rex-slice-move-up"><span>' . $RE_MODUL_NAME[$I_ID] . '</span></a>';
                                $listElements[] = '<a href="' . sprintf($sliceUrl, '&amp;upd=' . time() . '&amp;function=movedown') . '" title="' . $moveDown . '" class="rex-slice-move-down"><span>' . $RE_MODUL_NAME[$I_ID] . '</span></a>';
                            }
                            // ----- EXTENSION POINT
                            $listElements = rex_register_extension_point('ART_SLICE_MENU', $listElements, array('article_id' => $this->article_id, 'clang' => $this->clang, 'ctype' => $RE_CONTS_CTYPE[$I_ID], 'module_id' => $RE_MODUL_ID[$I_ID], 'slice_id' => $RE_CONTS[$I_ID]));
                            $mne = $msg;
                            if ($this->function == "edit" && $this->slice_id == $RE_CONTS[$I_ID]) {
                                $mne .= '<div class="rex-content-editmode-module-name rex-form-content-editmode-edit-slice">';
                            } else {
                                $mne .= '<div class="rex-content-editmode-module-name">';
                            }
                            $mne .= '
                <h3 class="rex-hl4">' . htmlspecialchars($RE_MODUL_NAME[$I_ID]) . '</h3>
                <div class="rex-navi-slice">
                  <ul>
              ';
                            $listElementFlag = true;
                            foreach ($listElements as $listElement) {
                                $class = '';
                                if ($listElementFlag) {
                                    $class = ' class="rex-navi-first"';
                                    $listElementFlag = false;
                                }
                                $mne .= '<li' . $class . '>' . $listElement . '</li>';
                            }
                            $mne .= '</ul></div></div>';
                            $slice_content .= $mne;
                            if ($this->function == "edit" && $this->slice_id == $RE_CONTS[$I_ID]) {
                                // **************** Aktueller Slice
                                // ----- PRE VIEW ACTION [EDIT]
                                $REX_ACTION = array();
                                // nach klick auf den übernehmen button,
                                // die POST werte übernehmen
                                if (rex_var::isEditEvent()) {
                                    foreach ($REX['VARIABLES'] as $obj) {
                                        $REX_ACTION = $obj->getACRequestValues($REX_ACTION);
                                    }
                                } else {
                                    foreach ($REX['VARIABLES'] as $obj) {
                                        $REX_ACTION = $obj->getACDatabaseValues($REX_ACTION, $this->CONT);
                                    }
                                }
                                if ($this->function == 'edit') {
                                    $modebit = '2';
                                } elseif ($this->function == 'delete') {
                                    $modebit = '4';
                                } else {
                                    $modebit = '1';
                                }
                                // pre-action and add
                                $ga = new rex_sql();
                                if ($this->debug) {
                                    $ga->debugsql = 1;
                                }
                                $ga->setQuery('SELECT preview FROM ' . $REX['TABLE_PREFIX'] . 'module_action ma,' . $REX['TABLE_PREFIX'] . 'action a WHERE preview != "" AND ma.action_id=a.id AND module_id=' . $RE_MODUL_ID[$I_ID] . ' AND ((a.previewmode & ' . $modebit . ') = ' . $modebit . ')');
                                for ($t = 0; $t < $ga->getRows(); $t++) {
                                    $iaction = $ga->getValue('preview');
                                    // ****************** VARIABLEN ERSETZEN
                                    foreach ($REX['VARIABLES'] as $obj) {
                                        $iaction = $obj->getACOutput($REX_ACTION, $iaction);
                                    }
                                    eval('?>' . $iaction);
                                    // ****************** SPEICHERN FALLS NOETIG
                                    foreach ($REX['VARIABLES'] as $obj) {
                                        $obj->setACValues($this->CONT, $REX_ACTION);
                                    }
                                    $ga->next();
                                }
                                // ----- / PRE VIEW ACTION
                                $slice_content .= $this->editSlice($RE_CONTS[$I_ID], $RE_MODUL_IN[$I_ID], $RE_CONTS_CTYPE[$I_ID], $RE_MODUL_ID[$I_ID]);
                            } else {
                                // Modulinhalt ausgeben
                                $slice_content .= '
                <!-- *** OUTPUT OF MODULE-OUTPUT - START *** -->
                <div class="rex-content-editmode-slice-output">
                <div class="rex-content-editmode-slice-output-2">
                  ' . $RE_MODUL_OUT[$I_ID] . '
                </div>
                </div>
                <!-- *** OUTPUT OF MODULE-OUTPUT - END *** -->
                ';
                                $slice_content = $this->replaceVars($this->CONT, $slice_content);
                            }
                        } else {
                            // ----- hat keine rechte an diesem modul
                            $mne = '
           <div class="rex-content-editmode-module-name">
                <h3 class="rex-hl4" id="slice' . $RE_CONTS[$I_ID] . '">' . $RE_MODUL_NAME[$I_ID] . '</h3>
                <div class="rex-navi-slice">
                  <ul>
                    <li>' . $I18N->msg('no_editing_rights') . ' <span>' . $RE_MODUL_NAME[$I_ID] . '</span></li>
                  </ul>
                </div>
          </div>';
                            $slice_content .= $mne . $RE_MODUL_OUT[$I_ID];
                            $slice_content = $this->replaceVars($this->CONT, $slice_content);
                        }
                    } else {
                        // ----- wenn mode nicht edit
                        if ($this->getSlice) {
                            while (list($k, $v) = each($RE_CONTS)) {
                                $I_ID = $k;
                            }
                        }
                        $slice_content .= $RE_MODUL_OUT[$I_ID];
                        $slice_content = $this->replaceVars($this->CONT, $slice_content);
                    }
                    // --------------- ENDE EINZELNER SLICE
                    // --------------- EP: SLICE_SHOW
                    $slice_content = rex_register_extension_point('SLICE_SHOW', $slice_content, array('article_id' => $this->article_id, 'clang' => $this->clang, 'ctype' => $RE_CONTS_CTYPE[$I_ID], 'module_id' => $RE_MODUL_ID[$I_ID], 'slice_id' => $RE_CONTS[$I_ID], 'function' => $this->function, 'function_slice_id' => $this->slice_id));
                    // ---------- slice in ausgabe speichern wenn ctype richtig
                    if ($this->ctype == -1 or $this->ctype == $RE_CONTS_CTYPE[$I_ID]) {
                        $this->content .= $slice_content;
                        // last content type slice id
                        $LCTSL_ID = $RE_CONTS[$I_ID];
                    }
                    // ----- zwischenstand: ctype .. wenn ctype neu dann if
                    if ($this->mode != "edit" && isset($RE_CONTS_CTYPE[$RE_CONTS[$I_ID]]) && $RE_CONTS_CTYPE[$I_ID] != $RE_CONTS_CTYPE[$RE_CONTS[$I_ID]] && $RE_CONTS_CTYPE[$RE_CONTS[$I_ID]] != "") {
                        $this->content .= "<?php } if(\$this->ctype == '" . $RE_CONTS_CTYPE[$RE_CONTS[$I_ID]] . "' || \$this->ctype == '-1'){ ?>";
                    }
                    // zum nachsten slice
                    $I_ID = $RE_CONTS[$I_ID];
                    $PRE_ID = $I_ID;
                }
                // ----- end: ctype unterscheidung
                if ($this->mode != "edit" && $i > 0) {
                    $this->content .= "<?php } ?>";
                }
                // ----- add module im edit mode
                if ($this->mode == "edit") {
                    $form_url = 'index.php';
                    if ($this->function == "add" && $this->slice_id == $LCTSL_ID) {
                        $slice_content = $this->addSlice($LCTSL_ID, $module_id);
                    } else {
                        // ----- BLOCKAUSWAHL - SELECT
                        $MODULESELECT[$this->ctype]->setId("module_id" . $LCTSL_ID);
                        // $slice_content = $add_select_box;
                        $slice_content = '
            <div class="rex-form rex-form-content-editmode">
            <form action="' . $form_url . '" method="get">
              <fieldset class="rex-form-col-1">
                <legend><span>' . $I18N->msg("add_block") . '</span></legend>
                <input type="hidden" name="article_id" value="' . $this->article_id . '" />
                <input type="hidden" name="page" value="content" />
                <input type="hidden" name="mode" value="' . $this->mode . '" />
                <input type="hidden" name="slice_id" value="' . $LCTSL_ID . '" />
                <input type="hidden" name="function" value="add" />
                <input type="hidden" name="clang" value="' . $this->clang . '" />
                <input type="hidden" name="ctype" value="' . $this->ctype . '" />

                  
                  <div class="rex-form-wrapper">
                    <div class="rex-form-row">
                      <p class="rex-form-col-a rex-form-select">
                        ' . $MODULESELECT[$this->ctype]->get() . '
                        <noscript><input class="rex-form-submit" type="submit" name="btn_add" value="' . $I18N->msg("add_block") . '" /></noscript>
                      </p>
                    </div>
                  </div>
              </fieldset>
            </form>
            </div>';
                    }
                    $this->content .= $slice_content;
                }
                // -------------------------- schreibe content
                if ($this->eval === FALSE) {
                    echo $this->replaceLinks($this->content);
                } else {
                    eval("?>" . $this->content);
                }
            } else {
                echo $I18N->msg('no_article_available');
            }
        }
        // ----- end: article caching
        $CONTENT = ob_get_contents();
        ob_end_clean();
        return $CONTENT;
    }
 function getArticle($curctype = -1)
 {
     global $REX;
     $this->ctype = $curctype;
     // bc
     if ($this->viasql) {
         $CONTENT = parent::getArticle($curctype);
     } elseif (!$this->getSlice && $this->article_id != 0) {
         // ----- start: article caching
         ob_start();
         ob_implicit_flush(0);
         $article_content_file = $REX['GENERATED_PATH'] . '/articles/' . $this->article_id . '.' . $this->clang . '.content';
         if (!file_exists($article_content_file)) {
             include_once $REX['INCLUDE_PATH'] . '/functions/function_rex_generate.inc.php';
             $generated = rex_generateArticleContent($this->article_id, $this->clang);
             if ($generated !== true) {
                 // fehlermeldung ausgeben
                 echo $generated;
             }
         }
         if (file_exists($article_content_file)) {
             eval(rex_get_file_contents($article_content_file));
         }
         // ----- end: article caching
         $CONTENT = ob_get_contents();
         ob_end_clean();
     } else {
         // Inhalt ueber sql generierens
         $CONTENT = parent::getArticle($curctype);
     }
     $CONTENT = rex_register_extension_point('ART_CONTENT', $CONTENT, array('ctype' => $curctype, 'article' => &$this));
     return $CONTENT;
 }