/**
  * Wert für die Ausgabe
  */
 function matchTemplate($content)
 {
     $var = 'REX_TEMPLATE';
     $matches = $this->getInputParams($content, $var);
     foreach ($matches as $match) {
         list($param_str, $template_id) = $match;
         $template = new rex_template($template_id);
         $content = str_replace($var . '[' . $param_str . ']', $template->getTemplate(), $content);
     }
     return $content;
 }
 function getFilePath($template_id)
 {
     if ($template_id < 1) {
         return FALSE;
     }
     return rex_template::getTemplatesDir() . '/' . $template_id . '.template';
 }
 /**
  * Wert für die Ausgabe
  */
 function matchTemplate($content)
 {
     $var = 'REX_TEMPLATE';
     $matches = $this->getInputParams($content, $var);
     foreach ($matches as $match) {
         list($param_str, $template_id) = $match;
         // bezeichner wählen, der keine variablen
         // aus modulen/templates überschreibt
         $varname = '$__rex_tpl' . $template_id;
         $tpl = '<?php
   ' . $varname . ' = new rex_template();
   ' . $varname . '->setId(' . $template_id . ');
   require ' . $varname . '->getFile();
   ?>';
         $template = new rex_template($template_id);
         $content = str_replace($var . '[' . $param_str . ']', $template->getTemplate(), $content);
     }
     return $content;
 }
 public function getField()
 {
     $field = new rex_form_select_element();
     $field->setAttribute('class', 'form-control');
     $field->setLabel(rex_i18n::msg('system_setting_default_template_id'));
     $select = $field->getSelect();
     $select->setSize(1);
     $select->setSelected(rex_template::getDefaultId());
     $templates = rex_template::getTemplatesForCategory(0);
     if (empty($templates)) {
         $select->addOption(rex_i18n::msg('option_no_template'), 0);
     } else {
         $select->addArrayOptions($templates);
     }
     return $field;
 }
 function preArticle()
 {
     global $REX, $I18N;
     // ---------- moduleselect: nur module nehmen auf die der user rechte hat
     if ($this->mode == 'edit') {
         $MODULE = rex_sql::factory();
         $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');
         }
         $this->MODULESELECT = array();
         foreach ($template_ctypes as $ct_id => $ct_name) {
             $this->MODULESELECT[$ct_id] = new rex_select();
             $this->MODULESELECT[$ct_id]->setName('module_id');
             $this->MODULESELECT[$ct_id]->setSize('1');
             $this->MODULESELECT[$ct_id]->setStyle('class="rex-form-select"');
             $this->MODULESELECT[$ct_id]->setAttribute('onchange', 'this.form.submit();');
             $this->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'])) {
                         $this->MODULESELECT[$ct_id]->addOption(rex_translate($m['name'], null, false), $m['id']);
                     }
                 }
             }
         }
     }
 }
