Added 3 special fields

This commit is contained in:
ivan 2017-10-06 12:26:22 +03:00
parent 14a81c9b26
commit a02c2fb6ae
4 changed files with 66 additions and 1 deletions

View File

@ -105,6 +105,9 @@ function AdminEntriesView() {
global $GBsubjectfield; global $GBsubjectfield;
global $GBcategoryfield; global $GBcategoryfield;
global $GBstickylocked; global $GBstickylocked;
global $GBfield1;
global $GBfield2;
global $GBfield3;
if (isset($_SESSION["SessionStatus"])?($_SESSION["SessionStatus"]==(md5($GBadmin.$GBpassword))):false) if ($DataStatus=="empty") echo $Titles["EmptyFile"],"\n"; if (isset($_SESSION["SessionStatus"])?($_SESSION["SessionStatus"]==(md5($GBadmin.$GBpassword))):false) if ($DataStatus=="empty") echo $Titles["EmptyFile"],"\n";
else if (isset($_SESSION["DeleteStatus"])) { else if (isset($_SESSION["DeleteStatus"])) {
if ($_SESSION["DeleteStatus"]=="deletion") { if ($_SESSION["DeleteStatus"]=="deletion") {
@ -131,6 +134,9 @@ function AdminEntriesView() {
} }
echo "</select><br>\n"; echo "</select><br>\n";
} }
if ($GBfield1) echo " ",$Titles["Field1"],": <input type=text name=\"field1\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][13],"\" maxlength=255><br>\n";
if ($GBfield2) echo " ",$Titles["Field2"],": <input type=text name=\"field2\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][14],"\" maxlength=255><br>\n";
if ($GBfield3) echo " ",$Titles["Field3"],": <input type=text name=\"field3\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][15],"\" maxlength=255><br>\n";
echo " ",$Titles["AdminMessage"],":<br>\n <textarea name=\"edittext\" wrap=virtual cols=50 rows=5 maxlength=$GBtextlenght>",$AdminEntries[($_SESSION["EditStatus"]-1)][4],"</textarea><br>\n"; echo " ",$Titles["AdminMessage"],":<br>\n <textarea name=\"edittext\" wrap=virtual cols=50 rows=5 maxlength=$GBtextlenght>",$AdminEntries[($_SESSION["EditStatus"]-1)][4],"</textarea><br>\n";
echo " ",$Titles["Response"],":<br>\n <textarea name=\"editresp\" wrap=virtual cols=50 rows=5 maxlength=$GBtextlenght>",$AdminEntries[($_SESSION["EditStatus"]-1)][6],"</textarea><br>\n"; echo " ",$Titles["Response"],":<br>\n <textarea name=\"editresp\" wrap=virtual cols=50 rows=5 maxlength=$GBtextlenght>",$AdminEntries[($_SESSION["EditStatus"]-1)][6],"</textarea><br>\n";
if ($GBstickylocked) { if ($GBstickylocked) {
@ -253,6 +259,12 @@ if (isset($_SESSION["SessionStatus"])?($_SESSION["SessionStatus"]==(md5($GBadmin
else $AdminEntries[($_SESSION["EditStatus"]-1)][7]=""; else $AdminEntries[($_SESSION["EditStatus"]-1)][7]="";
if (isset($_POST["editcategory"])) $AdminEntries[($_SESSION["EditStatus"]-1)][8]=$_POST["editcategory"]; if (isset($_POST["editcategory"])) $AdminEntries[($_SESSION["EditStatus"]-1)][8]=$_POST["editcategory"];
else $AdminEntries[($_SESSION["EditStatus"]-1)][8]=""; else $AdminEntries[($_SESSION["EditStatus"]-1)][8]="";
if (isset($_POST["field1"])) $AdminEntries[($_SESSION["EditStatus"]-1)][13]=$_POST["field1"];
else $AdminEntries[($_SESSION["EditStatus"]-1)][13]="";
if (isset($_POST["field2"])) $AdminEntries[($_SESSION["EditStatus"]-1)][14]=$_POST["field2"];
else $AdminEntries[($_SESSION["EditStatus"]-1)][14]="";
if (isset($_POST["field3"])) $AdminEntries[($_SESSION["EditStatus"]-1)][15]=$_POST["field3"];
else $AdminEntries[($_SESSION["EditStatus"]-1)][15]="";
if (isset($_POST["lock"])) $AdminEntries[($_SESSION["EditStatus"]-1)][11]=$_POST["lock"]; if (isset($_POST["lock"])) $AdminEntries[($_SESSION["EditStatus"]-1)][11]=$_POST["lock"];
else $AdminEntries[($_SESSION["EditStatus"]-1)][11]=""; else $AdminEntries[($_SESSION["EditStatus"]-1)][11]="";
if (isset($_POST["sticky"])) $AdminEntries[($_SESSION["EditStatus"]-1)][12]=$_POST["sticky"]; if (isset($_POST["sticky"])) $AdminEntries[($_SESSION["EditStatus"]-1)][12]=$_POST["sticky"];

View File

@ -87,6 +87,9 @@ function AddEntry() {
global $GBsubjectfield; global $GBsubjectfield;
global $GBcategoryfield; global $GBcategoryfield;
global $GBstriptags; global $GBstriptags;
global $GBfield1;
global $GBfield2;
global $GBfield3;
if (!$GBstriptags) $NewEntry["name"]=$_POST["name"]; if (!$GBstriptags) $NewEntry["name"]=$_POST["name"];
else $NewEntry["name"]=strip_tags($_POST["name"]); else $NewEntry["name"]=strip_tags($_POST["name"]);
if ($GBcityfield) { if ($GBcityfield) {
@ -116,6 +119,18 @@ function AddEntry() {
$NewEntry["number"]=""; $NewEntry["number"]="";
$NewEntry["lock"]=""; $NewEntry["lock"]="";
$NewEntry["sticky"]=""; $NewEntry["sticky"]="";
if ($GBfield1) {
if (!$GBstriptags) $NewEntry["field1"]=$_POST["field1"];
else $NewEntry["field1"]=strip_tags($_POST["field1"]);
} else $NewEntry["field1"]="";
if ($GBfield2) {
if (!$GBstriptags) $NewEntry["field2"]=$_POST["field2"];
else $NewEntry["field2"]=strip_tags($_POST["field2"]);
} else $NewEntry["field2"]="";
if ($GBfield3) {
if (!$GBstriptags) $NewEntry["field3"]=$_POST["field3"];
else $NewEntry["field3"]=strip_tags($_POST["field3"]);
} else $NewEntry["field3"]="";
$fhandle=fopen($GBdata,"a"); $fhandle=fopen($GBdata,"a");
fputcsv($fhandle,$NewEntry); fputcsv($fhandle,$NewEntry);
fclose($fhandle); fclose($fhandle);
@ -135,6 +150,9 @@ function AddEntryView() {
global $GBsubjectfield; global $GBsubjectfield;
global $GBcategoryfield; global $GBcategoryfield;
global $GBfilesize; global $GBfilesize;
global $GBfield1;
global $GBfield2;
global $GBfield3;
echo "<h2>",$Titles["Page"],"</h2><br>\n"; echo "<h2>",$Titles["Page"],"</h2><br>\n";
if ($PageStatus=="added") echo $Titles["Added"]."<br>\n"; if ($PageStatus=="added") echo $Titles["Added"]."<br>\n";
$captchanumber11=rand(1, 4); $captchanumber11=rand(1, 4);
@ -157,6 +175,9 @@ function AddEntryView() {
} }
echo "</select><br>\n"; echo "</select><br>\n";
} }
if ($GBfield1) echo " ",$Titles["Field1"],": <input type=text name=\"field1\" value=\"",$Values["field1"],"\" maxlength=255><br>\n";
if ($GBfield2) echo " ",$Titles["Field2"],": <input type=text name=\"field2\" value=\"",$Values["field2"],"\" maxlength=255><br>\n";
if ($GBfield3) echo " ",$Titles["Field3"],": <input type=text name=\"field3\" value=\"",$Values["field3"],"\" maxlength=255><br>\n";
echo " ",$Titles["Text"],":<br>\n <textarea name=\"text\" wrap=virtual cols=50 rows=5 maxlength=$GBtextlenght>",$Values["text"],"</textarea><br>\n"; echo " ",$Titles["Text"],":<br>\n <textarea name=\"text\" wrap=virtual cols=50 rows=5 maxlength=$GBtextlenght>",$Values["text"],"</textarea><br>\n";
if ($GBupload) { if ($GBupload) {
echo " <label for=\"file\">".$Titles["FileUpload"]."</label>\n"; echo " <label for=\"file\">".$Titles["FileUpload"]."</label>\n";
@ -216,6 +237,9 @@ function SinlgeEntry($Entry) {
global $GBcategoryfield; global $GBcategoryfield;
global $GBshownumbers; global $GBshownumbers;
global $GBreplies; global $GBreplies;
global $GBfield1;
global $GBfield2;
global $GBfield3;
echo " "; echo " ";
if ($GBreplies&&isset($Entry[9])&&$Entry[9]) echo "<div class=\"reply\">"; if ($GBreplies&&isset($Entry[9])&&$Entry[9]) echo "<div class=\"reply\">";
echo "<div class=\"entry\"><div class=\"messages_header\"><h4>"; echo "<div class=\"entry\"><div class=\"messages_header\"><h4>";
@ -234,7 +258,9 @@ function SinlgeEntry($Entry) {
} else echo $Titles["Wrote"]; } 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],"]";
if (($GBfield1)&&($Entry[13])) echo $Titles["PreField1"],$Entry[13],$Titles["PostField1"];
echo ":</div></h4><br>\n"; echo ":</div></h4><br>\n";
if (($GBfield2)&&($Entry[14])) echo $Titles["PreField2"],$Entry[14],$Titles["PostField2"];
if ($GBreadmore>0) { if ($GBreadmore>0) {
$Message=strip_tags($Entry[4]); $Message=strip_tags($Entry[4]);
if (strlen($Message)>$GBreadmore) { if (strlen($Message)>$GBreadmore) {
@ -247,6 +273,7 @@ function SinlgeEntry($Entry) {
} }
} else echo " ",nl2br($Entry[4]),"<br>\n"; } else echo " ",nl2br($Entry[4]),"<br>\n";
} else echo " ",nl2br($Entry[4]),"<br>\n"; } else echo " ",nl2br($Entry[4]),"<br>\n";
if (($GBfield3)&&($Entry[15])) echo $Titles["PreField3"],$Entry[15],$Titles["PostField3"];
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";
if ($GBreplies&&!($Entry[11])) { if ($GBreplies&&!($Entry[11])) {
@ -402,6 +429,9 @@ if(isset($_POST["submit"])) {
$_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"];
$_SESSION["value"]["field1"]=$_POST["field1"];
$_SESSION["value"]["field2"]=$_POST["field2"];
$_SESSION["value"]["field3"]=$_POST["field3"];
$Values=$_SESSION["value"]; $Values=$_SESSION["value"];
} else if (isset($_SESSION["value"])) Unset($_SESSION["value"]); } else if (isset($_SESSION["value"])) Unset($_SESSION["value"]);
} }

View File

@ -44,6 +44,9 @@ $GBstriptags=true; // enable or disable strip tags function during adding new en
$GBreplies=true; // enable or disable replies to mwssages $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) $GBshownumbers=true; // show or not show number of entries (if replies enabled - numbers will not shown anyway)
$GBstickylocked=true; // stick or lock entries in admin panel $GBstickylocked=true; // stick or lock entries in admin panel
$GBfield1=true; // enable or disable special field 1
$GBfield2=true; // enable or disable special field 2
$GBfield3=true; // enable or disable special field 3
$Titles["HeadTitle"]="Guestbook"; $Titles["HeadTitle"]="Guestbook";
$Titles["Page"]="Guestbook"; $Titles["Page"]="Guestbook";
$Titles["Name"]="Your name"; $Titles["Name"]="Your name";
@ -100,5 +103,13 @@ $Titles["Replied"]="replied";
$Titles["Replying"]="Replying to this message:"; $Titles["Replying"]="Replying to this message:";
$Titles["Locked"]="Locked"; $Titles["Locked"]="Locked";
$Titles["Sticky"]="Sticky"; $Titles["Sticky"]="Sticky";
$Titles["AttachedFile"]="Attached file"; $Titles["Field1"]="Field1";
$Titles["PreField1"]="<i>";
$Titles["PostField1"]="</i>";
$Titles["Field2"]="Field2";
$Titles["PreField2"]="<b>";
$Titles["PostField2"]="</b>";
$Titles["Field3"]="Field3";
$Titles["PreField3"]="<i>";
$Titles["PostField3"]="</i>";
?> ?>

View File

@ -45,6 +45,9 @@ $GBstriptags=true; // включение или отключение функц
$GBreplies=true; // включение или отключение ответов на сообщения $GBreplies=true; // включение или отключение ответов на сообщения
$GBshownumbers=true; // показывать или не показывать номера сообщений (если включены ответы - номера сообщений не будут показываться) $GBshownumbers=true; // показывать или не показывать номера сообщений (если включены ответы - номера сообщений не будут показываться)
$GBstickylocked=true; // приклеивать или лочить записи через панель администратора $GBstickylocked=true; // приклеивать или лочить записи через панель администратора
$GBfield1=true; // включить или отключить специальное поле 1
$GBfield2=true; // включить или отключить специальное поле 2
$GBfield3=true; // включить или отключить специальное поле 3
$Titles["HeadTitle"]="Гостевая книга"; $Titles["HeadTitle"]="Гостевая книга";
$Titles["Page"]="Гостевая книга"; $Titles["Page"]="Гостевая книга";
$Titles["Name"]="Ваше имя"; $Titles["Name"]="Ваше имя";
@ -102,4 +105,13 @@ $Titles["Replying"]="Ответ на это сообщение:";
$Titles["Locked"]="Нельзя ответить"; $Titles["Locked"]="Нельзя ответить";
$Titles["Sticky"]="Закрепленное сверху"; $Titles["Sticky"]="Закрепленное сверху";
$Titles["AttachedFile"]="Прикрепленный файл"; $Titles["AttachedFile"]="Прикрепленный файл";
$Titles["Field1"]="Поле1";
$Titles["PreField1"]="<i>";
$Titles["PostField1"]="</i>";
$Titles["Field2"]="Поле2";
$Titles["PreField2"]="<b>";
$Titles["PostField2"]="</b>";
$Titles["Field3"]="Поле3";
$Titles["PreField3"]="<i>";
$Titles["PostField3"]="</i>";
?> ?>