reset() 공개 메소드

Setzt den Cursor des Resultsets zurueck zum Anfang.
public reset ( )
 public static function init()
 {
     global $REX;
     self::$curClang = $REX['CUR_CLANG'];
     $sql = new rex_sql();
     $sql->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'string_table');
     foreach ($REX['CLANG'] as $clangId => $clangName) {
         for ($i = 0; $i < $sql->getRows(); $i++) {
             $key = $sql->getValue('keyname');
             $value = nl2br($sql->getValue('value_' . $clangId));
             self::$stringTable[$clangId][$key] = $value;
             self::$stringTableKeys[$clangId][] = $REX['ADDON']['string_table']['settings']['key_start_token'] . $key . $REX['ADDON']['string_table']['settings']['key_end_token'];
             self::$stringTableValues[$clangId][] = $value;
             $sql->next();
         }
         $sql->reset();
     }
 }
예제 #2
0
파일: handler.php 프로젝트: DECAF/redaxo
 /**
  * Erstellt den nötigen HTML Code um ein Formular zu erweitern.
  *
  * @param rex_sql $sqlFields rex_sql-objekt, dass die zu verarbeitenden Felder enthält
  * @param array   $epParams  Array of all EP parameters
  *
  * @return string
  */
 public function renderMetaFields(rex_sql $sqlFields, array $epParams)
 {
     $s = '';
     // Startwert für MEDIABUTTON, MEDIALIST, LINKLIST zähler
     $media_id = 1;
     $mlist_id = 1;
     $link_id = 1;
     $llist_id = 1;
     $activeItem = isset($epParams['activeItem']) ? $epParams['activeItem'] : null;
     $sqlFields->reset();
     for ($i = 0; $i < $sqlFields->getRows(); $i++, $sqlFields->next()) {
         // Umschliessendes Tag von Label und Formularelement
         $tag = 'p';
         $tag_attr = '';
         $name = $sqlFields->getValue('name');
         $title = $sqlFields->getValue('title');
         $params = $sqlFields->getValue('params');
         $typeLabel = $sqlFields->getValue('label');
         $attr = $sqlFields->getValue('attributes');
         $dblength = $sqlFields->getValue('dblength');
         $attrArray = rex_string::split($attr);
         if (isset($attrArray['perm'])) {
             if (!rex::getUser()->hasPerm($attrArray['perm'])) {
                 continue;
             }
             unset($attrArray['perm']);
         }
         $defaultValue = $sqlFields->getValue('default');
         if ($activeItem) {
             $itemValue = $activeItem->getValue($name);
             if (strpos($itemValue, '|+|') !== false) {
                 // Alte notation mit |+| als Trenner
                 $dbvalues = explode('|+|', $activeItem->getValue($name));
             } else {
                 // Neue Notation mit | als Trenner
                 $dbvalues = explode('|', $activeItem->getValue($name));
             }
         } else {
             $dbvalues = (array) $sqlFields->getValue('default');
         }
         if ($title != '') {
             $label = rex_i18n::translate($title);
         } else {
             $label = htmlspecialchars($name);
         }
         $id = preg_replace('/[^a-zA-Z\\-0-9_]/', '_', $label);
         $labelIt = true;
         $label = '<label for="' . $id . '">' . $label . '</label>';
         $field = '';
         switch ($typeLabel) {
             case 'text':
                 $tag_attr = ' class="form-control"';
                 $rexInput = rex_input::factory($typeLabel);
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setAttribute('id', $id);
                 $rexInput->setAttribute('name', $name);
                 if ($dblength > 0) {
                     $rexInput->setAttribute('maxlength', $dblength);
                 }
                 if ($activeItem) {
                     $rexInput->setValue($activeItem->getValue($name));
                 } else {
                     $rexInput->setValue($defaultValue);
                 }
                 $field = $rexInput->getHtml();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 break;
             case 'checkbox':
                 // Beachte auch default values in multiple fields bei ADD.
                 // Im EDIT wurde dies bereits vorher gehandelt
                 if (!$activeItem) {
                     $defaultValue = explode('|', $defaultValue);
                 }
                 $name .= '[]';
             case 'radio':
                 $formElements = [];
                 $values = [];
                 if (rex_sql::getQueryType($params) == 'SELECT') {
                     $sql = rex_sql::factory();
                     $value_groups = $sql->getDBArray($params, [], PDO::FETCH_NUM);
                     foreach ($value_groups as $value_group) {
                         if (isset($value_group[1])) {
                             $values[$value_group[1]] = $value_group[0];
                         } else {
                             $values[$value_group[0]] = $value_group[0];
                         }
                     }
                 } else {
                     $value_groups = explode('|', $params);
                     foreach ($value_groups as $value_group) {
                         // check ob key:value paar
                         // und der wert beginnt nicht mit "translate:"
                         if (strpos($value_group, ':') !== false && strpos($value_group, 'translate:') !== 0) {
                             $temp = explode(':', $value_group, 2);
                             $values[$temp[0]] = rex_i18n::translate($temp[1]);
                         } else {
                             $values[$value_group] = rex_i18n::translate($value_group);
                         }
                     }
                 }
                 $oneValue = count($values) == 1;
                 $attrStr = '';
                 $classAdd = '';
                 $inline = false;
                 if (false !== ($key = array_search('inline', $attrArray))) {
                     $inline = true;
                     unset($attrArray[$key]);
                 }
                 foreach ($attrArray as $key => $value) {
                     if ($key == 'class') {
                         $classAdd = ' ' . $value;
                     } else {
                         $attrStr = ' ' . $key . '="' . $value . '"';
                     }
                 }
                 if (!$activeItem) {
                     $dbvalues = (array) $defaultValue;
                 }
                 foreach ($values as $key => $value) {
                     $id = preg_replace('/[^a-zA-Z\\-0-9_]/', '_', $id . $key);
                     // wenn man keine Werte angibt (Boolean Chkbox/Radio)
                     // Dummy Wert annehmen, damit an/aus unterscheidung funktioniert
                     if ($oneValue && $key == '') {
                         $key = 'true';
                     }
                     $selected = '';
                     if (in_array($key, $dbvalues)) {
                         $selected = ' checked="checked"';
                     }
                     $e = [];
                     if ($oneValue) {
                         $e['label'] = $label;
                     } else {
                         $e['label'] = '<label for="' . $id . '">' . htmlspecialchars($value) . '</label>';
                     }
                     $e['field'] = '<input type="' . $typeLabel . '" name="' . $name . '" value="' . htmlspecialchars($key) . '" id="' . $id . '" ' . $attrStr . $selected . ' />';
                     $formElements[] = $e;
                 }
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', $formElements, false);
                 $fragment->setVar('inline', $inline);
                 if ($typeLabel == 'radio') {
                     $field = $fragment->parse('core/form/radio.php');
                 } else {
                     if (!$oneValue) {
                         $fragment->setVar('grouped', true);
                     }
                     $field = $fragment->parse('core/form/checkbox.php');
                 }
                 if (!$oneValue) {
                     $e = [];
                     $e['label'] = $label;
                     $e['field'] = $field;
                     $fragment = new rex_fragment();
                     $fragment->setVar('elements', [$e], false);
                     $field = $fragment->parse('core/form/form.php');
                 }
                 break;
             case 'select':
                 $tag_attr = ' class="form-control"';
                 $select = new rex_select();
                 $select->setStyle('class="form-control"');
                 $select->setName($name);
                 $select->setId($id);
                 $multiple = false;
                 foreach ($attrArray as $attr_name => $attr_value) {
                     if (empty($attr_name)) {
                         continue;
                     }
                     $select->setAttribute($attr_name, $attr_value);
                     if ($attr_name == 'multiple') {
                         $multiple = true;
                         $select->setName($name . '[]');
                         $select->setMultiple();
                     }
                 }
                 // Beachte auch default values in multiple fields bei ADD.
                 // Im EDIT wurde dies bereits vorher gehandelt
                 if ($multiple && !$activeItem) {
                     $dbvalues = explode('|', $defaultValue);
                 }
                 // hier mit den "raw"-values arbeiten, da die rex_select klasse selbst escaped
                 $select->setSelected($dbvalues);
                 if (rex_sql::getQueryType($params) == 'SELECT') {
                     // Werte via SQL Laden
                     $select->addDBSqlOptions($params);
                 } else {
                     // Optionen mit | separiert
                     // eine einzelne Option kann mit key:value separiert werden
                     $values = [];
                     $value_groups = explode('|', $params);
                     foreach ($value_groups as $value_group) {
                         // check ob key:value paar
                         // und der wert beginnt nicht mit "translate:"
                         if (strpos($value_group, ':') !== false && strpos($value_group, 'translate:') !== 0) {
                             $temp = explode(':', $value_group, 2);
                             $values[$temp[0]] = rex_i18n::translate($temp[1]);
                         } else {
                             $values[$value_group] = rex_i18n::translate($value_group);
                         }
                     }
                     $select->addOptions($values);
                 }
                 $field .= $select->get();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 break;
             case 'date':
             case 'time':
             case 'datetime':
                 $tag_attr = ' class="form-control-date"';
                 $active = $dbvalues[0] != 0;
                 if ($dbvalues[0] == '') {
                     $dbvalues[0] = time();
                 }
                 $inputValue = [];
                 $inputValue['year'] = date('Y', $dbvalues[0]);
                 $inputValue['month'] = date('n', $dbvalues[0]);
                 $inputValue['day'] = date('j', $dbvalues[0]);
                 $inputValue['hour'] = date('G', $dbvalues[0]);
                 $inputValue['minute'] = date('i', $dbvalues[0]);
                 $rexInput = rex_input::factory($typeLabel);
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setAttribute('id', $id);
                 $rexInput->setAttribute('name', $name);
                 $rexInput->setValue($inputValue);
                 $field = $rexInput->getHtml();
                 $checked = $active ? ' checked="checked"' : '';
                 $field .= '<input class="rex-metainfo-checkbox" type="checkbox" name="' . $name . '[active]" value="1"' . $checked . ' />';
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 break;
             case 'textarea':
                 $tag_attr = ' class="form-control"';
                 $rexInput = rex_input::factory($typeLabel);
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setAttribute('id', $id);
                 $rexInput->setAttribute('name', $name);
                 if ($activeItem) {
                     $rexInput->setValue($activeItem->getValue($name));
                 } else {
                     $rexInput->setValue($defaultValue);
                 }
                 $field = $rexInput->getHtml();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 break;
             case 'legend':
                 $tag = '';
                 $tag_attr = '';
                 $labelIt = false;
                 // tabindex entfernen, macht bei einer legend wenig sinn
                 $attr = preg_replace('@tabindex="[^"]*"@', '', $attr);
                 $field = '</fieldset><fieldset><legend id="' . $id . '"' . $attr . '>' . $label . '</legend>';
                 break;
             case 'REX_MEDIA_WIDGET':
                 $tag = 'div';
                 $tag_attr = ' class="rex-form-widget"';
                 $paramArray = rex_string::split($params);
                 $rexInput = rex_input::factory('mediabutton');
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setButtonId($media_id);
                 $rexInput->setAttribute('name', $name);
                 $rexInput->setValue($dbvalues[0]);
                 if (isset($paramArray['category'])) {
                     $rexInput->setCategoryId($paramArray['category']);
                 }
                 if (isset($paramArray['types'])) {
                     $rexInput->setTypes($paramArray['types']);
                 }
                 if (isset($paramArray['preview'])) {
                     $rexInput->setPreview($paramArray['preview']);
                 }
                 $id = $rexInput->getAttribute('id');
                 $field = $rexInput->getHtml();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 ++$media_id;
                 break;
             case 'REX_MEDIALIST_WIDGET':
                 $tag = 'div';
                 $tag_attr = ' class="rex-form-widget"';
                 $paramArray = rex_string::split($params);
                 $name .= '[]';
                 $rexInput = rex_input::factory('medialistbutton');
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setButtonId($mlist_id);
                 $rexInput->setAttribute('name', $name);
                 $rexInput->setValue($dbvalues[0]);
                 if (isset($paramArray['category'])) {
                     $rexInput->setCategoryId($paramArray['category']);
                 }
                 if (isset($paramArray['types'])) {
                     $rexInput->setTypes($paramArray['types']);
                 }
                 if (isset($paramArray['preview'])) {
                     $rexInput->setPreview($paramArray['preview']);
                 }
                 $id = $rexInput->getAttribute('id');
                 $field = $rexInput->getHtml();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 ++$mlist_id;
                 break;
             case 'REX_LINK_WIDGET':
                 $tag = 'div';
                 $tag_attr = ' class="rex-form-widget"';
                 $paramArray = rex_string::split($params);
                 $category = '';
                 if (isset($paramArray['category'])) {
                     $category = $paramArray['category'];
                 } elseif ($activeItem) {
                     $category = $activeItem->getValue('category_id');
                 }
                 $rexInput = rex_input::factory('linkbutton');
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setButtonId($link_id);
                 $rexInput->setCategoryId($category);
                 $rexInput->setAttribute('name', $name);
                 $rexInput->setValue($dbvalues[0]);
                 $id = $rexInput->getAttribute('id');
                 $field = $rexInput->getHtml();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 ++$link_id;
                 break;
             case 'REX_LINKLIST_WIDGET':
                 $tag = 'div';
                 $tag_attr = ' class="rex-form-widget"';
                 $paramArray = rex_string::split($params);
                 $category = '';
                 if (isset($paramArray['category'])) {
                     $category = $paramArray['category'];
                 } elseif ($activeItem) {
                     $category = $activeItem->getValue('category_id');
                 }
                 $name .= '[]';
                 $rexInput = rex_input::factory('linklistbutton');
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setButtonId($llist_id);
                 $rexInput->setCategoryId($category);
                 $rexInput->setAttribute('name', $name);
                 $rexInput->setValue(implode(',', $dbvalues));
                 $id = $rexInput->getAttribute('id');
                 $field = $rexInput->getHtml();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 ++$llist_id;
                 break;
             default:
                 // ----- EXTENSION POINT
                 list($field, $tag, $tag_attr, $id, $label, $labelIt) = rex_extension::registerPoint(new rex_extension_point('METAINFO_CUSTOM_FIELD', [$field, $tag, $tag_attr, $id, $label, $labelIt, 'values' => $dbvalues, 'rawvalues' => $dbvalues, 'type' => $typeLabel, 'sql' => $sqlFields]));
         }
         $s .= $this->renderFormItem($field, $tag, $tag_attr, $id, $label, $labelIt, $typeLabel);
     }
     return $s;
 }
