1. "; //Files $data_filename = "./miniwiki_data.htm"; //Strings $caption_title = "MiniWiki"; $caption_edit = "Edit"; $caption_save = "Save"; $caption_back = "Back"; $caption_lastchanged = "Last changed: "; if (!empty($_GET)) extract($_GET); if (!empty($_POST)) extract($_POST); if (!empty($_SERVER)) extract($_SERVER); ?> <?php echo $caption_title ?> "; echo ""; echo ""; echo $caption_title; echo ""; echo ""; echo ""; echo "
      "; } function print_editor($content, $caption_save, $caption_back) { echo "
      "; echo "

      "; echo ""; echo "   
      ".$caption_back.""; echo "
      "; } function print_redirect ($address) { echo "..."; echo ""; } function add_br($text) { $tmpString = $text; $tmpString = str_replace(chr(13).chr(10), "
      ".chr(13).chr(10), $tmpString); return $tmpString; } function remove_br($text) { $tmpString = $text; $tmpString = str_replace("
      ".chr(13).chr(10), chr(13).chr(10), $tmpString); return $tmpString; } if ($cmd=="edit") { if (filesize($data_filename)==0) { $content = ''; print_titlebar_editor($caption_title); print_editor ($content, $caption_save, $caption_back); } else { $handle = fopen($data_filename, "r"); if($handle) { $content = ''; while (!feof($handle)) $content .= fread($handle, filesize($data_filename)); fclose($handle); if ($auto_br) { $content = remove_br($content); } print_titlebar_editor($caption_title); print_editor ($content, $caption_save, $caption_back); } } } if ($cmd == "save") { $content = $_POST["textarea_1"]; $content = stripslashes($content); $content = strip_tags($content, $allowed_tags); if ($auto_br) { $content = add_br($content); } $handle = fopen($data_filename, "wb"); if ($handle) { fwrite($handle, $content); fclose($handle); print_redirect($_SERVER["PHP_SELF"]); } } if ($cmd!="edit" && $cmd!="save") { if (!file_exists($data_filename)) { $handle = fopen($data_filename, "wb"); if ($handle) { chmod ($data_filename, 0777); fclose($handle); } } echo ""; echo ""; echo ""; echo "
      "; echo $caption_title." | "."".$caption_edit.""; echo ""; if ($show_change_date) { echo $caption_lastchanged.date("d-m-Y, H:i", filemtime($data_filename)).""; } echo "
      "; echo "
      "; include ($data_filename); } ?>