function rex_generateTemplate($template_id)
{
    global $REX;
    $sql = new rex_sql();
    $qry = 'SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'template WHERE id = ' . $template_id;
    $sql->setQuery($qry);
    if ($sql->getRows() == 1) {
        $templatesDir = rex_template::getTemplatesDir();
        $templateFile = rex_template::getFilePath($template_id);
        if ($fp = @fopen($templateFile, 'w')) {
            $content = $sql->getValue('content');
            foreach ($REX['VARIABLES'] as $var) {
                $content = $var->getTemplate($content);
            }
            fwrite($fp, $content);
            fclose($fp);
            @chmod($templateFile, $REX['FILEPERM']);
            return true;
        } else {
            trigger_error('unable to generate template ' . $template_id . '!', E_USER_ERROR);
            if (!is_writable()) {
                trigger_error('directory "' . $templatesDir . '" is not writable!', E_USER_ERROR);
            }
        }
    }
    return false;
}
Ejemplo n.º 7
0
 /**
  * Erstellt eine neue Kategorie.
  *
  * @param int   $category_id KategorieId in der die neue Kategorie erstellt werden soll
  * @param array $data        Array mit den Daten der Kategorie
  *
  * @throws rex_api_exception
  *
  * @return string Eine Statusmeldung
  */
 public static function addCategory($category_id, array $data)
 {
     $message = '';
     if (!is_array($data)) {
         throw new rex_api_exception('Expecting $data to be an array!');
     }
     self::reqKey($data, 'catpriority');
     self::reqKey($data, 'catname');
     // parent may be null, when adding in the root cat
     $parent = rex_category::get($category_id);
     if ($parent) {
         $path = $parent->getPath();
         $path .= $parent->getId() . '|';
     } else {
         $path = '|';
     }
     if ($data['catpriority'] <= 0) {
         $data['catpriority'] = 1;
     }
     if (!isset($data['name'])) {
         $data['name'] = $data['catname'];
     }
     if (!isset($data['status'])) {
         $data['status'] = 0;
     }
     $contentAvailable = rex_plugin::get('structure', 'content')->isAvailable();
     if ($contentAvailable) {
         $startpageTemplates = [];
         if ($category_id != '') {
             // TemplateId vom Startartikel der jeweiligen Sprache vererben
             $sql = rex_sql::factory();
             // $sql->setDebug();
             $sql->setQuery('select clang_id,template_id from ' . rex::getTablePrefix() . "article where id={$category_id} and startarticle=1");
             for ($i = 0; $i < $sql->getRows(); $i++, $sql->next()) {
                 $startpageTemplates[$sql->getValue('clang_id')] = $sql->getValue('template_id');
             }
         }
         // Alle Templates der Kategorie
         $templates = rex_template::getTemplatesForCategory($category_id);
     }
     $user = rex::isBackend() ? null : 'frontend';
     // Kategorie in allen Sprachen anlegen
     $AART = rex_sql::factory();
     foreach (rex_clang::getAllIds() as $key) {
         if ($contentAvailable) {
             $template_id = rex_template::getDefaultId();
             if (isset($startpageTemplates[$key]) && $startpageTemplates[$key] != '') {
                 $template_id = $startpageTemplates[$key];
             }
             // Wenn Template nicht vorhanden, dann entweder erlaubtes nehmen
             // oder leer setzen.
             if (!isset($templates[$template_id])) {
                 $template_id = 0;
                 if (count($templates) > 0) {
                     $template_id = key($templates);
                 }
             }
         }
         $AART->setTable(rex::getTablePrefix() . 'article');
         if (!isset($id)) {
             $id = $AART->setNewId('id');
         } else {
             $AART->setValue('id', $id);
         }
         $AART->setValue('clang_id', $key);
         $AART->setValue('template_id', $template_id);
         $AART->setValue('name', $data['name']);
         $AART->setValue('catname', $data['catname']);
         $AART->setValue('catpriority', $data['catpriority']);
         $AART->setValue('parent_id', $category_id);
         $AART->setValue('priority', 1);
         $AART->setValue('path', $path);
         $AART->setValue('startarticle', 1);
         $AART->setValue('status', $data['status']);
         $AART->addGlobalUpdateFields($user);
         $AART->addGlobalCreateFields($user);
         try {
             $AART->insert();
             // ----- PRIOR
             if (isset($data['catpriority'])) {
                 self::newCatPrio($category_id, $key, 0, $data['catpriority']);
             }
             $message = rex_i18n::msg('category_added_and_startarticle_created');
             rex_article_cache::delete($id, $key);
             // ----- EXTENSION POINT
             // Objekte clonen, damit diese nicht von der extension veraendert werden koennen
             $message = rex_extension::registerPoint(new rex_extension_point('CAT_ADDED', $message, ['category' => clone $AART, 'id' => $id, 'parent_id' => $category_id, 'clang' => $key, 'name' => $data['catname'], 'priority' => $data['catpriority'], 'path' => $path, 'status' => $data['status'], 'article' => clone $AART, 'data' => $data]));
         } catch (rex_sql_exception $e) {
             throw new rex_api_exception($e);
         }
     }
     return $message;
 }
