You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

379 lines
11 KiB
PHP

<?php
session_start();
// Löschen aller Session-Variablen.
$_SESSION = array();
// Falls die Session gelöscht werden soll, löschen Sie auch das
// Session-Cookie.
// Achtung: Damit wird die Session gelöscht, nicht nur die Session-Daten!
if (isset($_COOKIE[session_name()]))
setcookie(session_name(), '', time()-42000, '/');
// Zum Schluß, löschen der Session.
session_destroy();
session_start();
set_include_path('..');
function Check_Html($uf){
global $navigation;
global $verz_img;
global $verz_rtf;
global $verz_html;
global $verz_xml;
global $verz_video;
global $sys_default_img;
global $sys_default_video;
if ($lfile = fopen($uf, "r")){
$noprt = false;
while (!feof ($lfile)){
$line = trim(fgets ($lfile, 4096));
// Kommentare überlesen
if ($noprt) {
if (!(strpos($line,"*/") === false )) {
$noprt = false;
$line = substr($line,strpos($line,"*/")+2);
if ($line == ""){
continue;
}
}
else{
continue;
}
}
// Mehrere Kommentarebeginnne und Enden in einer Zeile überlesen
while (!(strpos($line,"/*") === false )){
if (!(strpos($line,"*/") === false )){
$line = substr($line,0,strpos($line,"/*")) . substr($line,strpos($line,"*/")+2);
}
else {
$line = substr($line,0,strpos($line,"/*"));
$noprt = true;
}
if ($line == ""){
continue;
}
}
// Kommentare bins Ende der Zeile kappen
if (!(strpos($line,"//") === false )){
$line = substr($line,0,strpos($line,"//"));
}
if ($line == ""){
continue;
}
// Xml
$i = 0;
while ((strpos($line,'<!xml=') !== false )){
// auf erstes Zeichen und letztes Zeichen positionieren
$param_start_pos = strpos($line,'<!xml=') + 6;
$param_ende_pos = strpos($line,'>',$param_start_pos);
// kompletten block bis abschliessendem '>' ausschneiden
$param_block = substr($line, $param_start_pos, $param_ende_pos - $param_start_pos);
$line = str_replace("<!xml=$param_block>", '', $line);
// Parameter splitten
list($xml_filename, $xsl_filename) = split(',',$param_block);
// Parameter 1 = Filename zum XML file, extension wird geadded wenn fehlt
if( strpos($xml_filename,".xml") == FALSE )
$xml_filename .= ".xml";
// Parameter 2 = Filename XSL File, wenn fehlt, dann aus XML Filenamen generieren
if ($xsl_filename == ''){
$xsl_filename = str_replace( ".xml", "xsl", $xml_filename);
}
// Extention test , für xsl
if( strpos($xsl_filename,".xsl") == FALSE )
$xsl_filename .= ".xsl";
// style="width: 50%;"
if (!file_exists("../".$verz_xml.'/'.$xml_filename)){
PrintFehler("xml_file: " . $xml_filename ." nicht vorhanden - Fehler in ".$uf);
}
if (!file_exists("../".$verz_xml.'/'.$xsl_filename)){
PrintFehler("xsl_file: " . $xsl_filename ." nicht vorhanden - Fehler in ".$uf);
}
$line = str_replace("<!xml=$param_block>", '', $line);
if ($i++ > 10){
PrintFehler("Fehlerhaftes xml Tag " . $line ." Tag ist nicht in Orndung - Syntax Fehler in ".$uf);
exit; // Notaustieg bei falschem tag
}
}
//
// RTF PARSEN
//
$i = 0;
while ((strpos($line,'<!rtf=') !== false )){
// auf erstes Zeichen und letztes Zeichen positionieren
$param_start_pos = strpos($line,'<!rtf=') + 6;
$param_ende_pos = strpos($line,'>',$param_start_pos);
// kompletten block bis abschliessendem '>' ausschneiden
$param_block = substr($line, $param_start_pos, $param_ende_pos - $param_start_pos);
$rtf_filename = $verz_rtf.'/'.$param_block;
if( strpos($rtf_filename,".rtf") == FALSE )
$rtf_filename .= ".rtf";
if (!file_exists("../".$rtf_filename)){
PrintFehler("rtf_file: " . $rtf_filename ." nicht vorhanden - Fehler in ".$uf);
}
$line = str_replace("<!rtf=$param_block>", '', $line);
if ($i++ > 10){
echo "ACHTUNG TAGFEHLER STELLE rtf\n";
exit; // Notaustieg bei falschem tag
}
}
// Img
$i = 0;
while (!(strpos($line,"<!img") === false )) {
$x0 = strpos($line,"<!img");
$tag = substr($line,$x0,strpos(substr($line,$x0),">")+1);
// Fehlerhaftes Tag führt sonst zum loop
if ($tag == "") {
PrintFehler("Fehlerhaftes Tag " . $line ." Tag ist nicht in Orndung - Syntax Fehler in ".$uf);
break;
}
else {
$ttag = strpos($tag,",");
if ($ttag === false){
$ttag = strpos($tag,">");
$titel = "";
}
else{
$titel = substr($tag,$ttag + 1,strlen($tag) - $ttag - 2);
}
$lstart = strpos($tag,"=")+1;
$link = substr($tag,$lstart,$ttag - $lstart);
$class = substr( $tag,2,strpos($tag,"=")-2);
// Klammern weg für Ausdruck
$prtag = substr($tag,1,strlen($tag)-2);
if (!file_exists("../".$verz_img."/".$link)){
PrintFehler("Image " . $link . " existiert nicht in " . $prtag);
}
if ($titel == ""){
PrintFehler("Image - Titel existiert nicht in " . $prtag);
}
$line = str_replace($tag,'',$line);
}
if ($i++ > 10){ // Notaustieg bei falschem tag
PrintFehler("Img " . $tag . " ist nicht in Orndung - Syntax Fehler in ".$uf);
break; // Notaustieg bei falschem tag
}
}
// <!vid?=text,titel>
$i = 0;
while (!(strpos($line,"<!vid") === false ))
{
$x0 = strpos($line,"<!vid");
$tag = substr($line,$x0,strpos(substr($line,$x0),">")+1);
// Fehlerhaftes Tag führt sonst zum loop
if ($tag == ""){
PrintFehler("Fehlerhaftes Tag " . $line ." Tag ist nicht in Orndung - Syntax Fehler in ".$uf);
break;
}
else
{
$ttag = strpos($tag,",");
if ($ttag === false) {
$ttag = strpos($tag,">");
$titel = "";
}
else {
$titel = substr($tag,$ttag + 1,strlen($tag) - $ttag - 2);
}
$lstart = strpos($tag,"=")+1;
$link = $verz_video."/".substr($tag,$lstart,$ttag - $lstart);
if (!file_exists('../'.$link.".html")){
PrintFehler("Info - Video-Html " . $link . ".html existiert nicht in " . $uf);
}
if (!file_exists('../'.$link.".swf")){
PrintFehler("Info - Video-Swf " . $link . ".swf existiert nicht in " . $uf);
}
if (!file_exists('../'.$link . ".jpg") and !file_exists('../'.$link . ".gif")){
PrintFehler("Info - Thumbnail " . $link . ".jpg / .gif existiert nicht in " . $uf);
}
$line = str_replace($tag,'',$line);
}
if ($i++ > 10){
PrintFehler("Video " . $tag . " ist nicht in Orndung - Syntax Fehler in ".$uf);
break; // Notaustieg bei falschem tag
}
}
// Link
$i = 0;
while(!(strpos($line,"<!link=") === false )){
$posa = strpos($line,"<!link=");
$posa7 = $posa + 7;
$pose = strpos($line,'>',$posa);
list($navpos,$nav_anker) = split('#',substr($line,$posa7,$pose-$posa7));
if ($navpos[0] == "*"){
PrintFehler("Link " . $navpos . " verweißt auf einen Label in " . $uf);
}
else {
list($navtxt,$navhtml,$navinfo) = $navigation[$navpos];
if ($navtxt == ""){
PrintFehler("Link " . $navpos . " existiert nicht in " . $uf);
}
else if($nav_anker != '') {
if ($xfile = fopen("../".$verz_html."/".$navhtml, 'r')){
$buffer = fread($xfile,filesize("../".$verz_html."/".$navhtml));
fclose($xfile);
$k = 0;
$found = false;
while (++$k<=$sys_anz_ueberschriften){
if (strpos($buffer,'<!h'.$k.'a='.$nav_anker)) {
$found = true;
}
}
if (!$found){
PrintFehler("Link " . $navpos . '#'.$nav_anker." existiert nicht in " . $uf);
}
}
}
}
$line = str_replace(substr($line,$posa,$pose-$posa+1),$neuer_link,$line);
if ($i++ > 10){
PrintFehler("Link " . $navpos . " ist nicht in Orndung - Syntax Fehler in ".$uf);
break; // Notaustieg bei falschem tag
}
}
}
fclose($lfile);
}
else{
echo "Internal Error\n";
exit;
}
}
//
// -- Menü überprüfen
//
function Check_Menu($sys_sprache){
include "include/navigation_data.php";
$sonderfuktionen = array('$dummy','$link','$htmlfile','$infofile');
while (list ($nKey,list($navtxt,$navhtml,$navinfo,$navfunkt,$navmenu)) = each ($navigation)) {
if (in_array($navinfo, $sonderfuktionen) === false){
PrintEcho("Überprufe Menüpunkt :".$nKey." , ".$navtxt." , ".$navhtml." , ".$navinfo);
if ($navtxt == ""){
PrintFehler("Bei " . $nKey . " gibt es keinen NAVTXT");
}
if (($nKey[0] == "*" or $nKey[0] == "$") and $navfunkt == '' and ($navhtml != "" or $navinfo != "")) {
PrintFehler("Bei " . $nKey . " gibt es NAVHTML und/oder NAVINFO");
}
if (($nKey[0] != "*" and $nKey[0] != "$") and $navfunkt == '' and $navhtml == "") {
PrintFehler("Bei " . $nKey . " gibt es kein NAVHTML");
}
if ($navhtml != "" and $navfunkt == '' ) {
$f = $verz_html . "/" . $navhtml;
if (!file_exists("../".$f)){
PrintFehler("Bei " . $nKey . " exisitiert das File " . $f . " nicht");
}
else {
PrintEcho("Überprufe Dokuhtml :".$f);
Check_Html("../".$f);
}
}
if ($navinfo != "" and $navfunkt == '') {
$f = $verz_info . "/" . $navinfo;
if (!file_exists("../".$f)){
PrintFehler("Bei " . $nKey . " exisitiert das File " . $f . " nicht");
}
else {
PrintEcho("Überprufe Infohtml :".$f);
Check_Html("../".$f);
}
}
PrintEcho("");
}
}
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Check</title>
</head>
<body>
<?php
$err = false;
$ierr = 0;
include "include/sysvariable_inc.php";
include "include/funktions_inc.php";
PrintEcho("Check Sysvariable");
PrintEcho("");
if (!file_exists("../".$sys_default_img)){
PrintFehler("Das Default Image für den Fehlerfall ".$sys_default_img." exisitert nicht");
}
if (!file_exists("../".$sys_default_video)){
PrintFehler("Das Default Thumbnail für den Fehlerfall ".$sys_default_img." exisitert nicht");
}
PrintEcho("<br><hr>");
PrintEcho("Check Menu Deutsch");
PrintEcho("");
Check_Menu("deu");
PrintEcho("<br><hr>");
PrintEcho("Check Browser");
PrintEcho("");
$sys_admin = true;
include "include/geteditor_inc.php";
if ($sys_path_editor == ''){
PrintFehler("Kein Editor gefunden !!!!");
}
else{
PrintEcho("Editor gefunden: ".$sys_path_editor);
}
PrintEcho("<br><hr>");
// Fehlerauswertung
if ($err){
PrintFehler("Es sind " . $ierr . " Fehler aufgetreten - Bitte beheben");
}
else {
PrintEcho("Prüfung Deutsch erfolgreich beendet");
}
PrintEcho("<br><hr>");
echo "<br>";
echo "<br>";
echo "<br>\n";
echo "<a href=\"check.php?ap=".$_GET["ap"]."\">Restart Check</a><br>\n";
echo "<br>\n";
echo "<a href=\"restart.php?ap=".$_GET["ap"]."\">Session Restart</a>\n";
?>
</body>
</html>