Hauptmenu
Bitte Aktion auswählen"; $langMessage = "Neuer Eintrag:"; $langNewImage = "Bild einfügen"; $langNewLink = "Link einfügen"; $langNewComment = "Neuer Kommentar:"; $langName = "Name:"; $langNameError = "Bitte Name eingeben!"; $langHomepage = "Homepage:"; $langNewPassword = "Neues Passwort:"; $langOpenError = "Fehler beim Öffnen der Datei!
Sind Sie sicher, dass Sie die richtigen Rechte für dieses Verzeichnis besitzen?"; $langPassChanged = "Neues Passwort OK."; $langPassError = "Das neue Password funktioniert nicht!"; $langPassword = "Ändere arnep.de Weblog Passwort"; $langPasswordWarning = "Bitte das Passwort ändern, es entspricht immer noch dem Standardpasswort!!!"; $langPreview = "Vorschau"; $langRetype = "Wiederholen Sie das neue Passwort:"; $langSearch = "Suchen"; $langShowWeblog = "Zum Weblog"; $langSubmit = "Abschicken"; $langSubmitModif = "Änderungen abschicken"; $langSystemError = "System Fehler"; $langSystemMessage = "System Nachricht"; $langTitle = "Titel:"; $langCurrent = "Aktuell"; $langWeblogAdmin = "Weblog Administration"; $langWeblogTitle = "arnep.de Weblog"; $langWrongPassword = "Falsches Administrator-Passwort"; $langDays = array ('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'); $langBBCodeHelp = "

BBCode für Formatierungen:

\n [b] formatiert den Text [b]fett[/b]
\n [i] formatiert den Text [i]kursiv[/i]
\n [email] fügt eine E-Mail-Adresse ein: [email]weblog@arnep.de[/email] oder [email=weblog@arnep.de]Schreib mir![/email]
\n [url] fügt einen Link ein: [url]http://weblog.arnep.de[/url] oder [url=http://weblog.arnep.de]Arnes Weblog[/url]

\n"; /******************************************* * Configuration Step 3 : Carbon Copy Email * *******************************************/ // notifyMail = 1 enables mail sending to mailRecipient. // mailRecipient receives a mail each times an entry is entered (if notifyMail = 1) // mailSubject is the subject of the mail which is sent. // entryMail = 1 enables mail sending to comment-writer $notifyMail = 1; $mailRecipient = "pottharst@gmx.de"; $mailSubject = "Neuer Samlog-Weblogkommentar"; $entryMail = 0; /******************************** * Configuration Step 4 : Colors * ********************************/ // Choosing colors (Remove the unwanted color-model) // Standard (Greys, bright background) $colorWhite = "\"#000000\""; $colorBlack = "\"#FFFFFF\""; $colorHeads = "\"#DDDDDD\""; $colorBody1 = "\"#FFFFFF\""; $colorBody2 = "\"#DDDDDD\""; $colorText = "\"#000000\""; /* // Arne P. $colorWhite = "\"#FFFFFF\""; $colorBlack = "\"#000000\""; $colorHeads = "\"#666666\""; $colorBody1 = "\"ivory\""; $colorBody2 = "\"wheat\""; $colorText = "\"#666666\""; /* // The Following is the BIG SAM standard $colorWhite = "\"#FFFFFF\""; $colorBlack = "\"#000000\""; $colorHeads = "\"#42426F\""; $colorBody1 = "\"#FFF8DC\""; $colorBody2 = "\"#EFE8CC\""; */ // Data submission form colors $formHeadColor = $colorHeads; $formBodyColor = $colorBody1; $formTailColor = $colorBody2; $formHeadText = $colorWhite; $formBodyText = $colorBlack; // Guestbook entries colors $entryHeadColor = $colorHeads; $entryBodyColor1 = $colorBody2; $entryBodyColor2 = $colorBody1; $entryHeadText = $colorWhite; $entryBodyText1 = $colorBlack; $entryBodyText2 = $colorText; // Messages colors $adminHeadColor = $colorHeads; $adminHeadText = $colorWhite; $adminBodyColor1 = $colorBody2; $adminBodyText1 = $colorBlack; $adminBodyColor2 = $colorBody1; $adminBodyText2 = $colorText; /********************************* * Configuration Step 5 : Headers * *********************************/ // Normal Header for Site function displayHeader() { global $version, $type, $index, $cindex, $iswin; header ("Expires: Sat, 01 Jan 2000 00:00:00 GMT"); echo ("\n\n"); echo ("\n"); if ($type == "popup") { displayPopupHeader(); return; } // You migh use and include instead of all this : // include ("head.inc"); echo (''); echo ('SAMLOG Demo'); echo (''); echo (''); //Do not edit following lines! echo (""); echo ("\n"); echo (''); //Continue Editing here! echo ("

