/**
 * Glossar Addon
 * <
 * @author staab[at]public-4u[dot]de Markus Staab
 * @author <a href="http://www.public-4u.de">www.public-4u.de</a>
 * @package redaxo3
 * @version $Id: function_replace.inc.php,v 1.4 2008/01/25 09:48:36 kills Exp $
 */
function rex_glossar_replace($params)
{
    global $REX, $mypage, $I18N_GLOSSAR;
    $string = $params['subject'];
    // Aufteilen des Strings, damit nur im Body ersetzt wird
    $bodystart = strpos($string, '<body>');
    $header = substr($string, 0, $bodystart);
    $body = substr($string, $bodystart);
    // Bereiche ersetzen, in denen keine Glossar ersetzungen durchgeführt werden sollen
    // welche nicht innerhalb des Tags sind
    $back_srch = array();
    $back_rplc = array();
    $mtchs = array();
    if (preg_match_all('/(<textarea.*?>(.*?)<\\/textarea>)/s', $body, $mtchs)) {
        foreach ($mtchs[2] as $key => $mtch) {
            $back_srch[$key] = '###SPACER###' . $key . '###';
            $back_rplc[$key] = $mtch;
            $body = str_replace($mtch, '###SPACER###' . $key . '###', $body);
        }
    }
    $sql = new sql();
    //$sql->debugsql = true;
    $sql->setQuery('SELECT * FROM rex_13_glossar, rex_13_glossar_lang WHERE language = lang_id ORDER BY CHAR_LENGTH(shortcut) DESC');
    // IE doesnt support <abbr>
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
        $replacetag = 'acronym';
    } else {
        $replacetag = 'abbr';
    }
    $replaceformat = '<' . $replacetag . ' class=\\"abbr\\" title=\\"%desc% (%lang%)\\">%short%</' . $replacetag . '>';
    $searches = array();
    $replaces = array();
    for ($i = 0; $i < $sql->getRows(); $i++) {
        $language = htmlspecialchars($sql->getValue('lang_name'));
        $shortcut = htmlspecialchars($sql->getValue('shortcut'));
        $description = htmlspecialchars($sql->getValue('description'));
        $casesense = $sql->getValue('casesense');
        // Escape Shortcut for preg_match
        $escapedshortcut = preg_quote($shortcut, '/');
        $escapedentitiesshortuct = htmlentities($escapedshortcut);
        if ($escapedentitiesshortuct == $escapedshortcut) {
            $search = '/((<[^>]*)|' . $escapedshortcut . ')/e';
        } else {
            $search = '/((<[^>]*)|' . $escapedshortcut . '|' . $escapedentitiesshortuct . ')/e';
        }
        $replacer = _rex_glossar_parse_replace_format($replaceformat, array('lang' => $language, 'desc' => $description, 'short' => $shortcut));
        $replace = '"\\2"=="\\1" && strpos( "\\1", "<' . $replacetag . '>") === false ? "\\1":"' . $replacer . '"';
        if ($casesense == 0) {
            $search .= 'i';
        }
        $searches[] = $search;
        $replaces[] = $replace;
        $sql->next();
    }
    // Ersetzungen durchführen
    $body = stripslashes(preg_replace($searches, $replaces, $body));
    // Vorher ausgeschlossene Bereiche wieder einpflegen
    $body = str_replace($back_srch, $back_rplc, $body);
    return $header . $body;
}
function rex_opf_sync()
{
    global $REX;
    // abgleich der replacevalue felder..
    $s = new sql();
    // $s->debugsql = 1;
    $s->setQuery("select clang, replacename, name, count(replacename) from rex_opf_lang group by replacename");
    for ($i = 0; $i < $s->getRows(); $i++) {
        if (count($REX['CLANG']) != $s->getValue("count(replacename)")) {
            reset($REX['CLANG']);
            while (list($key, $val) = each($REX['CLANG'])) {
                $lclang = $key;
                $replacename = $s->getValue("replacename");
                $name = $s->getValue("name");
                $gs = new sql();
                $gs->setQuery("select clang from rex_opf_lang where clang={$lclang} and replacename='{$replacename}'");
                if ($gs->getRows() == 0) {
                    // erstelle
                    $us = new sql();
                    $us->setTable("rex_opf_lang");
                    $us->setValue("clang", $lclang);
                    $us->setValue("replacename", $replacename);
                    $us->setValue("name", $name);
                    $us->insert();
                }
            }
        }
        $s->next();
    }
}
Beispiel #3
0
 function glossar_replace($string)
 {
     global $REX, $mypage;
     $I18N_GLOSSAR = new i18n($REX[LANG], $REX[INCLUDE_PATH] . "/addons/{$mypage}/lang/");
     // CREATE LANG OBJ FOR THIS ADDON
     $sql = new sql();
     $sql->setQuery("select * from rex__glossar order by shortcut");
     for ($i = 0; $i < $sql->getRows(); $i++) {
         $language = $sql->getValue("language");
         if ($language == "0") {
             $language = $I18N_GLOSSAR->msg('lang_de_short');
         } elseif ($language == "1") {
             $language = $I18N_GLOSSAR->msg('lang_en_short');
         } else {
             $language = $I18N_GLOSSAR->msg('lang_fr_short');
         }
         $id = $sql->getValue("short_id");
         $shortcut = htmlentities($sql->getValue("shortcut"));
         $escapedshortcut = str_replace('.', '\\.', $shortcut);
         $description = htmlentities($sql->getValue("description"));
         $language = trim($language);
         $casesense = $sql->getValue("casesense");
         $search = "/((<[^>]*)|{$escapedshortcut})/e";
         $replace = '"\\2"=="\\1"? "\\1":"<span lang=\\"' . $language . '\\" xml:lang=\\"' . $language . '\\" title=\\"' . $language . ': ' . $description . '\\" class=\\"shortcut\\">' . $shortcut . '</span>"';
         $subject = $string;
         if ($casesense == 0) {
             $search .= 'i';
         }
         $string = preg_replace($search, $replace, $subject);
         $sql->counter++;
     }
     return $string;
 }
 function rex_opf($params)
 {
     global $REX;
     $content = $params['subject'];
     $gv = new sql();
     // $gv->debugsql = 1;
     $gv->setQuery("select * from rex_opf_lang where clang='" . $REX['CUR_CLANG'] . "'");
     for ($i = 0; $i < $gv->getRows(); $i++) {
         $content = str_replace($gv->getValue("replacename"), $gv->getValue("name"), $content);
         $gv->next();
     }
     return $content;
 }
 static function getUpdateDate($format = 'd.m.Y')
 {
     global $REX;
     $query = 'SELECT updatedate FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE updatedate <> 0 ORDER BY updatedate DESC LIMIT 1';
     $sql = new sql();
     $sql->setQuery($query);
     return date($format, $sql->getValue('updatedate'));
 }
 function stat()
 {
     $this->MAIN['stamp'] = array();
     $this->MAIN['ip'] = array();
     $this->MAIN['pageviews'] = array();
     // which pages in an array under this one
     $this->MAIN['useragent'] = array();
     $this->MAIN['hostname'] = array();
     $this->MAIN['referer'] = array();
     $this->BROWSER['type'] = array();
     $this->BROWSER['os'] = array();
     $this->REFERER = array();
     $this->SEARCH['engine'] = array();
     $this->SEARCH['words'] = array();
     $this->evalshows = array("REX_EVAL_DAY", "REX_EVAL_MONTH", "REX_EVAL_ALLARTICLE", "REX_EVAL_TOP10ARTICLE", "REX_EVAL_WORST10ARTICLE", "REX_EVAL_LAENDER", "REX_EVAL_SUCHMASCHINEN", "REX_EVAL_REFERER", "REX_EVAL_BROWSER", "REX_EVAL_OPERATINGSYSTEM", "REX_EVAL_SEARCHWORDS");
     $this->evalsnipps = array();
     $statartikel = new sql();
     $statartikel->setQuery("SELECT id,name FROM rex_article");
     for ($i = 0; $i < $statartikel->getRows(); $i++) {
         $this->ART[$statartikel->getValue("id")] = $statartikel->getValue("name");
         $statartikel->next();
     }
 }
 /**
  * Gibt den HTML Content zurück
  */
 function get()
 {
     $table = $this->getTable();
     $field = $this->getField();
     $foreignField = $this->getForeignField();
     $value = $this->formatValue();
     $qry = 'SELECT ' . $field . ' FROM ' . $table . ' WHERE ' . $foreignField . ' = "' . $value . '"';
     $sql = new sql();
     // $sql->debugsql = true;
     $sql->setQuery($qry);
     if ($sql->getRows() == 1) {
         return $sql->getValue($field);
     }
     return '';
 }
 function getArticlesByType($article_type_id, $ignore_offlines = false, $clang = false)
 {
     global $REX;
     if ($clang === false) {
         $clang = $REX[CUR_CLANG];
     }
     $offline = $ignore_offlines ? " and status = 1 " : "";
     $artlist = array();
     $sql = new sql();
     $sql->setQuery("select " . implode(',', OORedaxo::getClassVars()) . " FROM rex_article WHERE type_id = '{$article_type_id}' AND clang='{$clang}' {$offline}");
     for ($i = 0; $i < $sql->getRows(); $i++) {
         foreach (OORedaxo::getClassVars() as $var) {
             $article_data['_' . $var] = $sql->getValue($var);
         }
         $artlist[] = new OOArticle($article_data);
         $sql->next();
     }
     return $artlist;
 }
 function showall($next)
 {
     global $REX;
     // ------------- FALLS KEIN ROWSELECT ALLE DATENSAETZE HOLEN UND ANZAHL SETZEN
     if ($this->rows == "") {
         $this->sql = new sql($this->DB);
         $this->sql->setQuery($this->query);
         $this->rows = $this->sql->getRows();
     }
     $echo = "<table width=770 cellpadding=5 cellspacing=1 border=0 bgcolor=#ffffff>";
     $echo .= $this->table_header;
     // ------------- BLAETTERN
     if (!($next > 0 && $next <= $this->rows)) {
         $next = 0;
     }
     $list_start = $next;
     $list_end = $next + $this->list_amount;
     if ($list_end > $this->rows) {
         $list_end = $this->rows;
     }
     $before = $next - $this->list_amount;
     if ($before < 0) {
         $before = 0;
     }
     $next = $next + $this->list_amount;
     if ($next > $this->rows) {
         $next = $next - $this->list_amount;
     }
     if ($next < 0) {
         $next = 0;
     }
     $bhead = $this->blaettern_head;
     $bhead = str_replace("###LINK_BACK###", $this->addonlink . $before, $bhead);
     $bhead = str_replace("###LINK_NEXT###", $this->addonlink . $next, $bhead);
     $bhead = str_replace("###LIST_START###", $list_start, $bhead);
     $bhead = str_replace("###LIST_END###", $list_end, $bhead);
     $bhead = str_replace("###LIST_ALL###", $this->rows, $bhead);
     if ($this->blaettern_top) {
         $echo .= "<tr><td colspan=" . $this->data_num . " class=lgrey>{$bhead}</td></tr>";
     }
     // ------------ QUERY NEU ERSTELLEN MIT LIMIT
     $limit = "LIMIT " . $list_start . "," . $this->list_amount;
     $order = "";
     if ($this->order_name != "") {
         $order = " order by " . $this->order_name . " " . $this->order_type;
     } elseif ($this->default_order_name != "") {
         $order = " order by " . $this->default_order_name . " " . $this->default_order_type;
     }
     $SQL = new sql($this->DB);
     $SQL->debugsql = $this->debugsql;
     $SQL->setQuery("{$this->query} {$order} {$limit}");
     // ------------ <TH>HEADLINES
     $echo .= "<tr>";
     for ($i = 1; $i <= $this->data_num; $i++) {
         $echo .= "<th>";
         if ($this->data_order[$i]) {
             $type = $this->order_type;
             if ($type == "asc") {
                 $type = "desc";
             } else {
                 $type = "asc";
             }
             $echo .= " <a href=" . $this->addonlink . "&" . $this->var_ordername . "=" . $this->data[$i] . "&" . $this->var_ordertype . "=" . $type . "&" . $this->var_next . "={$before}><b>" . $this->data_name[$i] . "</b>" . $this->sort_char . "</a>";
         } else {
             $echo .= $this->data_name[$i];
         }
         $echo .= "</th>";
     }
     $echo .= "</tr>";
     // ------------ ERSTELLUNG DER LISTE
     for ($j = 0; $j < $SQL->getRows(); $j++) {
         for ($i = 1; $i <= $this->data_num; $i++) {
             // ----- START: DATENSATZ
             $echo .= "<td class=grey valign=top " . $this->td[$this->data_num] . ">";
             // ----- START: FORMAT
             if (!is_array($this->format[$i])) {
                 $value = htmlentities($SQL->getValue($this->data[$i]));
             } else {
                 $value = $SQL->getValue($this->data[$i]);
                 $contentvalue = $this->data[$i];
                 for ($k = 0; $k < count($this->format[$i]); $k++) {
                     switch ($this->format[$i][$k]) {
                         case "link":
                             $linkid = $SQL->getValue($this->format_value2[$i][$k]);
                             $value = '<a href="' . $this->format_value1[$i][$k] . $linkid . $this->format_value3[$i][$k] . '" ' . $this->format_value4[$i][$k] . '>' . $value . '</a>';
                             break;
                         case "ifvalue":
                             if ($value == $this->format_value1[$i][$k]) {
                                 $value = $this->format_value2[$i][$k];
                             }
                             break;
                         case "ifempty":
                             if ($value == "") {
                                 $value = $this->format_value1[$i][$k];
                             }
                             break;
                         case "prefix":
                             $value = $this->format_value1[$i][$k] . "{$value}";
                             break;
                         case "suffix":
                             $value = "{$value}" . $this->format_value1[$i][$k];
                             break;
                         case "callback":
                             $value = call_user_func($this->format_value1[$i][$k], $value);
                             break;
                         case "activestatus":
                             if ($value == 0) {
                                 $value = "inactive";
                             } else {
                                 $value = "active";
                             }
                             break;
                         case "status":
                             if ($value == 0) {
                                 $value = "inactive user";
                             } elseif ($value == 7) {
                                 $value = "superadmin";
                             } elseif ($value > 4) {
                                 $value = "admin";
                             } elseif ($value == 1) {
                                 $value = "guest";
                             } else {
                                 $value = "user";
                             }
                             break;
                         case "dt":
                             $dt = $this->format_value1[$i][$k];
                             if ($dt == "") {
                                 $dt = "M-d Y H:i:s";
                             }
                             $value = date_from_mydate($value, $dt);
                             break;
                         case "hour":
                             $value = $value . " h";
                             break;
                         case "minutes":
                             $value = "{$value} min";
                             break;
                         case "minute2hour":
                             $hours = intval($value / 60);
                             $minutes = ($value - $hours * 60) / 60 * 100;
                             if ($minutes < 10) {
                                 $minutes = "0{$minutes}";
                             } elseif ($minutes == 0) {
                                 $minutes = "00";
                             }
                             $value = "{$hours},{$minutes}";
                             break;
                         case "date":
                             $format = $this->format_value1[$i][$k];
                             if ($format == "") {
                                 $format = "d.M.Y H:i:s";
                             }
                             $value = date_from_mydate($value, $format);
                             break;
                         case "time":
                             $value = substr($value, 0, 2) . ":" . substr($value, 2, 2) . "";
                             break;
                         case "unixToDateTime":
                             $format = $this->format_value1[$i][$k];
                             if ($format == "") {
                                 $format = "d.M.Y H:i:s";
                             }
                             $value = date($format, $value);
                             break;
                         case "nl2br":
                             $value = nl2br($value);
                             break;
                         case "prozent":
                             $value = "<img src=/pics/p_prozent/" . show_prozent($value) . ".gif height=13 width=50>";
                             break;
                         case "wrap":
                             $value = $this->format_value1[$i][$k] . $value . $this->format_value2[$i][$k];
                             break;
                         case "addfield":
                             $value = $value . $this->format_value2[$i][$k] . $SQL->getValue($this->format_value1[$i][$k]) . $this->format_value3[$i][$k];
                             break;
                         case "clear":
                             $value = "";
                             break;
                         case "substr":
                             $elements = imap_mime_header_decode($value);
                             $value = "";
                             for ($l = 0; $l < count($elements); $l++) {
                                 // echo "Charset: {$elements[$i]->charset}\n";
                                 $value .= $elements[$l]->text;
                             }
                             $value = substr($value, 0, $this->format_value1[$i][$k]);
                             $value = htmlentities($value);
                             break;
                         case "content":
                             $value = $contentvalue;
                             break;
                         case "size":
                             $value = "<div style='text-align:right;width:auto;'>" . $this->human_file_size($value) . "</div>";
                             break;
                         case "js":
                             $elements = imap_mime_header_decode($value);
                             $value = "";
                             for ($l = 0; $l < count($elements); $l++) {
                                 // echo "Charset: {$elements[$i]->charset}\n";
                                 $value .= $elements[$l]->text;
                             }
                             if ($value == "") {
                                 $value = "<no entry>";
                             }
                             if ($this->format_value4[$i][$k] == "") {
                                 $value = substr($value, 0, 30);
                             } else {
                                 if ($this->format_value4[$i][$k] == "nosubstr") {
                                     $value = $value;
                                 } else {
                                     $value = substr($value, 0, $this->format_value4[$i][$k]);
                                 }
                             }
                             $value = nl2br(htmlentities($value));
                             $value = "<a href=javascript:" . $this->format_value1[$i][$k] . $SQL->getValue($this->format_value2[$i][$k]) . $this->format_value3[$i][$k] . ">{$value}</a>";
                             break;
                         case "boldstatus":
                             // **********************
                             // Prozer Special: MAIL
                             // zum anzeigen von bold falls TRUE(1)
                             // **********************
                             $elements = imap_mime_header_decode($value);
                             $value = "";
                             for ($l = 0; $l < count($elements); $l++) {
                                 // echo "Charset: {$elements[$i]->charset}\n";
                                 $value .= $elements[$l]->text;
                             }
                             if ($value == "") {
                                 $value = "<no subject entered>";
                             }
                             $value = substr($value, 0, 30);
                             $value = htmlentities($value);
                             //echo "<!-- ".$SQL->getValue("header")."-->";
                             if ($SQL->getValue("spam") != 0 && eregi("X-Spam-Flag: YES", $SQL->getValue("header"))) {
                                 if (!$SQL->getValue($this->format_value1[$i][$k])) {
                                     $value = "<b style=\"color:red\">{$value}</b>";
                                 } else {
                                     $value = "<span style=\"color:red\">{$value}</span>";
                                 }
                             } elseif (!$SQL->getValue($this->format_value1[$i][$k])) {
                                 $value = "<b>{$value}</b>";
                             }
                             break;
                         case "image":
                             // **********************
                             // Prozer Special
                             // zum anzeigen von bold falls TRUE(1)
                             // **********************
                             if ($SQL->getValue($this->format_value1[$i][$k]) > 0) {
                                 $value = $this->format_value2[$i][$k] . " " . htmlentities($value);
                             } else {
                                 $value = " ";
                             }
                             break;
                         case "statustodo":
                             // **********************
                             // Prozer Special
                             // zum anzeigen von bold falls TRUE(1)
                             // **********************
                             if ($value == 0) {
                                 $value = "done";
                             } elseif ($value == 1) {
                                 $value = "in work";
                             } elseif ($value == 2) {
                                 $value = "new";
                             }
                             break;
                         case "replace_value":
                             $stype = explode("|", $this->format_value1[$i][$k]);
                             $lvalue = $value;
                             $defaultvalue = -1;
                             for ($l = 0; $l < count($stype); $l++) {
                                 $svalue = $stype[$l];
                                 $l++;
                                 $sname = $stype[$l];
                                 if ($svalue === "") {
                                     $defaultvalue = $sname;
                                 }
                                 if ($lvalue == $svalue) {
                                     $lvalue = $sname;
                                 }
                             }
                             if ($lvalue == $value && $defaultvalue != -1) {
                                 $lvalue = $defaultvalue;
                             }
                             $value = $lvalue;
                             break;
                         case "checkbox":
                             $value = "<input onclick=setTRColor('tr{$j}','#f0efeb','#d8dca5',this.checked); type=checkbox name='" . $this->format_value1[$i][$k] . "' value='" . $value . "'>";
                             break;
                     }
                 }
             }
             // if ($value==""){ $value = "-"; }
             // ----- END: FORMAT
             $echo .= $value;
             $echo .= "</td>\n";
             // ----- END: DATENSATZ
         }
         $echo .= "</tr>";
         // ----- END: REIHE
         $SQL->next();
     }
     if ($this->blaettern_bottom) {
         $echo .= "<tr><td colspan=" . $this->data_num . " class=lgrey>{$bhead}</td></tr>";
     }
     $echo .= $this->table_footer;
     $echo .= "</table>";
     return $echo;
 }
 function showForm()
 {
     global $FORM, $REX;
     // --------------------------------- EDIT: 1. WERTE AUS DB HOLEN
     for ($i = 0; $i < $this->counter; $i++) {
         if ($this->value_type[$i] != "multipleselectsql") {
             if ($FORM[$this->rfid][submit] != 1 && $this->form_type == "edit") {
                 $FORM[$this->rfid][values][$i] = htmlentities($this->sql->getValue($this->value_tbl[$i]));
             } else {
                 $FORMVAL[$this->rfid][values][$i] = htmlentities($this->sql->getValue($this->value_tbl[$i]));
             }
         } else {
             $selsql = new sql();
             $selsql->setQuery("select * from " . $this->type_value5[$i] . " where " . $this->type_value6[$i]);
             for ($j = 0; $j < $selsql->getRows(); $j++) {
                 if ($FORM[$this->rfid][submit] != 1 && $this->form_type == "edit") {
                     $FORM[$this->rfid][values][$i][] = $selsql->getValue($this->type_value7[$i]);
                 } else {
                     $FORMVAL[$this->rfid][values][$i][] = $selsql->getValue($this->type_value7[$i]);
                 }
                 $selsql->next();
             }
         }
     }
     // --------------------------------- ABGESCHICKTE EINGABEN CHECKEN
     if ($FORM[$this->rfid][submit] == 1) {
         // ----------------------------- eingaben überprüfen
         $this->form_show = false;
         for ($i = 0; $i < $this->counter; $i++) {
             if ($this->value_check[$i] != "") {
                 if ($FORM[$this->rfid][values][$i] == "") {
                     $errmsg .= "Bitte tragen Sie '" . $this->value_form[$i] . "' ein! <br>";
                     $this->form_show = true;
                 }
             }
         }
     }
     // --------------------------------- EDIT: SPEICHERN FALLS MÖGLICH
     if ($FORM[$this->rfid][submit] == 1 && $this->form_type == "edit") {
         if ($errmsg == "") {
             $aa = new sql();
             $aa->debugsql = 0;
             $aa->setTable($this->tbl_name);
             $aa->where($this->form_where);
             for ($i = 0; $i < $this->counter; $i++) {
                 if ($this->value_type[$i] == "picjpg") {
                     $folder = $this->type_value1[$i];
                     $foldertmp = $REX[INCLUDE_PATH] . "/../../ss_pics/";
                     $fname = $_FILES[FORM][name][$this->rfid][values][$i];
                     if ($fname != "") {
                         // neues file
                         $nfname = $this->checkFilename($fname, $folder);
                         if ($nfname[ext] == ".jpg") {
                             $ftmpname = $_FILES[FORM][tmp_name][$this->rfid][values][$i];
                             move_uploaded_file($ftmpname, $foldertmp . $nfname[nname]);
                             $this->resizeJPGImage($foldertmp . $nfname[nname], $folder . $nfname[nname], $this->type_value3[$i], $this->type_value4[$i]);
                             $FORM[$this->rfid][values][$i] = $nfname[nname];
                             $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                         }
                     } elseif ($FORM[$this->rfid][values][$i][delete] != "") {
                         $FORM[$this->rfid][values][$i] = "";
                         $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                     } else {
                         $FORM[$this->rfid][values][$i] = $FORMVAL[$this->rfid][values][$i];
                     }
                 } elseif ($this->value_type[$i] == "file") {
                     $folder = $REX[INCLUDE_PATH] . "/../../ss_pics/";
                     $fname = $_FILES[FORM][name][$this->rfid][values][$i];
                     if ($fname != "") {
                         $nfname = $this->checkFilename($fname, $folder);
                         $ftmpname = $_FILES[FORM][tmp_name][$this->rfid][values][$i];
                         move_uploaded_file($ftmpname, $folder . $nfname[nname]);
                         $FORM[$this->rfid][values][$i] = $nfname[nname];
                         $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                     } elseif ($FORM[$this->rfid][values][$i][delete] != "") {
                         $FORM[$this->rfid][values][$i] = "";
                         $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                     } else {
                         $FORM[$this->rfid][values][$i] = $FORMVAL[$this->rfid][values][$i];
                     }
                 } elseif ($this->value_type[$i] == "multipleselectsql") {
                     // multipleselect
                     $ms = new sql();
                     $ms->query("delete from " . $this->type_value5[$i] . " where " . $this->type_value6[$i]);
                     if (is_Array($FORM[$this->rfid][values][$i])) {
                         reset($FORM[$this->rfid][values][$i]);
                         for ($j = 0; $j < count($FORM[$this->rfid][values][$i]); $j++) {
                             $val = current($FORM[$this->rfid][values][$i]);
                             $sql = "insert into " . $this->type_value5[$i] . " set " . $this->type_value6[$i] . ", " . $this->type_value7[$i] . "={$val}";
                             $ms->query($sql);
                             next($FORM[$this->rfid][values][$i]);
                         }
                     }
                 } elseif ($this->value_type[$i] == "subline" || $this->value_type[$i] == "empty") {
                 } elseif ($this->value_type[$i] == "datum") {
                     $tag = substr($FORM[$this->rfid][values][$i], 0, 2);
                     $monat = substr($FORM[$this->rfid][values][$i], 3, 2);
                     $jahr = substr($FORM[$this->rfid][values][$i], 6, 4);
                     $aa->setValue($this->value_tbl[$i], mktime(0, 0, 0, $monat, $tag, $jahr));
                 } else {
                     $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                 }
             }
             $aa->update();
             $msg = "Daten wurden gespeichert";
         } else {
             for ($i = 0; $i < $this->counter; $i++) {
                 if ($this->value_type[$i] != "multipleselectsql") {
                     $FORM[$this->rfid][values][$i] = htmlentities(stripslashes($FORM[$this->rfid][values][$i]));
                 }
             }
         }
         for ($i = 0; $i < $this->counter; $i++) {
             if ($this->value_type[$i] != "multipleselectsql") {
                 $FORM[$this->rfid][values][$i] = htmlentities(stripslashes($FORM[$this->rfid][values][$i]));
             } else {
                 // multipleselect
                 if (is_Array($FORM[$this->rfid][values][$i])) {
                     reset($FORM[$this->rfid][values][$i]);
                     for ($j = 0; $j < count($FORM[$this->rfid][values][$i]); $j++) {
                         $val = $FORM[$this->rfid][values][$i][j];
                     }
                 }
             }
         }
     }
     // --------------------------------- ADD: SPEICHERN FALLS MÖGLICH
     if ($FORM[$this->rfid][submit] == 1 && $this->form_type == "add") {
         if ($errmsg == "") {
             $aa = new sql();
             $aa->debugsql = 0;
             $aa->setTable($this->tbl_name);
             for ($i = 0; $i < $this->counter; $i++) {
                 if ($this->value_type[$i] == "datum") {
                     $tag = substr($FORM[$this->rfid][values][$i], 0, 2);
                     $monat = substr($FORM[$this->rfid][values][$i], 3, 2);
                     $jahr = substr($FORM[$this->rfid][values][$i], 6, 4);
                     $aa->setValue($this->value_tbl[$i], mktime(0, 0, 0, $monat, $tag, $jahr));
                 } elseif ($this->value_type[$i] != "multipleselectsql" && $this->value_type[$i] != "subline" && $this->value_type[$i] != "empty") {
                     $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                 }
             }
             $aa->insert();
             $msg = "Daten wurden gespeichert";
             for ($i = 0; $i < $this->counter; $i++) {
                 $FORM[$this->rfid][values][$i] = htmlentities(stripslashes($FORM[$this->rfid][values][$i]));
             }
         } else {
             for ($i = 0; $i < $this->counter; $i++) {
                 $FORM[$this->rfid][values][$i] = htmlentities(stripslashes($FORM[$this->rfid][values][$i]));
             }
         }
     }
     // --------------------------------- FORMULAR
     if ($this->form_show || $this->ShowFormAlways) {
         $ausgabe = "<table width=" . $this->width . " cellpadding=6 cellspacing=1 border=0 >";
         $ausgabe .= "<form ENCTYPE='multipart/form-data' action='" . $this->url . "' method='" . $this->method . "' name='" . $this->formname . "'>" . $this->form_header;
         $ausgabe .= "<input type=hidden name=FORM[{$this->rfid}][submit] value=1>";
         // ---------------------- FORM REIHEN
         $colcounter = $this->cols[0];
         for ($i = 0; $i < $this->counter; $i++) {
             if ($this->cols[$i] != "") {
                 $colcounter = $this->cols[$i];
             } else {
                 $this->cols[$i] = $colcounter;
             }
             if ($maxcount < $this->cols[$i]) {
                 $maxcount = $this->cols[$i];
             }
         }
         $colcounter = 0;
         if ($errmsg != "") {
             $ausgabe .= "<tr><td colspan=" . ($maxcount + 2) . " class=warning>{$errmsg}<br>Daten wurden noch nicht gespeichert</td></tr>";
         }
         if ($msg != "") {
             $ausgabe .= "<tr><td colspan=" . ($maxcount + 2) . " class=warning>{$msg}</td></tr>";
         }
         for ($i = 0; $i < $this->counter; $i++) {
             $name = "FORM[{$this->rfid}][values][{$i}]";
             $value = $FORM[$this->rfid][values][$i];
             // echo "<br>$i $maxcounter ".$this->cols[$i]." ".$this->cols[$i-1]." ".$this->value_form[$i];
             $colcounter++;
             if ($this->cols[$i - 1] != $this->cols[$i]) {
                 if ($i != 0) {
                     $ausgabe .= "</tr>\n\n";
                 }
                 $ausgabe .= "\n\n<tr>";
                 $colcounter = 0;
             } else {
                 // anfang
                 // ende
                 if ($colcounter == $this->cols[$i]) {
                     $ausgabe .= "</tr>\n\n";
                     $ausgabe .= "\n\n<tr>";
                     $colcounter = 0;
                 }
             }
             $addcolspawn = 0;
             if ($this->cols[$i] < $maxcount) {
                 $addcolspawn = 2;
             }
             switch ($this->value_type[$i]) {
                 // ---------------------- MULTIPLE SQL SELECT AUSGABE
                 case "multipleselectsql":
                     if ($this->form_type == "add") {
                         $ausgabe .= "<td colspan=2>Multiple Felder nur bei edit möglich\t</td>";
                     } else {
                         $ausgabe .= "\n\n";
                         $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                         $ssql = new sql();
                         $ssql->setQuery($this->type_value1[$i]);
                         $ssel = new rexselect();
                         $ssel->setName($name . "[]");
                         $ssel->setMultiple(1);
                         $ssel->setSize($this->type_value4[$i]);
                         $ssel->setStyle("width:100%;");
                         for ($j = 0; $j < $ssql->getRows(); $j++) {
                             $ssel->addOption($ssql->getValue($this->type_value3[$i]), $ssql->getValue($this->type_value2[$i]));
                             $ssql->next();
                         }
                         // $selsql = new sql;
                         // $selsql->setQuery("select * from ".$this->type_value5[$i]." where ".$this->type_value6[$i]);
                         if (is_Array($FORM[$this->rfid][values][$i])) {
                             reset($FORM[$this->rfid][values][$i]);
                             for ($j = 0; $j < count($FORM[$this->rfid][values][$i]); $j++) {
                                 $ssel->setSelected(current($FORM[$this->rfid][values][$i]));
                                 next($FORM[$this->rfid][values][$i]);
                             }
                         }
                         $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . ">" . $ssel->out() . "</td>";
                         $ausgabe .= "";
                     }
                     break;
                     // ---------------------- SINGLE SQL SELECT AUSGABE
                 // ---------------------- SINGLE SQL SELECT AUSGABE
                 case "singleselectsql":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ssql = new sql();
                     $ssql->setQuery($this->type_value1[$i]);
                     $ssel = new rexselect();
                     $ssel->setName($name);
                     $ssel->setStyle("width:100%;");
                     if ($this->value_check[$i] != 1) {
                         $ssel->addOption("----------------- keine Angabe -----------------", "0");
                     }
                     for ($j = 0; $j < $ssql->getRows(); $j++) {
                         $ssel->addOption($ssql->getValue($this->type_value3[$i]), $ssql->getValue($this->type_value2[$i]));
                         $ssql->next();
                     }
                     $ssel->setSelected($value);
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . ">" . $ssel->out() . "</td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- SINGLE SELECT AUSGABE
                 // ---------------------- SINGLE SELECT AUSGABE
                 case "singleselect":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $stype = explode("|", $this->type_value1[$i]);
                     $ssel = new rexselect();
                     $ssel->setName($name);
                     $ssel->setStyle("width:100%;");
                     for ($j = 0; $j < count($stype); $j++) {
                         $svalue = $stype[$j];
                         $j++;
                         $sname = $stype[$j];
                         $ssel->addOption($sname, $svalue);
                     }
                     $ssel->setSelected($value);
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . ">" . $ssel->out() . "</td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- Checkbox
                 // ---------------------- Checkbox
                 case "checkbox":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input type=checkbox name={$name} value=1 ";
                     if ($value == 1 || $value == "on") {
                         $ausgabe .= "checked";
                     }
                     $ausgabe .= "></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- PIC/JPG
                 // ---------------------- PIC/JPG
                 case "picjpg":
                     if ($value != "") {
                         $ausgabe .= "\n\n";
                         $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                         $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><table cellpadding=2 cellspacing=0><tr><td><input name={$name} type=file size=10></td><td rowspan=2>&nbsp;&nbsp;&nbsp;</td><td rowspan=2><img src=" . $this->type_value2[$i] . "{$value} width=" . $this->type_value3[$i] . " height=" . $this->type_value4[$i] . "></td></tr>";
                         $ausgabe .= "<tr><td valign=middle align=left class=grey><input type=checkbox name=FORM[{$this->rfid}][values][{$i}][delete]>&nbsp;&nbsp;Datei löschen </td></tr></table>";
                         $ausgabe .= "</td>";
                     } else {
                         $ausgabe .= "\n\n";
                         $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                         $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input name={$name} type=file size=10></td>";
                         $ausgabe .= "";
                     }
                     break;
                     // ---------------------- FILE
                 // ---------------------- FILE
                 case "file":
                     $myout = "";
                     if ($value != "") {
                         $myout = "\n\n<table><tr>";
                         $myout .= "<td valign=middle align=right class=grey><input type=checkbox name=FORM[{$this->rfid}][values][{$i}][delete]></td>";
                         $myout .= "<td class=grey>Datei löschen <a href=" . $this->type_value2[$i] . "{$value} target=_blank>{$value}</a></td>";
                         $myout .= "</tr></table>";
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "<br>{$myout}</td>";
                     $ausgabe .= "<td class=grey><input name={$name} type=file size=10></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- HTMLAREA
                 // ---------------------- HTMLAREA
                 case "htmlarea":
                     if ($this->type_value1[$i] == "") {
                         $this->type_value1[$i] = "width:100%; height:100px;";
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=top class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . ">" . REXHTMLAREA($name, $value) . "</td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- TEXTAREA
                 // ---------------------- TEXTAREA
                 case "textarea":
                     if ($this->type_value1[$i] == "") {
                         $this->type_value1[$i] = "width:100%; height:100px;";
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=top class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><textarea name={$name} cols=30 rows=5 style='" . $this->type_value1[$i] . "'>{$value}</textarea></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- HIDDEN
                 // ---------------------- HIDDEN
                 case "hidden":
                     $ausgabe .= "<input type=hidden name={$name} value=\"" . $this->type_value1[$i] . "\">";
                     break;
                     // ---------------------- TEXT
                 // ---------------------- TEXT
                 case "text":
                     if ($this->type_value1[$i] == "") {
                         $this->type_value1[$i] = "width:100%;";
                     }
                     if ($this->type_value2[$i] != "") {
                         $this->type_value2[$i] = "maxlength=" . $this->type_value2[$i];
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input type=text name={$name} value=\"{$value}\" " . $this->type_value2[$i] . " size=20 style='" . $this->type_value1[$i] . "'></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- DATUM
                 // ---------------------- DATUM
                 case "datum":
                     if ($this->type_value1[$i] == "") {
                         $this->type_value1[$i] = "width:100%;";
                     }
                     if ($this->type_value2[$i] != "") {
                         $this->type_value2[$i] = "maxlength=" . $this->type_value2[$i];
                     }
                     if (!preg_match("![0-9]{2}\\.[0-9]{2}\\.[0-9]{4}!", $value)) {
                         $value = date("d.m.Y", $value);
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input type=text name={$name} value=\"{$value}\" " . $this->type_value2[$i] . " size=20 style='" . $this->type_value1[$i] . "'></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- Überschrift
                 // ---------------------- Überschrift
                 case "subline":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<th valign=middle align=" . $this->value_tbl[$i] . " colspan=" . (2 + $addcolspawn) . ">" . $this->value_form[$i] . "</th>\n";
                     $ausgabe .= "\n";
                     break;
                     // ---------------------- Überschrift
                 // ---------------------- Überschrift
                 case "empty":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey colspan=" . (2 + $addcolspawn) . ">&nbsp;</td>\n";
                     $ausgabe .= "\n";
                     break;
                     // ---------------------- STANDARD AUSGABE - TEXT
                 // ---------------------- STANDARD AUSGABE - TEXT
                 default:
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input type=text name={$name} value=\"{$value}\" size=20 style='width:100%'></td>";
                     $ausgabe .= "";
             }
         }
         $ausgabe .= "</tr>";
         // ---------------------- SUBMIT
         $ausgabe .= "<tr>\n\n";
         $ausgabe .= "<td class=dgrey  width=" . $this->labelwidth . " >&nbsp;</td>\n\n";
         $ausgabe .= "<td align=left class=dgrey colspan=" . ($maxcount + 1) . "><input type=submit value='" . $this->submit_value . "'></td>\n\n";
         $ausgabe .= "</tr>\n\n";
         $ausgabe .= "</form></table>\n\n";
         return $ausgabe;
     } else {
         if ($msg != "") {
             $ausgabe = "<table width=" . $this->width . " cellpadding=6 cellspacing=1 border=0 bgcolor=#ffffff>";
             $ausgabe .= "<tr><td class=warning>{$msg}</td></tr>";
             $ausgabe .= "</table>";
             return $ausgabe;
         }
     }
 }
            }
        }
        echo "</table>";
        $OUT = false;
    }
}
if ($OUT) {
    // ausgabe modulliste !
    echo "<table border=0 cellpadding=5 cellspacing=1 width=770>\r\n\t\t<tr>\r\n\t\t\t<th width=30><a href=index.php?page=module&function=add><img src=pics/modul_plus.gif width=16 height=16 border=0></a></th>\r\n\t\t\t<th align=left width=300>" . $I18N->msg("module_description") . "</th>\r\n\t\t\t<th align=left>" . $I18N->msg("module_functions") . "</th>\r\n\t\t\t<th align=left width=100>PHP</th>\r\n\t\t\t<th align=left width=100>HTML</th>\r\n\t\t</tr>\r\n\t\t";
    if ($message != "") {
        echo "<tr><td align=center class=warning><img src=pics/warning.gif width=16 height=16></td><td colspan=5 class=warning>{$message}</td></tr>";
    }
    $sql = new sql();
    $sql->setQuery("select * from rex_modultyp order by name");
    for ($i = 0; $i < $sql->getRows(); $i++) {
        echo "\t<tr bgcolor=#eeeeee>\r\n\t\t\t\t<td class=grey align=center><img src=pics/modul.gif width=16 height=16></td>\r\n\t\t\t\t<td class=grey><a href=index.php?page=module&modul_id=" . $sql->getValue("id") . "&function=edit>" . htmlentities($sql->getValue("name")) . "</a>";
        if ($REX_USER->isValueOf("rights", "expertMode[]")) {
            echo " [" . $sql->getValue("id") . "]";
        }
        echo "</td>\r\n\t\t\t\t<td class=grey><a href=index.php?page=module&modul_id=" . $sql->getValue("id") . "&function=delete>" . $I18N->msg("delete_module") . "</a></td>\r\n\t\t\t\t<td class=grey>";
        if ($sql->getValue("php_enable") == 1) {
            echo $I18N->msg("yes");
        } else {
            echo "&nbsp;";
        }
        echo "</td>\r\n\t\t\t\t<td class=grey>";
        if ($sql->getValue("html_enable") == 1) {
            echo $I18N->msg("yes");
        }
        echo "</td>\r\n\t\t\t</tr>";
        $sql->counter++;
}
if ($OUT) {
    // ausgabe modulliste !
    echo '<table class="rex" style="table-layout:auto;" cellpadding="5" cellspacing="1">
    <tr>
      <th class="icon"><a href="index.php?page=module&amp;function=add"><img src="pics/modul_plus.gif" width="16" height="16" border="0" alt="' . $I18N->msg("create_module") . '" title="' . $I18N->msg("create_module") . '"></a></th>
      <th class="icon">ID</th>
      <th width="300">' . $I18N->msg("module_description") . '</th>
      <th>' . $I18N->msg("module_functions") . '</th>
    </tr>
    ' . "\n";
    if (isset($message) and $message != '') {
        echo '<tr class="warning"><td align="center"><img src="pics/warning.gif" width="16" height="16"></td><td colspan="3">' . $message . '</td></tr>';
    }
    $sql = new sql();
    $sql->setQuery("SELECT * FROM rex_modultyp ORDER BY name");
    for ($i = 0; $i < $sql->getRows(); $i++) {
        echo '  <tr>
        <td class="icon"><a href="index.php?page=module&amp;modul_id=' . $sql->getValue("id") . '&amp;function=edit"><img src="pics/modul.gif" width="16" height="16" border="0"></a></td>
        <td class="icon">' . $sql->getValue("id") . '</td>
        <td><a href="index.php?page=module&amp;modul_id=' . $sql->getValue("id") . '&amp;function=edit">' . htmlspecialchars($sql->getValue("name")) . '</a>' . "\n";
        if ($REX_USER->isValueOf("rights", "expertMode[]")) {
            echo ' [' . $sql->getValue("id") . ']';
        }
        echo '</td>
        <td><a href="index.php?page=module&amp;modul_id=' . $sql->getValue("id") . '&amp;function=delete" onclick="return confirm(\'' . $I18N->msg('delete') . ' ?\')">' . $I18N->msg("delete_module") . '</a></td>
      </tr>' . "\n";
        $sql->counter++;
    }
    echo '</table>';
}
Beispiel #13
0
     $meta_sql->update();
     $article->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where id='{$article_id}' and clang='{$clang}'");
     if (!isset($message)) {
         $message = '';
     }
     $err_msg = $I18N->msg("metadata_updated") . $message;
     rex_generateArticle($article_id);
 }
 $typesel = new select();
 $typesel->set_name("type_id");
 $typesel->set_style("width:100%;");
 $typesel->set_size(1);
 $typesql = new sql();
 $typesql->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article_type order by name");
 for ($i = 0; $i < $typesql->getRows(); $i++) {
     $typesel->add_option($typesql->getValue("name"), $typesql->getValue("type_id"));
     $typesql->next();
 }
 $typesel->set_selected($article->getValue("type_id"));
 // Artikeltyp-Auswahl nur anzeigen, wenn mehr als ein Typ vorhanden ist
 if ($typesql->getRows() <= 1) {
     $out = "<input type=hidden name=type_id value=0>";
 } else {
     $out = "<tr><td class=grey>" . $I18N->msg("article_type_list_name") . "</td><td class=grey>" . $typesel->out() . "</td></tr>";
 }
 echo "  <table border=0 cellpadding=5 cellspacing=1 width=100%>\n        <form action=index.php method=post ENCTYPE=multipart/form-data name=REX_FORM>\n        <input type=hidden name=page value=content>\n        <input type=hidden name=article_id value='{$article_id}'>\n        <input type=hidden name=mode value='meta'>\n        <input type=hidden name=save value=1>\n        <input type=hidden name=clang value={$clang}>\n        <input type=hidden name=ctype value={$ctype}>\n        <tr>\n          <td colspan=2>" . $I18N->msg("general") . "</td>\n        </tr>";
 if (isset($err_msg) and $err_msg != "") {
     echo '<tr><td colspan="2" class="warning"><font class="warning">' . $err_msg . '</font></td></tr>';
 }
 function selectdate($date, $extens)
 {
    function getNextSlice()
    {
        global $REX;
        $table = '';
        $table = $REX['TABLE_PREFIX'] . "article_slice";
        $sql = new sql();
        $query = <<<EOD
SELECT
  id,re_article_slice_id,value1,value2,value3,value4,value5,value6,
  value7,value8,value9,value10,file1,file2,file3,file4,file5,file6,
  file7,file8,file9,file10,link1,link2,link3,link4,link5,link6,link7,
  link8,link9,link10,php,html,article_id,modultyp_id
FROM {$table}
WHERE re_article_slice_id = {$this->_id}
EOD;
        $sql->setQuery($query);
        if ($sql->getRows() == 1) {
            return new OOArticleSlice($sql->getValue("id"), $sql->getValue("re_article_slice_id"), $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("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"), $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"), $sql->getValue("php"), $sql->getValue("html"), $sql->getValue("article_id"), $sql->getValue("modultyp_id"));
        }
        return null;
    }
 function deleteMessage($message_id)
 {
     // reply
     $r_sql = new sql();
     $r_sql->setQuery("select * from rex_5_board where message_id='{$message_id}' and board_id='" . $this->boardname . "'");
     if ($r_sql->getRows() == 1) {
         if ($r_sql->getValue("re_message_id") != 0) {
             // reply
             $ur_sql = new sql();
             $ur_sql->setTable("rex_5_board");
             $ur_sql->where("message_id='{$message_id}'");
             $ur_sql->setValue("status", 0);
             $ur_sql->update();
             $message_id = $r_sql->getValue("re_message_id");
             // update topic
             $u_sql = new sql();
             $u_sql->setQuery("select * from rex_5_board where re_message_id='{$message_id}' and status='1'");
             $u_sql->setTable("rex_5_board");
             $u_sql->where("message_id='{$message_id}'");
             $u_sql->setValue("replies", $u_sql->getRows());
             $u_sql->update();
             $this->msg["bb_msg_id"] = $r_sql->getValue("re_message_id");
             $return = $this->showMessage();
         } else {
             // topic
             $u_sql = new sql();
             $u_sql->setTable("rex_5_board");
             $u_sql->where("message_id='{$message_id}' or re_message_id='{$message_id}'");
             $u_sql->setValue("status", 0);
             $u_sql->update();
             $this->errmsg = $this->text[250];
             $return = $this->showMessages();
         }
     } else {
         $this->errmsg = $this->text[260];
         $return = $this->showMessages();
     }
     return $return;
 }
 function searchArticles($search)
 {
     global $REX;
     $strings = explode(" ", $search);
     $counter = 0;
     foreach ($strings as $s) {
         if ($counter != 0) {
             $add .= " AND ";
         }
         $add .= "( name like '%{$s}%' OR description like '%{$s}%' OR detaildesc like '%{$s}%' OR artnr like '%{$s}%')";
         $counter++;
     }
     $sql = new sql();
     $sql->debugsql = 0;
     $sql->setQuery("SELECT * FROM " . $REX[ADDON][tbl][art]["simple_shop"] . "\r\n\t\t\twhere clang='" . $clang . "' AND\r\n\t\t\tstatus>0 AND " . $add . " ORDER BY name");
     $return = array();
     for ($i = 0; $i < $sql->rows; $i++) {
         $return[] = new shop_article($sql->getValue("id"), $sql->getValue("clang"), $sql->getValue("name"), $sql->getValue("path"), $sql->getValue("category"), $sql->getValue("description"), $sql->getValue("artnr"), $sql->getValue("mwst"), $sql->getValue("price"), $sql->getValue("old_price"), $sql->getValue("deliver_price"), $sql->getValue("detaildesc"), $sql->getValue("thumbnail"), $sql->getValue("picture"), $sql->getValue("relation_1"), $sql->getValue("relation_2"), $sql->getValue("relation_3"), $sql->getValue("prio"), $sql->getValue("status"), $sql->getValue("instock"), $sql->getValue("stockinfo"));
         $sql->next();
     }
     return $return;
 }
         $sql->setQuery("SELECT template_id FROM " . $REX['TABLE_PREFIX'] . "article WHERE re_id={$re_id} and clang={$clang} and startpage=1");
         if ($sql->getRows() == 1) {
             $TMPL_SEL->set_selected($sql->getValue("template_id"));
         }
     }
     echo "<tr>\r\n            <form action=index.php method=post name=art_add_form>\r\n            <input type=hidden name=page value=structure>\r\n            <input type=hidden name=category_id value={$category_id}>\r\n            <input type=hidden name=clang value={$clang}>\r\n            <input type=hidden name=function value='add_article'>\r\n            <td class=icon><img src=pics/document.gif width=16 height=16 border=0></td>";
     if ($REX_USER->isValueOf("rights", "advancedMode[]")) {
         echo "<td class=grey align=center>-</td>";
     }
     echo "        \r\n            <td><input type=text name=article_name size=20></td>\r\n            <td>&nbsp;<input type=text name=Position_New_Article value=\"100\" style='width:30px'></td>\r\n            <td>" . $TMPL_SEL->out() . "</td>\r\n            <td>" . strftime($I18N->msg("adateformat")) . "&nbsp;</td>\r\n            <td><b>" . $I18N->msg("article") . "</b></td>\r\n            <td colspan=3><input type=submit value='add_article'></td>\r\n            </form>\r\n            <script type='text/javascript'> \r\n               <!-- \r\n               document.art_add_form.article_name.focus(); \r\n               //--> \r\n            </script>\r\n            </tr>";
 }
 // --------------------- ARTIKEL LIST
 $sql = new sql();
 $sql->setQuery("SELECT * \r\n        FROM \r\n          " . $REX['TABLE_PREFIX'] . "article \r\n        WHERE \r\n          ((re_id='{$category_id}' and startpage=0) or (id='{$category_id}' and startpage=1)) \r\n          and clang={$clang}  \r\n        ORDER BY \r\n          prior, name");
 for ($i = 0; $i < $sql->getRows(); $i++) {
     if ($sql->getValue("startpage") == 1) {
         $startpage = $I18N->msg("start_article");
         $icon = "liste.gif";
     } else {
         $startpage = $I18N->msg("article");
         $icon = "document.gif";
     }
     //    $pos++; // wird das noch gebraucht?
     // --------------------- ARTIKEL EDIT FORM
     if (isset($function) and $function == "edit" && isset($article_id) && $sql->getValue("id") == $article_id && $KATPERM) {
         $TMPL_SEL->set_selected($sql->getValue("template_id"));
         echo "  <tr>\r\n              <form action=index.php method=post name=art_edit_form>\r\n              <input type=hidden name=page value=structure>\r\n              <input type=hidden name=category_id value={$category_id}>\r\n              <input type=hidden name=article_id value=" . $sql->getValue("id") . ">\r\n              <input type=hidden name=function value='edit_article'>\r\n              <input type=hidden name=aid value=" . $sql->getValue("id") . ">\r\n              <input type=hidden name=clang value={$clang}>\r\n              <td class=icon><a href=index.php?page=content&article_id=" . $sql->getValue("id") . "&category_id={$category_id}&clang={$clang}><img src=pics/{$icon} width=16 height=16 border=0></a></td>";
         if ($REX_USER->isValueOf("rights", "advancedMode[]")) {
             echo "<td class=grey>" . $sql->getValue("id") . "</td>";
         }
         echo "\r\n              <td><input type=text name=article_name value=\"" . htmlspecialchars($sql->getValue("name")) . "\" size=20 style='width:100%'></td>\r\n              <td>&nbsp;<input type=text name=Position_Article value=\"" . htmlspecialchars($sql->getValue("prior")) . "\" style='width:30px'></td>\r\n              <td>" . $TMPL_SEL->out() . "</td>\r\n              <td>" . strftime($I18N->msg("adateformat"), $sql->getValue("createdate")) . "&nbsp;</td>\r\n              <td><b>{$startpage}</b></td>\r\n              <td colspan=3><input type=submit value='" . $I18N->msg("edit") . "'></td>\r\n              </form>\r\n              <script type='text/javascript'> \r\n                 <!-- \r\n                 document.art_edit_form.article_name.focus(); \r\n                 //--> \r\n              </script>\r\n              </tr>";
        $sel_status->add_option($ASTATUS[2], "2");
        $sel_status->set_size(1);
        $sel_status->set_selected($status);
        echo "\t\n\t\t\t<form action=index.php method=post>\n\t\t\t<input type=hidden name=page value=module>\n\t\t\t<input type=hidden name=subpage value=actions>\n\t\t\t<input type=hidden name=function value={$function}>\n\t\t\t<input type=hidden name=save value=ja>\n\t\t\t<input type=hidden name=action_id value={$action_id}>\n\t\t\t<tr>\n\t\t\t\t<td width=100 class=grey>" . $I18N->msg("action_name") . "</td>\n\t\t\t\t<td class=grey colspan=2><input type=text size=10 name=mname value=\"" . htmlentities($mname) . "\" style='width:100%;'></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign=top class=grey>" . $I18N->msg("input") . "</td>\n\t\t\t\t<td class=grey colspan=2><textarea cols=20 rows=70 name=actioninput style='width:100%; height: 150;'>" . htmlentities($actioninput) . "</textarea></td>\n\t\t\t</tr>";
        echo "\n\t\t\t<tr>\n\t\t\t\t<td align=right valign=middle class=grey>{$PREPOST['0']}/{$PREPOST['1']}</td>\n\t\t\t\t<td valign=middle class=grey colspan=2>" . $sel_prepost->out() . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td align=right valign=middle class=grey>STATUS</td>\n\t\t\t\t<td valign=middle class=grey colspan=2>" . $sel_status->out() . "</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=grey>&nbsp;</td>\n\t\t\t\t<td class=grey width=200><input type=submit value='" . $I18N->msg("save_action_and_quit") . "'></td>\n\t\t\t\t<td class=grey>";
        if ($function != "add") {
            echo "<input type=submit name=goon value='" . $I18N->msg("save_action_and_continue") . "'>";
        }
        echo "</td>\n\t\t\t</tr>\n\t\t\t</form>\n\t\t\t</table>";
        $OUT = false;
    }
}
if ($OUT) {
    // ausgabe actionsliste !
    echo "<table border=0 cellpadding=5 cellspacing=1 width=770>\n\t\t<tr>\n\t\t\t<th width=30><a href=index.php?page=module&subpage=actions&function=add><img src=pics/modul_plus.gif width=16 height=16 border=0></a></th>\n\t\t\t<th align=left width=300>" . $I18N->msg("action_name") . "</th>\n\t\t\t<th align=left>" . $I18N->msg("action_functions") . "</th>\n\t\t</tr>\n\t\t";
    if ($message != "") {
        echo "<tr><td align=center class=warning><img src=pics/warning.gif width=16 height=16></td><td colspan=4 class=warning>{$message}</td></tr>";
    }
    $sql = new sql();
    $sql->setQuery("select * from rex_action order by name");
    for ($i = 0; $i < $sql->getRows(); $i++) {
        echo "\t<tr bgcolor=#eeeeee>\n\t\t\t\t<td class=grey align=center><a href=index.php?page=module&subpage=actions&action_id=" . $sql->getValue("id") . "&function=edit><img src=pics/modul.gif width=16 height=16 border=0></a></td>\n\t\t\t\t<td class=grey><a href=index.php?page=module&subpage=actions&action_id=" . $sql->getValue("id") . "&function=edit>" . htmlentities($sql->getValue("name")) . "</a>";
        if ($REX_USER->isValueOf("rights", "expertMode[]")) {
            echo " [" . $sql->getValue("id") . "]";
        }
        echo " [" . $PREPOST[$sql->getValue("prepost")] . "|" . $ASTATUS[$sql->getValue("status")] . "]";
        echo "</td>\n\t\t\t\t<td class=grey><a href=index.php?page=module&subpage=actions&action_id=" . $sql->getValue("id") . "&function=delete>" . $I18N->msg("action_delete") . "</a></td>\n\t\t\t</tr>";
        $sql->counter++;
    }
    echo "</table>";
}
/**
 * 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";
    reset($REX['CLANG']);
    for ($i = 0; $i < count($REX['CLANG']); $i++) {
        $cur = key($REX['CLANG']);
        $val = current($REX['CLANG']);
        $content .= "\n\r\$REX['CLANG']['{$cur}'] = \"{$val}\";";
        next($REX['CLANG']);
    }
    $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 sql();
    $add->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where clang='0'");
    $fields = $add->getFieldnames();
    for ($i = 0; $i < $add->getRows(); $i++) {
        $adda = new sql();
        // $adda->debugsql = 1;
        $adda->setTable($REX['TABLE_PREFIX'] . "article");
        reset($fields);
        while (list($key, $value) = each($fields)) {
            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}")));
                    }
                }
            }
            //  createuser
            //  updateuser
        }
        $adda->insert();
        $add->next();
    }
    $add = new sql();
    $add->query("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();
}
 function addSlice($I_ID, $module_id)
 {
     global $REX, $FORM, $I18N;
     $FILE1 = "";
     $FILE2 = "";
     $FILE3 = "";
     $FILE4 = "";
     $FILE5 = "";
     $FILE6 = "";
     $FILE7 = "";
     $FILE8 = "";
     $FILE9 = "";
     $FILE10 = "";
     $MOD = new sql();
     $MOD->setQuery("select * from rex_modultyp where id={$module_id}");
     if ($MOD->getRows() != 1) {
         $slice_content = "<table width=100% cellspacing=0 cellpadding=5 border=0><tr><td class=dblue>" . $I18N->msg('module_doesnt_exist') . "</td></tr></table>";
     } else {
         $slice_content = "<a name=addslice></a><table width=100% cellspacing=0 cellpadding=5 border=0>\n                        <tr><td class=dblue><b>" . $I18N->msg('add_block') . "</b></td></tr>\n                                <tr><td class=blue>Modul: <b>" . $MOD->getValue("name") . "</b></td></tr>\n                                <tr>\n                                <td class=lblue>\n                                <form ENCTYPE=multipart/form-data action=index.php#slice{$I_ID} method=post name=REX_FORM>\n                                <input type=hidden name=article_id value={$this->article_id}>\n                                <input type=hidden name=page value=content>\n                                <input type=hidden name=mode value={$this->mode}>\n                                <input type=hidden name=slice_id value={$I_ID}>\n                                <input type=hidden name=function value=add>\n                                <input type=hidden name=module_id value={$module_id}>\n                                <input type=hidden name=save value=1>\n                                " . $MOD->getValue("eingabe") . "\n                                <br><input type=submit value='" . $I18N->msg('add_block') . "'></form>";
         $slice_content = $this->sliceClear($slice_content);
         $slice_content .= "</td></tr></table>";
     }
     return $slice_content;
 }
             $TMPL_SEL->set_selected($sql->getValue("template_id"));
         }
     }
     echo "\t<tr>\n\t\t\t<form action=index.php method=post>\n\t\t\t<input type=hidden name=page value=structure>\n\t\t\t<input type=hidden name=category_id value={$category_id}>\n\t\t\t<td class=grey align=center><img src=pics/document.gif width=16 height=16 border=0></td>\n\t\t\t<td class=grey><input type=hidden name=function value='add_article'><input type=text name=article_name size=20></td>\n\t\t\t<td class=grey>&nbsp;<input type=text name=Position_New_Article value=\"1\" style='width:30px'></td>\n\t\t\t<td class=grey>" . $TMPL_SEL->out() . "</td>\n\t\t\t<td class=grey>" . date_from_mydate(date("YmdHis"), "") . "&nbsp;</td>\n\t\t\t<td class=grey><b>" . $I18N->msg("article") . "</b></td>\n\t\t\t<td class=grey colspan=3><input type=submit value='add_article'></td>\n\t\t\t</form>\n\t\t\t</tr>";
 }
 // Check startArticle[] Permissons
 $startSQL = "";
 if ($REX_USER->isValueOf("rights", "startArticle[none]")) {
     if (!$REX_USER->isValueOf("rights", "startArticle[{$category_id}]")) {
         $startSQL = "AND startpage = 0";
     }
 }
 $sql = new sql();
 $sql->setQuery("select * from rex_article where category_id='{$category_id}' {$startSQL} order by prior,name");
 for ($i = 0; $i < $sql->getRows(); $i++) {
     if ($sql->getValue("startpage") == 1) {
         $startpage = $I18N->msg("start_article");
         $icon = "liste.gif";
     } else {
         $startpage = $I18N->msg("article");
         $icon = "document.gif";
     }
     $pos++;
     // hideArticle[id] Check
     if (!$REX_USER->isValueOf("rights", "hideArticle[" . $sql->getValue("id") . "]")) {
         if ($function == "edit" and $sql->getValue("id") == $article_id and $STRUCTURE_PERM) {
             $TMPL_SEL->set_selected($sql->getValue("template_id"));
             echo "  <tr>\n\t                <form action=index.php method=post>\n\t                <input type=hidden name=page value=structure>\n\t                <input type=hidden name=category_id value={$category_id}>\n\t                <input type=hidden name=article_id value=" . $sql->getValue("id") . ">\n\t                <input type=hidden name=function value='edit_article'>\n\t                <input type=hidden name=aid value=" . $sql->getValue("id") . ">\n\t                <td class=grey align=center><a href=index.php?page=content&article_id=" . $sql->getValue("id") . "&category_id={$category_id}><img src=pics/{$icon} width=16 height=16 border=0></a></td>\n\t                <td class=grey><input type=text name=article_name value=\"" . htmlentities($sql->getValue("name")) . "\" size=20 style='width:100%'></td>\n\t                <td class=grey>&nbsp;<input type=text name=Position_Article value=\"{$pos}\" style='width:30px'></td>\n\t                <td class=grey>" . $TMPL_SEL->out() . "</td>\n\t                <td class=grey>" . date_from_mydate($sql->getValue("erstelldatum"), "") . "&nbsp;</td>\n\t                <td class=grey><b>{$startpage}</b></td>\n\t                <td class=grey colspan=3><input type=submit value='" . $I18N->msg("edit") . "'></td>\n\t                </form>\n\t                </tr>";
         } elseif ($STRUCTURE_PERM) {
             echo "  <tr>\n\t                <td class=grey align=center><a href=index.php?page=content&article_id=" . $sql->getValue("id") . "&category_id={$category_id}&mode=edit><img src=pics/{$icon} width=16 height=16 border=0></a></td>\n\t                <td class=grey><a href=index.php?page=content&article_id=" . $sql->getValue("id") . "&category_id={$category_id}&mode=edit>" . $sql->getValue("name") . "&nbsp;</a>";
             if ($REX_USER->isValueOf("rights", "expertMode[]")) {
function REX_SEARCH($searchtxt, $surroundchars = 20, $categories = "", $surround_tag_start = "<b>", $surround_tag_end = "</b>")
{
    ###### CHECK WHICH PATHES SHOULD BE SEARCHED
    if (!is_array($categories)) {
        $ADD_AREA .= "AND rex_article.path like '%-%'";
    } else {
        $ADD_AREA = "AND (";
        foreach ($categories as $var) {
            $ADD_AREA .= " rex_article.path like '%-{$var}%' OR ";
        }
        $ADD_AREA = substr($ADD_AREA, 0, -3) . ")";
    }
    ##### TRIM SEARCHTXT
    $searchtxt = trim($searchtxt, " ");
    ##### CHECK IF SEARCH STRING IS LONG ENOUGH
    if (strlen($searchtxt) < 40 and strlen($searchtxt) > 2) {
        ##### EXPLODE SEARCH STRING
        $words = explode(" ", $searchtxt);
        $words_count = 0;
        if (count($words) > 3) {
            $words_count = 3;
            $RETURN[msg] = "Es wurden nur die ersten 3 Begriffe benutzt";
        } else {
            $words_count = count($words);
        }
        ##### START SQL CLASS
        $SUCHE = new sql();
        #### SEARCH FOR ALL KEYWORDS
        for ($i = 0; $i < $words_count; $i++) {
            $SUCHE->flush();
            $KEYWORD = current($words);
            #### SQL QUERY
            $sql = "\r\n\t        SELECT\r\n\r\n\t        rex_article.id,rex_article.name,rex_article.beschreibung,\r\n\r\n\t\t\trex_article_slice.value1,rex_article_slice.value2,rex_article_slice.value3,\r\n\t\t\trex_article_slice.value4,rex_article_slice.value5,rex_article_slice.value6,\r\n\t\t\trex_article_slice.value7,rex_article_slice.value8,rex_article_slice.value9,\r\n\r\n\t        (FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article.name,' ',',')) * 10) +\r\n\t        (FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article.beschreibung,' ',',')) * 5) +\r\n\t        (FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article.suchbegriffe,' ',',')) * 5) +\r\n\t        FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value1,' ',',')) +\r\n\t        FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value2,' ',',')) +\r\n\t        FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value3,' ',',')) +\r\n\t        FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value4,' ',',')) +\r\n\t        FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value5,' ',',')) +\r\n\t        FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value6,' ',',')) +\r\n\t        FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value7,' ',',')) +\r\n\t        FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value8,' ',',')) +\r\n\t        FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value9,' ',','))\r\n\t        AS COUNTWORD\r\n\r\n\t        FROM rex_article_slice\r\n\r\n\t        LEFT JOIN rex_article ON rex_article.id=rex_article_slice.article_id\r\n\r\n\t        WHERE\r\n\r\n\t        (\r\n\t        rex_article.name LIKE ('%{$KEYWORD}%') OR\r\n\t        rex_article.beschreibung LIKE ('%{$KEYWORD}%') OR\r\n\t        rex_article.suchbegriffe LIKE ('%{$KEYWORD}%') OR\r\n\t        rex_article_slice.value1 LIKE ('%{$KEYWORD}%') OR\r\n\t        rex_article_slice.value2 LIKE ('%{$KEYWORD}%') OR\r\n\t        rex_article_slice.value3 LIKE ('%{$KEYWORD}%') OR\r\n\t        rex_article_slice.value4 LIKE ('%{$KEYWORD}%') OR\r\n\t        rex_article_slice.value5 LIKE ('%{$KEYWORD}%') OR\r\n\t        rex_article_slice.value6 LIKE ('%{$KEYWORD}%') OR\r\n\t        rex_article_slice.value7 LIKE ('%{$KEYWORD}%') OR\r\n\t        rex_article_slice.value8 LIKE ('%{$KEYWORD}%') OR\r\n\t        rex_article_slice.value9 LIKE ('%{$KEYWORD}%')\r\n\t        )\r\n\r\n\t        AND status = 1\r\n\r\n\t\t\t{$ADD_AREA}\r\n\r\n\t        GROUP BY id\r\n\r\n\t        ORDER BY COUNTWORD DESC\r\n\r\n\t        LIMIT 0,50\r\n\r\n\t        ";
            $SUCHE->setQuery($sql);
            $count_limit = 0;
            ###### GO THROUGH RESULTS
            for ($j = 0; $j < $SUCHE->getRows(); $j++) {
                $ART[$SUCHE->getValue("rex_article.id")][ID] = $SUCHE->getValue("rex_article.id");
                $ART[$SUCHE->getValue("rex_article.id")][NAME] = $SUCHE->getValue("rex_article.name");
                $ART[$SUCHE->getValue("rex_article.id")][DESC] = $SUCHE->getValue("rex_article.beschreibung");
                $ART[$SUCHE->getValue("rex_article.id")][COUNTWORD] = $SUCHE->getValue("COUNTWORD");
                $ART[$SUCHE->getValue("rex_article.id")][URL] = $SUCHE->getValue("rex_article.id") . "-" . ModRewriteName($SUCHE->getValue("rex_article.name"));
                ###### CHECK OCURRENCE OF KEYWORD
                for ($val = 1; $val < 10; $val++) {
                    $regex = "/\\b.{0," . $surroundchars . "}" . $KEYWORD . ".{0," . $surroundchars . "}\\b/im";
                    preg_match_all($regex, strip_tags($SUCHE->getValue("rex_article_slice.value" . $val)), $matches);
                    if ($matches[0][0] != '') {
                        $ART_REGEX[$SUCHE->getValue("rex_article.id")] .= "... " . implode($matches[0], " ... ");
                    }
                }
                $SUCHE->next();
            }
            $SEARCH_WORDS[] = $KEYWORD;
            next($words);
        }
        if (is_array($ART_REGEX)) {
            $replace_string = implode("|", $SEARCH_WORDS);
            foreach ($ART_REGEX as $key => $var) {
                $ART[$key][DESC_REGEX] = preg_replace("/(" . $replace_string . ")/im", $surround_tag_start . "\\1" . $surround_tag_end, $var) . " ...";
            }
        }
    }
    return $ART;
}
 print "<table class=rex border=0 cellpadding=5 cellspacing=1 style='width:100%'>\n";
 print "<tr>\r\n    <th align=left class=icon></th>\r\n    <th align=left width=80><b>" . $I18N->msg('pool_file_thumbnail') . "</b></th>\r\n    <th align=left><b>" . $I18N->msg('pool_file_info') . "/ " . $I18N->msg('pool_file_description') . "</b></th>\r\n    <th align=left width=150><b>" . $I18N->msg('pool_file_functions') . "</b></th>\r\n    </tr>\n";
 if (isset($msg) and $msg != "") {
     print "<tr class=warning><td align=center><img src=pics/warning.gif width=16 height=16></td><td class=warning colspan=3>{$msg}</td></tr>";
     $msg = "";
 }
 //deletefilelist und cat change
 print "<form name=rex_file_list action=index.php method=post ENCTYPE=multipart/form-data>\n";
 print "<input type=hidden name=page value=medienpool>\n";
 print "<input type=hidden name=rex_file_category value={$rex_file_category}>\n";
 print "<input type=hidden name=media_method value=''>\n";
 $files = new sql();
 // $files->debugsql = 1;
 $files->setQuery("SELECT * FROM " . $REX['TABLE_PREFIX'] . "file WHERE category_id=" . $rex_file_category . " ORDER BY updatedate desc");
 for ($i = 0; $i < $files->getRows(); $i++) {
     $file_id = $files->getValue("file_id");
     $file_name = $files->getValue("filename");
     $file_oname = $files->getValue("originalname");
     $file_title = $files->getValue("title");
     $file_description = $files->getValue("description");
     $file_copyright = $files->getValue("copyright");
     $file_type = $files->getValue("filetype");
     $file_size = $files->getValue("filesize");
     $file_stamp = date("d-M-Y | H:i", $files->getValue("updatedate")) . "h";
     $file_updateuser = $files->getValue("updateuser");
     // check if file exists
     // was passiert wenn nicht da ?
     // if(!file_exists($REX['MEDIAFOLDER']."/".$file_name)) continue;
     $file_ext = substr(strrchr($file_name, "."), 1);
     $icon_src = "pics/mime_icons/mime-default.gif";
     if (OOMedia::isDocType($file_ext)) {
             $function = "edit_article";
         } else {
             $send = 1;
             $function = "";
         }
     }
     $sql->flush();
     $sql->setTable("rex_4_article");
     $sql->setValue("category", $diecats);
     $sql->where("id=" . $aid . " and clang=" . $clang);
     $sql->update();
 } else {
     //----> Neuer Artikel wird angelegt
     $sql2 = new sql();
     $sql2->setQuery("SELECT MAX(id) as theid from rex_4_article");
     $theid = $sql2->getValue("theid");
     if ($theid == "") {
         $theid = 0;
     }
     $theid++;
     $aid = $theid;
     foreach ($REX[CLANG] as $key => $language) {
         $sql->flush();
         $sql->setTable("rex_4_article");
         $sql->setValue("name", $article[name]);
         $sql->setValue("artnr", $article[artnr]);
         $sql->setValue("id", $theid);
         $sql->setValue("clang", $key);
         $sql->setValue("category", $diecats);
         $sql->setValue("description", $article[desc]);
         $sql->setValue("detaildesc", $VALUE[1]);
function generateAll()
{
    global $REX, $I18N;
    // ----------------------------------------------------------- generiere templates
    deleteDir($REX[INCLUDE_PATH] . "/generated/templates", 0);
    // mkdir($REX[INCLUDE_PATH]."/generated/templates",0664);
    $gt = new sql();
    $gt->setQuery("select * from rex_template");
    for ($i = 0; $i < $gt->getRows(); $i++) {
        $fp = fopen($REX[INCLUDE_PATH] . "/generated/templates/" . $gt->getValue("rex_template.id") . ".template", "w");
        fputs($fp, $gt->getValue("rex_template.content"));
        fclose($fp);
        $gt->next();
    }
    // ----------------------------------------------------------- generiere artikel
    deleteDir($REX[INCLUDE_PATH] . "/generated/articles", 0);
    // mkdir($REX[INCLUDE_PATH]."/generated/articles",0664);
    $gc = new sql();
    $gc->setQuery("select * from rex_article");
    for ($i = 0; $i < $gc->getRows(); $i++) {
        generateArticle($gc->getValue("id"));
        $gc->next();
    }
    // ----------------------------------------------------------- generiere categorien
    deleteDir($REX[INCLUDE_PATH] . "/generated/categories", 0);
    // mkdir($REX[INCLUDE_PATH]."/generated/categories",0664);
    $gcc = new sql();
    $gcc->setQuery("select * from rex_category");
    for ($i = 0; $i < $gcc->getRows(); $i++) {
        generateCategory($gcc->getValue("id"));
        $gcc->next();
    }
    // generateCategories();
    $MSG = $I18N->msg('articles_generated') . " " . $I18N->msg('old_articles_deleted');
    return $MSG;
}
Beispiel #26
0
     $link = mysql_connect($DB[1][HOST], $DB[1][LOGIN], $DB[1][PSW]);
     $lines = explode(";", $create);
     array_pop($lines);
     foreach ($lines as $line) {
         if (!mysql_db_query($DB[1][NAME], $line, $link)) {
             $err_msg .= "Folgender Fehler tauchte beim Update auf. MySQL: " . mysql_error() . "<br>";
         }
     }
 } elseif ($dbanlegen == 2) {
     // ----- Keine Datenbank anlegen
     $TBLS = array("rex__article_comment" => 0, "rex__session" => 0, "rex__board" => 0, "rex__user" => 0, "rex__user_comment" => 0, "rex__user_mail" => 0, "rex_action" => 0, "rex_article" => 0, "rex_article_slice" => 0, "rex_article_type" => 0, "rex_category" => 0, "rex_email" => 0, "rex_file" => 0, "rex_file_category" => 0, "rex_modultyp" => 0, "rex_template" => 0, "rex_user" => 0, "rex_file_category" => 0);
     $gt = new sql();
     // $gt->debugsql = 1;
     $gt->setQuery("show tables");
     for ($i = 0; $i < $gt->getRows(); $i++, $gt->next()) {
         $tblname = $gt->getValue("Tables_in_" . $DB[1][NAME]);
         if (substr($tblname, 0, 4) == "rex_") {
             // echo $tblname."<br>";
             if (array_key_exists("{$tblname}", $TBLS)) {
                 $TBLS["{$tblname}"] = 1;
             }
         }
     }
     for ($i = 0; $i < count($TBLS); $i++) {
         if (current($TBLS) != 1) {
             $err_msg .= "Tabelle " . key($TBLS) . " wurde nicht gefunden !<br>";
         }
         next($TBLS);
     }
 } elseif ($dbanlegen == 1) {
     // ----- leere Datenbank und alte DB löschen / drop
 function getNewArticles($number_of_articles, $ignore_startpages = true, $ignore_offlines = true)
 {
     global $REX;
     $off = $ignore_offlines ? " and status = 1 " : "";
     $nostart = $ignore_startpages ? " and startpage = 0 and id != {$REX[STARTARTIKEL_ID]}" : "";
     $limit = " LIMIT 0, {$number_of_articles} ";
     $artlist = array();
     $sql = new sql();
     $sql->setQuery("select id,name,beschreibung,attribute,file,category_id,type_id,startpage,prior,path,status,online_von,online_bis,erstelldatum,suchbegriffe,template_id,checkbox01,checkbox02,checkbox03,checkbox04 from rex_article where 1=1 {$off} {$nostart} order by erstelldatum desc {$limit}");
     for ($i = 0; $i < $sql->getRows(); $i++) {
         $artlist[] = new OOArticle($sql->getValue("id"), $sql->getValue("name"), $sql->getValue("beschreibung"), $sql->getValue("attribute"), $sql->getValue("file"), $sql->getValue("category_id"), $sql->getValue("type_id"), $sql->getValue("startpage"), $sql->getValue("prior"), $sql->getValue("path"), $sql->getValue("status"), $sql->getValue("online_von"), $sql->getValue("online_bis"), $sql->getValue("erstelldatum"), $sql->getValue("suchbegriffe"), $sql->getValue("template_id"), $sql->getValue("checkbox01"), $sql->getValue("checkbox02"), $sql->getValue("checkbox03"), $sql->getValue("checkbox04"));
         $sql->next();
     }
     return $artlist;
 }
function copyCategory($which, $to_cat)
{
    ## orginal selecten
    $orig = new sql();
    $orig->setQuery("SELECT * FROM rex_category WHERE id={$which}");
    if ($to_cat != 0) {
        ## ziel selecten um den path zu bekomme
        $ziel = new sql();
        $ziel->setQuery("SELECT * FROM rex_category WHERE id={$to_cat}");
        $zielpath = $ziel->getValue("path") . "-" . $to_cat;
    } else {
        ## ziel is top also path
        $zielpath = "";
    }
    ## neue kategorie schreiben
    $add = new sql();
    $add->setTable("rex_category");
    $add->setValue("name", $orig->getValue("name"));
    $add->setValue("re_category_id", $to_cat);
    $add->setValue("prior", $orig->getValue("prior"));
    $add->setValue("path", $zielpath);
    $add->setvalue("status", $orig->getValue("status"));
    $add->insert();
    ## artikel kopieren order by !!! da sonst startartikel falsch
    $articles = new sql();
    $articles->setQuery("SELECT * FROM rex_article WHERE category_id={$which} order by startpage desc");
    for ($i = 0; $i < $articles->rows; $i++, $articles->next()) {
        copyArticle($articles->getValue("id"), $add->last_insert_id);
    }
    ## suchen nach unterkategorien und diese dann natürlich mitkopieren
    ## "rekursier on" hier
    $subcats = new sql();
    $subcats->setQuery("SELECT * FROM rex_category WHERE re_category_id={$which}");
    for ($i = 0; $i < $subcats->rows; $i++, $subcats->next()) {
        copyCategory($subcats->getValue("id"), $add->last_insert_id);
    }
}
<?php

// changed 4.4.04 Carsten Eckelmann <*****@*****.**>
$KAT = new sql();
$KATs = new sql();
$KATs->setQuery("select * from rex_category");
$KATlink = "index.php?page=structure";
$KATout = "";
$KATebene = 0;
$KATcategory_id = $category_id;
$KATSQLpath = "";
$KatMaxEbenen = 5;
for ($ii = 0; $ii < $KatMaxEbenen; $ii++) {
    $KATs->counter = 0;
    for ($ik = 0; $ik < $KATs->getRows(); $ik++) {
        if ($KATcategory_id == $KATs->getValue("id")) {
            if ($REX_USER->isValueOf("rights", "structure[{$KATcategory_id}]")) {
                $STRUCTURE_PERM = TRUE;
            }
            if ($REX_USER->isValueOf("rights", "expertMode[]")) {
                $add_on = " [" . $KATs->getValue("id") . "]";
            } else {
                $add_on = "";
            }
            $KATout = " : <a href=index.php?page=structure&category_id=" . $KATs->getValue("id") . ">" . $KATs->getValue("name") . "</a>{$add_on}" . $KATout;
            $KATSQLpath = "-" . $KATs->getValue("id") . $KATSQLpath;
            $KATcategory_id = $KATs->getValue("re_category_id");
            if ($KATs->getValue("id") == $category_id) {
                $re_category_id = $KATs->getValue("re_category_id");
            }
            $KATebene++;
<?php

echo "<table border=0 cellpadding=0 cellspacing=0 width=770 ><tr><td class=grey><br>";
$boards = new sql();
$boards->setQuery("select distinct board_id from rex_5_board");
if ($boards->getRows() > 0) {
    $currentboardname = "";
    echo "<table border=0 cellpadding=5 cellspacing=1 width=100%>";
    for ($i = 0; $i < $boards->getRows(); $i++) {
        $boardname = $boards->getValue("board_id");
        echo "<tr><td class=dgrey><b><a href=index.php?page=community&subpage=board&FORM[boardname]={$boardname} class=black>{$boardname}</a></b></td></tr>";
        if ($FORM[boardname] == $boardname) {
            $currentboardname = $boardname;
        }
        $boards->next();
    }
    echo "</table><br>";
    if ($currentboardname != "") {
        $board = new rex_com_board();
        $board->addLink("page", "community");
        $board->addLink("subpage", "board");
        $board->setBoardname($currentboardname);
        // $board->setUserjoin("rex_2_user on rex_5_board.user_id=rex_2_user.id","rex_2_user.login");
        $board->setAdmin();
        $board->setAnonymous(true);
        echo $board->showBoard();
    }
} else {
    echo "&nbsp;&nbsp;Kein Board wurde eingetragen !<br>";
}
echo "<br></td></tr></table>";