/** * Konstruktor. Stellt die Daten der Kategorie aus der Datenbank zusammen. * @param int $kategorie_id Kategorie ID. * @param int $clang_id Redaxo SprachID. * @param string $table_prefix Redaxo Tabellen Praefix ($REX['TABLE_PREFIX']) */ public function __construct($kategorie_id, $clang_id, $table_prefix = "rex_") { $this->table_prefix = $table_prefix; // Sprachfallback $query_prove = "SELECT * FROM " . $this->table_prefix . "d2u_stellenmarkt_kategorien_lang AS lang " . "WHERE kategorie_id = " . $kategorie_id . " " . "ORDER BY clang_id DESC"; $result_prove = new rex_sql(); $result_prove->setQuery($query_prove); $num_rows_prove = $result_prove->getRows(); $is_lang_available = false; $fallback_lang_id = 0; for ($i = 0; $i < $num_rows_prove; $i++) { if ($result_prove->getValue("lang.clang_id") == $clang_id) { $is_lang_available = true; } else { $fallback_lang_id = $result_prove->getValue("lang.clang_id"); } $result_prove->next(); } $sql_clang_id = $clang_id; if ($is_lang_available == false) { $sql_clang_id = $fallback_lang_id; } $query = "SELECT * FROM " . $this->table_prefix . "d2u_stellenmarkt_kategorien AS kategorien " . "LEFT JOIN " . $this->table_prefix . "d2u_stellenmarkt_kategorien_lang AS lang " . "ON kategorien.kategorie_id = lang.kategorie_id " . "WHERE kategorien.kategorie_id = " . $kategorie_id . " " . "AND (clang_id = " . $sql_clang_id . " OR clang_id IS NULL) " . "LIMIT 0, 1"; $result = new rex_sql(); $result->setQuery($query); $num_rows = $result->getRows(); if ($num_rows > 0) { $this->kategorie_id = $result->getValue("kategorie_id"); if ($result->getValue("clang_id") != "") { $this->clang_id = $result->getValue("clang_id"); } $this->interne_bezeichnung = $result->getValue("interne_bezeichnung"); $this->name = $result->getValue("name"); } }
/** * Alle Metafelder löschen, nicht das nach einem Import in der Parameter Tabelle * noch Datensätze zu Feldern stehen, welche nicht als Spalten in der * rex_article angelegt wurden! */ function rex_a62_metainfo_cleanup($params) { global $REX; // Cleanup nur durchführen, wenn auch die rex_article Tabelle neu angelegt wird if (isset($params['force']) && $params['force'] != true && strpos($params['content'], 'CREATE TABLE `' . $REX['TABLE_PREFIX'] . 'article`') === false && strpos($params['content'], 'CREATE TABLE ' . $REX['TABLE_PREFIX'] . 'article') === false) { return; } require_once $REX['INCLUDE_PATH'] . '/addons/metainfo/classes/class.rex_table_manager.inc.php'; $sql = new rex_sql(); $sql->setQuery('SELECT name FROM ' . $REX['TABLE_PREFIX'] . '62_params'); for ($i = 0; $i < $sql->getRows(); $i++) { if (substr($sql->getValue('name'), 0, 4) == 'med_') { $tableManager = new rex_a62_tableManager($REX['TABLE_PREFIX'] . 'file'); } else { $tableManager = new rex_a62_tableManager($REX['TABLE_PREFIX'] . 'article'); } $tableManager->deleteColumn($sql->getValue('name')); $sql->next(); } // evtl reste aufräumen $tablePrefixes = array('article' => array('art_', 'cat_'), 'file' => array('med_')); foreach ($tablePrefixes as $table => $prefixes) { $table = $REX['TABLE_PREFIX'] . $table; $tableManager = new rex_a62_tableManager($table); foreach (rex_sql::showColumns($table) as $column) { $column = $column['name']; if (in_array(substr($column, 0, 4), $prefixes)) { $tableManager->deleteColumn($column); } } } $sql = new rex_sql(); $sql->setQuery('DELETE FROM ' . $REX['TABLE_PREFIX'] . '62_params'); rex_generateAll(); }
/** * SET CONTENT OF ROBOTS.TXT * * @return (string) robots.txt */ public function setContent($content) { global $REX; $out = ''; $langs = array_keys($REX['CLANG']); // get clang ids $defaultRobotsTxt = 'User-agent: *' . "\r\n" . 'Disallow:'; if (!$REX['ADDON']['seo42']['settings']['no_robots_txt_auto_disallow']) { foreach ($langs as $lang) { $query = "SELECT id FROM " . $REX['TABLE_PREFIX'] . "article WHERE seo_noindex = '1' AND status = 1 AND clang = " . $lang; $sql = new rex_sql(); $sql->setQuery($query); for ($i = 1; $i <= $sql->getRows(); $i++) { $out .= "Disallow: /" . seo42::getTrimmedUrl($sql->getValue('id'), $lang) . "\r\n"; $sql->next(); } } } if ($out != '') { $out = "User-agent: *" . "\r\n" . $out . "\r\n"; } if ($out == '' && $content == '') { $this->robots_txt = $defaultRobotsTxt; } else { $this->robots_txt = $out . $content; } }
function rex_copyRevisionContent($article_id, $clang, $from_revision_id, $to_revision_id, $from_re_sliceid = 0, $to_revision_delete = FALSE) { global $REX; if ($to_revision_delete) { $dc = new rex_sql(); // $dc->debugsql = 1; $dc->setQuery('delete from ' . $REX['TABLE_PREFIX'] . 'article_slice where article_id=' . $article_id . ' and clang=' . $clang . ' and revision=' . $to_revision_id); } if ($from_revision_id == $to_revision_id) { return false; } $gc = new rex_sql(); // $gc->debugsql = 1; $gc->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article_slice where re_article_slice_id='{$from_re_sliceid}' and article_id='{$article_id}' and clang='{$clang}' and revision='{$from_revision_id}'"); if ($gc->getRows() == 1) { // letzt slice_id des ziels holen .. $glid = new rex_sql(); // $glid->debugsql = 1; $glid->setQuery("\n\t\t\t\t\tselect \n\t\t\t\t\t\tr1.id, r1.re_article_slice_id\n\t from \n\t\t\t\t\t\t" . $REX['TABLE_PREFIX'] . "article_slice as r1\n\t\t\t\t\tleft join " . $REX['TABLE_PREFIX'] . "article_slice as r2 on r1.id = r2.re_article_slice_id\n\t where \n\t\t\t\t\t\tr1.article_id = {$article_id} and r1.clang = {$clang} and \n\t\t\t\t\t\tr2.id is NULL and \n\t\t\t\t\t\tr1.revision='{$to_revision_id}';"); if ($glid->getRows() == 1) { $to_last_slice_id = $glid->getValue("r1.id"); } else { $to_last_slice_id = 0; } $ins = new rex_sql(); // $ins->debugsql = 1; $ins->setTable($REX['TABLE_PREFIX'] . "article_slice"); $cols = new rex_sql(); $cols->setquery("SHOW COLUMNS FROM " . $REX['TABLE_PREFIX'] . "article_slice"); for ($j = 0; $j < $cols->rows; $j++, $cols->next()) { $colname = $cols->getValue("Field"); if ($colname == "re_article_slice_id") { $value = $to_last_slice_id; } elseif ($colname == "revision") { $value = $to_revision_id; } elseif ($colname == "createdate") { $value = time(); } elseif ($colname == "updatedate") { $value = time(); } elseif ($colname == "createuser") { $value = $REX["USER"]->getValue("login"); } elseif ($colname == "updateuser") { $value = $REX["USER"]->getValue("login"); } else { $value = $gc->getValue($colname); } if ($colname != "id") { $ins->setValue($colname, $ins->escape($value)); } } $ins->insert(); // id holen und als re setzen und weitermachen.. rex_copyRevisionContent($article_id, $clang, $from_revision_id, $to_revision_id, $gc->getValue("id")); return true; } rex_generateArticle($article_id); return true; }
/** * delete the metafields */ public static function delFields() { global $REX; $sql = new rex_sql(); $sql->setQuery('SELECT `name` FROM ' . $REX['TABLE_PREFIX'] . '62_params WHERE `name` LIKE "asd_%"'); $delFields = array(); for ($i = 1; $i <= $sql->getRows(); $i++) { $delFields[] = a62_delete_field($sql->getValue('name')); $sql->next(); } return self::checkErrorMessage($delFields); }
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0) { // ***** SELECT FESTLEGEN $SEL = new rex_select(); $SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . '][]'); $SEL->setId("el_" . $this->id); $SEL->setSize(5); $SEL->setMultiple(1); // ***** SQL - ROHDATEN ZIEHEN $sql = $this->elements[5]; $teams = new rex_sql(); $teams->debugsql = $this->params["debug"]; $teams->setQuery($sql); for ($t = 0; $t < $teams->getRows(); $t++) { $SEL->addOption($teams->getValue($this->elements[7]), $teams->getValue($this->elements[6])); $teams->next(); } $wc = ""; // if (isset($warning["el_" . $this->getId()])) $wc = $warning["el_" . $this->getId()]; $SEL->setStyle('class="multipleselect ' . $wc . '"'); // ***** EINGELOGGT ODER NICHT SETZEN if ($send == 0) { // erster aufruf // Daten ziehen if ($this->params["main_id"] > 0) { $this->value = array(); $g = new rex_sql(); $g->debugsql = $this->params["debug"]; $g->setQuery('select ' . $this->elements[3] . ' from ' . $this->elements[1] . ' where ' . $this->elements[2] . '=' . $this->params["main_id"]); $gg = $g->getArray(); if (is_array($gg)) { foreach ($gg as $g) { $this->value[] = $g[$this->elements[3]]; } } } } // ***** AUSWAHL SETZEN if (is_array($this->value)) { foreach ($this->value as $val) { $SEL->setSelected($val); } } // ***** AUSGEBEN $form_output[] = ' <p class="formmultipleselect"> <label class="multipleselect ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[4] . '</label> ' . $SEL->get() . ' </p>'; }
function getValue($value) { if (!is_array($value)) { $value = array(); $section =& $this->getSection(); // Alle vorhanden Werte löschen $sql = new rex_sql(); $sql->setQuery('SELECT `' . $this->foreignField . '` FROM `' . $this->foreignTable . '` WHERE ' . $section->_getWhereString()); for ($i = 0; $i < $sql->getRows(); $i++) { $value[] = $sql->getValue($this->foreignField); $sql->next(); } } return $value; }
/** * update the article id in the url_control sql table * @param int $id */ public static function updateArticleId($id) { global $REX; $sql = new rex_sql(); $sql->setTable($REX['TABLE_PREFIX'] . 'url_control_generate'); $sql->setWhere('`table` = "' . rex_asd_news_config::getTable() . '"'); $sql->select('id'); for ($i = 1; $i <= $sql->getRows(); $i++) { $saveSql = new rex_sql(); $saveSql->setTable($REX['TABLE_PREFIX'] . 'url_control_generate'); $saveSql->setWhere('`id` = ' . $sql->getValue('id')); $saveSql->setValue('article_id', $id); $saveSql->update(); $sql->next(); } }
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(); } }
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0) { $SEL = new rex_select(); $SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . ']'); $SEL->setId("el_" . $this->id); $SEL->setSize(1); $sql = $this->elements[4]; $teams = new rex_sql(); $teams->debugsql = $this->params["debug"]; $teams->setQuery($sql); $sqlnames = array(); if ($this->elements[3] != 1) { // mit --- keine auswahl --- $SEL->addOption($this->elements[3], "0"); } for ($t = 0; $t < $teams->getRows(); $t++) { $SEL->addOption($teams->getValue($this->elements[6]), $teams->getValue($this->elements[5])); if (isset($this->elements[7])) { $sqlnames[$teams->getValue($this->elements[5])] = $teams->getValue($this->elements[7]); } $teams->next(); } $wc = ""; if (isset($warning["el_" . $this->getId()])) { $wc = $warning["el_" . $this->getId()]; } $SEL->setStyle(' class="select ' . $wc . '"'); if ($this->value == "" && isset($this->elements[7]) && $this->elements[7] != "") { $this->value = $this->elements[7]; } $SEL->setSelected($this->value); $form_output[] = ' <p class="formselect"> <label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[2] . '</label> ' . $SEL->get() . ' </p>'; $email_elements[$this->elements[1]] = stripslashes($this->value); if (isset($sqlnames[$this->value])) { $email_elements[$this->elements[1] . '_SQLNAME'] = stripslashes($sqlnames[$this->value]); } if (!isset($this->elements[8]) || $this->elements[8] != "no_db") { $sql_elements[$this->elements[1]] = $this->value; } }
function getArticle($curctype = -1) { global $module_id, $REX_USER, $REX, $I18N; $this->ctype = $curctype; $sliceLimit = ''; if ($this->getSlice) { //$REX['GG'] = 0; $sliceLimit = " AND " . $REX['TABLE_PREFIX'] . "article_slice.id = '" . $this->getSlice . "' "; } // ----- start: article caching ob_start(); ob_implicit_flush(0); if ($REX['GG'] && !$this->viasql && !$this->getSlice) { if ($this->article_id != 0) { $this->contents = ''; $article_content_file = $REX['INCLUDE_PATH'] . '/generated/articles/' . $this->article_id . '.' . $this->clang . '.content'; if ($cont = rex_get_file_contents($article_content_file)) { $this->contents = $cont; eval($this->contents); } } } 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 . "'\r\n " . $sliceLimit . "\r\n ORDER BY " . $REX['TABLE_PREFIX'] . "article_slice.re_article_slice_id"; $this->CONT = new rex_sql(); $this->CONT->debugsql = 0; $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_CONTS[$this->CONT->getValue('re_article_slice_id')] = $this->CONT->getValue($REX['TABLE_PREFIX'] . 'article_slice.id'); $RE_CONTS_CTYPE[$this->CONT->getValue('re_article_slice_id')] = $this->CONT->getValue($REX['TABLE_PREFIX'] . 'article_slice.ctype'); $RE_MODUL_IN[$this->CONT->getValue('re_article_slice_id')] = $this->CONT->getValue($REX['TABLE_PREFIX'] . 'module.eingabe'); $RE_MODUL_OUT[$this->CONT->getValue('re_article_slice_id')] = $this->CONT->getValue($REX['TABLE_PREFIX'] . 'module.ausgabe'); $RE_MODUL_ID[$this->CONT->getValue('re_article_slice_id')] = $this->CONT->getValue($REX['TABLE_PREFIX'] . 'module.id'); $RE_MODUL_NAME[$this->CONT->getValue('re_article_slice_id')] = $this->CONT->getValue($REX['TABLE_PREFIX'] . 'module.name'); $RE_C[$this->CONT->getValue('re_article_slice_id')] = $i; $this->CONT->next(); } // ---------- moduleselect: nur module nehmen auf die der user rechte hat if ($this->mode == 'edit') { $MODULE = new rex_sql(); $MODULE->setQuery('select * from ' . $REX['TABLE_PREFIX'] . 'module order by name'); $MODULESELECT = new rex_select(); $MODULESELECT->setName('module_id'); $MODULESELECT->setSize('1'); $MODULESELECT->setAttribute('onchange', 'this.form.submit();'); $MODULESELECT->addOption('---------------------------- ' . $I18N->msg('add_block'), ''); for ($i = 0; $i < $MODULE->getRows(); $i++) { if ($REX_USER->hasPerm('module[' . $MODULE->getValue('id') . ']') || $REX_USER->hasPerm('admin[]')) { $MODULESELECT->addOption(rex_translate($MODULE->getValue('name'), NULL, FALSE), $MODULE->getValue('id')); } $MODULE->next(); } } // ---------- SLICE IDS SORTIEREN UND AUSGEBEN $I_ID = 0; $PRE_ID = 0; $LCTSL_ID = 0; $this->CONT->reset(); $this->article_content = ""; for ($i = 0; $i < $this->CONT->getRows(); $i++) { // ----- ctype unterscheidung if ($this->mode != "edit" && $i == 0) { $this->article_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'; if ($this->setanker) { $form_url .= '#addslice'; } $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->setId("module_id" . $I_ID); $slice_content = ' <form action="' . $form_url . '" method="get" id="slice' . $RE_CONTS[$I_ID] . '"> <fieldset> <legend class="rex-lgnd"><span class="rex-hide">' . $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 . '" /> <p class="rex-slct"> ' . $MODULESELECT->get() . ' <noscript><input type="submit" class="rex-sbmt" name="btn_add" value="' . $I18N->msg("add_block") . '" /></noscript> </p> </fieldset> </form>'; } // ----- EDIT/DELETE BLOCK - Wenn Rechte vorhanden if ($REX_USER->hasPerm("module[" . $RE_MODUL_ID[$I_ID] . "]") || $REX_USER->hasPerm("admin[]")) { $msg = ''; if ($this->slice_id == $RE_CONTS[$I_ID] && $this->message != '') { $msg = rex_warning($this->message); } $sliceUrl = 'index.php?page=content&article_id=' . $this->article_id . '&mode=edit&slice_id=' . $RE_CONTS[$I_ID] . '&clang=' . $this->clang . '&ctype=' . $this->ctype . '%s#slice' . $RE_CONTS[$I_ID]; $listElements = array(); $listElements[] = '<a href="' . sprintf($sliceUrl, '&function=edit') . '" class="rex-clr-grn">' . $I18N->msg('edit') . ' <span class="rex-hide">' . $RE_MODUL_NAME[$I_ID] . '</span></a>'; $listElements[] = '<a href="' . sprintf($sliceUrl, '&function=delete&save=1') . '" class="rex-clr-red" onclick="return confirm(\'' . $I18N->msg('delete') . ' ?\')">' . $I18N->msg('delete') . ' <span class="rex-hide">' . $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, '&upd=' . time() . '&function=moveup') . '" title="' . $moveUp . '"><img src="media/file_up.gif" width="16" height="16" alt="' . $moveUp . '" /> <span class="rex-hide">' . $RE_MODUL_NAME[$I_ID] . '</span></a>'; $listElements[] = '<a href="' . sprintf($sliceUrl, '&upd=' . time() . '&function=movedown') . '" title="' . $moveDown . '"><img src="media/file_down.gif" width="16" height="16" alt="' . $moveDown . '" /> <span class="rex-hide">' . $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 . ' <div class="rex-cnt-editmode-slc"> <p class="rex-flLeft">' . htmlspecialchars($RE_MODUL_NAME[$I_ID]) . '</p> <ul class="rex-flRight" id="rex-slc-mnu"> '; foreach ($listElements as $listElement) { $mne .= '<li>' . $listElement . '</li>'; } $mne .= '</ul></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); } } // TODO: PreviewActions gibts nur im EditMode...? if ($this->function == 'edit') { $modebit = '2'; } elseif ($this->function == 'delete') { $modebit = '4'; } else { $modebit = '1'; } // pre-action and add $ga = new rex_sql(); $ga->debugsql = 0; $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-cnt-slc-otp"><div class="rex-cnt-slc-otp2"> ' . $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-cnt-editmode-slc"> <p class="rex-flLeft" id="slice' . $RE_CONTS[$I_ID] . '">' . $RE_MODUL_NAME[$I_ID] . '</p> <ul class="rex-flRight"> <li>' . $I18N->msg('no_editing_rights') . ' <span class="rex-hide">' . $RE_MODUL_NAME[$I_ID] . '</span></li> </ul> </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->article_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->article_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->article_content .= "<?php } ?>"; } // ----- add module im edit mode if ($this->mode == "edit") { $form_url = 'index.php'; if ($this->setanker) { $form_url .= '#addslice'; } if ($this->function == "add" && $this->slice_id == $LCTSL_ID) { $slice_content = $this->addSlice($LCTSL_ID, $module_id); } else { // ----- BLOCKAUSWAHL - SELECT $MODULESELECT->setId("module_id" . $LCTSL_ID); // $slice_content = $add_select_box; $slice_content = ' <form action="' . $form_url . '" method="get"> <fieldset> <legend class="rex-lgnd"><span class="rex-hide">' . $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 . '" /> <p class="rex-slct"> ' . $MODULESELECT->get() . ' <noscript><input type="submit" class="rex-sbmt" name="btn_add" value="' . $I18N->msg("add_block") . '" /></noscript> </p> </fieldset> </form>'; } $this->article_content .= $slice_content; } // -------------------------- schreibe content if ($this->mode == "generate" || $this->viasql) { echo $this->replaceLinks($this->article_content); } else { eval("?>" . $this->article_content); } } else { echo $I18N->msg('no_article_available'); } } // ----- end: article caching $CONTENT = ob_get_contents(); ob_end_clean(); return $CONTENT; }
/** * rex_rewriter_generate_pathnames * generiert die Pathlist, abhŠngig von Aktion * @author markus.staab[at]redaxo[dot]de Markus Staab * @package redaxo4.2 */ function rex_rewriter_generate_pathnames($params) { global $REX, $REXPATH; if (file_exists(FULLNAMES_PATHLIST)) { require_once FULLNAMES_PATHLIST; } if (!isset($REXPATH)) { $REXPATH = array(); } if (!isset($params['extension_point'])) { $params['extension_point'] = ''; } $where = ''; switch ($params['extension_point']) { // ------- sprachabhängig, einen artikel aktualisieren case 'CAT_DELETED': case 'ART_DELETED': unset($REXPATH[$params['id']]); break; case 'CAT_ADDED': case 'CAT_UPDATED': case 'ART_ADDED': case 'ART_UPDATED': $where = '(id=' . $params['id'] . ' AND clang=' . $params['clang'] . ') OR (path LIKE "%|' . $params['id'] . '|%" AND clang=' . $params['clang'] . ')'; break; // ------- alles aktualisieren // ------- alles aktualisieren case 'ALL_GENERATED': default: $where = '1=1'; break; } if ($where != '') { $db = new rex_sql(); // $db->debugsql=true; $db->setQuery('SELECT id,clang,path,startpage FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE ' . $where . ' and revision=0'); while ($db->hasNext()) { $clang = $db->getValue('clang'); $pathname = ''; if (count($REX['CLANG']) > 1) { $pathname = $REX['CLANG'][$clang] . '/'; } // pfad über kategorien bauen $path = trim($db->getValue('path'), '|'); if ($path != '') { $path = explode('|', $path); foreach ($path as $p) { $ooc = OOCategory::getCategoryById($p, $clang); $name = $ooc->getName(); unset($ooc); // speicher freigeben $pathname = rex_rewriter_appendToPath($pathname, $name); } } $ooa = OOArticle::getArticleById($db->getValue('id'), $clang); if ($ooa->isStartArticle()) { $ooc = $ooa->getCategory(); $catname = $ooc->getName(); unset($ooc); // speicher freigeben $pathname = rex_rewriter_appendToPath($pathname, $catname); } // eigentlicher artikel anhängen $name = $ooa->getName(); unset($ooa); // speicher freigeben $pathname = rex_rewriter_appendToPath($pathname, $name); $pathname = substr($pathname, 0, strlen($pathname) - 1) . '.html'; $REXPATH[$db->getValue('id')][$db->getValue('clang')] = $pathname; $db->next(); } } rex_put_file_contents(FULLNAMES_PATHLIST, "<?php\n\$REXPATH = " . var_export($REXPATH, true) . ";\n"); }
/** * Holt alle zugehörigen Kurse aus der Datenbank. * @param boolean $nur_online TRUE, wenn nur online Kurse ausgegeben werden, * sonst false * @return Kurse[] Array mit Kursobjekten. */ public function getAllKurse($nur_online = TRUE) { $query = "SELECT kurs_id FROM " . $this->table_prefix . "d2u_kurse_kurse " . "WHERE (terminkategorie_ids LIKE '%|" . $this->terminkategorie_id . "|%' " . " OR terminkategorie_ids = '" . $this->terminkategorie_id . "') "; if ($nur_online) { $query .= "AND status = 'online' " . "AND (datum_von = '' OR datum_von >= '" . date("Y-m-d", time()) . "') "; } $query .= "ORDER BY datum_von, titel"; $result = new rex_sql(); $result->setQuery($query); $num_rows = $result->getRows(); $kurse = array(); for ($i = 0; $i < $num_rows; $i++) { $kurse[] = new Kurs($result->getValue("kurs_id"), $this->table_prefix); $result->next(); } return $kurse; }
} $csuchfeld = rex_request("csuchfeld", "array"); $SUCHSEL = new rexselect(); $SUCHSEL->setMultiple(1); $SUCHSEL->setSize(5); $SUCHSEL->setName("csuchfeld[]"); $SUCHSEL->setStyle("width:100%;"); $ssql = new rex_sql(); //$ssql->debugsql = 1; $ssql->setQuery("select * from " . $table_field . " order by prior"); for ($i = 0; $i < $ssql->getRows(); $i++) { $SUCHSEL->addOption($ssql->getValue("name"), $ssql->getValue("userfield")); if (!is_array($csuchfeld)) { $SUCHSEL->setSelected($ssql->getValue("field")); } $ssql->next(); } foreach ($csuchfeld as $cs) { $SUCHSEL->setSelected($cs); $link .= "&csuchfeld[]=" . $cs; } $cstatus = rex_request("cstatus", "string"); $STATUSSEL = new rexselect(); $STATUSSEL->setName("cstatus"); $STATUSSEL->setStyle("width:100%;"); $STATUSSEL->addOption("Aktiv & Inaktiv", ""); $STATUSSEL->addOption("Aktiv", 1); $STATUSSEL->addOption("Inaktiv", 0); if ($cstatus != "") { $STATUSSEL->setSelected($cstatus); $link .= "&cstatus=" . urlencode($cstatus);
function organizePriorities($newPrio, $oldPrio) { if ($newPrio == $oldPrio) { return; } if ($newPrio < $oldPrio) { $addsql = 'desc'; } else { $addsql = 'asc'; } $sql = new rex_sql(); $sql->debugsql =& $this->debug; $sql->setQuery('SELECT field_id FROM ' . $this->tableName . ' WHERE name LIKE "' . $this->metaPrefix . '%" ORDER BY prior, updatedate ' . $addsql); $updateSql = new rex_sql(); $updateSql->debugsql =& $this->debug; for ($i = 0; $i < $sql->getRows(); $i++) { $updateSql->setTable($this->tableName); $updateSql->setValue('prior', $i + 1); $updateSql->setWhere('name LIKE "' . $this->metaPrefix . '%" AND field_id = ' . $sql->getValue('field_id')); $updateSql->update(); $sql->next(); } }
<?php // Uebersichtsliste if ($func == '') { // Wenn eine Kategorie geloescht wurde koennen die lang-Objekte noch existieren und ... $query_to_delete = "SELECT lang.kategorie_id, kategorien.kategorie_id " . "FROM `" . $REX['TABLE_PREFIX'] . "d2u_stellenmarkt_kategorien_lang` AS lang " . "LEFT JOIN `" . $REX['TABLE_PREFIX'] . "d2u_stellenmarkt_kategorien` AS kategorien " . "ON lang.kategorie_id = kategorien.kategorie_id " . "WHERE kategorien.kategorie_id IS NULL " . "GROUP BY lang.kategorie_id"; $result_to_delete = new rex_sql(); $result_to_delete->setQuery($query_to_delete); $num_rows_to_delete = $result_to_delete->getRows(); for ($i = 0; $i < $num_rows_to_delete; $i++) { // ... muessen zuerst geloescht werden $delete_qry = 'DELETE FROM ' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_kategorien_lang ' . 'WHERE kategorie_id = ' . $result_to_delete->getValue("lang.kategorie_id"); $delete_sql = new rex_sql(); $delete_data = $delete_sql->getArray($delete_qry); $result_to_delete->next(); } /* * Liste anlegen */ $sql = 'SELECT kategorie_id, interne_bezeichnung FROM ' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_kategorien AS kategorien ' . 'ORDER BY interne_bezeichnung ASC'; $list = rex_list::factory($sql, 100); // Spalten mit Sortierfunktion $list->setColumnSortable('interne_bezeichnung'); $imgHeader = '<a href="' . $list->getUrl(array('func' => 'add')) . '"><img src="media/metainfo_plus.gif" alt="add" title="add" /></a>'; // Hinzufuegen Button $list->addColumn($imgHeader, '<img src="media/metainfo.gif" alt="field" title="field" />', 0, array('<th class="rex-icon">###VALUE###</th>', '<td class="rex-icon">###VALUE###</td>')); // Edit Button unterhalb des hinzufuegen Buttons $list->setColumnParams($imgHeader, array('func' => 'edit', 'entry_id' => '###kategorie_id###')); // Labels $list->setColumnLabel('kategorie_id', $I18N_STELLEN->msg('id')); $list->setColumnLabel('interne_bezeichnung', $I18N_STELLEN->msg('interne_bezeichnung'));
function _getSliceWhere($whereCluase, $table = null, $fields = null, $default = null) { global $REX; if (!$table) { $table = $REX['TABLE_PREFIX'] . 'article_slice'; } if (!$fields) { $fields = '*'; } $sql = new rex_sql(); // $sql->debugsql = true; $query = ' SELECT ' . $fields . ' FROM ' . $table . ' WHERE ' . $whereCluase; $sql->setQuery($query); $rows = $sql->getRows(); if ($rows == 1) { return new OOArticleSlice($sql->getValue('id'), $sql->getValue('article_id'), $sql->getValue('clang'), $sql->getValue('ctype'), $sql->getValue('modultyp_id'), $sql->getValue('re_article_slice_id'), $sql->getValue('next_article_slice_id'), $sql->getValue('createdate'), $sql->getValue('updatedate'), $sql->getValue('createuser'), $sql->getValue('updateuser'), $sql->getValue('revision'), array($sql->getValue('value1'), $sql->getValue('value2'), $sql->getValue('value3'), $sql->getValue('value4'), $sql->getValue('value5'), $sql->getValue('value6'), $sql->getValue('value7'), $sql->getValue('value8'), $sql->getValue('value9'), $sql->getValue('value10'), $sql->getValue('value11'), $sql->getValue('value12'), $sql->getValue('value13'), $sql->getValue('value14'), $sql->getValue('value15'), $sql->getValue('value16'), $sql->getValue('value17'), $sql->getValue('value18'), $sql->getValue('value19'), $sql->getValue('value20')), array($sql->getValue('file1'), $sql->getValue('file2'), $sql->getValue('file3'), $sql->getValue('file4'), $sql->getValue('file5'), $sql->getValue('file6'), $sql->getValue('file7'), $sql->getValue('file8'), $sql->getValue('file9'), $sql->getValue('file10')), array($sql->getValue('filelist1'), $sql->getValue('filelist2'), $sql->getValue('filelist3'), $sql->getValue('filelist4'), $sql->getValue('filelist5'), $sql->getValue('filelist6'), $sql->getValue('filelist7'), $sql->getValue('filelist8'), $sql->getValue('filelist9'), $sql->getValue('filelist10')), array($sql->getValue('link1'), $sql->getValue('link2'), $sql->getValue('link3'), $sql->getValue('link4'), $sql->getValue('link5'), $sql->getValue('link6'), $sql->getValue('link7'), $sql->getValue('link8'), $sql->getValue('link9'), $sql->getValue('link10')), array($sql->getValue('linklist1'), $sql->getValue('linklist2'), $sql->getValue('linklist3'), $sql->getValue('linklist4'), $sql->getValue('linklist5'), $sql->getValue('linklist6'), $sql->getValue('linklist7'), $sql->getValue('linklist8'), $sql->getValue('linklist9'), $sql->getValue('linklist10')), $sql->getValue('php'), $sql->getValue('html')); } else { if ($rows > 1) { $slices = array(); for ($i = 0; $i < $rows; $i++) { $slices[] = new OOArticleSlice($sql->getValue('id'), $sql->getValue('article_id'), $sql->getValue('clang'), $sql->getValue('ctype'), $sql->getValue('modultyp_id'), $sql->getValue('re_article_slice_id'), $sql->getValue('next_article_slice_id'), $sql->getValue('createdate'), $sql->getValue('updatedate'), $sql->getValue('createuser'), $sql->getValue('updateuser'), $sql->getValue('revision'), array($sql->getValue('value1'), $sql->getValue('value2'), $sql->getValue('value3'), $sql->getValue('value4'), $sql->getValue('value5'), $sql->getValue('value6'), $sql->getValue('value7'), $sql->getValue('value8'), $sql->getValue('value9'), $sql->getValue('value10'), $sql->getValue('value11'), $sql->getValue('value12'), $sql->getValue('value13'), $sql->getValue('value14'), $sql->getValue('value15'), $sql->getValue('value16'), $sql->getValue('value17'), $sql->getValue('value18'), $sql->getValue('value19'), $sql->getValue('value20')), array($sql->getValue('file1'), $sql->getValue('file2'), $sql->getValue('file3'), $sql->getValue('file4'), $sql->getValue('file5'), $sql->getValue('file6'), $sql->getValue('file7'), $sql->getValue('file8'), $sql->getValue('file9'), $sql->getValue('file10')), array($sql->getValue('filelist1'), $sql->getValue('filelist2'), $sql->getValue('filelist3'), $sql->getValue('filelist4'), $sql->getValue('filelist5'), $sql->getValue('filelist6'), $sql->getValue('filelist7'), $sql->getValue('filelist8'), $sql->getValue('filelist9'), $sql->getValue('filelist10')), array($sql->getValue('link1'), $sql->getValue('link2'), $sql->getValue('link3'), $sql->getValue('link4'), $sql->getValue('link5'), $sql->getValue('link6'), $sql->getValue('link7'), $sql->getValue('link8'), $sql->getValue('link9'), $sql->getValue('link10')), array($sql->getValue('linklist1'), $sql->getValue('linklist2'), $sql->getValue('linklist3'), $sql->getValue('linklist4'), $sql->getValue('linklist5'), $sql->getValue('linklist6'), $sql->getValue('linklist7'), $sql->getValue('linklist8'), $sql->getValue('linklist9'), $sql->getValue('linklist10')), $sql->getValue('php'), $sql->getValue('html')); $sql->next(); } return $slices; } } return $default; }
/** * Übernimmt die gePOSTeten werte in ein rex_sql-Objekt. * * @param array $params * @param rex_sql $sqlSave rex_sql-objekt, in das die aktuellen Werte gespeichert werden sollen * @param rex_sql $sqlFields rex_sql-objekt, dass die zu verarbeitenden Felder enthält */ public static function fetchRequestValues(&$params, &$sqlSave, $sqlFields) { if (rex_request_method() != 'post') { return; } for ($i = 0; $i < $sqlFields->getRows(); $i++, $sqlFields->next()) { $fieldName = $sqlFields->getValue('name'); $fieldType = $sqlFields->getValue('type_id'); $fieldAttributes = $sqlFields->getValue('attributes'); // dont save restricted fields $attrArray = rex_string::split($fieldAttributes); if (isset($attrArray['perm'])) { if (!rex::getUser()->hasPerm($attrArray['perm'])) { continue; } unset($attrArray['perm']); } // Wert in SQL zum speichern $saveValue = self::getSaveValue($fieldName, $fieldType, $fieldAttributes); $sqlSave->setValue($fieldName, $saveValue); // Werte im aktuellen Objekt speichern, dass zur Anzeige verwendet wird if (isset($params['activeItem'])) { $params['activeItem']->setValue($fieldName, $saveValue); } } }
/** * Erstellt eine Clang * * @param $id Id der Clang * @param $name Name der Clang */ function rex_addCLang($id, $name) { global $REX; $REX['CLANG'][$id] = $name; $content = "// --- DYN\n\r"; foreach ($REX['CLANG'] as $cur => $val) { $content .= "\n\r\$REX['CLANG']['{$cur}'] = \"{$val}\";"; } $content .= "\n\r// --- /DYN"; $file = $REX['INCLUDE_PATH'] . "/clang.inc.php"; $h = fopen($file, "r"); $fcontent = fread($h, filesize($file)); $fcontent = ereg_replace("(\\/\\/.---.DYN.*\\/\\/.---.\\/DYN)", $content, $fcontent); fclose($h); $h = fopen($file, "w+"); fwrite($h, $fcontent, strlen($fcontent)); fclose($h); @chmod($file, 0777); $add = new rex_sql(); $add->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where clang='0'"); $fields = $add->getFieldnames(); $adda = new rex_sql(); // $adda->debugsql = 1; for ($i = 0; $i < $add->getRows(); $i++) { $adda->setTable($REX['TABLE_PREFIX'] . "article"); foreach ($fields as $key => $value) { if ($value == 'pid') { echo ''; } else { if ($value == 'clang') { $adda->setValue('clang', $id); } else { if ($value == 'status') { $adda->setValue('status', '0'); } else { $adda->setValue($value, rex_addslashes($add->getValue($value))); } } } } $adda->insert(); $add->next(); } $add = new rex_sql(); $add->setQuery("insert into " . $REX['TABLE_PREFIX'] . "clang set id='{$id}',name='{$name}'"); // ----- EXTENSION POINT rex_register_extension_point('CLANG_ADDED', '', array('id' => $id, 'name' => $name)); rex_generateAll(); }
public function getDataListQuery($rex_xform_filter = array(), $searchObject) { global $REX; $sql = 'select * from ' . $this->table->getTablename() . ' t0'; $sql_felder = new rex_sql(); $sql_felder->setQuery('SELECT * FROM ' . rex_xform_manager_field::table() . ' WHERE table_name="' . $this->table->getTablename() . '" AND type_id="value" ORDER BY prio'); $max = $sql_felder->getRows(); if ($max > 0) { $existingFields = array_map(function ($column) { return $column['name']; }, rex_sql::showColumns($this->table->getTablename())); $fields = array(); for ($i = 0; $i < $sql_felder->getRows(); $i++) { if (in_array($sql_felder->getValue('name'), $existingFields)) { $fields[] = '`' . $sql_felder->getValue('name') . '`'; } else { $fields[] = 'NULL AS `' . $sql_felder->getValue('name') . '`'; } $sql_felder->next(); } $sql = 'select `id`,' . implode(',', $fields) . ' from `' . $this->table->getTablename() . '` t0'; } $sql .= $this->getDataListQueryWhere($rex_xform_filter, $searchObject); if ($this->table->getSortFieldName() != "") { $sql .= ' ORDER BY `' . $this->table->getSortFieldName() . '` ' . $this->table->getSortOrderName(); } $sql = rex_register_extension_point('XFORM_DATA_LIST_SQL', $sql, array('table' => $this->table)); return $sql; }
if ($gaa->getRows() > 0) { $gma = new rex_sql(); $gma->setQuery("SELECT * FROM " . $REX['TABLE_PREFIX'] . "module_action, " . $REX['TABLE_PREFIX'] . "action WHERE " . $REX['TABLE_PREFIX'] . "module_action.action_id=" . $REX['TABLE_PREFIX'] . "action.id and " . $REX['TABLE_PREFIX'] . "module_action.module_id='{$modul_id}'"); $actions = ''; for ($i = 0; $i < $gma->getRows(); $i++) { $iaction_id = $gma->getValue($REX['TABLE_PREFIX'] . 'module_action.id'); $action_id = $gma->getValue($REX['TABLE_PREFIX'] . 'module_action.action_id'); $action_edit_url = 'index.php?page=module&subpage=actions&action_id=' . $action_id . '&function=edit'; $action_name = rex_translate($gma->getValue('name')); $actions .= '<tr> <td class="rex-icon"><a href="' . $action_edit_url . '"><img src="media/modul.gif" width="16" height="16" alt="' . htmlspecialchars($action_name) . '" title="' . htmlspecialchars($action_name) . '" /></a></td> <td class="rex-icon">' . $gma->getValue("id") . '</td> <td><a href="' . $action_edit_url . '">' . $action_name . '</a></td> <td><a href="index.php?page=module&modul_id=' . $modul_id . '&function_action=delete&function=edit&iaction_id=' . $iaction_id . '" onclick="return confirm(\'' . $I18N->msg('delete') . ' ?\')">' . $I18N->msg('action_delete') . '</a></td> </tr>'; $gma->next(); } if ($actions != '') { $actions = ' <table class="rex-table" summary="' . $I18N->msg('actions_added_summary') . '"> <caption>' . $I18N->msg('actions_added_caption') . '</caption> <colgroup> <col width="40" /> <col width="40" /> <col width="*" /> <col width="153" /> </colgroup> <thead> <tr> <th class="rex-icon"> </th> <th class="rex-icon">ID</th>
$previewmode[] = $value; } } foreach (array(1 => 'ADD', 2 => 'EDIT', 4 => 'DELETE') as $var => $value) { if (($sql->getValue('presavemode') & $var) == $var) { $presavemode[] = $value; } } foreach (array(1 => 'ADD', 2 => 'EDIT', 4 => 'DELETE') as $var => $value) { if (($sql->getValue('postsavemode') & $var) == $var) { $postsavemode[] = $value; } } echo ' <tr> <td class="rex-icon"><a class="rex-i-element rex-i-action" href="index.php?page=module&subpage=actions&action_id=' . $sql->getValue("id") . '&function=edit" title="' . htmlspecialchars($sql->getValue("name")) . '"><span class="rex-i-element-text">' . htmlspecialchars($sql->getValue("name")) . '</span></a></td> <td class="rex-small">' . $sql->getValue("id") . '</td> <td><a href="index.php?page=module&subpage=actions&action_id=' . $sql->getValue("id") . '&function=edit">' . htmlspecialchars($sql->getValue("name")) . '</a></td> <td>' . implode('/', $previewmode) . '</td> <td>' . implode('/', $presavemode) . '</td> <td>' . implode('/', $postsavemode) . '</td> <td><a href="index.php?page=module&subpage=actions&action_id=' . $sql->getValue("id") . '&function=delete" onclick="return confirm(\'' . $I18N->msg('action_delete') . ' ?\')">' . $I18N->msg("action_delete") . '</a></td> </tr> '; $sql->next(); } echo '</tbody>' . "\n"; } echo ' </table>'; }
<?php // Stellenkategorien $query = 'SELECT interne_bezeichnung, kategorie_id ' . 'FROM ' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_kategorien ' . 'ORDER BY interne_bezeichnung'; $result = new rex_sql(); $result->setQuery($query); $num_rows = $result->getRows(); $kategorien = array(); for ($i = 0; $i < $num_rows; $i++) { $kategorien[$result->getValue("kategorie_id")] = $result->getValue("interne_bezeichnung"); $result->next(); } print 'Anzuzeigende Stellenkategorie auswählen: '; $select = new rex_select(); $select->setName('VALUE[1]'); $select->setSize(1); // Daten $select->addOption("Alle", 0); foreach ($kategorien as $key => $val) { $select->addOption($val, $key); } // Vorselektierung $select->setSelected("REX_VALUE[1]"); echo $select->show(); ?> <p><br />Alle weiteren Änderungen bitte im <a href="index.php?page=d2u_stellenmarkt">Stellenmarkt Addon</a> vornehmen.</p>
<!-- *** OUTPUT ARTICLES - START *** -->'; // --------------------- READ TEMPLATES if ($category_id > -1) { $TEMPLATES = new rex_sql(); $TEMPLATES->setQuery('select * from ' . $REX['TABLE_PREFIX'] . 'template order by name'); $TMPL_SEL = new rex_select(); $TMPL_SEL->setName('template_id'); $TMPL_SEL->setId('template_id'); $TMPL_SEL->setSize(1); $TMPL_SEL->addOption($I18N->msg('option_no_template'), '0'); for ($i = 0; $i < $TEMPLATES->getRows(); $i++) { if ($TEMPLATES->getValue('active') == 1) { $TMPL_SEL->addOption(rex_translate($TEMPLATES->getValue('name')), $TEMPLATES->getValue('id')); } $TEMPLATE_NAME[$TEMPLATES->getValue('id')] = rex_translate($TEMPLATES->getValue('name')); $TEMPLATES->next(); } $TEMPLATE_NAME[0] = $I18N->msg('template_default_name'); // --------------------- ARTIKEL LIST if (isset($amessage) and $amessage != '') { echo rex_warning($amessage); } $art_add_link = ''; if ($KATPERM && !$REX_USER->hasPerm('editContentOnly[]')) { $art_add_link = '<a href="index.php?page=structure&category_id=' . $category_id . '&function=add_art&clang=' . $clang . '"' . rex_accesskey($I18N->msg('article_add'), $REX['ACKEY']['ADD_2']) . '><img src="media/document_plus.gif" alt="' . $I18N->msg('article_add') . '" /></a>'; } $add_head = ''; $add_col = ''; if ($REX_USER->hasPerm('advancedMode[]')) { $add_head = '<th class="rex-icon">' . $I18N->msg('header_id') . '</th>'; $add_col = '<col width="40" />';
function regenerateArticlesByModultypId($modules) { global $PHP_SELF, $module_id, $FORM, $REX_USER, $REX, $I18N; include_once $REX[INCLUDE_PATH] . "/clang.inc.php"; $modules = explode("__", $modules); array_pop($modules); $gc = new rex_sql(); foreach ($modules as $modul_id) { $gc->setQuery("SELECT DISTINCT(" . $REX['TABLE_PREFIX'] . "article.id) FROM " . $REX['TABLE_PREFIX'] . "article\n \t LEFT JOIN " . $REX['TABLE_PREFIX'] . "article_slice ON " . $REX['TABLE_PREFIX'] . "article.id=" . $REX['TABLE_PREFIX'] . "article_slice.article_id\n \t WHERE " . $REX['TABLE_PREFIX'] . "article_slice.modultyp_id='{$modul_id}'"); for ($i = 0; $i < $gc->getRows(); $i++) { rex_generateArticle($gc->getValue($REX['TABLE_PREFIX'] . "article.id")); $gc->next(); } } }
function init() { global $REX, $I18N_META_INFOS; // ----- EXTENSION POINT // IDs aller Feldtypen bei denen das Parameter-Feld eingeblendet werden soll $typeFields = rex_register_extension_point('A62_TYPE_FIELDS', array(REX_A62_FIELD_SELECT, REX_A62_FIELD_RADIO, REX_A62_FIELD_CHECKBOX)); $field =& $this->addReadOnlyField('prefix', $this->metaPrefix); $field->setLabel($I18N_META_INFOS->msg('field_label_prefix')); $field =& $this->addTextField('name'); $field->setLabel($I18N_META_INFOS->msg('field_label_name')); $field =& $this->addSelectField('prior'); $field->setLabel($I18N_META_INFOS->msg('field_label_prior')); $select =& $field->getSelect(); $select->setSize(1); $select->addOption($I18N_META_INFOS->msg('field_first_prior'), 1); // Im Edit Mode das Feld selbst nicht als Position einfügen $qry = 'SELECT name,prior FROM ' . $this->tableName . ' WHERE `name` LIKE "' . $this->metaPrefix . '%"'; if ($this->isEditMode()) { $qry .= ' AND field_id != ' . $this->getParam('field_id'); } $qry .= ' ORDER BY prior'; $sql = new rex_sql(); $sql->setQuery($qry); for ($i = 0; $i < $sql->getRows(); $i++) { $select->addOption($I18N_META_INFOS->msg('field_after_prior', $sql->getValue('name')), $sql->getValue('prior') + 1); $sql->next(); } $field =& $this->addTextField('title'); $field->setLabel($I18N_META_INFOS->msg('field_label_title')); $field->setNotice($I18N_META_INFOS->msg('field_notice_title')); $field =& $this->addSelectField('type'); $field->setLabel($I18N_META_INFOS->msg('field_label_type')); $field->setAttribute('onchange', 'checkConditionalFields(this, new Array(' . implode(',', $typeFields) . '));'); $select =& $field->getSelect(); $select->setSize(1); $qry = 'SELECT label,id FROM ' . $REX['TABLE_PREFIX'] . '62_type'; if ($this->metaPrefix == 'med_') { $qry .= ' WHERE label NOT LIKE "REX_MEDIA%"'; } $select->addSqlOptions($qry); $notices = ''; for ($i = 1; $i < REX_A62_FIELD_COUNT; $i++) { if ($I18N_META_INFOS->hasMsg('field_params_notice_' . $i)) { $notices .= '<span class="rex-notice" id="a62_field_params_notice_' . $i . '" style="display:none">' . $I18N_META_INFOS->msg('field_params_notice_' . $i) . '</span>' . "\n"; } } $notices .= ' <script type="text/javascript"> var needle = new getObj("' . $field->getAttribute('id') . '"); checkConditionalFields(needle.obj, new Array(' . implode(',', $typeFields) . ')); </script>'; $field =& $this->addTextAreaField('params'); $field->setLabel($I18N_META_INFOS->msg('field_label_params')); $field->setSuffix($notices); $field =& $this->addTextAreaField('attributes'); $field->setLabel($I18N_META_INFOS->msg('field_label_attributes')); $notice = '<span class="rex-notice" id="a62_field_attributes_notice">' . $I18N_META_INFOS->msg('field_attributes_notice') . '</span>' . "\n"; $field->setSuffix($notice); $field =& $this->addTextField('default'); $field->setLabel($I18N_META_INFOS->msg('field_label_default')); // $field =& $this->addTextAreaField('validate'); // $field->setLabel($I18N_META_INFOS->msg('field_label_validate')); }
// rechte sind vorhanden // ctype beachten // verschieben / vertauschen // article regenerieren. $slice_id = $CM->getValue($REX['TABLE_PREFIX'] . "article_slice.id"); $slice_article_id = $CM->getValue("article_id"); $re_slice_id = $CM->getValue($REX['TABLE_PREFIX'] . "article_slice.re_article_slice_id"); $slice_ctype = $CM->getValue($REX['TABLE_PREFIX'] . "article_slice.ctype"); $gs = new rex_sql(); // $gs->debugsql = 1; $gs->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article_slice where article_id='{$slice_article_id}'"); for ($i = 0; $i < $gs->getRows(); $i++) { $SID[$gs->getValue("re_article_slice_id")] = $gs->getValue("id"); $SREID[$gs->getValue("id")] = $gs->getValue("re_article_slice_id"); $SCTYPE[$gs->getValue("id")] = $gs->getValue("ctype"); $gs->next(); } $message = $I18N->msg('slice_moved_error'); // ------ moveup if ($function == "moveup") { if ($SREID[$slice_id] > 0) { if ($SCTYPE[$SREID[$slice_id]] == $slice_ctype) { $gs->setQuery("update " . $REX['TABLE_PREFIX'] . "article_slice set re_article_slice_id='" . $SREID[$SREID[$slice_id]] . "' where id='" . $slice_id . "'"); $gs->setQuery("update " . $REX['TABLE_PREFIX'] . "article_slice set re_article_slice_id='" . $slice_id . "' where id='" . $SREID[$slice_id] . "'"); if ($SID[$slice_id] > 0) { $gs->setQuery("update " . $REX['TABLE_PREFIX'] . "article_slice set re_article_slice_id='" . $SREID[$slice_id] . "' where id='" . $SID[$slice_id] . "'"); } $message = $I18N->msg('slice_moved'); rex_generateArticle($slice_article_id); } }
<?php // title: Test für das Backend // Zugriff auf Usertabelle $_sql = new rex_sql(); $_result = $_sql->setQuery('SELECT login,name,description,session_id FROM ' . $REX['TABLE_PREFIX'] . 'user WHERE session_id <> "" ORDER BY login ASC '); echo '<h1>Angemeldete Benutzer</h1>'; echo '<ul>'; for ($i = 0; $i < $_sql->getRows(); $i++) { echo '<li>' . $_sql->getValue('login') . ': ' . $_sql->getValue('name') . ' ' . $_sql->getValue('description') . '</li>'; $_sql->next(); } echo '</ul>';
// $nl->setQuery('select * from rex_com_user where newsletter_last_id<>"'.$nl_id.'" and email<>"" and newsletter=1 LIMIT 50'); $nl->setQuery('select * from rex_com_user where newsletter_last_id<>"' . $nl_id . '" and email<>"" and newsletter=1 and profile=' . $nl_filter_profile . ' and status=' . $nl_filter_status . ' LIMIT 50'); if ($nl->getRows() > 0) { $i = "" . date("H:i:s") . "h Bitte noch nicht abbrechen. Automatischer Reload. Es werden noch weitere E-Mails versendet"; ?> <script> function win_reload(){ window.location.reload(); } setTimeout("win_reload()",5000); // Millisekunden 1000 = 1 Sek * 80 </script><?php $i .= "<br />An folgende E-Mails wurde der Newsletter versendet: "; $up = new rex_sql(); foreach ($nl->getArray() as $userinfo) { $i .= ", " . $userinfo["email"]; $up->setQuery('update rex_com_user set newsletter_last_id="' . $nl_id . '" where id=' . $userinfo["id"]); $r = rex_newsletter_sendmail($userinfo, $nl_from_email, $nl_from_name, $nl_subject, $nl_body_text, $nl_body_html); $nl->next(); } $info[] = $i; } else { $info[] = "Alle eMails wurden verschickt"; } } // ---------- Fehlermeldungen if (count($error) > 0) { foreach ($error as $e) { echo rex_warning($e); } } if (count($info) > 0) { foreach ($info as $i) { echo rex_info($i);
/** * Erstellt einen SQL Dump, der die aktuellen Datebankstruktur darstellt * @return string SQL Dump der Datenbank */ function rex_a1_export_db() { global $REX; $tabs = new rex_sql(); $tabs->setquery('SHOW TABLES'); $dump = ''; // ----- EXTENSION POINT rex_register_extension_point('A1_BEFORE_DB_EXPORT'); for ($i = 0; $i < $tabs->rows; $i++, $tabs->next()) { $tab = $tabs->getValue('Tables_in_' . $REX['DB']['1']['NAME']); if (strstr($tab, $REX['TABLE_PREFIX']) == $tab && $tab != $REX['TABLE_PREFIX'] . 'user' && substr($tab, 0, strlen($REX['TABLE_PREFIX'] . $REX['TEMP_PREFIX'])) != $REX['TABLE_PREFIX'] . $REX['TEMP_PREFIX']) { $cols = new rex_sql(); $cols->setquery("SHOW COLUMNS FROM `" . $tab . "`"); $query = "DROP TABLE IF EXISTS `" . $tab . "`;\nCREATE TABLE `" . $tab . "` ("; // Spalten auswerten for ($j = 0; $j < $cols->rows; $j++) { $colname = $cols->getValue('Field'); $coltype = $cols->getValue('Type'); // Null Werte if ($cols->getValue('Null') == 'YES') { $colnull = 'NULL'; } else { $colnull = 'NOT NULL'; } // Default Werte if ($cols->getValue('Default') != '') { $coldef = 'DEFAULT \'' . str_replace("'", "\\'", $cols->getValue('Default')) . '\''; } else { $coldef = ''; } // Spezial Werte $colextra = $cols->getValue('Extra'); $query .= " `{$colname}` {$coltype} {$colnull} {$coldef} {$colextra}"; if ($j + 1 != $cols->rows) { $query .= ","; } $cols->next(); } // Indizes Auswerten $indizes = new rex_sql(); $indizes->setQuery('SHOW INDEX FROM `' . $tab . '`'); $primary = array(); $uniques = array(); $fulltexts = array(); for ($x = 0; $x < $indizes->getRows(); $x++) { if ($indizes->getValue('Index_type') == 'BTREE') { if ($indizes->getValue('Key_name') != 'PRIMARY') { $uniques[$indizes->getValue('Key_name')][] = $indizes->getValue('Column_name'); } else { $primary[$indizes->getValue('Key_name')][] = $indizes->getValue('Column_name'); } } else { if ($indizes->getValue('Index_type') == 'FULLTEXT') { $fulltexts[$indizes->getValue('Key_name')][] = $indizes->getValue('Column_name'); } } $indizes->next(); } // Primary key Auswerten foreach ($primary as $name => $columnNames) { // , UNIQUE KEY `name` (`spalten`,..) $query .= ", PRIMARY KEY (`" . implode('`,`', $columnNames) . "`)"; } // Unique Index Auswerten foreach ($uniques as $name => $columnNames) { // , UNIQUE KEY `name` (`spalten`,..) $query .= ", UNIQUE KEY `" . $name . "`(`" . implode('`,`', $columnNames) . "`)"; } // Unique Index Auswerten foreach ($fulltexts as $name => $columnNames) { // , FULLTEXT KEY `name` (`spalten`,..) $query .= ", FULLTEXT KEY `" . $name . "`(`" . implode('`,`', $columnNames) . "`)"; } $query .= ") TYPE=MyISAM;"; $dump .= $query . "\n"; // Inhalte der Tabelle Auswerten $cont = new rex_sql(); $cont->setquery("SELECT * FROM `" . $tab . "`"); for ($j = 0; $j < $cont->rows; $j++, $cont->next()) { $query = "INSERT INTO `" . $tab . "` VALUES ("; $cols->counter = 0; for ($k = 0; $k < $cols->rows; $k++, $cols->next()) { $con = $cont->getValue($cols->getValue("Field")); if (is_numeric($con)) { $query .= "'" . $con . "'"; } else { $query .= "'" . addslashes($con) . "'"; } if ($k + 1 != $cols->rows) { $query .= ","; } } $query .= ");"; $dump .= str_replace(array("\r\n", "\n"), '\\r\\n', $query) . "\n"; } } } // Versionsstempel hinzufügen $dump = str_replace("\r", "", $dump); $header = "## Redaxo Database Dump Version " . $REX['VERSION'] . "\n"; $header .= "## Prefix " . $REX['TABLE_PREFIX'] . "\n"; $content = $header . $dump; // ----- EXTENSION POINT $content = rex_register_extension_point('A1_AFTER_DB_EXPORT', $content); return $content; }