SAMLOG - Demo

\n"); } // Special Header for Popup Window, do not edit! function displayPopupHeader() { global $langWeblogTitle, $langComments; echo (''); echo ("$langWeblogTitle - $langComments"); echo ("\n"); echo (''); echo ('
'); echo ("

$langComments

"); } /******************************** * Configuration Step 6 : Footer * ********************************/ function displayFooter() { echo '
'; echo '(c)SAMLOG 2001-2002 Arne Pottharst
'; echo ''; } /****************************************************** * Configuration Step 7 : Number of messages displayed * ******************************************************/ // Number of fields to be displayed simultaneously. // To display everything, set $displayStep to 0. $displayStep = 10; // Number of fields to be displayed simultaneously for Admin-Editing. $displayStepEdit = 10; /************************************************ * Configuration Step 8 : Allow AutoLink System * ************************************************/ // Set to 1 to allow links in Comments $allowAutoLink = 1; // Set to 1 to allow BBCode in Comments $allowBBCode = 1; /************************ * End of Configuration * ************************/ // *************************************************************** // // * Do edit below this line on your own risk, but feel free ;-) * // // *************************************************************** // // $absoluteScriptPath is the name of the current script (this file) and which is going to // be modified by itself. This means that (theoretically) this file can be // placed anywhere on the system, with any fileName. $absoluteScriptPath = $PATH_TRANSLATED; $relativeScriptPath = $PHP_SELF; // when the php preprocessor is installed as an independant binary (as CGI). if ($PATH_INFO!="") { $relativeScriptPath = $PATH_INFO; } // to be used when $PHP_SELF contains virtual directory reference // (for multi-users servers, eg : free.fr, online.fr ...) if (($SERVER_NAME=="php.proxad.net")||(($SERVER_NAME=="php3.pro.proxad.net"))) { $relativeScriptPath = substr($relativeScriptPath, strpos(substr($relativeScriptPath, 1), "/")+1); } $theName = substr($absoluteScriptPath, 0, strrpos($absoluteScriptPath, ".")); $extension = substr($absoluteScriptPath, strrpos($absoluteScriptPath, ".")+1); // The dataFile contains all the guestbook entries, and $adminpassword . // $adminpassword is the password which will be asked for any administration // actions. This password could be changed only if in admin mode (old // $adminpassword matches $admin). // Defines the name of the database file where the entries are stored. $dataFile = "${theName}.dat.${extension}"; $commentFile = "${theName}.comment.${extension}"; //****************************************************************************** // function displayForm : Display the form which enables the client to type a // message. function displayForm($guest) { //$guest: 0 = admin, 1 = guest global $admin,$type,$preview,$entry; global $relativeScriptPath; global $formHeadColor; global $formBodyColor; global $formTailColor; global $formHeadText; global $formBodyText; global $langName,$langNameError; global $langEmail, $langTitle; global $langLocation; global $langHomepage; global $langMessage, $langNewComment,$langCommentError; global $langSubmit, $langPreview, $langMainMenu; global $langNewLink, $langNewImage, $langBBCodeHelp, $allowBBCode, $langAllowBBCode; global $comment,$link; global $aname, $aemail, $alocation, $ahomepage, $amessage, $abbcode, $atitle; // Writing HTML Code if ($type=="popup") { echo ("
\n"); } else { echo ("
\n"); } if ($guest == "1") { if (($aname == "") && ($preview != "")) echo "\n"; if (($amessage == "") && ($preview != "")) echo "\n"; echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); } echo ("\n"); echo ("\n"); echo ("
$langNameError
$langCommentError
$langName$langEmail
$langLocation$langHomepage
\n"); if ($guest == "1") { echo ("$langNewComment
\n"); } else { echo ("$langMessage
\n"); $atitle = stripslashes($atitle); $amessage = stripslashes($amessage); $amessage = str_replace('"', '"', $amessage); $amessage = str_replace("
","\n",$amessage); echo "$langTitle
"; } echo ("
\n"); echo ("
\n"); // Hidden fields to differ between admin-entry and guest-entry if ($guest == "0") { echo ("\n"); } else { echo ("\n"); } echo ("\n"); if ($guest == "0") { // Admin button to insert image/ link echo ("\n"); echo ("    \n"); } else { // Checkbox for BBCode if (($abbcode == "bbcode") || ($preview == "")) { $bbcode="checked=\"checked\""; } if ($allowBBCode == "1") echo (" $langAllowBBCode\n"); } //First show only preview button, then both buttons echo ("\n"); if ((($preview != "" || $entry != "") && $aname != "" && $amessage != "") || $guest == "0") echo ("\n"); echo ("
\n"); echo ("
\n"); if ($allowBBCode=="1" && $guest == "1") { echo $langBBCodeHelp; } if ($guest == "0") { echo ("
"); echo (""); echo (""); echo ("
"); } } //****************************************************************************** // function displayMessage displays the $errorMessage error message. function displayMessage($errorMessage,$msgType,$exit) { global $adminHeadColor; global $adminHeadText; global $adminBodyColor1; global $adminBodyText1; global $adminBodyColor2; global $adminBodyText2; global $langAdminError; global $langSystemError; global $langSystemMessage; global $langWeblogTitle; displayHeader(); echo ("
"); echo ("  $langWeblogTitle
"); echo ("
"); if ($msgType=="1") // Admin Message echo ("  $langAdminError"); if ($msgType=="2") // System Error echo ("  $langSystemError"); if ($msgType=="3") // System Message echo ("  $langSystemMessage"); echo (""); echo ("
"); echo (""); echo ("
$errorMessage

