URL: http://www.chaos.de
*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$sql = "SELECT content FROM site_text WHERE tname = '" . eCRC(dirname($environment["ebene"])) . "." . basename($environment["ebene"]) . "' AND status = '1'";
include $pathvars["moduleroot"] . "wizard/wizard.cfg.php";
$cfg["wizard"]["function"]["print"][] = "makece";
include $pathvars["moduleroot"] . "wizard/wizard-functions.inc.php";
if (($cfg["print"]["path"] == "" || strstr($environment["ebene"], $cfg["print"]["path"])) && class_exists('PDFlib')) {
    $sql = "SELECT content FROM site_text WHERE tname = '" . eCRC(dirname($environment["ebene"])) . "." . basename($environment["ebene"]) . "' AND status = '1'";
    if ($debugging["sql_enable"]) {
        $debugging["ausgabe"] .= "sql: " . $sql . $debugging["char"];
    }
    $result = $db->query($sql);
    $data = $db->fetch_array($result, 1);
    $test = content_split_all($data["content"]);
    $mutate["H"] = array("H");
    #$mutate["B"] = array("");
    $mutate["P"] = array("P");
    $pdf = new PDFlib();
    $pdf->begin_document("", "lang=de tagged=true");
    $pdf->set_info("Creator", "hello.php");
    $pdf->set_info("Author", "STI");
    $pdf->set_info("Title", "Hello world (PHP)!");
    $pdf->set_parameter("autospace", "true");
    $doc = $pdf->begin_item("Document", "Title=Buffy");
    $pdf->begin_page_ext(0, 0, "width=a4.width height=a4.height");
    $font = $pdf->load_font("Helvetica", "unicode", "");
    $pdf->setfont($font, 10);
    $fontname = $pdf->get_parameter("fontname", 0);
    $count = 0;
 // form eingaben pr�fen
 form_errors($form_options, $_POST);
 if ($ausgaben["form_error"] == "") {
     // falls content in session steht diesen holen, ansonsten aus der db
     if ($_SESSION["wizard_content"][$identifier] != "") {
         $old_content = $_SESSION["wizard_content"][$identifier];
     } else {
         $sql = "SELECT version, html, content\n                                FROM " . SITETEXT . "\n                                WHERE tname='" . $environment["parameter"][2] . "'\n                                AND lang='" . $environment["language"] . "'\n                                AND label='" . $environment["parameter"][3] . "'\n                            ORDER BY version DESC\n                                LIMIT 0,1";
         $result = $db->query($sql);
         if ($debugging["sql_enable"]) {
             $debugging["ausgabe"] .= "sql: " . $sql . $debugging["char"];
         }
         $data = $db->fetch_array($result, $nop);
         $old_content = $data["content"];
     }
     $tag_meat = content_split_all($old_content);
     // verbotenen tags rausfiltern
     foreach ($allowed_tags as $value) {
         $buffer[] = "[/" . strtoupper($value) . "]";
         // ist der tag geschlossen
         if (strstr($_POST["content"], "[" . strtoupper($value))) {
             // oeffnende Tags zaehlen
             preg_match_all("/" . "\\[" . strtoupper($value) . ".*\\]" . "/Us", $_POST["content"], $match);
             $count_open = count($match[0]);
             // schliessende Tags zaehlen
             preg_match_all("/" . "\\[\\/" . strtoupper($value) . "\\]" . "/Us", $_POST["content"], $match);
             $count_close = count($match[0]);
             // zuviele offene oder zuviele schliessende Tags?
             if ($count_open > $count_close) {
                 $ausgaben["form_error"] .= "Fehler: m&ouml;glicherweise fehlt mindestens ein abschliessendes [/" . strtoupper($value) . "]<br />";
             } elseif ($count_open < $count_close) {
 }
 // falls content in session steht
 $identifier = $environment["parameter"][1] . "," . $environment["parameter"][2] . "," . $environment["parameter"][3];
 if ($_SESSION["wizard_content"][$identifier] != "") {
     $form_values["content"] = $_SESSION["wizard_content"][$identifier];
 }
 // wizard-typ rausfinden
 preg_match("/\\[!\\]wizard:(.*)\\[\\/!\\]/i", $form_values["content"], $match);
 if ($match[1] != "" && is_array($cfg["wizard"]["wizardtyp"][$match[1]])) {
     $wizard_name = $match[1];
 } else {
     $wizard_name = "standard";
 }
 // was soll modifiziert werden
 $tag_marken = explode(":", $environment["parameter"][4]);
 $tag_meat = content_split_all($form_values["content"]);
 $anker = "";
 if ((count($tag_marken) > 1 || $environment["parameter"][4] == "nop") && (strstr($_SERVER["HTTP_REFERER"], $cfg["wizard"]["basis"]) || $_SERVER["HTTP_REFERER"] == "")) {
     switch ($environment["parameter"][7]) {
         case "add":
             $allcontent = content_level1($form_values["content"]);
             if ($cfg["wizard"]["wizardtyp"][$wizard_name]["section_block"][1] == 0) {
                 $buffer = $allcontent;
                 $buffer[] = $cfg["wizard"]["add_tags"][$tag_marken[0]];
                 end($buffer);
                 //                         $environment["parameter"][6] = key($buffer);
                 $anker = "?scroll=item_" . key($buffer);
             } else {
                 foreach ($allcontent as $key => $value) {
                     if (count($allcontent) - $key <= $cfg["wizard"]["wizardtyp"][$wizard_name]["section_block"][1]) {
                         $buffer[] = preg_replace("/^[ ]+/m", "", $cfg["wizard"]["add_tags"][$tag_marken[0]]);
 foreach ($tag_sort as $pos => $value) {
     $edit_marker = "<!--ID:" . sprintf("%04d", $i) . "-->";
     $pre_mark = substr($content, 0, $value["start"] + $i * strlen($edit_marker));
     $post_mark = substr($content, $value["start"] + $i * strlen($edit_marker));
     // welche "verschachtelungs-ebene"
     $level = count($tag_meat[$value["para"][0]][$value["para"][1]]["keks"]);
     if ($tag_meat[$value["para"][0]][$value["para"][1]]["keks"] == "") {
         $level = 0;
     }
     $nested[$level][$i] = array($value["para"][0], $value["para"][1]);
     // content ergaenzen
     $content = $pre_mark . $edit_marker . $post_mark;
     $i++;
 }
 // tag
 $tmp_tag_meat = content_split_all($content);
 // 2. Durchlauf: die bearbeiten-bereiche werden gesetzt
 foreach ($nested as $level => $value) {
     foreach ($value as $id => $tag_id) {
         $tag_name = $tag_id[0];
         $tag_key = $tag_id[1];
         $tag_info = $tmp_tag_meat[$tag_name][$tag_key];
         // links bauen
         $edit = $cfg["wizard"]["basis"] . "/editor," . $environment["parameter"][1] . "," . $environment["parameter"][2] . "," . $environment["parameter"][3] . "," . $tag_id[0] . ":" . $tag_id[1] . "," . $environment["parameter"][5] . "," . $environment["parameter"][6] . ".html";
         $del = $cfg["wizard"]["basis"] . "/modify," . $environment["parameter"][1] . "," . $environment["parameter"][2] . "," . $environment["parameter"][3] . "," . $tag_id[0] . ":" . $tag_id[1] . "," . $environment["parameter"][5] . "," . $environment["parameter"][6] . "," . "delete.html";
         $rip = $cfg["wizard"]["basis"] . "/modify," . $environment["parameter"][1] . "," . $environment["parameter"][2] . "," . $environment["parameter"][3] . "," . $tag_id[0] . ":" . $tag_id[1] . "," . $environment["parameter"][5] . "," . $environment["parameter"][6] . "," . "rip.html";
         // buffy: alle tags werden in ein hidedata-array geschrieben
         if ($tag_name == "SORT" || $tag_name == "ENDE") {
             $hidevalue = substr($tag_info["meat"], 8, 2) . "." . substr($tag_info["meat"], 5, 2) . "." . substr($tag_info["meat"], 0, 4);
             if ($hidevalue == "01.01.1970") {
                 $hidevalue = "&infin;";