| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,105 @@ |
| 1 |
+<?php |
|
| 2 |
+// ---------------------------------------------------------------------- |
|
| 3 |
+// eFiction 3.0 |
|
| 4 |
+// Copyright (c) 2007 by Tammy Keefer |
|
| 5 |
+// Valid HTML 4.01 Transitional |
|
| 6 |
+// Based on eFiction 1.1 |
|
| 7 |
+// Copyright (C) 2003 by Rebecca Smallwood. |
|
| 8 |
+// http://efiction.sourceforge.net/ |
|
| 9 |
+// ---------------------------------------------------------------------- |
|
| 10 |
+// LICENSE |
|
| 11 |
+// |
|
| 12 |
+// This program is free software; you can redistribute it and/or |
|
| 13 |
+// modify it under the terms of the GNU General Public License (GPL) |
|
| 14 |
+// as published by the Free Software Foundation; either version 2 |
|
| 15 |
+// of the License, or (at your option) any later version. |
|
| 16 |
+// |
|
| 17 |
+// This program is distributed in the hope that it will be useful, |
|
| 18 |
+// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 19 |
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 20 |
+// GNU General Public License for more details. |
|
| 21 |
+// |
|
| 22 |
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html |
|
| 23 |
+// ---------------------------------------------------------------------- |
|
| 24 |
+ |
|
| 25 |
+if(!defined("_CHARSET")) exit( );
|
|
| 26 |
+ |
|
| 27 |
+ |
|
| 28 |
+ $output .= "<div id=\"pagetitle\">"._CUSTPAGES."</div>"; |
|
| 29 |
+if(isset($_GET['delete']) && isNumber($_GET['delete'])) {
|
|
| 30 |
+ $result = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_messages WHERE message_id = ".$_GET['delete']." LIMIT 1");
|
|
| 31 |
+ if($result) $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 32 |
+ else $output .= write_error(_ERROR); |
|
| 33 |
+} |
|
| 34 |
+if(isset($_POST['submit'])) {
|
|
| 35 |
+ if(!preg_match("!^[a-z0-9_]{3,30}$!i", $_POST['name'])) $output .= write_error(_BADVARNAME);
|
|
| 36 |
+ else {
|
|
| 37 |
+ $pagename = descript($_POST['name']); |
|
| 38 |
+ $pagetitle = descript($_POST['title']); |
|
| 39 |
+ if(isset($_GET['edit']) && isNumber($_GET['edit'])) |
|
| 40 |
+ $result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_messages SET message_name = '".escapestring($pagename)."', message_title = '".escapestring($pagetitle)."', message_text = '".escapestring(descript($_POST['text']))."' WHERE message_id = ".$_GET['edit']." LIMIT 1");
|
|
| 41 |
+ else {
|
|
| 42 |
+ $result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_messages(`message_name`, `message_title`, `message_text`) VALUES( '".escapestring($pagename)."', '".escapestring($pagetitle)."', '".escapestring(descript($_POST['text']))."')");
|
|
| 43 |
+ if($result) $result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_pagelinks(`link_name`, `link_text`, `link_url`, `link_target`, `link_access`) VALUES('".escapestring($pagename)."_link', '".escapestring($pagetitle)."', 'viewpage.php?page=$pagename', '0', '0')");
|
|
| 44 |
+ } |
|
| 45 |
+ if($result) $output .= write_message(_ACTIONSUCCESSFUL."<br /><br /><a href='viewpage.php?page=$pagename'>$pagetitle</a>"); |
|
| 46 |
+ else $output .= write_error(_ERROR); |
|
| 47 |
+ unset($_GET['edit']); |
|
| 48 |
+ } |
|
| 49 |
+} |
|
| 50 |
+if((isset($_GET['edit']) && isNumber($_GET['edit'])) || isset($_GET["new"]) || isset($_POST['preview'])) {
|
|
| 51 |
+ unset($message, $id, $name, $title, $text); |
|
| 52 |
+ if(isset($_POST['preview'])) {
|
|
| 53 |
+ $name = descript($_POST['name']); |
|
| 54 |
+ $title = descript($_POST['title']); |
|
| 55 |
+ $thistext = descript($_POST['text']); |
|
| 56 |
+ $edit = isset($_GET['edit']) ? $_GET['edit'] : ""; |
|
| 57 |
+ if(strpos($thistext, "?>") === false) $output .= "<div id='pagetitle'>$title</div>\n\n$thistext"; |
|
| 58 |
+ else {
|
|
| 59 |
+ $text = ""; |
|
| 60 |
+ eval("?>".$thistext."<?php ");
|
|
| 61 |
+ $output .= "<div id='pagetitle'>$title</div>\n\n$text"; |
|
| 62 |
+ } |
|
| 63 |
+ $text = $thistext; |
|
| 64 |
+ } |
|
| 65 |
+ else if(isset($_GET['edit'])) {
|
|
| 66 |
+ $edit = $_GET['edit']; |
|
| 67 |
+ $pagequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_messages WHERE message_id = $edit LIMIT 1");
|
|
| 68 |
+ $message = dbassoc($pagequery); |
|
| 69 |
+ $id = $message['message_id']; |
|
| 70 |
+ $name = $message['message_name']; |
|
| 71 |
+ $title = $message['message_title']; |
|
| 72 |
+ $text = $message['message_text']; |
|
| 73 |
+ } |
|
| 74 |
+ else {
|
|
| 75 |
+ $name = ""; |
|
| 76 |
+ $title = ""; |
|
| 77 |
+ $text = ""; |
|
| 78 |
+ } |
|
| 79 |
+ $output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=custpages".(isset($edit) ? "&edit=$edit" : "")."\"> |
|
| 80 |
+ <div><label for=\"name\">"._NAME.":</label> <input type=\"text\" class=\"textbox\" name=\"name\" value=\"$name\"></div> |
|
| 81 |
+ <div><label for=\"title\">"._TITLE.":</label> <input type=\"text\" class=\"textbox\" name=\"title\" value=\"$title\" size=\"30\"></div> |
|
| 82 |
+ <div><label for=\"text\">"._TEXT.":</label><br /> |
|
| 83 |
+ <textarea class=\"textbox\" rows=\"10\" cols=\"60\" style='width: 100%;' name=\"text\">$text</textarea>"; |
|
| 84 |
+ if($tinyMCE) |
|
| 85 |
+ $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('text');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
|
|
| 86 |
+ $output .= "</div><INPUT type=\"submit\" class=\"button\" name=\"preview\" id=\"preview\" value=\""._PREVIEW."\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" id=\"submit\" value=\""._SUBMIT."\"></form></div>"; |
|
| 87 |
+ $output .= write_message(_CUSTPAGENOTE); |
|
| 88 |
+} |
|
| 89 |
+else {
|
|
| 90 |
+ $listquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_messages");
|
|
| 91 |
+ $output .= "<table class=\"tblborder\" style=\"margin: 0 auto;\"><tr><th class=\"tblborder\">"._ID."</th><th class=\"tblborder\">"._NAME."</th><th class=\"tblborder\">"._TITLE."</th><th class=\"tblborder\">"._OPTIONS."</th></tr>"; |
|
| 92 |
+ while($msg = dbassoc($listquery)) {
|
|
| 93 |
+ // Hidden messages they're listed in the settings. |
|
| 94 |
+ if($msg['message_name'] == "welcome" || $msg['message_name'] == "nothankyou" || $msg['message_name'] == "thankyou" || |
|
| 95 |
+ $msg['message_name'] == "copyright" || $msg['message_name'] == "printercopyright") continue; |
|
| 96 |
+ $output .= "<tr><td class=\"tblborder\">$msg[message_id]</td><td class=\"tblborder\">$msg[message_name]</td><td class=\"tblborder\"><a href='viewpage.php?page=$msg[message_name]'>$msg[message_title]</a></td> |
|
| 97 |
+ <td class=\"tblborder\"><a href=\"admin.php?action=custpages&edit=$msg[message_id]\">"._EDIT."</a> | |
|
| 98 |
+ <a href=\"admin.php?action=custpages&delete=$msg[message_id]\">"._DELETE."</a></td></tr>"; |
|
| 99 |
+ } |
|
| 100 |
+ if(!dbnumrows($listquery)) $output .= "<tr><td class=\"tblborder\" colspan=\"3\" align=\"center\">"._NORESULTS."</td></tr>"; |
|
| 101 |
+ $output .= "<tr><td class=\"tblborder\" colspan=\"4\" align=\"center\"><a href=\"admin.php?action=custpages&new=1\">"._ADDCUSTPAGE."</a></td></tr>"; |
|
| 102 |
+ $output .= "</table>"; |
|
| 103 |
+ $output .= write_message(_CUSTPAGENOTE); |
|
| 104 |
+} |
|
| 105 |
+?> |
|
| 0 | 106 |
\ No newline at end of file |