"); echo ("

 

\n"); if ($exit==0){ displayFooter(); exit; } } //****************************************************************************** // misc functions function standardizeStoredText($str,$guest) { if ($guest=="1") { $str = htmlspecialchars($str); } $str = str_replace("'", "\\'", $str); $str = str_replace("\\\\'", "\\'", $str); $str = str_replace("\\\"", "\"", $str); $str = str_replace('\"', '"', $str); $str = str_replace("\n", "
", $str); $str = str_replace("\r", "", $str); $str = str_replace("$", "$", $str); # if (strrpos($str,"\\") == strlen($str)) $str .= " "; //" return $str; } function standardizeDisplayedText($str) { $str = str_replace("<br>", "
", $str); return $str; } function standardizeAdminText($str) { return $str; } function seekHttp($rawText) { $pattern = array( "/http:\/\/((\w|\.|\?|\%|=|\~|\/|-)*)/", "/((\w|-|\.)*@([a-zA-Z0-9]|-)*\.[a-zA-Z]*)/"); $replacement = array( "http://\\1", "\\1"); $hyperLinkedText=preg_replace($pattern, $replacement, $rawText); return $hyperLinkedText; } function seekBBCode($str) { global $allowBBCode,$type; if ($allowBBCode=="0") { return $str; exit; } if ($type=="popup") $target="target=\"_blank\""; else $target = ""; # $str = preg_replace("/\[b\](.*)\[\/b\]/i","\\1",$str); # $str = preg_replace("/\[i\](.*)\[\/i\]/i","\\1",$str); $str = str_replace("[b]", "", $str); $str = str_replace("[/b]", "", $str); $str = str_replace("[i]", "", $str); $str = str_replace("[/i]", "", $str); $str = preg_replace("/\[url\]http:\/\/([^\[]*)\[\/url\]/i","\\1",$str); $str = preg_replace("/\[url=http:\/\/([^\]]*)\]([^\[]*)\[\/url\]/i","\\2",$str); $str = preg_replace("/\[email\](([^\?]*)([^\[])*)\[\/email\]/i","\\2",$str); $str = preg_replace("/\[email=([^\]]*)\]([^\[]*)\[\/email\]/i","\\2",$str); return $str; } function urlExists($url) { $fp = @fopen($url,"r"); if (isset($url) && ($url != "http://") && ($fp)) { fclose($fp); return TRUE; } else return FALSE; } //****************************************************************************** // function Xfopen : opens a file $fileName and locks it function Xfopen($fileName, $openMode, $sharing) { global $langOpenError, $iswin; $fp=@fopen($fileName, $openMode); if (!$fp) { displayMessage($langOpenError,2,0); } if ($sharing==true) { $op=1; } else { $op=2; } if ($iswin == 0) { if (!@flock($fp,$op)) { @flock($fp,3); displayMessage("flock timeout",2,0); } } return $fp; } //****************************************************************************** // function Xfclose : unlocks the file $fp and closes it function Xfclose($fp) { global $iswin; if ($iswin == 0) @flock($fp,3); @fclose($fp); } //****************************************************************************** // function indexDisplay function indexDisplay() { global $relativeScriptPath; global $index; global $archive_date, $archive_title; global $langCurrent, $langIndex, $langCalendar, $langSearch; displayHeader(); echo "

Übersicht über alle Einträge

"; echo "[$langCurrent]\n"; echo "[$langIndex]\n"; echo "[$langCalendar]\n"; echo "[$langSearch]
\n"; if ($index==0) { displayFooter(); return; } for ($msgNumber=$index ; $msgNumber>0 ; $msgNumber--) { echo ("

$archive_title[$msgNumber]
\n"); echo ("    [$archive_date[$msgNumber]]

\n"); } echo "[$langCurrent]\n"; echo "[$langIndex]\n"; echo "[$langCalendar]\n"; echo "[$langSearch]
\n"; displayFooter(); } //****************************************************************************** // function calendarDisplay function calendarDisplay() { global $relativeScriptPath; global $index; global $archive_date, $archive_title; global $langCurrent, $langIndex, $langCalendar, $langSearch; displayHeader(); echo "

Übersicht über alle Einträge

"; echo "[$langCurrent]\n"; echo "[$langIndex]\n"; echo "[$langCalendar]

\n"; // echo "[$langSearch]\n"; if ($index==0) { displayFooter(); return; } // count years $years = Array(); $ayear = ""; for ($msgNumber=1 ; $msgNumber<=$index ; $msgNumber++) { ereg("^[^ ]* (..)\.(..)\.(....)",$archive_date[$msgNumber],$regs); $year = $regs[3]; if ($year != $ayear) $years[] = $year; $ayear = $year; } $year = ""; $month = ""; $day = ""; $ayear = $year; $amonth = $month; $aday = $day; $cfirst = 0; // first week-day of month $cday = 0; // akutal calender day // print links for years for ($i=0 ; $i < count($years) ; $i++) echo "[$years[$i]] "; echo ""; for ($msgNumber=1 ; $msgNumber<=$index ; $msgNumber++) { ereg("^[^ ]* (..)\.(..)\.(....)",$archive_date[$msgNumber],$regs); $year = $regs[3]; $month = $regs[2]; $day = $regs[1]; if ($day == $aday) continue; // new year if ($year != $ayear) echo "
$year
\n"; // new month if ($month != $amonth) { // fill end of month with space if ((($cday+$cfirst) % 7)!=0) for ($i=0 ; $i<7-(($cday+$cfirst) % 7) ; $i++) echo "   "; if (($year == $ayear) && ((($cday+$cfirst) % 7)!=0)) echo "
"; echo "
$month
\n"; // fill begin of month with space $cday = 0; $cfirst = strftime("%w",mktime(0,0,0,$month,1,$year)); for ($i=0 ; $i<$cfirst ; $i++) echo "   "; } while ($cday < $day) { echo sprintf("%02d ", $cday); $cday++; if (($cday+$cfirst) % 7 == 0) echo "
\n"; } echo "$day "; $cday++; if (($cday+$cfirst) % 7 == 0) echo "
\n"; $ayear = $year; $amonth = $month; $aday = $day; } echo "...
"; echo "

[$langCurrent]\n"; echo "[$langIndex]\n"; echo "[$langCalendar]
\n"; // echo "[$langSearch]\n"; displayFooter(); } //****************************************************************************** // function fullDisplay function fullDisplay() { global $displayStep, $displayBegin, $link; global $entryHeadColor,$entryHeadText, $entryBodyColor1,$entryBodyText1, $entryBodyColor2,$entryBodyText2 ; global $relativeScriptPath; global $index, $cindex; global $archive_mail, $archive_name, $archive_homepage, $archive_location, $archive_text, $archive_date, $archive_title; global $comment_mail, $comment_name, $comment_homepage, $comment_location, $comment_text, $comment_date, $comment_bbcode, $comment_id; global $allowAutoLink; global $langHomepage, $langLocationFrom, $langHideComments, $langIndex, $langCalendar, $langSearch, $langCurrent; global $comment, $type, $preview, $entry; global $aname, $aemail, $alocation, $ahomepage, $amessage, $abbcode; displayHeader(); if ($index==0) { echo "

[!]

\n"; displayFooter(); return; } echo "[$langCurrent]\n"; echo "[$langIndex]\n"; echo "[$langCalendar]
\n"; // echo "[$langSearch]\n"; for($i=1;$i<=$index;$i=$nextEnd+1) { $nextBegin = $i; if ($i==1) { $nextEnd=$index % $displayStep; if ($nextEnd==0) $nextEnd=$displayStep; } else $nextEnd = $i+$displayStep-1; if ($nextEnd==$nextBegin) echo ("[$nextBegin]\n"); else echo ("[$nextBegin-$nextEnd]\n"); } echo "


\n"; // Message arrays are displayed here : // Displaying all the entries. if (isset($link)) $displayBegin = $link - $displayStep+1; if ($displayStep==0) { $displayBegin=1; $displayStep=$index; } if ($displayBegin==1) { $startAt=$index % $displayStep; if ($startAt==0) $startAt=$displayStep; } else { $startAt=$displayBegin+$displayStep-1; } if ($startAt < 1) $startAt = 1; if ($displayBegin < 1) $displayBegin = 1; for ($msgNumber=$startAt ; $msgNumber>=$displayBegin ; $msgNumber--) { if ($comment =="" || ($comment == $msgNumber)) { echo ("\n
"); echo ("$archive_title[$msgNumber]
"); echo ("    [$archive_date[$msgNumber]]

"); echo ("
"); echo $archive_text[$msgNumber]; echo ("
\n"); } if (isset($comment) && ($comment == $msgNumber)) { //display comments echo "

[$langHideComments]

\n"; $commentNumber = 0; echo "
"; if ($preview!=""){ commentDisplay($aname,$aemail,$alocation,$ahomepage,$amessage,date( "d.m.Y - H:i:s" ),$abbcode,$type); } else { for($cmtNumber=1 ; $cmtNumber<=$cindex ; $cmtNumber++) { if ($comment_id[$cmtNumber] == $msgNumber) { $commentNumber++; commentDisplay($comment_name[$cmtNumber],$comment_mail[$cmtNumber],$comment_location[$cmtNumber],$comment_homepage[$cmtNumber],$comment_text[$cmtNumber],$comment_date[$cmtNumber],$comment_bbcode[$cmtNumber],$type); } } if ($commentNumber==0) {echo "
[Noch keine Kommentare]
";} } echo "
"; displayForm("1"); echo "
"; echo "


\n"; } elseif ($comment =="" || ($comment == $msgNumber)) { //count comments $commentNumber = 0; for($cmtNumber=1 ; $cmtNumber<=$cindex ; $cmtNumber++) { if ($comment_id[$cmtNumber] == $msgNumber) { $commentNumber++; } } echo "

"; if ($commentNumber==1) {echo "[1 Kommentar] ";} else {echo "[$commentNumber Kommentare] ";} $linkNumber = $msgNumber; echo "[Link] "; echo "


\n"; } } echo "[$langCurrent]\n"; echo "[$langIndex]\n"; echo "[$langCalendar]
\n"; // echo "[$langSearch]\n"; for($i=1;$i<=$index;$i=$nextEnd+1) { $nextBegin = $i; if ($i==1) { $nextEnd=$index % $displayStep; if ($nextEnd==0) $nextEnd=$displayStep; } else $nextEnd = $i+$displayStep-1; if ($nextEnd==$nextBegin) echo ("[$nextBegin]\n"); else echo ("[$nextBegin-$nextEnd]\n"); } echo "[!]\n"; displayFooter(); } //****************************************************************************** // function popupDisplay function popupDisplay() { global $displayStep,$displayBegin ; global $entryHeadColor,$entryHeadText, $entryBodyColor1,$entryBodyText1, $entryBodyColor2,$entryBodyText2 ; global $relativeScriptPath; global $index, $cindex; global $archive_mail, $archive_name, $archive_homepage, $archive_location, $archive_text, $archive_date, $archive_title; global $comment_mail, $comment_name, $comment_homepage, $comment_location, $comment_text, $comment_date, $comment_bbcode, $comment_id; global $allowAutoLink; global $langHomepage, $langLocationFrom, $langHideComments; global $comment, $type, $preview; global $aname, $aemail, $alocation, $ahomepage, $amessage, $abbcode; displayHeader(); // Message arrays are displayed here : // Displaying all the entries. if ($displayStep==0) { $displayBegin=1; $displayStep=$index; } if ($displayBegin==1) { $startAt=$index % $displayStep; if ($startAt==0) $startAt=$displayStep; } else { $startAt=$displayBegin+$displayStep-1; } for ($msgNumber=1 ; $msgNumber<=$index ; $msgNumber++) { if (isset($comment) && ($comment == $msgNumber)) { // display comments echo "

[$langHideComments]

\n"; echo "
\n"; if ($preview!=""){ commentDisplay($aname,$aemail,$alocation,$ahomepage,$amessage,date( "d.m.Y - H:i:s" ),$abbcode,$type); } else { $commentNumber = 0; for($cmtNumber=1 ; $cmtNumber<=$cindex ; $cmtNumber++) { if ($comment_id[$cmtNumber] == $msgNumber) { $commentNumber++; commentDisplay($comment_name[$cmtNumber],$comment_mail[$cmtNumber],$comment_location[$cmtNumber],$comment_homepage[$cmtNumber],$comment_text[$cmtNumber],$comment_date[$cmtNumber],$comment_bbcode[$cmtNumber],$type); } } if ($commentNumber==0) {echo "
[Noch keine Kommentare]
";} } // isset(preview) echo "
"; displayForm("1"); echo "
"; echo "
[$langHideComments]
\n"; } } displayFooter(); } //****************************************************************************** // function commentDisplay function commentDisplay($name,$mail,$location,$homepage,$text,$date,$bbcode,$type) { global $allowAutoLink,$allowBBCode,$preview; echo "
"; echo ("Am $date schrieb "); #$url = strtolower($homepage); #if (substr($url,0,7) == "http://") $url = substr($url,7); #if (substr($url,0,4) == "www.") $url = substr($url,4); #if (substr($url,-1,4) == "/") $url = substr($url,0,-1); if($type=="popup") $target = "target=\"_blank\""; else $target = ""; if (($mail != "") && (($homepage != "") && ($homepage != "http://"))) echo "$name ($homepage) "; elseif ($mail != "") echo "$name "; elseif (($homepage != "") && ($homepage != "http://")) echo "$name "; else echo "$name "; if ($location!="") echo "aus $location "; echo "dieses:\n"; echo ("
\n"); # echo "

$text

"; if ($preview!="") $text=standardizeStoredText($text,"1"); if ($allowBBCode==1){ if ($bbcode=="bbcode") { $text=seekBBCode($text); } elseif ($allowAutoLink==1) { $text=seekHttp($text); } } elseif ($allowAutoLink==1) $text=seekHttp($text); # $text = standardizeDisplayedText($text); echo ($text); echo ("

\n"); } //****************************************************************************** // function readData function readData($resetBegin) { global $adminpassword; global $index; global $dataFile; global $archive_mail, $archive_name, $archive_text, $archive_date, $archive_location, $archive_homepage, $archive_title; global $displayBegin, $displayStep; global $langName, $langEmail, $langHomepage, $langLocation; // Includes automatically filled data arrays : $index = 0; $fout=Xfopen($dataFile, "r", true); include($dataFile); Xfclose($fout); // From now, $index will indicate the number of data entries. // Beginning of the data to be displayed, default = 1 if (!isset($displayBegin)) $displayBegin=""; if ($displayBegin=="" || $resetBegin==1) { $displayBegin = $index-$displayStep+1; if ($displayBegin<=0) $displayBegin=1; } } //****************************************************************************** // function readComment function readComment($resetBegin) { global $cindex; global $commentFile; global $comment_mail, $comment_name, $comment_text, $comment_date, $comment_location, $comment_homepage, $comment_id, $comment_ip, $comment_agent, $comment_bbcode; global $langName, $langEmail, $langHomepage, $langLocation; // Includes automatically filled data arrays : $cindex = 0; $fout=Xfopen($commentFile, "r", true); include($commentFile); Xfclose($fout); // From now, $cindex will indicate the number of data entries. } //****************************************************************************** // If the Datafile does not exist, creates it. if (!file_exists(${dataFile})) { $fout = Xfopen($dataFile, "w+", false); fputs($fout, ""); //"); Xfclose ($fout); } $aname=$name;$aemail=$email;$alocation=$location;$ahomepage=$homepage;$amessage=$message;$atitle=$title;$abbcode=$bbcode; if (!isset($message)) { $message=""; } if (!isset($comment)) { $comment=""; } if (!isset($admin) && !isset($preview)) { if (!isset($name) || $name=="") { $name=""; $message=""; } } if (!isset($type)) { $type=""; } if (!isset($admin)) if (isset($preview)) { $name="";$message=""; } elseif (!isset($entry)) { $ahomepage="http://"; $preview=""; } if (!isset($admin)) { if (($message=="")) { /************************************************************************************ * Use Case no 1-A * * * * This case is encountered when a client simply wants to add a message to the * * guestbook. (Every variable is empty); * ************************************************************************************/ readData(0); readComment(0); if ($type == "popup") { popupDisplay(); } elseif ($type == "index") { indexDisplay(); } elseif ($type == "calendar") { calendarDisplay(); } else { fullDisplay(); } exit; } else if (($command=="add") && ($message!="") && ($name!="") && ($comment!="")) { $position = filesize($commentFile); $fout = Xfopen($commentFile, "r+", false); fseek($fout,$position-2); $insert_msgdate = date( "d.m.Y - H:i:s" ); $name=standardizeStoredText($name,"1"); $email=standardizeStoredText($email,"1"); $message=standardizeStoredText($message,"1"); $location=standardizeStoredText($location,"1"); $homepage=standardizeStoredText($homepage,"1"); $ip=$REMOTE_ADDR; $agent=$HTTP_USER_AGENT; //add space after each user-modified-field: another bug fixed TODO fputs ($fout,"\$comment_id[++\$cindex] = '$comment';\n"); fputs ($fout,"\$comment_name[ \$cindex] = '$name';\n"); fputs ($fout,"\$comment_mail[ \$cindex] = '$email';\n"); fputs ($fout,"\$comment_date[ \$cindex] = '$insert_msgdate';\n"); fputs ($fout,"\$comment_text[ \$cindex] = '$message';\n"); fputs ($fout,"\$comment_location[ \$cindex] = '$location';\n"); fputs ($fout,"\$comment_homepage[ \$cindex] = '$homepage';\n"); fputs ($fout,"\$comment_ip[ \$cindex] = '$ip';\n"); fputs ($fout,"\$comment_agent[ \$cindex] = '$agent';\n"); fputs ($fout,"\$comment_bbcode[ \$cindex] = '$bbcode';"); fputs ($fout,"\n?>"); //", "\n", $message); $mailBody = "From: $name <$email> $langLocationFrom $location\n$langHomepage $homepage\n$insert_msgdate\n\n$message\n\n\n".$entryData;; if ($iswin == 0) mail($mailRecipient,$mailSubject,$mailBody,"From: $email\nReply-to: $name <$email>"); } // Sending a mail to person who wrote comment if ($entryMail == 1) { $mailBody = "Hallo $name!\n\nVielen Dank, dass Du einen Kommentar in mein Weblog geschrieben hast.\nSchau' doch mal wieder bei meiner Homepage vorbei!\n\nMfG, Arne P.\n\nHomepage: http://arnep.de/\nWeblog: http://weblog.arnep.de"; if ($iswin == 0) mail($email,"Danke fuer Deinen Eintrag!",$mailBody,"From: arne@arnep.de\nReply-to: Arne P. "); } $page=$relativeScriptPath; if ($type=="popup") header("Location: $page?comment=$comment&type=popup"); else header("Location: $page?comment=$comment"); exit; } } else //$admin isset ;-) { readData(0); readComment(0); if ($admin==$adminpassword) { if ($command=="") { displayHeader(); echo ("$langMenu\n"); // "Change Password" Button echo ("
\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("
\n"); if($adminpassword==$standardPassword) echo "

$langPasswordWarning

"; // "Add Entry" Button echo ("
\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("
\n"); // "Edit Entry" Buttons $i = $index; echo "

$index $langEntries
$cindex $langComments

"; while ($i > 0) { echo ("
\n"); echo ("\n"); echo ("\n"); $j = $i - $displayStepEdit; if ($displayStepEdit == 0) { $j = $index; $i = 1; } if ($j < 1) $j = 1; $lang_EditEntry = $langEditEntry; $number = "$j - $i"; // Make buttontext with number eval("\$lang_EditEntry = \"$lang_EditEntry\";"); echo ("\n"); echo ("\n"); echo ("
\n"); $i = $i - $displayStepEdit; if ($displayStepEdit == 0) $i = 0; } // "Exit Menu" Button echo ("
\n"); echo ("\n"); echo ("
\n"); displayFooter(); exit; } elseif ($command=="pwform") { displayHeader(); echo("

$langWeblogAdmin

\n"); echo("
\n"); // Display the form which enables the admin to change his password echo ("
\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("
\n"); echo (" $langPassword.
"); echo ("  $langnewPassword"); echo (" 
"); echo ("  $langRetype"); echo (" 
\n"); echo ("\n"); echo ("\n"); echo ("
\n"); echo ("
\n"); echo ("
"); echo (""); echo (""); echo ("
"); displayFooter(); exit; } elseif (($command=="addform") || ($command=="add") && ($preview==$langPreview)) { displayHeader(); // Display form to submit new entry $atitle=standardizeStoredText($atitle,"1"); $amessage=standardizeStoredText($amessage,"1"); displayForm("0"); echo "
$title
".standardizeStoredText($message,"0")."
"; displayFooter(); exit; } elseif ($command=="editform") { displayHeader(); $startEdit = $editstart; $endEdit = $editstart - $displayStepEdit; if ($endEdit < 1) $endEdit = 1; echo "

$langEntries $endEdit - $startEdit

"; echo ("
"); echo (""); echo (""); echo ("
"); // Message arrays are displayed here in forms in order to modify them echo ("
\n"); for ($i=$startEdit ; $i>=$endEdit ; $i--) { $msgNumber = $i; $str = str_replace("
", "\n", $archive_text[$msgNumber]); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n
\n"); echo (" "); echo ("$langEntry #$msgNumber 
$langTitle \n$langDate
\n"); //display comments $commentNumber = 0; for($cmtNumber=1 ; $cmtNumber<=$cindex ; $cmtNumber++) { if ($comment_id[$cmtNumber] == $msgNumber) { $commentNumber++; echo "\n"); $str = str_replace("
", "\n", $comment_text[$cmtNumber]); echo ("\n
"; echo "


\n"; echo ("$langName "); echo ("$langDate
"); echo ("$langEmail "); echo ("$langHomepage
"); echo ("$langLocation "); echo ("$langIP
"); echo ("$langAgent "); echo ("$langID
"); echo ("$langAllowBBCode
"; echo ("
\n"); } } if ($commentNumber==0) {echo "
[Keine Kommentare]
";} echo "


\n"; echo ("
\n
\n"); } echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("
\n"); echo ("
"); echo (""); echo (""); echo ("
"); displayFooter(); exit; } else if (($command=="add") && ($message!="") && ($title!="")) { /******************************************************************************** * Use Case no 1-B * * * * Case is encountered when a client has just filled in the appropriate fields * * (name, mail, message). * * $name = "Some Name" * * $email = "Some@Email" * * $message = "Some Message" * * Simply add message in the top of all previous messages. * ********************************************************************************/ $position = filesize($dataFile); $fout = Xfopen($dataFile, "r+", false); fseek($fout,$position-2); $insert_msgdate = $langDays[date("w")].date( ", d.m.Y - H:i" ); $message=standardizeStoredText($message,"0"); $title=standardizeStoredText($title,"0"); fputs ($fout,"\$archive_date[++\$index] = '$insert_msgdate';\n"); fputs ($fout,"\$archive_title[ \$index] = '$title';\n"); fputs ($fout,"\$archive_text[ \$index] = '$message';\n"); fputs ($fout,"?>"); //"); echo (""); echo (""); echo (""); echo (""); echo ("
"); echo (""); echo (""); echo ("
"); displayFooter(); } else { // Rewrites the whole Datafile with the new password, and all the entries. $fout = Xfopen($dataFile, "w", false); fputs ($fout,""); //"); echo (""); echo (""); echo (""); displayFooter(); exit; } } else if ($command=="modify") { /******************************************************************************** * Use Case no 2-C * * * * Admin mode (The administrator is updating entries). * * $admin = $adminpassword * * $nameXXX = "Modified name (no XXX)" * * $emailXXX = "Modified email (no XXX)" * * $messageXXX = "Modified message (no XXX)" * * $keep = "on" or "" * * Check if $admin matches $adminpassword. * * Rewrites ALL the fields except when $keepXXX = "" * * Rewrites the whole Datafile with the new password, and all the entries.* ********************************************************************************/ $fout = Xfopen($dataFile, "w", false); fputs ($fout,""); //"); //\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("
Bitte Passwort eingeben:
\n"); echo ("\n"); } else { /************************************************ * Use Case no 2-Z * * * * If $admin does NOT match $adminpassword. * * $admin != $adminpassword * * Error message : "Wrong Admin Password" * ************************************************/ displayMessage("$langWrongPassword",1,1); echo "

Neu einloggen

"; displayFooter(); } } ?>