Ejemplo n.º 8
0
echo rex_view::title(rex_i18n::msg('title_templates'));
$OUT = true;
$function = rex_request('function', 'string');
$template_id = rex_request('template_id', 'int');
$save = rex_request('save', 'string');
$goon = rex_request('goon', 'string');
$success = '';
$error = '';
$content = '';
$message = '';
if ($function == 'delete') {
    $del = rex_sql::factory();
    $del->setQuery('SELECT ' . rex::getTablePrefix() . 'article.id,' . rex::getTablePrefix() . 'template.name FROM ' . rex::getTablePrefix() . 'article
        LEFT JOIN ' . rex::getTablePrefix() . 'template ON ' . rex::getTablePrefix() . 'article.template_id=' . rex::getTablePrefix() . 'template.id
        WHERE ' . rex::getTablePrefix() . 'article.template_id="' . $template_id . '" LIMIT 0,10');
    if ($del->getRows() > 0 || rex_template::getDefaultId() == $template_id) {
        $error = rex_i18n::msg('cant_delete_template_because_its_in_use', rex_i18n::msg('id') . ' = ' . $template_id);
    } else {
        $del->setQuery('DELETE FROM ' . rex::getTablePrefix() . 'template WHERE id = "' . $template_id . '" LIMIT 1');
        // max. ein Datensatz darf loeschbar sein
        rex_file::delete(rex_path::addonCache('templates', $template_id . '.template'));
        $success = rex_i18n::msg('template_deleted');
    }
} elseif ($function == 'edit') {
    $legend = rex_i18n::msg('edit_template') . ' <small class="rex-primary-id">' . rex_i18n::msg('id') . ' = ' . $template_id . '</small>';
    $hole = rex_sql::factory();
    $hole->setQuery('SELECT * FROM ' . rex::getTablePrefix() . 'template WHERE id = "' . $template_id . '"');
    if ($hole->getRows() == 1) {
        $templatename = $hole->getValue('name');
        $template = $hole->getValue('content');
        $active = $hole->getValue('active');
Ejemplo n.º 9
0
 public function getArticleTemplate()
 {
     if ($this->template_id != 0 && $this->article_id != 0) {
         ob_start();
         ob_implicit_flush(0);
         $TEMPLATE = new rex_template($this->template_id);
         $tplContent = $this->replaceCommonVars($TEMPLATE->getTemplate());
         require rex_stream::factory('template/' . $this->template_id, $tplContent);
         $CONTENT = ob_get_contents();
         ob_end_clean();
         $CONTENT = $this->replaceLinks($CONTENT);
     } else {
         $CONTENT = 'no template';
     }
     return $CONTENT;
 }
Ejemplo n.º 10
0
$fragment = new rex_fragment();
$fragment->setVar('heading', rex_i18n::msg('structure_categories_caption', $cat_name), false);
$fragment->setVar('content', $echo, false);
echo $fragment->parse('core/page/section.php');
// --------------------------------------------- ARTIKEL LISTE
$echo = '';
// --------------------- READ TEMPLATES
if ($category_id > 0 || $category_id == 0 && !rex::getUser()->getComplexPerm('structure')->hasMountpoints()) {
    $withTemplates = $this->getPlugin('content')->isAvailable();
    $tmpl_head = '';
    if ($withTemplates) {
        $template_select = new rex_select();
        $template_select->setName('template_id');
        $template_select->setSize(1);
        $template_select->setStyle('class="form-control"');
        $templates = rex_template::getTemplatesForCategory($category_id);
        if (count($templates) > 0) {
            foreach ($templates as $t_id => $t_name) {
                $template_select->addOption(rex_i18n::translate($t_name, false), $t_id);
                $TEMPLATE_NAME[$t_id] = rex_i18n::translate($t_name);
            }
        } else {
            $template_select->addOption(rex_i18n::msg('option_no_template'), '0');
            $TEMPLATE_NAME[0] = rex_i18n::msg('template_default_name');
        }
        $tmpl_head = '<th>' . rex_i18n::msg('header_template') . '</th>';
    }
    // --------------------- ARTIKEL LIST
    $art_add_link = '';
    if ($KATPERM) {
        $art_add_link = '<a href="' . $context->getUrl(['function' => 'add_art']) . '"' . rex::getAccesskey(rex_i18n::msg('article_add'), 'add_2') . '><i class="rex-icon rex-icon-add-article"></i></a>';
Ejemplo n.º 11
0
 /**
  * {@inheritdoc}
  */
 protected function preArticle($articleContent, $module_id)
 {
     // ---------- moduleselect: nur module nehmen auf die der user rechte hat
     if ($this->mode == 'edit') {
         $MODULE = rex_sql::factory();
         $modules = $MODULE->getArray('select * from ' . rex::getTablePrefix() . 'module order by name');
         $template_ctypes = isset($this->template_attributes['ctype']) ? $this->template_attributes['ctype'] : [];
         // wenn keine ctyes definiert sind, gibt es immer den CTYPE=1
         if (count($template_ctypes) == 0) {
             $template_ctypes = [1 => 'default'];
         }
         $this->MODULESELECT = [];
         foreach ($template_ctypes as $ct_id => $ct_name) {
             foreach ($modules as $m) {
                 if (rex::getUser()->getComplexPerm('modules')->hasPerm($m['id'])) {
                     if (rex_template::hasModule($this->template_attributes, $ct_id, $m['id'])) {
                         $this->MODULESELECT[$ct_id][] = ['name' => rex_i18n::translate($m['name'], false), 'id' => $m['id']];
                     }
                 }
             }
         }
     }
     return parent::preArticle($articleContent, $module_id);
 }
Ejemplo n.º 12
0
 /**
  * Bearbeitet einen Artikel.
  *
  * @param int   $article_id Id des Artikels der verändert werden soll
  * @param int   $clang      Id der Sprache
  * @param array $data       Array mit den Daten des Artikels
  *
  * @throws rex_api_exception
  *
  * @return string Eine Statusmeldung
  */
 public static function editArticle($article_id, $clang, $data)
 {
     if (!is_array($data)) {
         throw new rex_api_exception('Expecting $data to be an array!');
     }
     self::reqKey($data, 'name');
     // Artikel mit alten Daten selektieren
     $thisArt = rex_sql::factory();
     $thisArt->setQuery('select * from ' . rex::getTablePrefix() . 'article where id=' . $article_id . ' and clang_id=' . $clang);
     if ($thisArt->getRows() != 1) {
         throw new rex_api_exception('Unable to find article with id "' . $article_id . '" and clang "' . $clang . '"!');
     }
     $ooArt = rex_article::get($article_id, $clang);
     $data['category_id'] = $ooArt->getCategoryId();
     if (rex_plugin::get('structure', 'content')->isAvailable()) {
         $templates = rex_template::getTemplatesForCategory($data['category_id']);
         // Wenn Template nicht vorhanden, dann entweder erlaubtes nehmen
         // oder leer setzen.
         if (!isset($templates[$data['template_id']])) {
             $data['template_id'] = 0;
             if (count($templates) > 0) {
                 $data['template_id'] = key($templates);
             }
         }
     }
     if (isset($data['priority'])) {
         if ($data['priority'] <= 0) {
             $data['priority'] = 1;
         }
     }
     // complete remaining optional aprams
     foreach (['path', 'priority'] as $optionalData) {
         if (!isset($data[$optionalData])) {
             $data[$optionalData] = $thisArt->getValue($optionalData);
         }
     }
     $EA = rex_sql::factory();
     $EA->setTable(rex::getTablePrefix() . 'article');
     $EA->setWhere(['id' => $article_id, 'clang_id' => $clang]);
     $EA->setValue('name', $data['name']);
     $EA->setValue('template_id', $data['template_id']);
     $EA->setValue('priority', $data['priority']);
     $EA->addGlobalUpdateFields();
     try {
         $EA->update();
         $message = rex_i18n::msg('article_updated');
         // ----- PRIOR
         rex_sql::factory()->setTable(rex::getTable('article'))->setWhere('id = :id AND clang_id != :clang', ['id' => $article_id, 'clang' => $clang])->setValue('priority', $data['priority'])->addGlobalUpdateFields()->update();
         foreach (rex_clang::getAllIds() as $clangId) {
             self::newArtPrio($data['category_id'], $clangId, $data['priority'], $thisArt->getValue('priority'));
         }
         rex_article_cache::delete($article_id);
         // ----- EXTENSION POINT
         $message = rex_extension::registerPoint(new rex_extension_point('ART_UPDATED', $message, ['id' => $article_id, 'article' => clone $EA, 'article_old' => clone $thisArt, 'status' => $thisArt->getValue('status'), 'name' => $data['name'], 'clang' => $clang, 'parent_id' => $data['category_id'], 'priority' => $data['priority'], 'path' => $data['path'], 'template_id' => $data['template_id'], 'data' => $data]));
     } catch (rex_sql_exception $e) {
         throw new rex_api_exception($e);
     }
     return $message;
 }
 public static function getJSCodeFromTemplate($templateId, $simpleMinify = true)
 {
     $template = new rex_template($templateId);
     return self::getJSCode($template->getFile(), $simpleMinify);
 }
Ejemplo n.º 14
0
 }
 // --------------------- ARTIKEL ADD FORM
 if ($function == 'add_art' && $KATPERM) {
     $tmpl_td = '';
     if ($withTemplates) {
         $selectedTemplate = 0;
         if ($category_id) {
             // template_id vom Startartikel erben
             $sql2 = rex_sql::factory();
             $sql2->setQuery('SELECT template_id FROM ' . rex::getTablePrefix() . 'article WHERE id=' . $category_id . ' AND clang_id=' . $clang . ' AND startarticle=1');
             if ($sql2->getRows() == 1) {
                 $selectedTemplate = $sql2->getValue('template_id');
             }
         }
         if (!$selectedTemplate || !isset($TEMPLATE_NAME[$selectedTemplate])) {
             $selectedTemplate = rex_template::getDefaultId();
         }
         if ($selectedTemplate && isset($TEMPLATE_NAME[$selectedTemplate])) {
             $template_select->setSelected($selectedTemplate);
         }
         $tmpl_td = '<td data-title="' . rex_i18n::msg('header_template') . '">' . $template_select->get() . '</td>';
     }
     $echo .= '<tr class="mark">
                 <td class="rex-table-icon"><i class="rex-icon rex-icon-article"></i></td>
                 <td class="rex-table-id" data-title="' . rex_i18n::msg('header_id') . '">-</td>
                 <td data-title="' . rex_i18n::msg('header_article_name') . '"><input class="form-control" type="text" name="article-name" autofocus /></td>
                 ' . $tmpl_td . '
                 <td data-title="' . rex_i18n::msg('header_date') . '">' . rex_formatter::strftime(time(), 'date') . '</td>
                 <td class="rex-table-priority" data-title="' . rex_i18n::msg('header_priority') . '"><input class="form-control" type="text" name="article-position" value="' . ($artPager->getRowCount() + 1) . '" /></td>
                 <td class="rex-table-action" colspan="3"><input type="hidden" name="rex-api-call" value="article_add" /><button class="btn btn-save" type="submit" name="artadd_function"' . rex::getAccesskey(rex_i18n::msg('article_add'), 'save') . '>' . rex_i18n::msg('article_add') . '</button></td>
             </tr>
/**
 * Generiert den TemplateCache im Filesystem
 *
 * @param $template_id Id des zu generierenden Templates
 *
 * @return TRUE bei Erfolg, sonst FALSE
 */
function rex_generateTemplate($template_id)
{
    global $REX;
    $sql = rex_sql::factory();
    $qry = 'SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'template WHERE id = ' . $template_id;
    $sql->setQuery($qry);
    if ($sql->getRows() == 1) {
        $templatesDir = rex_template::getTemplatesDir();
        $templateFile = rex_template::getFilePath($template_id);
        $content = $sql->getValue('content');
        foreach ($REX['VARIABLES'] as $var) {
            $content = $var->getTemplate($content);
        }
        if (rex_file::put($templateFile, $content) !== false) {
            return true;
        } else {
            trigger_error('Unable to generate template ' . $template_id . '!', E_USER_ERROR);
            if (!is_writable()) {
                trigger_error('directory "' . $templatesDir . '" is not writable!', E_USER_ERROR);
            }
        }
    } else {
        trigger_error('Template with id "' . $template_id . '" does not exist!', E_USER_ERROR);
    }
    return false;
}
 function getArticleTemplate()
 {
     // global $REX hier wichtig, damit in den Artikeln die Variable vorhanden ist!
     global $REX;
     if ($this->getTemplateId() != 0 && $this->article_id != 0) {
         ob_start();
         ob_implicit_flush(0);
         $TEMPLATE = new rex_template();
         $TEMPLATE->setId($this->getTemplateId());
         $tplContent = $TEMPLATE->getTemplate();
         $tplContent = $this->replaceCommonVars($tplContent);
         eval("?>" . $tplContent);
         $CONTENT = ob_get_contents();
         ob_end_clean();
     } else {
         $CONTENT = "no template";
     }
     return $CONTENT;
 }
Ejemplo n.º 17
0
 public static function checkPermissions($ep)
 {
     $AddonPerm = rex_config::get('slice_ui');
     $article = rex_sql::factory();
     // $article->setDebug();
     $articleTable = rex::getTablePrefix() . 'article';
     $article->setTable($articleTable);
     // $article->setDebug();
     $article->setQuery('
   SELECT article.*, template.attributes as template_attributes
   FROM ' . rex::getTablePrefix() . 'article as article
   LEFT JOIN ' . rex::getTablePrefix() . 'template as template ON template.id=article.template_id
   WHERE article.id = ? AND clang_id = ?', array($ep['article_id'], $ep['clang']));
     $ctype = 1;
     if ($c = rex_request('ctype')) {
         $ctype = $c;
     }
     $template_attributes = json_decode($article->getValue('template_attributes'), 1);
     if ($template_attributes === null) {
         $template_attributes = array();
     }
     $AddonPerm['ctypes'] = $AddonPerm['ctypes'][$article->getValue('template_id')];
     if (!rex_template::hasModule($template_attributes, $ep['ctype'], $ep['module_id'])) {
         return false;
     } elseif (!(rex::getUser()->isAdmin() || rex::getUser()->hasPerm('module[' . $ep['module_id'] . ']') || rex::getUser()->hasPerm('module[0]'))) {
         return false;
     }
     if (strpos(rex_get('page', 'string'), 'content/paste') === false) {
         if (!empty($AddonPerm['modules']) && !in_array('all', $AddonPerm['modules']) && !in_array($ep['module_id'], $AddonPerm['modules']) || !empty($AddonPerm['ctypes']) && !in_array('all', $AddonPerm['ctypes']) && !in_array($ep['ctype'], $AddonPerm['ctypes'])) {
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 18
0
     }
 } else {
     // add
     $module_id = rex_post('module_id', 'int');
     $CM->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'module WHERE id=' . $module_id);
 }
 if ($CM->getRows() != 1) {
     // ------------- START: MODUL IST NICHT VORHANDEN
     $global_warning = $I18N->msg('module_not_found');
     $slice_id = '';
     $function = '';
     // ------------- END: MODUL IST NICHT VORHANDEN
 } else {
     // ------------- MODUL IST VORHANDEN
     // ----- RECHTE AM MODUL ?
     if ($function != 'delete' && !rex_template::hasModule($template_attributes, $ctype, $module_id)) {
         $global_warning = $I18N->msg('no_rights_to_this_function');
         $slice_id = '';
         $function = '';
     } elseif (!($REX['USER']->isAdmin() || $REX['USER']->hasPerm('module[' . $module_id . ']') || $REX['USER']->hasPerm('module[0]'))) {
         // ----- RECHTE AM MODUL: NEIN
         $global_warning = $I18N->msg('no_rights_to_this_function');
         $slice_id = '';
         $function = '';
     } else {
         // ----- RECHTE AM MODUL: JA
         // ***********************  daten einlesen
         $REX_ACTION = array();
         $REX_ACTION['SAVE'] = true;
         foreach ($REX['VARIABLES'] as $obj) {
             $REX_ACTION = $obj->getACRequestValues($REX_ACTION);
Ejemplo n.º 19
0
     }
 } else {
     // add
     $module_id = rex_post('module_id', 'int');
     $CM->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'module WHERE id=' . $module_id);
 }
 if ($CM->getRows() != 1) {
     // ------------- START: MODUL IST NICHT VORHANDEN
     $global_warning = $I18N->msg('module_not_found');
     $slice_id = '';
     $function = '';
     // ------------- END: MODUL IST NICHT VORHANDEN
 } else {
     // ------------- MODUL IST VORHANDEN
     // ----- RECHTE AM MODUL ?
     if (!rex_template::hasModule($template_attributes, $ctype, $module_id)) {
         $global_warning = $I18N->msg('no_rights_to_this_function');
         $slice_id = '';
         $function = '';
     } elseif (!($REX['USER']->isAdmin() || $REX['USER']->hasPerm('module[' . $module_id . ']') || $REX['USER']->hasPerm('module[0]'))) {
         // ----- RECHTE AM MODUL: NEIN
         $global_warning = $I18N->msg('no_rights_to_this_function');
         $slice_id = '';
         $function = '';
     } else {
         // ----- RECHTE AM MODUL: JA
         // ***********************  daten einlesen
         $REX_ACTION = array();
         $REX_ACTION['SAVE'] = true;
         foreach ($REX['VARIABLES'] as $obj) {
             $REX_ACTION = $obj->getACRequestValues($REX_ACTION);