| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,168 @@ |
| 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 |
+$list = true; |
|
| 29 |
+ |
|
| 30 |
+if(isset($_GET['type_id']) && isNumber($_GET['type_id'])) $type_id = $_GET['type_id']; |
|
| 31 |
+if(isset($_GET['listtype']) && isNumber($_GET['listtype'])) $listtype = $_GET['listtype']; |
|
| 32 |
+ |
|
| 33 |
+if(isset($_GET['delete'])) {
|
|
| 34 |
+ if($_GET['delete'] == "class" && isNumber($_GET["class"])) $thislist = dbquery("SELECT class_id FROM ".TABLEPREFIX."fanfiction_classes WHERE class_id = '".$_GET["class"]."'");
|
|
| 35 |
+ else {
|
|
| 36 |
+ list($classname) = dbrow(dbquery("SELECT classtype_name FROM ".TABLEPREFIX."fanfiction_classtypes WHERE classtype_id = '$type_id'"));
|
|
| 37 |
+ dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_pagelinks WHERE link_name = '".$classname."_link' LIMIT 1");
|
|
| 38 |
+ $thislist = dbquery("SELECT class_id FROM ".TABLEPREFIX."fanfiction_classes WHERE class_type = '$type_id'");
|
|
| 39 |
+ dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_classtypes WHERE classtype_id = '$type_id'");
|
|
| 40 |
+ } |
|
| 41 |
+ while($thisclass = dbassoc($thislist)) {
|
|
| 42 |
+ $class = $thisclass['class_id']; |
|
| 43 |
+ $stories = dbquery("SELECT sid, classes FROM ".TABLEPREFIX."fanfiction_stories WHERE FIND_IN_SET('$class', classes) > 0");
|
|
| 44 |
+ while($s = dbassoc($stories)) {
|
|
| 45 |
+ dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET classes = '".implode(",", array_diff(explode(",", $s['classes']), array($class)))."' WHERE sid = '$s[sid]' LIMIT 1");
|
|
| 46 |
+ } |
|
| 47 |
+ $series = dbquery("SELECT seriesid, classes FROM ".TABLEPREFIX."fanfiction_series WHERE FIND_IN_SET('$class', classes) > 0");
|
|
| 48 |
+ while($s = dbassoc($series)) {
|
|
| 49 |
+ dbquery("UPDATE ".TABLEPREFIX."fanfiction_series SET classes = '".implode(",", array_diff(explode(",", $s['classes']), array($class)))."' WHERE seriesid = '$s[seriesid]' LIMIT 1");
|
|
| 50 |
+ } |
|
| 51 |
+ $code = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'delclass'");
|
|
| 52 |
+ while($c = dbassoc($code)) {
|
|
| 53 |
+ eval($c['code_text']); |
|
| 54 |
+ } |
|
| 55 |
+ dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_classes WHERE class_id = '$class' LIMIT 1");
|
|
| 56 |
+ } |
|
| 57 |
+} |
|
| 58 |
+if(isset($_GET['newitems']) && isNumber($_GET['newitems'])) {
|
|
| 59 |
+ if(isset($_POST['submit'])) {
|
|
| 60 |
+ for($x = 1; $x <= $itemsperpage; $x++) {
|
|
| 61 |
+ $item = escapestring(descript(strip_tags($_POST["item_$x"]))); |
|
| 62 |
+ if($item) {
|
|
| 63 |
+ $result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_classes(`class_type`, `class_name`) VALUES('$_GET[newitems]', '$item')");
|
|
| 64 |
+ if(!$result) $output .= write_error(magicunquote($item).": "._ERROR."<br />"); |
|
| 65 |
+ } |
|
| 66 |
+ } |
|
| 67 |
+ $listtype = $_GET['newitems']; |
|
| 68 |
+ } |
|
| 69 |
+ else {
|
|
| 70 |
+ $type = dbquery("SELECT classtype_title FROM ".TABLEPREFIX."fanfiction_classtypes WHERE classtype_id = '$_GET[newitems]' LIMIT 1");
|
|
| 71 |
+ list($thistype) = dbrow($type); |
|
| 72 |
+ $output .= "<div id=\"pagetitle\">$thistype</div><div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" style=\"width: 450px; margin: 1em auto;\" action=\"admin.php?action=classifications&newitems=$_GET[newitems]\">\n"; |
|
| 73 |
+ for($x = 1; $x <= $itemsperpage; $x ++) {
|
|
| 74 |
+ $output .= "<div><label for=\"item_$x\">"._NEWITEM." $x: </label><input type=\"text\" class=\"textbox\" size='30' name=\"item_$x\"></div>\n"; |
|
| 75 |
+ } |
|
| 76 |
+ $output .= "<div style='text-align: center; margin: 1em auto;'><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></div></div>"; |
|
| 77 |
+ $list = false; |
|
| 78 |
+ } |
|
| 79 |
+} |
|
| 80 |
+if(isset($listtype)) {
|
|
| 81 |
+ $thislist = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classes WHERE class_type = '$listtype'");
|
|
| 82 |
+ $output .= "<table class=\"tblborder\" style=\"margin: 0 auto;\"><tr><th clas=\"tblborder\">"._CLASS."</th><th clas=\"tblborder\">"._OPTIONS."</th></tr>"; |
|
| 83 |
+ if(!dbnumrows($thislist)) $output .= "<tr><td class=\"tblborder\" colspan='2'>"._NORESULTS."</td></tr>"; |
|
| 84 |
+ while($class = dbassoc($thislist)) {
|
|
| 85 |
+ $output .= "<tr> |
|
| 86 |
+ <td class=\"tblborder\"> |
|
| 87 |
+ $class[class_name] |
|
| 88 |
+ </td> |
|
| 89 |
+ <td class=\"tblborder\"> |
|
| 90 |
+ <a href=\"admin.php?action=classifications&class=$class[class_id]\">"._EDIT."</a> | |
|
| 91 |
+ <a href=\"admin.php?action=classifications&delete=class&class=$class[class_id]&listtype=$listtype\">"._DELETE."</a> |
|
| 92 |
+ </td></tr>"; |
|
| 93 |
+ } |
|
| 94 |
+ $output .= "<tr><td class=\"tblborder\" colspan=\"2\" style=\"text-align: center;\"><a href=\"admin.php?action=classifications&newitems=$listtype\">"._ADDNEWCLASSES."</a></td></tr></table>"; |
|
| 95 |
+ $list = false; |
|
| 96 |
+} |
|
| 97 |
+if(isset($_GET['type']) && empty($_GET['delete'])) {
|
|
| 98 |
+ if(isset($_POST['submit'])) {
|
|
| 99 |
+ $type_name = escapestring(descript(strip_tags($_POST['type_name']))); |
|
| 100 |
+ $type_title = escapestring(descript(strip_tags($_POST['type_title']))); |
|
| 101 |
+ if(isset($_POST['type_id'])) $result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_classtypes SET classtype_name = '$type_name', classtype_title = '$type_title' WHERE classtype_id = '".$_POST['type_id']."' LIMIT 1");
|
|
| 102 |
+ else {
|
|
| 103 |
+ $result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_classtypes(classtype_name, classtype_title) VALUES('$type_name', '$type_title')");
|
|
| 104 |
+ $id = dbinsertid($result); |
|
| 105 |
+ $result2 = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_pagelinks(link_name, link_text, link_url) VALUES('".$type_name."_link', '$type_title', 'browse.php?type=class&type_id=$id')");
|
|
| 106 |
+ } |
|
| 107 |
+ if($result) $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 108 |
+ else $output .= write_error(_ERROR); |
|
| 109 |
+ } |
|
| 110 |
+ else {
|
|
| 111 |
+ if(isNumber($_GET['type'])) {
|
|
| 112 |
+ $typequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classtypes WHERE classtype_id = '$_GET[type]' LIMIT 1");
|
|
| 113 |
+ $thistype = dbassoc($typequery); |
|
| 114 |
+ } |
|
| 115 |
+ $output .= "<div id='settingsform'><form method=\"POST\" style=\"width: 100%; margin: 1em auto;\" enctype=\"multipart/form-data\" action=\"admin.php?action=classifications&type=$_GET[type]\">"; |
|
| 116 |
+ if(isset($thistype)) $output .= "<input type=\"hidden\" name=\"type_id\" value=\"".$thistype['classtype_id']."\">"; |
|
| 117 |
+ $output .= "<div><label for=\"type_name\">"._NAME.": </label> <input type=\"text\" class=\"textbox\" name=\"type_name\" value=\"".(isset($thistype) ? $thistype['classtype_name'] : "")."\"></div> |
|
| 118 |
+ <div><label for=\"type_name\">"._TITLE.": </label> <input type=\"text\" class=\"textbox\" name=\"type_title\" value=\"".(isset($thistype) ? $thistype['classtype_title'] : "")."\"></div> |
|
| 119 |
+ <div style='text-align: center; margin: 1em auto;'><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></div></form></div>"; |
|
| 120 |
+ $output .= write_message(_CLASSNOTE); |
|
| 121 |
+ $list = false; |
|
| 122 |
+ } |
|
| 123 |
+} |
|
| 124 |
+if(isset($_GET['class']) && empty($_GET['delete'])) {
|
|
| 125 |
+ if(isset($_POST['submit'])) {
|
|
| 126 |
+ if(isset($_GET['class']) && isNumber($_GET['class'])) $class_id = $_GET['class']; |
|
| 127 |
+ $class_name = escapestring(descript(strip_tags($_POST['class_name']))); |
|
| 128 |
+ $class_type = isNumber($_POST['type_id']) ? $_POST['type_id'] : false; |
|
| 129 |
+ if(isset($class_id)) $result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_classes SET class_name = '$class_name', class_type = '$class_type' WHERE class_id = '$class_id' LIMIT 1");
|
|
| 130 |
+ if($result) $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 131 |
+ else $output .= write_error(_ERROR); |
|
| 132 |
+ } |
|
| 133 |
+ else {
|
|
| 134 |
+ if(isNumber($_GET['class'])) {
|
|
| 135 |
+ $typequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classes WHERE class_id = '$_GET[class]' LIMIT 1");
|
|
| 136 |
+ $thisclass = dbassoc($typequery); |
|
| 137 |
+ } |
|
| 138 |
+ $output .= "<div id='settingsform'><form method=\"POST\" style=\"width: 90%; margin: 1em auto;\" enctype=\"multipart/form-data\" action=\"admin.php?action=classifications&class=$_GET[class]\">"; |
|
| 139 |
+ if(isset($thisclass)) $output .= "<div><label for=\"class_name\">"._NAME.": </label> <input type=\"text\" class=\"textbox\" name=\"class_name\" value=\"".(isset($thisclass) ? $thisclass['class_name'] : "")."\"></div> |
|
| 140 |
+ <div><label for=\"type_id\">"._CLASSTYPES.":</label> <select name=\"type_id\" id=\"type_id\">"; |
|
| 141 |
+ $types = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classtypes");
|
|
| 142 |
+ while($t = dbassoc($types)) {
|
|
| 143 |
+ $output .= "<option value='".$t['classtype_id']."'".($t['classtype_id'] == $thisclass['class_type'] ? " selected" : "").">".$t['classtype_title']."</option>"; |
|
| 144 |
+ } |
|
| 145 |
+ $output .= "</select></div> |
|
| 146 |
+ <div id='submitdiv'><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></div></form><div class='cleaner'> </div></div>"; |
|
| 147 |
+ $output .= write_message(_CLASSNOTE); |
|
| 148 |
+ $list = false; |
|
| 149 |
+ } |
|
| 150 |
+} |
|
| 151 |
+if($list) {
|
|
| 152 |
+ $types = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classtypes");
|
|
| 153 |
+ $output .= "<div style='text-align: center;'><table class=\"tblborder\" style=\"margin: 0 auto; text-align: left;\"><tr><th clas=\"tblborder\">"._CLASSTYPES."</th><th clas=\"tblborder\">"._OPTIONS."</th></tr>"; |
|
| 154 |
+ if(!dbnumrows($types)) $output .= "<tr><td class=\"tblborder\" colspan='2'>"._NORESULTS."</td></tr>"; |
|
| 155 |
+ while($type = dbassoc($types)) {
|
|
| 156 |
+ $output .= "<tr> |
|
| 157 |
+ <td class=\"tblborder\"> |
|
| 158 |
+ <a href=\"admin.php?action=classifications&listtype=$type[classtype_id]\">$type[classtype_title]</a> |
|
| 159 |
+ </td> |
|
| 160 |
+ <td class=\"tblborder\"> |
|
| 161 |
+ <a href=\"admin.php?action=classifications&type=$type[classtype_id]\">"._EDIT."</a> | |
|
| 162 |
+ <a href=\"admin.php?action=classifications&delete=type&type_id=$type[classtype_id]\">"._DELETE."</a> |
|
| 163 |
+ </td></tr>"; |
|
| 164 |
+ } |
|
| 165 |
+ $output .= "<tr><td class=\"tblborder\" colspan=\"2\" style=\"text-align: center;\"><a href=\"admin.php?action=classifications&type=new\">"._ADDNEWCLASSTYPE."</a></td></tr></table></div>"; |
|
| 166 |
+ $output .= write_message(_CLASSLISTNOTE); |
|
| 167 |
+} |
|
| 168 |
+?> |
|
| 0 | 169 |
\ No newline at end of file |