예제 #3
0
         }
     }
 }
 // categories
 foreach ($cat_ids as $cat_id) {
     if ($sql->hasPerm('csw[' . $cat_id . ']')) {
         $sel_cat->setSelected($cat_id);
     }
 }
 // media categories
 foreach ($mediacat_ids as $cat_id) {
     if ($sql->hasPerm('media[' . $cat_id . ']')) {
         $sel_media->setSelected($cat_id);
     }
 }
 $sqlmodule->reset();
 for ($i = 0; $i < $sqlmodule->getRows(); $i++) {
     $name = 'module[' . $sqlmodule->getValue('id') . ']';
     if ($sql->hasPerm($name)) {
         $sel_module->setSelected($sqlmodule->getValue('id'));
     }
     $sqlmodule->next();
 }
 $sqlsprachen->reset();
 for ($i = 0; $i < $sqlsprachen->getRows(); $i++) {
     $name = 'clang[' . $sqlsprachen->getValue('id') . ']';
     if ($sql->hasPerm($name)) {
         $sel_sprachen->setSelected($sqlsprachen->getValue('id'));
     }
     $sqlsprachen->next();
 }
         $ArticleID = $row['id'];
         $TemplateTypID = $row['template_id'];
         $TEMPLATEHIDDEN = '';
         $TEMPLATE = '<select name="template_id">' . "\n";
         for ($i = 0; $i < $TEMPLATES->getRows(); $i++) {
             $TemplateName = $TEMPLATES->getValue("name");
             $TemplateID = $TEMPLATES->getValue("id");
             if ($TemplateTypID == $TemplateID) {
                 $TEMPLATE .= '<option value="' . $TemplateID . '" selected="selected">[' . $TemplateID . '] - ' . htmlentities($TemplateName, ENT_QUOTES) . '</option>' . "\n";
                 $TEMPLATEHIDDEN = $TemplateID;
             } else {
                 $TEMPLATE .= '<option value="' . $TemplateID . '">[' . $TemplateID . '] - ' . htmlentities($TemplateName, ENT_QUOTES) . '</option>' . "\n";
             }
             $TEMPLATES->next();
         }
         $TEMPLATES->reset();
         $TEMPLATE .= '</select>' . "\n";
         // Article-Name
         $ARTICLE_NAME = htmlentities($row['article_name'], ENT_QUOTES);
         // Article-Name-Kurzform
         $ARTICLE_NAME_KURZ = mas_kurzanzeige_106($row['article_name'], 20);
         $ARTICLE_NAME_KURZ = htmlentities($ARTICLE_NAME_KURZ, ENT_QUOTES);
         // Artikel-ID mit einem Link versehen index.php?page=content&article_id=83
         $ARTICLEID = '<a href="index.php?page=content&amp;article_id=' . $row['id'] . '" title="' . $ARTICLE_NAME . '">[' . $row['id'] . '] - ' . $ARTICLE_NAME_KURZ . '</a>';
         $t->set_var(array("ARTICLEID" => $ARTICLEID, "TEMPLATETYPID" => $TemplateTypID, "TEMPLATE" => $TEMPLATE, "SENDBUTTON" => $I18N_MAS->msg('art_and_temp_form_button_send'), "HIDDEN_ARTICLEID" => $ArticleID, "HIDDEN_TEMPLATEIDOLD" => $TEMPLATEHIDDEN));
         $t->parse("EintragsUebersicht_s", "EintragsUebersicht", true);
     }
     // foreach ($data as $row)
     // Module zur Ausgabe da, dann anzeigen
     $t->set_var(array("AUSGABEVORHANDEN_BEGINN" => '', "AUSGABEVORHANDEN_ENDE" => ''));
 } else {
 /**
  * return array with the meta name & values
  * it test if the form is posted or not and add the necessary values
  * @return array
  */
 public function getMetaValues()
 {
     global $REX;
     $returnArray = array();
     $this->sqlFields->reset();
     for ($i = 0; $i < $this->sqlFields->getRows(); $i++, $this->sqlFields->next()) {
         $fieldName = $this->sqlFields->getValue('name');
         $fieldType = $this->sqlFields->getValue('type');
         $fieldAttributes = $this->sqlFields->getValue('attributes');
         $postValue = rex_post($fieldName, 'array', null);
         // Wert aus der DB nehmen, falls keiner extern und keiner im POST angegeben
         if ($postValue === null && $this->sql->getRows() == 1 && $this->sql->hasValue($fieldName)) {
             $postValue = $this->sql->getValue($fieldName);
         }
         // dont save restricted fields
         $attrArray = rex_split_string($fieldAttributes);
         if (isset($attrArray['perm'])) {
             if (!$REX['USER']->hasPerm($attrArray['perm'])) {
                 continue;
             }
             unset($attrArray['perm']);
         }
         // handle date types with timestamps
         if (is_array($postValue) && isset($postValue['year']) && isset($postValue['month']) && isset($postValue['day']) && isset($postValue['hour']) && isset($postValue['minute'])) {
             if (isset($postValue['active'])) {
                 $saveValue = mktime((int) $postValue['hour'], (int) $postValue['minute'], 0, (int) $postValue['month'], (int) $postValue['day'], (int) $postValue['year']);
             } else {
                 $saveValue = 0;
             }
         } elseif (is_array($postValue) && isset($postValue['year']) && isset($postValue['month']) && isset($postValue['day'])) {
             if (isset($postValue['active'])) {
                 $saveValue = mktime(0, 0, 0, (int) $postValue['month'], (int) $postValue['day'], (int) $postValue['year']);
             } else {
                 $saveValue = 0;
             }
         } elseif (is_array($postValue) && isset($postValue['hour']) && isset($postValue['minute'])) {
             if (isset($postValue['active'])) {
                 $saveValue = mktime((int) $postValue['hour'], (int) $postValue['minute'], 0, 0, 0, 0);
             } else {
                 $saveValue = 0;
             }
         } else {
             if (count($postValue) > 1) {
                 // Mehrwertige Felder
                 $saveValue = '|' . implode('|', $postValue) . '|';
             } else {
                 $postValue = is_array($postValue) && isset($postValue[0]) ? $postValue[0] : $postValue;
                 if ($fieldType == REX_A62_FIELD_SELECT && strpos($fieldAttributes, 'multiple') !== false || $fieldType == REX_A62_FIELD_CHECKBOX) {
                     // Mehrwertiges Feld, aber nur ein Wert ausgewählt
                     $saveValue = '|' . $postValue[0] . '|';
                 } else {
                     // Einwertige Felder
                     $saveValue = $postValue;
                 }
             }
         }
         // Wert in SQL zum speichern
         $returnArray[$fieldName] = $saveValue;
     }
     return $returnArray;
 }
예제 #6
0
/**
* seo42_generate_pathlist()
*
* generiert die Pathlist, abhängig von Aktion
* @author markus.staab[at]redaxo[dot]de Markus Staab
* @package redaxo4.2
*/
function seo42_generate_pathlist($params)
{
    global $REX, $SEO42_IDS, $SEO42_URLS;
    // temporary community install workaround
    if (!isset($REX['ADDON']['seo42'])) {
        return;
    }
    // include pathlist file
    if (file_exists(SEO42_PATHLIST)) {
        require_once SEO42_PATHLIST;
    }
    // EXTENSION POINT "SEO42_PATHLIST_BEFORE_REBUILD"
    $subject = array('SEO42_IDS' => $SEO42_IDS, 'SEO42_URLS' => $SEO42_URLS);
    rex_register_extension_point('SEO42_PATHLIST_BEFORE_REBUILD', $subject);
    $SEO42_IDS = array();
    $SEO42_URLS = array();
    $REX['SEO42_URL_CLONE'] = array();
    $db = new rex_sql();
    // REVISION FIX
    $db->setQuery('UPDATE ' . $REX['TABLE_PREFIX'] . 'article SET revision = 0 WHERE revision IS NULL;');
    $db->setQuery('UPDATE ' . $REX['TABLE_PREFIX'] . 'article_slice SET revision = 0 WHERE revision IS NULL;');
    if ($REX['ADDON']['seo42']['settings']['ignore_root_cats']) {
        $sqlQuery = 'SELECT `id`, `clang`, `path`, `startpage`,`seo_custom_url` FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE re_id != 0 OR (re_id = 0 AND catname LIKE "") AND revision=0 OR revision IS NULL ORDER BY id';
    } else {
        $sqlQuery = 'SELECT `id`, `clang`, `path`, `startpage`,`seo_custom_url` FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE revision=0 OR revision IS NULL ORDER BY id';
    }
    $db->setQuery($sqlQuery);
    // redirects start articles withou slash: /xx to /xx/
    if (count($REX['CLANG']) > 1) {
        foreach ($REX['CLANG'] as $clangId => $clangName) {
            if ($REX['ADDON']['seo42']['settings']['url_ending'] == '') {
                $langSlug = seo42::getLangUrlSlug($clangId) . '/';
            } else {
                $langSlug = seo42::getLangUrlSlug($clangId);
            }
            if ($REX['ADDON']['seo42']['settings']['homelang'] != $clangId) {
                $SEO42_URLS[$langSlug] = array('id' => $REX['START_ARTICLE_ID'], 'clang' => $clangId, 'status' => 301);
            }
        }
    }
    while ($db->hasNext()) {
        $pathname = '';
        $id = $db->getValue('id');
        $clang = $db->getValue('clang');
        $path = $db->getValue('path');
        // LANG SLUG
        if (count($REX['CLANG']) > 1 && $clang != $REX['ADDON']['seo42']['settings']['hide_langslug']) {
            $pathname = '';
            $pathname = seo42_appendToPath($pathname, seo42::getLangUrlSlug($clang), $id, $clang);
        }
        // pfad über kategorien bauen
        $path = trim($path, '|');
        if ($path != '') {
            $path = explode('|', $path);
            foreach ($path as $p) {
                $ooc = OOCategory::getCategoryById($p, seo42_utils::getInheritedClang($clang));
                // PREVENT FATALS IN RARE CONDITIONS WHERE DB/CACHE ARE OUT OF SYNC
                if (!is_a($ooc, 'OOCategory')) {
                    continue;
                }
                // 42
                if ($REX['ADDON']['seo42']['settings']['ignore_root_cats'] && $ooc->getParentId() == 0) {
                    continue;
                }
                $name = $ooc->getName();
                unset($ooc);
                $pathname = seo42_appendToPath($pathname, $name, $id, $clang);
            }
        }
        $ooa = OOArticle::getArticleById($id, seo42_utils::getInheritedClang($clang));
        // PREVENT FATALS IN RARE CONDITIONS WHERE DB/CACHE ARE OUT OF SYNC
        if (!is_a($ooa, 'OOArticle')) {
            $db->next();
            continue;
        }
        if ($ooa->isStartArticle()) {
            $ooc = $ooa->getCategory();
            $catname = $ooc->getName();
            unset($ooc);
            $pathname = seo42_appendToPath($pathname, $catname, $id, $clang);
        }
        // url_schema: seo42
        if (!$ooa->isStartArticle()) {
            // eigentlicher artikel anhängen
            $name = $ooa->getName();
            unset($ooa);
            $pathname = seo42_appendToPath($pathname, $name, $id, $clang);
        }
        // ALLGEMEINE URL ENDUNG
        $pathname = substr($pathname, 0, strlen($pathname) - 1) . $REX['ADDON']['seo42']['settings']['url_ending'];
        // STARTSEITEN URL FORMAT
        if ($db->getValue('id') == $REX['START_ARTICLE_ID'] && $db->getValue('clang') == $REX['ADDON']['seo42']['settings']['homelang'] && ($REX['ADDON']['seo42']['settings']['homeurl'] == 1 || $REX['ADDON']['seo42']['settings']['homeurl'] == 2)) {
            $pathname = '';
        } elseif ($REX['ADDON']['seo42']['settings']['homeurl'] == 2 && $db->getValue('id') == $REX['START_ARTICLE_ID'] && count($REX['CLANG']) > 1) {
            if ($REX['ADDON']['seo42']['settings']['url_ending'] == '') {
                $langSlug = seo42::getLangUrlSlug($clang);
            } else {
                $langSlug = seo42::getLangUrlSlug($clang) . '/';
            }
            $pathname = $langSlug;
        }
        // UNSET OLD URL FROM $SEO42_URLS
        if (isset($SEO42_IDS[$id][$clang]['url']) && isset($SEO42_URLS[$SEO42_IDS[$id][$clang]['url']])) {
            unset($SEO42_URLS[$SEO42_IDS[$id][$clang]['url']]);
        }
        $SEO42_IDS[$id][$clang] = array('url' => $pathname);
        $SEO42_URLS[$pathname] = array('id' => (int) $id, 'clang' => (int) $clang);
        // get data from default lang if clone option is enabled for all other langs
        $jsonData = json_decode($db->getValue('seo_custom_url'), true);
        $articleId = $db->getValue('id');
        $clangId = $db->getValue('clang');
        if (isset($jsonData['url_clone']) && $jsonData['url_clone'] == true && $clangId == $REX['START_CLANG_ID']) {
            $REX['SEO42_URL_CLONE'][$articleId] = $jsonData;
        }
        $db->next();
    }
    // URL MANIPULATION BY SEO42
    // -----------------------------------------------------------------------------------------------------------
    $interReplaceIds = array();
    $db->reset();
    for ($i = 0; $i < $db->getRows(); $i++) {
        $urlField = $db->getValue('seo_custom_url');
        $articleId = $db->getValue('id');
        $clangId = $db->getValue('clang');
        if ($urlField != '' || isset($REX['SEO42_URL_CLONE'][$articleId])) {
            $urlData = seo42_utils::getUrlTypeData($urlField);
            $jsonData = json_decode($urlData, true);
            if (isset($REX['SEO42_URL_CLONE'][$articleId]) && !isset($jsonData['url_type'])) {
                $jsonData = $REX['SEO42_URL_CLONE'][$articleId];
            }
            switch ($jsonData['url_type']) {
                case SEO42_URL_TYPE_DEFAULT:
                    // do nothing
                    break;
                case SEO42_URL_TYPE_USERDEF_INTERN:
                    $customUrl = $jsonData['custom_url'];
                    if ($SEO42_IDS[$articleId][$clangId]['url'] != $customUrl) {
                        // only if custom url ist different then auto url
                        $SEO42_URLS[$customUrl] = $SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']];
                        unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
                    }
                    $SEO42_IDS[$articleId][$clangId] = array('url' => $customUrl);
                    break;
                case SEO42_URL_TYPE_USERDEF_EXTERN:
                    $customUrl = $jsonData['custom_url'];
                    unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
                    $SEO42_IDS[$articleId][$clangId] = array('url' => $customUrl);
                    break;
                case SEO42_URL_TYPE_MEDIAPOOL:
                    $customUrl = $REX['MEDIA_DIR'] . '/' . $jsonData['file'];
                    unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
                    $SEO42_IDS[$articleId][$clangId] = array('url' => $customUrl);
                    break;
                case SEO42_URL_TYPE_INTERN_REPLACE:
                    $customArticleId = $jsonData['article_id'];
                    $interReplaceIds[$clangId][$articleId] = array('id' => $customArticleId, 'clang' => $clangId);
                    unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
                    if (isset($SEO42_IDS[$customArticleId][$clangId]['url'])) {
                        $SEO42_IDS[$articleId][$clangId] = array('url' => $SEO42_IDS[$customArticleId][$clangId]['url']);
                    } else {
                        $SEO42_IDS[$articleId][$clangId] = array('url' => '');
                    }
                    break;
                case SEO42_URL_TYPE_INTERN_REPLACE_CLANG:
                    $customArticleId = $jsonData['article_id'];
                    $customClangId = $jsonData['clang_id'];
                    $interReplaceIds[$clangId][$articleId] = array('id' => $customArticleId, 'clang' => $customClangId);
                    unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
                    if (isset($SEO42_IDS[$customArticleId][$customClangId]['url'])) {
                        $SEO42_IDS[$articleId][$clangId] = array('url' => $SEO42_IDS[$customArticleId][$customClangId]['url']);
                    } else {
                        $SEO42_IDS[$articleId][$clangId] = array('url' => '');
                    }
                    break;
                case SEO42_URL_TYPE_REMOVE_ROOT_CAT:
                    $curUrl = $SEO42_IDS[$articleId][$clangId]['url'];
                    $newUrl = seo42_utils::removeRootCatFromUrl($curUrl, $clangId);
                    if ($newUrl != '') {
                        // same as SEO42_URL_TYPE_USERDEF_INTERN
                        $SEO42_URLS[$newUrl] = $SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']];
                        unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
                        $SEO42_IDS[$articleId][$clangId] = array('url' => $newUrl);
                    }
                    break;
                case SEO42_URL_TYPE_CALL_FUNC:
                    if ($jsonData['no_url']) {
                        unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
                    }
                    break;
                case SEO42_URL_TYPE_LANGSWITCH:
                    unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
                    break;
                case SEO42_URL_TYPE_NONE:
                    unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
                    $SEO42_IDS[$articleId][$clangId] = array('url' => '');
                    break;
            }
            unset($jsonData);
        }
        $db->next();
    }
    // workaround for #177
    foreach ($interReplaceIds as $clangId => $value) {
        foreach ($value as $interReplaceId => $targetArticle) {
            if (isset($SEO42_IDS[$targetArticle['id']][$targetArticle['clang']]['url'])) {
                $SEO42_IDS[$interReplaceId][$clangId] = array('url' => $SEO42_IDS[$targetArticle['id']][$targetArticle['clang']]['url']);
            }
        }
    }
    // -----------------------------------------------------------------------------------------------------------
    // EXTENSION POINT "SEO42_PATHLIST_CREATED"
    $subject = array('SEO42_IDS' => $SEO42_IDS, 'SEO42_URLS' => $SEO42_URLS);
    $subject = rex_register_extension_point('SEO42_PATHLIST_CREATED', $subject);
    // EXTENSION POINT "SEO42_PATHLIST_FINAL" - READ ONLY
    rex_register_extension_point('SEO42_PATHLIST_FINAL', $subject);
    // ASSEMBLE, COMPRESS & WRITE PATHLIST TO FILE
    $pathlist_content = '$SEO42_IDS = ' . var_export($subject['SEO42_IDS'], true) . ';' . PHP_EOL . '$SEO42_URLS = ' . var_export($subject['SEO42_URLS'], true) . ';';
    $pathlist_content = seo42_compressPathlist($pathlist_content);
    rex_put_file_contents(SEO42_PATHLIST, '<?php' . PHP_EOL . $pathlist_content);
    // PURGE *.CONTENT CACHEFILES TO UPDATE INTERNAL LINKS CREATED BY replceLinks() in rex_article_base
    seo42_purgeCacheFiles();
}
         $SliceID = $row['id'];
         $ModulTypID = $row['modultyp_id'];
         $MODULHIDDEN = '';
         $MODUL = '<select name="module_id">' . "\n";
         for ($i = 0; $i < $MODULE->getRows(); $i++) {
             $ModulName = $MODULE->getValue("name");
             $ModulID = $MODULE->getValue("id");
             if ($ModulTypID == $ModulID) {
                 $MODUL .= '<option value="' . $ModulID . '" selected="selected">[' . $ModulID . '] - ' . htmlentities($ModulName, ENT_QUOTES) . '</option>' . "\n";
                 $MODULHIDDEN = $ModulID;
             } else {
                 $MODUL .= '<option value="' . $ModulID . '">[' . $ModulID . '] - ' . htmlentities($ModulName, ENT_QUOTES) . '</option>' . "\n";
             }
             $MODULE->next();
         }
         $MODULE->reset();
         $MODUL .= '</select>' . "\n";
         // Article-Name
         $ARTICLE_NAME = htmlentities($row['article_name'], ENT_QUOTES);
         // Article-Name-Kurzform
         $ARTICLE_NAME_KURZ = mas_kurzanzeige_106($row['article_name'], 20);
         $ARTICLE_NAME_KURZ = htmlentities($ARTICLE_NAME_KURZ, ENT_QUOTES);
         // Artikel-ID mit einem Link versehen index.php?page=content&article_id=83
         $ARTICLEID = '<a href="index.php?page=content&amp;article_id=' . $row['article_id'] . '&amp;ctype=' . $row['ctype'] . '" title="' . $ARTICLE_NAME . ' - CTYPE: ' . $row['ctype'] . '">[' . $row['article_id'] . '] - ' . $ARTICLE_NAME_KURZ . '</a>';
         $t->set_var(array("SLICEID" => $SliceID, "ARTICLEID" => $ARTICLEID, "MODULTYPID" => $ModulTypID, "MODUL" => $MODUL, "SENDBUTTON" => $I18N_MAS->msg('form_button_send'), "HIDDEN_SLICEID" => $SliceID, "HIDDEN_MODULIDOLD" => $MODULHIDDEN));
         $t->parse("EintragsUebersicht_s", "EintragsUebersicht", true);
     }
     // foreach ($data as $row)
     // Module zur Ausgabe da, dann anzeigen
     $t->set_var(array("AUSGABEVORHANDEN_BEGINN" => '', "AUSGABEVORHANDEN_ENDE" => ''));
 } else {