<?php
##################################
### DATENBANKPFAD ###
##################################
if($_GET['datenbank']!="" && $_SESSION['backupVorschau']==1)
{
$datei="$pfad/Data/Backups/$_GET[datenbank]";
}
else
$datei="$pfad/Data/gb.txt";
##################################
### FUNKTIONEN ###
##################################
function configAuslesen($pfad)
{
$configFile=file("$pfad/Data/config.dat");
$config=explode("|||",$configFile[0]);
return $config;
}
function StringKuerzen($string,$laenge)
{
if(strlen($string)>$laenge)
return substr($string,0,$laenge)."...";
else
return $string;
}
function leerwortErsetzen($template, $platzhalter, $value)
{
$template=str_replace($platzhalter,$value,$template);
return $template;
}
function parseTemplate($template)
{
echo $template;
}
function templateEinlesen($templateDatei)
{
$fp = file($templateDatei);
return implode("",$fp);
}
function SeitenzahlenAusgeben($proSeite,$alleBeitraege,$aktuelleSeite)
{
$offset=2;
global $sess_id,$form,$includeVars;
$ausgabe="";
if($alleBeitraege>0)
{
if($alleBeitraege>$proSeite)
{
$gesamtSeiten=ceil($alleBeitraege/$proSeite);
$start=0;
$ende=$proSeite;
if($gesamtSeiten>(($offset*2)+3))
{
if($aktuelleSeite>1)
{
if($aktuelleSeite>$offset+1 && $aktuelleSeite<($gesamtSeiten-$offset))
{
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$ende&aktuelleSeite=1&form=$form$includeVars\" class=\"links\">1</a> ]";
$ausgabe.=" ... ";
for($x=$aktuelleSeite-$offset;$x<=$aktuelleSeite+$offset;$x++)
{
$start=$proSeite*($x-1);
$ende=$proSeite*$x;
if($aktuelleSeite==$x)
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$ende&aktuelleSeite=$x&form=$form$includeVars\" class=\"links\"><u><b>$x</b></u></a> ] ";
else
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$ende&aktuelleSeite=$x&form=$form$includeVars\" class=\"links\">$x</a> ] ";
}
$start=$proSeite*($gesamtSeiten-1);
$ausgabe.="... ";
$ende=$gesamtSeiten-1;
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$alleBeitraege&aktuelleSeite=$gesamtSeiten&form=$form$includeVars\" class=\"links\">$gesamtSeiten</a> ]";
}
else
{
if($aktuelleSeite>($gesamtSeiten-$offset-1) || $aktuelleSeite<($gesamtSeiten-$offset) && $aktuelleSeite>$offset+1)
{
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$ende&aktuelleSeite=1&form=$form$includeVars\" class=\"links\">1</a> ]";
$ausgabe.=" ... ";
}
if($aktuelleSeite-$offset<=0)
$minus=(($aktuelleSeite-$offset)*(-1))+1;
else
$minus=0;
if(($aktuelleSeite+$offset)>$gesamtSeiten)
$bis=$gesamtSeiten;
else
$bis=$aktuelleSeite+$offset;
for($x=$aktuelleSeite-$offset+$minus;$x<=$bis;$x++)
{
$start=$proSeite*($x-1);
if(($ende+$proSeite)>$alleBeitraege)
$ende=$alleBeitraege;
else
$ende=$proSeite*$x;
if($aktuelleSeite==$x)
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$ende&aktuelleSeite=$x&form=$form$includeVars\" class=\"links\"><u><b>$x</b></u></a> ] ";
else
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$ende&aktuelleSeite=$x&form=$form$includeVars\" class=\"links\">$x</a> ] ";
}
if($aktuelleSeite<=$offset+1 || $aktuelleSeite<($gesamtSeiten-$offset) && $aktuelleSeite>$offset+1)
{
$start=$proSeite*($gesamtSeiten-1);
$ausgabe.="... ";
$ende=$gesamtSeiten-1;
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$alleBeitraege&aktuelleSeite=$gesamtSeiten&form=$form$includeVars\" class=\"links\">$gesamtSeiten</a> ]";
}
}
}
else
{
for($x=1;$x<=$aktuelleSeite+$offset;$x++)
{
if($aktuelleSeite==$x)
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$ende&aktuelleSeite=$x&form=$form$includeVars\" class=\"links\"><u><b>$x</b></u></a>] ";
else
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$ende&aktuelleSeite=$x&form=$form$includeVars\" class=\"links\">$x</a> ] ";
$start=$start+$proSeite;
if(($ende+$proSeite)>$alleBeitraege)
$ende=$alleBeitraege;
else
$ende=$ende+$proSeite;
}
$start=$proSeite*($gesamtSeiten-1);
$ausgabe.="... ";
$ende=$gesamtSeiten-1;
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$alleBeitraege&aktuelleSeite=$gesamtSeiten&form=$form$includeVars\" class=\"links\">$gesamtSeiten</a> ]";
}
}
else
{
for($x=1;$x<=$gesamtSeiten;$x++)
{
if($aktuelleSeite==$x)
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$ende&aktuelleSeite=$x&form=$form$includeVars\" class=\"links\"><u><b>$x</b></u></a> ] ";
else
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=$start&ende=$ende&aktuelleSeite=$x&form=$form$includeVars\" class=\"links\">$x</a> ] ";
$start=$start+$proSeite;
if(($ende+$proSeite)>$alleBeitraege)
$ende=$alleBeitraege;
else
$ende=$ende+$proSeite;
}
}
}
else
$ausgabe.="[ <a href=\"$_SERVER[PHP_SELF]?start=0&ende=$alleBeitraege&aktuelleSeite=1&form=$form$includeVars\" class=\"links\">1</a> ]";
}
else
$ausgabe="";
return $ausgabe;
}
// SPRACHE WIRD AUS DER SPRACHDATEI ANHAND DER ÜBERGEBENEN DATEI IN EIN ARRAY GELESEN //
function spracheLesen($datei,$pfad)
{
$found=false;
$config=configAuslesen($pfad);
if($config[58]!="")
$file_sprache=file("$pfad/Data/Language/$config[58]");
else
$file_sprache=file("$pfad/Data/Language/de.dat");
for($i=0;$i<count($file_sprache);$i++)
{
$zeile=$file_sprache[$i];
if(trim($zeile)==$datei)
{
$array=array();
$found=true;
}
if(trim($zeile)!="---" && trim($zeile)!="###" && $found==true)
{
if(trim($zeile)!=$datei)
{
$ausdruck=explode("|",$zeile);
array_push($array,trim($ausdruck[1]));
}
}
if(trim($zeile)=="###" && $found==true)
break;
}
return $array;
}
// Alle Daten werden in einem mehrdimensionalen Array zurückgegeben //
function dateiAuslesen($pfad)
{
$a=0;
$b=0;
global $datei;
$file=file($datei);
$array=array();
$url=explode("/",$_SERVER['PHP_SELF']);
$dateiname=trim($url[count($url)-1]);
foreach($file as $beitrag)
{
$inhalt_zeile=explode("|||",$beitrag);
if($dateiname!="admin.php")
{
if(trim($inhalt_zeile[20])==0)
{
foreach($inhalt_zeile as $inhalt)
{
$array[$b][$a]=$inhalt;
$a++;
}
$a=0;
$b++;
}
}
else
{
foreach($inhalt_zeile as $inhalt)
{
$array[$b][$a]=$inhalt;
$a++;
}
$a=0;
$b++;
}
}
return $array;
}
// Array mit den Daten eines (!) Beitrags wird zurückgegeben //
function BeitragAusgeben($pfad,$id)
{
global $datei;
$fileBeitrag=file($datei);
$arrayString;
$a=0;
foreach($fileBeitrag as $beitrag)
{
$inhaltZeile=explode("|||",$beitrag);
if($inhaltZeile[0]==$id)
{
$arrayString=$beitrag;
break;
}
}
$array=explode("|||",$arrayString);
return $array;
}
function TageAusgebenVonBis($von,$bis, $aktivtag)
{
for($i=$von;$i<$bis;$i++)
{
if($i<10)
$i="0".$i;
if($aktivtag==$i)
$ckecked="selected";
else
$checked="";
echo "<option value=\"$i\" $checked>$i</option>\n";
}
}
function BBTagLeiste($pfad,$form,$feld)
{
$config=configAuslesen($pfad);
$ausgabe="<a href=\"#\" OnClick=\"insert('[B]', '[/B]','$form','$feld')\"><img src=\"$pfad/images/buttons/fett.gif\" border=\"0\" alt=\"\" title=\"\"></a><a href=\"#\" OnClick=\"insert('[I]', '[/I]','$form','$feld')\"><img src=\"$pfad/images/buttons/kursiv.gif\" border=\"0\" alt=\"\" title=\"\"></a><a href=\"#\" OnClick=\"insert('[U]', '[/U]','$form','$feld')\"><img src=\"$pfad/images/buttons/unterstrichen.gif\" border=\"0\" alt=\"\" title=\"\"></a>";
if($config[43]=="ein")
$ausgabe.="<a href=\"#\" OnClick=\"SmiliesAnzeigen('$form','$feld')\"><img src=\"$pfad/images/buttons/smily.gif\" border=\"0\" alt=\"\" title=\"\"></a>";
if($config[59]==1)
$ausgabe.="<a href=\"#\" OnClick=\"insert('[IMG]', '[/IMG]','$form','$feld')\"><img src=\"$pfad/images/buttons/img.gif\" border=\"0\" alt=\"\" title=\"\"></a>";
$ausgabe.="<a href=\"#\" OnClick=\"insert('[URL]', '[/URL]','$form','$feld')\"><img src=\"$pfad/images/buttons/link.gif\" border=\"0\" alt=\"\" title=\"\"></a><a href=\"#\" OnClick=\"insert('[MAIL]', '[/MAIL]','$form','$feld')\"><img src=\"$pfad/images/buttons/mail.gif\" border=\"0\" alt=\"\" title=\"\"></a>";
return $ausgabe;
}
function BeitragEditierenAnzeigenVerwaltung($pfad,$daten,$id,$dateiname)
{
$config=configAuslesen($pfad);
$gesamt=anzahlBeitraege($pfad);
$daten[10]=str_replace("<br>","\n",$daten[10]);
$daten[11]=str_replace("<br>","\n",$daten[11]);
for($i=0;$i<count($daten);$i++)
$daten[$i]=str_replace("\\","",$daten[$i]);
if($config[34]=="")
$config[34]="-";
if($config[35]=="")
$config[35]="-";
if($config[36]=="")
$config[36]="-";
if($config[37]=="")
$config[37]="-";
if($daten[4]=="")
$daten[4]="-";
if($daten[5]=="")
$daten[5]="-";
if($daten[6]=="")
$daten[6]="-";
if($daten[7]=="")
$daten[7]="-";
if($daten[8]=="")
$daten[8]="-";
if($daten[9]=="")
$daten[9]="-";
if($daten[20]=="")
$daten[20]="-";
if($daten[16]=="")
$daten[16]="-";
if($daten[17]=="")
$daten[17]="-";
if($daten[18]=="")
$daten[18]="-";
if($daten[21]=="")
$daten[21]="-";
if(trim($daten[22])=="")
$daten[22]="-";
$sprache=spracheLesen("index.php","../");
$ausgabe="
<div id=\"rahmen_aussen\">
<div style=\"width:658px;float:left;\">
<div style=\"font-color:#520201;width:658px;float:left;background-color:#FFFFFF\">
<div id=\"id\" style=\"float:left;width:100px;height:25px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\"><b>ID:</b> $daten[0]</span>
</p>
</div>
<div style=\"clear:both\"></div>
<div id=\"datumzeit\" style=\"width:658px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-left:5px\">
<select name=\"tag[$id]\" OnFocus=\"this.style.borderColor='#CB7070'\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\">";
$datum=explode(".",$daten[2]);
for($i=1;$i<32;$i++)
{
if($i<10)
$i="0".$i;
if($i==$datum[0])
$checked="selected";
else
$checked="";
$ausgabe.="<option value=\"$i\" $checked>$i</option>\n";
}
$ausgabe.="</select>";
$ausgabe.="<select name=\"monat[$id]\" OnFocus=\"this.style.borderColor='#CB7070'\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\">";
for($i=1;$i<=12;$i++)
{
if($i<10)
$i="0".$i;
if($i==$datum[1])
$checked="selected";
else
$checked="";
$ausgabe.="<option value=\"$i\" $checked>$i</option>\n";
}
$ausgabe.="</select>";
$ausgabe.="<select name=\"jahr[$id]\" OnFocus=\"this.style.borderColor='#CB7070'\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\">";
for($i=2004;$i<=2020;$i++)
{
if($i<10)
$i="0".$i;
if($i==$datum[2])
$checked="selected";
else
$checked="";
$ausgabe.="<option value=\"$i\" $checked>$i</option>\n";
}
$ausgabe.="
</select>
$sprache[22]
<select name=\"stunde[$id]\" OnFocus=\"this.style.borderColor='#CB7070'\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\">";
$zeit=explode(":",$daten[3]);
for($i=0;$i<24;$i++)
{
if($i<10)
$i="0".$i;
if($i==$zeit[0])
$checked="selected";
else
$checked="";
$ausgabe.="<option value=\"$i\" $checked>$i</option>\n";
}
$ausgabe.="</select>";
$ausgabe.="<select name=\"minute[$id]\" OnFocus=\"this.style.borderColor='#CB7070'\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\">";
for($i=0;$i<=59;$i++)
{
if($i<10)
$i="0".$i;
if($i==$zeit[1])
$checked="selected";
else
$checked="";
$ausgabe.="<option value=\"$i\" $checked>$i</option>\n";
}
$ausgabe.="
</select> $sprache[33] (IP: <i>$daten[12]</i> )
</p>
</div>
<div id=\"name\" style=\"float:left;width:329px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">$sprache[0]:</span> <input value='".$daten[1]."' OnFocus=\"this.style.borderColor='#CB7070'\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"nick[$id]\" size=\"40\" maxlength=\"50\">
</p>
</div>
<div id=\"name\" style=\"float:left;width:329px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">$sprache[27]:</span> <input value='".$daten[6]."' OnFocus=\"this.style.borderColor='#CB7070';if(this.value=='-') this.value=''\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"icq[$id]\" size=\"12\" maxlength=\"10\">
</p>
</div>
<div style=\"clear:both\"></div>
<div id=\"name\" style=\"float:left;width:329px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">$sprache[1]:</span> <input value='".$daten[4]."' OnFocus=\"this.style.borderColor='#CB7070';if(this.value=='-') this.value=''\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"mail[$id]\" size=\"50\" maxlength=\"150\">
</p>
</div>
<div id=\"name\" style=\"float:left;width:329px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">$sprache[29]:</span> <input value='".$daten[8]."' OnFocus=\"this.style.borderColor='#CB7070';if(this.value=='-') this.value=''\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"msn[$id]\" size=\"50\" maxlength=\"100\">
</p>
</div>
<div style=\"clear:both\"></div>
<div id=\"name\" style=\"float:left;width:329px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">$sprache[26]:</span> <input value='".$daten[5]."' OnFocus=\"this.style.borderColor='#CB7070';if(this.value=='-') this.value=''\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"page[$id]\" size=\"40\" maxlength=\"300\">
</p>
</div>
<div id=\"name\" style=\"float:left;width:329px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">$sprache[30]:</span> <input value='".$daten[9]."' OnFocus=\"this.style.borderColor='#CB7070';if(this.value=='-') this.value=''\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"yahoo[$id]\" size=\"40\" maxlength=\"100\">
</p>
</div>
<div style=\"clear:both\"></div>
<div id=\"name\" style=\"float:left;width:329px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">Skype:</span> <input value='".$daten[21]."' OnFocus=\"this.style.borderColor='#CB7070';if(this.value=='-') this.value=''\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"skype[$id]\" size=\"40\" maxlength=\"100\">
</p>
</div>
<div id=\"name\" style=\"float:left;width:329px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">Google Talk:</span> <input value='".$daten[22]."' OnFocus=\"this.style.borderColor='#CB7070';if(this.value=='-') this.value=''\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"googletalk[$id]\" size=\"40\" maxlength=\"100\">
</p>
</div>
<div style=\"clear:both\"></div>
<div id=\"name\" style=\"float:left;width:450px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">$sprache[28]:</span> <input value='".$daten[7]."' OnFocus=\"this.style.borderColor='#CB7070';if(this.value=='-') this.value=''\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"aim[$id]\" size=\"40\" maxlength=\"50\">
</p>
</div>
<div style=\"clear:both\"></div>
<div id=\"name\" style=\"float:left;width:329px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">$sprache[3]:</span> ";
for($i=1;$i<=6;$i++)
{
$i="0".$i;
if($daten[19]=="-")
{
$ausgabe.="$sprache[4]\n";
break;
}
if($daten[19]==$i)
{
$r=$i+4;
$ausgabe.="<b>$i</b> ($sprache[$r])";
break;
}
}
$ausgabe.="
</p>
</div>
<div style=\"clear:both\"></div>";
if($config[34]!="" && $config[34]!="-")
{
$ausgabe.="
<div id=\"name\" style=\"float:left;width:450px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">$config[34]:</span> <input value='".$daten[15]."' OnFocus=\"this.style.borderColor='#CB7070'\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"zusatzfeld_1[$id]\" size=\"40\" maxlength=\"300\">
</p>
</div>
<div style=\"clear:both\"></div>";
}
if($config[35]!="" && $config[35]!="-")
{
$ausgabe.="
<div id=\"name\" style=\"float:left;width:450px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">$config[35]:</span> <input value='".$daten[16]."' OnFocus=\"this.style.borderColor='#CB7070'\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"zusatzfeld_2[$id]\" size=\"40\" maxlength=\"300\">
</p>
</div>
<div style=\"clear:both\"></div>";
}
if($config[36]!="" && $config[36]!="-")
{
$ausgabe.="
<div id=\"name\" style=\"float:left;width:450px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">$config[36]:</span> <input value='".$daten[17]."' OnFocus=\"this.style.borderColor='#CB7070'\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"zusatzfeld_3[$id]\" size=\"40\" maxlength=\"300\">
</p>
</div>
<div style=\"clear:both\"></div>";
}
if($config[37]!="" && $config[37]!="-")
{
$ausgabe.="
<div id=\"name\" style=\"float:left;width:329px;height:20px\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<span class=\"verwaltung_beitrag_schrift\">$config[37]:</span> <input value='".$daten[18]."' OnFocus=\"this.style.borderColor='#CB7070'\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" type=\"text\" name=\"zusatzfeld_4[$id]\" size=\"40\" maxlength=\"300\">
</p>
</div>
<div style=\"clear:both\"></div>";
}
$ausgabe.="
<div style=\"clear:both;height:10px;line-height:1%\"></div>
<div id=\"datumzeit\" style=\"width:658px;border:1px solid #CCCCCC;margin:0px;background-color:#F3F3F3\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px;margin-bottom:4px;\">
<span class=\"titel\">$sprache[31]</span>
</p>
</div>
<div id=\"datumzeit\" style=\"width:658px\">
<p style=\"padding:0px;margin:0px;margin-top:15px;margin-left:15px;margin-bottom:10px\">";
$ausgabe.=BBTagLeiste("..","form1","message[$id]");
$ausgabe.="
</p>
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<textarea OnFocus=\"this.style.borderColor='#CB7070'\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"margin:0px;padding:0px;margin-left:-5px;border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" name=\"message[$id]\" rows=\"15\" cols=\"126\">$daten[10]</textarea>
</p>
</div>
<div style=\"clear:both\"></div>
<div id=\"datumzeit\" style=\"width:658px;border:1px solid #CCCCCC;margin-top:5px;background-color:#F3F3F3\">
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px;margin-bottom:4px;\">
<span class=\"titel\">$sprache[32]</span>
</p>
</div>
<div id=\"datumzeit\" style=\"width:658px\">
<p style=\"padding:0px;margin:0px;margin-top:15px;margin-left:15px;margin-bottom:10px\">";
$ausgabe.=BBTagLeiste("..","form1","kommentar[$id]");
$ausgabe.="
</p>
<p style=\"padding:0px;margin:0px;margin-top:4px;margin-left:5px\">
<textarea OnFocus=\"this.style.borderColor='#CB7070';if(this.value=='-') this.value=''\" OnBlur=\"this.style.borderColor='#CCCCCC'\" style=\"margin:0px;padding:0px;margin-left:-5px;border:1px solid #CCCCCC;font-size:10px; font-family:verdana\" name=\"kommentar[$id]\" rows=\"10\" cols=\"126\">$daten[11]</textarea>
</p>
</div>
<div style=\"clear:both\"></div>
</div>
</div>
<div style=\"clear:both\"></div>
</div>";
return $ausgabe;
}
// Füllt eine Nummer mit Nullen auf, bis $gesamt erreicht ist
function nummerAuffuellen($nr,$gesamt)
{
while(strlen($nr)<strlen($gesamt))
{
$nr="0".$nr;
}
return $nr;
}
function anzahlBeitraege($pfad)
{
global $datei;
$file=file($datei);
$url=explode("/",$_SERVER['PHP_SELF']);
$dateiname=trim($url[count($url)-1]);
$a=0;
if($dateiname!="admin.php")
{
foreach($file as $beitrag)
{
$daten=explode("|||",$beitrag);
if(trim($daten[20])==0)
$a++;
}
}
else
$a=count($file);
return $a;
}
function TextUmbrechen($text, $breitegb,$pfad)
{
$config=configAuslesen($pfad);
$durchschnittsbreite=array(9,10,11,12,13,14,15);
$buchstabenbreite=$config[1]-8;
$laenge=0;
$tempcode;
$leertext;
$isCode=false;
for($i=0;$i<strlen($text);$i++)
{
if($i<=strlen($text))
{
if($text[$i]=="<" && $text[$i+1]=="b" && $text[$i+2]=="r" && $text[$i+3]==">")
{
$leertext.="<br>";
$i=$i+3;
$laenge=0;
$letztesLeerzeichen=0;
}
else
{
if($text[$i]=="[")
{
for($x=$i;$x<=$i+7;$x++)
{
if($x<strlen($text))
{
$tempcode.=$text[$x];
if($text[$x]=="]")
{
$i=$x;
break;
}
}
}
}
if($tempcode=="[URL]" || $tempcode=="[IMG]" || $tempcode=="[MAIL]")
{
$leertext.=$tempcode;
$isCode=true;
$i++;
}
if($tempcode=="[/URL2]" || $tempcode=="[/MAIL2]" || $tempcode=="[/IMG]")
{
$leertext.=$tempcode;
$isCode=false;
$i++;
}
if($tempcode=="[/URL]" || $tempcode=="[/MAIL]")
{
$isCode=false;
$leertext.=$tempcode;
$i++;
}
if($tempcode=="[U]" || $tempcode=="[B]" || $tempcode=="[I]")
{
$leertext.=$tempcode;
$i++;
}
if($tempcode=="[/U]" || $tempcode=="[/B]" || $tempcode=="[/I]")
{
$leertext.=$tempcode;
$i++;
}
if($isCode)
{
$leertext.=$text[$i];
}
if(!$isCode)
{
if($laenge>=$breitegb)
{
if($i<strlen($text)-20)
{
$leerzeichen=false;
for($x=$i;$x<$i+20;$x++)
{
if($text[$x]==" ")
{
$leerzeichen=true;
break;
}
}
if(!$leerzeichen)
{
$leertext.=" ";
$laenge=0;
}
}
}
$leertext.=$text[$i];
$laenge+=$durchschnittsbreite[$buchstabenbreite];
}
$tempcode="";
}
}
else
{
$leertext.=$text[$i];
}
}
return $leertext;
}
function BadwordFilter($pfad,$text)
{
$fileBadwords=file("$pfad/Data/badwords.dat");
$badwords=split(",",$fileBadwords[0]);
$textArray=explode(" ",$text);
$x=0;
$arrayZeichen=array(",",".","!","\"","'","§","$","%","&","/","(",")","=","0","1","2","3","4","5","6","7","8","9","?","\\","*","+","~","´","`","^","°",";",":","#","-","_","{","[","]","}");
foreach($textArray as $wort)
{
if(strlen($wort)>2)
{
foreach($badwords as $badword)
{
$pos = strpos(strtolower(trim($wort)), strtolower(trim($badword)));
if($pos>-1)
{
if(strtolower(trim($wort))==strtolower(trim($badword)) && trim($badword)!="")
$textArray[$x]="***";
else
{
foreach($arrayZeichen as $zeichen)
$wort=str_replace($zeichen," ",$wort);
if(strtolower(trim($wort))==strtolower(trim($badword)) && trim($badword)!="")
$textArray[$x]="***";
}
}
}
$x++;
}
}
$text=implode(" ",$textArray);
return $text;
}
function LinksErkennen($text)
{
$text = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "$1[URL]http://$2[/URL2]$2[/URL]", $text);
$text = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "$1[URL]http://$2[/URL2]$2[/URL]", $text);
$text = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "$1[MAIL]$2@$3[/MAIL2]$2@$3[/MAIL]", $text);
return $text;
}
function formatText($pfad,$text,$dateiname)
{
$config=configAuslesen($pfad);
$startposurl=0;
$startposmail=0;
if($config[33]==1)
{
$text=BadwordFilter($pfad,$text);
}
$text=LinksErkennen($text);
$text=TextUmbrechen($text, $config[4]-45,$pfad);
$text=str_replace("[B]","<b>",$text);
$text=str_replace("[/B]","</b>",$text);
$text=str_replace("[I]","<i>",$text);
$text=str_replace("[/I]","</i>",$text);
$text=str_replace("[U]","<u>",$text);
$text=str_replace("[/U]","</u>",$text);
$text=str_replace("\\","",$text);
$text=str_replace("[URL]","<a href=\"",$text);
$text=str_replace("[/URL2]","\" target=\"_blank\" class=\"links_eintrag\">",$text);
$text=str_replace("[/URL]","</a>",$text);
$text=str_replace("[MAIL]","<a href=\"mailto:",$text);
$text=str_replace("[/MAIL2]","\" class=\"links_eintrag\">",$text);
$text=str_replace("[/MAIL]","</a>",$text);
if($config[59]==1)
{
$text=str_replace("[IMG]","<img src=\"",$text);
$text=str_replace("[/IMG]","\" class=\"autofit\" border=\"0\" titel=\"\" alt=\"\">",$text);
}
if(trim($config[43])=="ein" && $dateiname!="admin.php")
{
$filesmilies=file("$pfad/Data/smilies.dat");
foreach($filesmilies as $smily)
{
$smilydaten=explode("|§#§|",$smily);
if(trim($smilydaten[3])==1)
{
$text=str_replace("$smilydaten[0]","<img src=\"$pfad/smilies/$smilydaten[1]\" border=\"0\" alt=\"\" title=\"\">",$text);
}
}
}
return $text;
}
if($_GET['action']=="smiliesAnzeigen")
{
$pfad=$_GET['pfad'];
$divbreite=300;
$filesmilies=file("./Data/smilies.dat");
if($_GET['dateiname']=="admin.php")
$pfad="..";
foreach($filesmilies as $smily)
{
$smilydaten=explode("|§#§|",$smily);
$breite=$divbreite-40;
$breitebild=$divbreite/3.5;
$breiterest=$breite-$breitebild;
if(trim($smilydaten[3])==1)
{
echo "
<div OnClick=\"javascript:SmilieEinfuegen('$smilydaten[0]')\" OnMouseOver=\"this.style.backgroundColor='#EBE8E2'\" OnMouseOut=\"this.style.backgroundColor=''\" style=\"cursor:pointer;margin-left:15px;border:1px solid #E9E6E1;width:".$breite."px\">
<div style=\"float:left;width:".$breitebild."px\">
<p style=\"margin:0px;padding-left:5px;padding-top:15px\">
<a href=\"javascript:SmilieEinfuegen('$smilydaten[0]')\"><img src=\"$pfad/smilies/$smilydaten[1]\" border=\"0\" alt=\"\" title=\"\"></a>
</p>
</div>
<div style=\"float:left;width:".$breiterest."px\">
<div style=\"width:".$breiterest."px\">
<p style=\"margin:0px;padding:5px\">
<font color=\"#000000\" size=\"1\">".htmlentities($smilydaten[0])."</font>
</p>
</div>
<div style=\"float:left;width:".$breiterest."px\">
<p style=\"margin:0px;padding:5px\">
<font color=\"#000000\" size=\"1\"><b>".htmlentities($smilydaten[2])."</b></font>
</p>
</div>
</div>
<div style=\"clear:both\"></div>
</div>
<div style=\"height:10px\"></div>
";
}
}
}
?>