Replies added
This commit is contained in:
parent
8d36e4b584
commit
7608ad9426
3
README
3
README
|
@ -1,4 +1,4 @@
|
||||||
PHPCSV Guestbook version 0.98
|
PHPCSV Guestbook version 0.99
|
||||||
|
|
||||||
Simple php guestbook with csv file data storage.
|
Simple php guestbook with csv file data storage.
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ Features:
|
||||||
- 'Read More' button
|
- 'Read More' button
|
||||||
- Pagination
|
- Pagination
|
||||||
- Categories
|
- Categories
|
||||||
|
- Replies
|
||||||
|
|
||||||
Working example: https://zlaxyi.soundragon.su/gb
|
Working example: https://zlaxyi.soundragon.su/gb
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ if ($_SESSION["SessionStatus"]==(md5($GBadmin.$GBpassword))) {
|
||||||
if (isset($_POST["submitdelete"])) {
|
if (isset($_POST["submitdelete"])) {
|
||||||
$_SESSION["DeleteStatus"]="deletion";
|
$_SESSION["DeleteStatus"]="deletion";
|
||||||
foreach($AdminEntries as $e=>$Entry) if (isset($_POST["cb$e"])) $_SESSION["DeleteEntries"][]=$e;
|
foreach($AdminEntries as $e=>$Entry) if (isset($_POST["cb$e"])) $_SESSION["DeleteEntries"][]=$e;
|
||||||
if (!count($_SESSION["DeleteEntries"])) $_SESSION["DeleteStatus"]="";
|
if (isset($_SESSION["DeleteEntries"])) if (!count($_SESSION["DeleteEntries"])) $_SESSION["DeleteStatus"]="";
|
||||||
} if (isset($_POST["submiteedit"])) if (($_POST["submiteedit"])&&($_SESSION["EditStatus"])) {
|
} if (isset($_POST["submiteedit"])) if (($_POST["submiteedit"])&&($_SESSION["EditStatus"])) {
|
||||||
$AdminEntries[($_SESSION["EditStatus"]-1)][0]=$_POST["editname"];
|
$AdminEntries[($_SESSION["EditStatus"]-1)][0]=$_POST["editname"];
|
||||||
if (isset($_POST["editfrom"])) $AdminEntries[($_SESSION["EditStatus"]-1)][1]=$_POST["editfrom"];
|
if (isset($_POST["editfrom"])) $AdminEntries[($_SESSION["EditStatus"]-1)][1]=$_POST["editfrom"];
|
||||||
|
|
|
@ -71,16 +71,22 @@ img {
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-link{
|
.reply {
|
||||||
border:none;
|
position: relative;
|
||||||
outline:none;
|
padding: 20px;
|
||||||
background:none;
|
width: 98%;
|
||||||
cursor:pointer;
|
}
|
||||||
color:#0000EE;
|
|
||||||
padding:0;
|
.btn-link {
|
||||||
text-decoration:underline;
|
border: none;
|
||||||
font-family:inherit;
|
outline: none;
|
||||||
font-size:inherit;
|
background: none;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #0000EE;
|
||||||
|
padding: 0;
|
||||||
|
text-decoration: underline;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button,
|
.button,
|
||||||
|
|
75
index.php
75
index.php
|
@ -93,7 +93,10 @@ function AddEntry() {
|
||||||
} else $NewEntry["subj"]="";
|
} else $NewEntry["subj"]="";
|
||||||
if ($GBcategoryfield) $NewEntry["category"]=strip_tags($_POST["category"]);
|
if ($GBcategoryfield) $NewEntry["category"]=strip_tags($_POST["category"]);
|
||||||
else $NewEntry["category"]="";
|
else $NewEntry["category"]="";
|
||||||
$NewEntry["parameters"]="";
|
if (isset($_SESSION["reply"])) {
|
||||||
|
$NewEntry["reply"]=$_SESSION["reply"][5];
|
||||||
|
unset($_SESSION["reply"]);
|
||||||
|
}
|
||||||
$fhandle=fopen($GBdata,"a");
|
$fhandle=fopen($GBdata,"a");
|
||||||
fputcsv($fhandle,$NewEntry);
|
fputcsv($fhandle,$NewEntry);
|
||||||
fclose($fhandle);
|
fclose($fhandle);
|
||||||
|
@ -178,17 +181,26 @@ function AddSearchBar() {
|
||||||
|
|
||||||
function SinlgeEntry($Entry) {
|
function SinlgeEntry($Entry) {
|
||||||
global $Titles;
|
global $Titles;
|
||||||
|
global $GBreplies;
|
||||||
global $GBreadmore;
|
global $GBreadmore;
|
||||||
global $GBcityfield;
|
global $GBcityfield;
|
||||||
global $GBlinkfield;
|
global $GBlinkfield;
|
||||||
global $GBsubjectfield;
|
global $GBsubjectfield;
|
||||||
global $GBcategoryfield;
|
global $GBcategoryfield;
|
||||||
echo " <div class=\"entry\"><div class=\"messages_header\"><h4>",$Entry[10],". ";
|
global $GBshownumbers;
|
||||||
|
global $GBreplies;
|
||||||
|
echo " ";
|
||||||
|
if ($GBreplies&&isset($Entry[9])&&$Entry[9]) echo "<div class=\"reply\">";
|
||||||
|
echo "<div class=\"entry\"><div class=\"messages_header\"><h4>";
|
||||||
|
if ($GBshownumbers) echo $Entry[10],". ";
|
||||||
if ($Entry[2]) echo "<a href=\"",$Entry[2],"\">";
|
if ($Entry[2]) echo "<a href=\"",$Entry[2],"\">";
|
||||||
echo "<b>",$Entry[0],"</b>";
|
echo "<b>",$Entry[0],"</b>";
|
||||||
if ($Entry[2]) echo "</a>";
|
if ($Entry[2]) echo "</a>";
|
||||||
if ($Entry[1]) echo " ",$Titles["From"]," <b>",$Entry[1],"</b>";
|
if ($Entry[1]) echo " ",$Titles["From"]," <b>",$Entry[1],"</b>";
|
||||||
echo ", ",date("j.m.Y, H:i",$Entry[5]),", ",$Titles["Wrote"];
|
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 (($GBsubjectfield)&&($Entry[7])) echo " ",$Titles["About"]," '",$Entry[7],"'";
|
||||||
if (($GBcategoryfield)&&($Entry[8])) echo " [",$Entry[8],"]";
|
if (($GBcategoryfield)&&($Entry[8])) echo " [",$Entry[8],"]";
|
||||||
echo ":</div></h4><br>\n";
|
echo ":</div></h4><br>\n";
|
||||||
|
@ -206,7 +218,14 @@ function SinlgeEntry($Entry) {
|
||||||
} else echo " ",nl2br($Entry[4]),"<br>\n";
|
} else echo " ",nl2br($Entry[4]),"<br>\n";
|
||||||
if ($Entry[6]) echo "<br><i><b>",$Titles["Response"],":</b><br>\n";
|
if ($Entry[6]) echo "<br><i><b>",$Titles["Response"],":</b><br>\n";
|
||||||
if ($Entry[6]) echo nl2br($Entry[6]),"</i><br>\n";
|
if ($Entry[6]) echo nl2br($Entry[6]),"</i><br>\n";
|
||||||
echo "</div><hr>\n";
|
if ($GBreplies) {
|
||||||
|
echo "<form action=index.php method=post>";
|
||||||
|
echo "<p align=\"right\"><button type=submit name=\"reply\" value=\"",$Entry[10],"\">",$Titles["Reply"],"</button></p>";
|
||||||
|
echo "</form>";
|
||||||
|
}
|
||||||
|
echo "</div>";
|
||||||
|
if ($GBreplies&&isset($Entry[9])&&$Entry[9]) echo "</div>";
|
||||||
|
echo "<hr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function EntriesView() {
|
function EntriesView() {
|
||||||
|
@ -219,6 +238,26 @@ function EntriesView() {
|
||||||
global $GBlinkfield;
|
global $GBlinkfield;
|
||||||
global $GBsubjectfield;
|
global $GBsubjectfield;
|
||||||
global $GBcategoryfield;
|
global $GBcategoryfield;
|
||||||
|
global $GBreplies;
|
||||||
|
if (isset($_SESSION["reply"])) {
|
||||||
|
echo $Titles["Replying"],"<br>\n";
|
||||||
|
}
|
||||||
|
if ($GBreplies) {
|
||||||
|
$EntriesReplySorted=$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"];
|
if ($DataStatus=="empty") echo $Titles["EmptyFile"];
|
||||||
else if(isset($_POST["search"])&&isset($_POST["serachq"])) {
|
else if(isset($_POST["search"])&&isset($_POST["serachq"])) {
|
||||||
$SearchResult=Search($_POST["serachq"]);
|
$SearchResult=Search($_POST["serachq"]);
|
||||||
|
@ -278,6 +317,8 @@ function EntriesView() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($GBreplies) $GBshownumbers=false;
|
||||||
|
|
||||||
if(isset($_POST["submit"])) {
|
if(isset($_POST["submit"])) {
|
||||||
if (!$_POST["text"]) $PageStatus="emptytext";
|
if (!$_POST["text"]) $PageStatus="emptytext";
|
||||||
if (!$_POST["name"]) $PageStatus="emptyname";
|
if (!$_POST["name"]) $PageStatus="emptyname";
|
||||||
|
@ -302,18 +343,26 @@ if(isset($_POST["submit"])) {
|
||||||
}
|
}
|
||||||
} else $PageStatus="wrongcaptcha";
|
} else $PageStatus="wrongcaptcha";
|
||||||
if (($PageStatus)&&!($PageStatus=="added")) {
|
if (($PageStatus)&&!($PageStatus=="added")) {
|
||||||
$SESSION["value"]["name"]=$_POST["name"];
|
$_SESSION["value"]["name"]=$_POST["name"];
|
||||||
$SESSION["value"]["from"]=$_POST["from"];
|
$_SESSION["value"]["from"]=$_POST["from"];
|
||||||
$SESSION["value"]["link"]=$_POST["link"];
|
$_SESSION["value"]["link"]=$_POST["link"];
|
||||||
$SESSION["value"]["subj"]=$_POST["subj"];
|
$_SESSION["value"]["subj"]=$_POST["subj"];
|
||||||
$SESSION["value"]["category"]=$_POST["category"];
|
$_SESSION["value"]["category"]=$_POST["category"];
|
||||||
$SESSION["value"]["email"]=$_POST["email"];
|
$_SESSION["value"]["email"]=$_POST["email"];
|
||||||
$SESSION["value"]["text"]=$_POST["text"];
|
$_SESSION["value"]["text"]=$_POST["text"];
|
||||||
$Values=$SESSION["value"];
|
$Values=$_SESSION["value"];
|
||||||
} else if (isset($SESSION["value"])) Unset($SESSION["value"]);
|
} else if (isset($_SESSION["value"])) Unset($_SESSION["value"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$Entries=ReadEntries();
|
$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";
|
include "page.php";
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -13,7 +13,7 @@ $GBpassword="password";
|
||||||
$GBpagination=10; // pagination for entries, 0 - disabled
|
$GBpagination=10; // pagination for entries, 0 - disabled
|
||||||
$GBreadmore=255; // number of symbols for 'Read More' feature, 0 - shows full entries
|
$GBreadmore=255; // number of symbols for 'Read More' feature, 0 - shows full entries
|
||||||
$GBsearch=true; // enable or disable search bar
|
$GBsearch=true; // enable or disable search bar
|
||||||
$GBcaptcha=false; // enable or disable captcha
|
$GBcaptcha=true; // enable or disable captcha
|
||||||
$GBupload=true; // enable or disable upload image feature
|
$GBupload=true; // enable or disable upload image feature
|
||||||
$GBimagesize=1048576; // maximum image size
|
$GBimagesize=1048576; // maximum image size
|
||||||
$GBnotificationmailto=""; // leave empty if you don't want send notification
|
$GBnotificationmailto=""; // leave empty if you don't want send notification
|
||||||
|
@ -30,6 +30,8 @@ $GBcategoryfield=array(
|
||||||
4=>"Order",
|
4=>"Order",
|
||||||
5=>"Other");
|
5=>"Other");
|
||||||
$GBstriptags=true; // enable or disable strip tags function during adding new entry
|
$GBstriptags=true; // enable or disable strip tags function during adding new entry
|
||||||
|
$GBreplies=true; // enable or disable replies to mwssages
|
||||||
|
$GBshownumbers=true; // show or not show number of entries (if replies enabled - numbers will not shown anyway)
|
||||||
$Titles["HeadTitle"]="Guestbook";
|
$Titles["HeadTitle"]="Guestbook";
|
||||||
$Titles["Page"]="Guestbook";
|
$Titles["Page"]="Guestbook";
|
||||||
$Titles["Name"]="Your name";
|
$Titles["Name"]="Your name";
|
||||||
|
@ -81,4 +83,7 @@ $Titles["WrongImage"]="Can't upload image.";
|
||||||
$Titles["Subject"]="Subject";
|
$Titles["Subject"]="Subject";
|
||||||
$Titles["Category"]="Category";
|
$Titles["Category"]="Category";
|
||||||
$Titles["About"]="about";
|
$Titles["About"]="about";
|
||||||
|
$Titles["Reply"]="Reply";
|
||||||
|
$Titles["Replied"]="replied";
|
||||||
|
$Titles["Replying"]="Replying to this message:";
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -31,6 +31,8 @@ $GBcategoryfield=array(
|
||||||
4=>"Order",
|
4=>"Order",
|
||||||
5=>"Other");
|
5=>"Other");
|
||||||
$GBstriptags=true; // включение или отключение функции обрезания тегов при добавлении новой записи
|
$GBstriptags=true; // включение или отключение функции обрезания тегов при добавлении новой записи
|
||||||
|
$GBreplies=true; // включение или отключение ответов на сообщения
|
||||||
|
$GBshownumbers=true; // показывать или не показывать номера сообщений (если включены ответы - номера сообщений не будут показываться)
|
||||||
$Titles["HeadTitle"]="Гостевая книга";
|
$Titles["HeadTitle"]="Гостевая книга";
|
||||||
$Titles["Page"]="Гостевая книга";
|
$Titles["Page"]="Гостевая книга";
|
||||||
$Titles["Name"]="Ваше имя";
|
$Titles["Name"]="Ваше имя";
|
||||||
|
@ -82,4 +84,7 @@ $Titles["WrongImage"]="Не могу загрузить изображение."
|
||||||
$Titles["Subject"]="Тема";
|
$Titles["Subject"]="Тема";
|
||||||
$Titles["Category"]="Категория";
|
$Titles["Category"]="Категория";
|
||||||
$Titles["About"]="о";
|
$Titles["About"]="о";
|
||||||
|
$Titles["Reply"]="Ответить";
|
||||||
|
$Titles["Replied"]="ответил";
|
||||||
|
$Titles["Replying"]="Ответ на это сообщение:";
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue