"; $NewEntry["datetime"]=time(); $NewEntry["response"]=""; if ($GBsubjectfield) { if (!$GBstriptags) $NewEntry["subj"]=$_POST["subj"]; else $NewEntry["subj"]=strip_tags($_POST["subj"]); } else $NewEntry["subj"]=""; if ($GBcategoryfield) $NewEntry["category"]=strip_tags($_POST["category"]); else $NewEntry["category"]=""; if (isset($_SESSION["reply"])) { $NewEntry["reply"]=$_SESSION["reply"][5]; unset($_SESSION["reply"]); } else $NewEntry["reply"]=""; $NewEntry["number"]=""; $NewEntry["lock"]=""; $NewEntry["sticky"]=""; $fhandle=fopen($GBdata,"a"); fputcsv($fhandle,$NewEntry); fclose($fhandle); $PageStatus="added"; $_SESSION["captcha"]=""; } function AddEntryView() { global $Titles; global $Values; global $PageStatus; global $GBcaptcha; global $GBtextlenght; global $GBupload; global $GBcityfield; global $GBlinkfield; global $GBsubjectfield; global $GBcategoryfield; echo "

",$Titles["Page"],"


\n"; if ($PageStatus=="added") echo $Titles["Added"]."
\n"; $captchanumber11=rand(1, 4); $captchanumber12=rand(0, 9); $captchanumber21=rand(1, 4); $captchanumber22=rand(0, 9); $_SESSION["captcha"]=md5(base64_encode(($captchanumber11.$captchanumber12)+($captchanumber21.$captchanumber22))); echo "
\n"; echo " ",$Titles["Name"],": (",$Titles["Required"],")
\n"; if ($GBcityfield) echo " ",$Titles["City"],":
\n"; if ($GBlinkfield) echo " ",$Titles["Link"],":
\n"; echo " ",$Titles["Email"],": ($Titles[NotPublic])
\n"; if ($GBsubjectfield) echo " ",$Titles["Subject"],":
\n"; if ($GBcategoryfield) { echo " ",$Titles["Category"],":
\n"; } echo " ",$Titles["Text"],":
\n
\n"; if ($GBupload) { echo " \n"; echo "
\n"; } if ($GBcaptcha) echo " ",$Titles["Captcha"],": $captchanumber11$captchanumber11$captchanumber12 ",$Titles["CaptchaPlus"]," $captchanumber21$captchanumber22$captchanumber21 = ?
\n"; echo " \n"; echo "
\n"; if ($PageStatus=="emptyname") echo $Titles["EmptyName"],"
\n"; if ($PageStatus=="emptytext") echo $Titles["EmptyText"],"
\n"; if ($PageStatus=="wrongimage") echo $Titles["WrongImage"],"
\n"; if ($PageStatus=="wrongcaptcha") echo $Titles["WrongCaptcha"],"
\n"; } function Search($SearchQuery) { $Entries=ReadEntries(); $SearchResultCount=0; $SearchResult=false; foreach($Entries as $e=>$Entry) { for($p=0; $p<9; $p++) { if (mb_stristr($Entry[$p],$SearchQuery)) { $SearchResult[$SearchResultCount][0]=$e; $SearchResult[$SearchResultCount][1]=$Entry; $SearchResultCount++; break; } } } return $SearchResult; } function AddSearchBar() { global $Titles; global $GBsearch; global $GBcategoryfield; if ($GBsearch) { echo "
"; echo ""; echo ""; foreach ($GBcategoryfield as $category) echo " "; echo ""; echo "
"; } } function SinlgeEntry($Entry) { global $Titles; global $GBreplies; global $GBreadmore; global $GBcityfield; global $GBlinkfield; global $GBsubjectfield; global $GBcategoryfield; global $GBshownumbers; global $GBreplies; echo " "; if ($GBreplies&&isset($Entry[9])&&$Entry[9]) echo "
"; echo "

"; if ($GBshownumbers) echo $Entry[10],". "; if ($Entry[2]) echo ""; echo "",$Entry[0],""; if ($Entry[2]) echo ""; if ($Entry[1]) echo " ",$Titles["From"]," ",$Entry[1],""; echo ", ",date("j.m.Y, H:i",$Entry[5]),", "; if ($GBreplies&&isset($Entry[9])&&$Entry[9]) { echo $Titles["Replied"]; } else echo $Titles["Wrote"]; if (($GBsubjectfield)&&($Entry[7])) echo " ",$Titles["About"]," '",$Entry[7],"'"; if (($GBcategoryfield)&&($Entry[8])) echo " [",$Entry[8],"]"; echo ":


\n"; if ($GBreadmore>0) { $Message=strip_tags($Entry[4]); if (strlen($Message)>$GBreadmore) { $readmorenumber="readmore".$Entry[10]; if ($_POST[$readmorenumber]) echo " ",nl2br($Entry[4]),"
\n"; else { $Message = substr($Message, 0, $GBreadmore); $Message = substr($Message, 0, strrpos($Message, ' '))."...
"; echo " ",nl2br($Message),"
\n"; } } else echo " ",nl2br($Entry[4]),"
\n"; } else echo " ",nl2br($Entry[4]),"
\n"; if ($Entry[6]) echo "
",$Titles["Response"],":
\n"; if ($Entry[6]) echo nl2br($Entry[6]),"

\n"; if ($GBreplies) { echo "
"; echo "

"; echo "
"; } echo "
"; if ($GBreplies&&isset($Entry[9])&&$Entry[9]) echo "
"; echo "
\n"; } function EntriesView() { global $Titles; global $DataStatus; global $Entries; global $GBpagination; global $GBreadmore; global $GBcityfield; global $GBlinkfield; global $GBsubjectfield; global $GBcategoryfield; global $GBreplies; if (isset($_SESSION["reply"])) { echo $Titles["Replying"],"
\n"; } if ($GBreplies) { $EntriesReplySorted=$Entries; if (isset($Entries)) foreach($Entries as $Entry) { if (isset($Entry[9])) { foreach($EntriesReplySorted as $n=>$EntrySort) if ($EntrySort[5]==$Entry[5]) $a=$n; foreach($EntriesReplySorted as $n=>$EntrySort) if ($EntrySort[5]==$Entry[9]) $b=$n; if (isset($b)) { $out=array_splice($EntriesReplySorted, $a, 1); array_splice($EntriesReplySorted, $b, 0, $out); } } } $Entries=$EntriesReplySorted; } if ($DataStatus=="empty") echo $Titles["EmptyFile"]; else if(isset($_POST["search"])&&isset($_POST["serachq"])) { $SearchResult=Search($_POST["serachq"]); if ($SearchResult) { $GBpagination=0; unset($Entries); foreach($SearchResult as $n=>$Entry) $Entries[$n]=$Entry[1]; } else echo $Titles["NoResult"].": '",$_POST["serachq"],"'.
\n"; } if (($GBpagination>0)&&(count($Entries)>$GBpagination)) { $Entries=array_reverse($Entries); if (isset($_GET["page"])) switch ($_GET["page"]) { case $Titles["First"]: $CurrentPage=0; break; case $Titles["Last"]: $CurrentPage=(int)((count($Entries)-1)/$GBpagination); break; case $Titles["Previous"]: $CurrentPage=$_SESSION["currentpage"]-1; break; case $Titles["Next"]: $CurrentPage=$_SESSION["currentpage"]+1; break; default: $CurrentPage=$_GET["page"]-1; } else $CurrentPage=0; for ($e = ($GBpagination*$CurrentPage); $e < ($GBpagination*($CurrentPage+1)); $e++) { if ($e>=count($Entries)) break; SinlgeEntry($Entries[$e]); } echo "
\n"; if ($CurrentPage>0) { echo " \n"; echo " \n"; } for ($p = ($CurrentPage-2); $p <= ($CurrentPage+2); $p++) { $page = $p+1; if (($p>=0)&&($p<(count($Entries)/$GBpagination))) { echo " \n"; } } if ($CurrentPage<((count($Entries)/$GBpagination)-1)) { echo " \n"; echo " \n"; } echo "
\n"; $_SESSION["currentpage"]=$CurrentPage; } else { if (isset($Entries[0])) { $Entries=array_reverse($Entries); foreach($Entries as $e=>$Entry) SinlgeEntry($Entry); } } } if ($GBreplies) $GBshownumbers=false; if(isset($_POST["submit"])) { if (!$_POST["text"]) $PageStatus="emptytext"; if (!$_POST["name"]) $PageStatus="emptyname"; if ($GBupload) { if ($_FILES["uploadedfile"]["tmp_name"]) { $UploadedFile=CheckFile(); if (!$UploadedFile) { $PageStatus="wrongimage"; } } } if (($_POST["name"])&&($_POST["text"])) if (isset($_POST["captcha"])&&(md5(base64_encode($_POST["captcha"]))==$_SESSION["captcha"])) { if (!isset($PageStatus)=="wrongimage") { AddEntry(); if ($GBnotificationmailto) SendMail(); } } else if (!$GBcaptcha) { if (!isset($PageStatus)=="wrongimage") { AddEntry(); if ($GBnotificationmailto) SendMail(); } } else $PageStatus="wrongcaptcha"; if (($PageStatus)&&!($PageStatus=="added")) { $_SESSION["value"]["name"]=$_POST["name"]; $_SESSION["value"]["from"]=$_POST["from"]; $_SESSION["value"]["link"]=$_POST["link"]; $_SESSION["value"]["subj"]=$_POST["subj"]; $_SESSION["value"]["category"]=$_POST["category"]; $_SESSION["value"]["email"]=$_POST["email"]; $_SESSION["value"]["text"]=$_POST["text"]; $Values=$_SESSION["value"]; } else if (isset($_SESSION["value"])) Unset($_SESSION["value"]); } $Entries=ReadEntries(); if(isset($_POST["reply"])) { $_SESSION["reply"]=$Entries[$_POST["reply"]-1]; $GBsearch=false; unset($Entries); $GBreplies=false; $Entries[0]=$_SESSION["reply"]; } else unset($_SESSION["reply"]); include "page.php"; ?>