Пример #1
0
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();
    }
}
/**
 * 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;
}
Пример #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;
 }
 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'));
 }
Пример #5
0
 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;
 }
function _rex_installDump($file, $debug = false)
{
    $sql = new sql();
    $sql->debugsql = $debug;
    $error = '';
    foreach (readSqlDump($file) as $query) {
        $sql->setQuery($query);
        if (($sqlerr = $sql->getError()) != '') {
            $error .= $sqlerr . "\n<br/>";
        }
    }
    return $error;
}
function CHECKONOFFSTATUS()
{
    $db = new sql();
    $today = date("Ymd");
    $sql = "\n\tSELECT id,status\n\tFROM rex_article WHERE\n\t(online_von <= '{$today}' AND online_von != '' AND online_bis = '' AND status='0')\n\tOR\n\t(online_von <= '{$today}' AND online_von != '' AND online_bis >= '{$today}' AND status='0')\n\tOR\n\t(online_von = '' AND online_bis >= '{$today}' AND status='0')\n\tOR\n\t(online_von < '{$today}' AND online_bis < '{$today}' AND online_von != '' AND online_bis != '' AND status='0')\n\tOR\n\t(online_bis < '{$today}' AND online_bis != '' AND online_von = '' AND status='1')\n\tOR\n\t(online_bis < '{$today}' AND online_bis != '' AND online_von > '{$today}' AND status='1')\n\tOR\n\t(online_bis < '{$today}' AND online_von < '{$today}' AND online_von != '' AND online_bis != '' AND status='1')\n\tOR\n\t(online_bis > '{$today}' AND online_von > '{$today}' AND online_von != '' AND online_bis != '' AND status='1')\n\t";
    $result = $db->get_array($sql);
    if (is_array($result)) {
        foreach ($result as $var) {
            $status = $var[status] == 0 ? 1 : 0;
            $sql = "UPDATE rex_article SET status = '{$status}' WHERE id='{$var['id']}'";
            $db->setQuery($sql);
        }
    }
}
 /**
  * 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 enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
 {
     foreach ($email_elements as $k => $v) {
         if ($this->elements[3] == $k) {
             $value = $v;
         }
     }
     $gd = new sql();
     // $gd->debugsql = 1;
     $gd->setQuery('select * from ' . $this->elements[1] . ' where ' . $this->elements[2] . '="' . addslashes($v) . '"');
     if ($gd->getRows() == 1) {
         $ar = $gd->get_array();
         foreach ($ar[0] as $k => $v) {
             $email_elements[$k] = $v;
         }
     }
     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 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;
 }
Пример #12
0
 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();
     }
 }
    }
}
if ($function != "edit_article") {
    //---------------------------------- Online / Offline switch
    if ($function == "online_article") {
        $sql = new sql();
        $sql->setQuery("update rex_4_article set status='1' WHERE id='" . $aid . "' AND clang='" . $clang . "'");
    }
    if ($function == "offline_article") {
        $sql = new sql();
        $sql->setQuery("update rex_4_article set status='0' WHERE id='" . $aid . "' AND clang='" . $clang . "'");
    }
    //----------------------------------- Artikel löschen
    if ($function == "delete_article") {
        $sql = new sql();
        $sql->setQuery("delete from rex_4_article WHERE id='" . $aid . "'");
        if ($sql->error == "") {
            echo preg_replace("!##msg##!", $I18N_SIMPLE_SHOP->msg("product_deleted"), $message_corpus);
        } else {
            echo preg_replace("!##msg##!", $I18N_SIMPLE_SHOP->msg("error"), $message_corpus);
        }
    }
    echo "<table class=rex border=0 cellpadding=5 cellspacing=1 width=770>\n        <tr>\n          <th class=icon width=30><a href='index.php?page=" . $mypage . "&function=edit_article&clang={$clang}&articlesearch=" . $articlesearch . "' target='_self' ><img src=pics/document_plus.gif width=16 height=16 border=0 title=\"" . $I18N->msg("article_add") . " alt=\"" . $I18N->msg("article_add") . "\"></a></th>\n          <th align=left>" . $I18N_SIMPLE_SHOP->msg("header_article") . "</th>\n\n          <th width=250 align=left>" . $I18N_SIMPLE_SHOP->msg("header_edit") . "</th>\n          <th align=left width=153>" . $I18N_SIMPLE_SHOP->msg("header_status") . "</th>\n        </tr>\n        ";
    if (isset($articlesearch)) {
        //---------------------------------- Liste der Artikel
        $artikle_objekts = shop_category::getArticleList($clang, $articlesearch);
        for ($i = 0; $i < count($artikle_objekts); $i++) {
            echo "\n        <tr>\n        <td class=grey width=30 align=center><a href='index.php?page=" . $mypage . "&function=edit_article&aid=" . $artikle_objekts[$i]->getId() . "&clang={$clang}&articlesearch=" . $articlesearch . "' target='_self'><img src=\"pics/document.gif\" border=\"0\" height=\"16\" width=\"16\"></A></td>\n        <td class=grey>" . $artikle_objekts[$i]->getName() . "</td>\n        <td class=grey width=250 ><a href='index.php?page=" . $mypage . "&function=edit_article&aid=" . $artikle_objekts[$i]->getId() . "&clang={$clang}&articlesearch=" . $articlesearch . "' target='_self'>" . $I18N_SIMPLE_SHOP->msg("header_article_edit") . "</td>";
            if ($artikle_objekts[$i]->getStatus() == 0) {
                $article_status = "<a href='index.php?page=simple_shop&aid=" . $artikle_objekts[$i]->getId() . "&function=online_article&clang={$clang}&articlesearch=" . $articlesearch . "'><font color=#dd0000>" . $I18N->msg("status_offline") . "</font></a>";
            } elseif ($artikle_objekts[$i]->getStatus() == 1) {
Пример #14
0
        echo '<br />' . nl2br(htmlspecialchars($file_description)) . '<br /><br />' . $file_stamp . '|' . $file_updateuser . '</td>' . "\n";
        echo '  <td valign="top" class="grey">' . $opener_link . '</td>' . "\n";
        echo '</tr>' . "\n\n";
        $files->next();
    }
    if ($files->getRows() == 0) {
        // ----- no items found
        // print "<tr><td colspan=5>&nbsp;</td>";
        print "<tr>\r\n      <td class=grey align=center>&nbsp;</td>\r\n      <td class=grey colspan=3>" . $I18N->msg('pool_nomediafound') . "</td>\r\n      </tr>";
    } elseif ($PERMALL) {
        print "</table>";
        print "<table class=rex border=0 cellpadding=5 cellspacing=1 style='width:100%'>\n";
        // ----- move and delete selected items
        print "<tr>\r\n      <td align=center class=icon><!-- " . $I18N->msg('pool_select_all') . " --><input type=checkbox name=checkie value=0 onClick=\"SetAllCheckBoxes('rex_file_list','selectedmedia[]',this)\"></td>";
        $filecat = new sql();
        $filecat->setQuery("SELECT * FROM " . $REX['TABLE_PREFIX'] . "file_category ORDER BY name ASC LIMIT 1");
        if ($filecat->getRows() > 0) {
            print "\r\n      <!-- <td class=grey><b>" . $I18N->msg('pool_selectedmedia') . "</b>&nbsp;</td>-->\r\n      <td class=grey>" . $cats_sel->out() . "</td>\r\n      <td class=grey><input type=submit value=\"" . $I18N->msg('pool_changecat_selectedmedia') . "\" onclick=\"document.rex_file_list.media_method.value='updatecat_selectedmedia';\"></td>\r\n      <td class=grey width=150><input type=submit value=\"" . $I18N->msg('pool_delete_selectedmedia') . "\" onclick=\"document.rex_file_list.media_method.value='delete_selectedmedia';return confirm('" . $I18N->msg('delete') . " ?');\"></td>\r\n      ";
        } else {
            print "\r\n      <td class=grey>&nbsp;</td>\r\n      <td class=grey width=150><input type=submit value=\"" . $I18N->msg('pool_delete_selectedmedia') . "\" onclick=\"document.rex_file_list.media_method.value='delete_selectedmedia';return confirm('" . $I18N->msg('delete') . " ?');\" ></td>\r\n      ";
        }
        print "</tr>";
    }
    print "</form>";
    print "</table>";
}
echo "</body></html>";
function converDescription($description)
{
    return htmlspecialchars($description);
}
 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;
 }
                echo "<tr><td colspan=3></td></tr><tr>\r\n\t\t\t\t\t<td class=grey>&nbsp;</td>\r\n\t\t\t\t\t<td class=grey>" . $gaa_sel->out() . "</td>\r\n\t\t\t\t\t<td class=grey><input type=submit value='" . $I18N->msg("action_add") . "'></td>\r\n\t\t\t\t\t</tr>";
                echo "</form>";
            }
        }
        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");
        }
 function checkLogin()
 {
     // wenn logout dann header schreiben und auf error seite verweisen
     // message schreiben
     $ok = false;
     if (!$this->logout) {
         if ($this->usr_login != "") {
             // wenn login daten eingegeben dann checken
             // auf error seite verweisen und message schreiben
             $this->USER = new sql($this->DB);
             $USR_LOGIN = $this->usr_login;
             $USR_PSW = $this->usr_psw;
             $query = str_replace("USR_LOGIN", $this->usr_login, $this->login_query);
             $query = str_replace("USR_PSW", $this->usr_psw, $query);
             //				 $this->USER->debugsql = 1;
             $this->USER->setQuery($query);
             if ($this->USER->getRows() == 1) {
                 $ok = true;
                 $_SESSION[UID][$this->system_id] = $this->USER->getValue($this->uid);
                 // Erfolgreicher Login in der DB vermerken
                 $sql = new sql();
                 $sql->setQuery('UPDATE rex_user SET lasttrydate ="' . time() . '" WHERE login ="******"');
             } else {
                 $this->message = $this->text[30];
                 $_SESSION[UID][$this->system_id] = "";
                 // session_unregister("REX_SESSION");
             }
         } elseif ($_SESSION[UID][$this->system_id] != "") {
             // wenn kein login und kein logout dann nach sessiontime checken
             // message schreiben und falls falsch auf error verweisen
             $this->USER = new sql($this->DB);
             $query = str_replace("USR_UID", $_SESSION[UID][$this->system_id], $this->user_query);
             // $this->USER->debugsql = 1;
             $this->USER->setQuery($query);
             if ($this->USER->getRows() == 1) {
                 // echo $REX_SESSION[ST][$this->system_id]." + ".$this->session_duration." > ".time();
                 if ($_SESSION[ST][$this->system_id] + $this->session_duration > time()) {
                     $ok = true;
                     $_SESSION[UID][$this->system_id] = $this->USER->getValue($this->uid);
                 } else {
                     $this->message = $this->text[10];
                 }
             } else {
                 $this->message = $this->text[20];
             }
         } else {
             $this->message = $this->text[40];
             $ok = false;
         }
     } else {
         $this->message = $this->text[50];
         $_SESSION[UID][$this->system_id] = "";
         // session_unregister("REX_SESSION");
     }
     if ($ok) {
         // wenn alles ok dann REX[UID][system_id) schreiben
         $_SESSION[ST][$this->system_id] = time();
         //session_register("REX_SESSION");
         // $_SESSION['REX_SESSION'] = $REX_SESSION;
     } else {
         // wenn nicht, dann UID loeschen und error seite
         $_SESSION[ST][$this->system_id] = "";
         $_SESSION[UID][$this->system_id] = "";
         // header("Location: $this->error_page"."&FORM[loginmessage]=".urlencode($this->message));
         // echo $this->message;
     }
     return $ok;
 }
Пример #18
0
 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;
         }
     }
 }
Пример #19
0
     $meta_sql->setValue("file", $REX_MEDIA_1);
     // ----------------------------- / FILE UPLOAD
     $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>';
 }
}
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>';
}
Пример #21
0
        $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>";
}
Пример #22
0
         $sql->setQuery("select template_id from rex_article where category_id={$category_id} and startpage=1");
         if ($sql->getRows() == 1) {
             $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) {
/**
 * 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();
}
Пример #24
0
<?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>";
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);
    }
}
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;
}
 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 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;
 }
<?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++;
Пример #30
0
         }
         $sql = new sql();
         $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>";