$ausgaben["num_row"] = $ausgaben["num_row_tag"];
    $ausgaben["num_col"] = $ausgaben["num_col_tag"];
}
// tabelle zusammenbauen
if (count($tab_rows) > 0) {
    $ausgaben["tabelle"] = "<table width=\"100%\">\n";
    $ausgaben["tabelle"] .= "<tr>\n" . implode("</tr>\n<tr>\n", $tab_rows) . "</tr>\n";
    $ausgaben["tabelle"] .= "</table>";
}
// abspeichern, part 2
// * * *
if ($environment["parameter"][7] == "verify" && ($_POST["send"] != "" || $_POST["add"] != "" || $_POST["sel"] != "" || $_POST["refresh"] != "" || $_POST["upload"] != "")) {
    $tab = "[TAB=" . implode(";", $_POST["tagwerte"]) . "]\n";
    $num_cell = 0;
    for ($i = 0; $i < $_POST["num_row"]; $i++) {
        $tab .= "[ROW]\n";
        for ($k = 0; $k < $_POST["num_col"]; $k++) {
            if ($i == 0 && $_POST["col_header"] == -1) {
                $tab .= "[TH]" . tagremove(trim($_POST["cells"][$i][$k])) . "[/TH]\n";
            } else {
                $tab .= "[COL]" . trim($_POST["cells"][$i][$k]) . "[/COL]\n";
            }
            $num_cell++;
        }
        $tab .= "[/ROW]\n";
    }
    $tab .= "[/TAB]";
    $to_insert = $tab;
}
// + + +
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // funktions bereich
 // ***
 ### put your code here ###
 /* z.B. db query */
 $sql = "SELECT * FROM " . $cfg["db"]["info"]["entries"];
 if ($debugging["sql_enable"]) {
     $debugging["ausgabe"] .= "sql: " . $sql . $debugging["char"];
 }
 // seiten umschalter
 $inhalt_selector = inhalt_selector($sql, $environment["parameter"][1], $cfg["db"]["info"]["rows"], $parameter, 1, 3, $getvalues);
 $ausgaben["inhalt_selector"] = $inhalt_selector[0] . "<br />";
 $sql = $inhalt_selector[1];
 $ausgaben["anzahl"] = $inhalt_selector[2];
 $result = $db->query($sql);
 while ($data = $db->fetch_array($result, 1)) {
     $dataloop["liste"][] = array("titel" => $data[$cfg["db"]["info"]["titel"]], "teaser" => tagremove($data[$cfg["db"]["info"]["teaser"]]), "datum" => substr($data[$cfg["db"]["info"]["datum_von"]], 8, 2) . "." . substr($data[$cfg["db"]["info"]["datum_von"]], 5, 2) . "." . substr($data[$cfg["db"]["info"]["datum_von"]], 0, 4), "link" => $cfg["basis"] . "/details," . $data[$cfg["db"]["info"]["key"]] . ".html");
 }
 // +++
 // funktions bereich
 // page basics
 // ***
 // fehlermeldungen
 if ($HTTP_GET_VARS["error"] != "") {
     if ($HTTP_GET_VARS["error"] == 1) {
         $ausgaben["form_error"] = "#(error1)";
     }
 } else {
     $ausgaben["form_error"] = "";
 }
 // navigation erstellen
 $ausgaben["link_new"] = $cfg["basis"] . "/add.html";
 # automatik geht $mapping["main"] = "1943315524.email";
 #if ( $debugging["html_enable"] ) $debugging["ausgabe"] .= "<font color=\"#FF0000\">ATTENTION: template overwrite -> ".$mapping["main"].".tem.html</font>".$debugging["char"];
 $mapping["navi"] = "leer";
 // wohin schicken
 $ausgaben["form_error"] = "";
 $ausgaben["form_aktion"] = $cfg["basis"] . "/" . $cfg["ebene"]["zwei"] . "/email,form,send," . $environment["parameter"][2] . ".html";
 // referer im form mit hidden element mitschleppen
 if ($HTTP_POST_VARS["form_referer"] == "") {
     $ausgaben["form_referer"] = $_SERVER["HTTP_REFERER"];
     $ausgaben["form_break"] = $ausgaben["form_referer"];
 } else {
     $ausgaben["form_referer"] = $HTTP_POST_VARS["form_referer"];
     $ausgaben["form_break"] = $ausgaben["form_referer"];
 }
 $ausgabe = tagremove($data["itext"], true);
 $ausgabe_ilead = tagremove($data["ilead"]);
 // beschreibung ausgeben
 if ($data["ilead"]) {
     $ausgaben["itext"] = $ausgabe_ilead;
 } else {
     $ausgaben["itext"] = substr($ausgabe, 0, 300) . "...";
     #$ausgaben["itext"] = tagremove_buffy (substr ($data["itext"],0,300)."...");
 }
 $ausgaben["iautor"] = $data["iautor"];
 $ausgaben["ikategorie"] = $data["ikategorie"];
 $ausgaben["ititel"] = $data["ititel"];
 if ($environment["parameter"][2] == "send") {
     // form eingaben prüfen
     form_errors($form_options, $form_values);
     // artikel abschicken
     if ($ausgaben["form_error"] == "" && ($HTTP_POST_VARS["submit"] != "" || $HTTP_POST_VARS["image"] != "")) {
while ($data = $db->fetch_array($result, $nop)) {
    foreach ($data as $key => $value) {
        ${$key} = $value;
    }
    // titel verlinken
    #$ititel = "<a class=\"id_head\" \"href=\"".$cfg["basis"]."/".$cfg["ebene"]["zwei"]."/details,".$data[$cfg["db"]["key"]].".html\">".$ititel."</a>";
    // datum richtig setzen
    $ierstellt = substr($ierstellt, 8, 2) . "." . substr($ierstellt, 5, 2) . "." . substr($ierstellt, 0, 4);
    // nicht freigegebene artikel markieren
    if ($iaktiv != -1) {
        $ierstellt = $ierstellt . "<br><i>(keine Freigabe)</i>";
    }
    // wenn es keinen lead gibt 300 zeichen text ohne tags nehmen
    $ilead = tagremove($ilead);
    if ($ilead == "") {
        $itext = tagremove($itext);
        $ilead = substr($itext, 0, 300);
    }
    if ($ikategorie) {
        $ikategorie = "," . $ikategorie;
        #}
    }
    if ($data["ikategorie"]) {
        $kat = "/" . $data["ikategorie"];
    } else {
        $kat = "";
    }
    #echo $data["ikategorie"];
    // mehr link
    $mehr = $cfg["basis"] . "/" . $data["ibereich"] . "/details," . $data[$cfg["db"]["key"]] . ".html";
    #$mehr = $cfg["basis"]."/".$cfg["ebene"]["zwei"]."/details,".$data[$cfg["db"]["key"]].".html";
 // space killer
 if ($specialvars["denyspace"] == -1) {
     $pattern = "  +";
     while (preg_match("/" . $pattern . "/", $content, $tag)) {
         $content = str_replace($tag[0], " ", $content);
     }
 }
 // neuen content in session zwischenscheichern
 if ($_POST["ajax"] == "on") {
     //                     // experimentell: html in tag umwandeln
     //                     $content = html2tag($content,"none");
     if (file_exists($pathvars["moduleroot"] . "customer/" . $wizard_name . ".inc.php")) {
         include $pathvars["moduleroot"] . "customer/" . $wizard_name . ".inc.php";
     }
     $content = tagreplace($content);
     $content = tagremove($content);
     if (get_magic_quotes_gpc() == 1) {
         $content = stripslashes($content);
     }
     if ($cfg["wizard"]["utf8"] != TRUE) {
         $content = utf8_encode($content);
     }
     header("HTTP/1.0 200 OK");
     echo preg_replace(array("/#\\{.+\\}/U", "/g\\(.+\\)/U"), "", $content);
     die;
 }
 if (get_magic_quotes_gpc() == 1) {
     $content = stripslashes($content);
 }
 $_SESSION["wizard_content"][$identifier] = $content;
 if ($_POST["add"] || $_POST["sel"] || $_POST["create_sel"] || $_POST["upload"] || $_POST["uploaded"] || $_POST["change_pic"]) {
    $debugging["ausgabe"] .= "[ ** {$script_name} ** ]" . $debugging["char"];
}
// konfiguration
#require $pathvars["config"]."addon/sitesearch.inc.php";
if ($debugging["html_enable"]) {
    $debugging["ausgabe"] .= "(1) funktion: " . $environment["subparam"][1] . $debugging["char"];
}
$ausgaben["sitesearch_aktion"] = $pathvars["virtual"] . "/sitesearch,search.html";
$ausgaben["sitesearch_search"] = $HTTP_POST_VARS["search"];
if ($environment["param"][1] == "search") {
    $sql = "SELECT lang, tname, content, ebene, kategorie FROM site_text WHERE content LIKE '%" . $HTTP_POST_VARS["search"] . "%'";
    $result = $db->query($sql);
    while ($site_text = $db->fetch_array($result, $nop)) {
        #$path = str_replace(".","/",$site_text["tname"]);
        $ausgaben["output"] .= "<a target=\"_top\" href=\"" . $pathvars["virtual"] . $site_text["ebene"] . "/" . $site_text["kategorie"] . ".html\">Seite: " . $site_text["ebene"] . "/" . $site_text["kategorie"] . ".html</a><br>";
        $site_text["content"] = tagremove($site_text["content"]);
        $pos = strpos($site_text["content"], $HTTP_POST_VARS["search"]);
        $laenge = strlen($site_text["content"]);
        $bereich = 120;
        $how = $bereich / 2;
        if ($bereich >= $laenge) {
            $start = 0;
        } elseif ($pos >= $how) {
            $start = $pos - $how;
        } elseif ($pos == 0) {
            $start = $pos;
        } else {
            $start = $how - $pos;
        }
        $found = substr($site_text["content"], $start, $bereich);
        $ausgaben["output"] .= "... " . " " . $found . " ( {$laenge} / {$bereich} / {$pos} / {$start} )" . " ...<br><br>";
// * * *
if ($environment["parameter"][7] == "verify" && ($_POST["send"] != "" || $_POST["add"] != "" || $_POST["sel"] != "" || $_POST["refresh"] != "" || $_POST["upload"] != "")) {
    $buffer = "";
    foreach ($_POST["areas"] as $key => $value) {
        if ($key % 2 == 1 && $_POST[$key] == $key) {
            $list_display = preg_split("/(" . chr(10) . ")/", $value, -1, PREG_SPLIT_NO_EMPTY);
            $e = "";
            foreach ($list_display as $test) {
                $e .= "[DIV]" . $test . "[/DIV]";
            }
            $value = $e;
        }
        $value = preg_replace("/\\[\\/DIV\\][\\s]?/", "[/DIV]", $value);
        $ende[] = $value;
    }
    foreach ($ende as $key => $value) {
        $trenner = "[*]";
        if ($key == 0) {
            $trenner = "";
        }
        $list_buffer .= $trenner . $value;
    }
    $list_buffer = preg_replace("/^\\[\\*\\]/", "", $list_buffer);
    // verbotenen tags rausfiltern
    $buffer = array();
    foreach ($allowed_tags as $value) {
        $buffer[] = "[/" . strtoupper($value) . "]";
    }
    $to_insert = $tag_meat[$tag_marken[0]][$tag_marken[1]]["tag_start"] . tagremove($list_buffer, False, $buffer) . $tag_meat[$tag_marken[0]][$tag_marken[1]]["tag_end"];
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Example #8
0
     if ($rechte[news_edit] == -1) {
         # seite hinzufuehgen
         $ausgaben[inh_select] .= "<a href=\"" . $pathvars[virtual] . "/news/create_page," . $environment[param][1] . "," . $neueseite . ".html\">[New]</a>";
     }
     $mapping[main] = "news.tem1";
 } else {
     // beitrag uebersicht zusammensetzen
     $ausgaben[news_rspalte] = "";
     $sql = "SELECT * FROM " . BEITRAG_KOPF . " WHERE " . $news_where_statement_aktuell;
     $result = $db->query($sql);
     while ($news = $db->fetch_array($result, 1)) {
         $ausgaben[news_ueberschrift] = "<a href=\"" . $pathvars[virtual] . "/news," . $news[beitragid] . ",1.html\">" . $news[beitrag] . "</a><br />";
         $sql = "SELECT " . $environment[news_uebersicht_pre_inh] . " FROM " . BEITRAG_INHALT . " where beitragid = '" . $news[beitragid] . "'";
         $inh_result = $db->query($sql);
         $row = $db->fetch_row($inh_result, 1);
         $ausgaben[news_teiltext] = tagremove($row[0]);
         $ausgaben[news_teiltext] = substr($ausgaben[news_teiltext], 0, $environment[news_uebersicht_pre_len]) . "&nbsp;<a href=\"" . $pathvars[virtual] . "/news," . $news[beitragid] . ",1.html\">... mehr?</a><br />";
         if ($spalte == "news_lspalte") {
             $spalte = "news_rspalte";
         } else {
             $spalte = "news_lspalte";
         }
         $ausgaben[$spalte] .= parser("news.preview", "") . "<br />";
     }
     $mapping[main] = "news";
     if ($ausgaben[news_lspalte] == "") {
         $ausgaben[news_lspalte] = "Aktuell keine Eintr&auml;ge";
     }
     if ($ausgaben[news_rspalte] == "") {
         $ausgaben[news_rspalte] = "Aktuell keine weiteren Eintr&auml;ge";
     }
    $pt_datum[0] .= " " . $search;
    $specialvars["pagetitle"] = implode($defaults["split"]["title"], $pt_datum);
    $hidedata["anfrage"]["suche"] = $search;
}
// kalender einblenden
include $pathvars["moduleroot"] . "libraries/function_calendar.inc.php";
$ausgaben["calendar"] .= "<div class=\"box\">" . calendar("", "", "cal_termine", -1, -1) . "</div>";
include $pathvars["moduleroot"] . "libraries/function_menu_convert.inc.php";
include $pathvars["moduleroot"] . "libraries/function_show_blog.inc.php";
$tags[titel] = "H1";
$tags[teaser] = "P=teaser";
$tags[image] = "IMG=";
// loopen der artikel
$dataloop["artikel"] = show_blog("/aktuell/archiv", $tags, "disabled", "0,1", "/aktuell/archiv");
if (is_array($dataloop["artikel"])) {
    $dataloop["artikel"][1]["teaser_org"] = tagremove($dataloop["artikel"][1]["teaser_org"]);
}
$dataloop["more_artikel"] = show_blog("/aktuell/archiv", $tags, "disabled", "1,3", "/aktuell/archiv");
if (count($dataloop["artikel"]) > 0) {
    $hidedata["artikel"]["on"] = "on";
}
// loopen der pressemitteilungen
$dataloop["presse"] = show_blog("/aktuell/presse", $tags, "disabled", "0,4", "/aktuell/presse");
if (count($dataloop["presse"]) > 0) {
    $hidedata["presse"]["on"] = "on";
}
// loopen der termine
$ter_tname = eCRC("/aktuell/termine") . ".%";
$dd = date('U');
$sql_t = "Select Cast(SUBSTR(content,POSITION('[SORT]' IN content)+6,POSITION('[/SORT]' IN content)-POSITION('[SORT]' IN content)-6) as DATETIME) as date,tname,ebene,kategorie,content from site_text\n            WHERE\n                status='1' AND\n                ( tname like '" . $ter_tname . "') AND (\n                Cast(SUBSTR(content,POSITION('[SORT]' IN content)+6,POSITION('[/SORT]' IN content)-POSITION('[SORT]' IN content)-6) as DATETIME) > '" . date('Y-m-d', $dd) . " 00:00:00'\n                OR\n                Cast(SUBSTR(content,POSITION('[_TERMIN]' IN content)+9,POSITION('[/_TERMIN]' IN content)-POSITION('[_TERMIN]' IN content)-9) as DATETIME) > '" . date('Y-m-d', $dd) . " 00:00:00'\n                ) AND\n                SUBSTR(content,POSITION('[KATEGORIE]' IN content),POSITION('[/KATEGORIE]' IN content)-POSITION('[KATEGORIE]' IN content))= '[KATEGORIE]/aktuell/termine' \n                ORDER BY date LIMIT 0,4";
$result_t = $db->query($sql_t);
             $ersatz .= "\n   * " . $key . "\n";
         }
         $text = str_replace($wert, $ersatz . "\n", $text);
         $wert = "";
         $ersatz = "";
     }
     return $text;
 }
 $ausgabe = tagremove($data["itext"], true);
 $ausgabe_ilead = tagremove($data["ilead"]);
 // beschreibung ausgeben
 if ($data["ilead"]) {
     $ausgaben["itext"] = $ausgabe_ilead;
 } else {
     #            $ausgaben["itext"] = substr($ausgabe,0,300)."...";
     $ausgaben["itext"] = tagremove(substr($data["itext"], 0, 300) . "...");
 }
 $ausgaben["iautor"] = $data["iautor"];
 $ausgaben["ikategorie"] = $data["ikategorie"];
 $ausgaben["ititel"] = $data["ititel"];
 if ($environment["parameter"][2] == "send") {
     // form eingaben prüfen
     form_errors($form_options, $form_values);
     // artikel abschicken
     if ($ausgaben["form_error"] == "" && ($HTTP_POST_VARS["submit"] != "" || $HTTP_POST_VARS["image"] != "")) {
         $url = "URL dieses Beitrages:\n" . "http://www.bvv.bayern.de" . $cfg["basis"] . "/" . $environment["katid"] . "/details," . $environment["parameter"][3] . ".html";
         // itext u. ititel mit einigen angaben erweitern
         if ($form_values["emailzusatz"] != "") {
             $zusatz = "-----\n" . $form_values["emailzusatz"] . "\n-----\n";
         } else {
             $zusatz = "";
function rss_get_content($path, $only_sub = 0, $label = "")
{
    global $db, $pathvars, $environment, $dataloop, $hidedata, $cfg;
    // ebene und kategorie bauen
    $array = explode("/", $path);
    $kategorie = array_pop($array);
    if (count($array) > 1) {
        $ebene = implode("/", $array);
        $tname = eCRC($ebene) . "." . $kategorie;
    } else {
        $ebene = "";
        $tname = $kategorie;
    }
    if ($only_sub == -1) {
        $sql = "SELECT  *\n                      FROM  " . $cfg["rss"]["db"]["text"]["entries"] . "\n                     WHERE tname LIKE '" . eCRC($path) . "%'\n                       AND label='" . $cfg["rss"]["def_label"] . "'\n                       AND lang='" . $environment["language"] . "'\n                       AND status=1";
    } else {
        $sql = "SELECT  *\n                      FROM  " . $cfg["rss"]["db"]["text"]["entries"] . "\n                     WHERE (tname='" . $tname . "' OR tname LIKE '" . eCRC($path) . "%')\n                       AND label='" . $cfg["rss"]["def_label"] . "'\n                       AND lang='" . $environment["language"] . "'\n                       AND status=1";
    }
    $result = $db->query($sql);
    while ($data = $db->fetch_array($result, 1)) {
        $test_suffix = "";
        // AUSNAHMEN
        // direkte unterseiten von aktuell (z.B. /aktuell/archiv.html)
        if (strstr($data["tname"], "2573533673")) {
            continue;
        }
        // ZEIT-STEUERUNG
        // heute
        $timestamp_heute = mktime();
        // start-datum
        if (preg_match("#\\[SORT\\](.*)\\[/SORT\\]#U", $data["content"], $match)) {
            $date_start = $match[1];
            if (preg_match("/^([0-9]{4})-([0-9]{2})-([0-9]{2})/", $date_start, $date_match)) {
                $timestamp_start = mktime("0", "0", "0", $date_match[2], $date_match[3], $date_match[1]);
            } else {
                // falls nicht angegeben, ganz frueher annehmen
                $timestamp_start = mktime(0, 0, 0, 1, 1, 1971);
            }
        } else {
            // falls nicht angegeben, ganz frueher annehmen
            $date_start = "1971-01-01";
            $timestamp_start = mktime(0, 0, 0, 1, 1, 1971);
        }
        //             // end-datum
        //             if ( preg_match("#\[ENDE\](.*)\[/ENDE\]#U",$data["content"],$match) ) {
        //                 $date_ende = $match[1];
        //                 preg_match("/^([0-9]{4})-([0-9]{2})-([0-9]{2})/",$date_ende,$date_match);
        //                 if ( $date_match[0] != "" && !strstr($match[1],"1970-01-01")  ) {
        //                     $timestamp_ende = mktime(23,59,59,$date_match[2],$date_match[3],$date_match[1]);
        //                 } else {
        //                     // falls nicht angegeben, morgen nacht annehmen
        //                     $timestamp_ende = mktime(23,59,59,date("m"),(date("d")+1),date("Y"));
        //                 }
        //             } else {
        //                 // falls nicht angegeben, morgen nacht annehmen
        //                 $date_ende = date("Y")."-".(date("d")+1)."-".(date("d")+1);
        //                 $timestamp_ende = mktime(23,59,59,date("m"),(date("d")+1),date("Y"));
        //                 // falls bei terminen kein end-datum startdatum setzen
        //                 if ( strstr($data["tname"],"1884525588") ) $timestamp_ende = $timestamp_start;
        //             }
        //             // abgelaufenen werden auf alle faelle rausgeschnissen
        //             if ( $timestamp_heute > $timestamp_ende ) continue;
        // wenn startdatum noch nicht erreicht ist rausschmeissen (ausnahme: termine)
        if (!strstr($data["tname"], "1884525588")) {
            if ($timestamp_start > $timestamp_heute) {
                continue;
            }
        }
        // kategorieueberpruefung fuer amts-artikel
        preg_match("#\\[KATEGORIE\\](.*)\\[/KATEGORIE\\]#U", $data["content"], $match);
        if ($_GET["kategorie"] != "") {
            if ($match[1] != "" && !strstr($match[1], $_GET["kategorie"])) {
                continue;
            }
        } else {
            if ($match[1] != "" && !strstr($match[1], $environment["ebene"])) {
                continue;
            }
        }
        // titel
        $title = "---";
        if (strstr($data["tname"], "1884525588")) {
            preg_match("/\\[_NAME\\](.+)\\[\\/_NAME/Us", $data["content"], $match);
        } else {
            preg_match("/\\[H[0-9]{1}\\](.+)\\[\\/H/Us", $data["content"], $match);
        }
        if (count($match) > 1) {
            $title = $match[1];
        }
        if ($label != "") {
            $title = $label . ": " . $title;
        }
        if ($cfg["rss"]["utf_encoding"] == -1) {
            $title = utf8_encode($title);
        }
        // link
        if ($cfg["rss"]["webroot"] != "") {
            $link = $cfg["rss"]["webroot"] . $data["ebene"] . "/" . $data["kategorie"] . ".html";
            // termin-ausnahme
            if (strstr($data["tname"], "1884525588")) {
                $link = $cfg["rss"]["webroot"] . $data["ebene"] . ",," . $data["kategorie"] . ",all.html";
            }
            if (strstr($_SERVER["SERVER_NAME"], "vermessungsamt-")) {
                $link = str_replace(array($cfg["rss"]["webroot"], ".int-dmz.bayern", "/aktuell", "archiv"), array("http://www." . $_SERVER["SERVER_NAME"], "", "", "artikel"), $link);
                $link = preg_replace("/\\/([0-9]+)\\.html\$/Ui", ',,$1.html', $link);
            }
        } else {
            $link = $pathvars["webroot"] . $data["ebene"] . "/" . $data["kategorie"] . ".html";
        }
        // teaser
        $teaser = "";
        preg_match("/\\[P=teaser\\](.+)\\[\\/P/U", $data["content"], $match);
        if (count($match) > 1) {
            $teaser = tagremove($match[1]);
        }
        if ($cfg["rss"]["utf_encoding"] == -1) {
            $teaser = utf8_encode($teaser);
        }
        // pubDate. RFC2822-formatierte Datum
        // mit ausnahme, wenn bei artikel ein datum mitgeben wurde
        if (preg_match("/\\[SORT\\](.+)\\[\\/SORT\\]/U", $data["content"], $match)) {
            $date = $match[1];
        } else {
            $date = $data["changed"];
        }
        $pubDate = date("r", mktime(substr($date, 11, 2), substr($date, 14, 2), substr($date, 17, 2), substr($date, 5, 2), substr($date, 8, 2), substr($date, 0, 4)));
        // lastBuildDate
        if ($pubDate > $hidedata["rss"]["lastBuildDate"]) {
            $hidedata["rss"]["lastBuildDate"] = $pubDate;
        }
        $dataloop["items"][$date . " - " . $data["ebene"] . "/" . $data["kategorie"]] = array("title" => $title, "teaser" => $teaser, "link" => $link, "guid" => $link, "pubDate" => $pubDate);
    }
    if (is_array($dataloop["items"])) {
        krsort($dataloop["items"]);
    }
}
    $debugging[ausgabe] .= "[ ** {$script_name} ** ]" . $debugging[char];
}
// konfiguration
#require $pathvars[config]."addon/sitesearch.inc.php";
if ($debugging[html_enable]) {
    $debugging[ausgabe] .= "(1) funktion: " . $environment[subparam][1] . $debugging[char];
}
$ausgaben[sitesearch_aktion] = $pathvars[virtual] . "/sitesearch,search.html";
$ausgaben[sitesearch_search] = $HTTP_POST_VARS[search];
if ($environment[param][1] == "search") {
    $sql = "SELECT tname, content, ebene, kategorie FROM site_text WHERE content LIKE '%" . $HTTP_POST_VARS[search] . "%'";
    $result = $db->query($sql);
    while ($site_text = $db->fetch_array($result, $nop)) {
        #$path = str_replace(".","/",$site_text[tname]);
        $ausgaben[output] .= "<a target=\"_blank\" href=\"/" . $environment[design] . "/" . $environment[language] . $site_text["ebene"] . "/" . $site_text["kategorie"] . ".html\">" . $specialvars[pagetitle] . " - " . $site_text[kategorie] . "</a><br>";
        $site_text[content] = tagremove($site_text[content]);
        $pos = strpos($site_text[content], $HTTP_POST_VARS[search]);
        $laenge = strlen($site_text[content]);
        $bereich = 120;
        $how = $bereich / 2;
        if ($bereich >= $laenge) {
            $start = 0;
        } elseif ($pos >= $how) {
            $start = $pos - $how;
        } elseif ($pos == 0) {
            $start = $pos;
        } else {
            $start = $how - $pos;
        }
        $found = substr($site_text[content], $start, $bereich);
        $ausgaben[output] .= "... " . " " . $found . " ( {$laenge} / {$bereich} / {$pos} / {$start} )" . " ...<br><br>";
 $sql = "SELECT *\n                    FROM " . $cfg["search"]["db"]["text"]["entries"] . "\n                    WHERE " . $cfg["search"]["db"]["text"]["where"] . " LIKE '%" . $sanitized["search"] . "%'";
 if ($debugging["sql_enable"]) {
     $debugging["ausgabe"] .= "sql: " . $sql . $debugging["char"];
 }
 $result = $db->query($sql);
 $hits = $db->num_rows($result);
 if ($hits == 0) {
     $ausgaben["result"] = "#(found_nothing)";
 } elseif ($hits == 1) {
     $data = $db->fetch_array($result, 1);
     header("Location: " . $pathvars["virtual"] . $data["ebene"] . "/" . $data["kategorie"] . ".html");
 } else {
     $ausgaben["result"] = "#(found_something)";
     while ($data = $db->fetch_array($result, 1)) {
         #$dataloop["leer"][$data["id"]][1] = $data["field1"];
         $content = tagremove($data["content"]);
         $p = strpos($content, $sanitized["search"]);
         $l = strlen($content);
         $b = 120;
         $h = $b / 2;
         if ($b >= $l) {
             $s = 0;
         } elseif ($p >= $h) {
             $s = $p - $h;
         } elseif ($p == 0) {
             $s = $p;
         } else {
             $s = $h - $p;
         }
         $found = substr($content, $s, $b);
         $found = "... " . $found . " ..." . " ( {$l} / {$b} / {$p} / {$s} )";