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 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=100% cellpadding=5 cellspacing=1 border=0 bgcolor=#ffffff>";
     $echo .= $this->table_header;
     // ------------- HEADER
     $echo .= "<tr><td colspan=" . ($this->data_num + $this->column_num) . " class=lgrey><b>";
     // ------------- 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;
     }
     $echo .= "<a href=index.php?article_id=" . $this->article_id . "&FORM[next]={$before}" . $this->addonlink . "><img src={$REX['HTDOCS_PATH']}/pics/back.gif width=24 height=13 border=0></a> ";
     $echo .= "<a href=index.php?article_id=" . $this->article_id . "&FORM[next]={$next}" . $this->addonlink . "><img src={$REX['HTDOCS_PATH']}/pics/forward.gif width=24 height=13 border=0></a>";
     $echo .= " &nbsp; &nbsp; &nbsp; &nbsp; {$list_start} - {$list_end} of {$this->rows} ";
     $echo .= "</b></td></tr>";
     // ------------ QUERY NEU ERSTELLEN MIT LIMIT
     $limit = "LIMIT " . $list_start . "," . $this->list_amount;
     $SQL = new sql($this->DB);
     $SQL->setQuery("{$this->query} {$limit}");
     // ------------ <TH>HEADLINES
     $echo .= "<tr>";
     for ($i = 1; $i <= $this->data_num; $i++) {
         $echo .= "<th>";
         $echo .= $this->data_name[$i];
         $echo .= "</th>";
         if ($this->column_name[$i] != "") {
             $echo .= "<th>&nbsp;</th>";
         }
     }
     $echo .= "</tr>";
     // ------------ ERSTELLUNG DER LISTE
     for ($j = 0; $j < $SQL->getRows(); $j++) {
         // $echo .= "<tr onmouseover=\"setPointer(this,'#d8dca5')\" onmouseout=\"setPointer(this,'#f0efeb')\">";
         $echo .= "<tr id=tr{$j}>";
         for ($i = 1; $i <= $this->data_num; $i++) {
             $echo .= "<td class=grey valign=top>";
             switch ($this->format[$i]) {
                 case "activestatus":
                     if ($SQL->getValue($this->data[$i]) == 0) {
                         $value = "inactive";
                     } else {
                         $value = "active";
                     }
                     break;
                 case "status":
                     if ($SQL->getValue($this->data[$i]) == 0) {
                         $value = "inactive user";
                     } elseif ($SQL->getValue($this->data[$i]) == 7) {
                         $value = "superadmin";
                     } elseif ($SQL->getValue($this->data[$i]) > 4) {
                         $value = "admin";
                     } elseif ($SQL->getValue($this->data[$i]) == 1) {
                         $value = "guest";
                     } else {
                         $value = "user";
                     }
                     break;
                 case "dt":
                     $value = date_from_mydate($SQL->getValue($this->data[$i]), "M-d Y H:i:s");
                     break;
                 case "hour":
                     $value = $SQL->getValue($this->data[$i]) . " h";
                     break;
                 case "minutes":
                     $minutes = $SQL->getValue($this->data[$i]);
                     $value = "{$minutes} min";
                     break;
                 case "minute2hour":
                     $hours = intval($SQL->getValue($this->data[$i]) / 60);
                     $minutes = ($SQL->getValue($this->data[$i]) - $hours * 60) / 60 * 100;
                     if ($minutes < 10) {
                         $minutes = "0{$minutes}";
                     } elseif ($minutes == 0) {
                         $minutes = "00";
                     }
                     $value = "{$hours},{$minutes}";
                     break;
                 case "date":
                     $value = date_from_mydate($SQL->getValue($this->data[$i]), "Y-M-d");
                     break;
                 case "time":
                     $value = substr($SQL->getValue($this->data[$i]), 0, 2) . ":" . substr($SQL->getValue($this->data[$i]), 2, 2) . "";
                     break;
                 case "unixToDateTime":
                     $value = date("d.M.Y H:i:s", $SQL->getValue($this->data[$i]));
                     break;
                 case "nl2br":
                     $value = nl2br($SQL->getValue($this->data[$i]));
                     break;
                 case "prozent":
                     $value = "<img src=/pics/p_prozent/" . show_prozent($SQL->getValue($this->data[$i])) . ".gif height=13 width=50>";
                     break;
                 case "substr":
                     $value = $SQL->getValue($this->data[$i]);
                     $elements = imap_mime_header_decode($value);
                     $value = "";
                     for ($k = 0; $k < count($elements); $k++) {
                         // echo "Charset: {$elements[$i]->charset}\n";
                         $value .= $elements[$k]->text;
                     }
                     $value = substr($value, 0, $this->format_value1[$i]);
                     $value = htmlentities($value);
                     break;
                 case "content":
                     $value = $this->data[$i];
                     break;
                 case "js":
                     $value = $SQL->getValue($this->data[$i]);
                     $elements = imap_mime_header_decode($value);
                     $value = "";
                     for ($k = 0; $k < count($elements); $k++) {
                         // echo "Charset: {$elements[$i]->charset}\n";
                         $value .= $elements[$k]->text;
                     }
                     if ($value == "") {
                         $value = "<no entry>";
                     }
                     if ($this->format_value4[$i] == "") {
                         $value = substr($value, 0, 30);
                     } else {
                         if ($this->format_value4[$i] == "nosubstr") {
                             $value = $value;
                         } else {
                             $value = substr($value, 0, $this->format_value4[$i]);
                         }
                     }
                     $value = nl2br(htmlentities($value));
                     $value = "<a href=javascript:" . $this->format_value1[$i] . $SQL->getValue($this->format_value2[$i]) . $this->format_value3[$i] . ">{$value}</a>";
                     break;
                 case "boldstatus":
                     // **********************
                     // Prozer Special: MAIL
                     // zum anzeigen von bold falls TRUE(1)
                     // **********************
                     $value = $SQL->getValue($this->data[$i]);
                     $elements = imap_mime_header_decode($value);
                     $value = "";
                     for ($k = 0; $k < count($elements); $k++) {
                         // echo "Charset: {$elements[$i]->charset}\n";
                         $value .= $elements[$k]->text;
                     }
                     if ($value == "") {
                         $value = "<no subject entered>";
                     }
                     $value = substr($value, 0, 30);
                     $value = htmlentities($value);
                     if (!$SQL->getValue($this->format_value1[$i])) {
                         $value = "<b>{$value}</b>";
                     }
                     break;
                 case "image":
                     // **********************
                     // Prozer Special
                     // zum anzeigen von bold falls TRUE(1)
                     // **********************
                     if ($SQL->getValue($this->format_value1[$i]) > 0) {
                         $value = $this->format_value2[$i] . " " . htmlentities($SQL->getValue($this->data[$i]));
                     } else {
                         $value = " ";
                     }
                     break;
                 case "statustodo":
                     // **********************
                     // Prozer Special
                     // zum anzeigen von bold falls TRUE(1)
                     // **********************
                     $value = $SQL->getValue($this->data[$i]);
                     if ($value == 0) {
                         $value = "done";
                     } elseif ($value == 1) {
                         $value = "in work";
                     } elseif ($value == 2) {
                         $value = "new";
                     }
                     break;
                 case "checkbox":
                     $value = "<input onclick=setTRColor('tr{$j}','#f0efeb','#d8dca5',this.checked); type=checkbox name='" . $this->format_value1[$i] . "' value='" . $SQL->getValue($this->data[$i]) . "'>";
                     break;
                 default:
                     $value = htmlentities($SQL->getValue($this->data[$i]));
             }
             if ($value == "") {
                 $value = "-";
             }
             if ($this->link_to[$i] != "") {
                 $link = $this->link_to[$i];
                 $link_field = $this->link_field[$i];
                 if ($this->link_field[$i] != "") {
                     $value = "<a href=" . $this->link_to[$i] . urlencode($SQL->getValue($link_field)) . $this->addonlink . " class=yel>{$value}</a>";
                 } else {
                     $value = value;
                 }
             }
             $echo .= $value;
             $echo .= "</td>\n";
             if ($this->column_name[$i] != "") {
                 $link_name = $this->column_link[$i];
                 $link_field = $this->column_linkadd[$i];
                 $column_name = $this->column_name[$i];
                 $column_ausgabe = "<td class=grey valign=top><a href={$link_name}";
                 $column_ausgabe .= $SQL->getValue($link_field);
                 $column_ausgabe .= $this->column_linkend[$i];
                 $column_ausgabe .= " class=yel>{$column_name}</a></td>";
                 $echo .= $column_ausgabe;
             }
         }
         $echo .= "</tr>";
         $SQL->next();
     }
     $echo .= $this->table_footer;
     $echo .= "</table><br>";
     return $echo;
 }