| ... | ... |
@@ -68,14 +68,14 @@ if(!empty($_GET['edit'])) {
|
| 68 | 68 |
$panelinfo = dbassoc($panelquery); |
| 69 | 69 |
$output .= "<div class='sectionheader'>".($_GET['edit'] == "new" ? _ADDPANEL : _EDITPANEL)."</div> |
| 70 | 70 |
<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" style='width: 450px; margin: 0 auto;' action=\"admin.php?action=panels&edit=".$_GET['edit']."\"> |
| 71 |
- <label for='panel_name'>"._NAME.":</label> <input type='text' class='textbox' name='panel_name' id='panel_name' value='".$panelinfo['panel_name']."'><br /> |
|
| 72 |
- <label for='panel_title'>"._TITLE.":</label> <input type='text' class='textbox' name='panel_title' id='panel_title' value='".$panelinfo['panel_title']."'><br /> |
|
| 73 |
- <label for='panel_url'>"._PANELURL.":</label> <input type='text' class='textbox' name='panel_url' id='panel_url' value='".$panelinfo['panel_url']."'><br /> |
|
| 71 |
+ <label for='panel_name'>"._NAME.":</label> <input type='text' class='textbox' name='panel_name' id='panel_name' value='".(isset($panelinfo['panel_name']) ? $panelinfo['panel_name'] : null)."'><br /> |
|
| 72 |
+ <label for='panel_title'>"._TITLE.":</label> <input type='text' class='textbox' name='panel_title' id='panel_title' value='".(isset($panelinfo['panel_title']) ? $panelinfo['panel_title'] : null)."'><br /> |
|
| 73 |
+ <label for='panel_url'>"._PANELURL.":</label> <input type='text' class='textbox' name='panel_url' id='panel_url' value='".(isset($panelinfo['panel_url']) ? $panelinfo['panel_url'] : null)."'><br /> |
|
| 74 | 74 |
<label for='panel_level'>"._LEVEL.":</label> <select name='panel_level' id='panel_level'>"; |
| 75 |
- for($x = 0; $x < 5; $x++) { $output .= "<option".($panelinfo['panel_level'] == $x ? " selected" : "").">$x</option>"; }
|
|
| 75 |
+ for($x = 0; $x < 5; $x++) { $output .= "<option".(($panelinfo['panel_level'] ?? null) == $x ? " selected" : "").">$x</option>"; }
|
|
| 76 | 76 |
$output .= "</select><br /> |
| 77 |
- <label for='panel_hidden'>"._HIDDEN.":</label> <input type='checkbox' class='checkbox' name='panel_hidden' id='panel_hidden' ".($panelinfo['panel_hidden'] ? " checked" : "")."><br /> |
|
| 78 |
- <label for='panel_type'>"._TYPE.":</label> <input type='text' class='textbox' name='panel_type' id='panel_type' value='".$panelinfo['panel_type']."' size='2'><br /> |
|
| 77 |
+ <label for='panel_hidden'>"._HIDDEN.":</label> <input type='checkbox' class='checkbox' name='panel_hidden' id='panel_hidden' ".(($panelinfo['panel_hidden'] ?? null) ? " checked" : "")."><br /> |
|
| 78 |
+ <label for='panel_type'>"._TYPE.":</label> <input type='text' class='textbox' name='panel_type' id='panel_type' value='".(isset($panelinfo['panel_type']) ? $panelinfo['panel_type'] : null)."' size='2'><br /> |
|
| 79 | 79 |
<div style='margin: 1em; text-align: center;'><INPUT type=\"submit\" class=\"button\" value=\""._SUBMIT."\" name=\"submit\"></div></form></div>"; |
| 80 | 80 |
} |
| 81 | 81 |
} |
| ... | ... |
@@ -96,7 +96,7 @@ else if(!empty($_GET['delete'])) {
|
| 96 | 96 |
} |
| 97 | 97 |
} |
| 98 | 98 |
else {
|
| 99 |
- $output .= "<form name=\"list\" action=\"\"><div class='sectionheader'>"._PANELS." <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_PANELS."</span></A><br /> <select name=\"list\" onchange=\"if(this.selectedIndex.value != 'false') document.location = document.list.list.options[document.list.list.selectedIndex].value\">"; |
|
| 99 |
+ $output .= "<form name=\"list\" action=\"\"><div class='sectionheader'>"._PANELS." <A HREF=\"#\" class=\"pophelp\" style='font-size: 12pt;'>[?]<span>"._HELP_PANELS."</span></A><br /> <select name=\"list\" onchange=\"if(this.selectedIndex.value != 'false') document.location = document.list.list.options[document.list.list.selectedIndex].value\">"; |
|
| 100 | 100 |
$output .= "<option value=\"admin.php?action=panels\">"._ALL."</option>"; |
| 101 | 101 |
$paneltypelist = dbquery("SELECT DISTINCT panel_type FROM ".TABLEPREFIX."fanfiction_panels ORDER BY panel_type");
|
| 102 | 102 |
while($t = dbrow($paneltypelist)) {
|
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,136 @@ |
| 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 |
+$paneltypes = array("A" => _ADMIN, "U" => _USERACCOUNT, "P" => _PROFILE, "F" => _FAVOR, "S" => _SUBMISSIONS, "B" => _BROWSE, "L" => _10LISTS);
|
|
| 28 |
+ |
|
| 29 |
+if(isset($_GET['type'])) $type = $_GET['type']; |
|
| 30 |
+else $type = false; |
|
| 31 |
+if(!empty($_GET['go'])) {
|
|
| 32 |
+ $go = $_GET['go']; |
|
| 33 |
+ $order = $_GET['order']; |
|
| 34 |
+ if($go == "up") $oneabove = $order - 1; |
|
| 35 |
+ else $oneabove = $order + 1; |
|
| 36 |
+ dbquery("UPDATE ".TABLEPREFIX."fanfiction_panels SET panel_order = '$order' WHERE panel_type = '$type' and panel_order = '$oneabove'");
|
|
| 37 |
+ dbquery("UPDATE ".TABLEPREFIX."fanfiction_panels SET panel_order = '$oneabove' WHERE panel_id = '".$_GET['panel']."'");
|
|
| 38 |
+} |
|
| 39 |
+if(!empty($_GET['edit'])) {
|
|
| 40 |
+ if(!empty($_POST['submit'])) {
|
|
| 41 |
+ $panel_name = addslashes(strip_tags(descript($_POST['panel_name']))); |
|
| 42 |
+ $panel_title = addslashes(strip_tags(descript($_POST['panel_title']))); |
|
| 43 |
+ $panel_url = addslashes(strip_tags(descript($_POST['panel_url']))); |
|
| 44 |
+ $panel_level = (!empty($_POST['panel_level']) && isNumber($_POST['panel_level']) ? $_POST['panel_level'] : 0); |
|
| 45 |
+ $panel_hidden = (!empty($_POST['panel_hidden']) ? 1 : 0); |
|
| 46 |
+ $panel_type = strip_tags(descript($_POST['panel_type'])); |
|
| 47 |
+ if(!$panel_hidden) {
|
|
| 48 |
+ $oldinfo = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_id = '".$_GET['edit']."'");
|
|
| 49 |
+ $panelinfo = dbassoc($oldinfo); |
|
| 50 |
+ $nextorder = 0; |
|
| 51 |
+ if($panelinfo['panel_hidden'] || $_GET['edit'] == "new") {
|
|
| 52 |
+ $order = dbquery("SELECT COUNT(panel_id) FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_type = '$panel_type' AND panel_hidden = 0".($panel_type == "A" ? " AND panel_level = '$panel_level'" : ""));
|
|
| 53 |
+ list($nextorder) = dbrow($order); |
|
| 54 |
+ $nextorder++; |
|
| 55 |
+ } |
|
| 56 |
+ else {
|
|
| 57 |
+ $nextorder = 0; |
|
| 58 |
+ } |
|
| 59 |
+ } |
|
| 60 |
+ else if($panel_hidden) $nextorder = 0; |
|
| 61 |
+ if($_GET['edit'] != "new") $result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_panels SET panel_name = '$panel_name', panel_title = '$panel_title', panel_url = '$panel_url', panel_level = '$panel_level', panel_hidden = '$panel_hidden', panel_type = '$panel_type'".(!empty($panel_hidden) ? ", panel_order = '$nextorder'" : "")." WHERE panel_id = '".$_GET['edit']."'");
|
|
| 62 |
+ else $result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_panels(`panel_name`, `panel_title`, `panel_url`, `panel_level`, `panel_hidden`, `panel_type`, `panel_order`) VALUES( '$panel_name', '$panel_title', '$panel_url', '$panel_level', '$panel_hidden', '$panel_type', '$nextorder')");
|
|
| 63 |
+ if($result) $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 64 |
+ else $output .= write_error(_ERROR); |
|
| 65 |
+ } |
|
| 66 |
+ else {
|
|
| 67 |
+ $panelquery= dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_id = '".$_GET['edit']."' LIMIT 1");
|
|
| 68 |
+ $panelinfo = dbassoc($panelquery); |
|
| 69 |
+ $output .= "<div class='sectionheader'>".($_GET['edit'] == "new" ? _ADDPANEL : _EDITPANEL)."</div> |
|
| 70 |
+ <div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" style='width: 450px; margin: 0 auto;' action=\"admin.php?action=panels&edit=".$_GET['edit']."\"> |
|
| 71 |
+ <label for='panel_name'>"._NAME.":</label> <input type='text' class='textbox' name='panel_name' id='panel_name' value='".$panelinfo['panel_name']."'><br /> |
|
| 72 |
+ <label for='panel_title'>"._TITLE.":</label> <input type='text' class='textbox' name='panel_title' id='panel_title' value='".$panelinfo['panel_title']."'><br /> |
|
| 73 |
+ <label for='panel_url'>"._PANELURL.":</label> <input type='text' class='textbox' name='panel_url' id='panel_url' value='".$panelinfo['panel_url']."'><br /> |
|
| 74 |
+ <label for='panel_level'>"._LEVEL.":</label> <select name='panel_level' id='panel_level'>"; |
|
| 75 |
+ for($x = 0; $x < 5; $x++) { $output .= "<option".($panelinfo['panel_level'] == $x ? " selected" : "").">$x</option>"; }
|
|
| 76 |
+ $output .= "</select><br /> |
|
| 77 |
+ <label for='panel_hidden'>"._HIDDEN.":</label> <input type='checkbox' class='checkbox' name='panel_hidden' id='panel_hidden' ".($panelinfo['panel_hidden'] ? " checked" : "")."><br /> |
|
| 78 |
+ <label for='panel_type'>"._TYPE.":</label> <input type='text' class='textbox' name='panel_type' id='panel_type' value='".$panelinfo['panel_type']."' size='2'><br /> |
|
| 79 |
+ <div style='margin: 1em; text-align: center;'><INPUT type=\"submit\" class=\"button\" value=\""._SUBMIT."\" name=\"submit\"></div></form></div>"; |
|
| 80 |
+ } |
|
| 81 |
+} |
|
| 82 |
+else if(!empty($_GET['delete'])) {
|
|
| 83 |
+ $panel_id = $_GET['delete']; |
|
| 84 |
+ $confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false; |
|
| 85 |
+ if($confirm == "yes" && isNumber($panel_id)) {
|
|
| 86 |
+ $result = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_id = '$panel_id' LIMIT 1");
|
|
| 87 |
+ if($result) $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 88 |
+ else $output .= write_error(_ERROR); |
|
| 89 |
+ } |
|
| 90 |
+ else if ($confirm == "no") {
|
|
| 91 |
+ $output .= write_message(_ACTIONCANCELLED); |
|
| 92 |
+ } |
|
| 93 |
+ else {
|
|
| 94 |
+ $output .= write_message(_CONFIRMDELETE."<br /><br /> |
|
| 95 |
+ [ <a href=\"admin.php?action=panels&delete=$panel_id&confirm=yes\">"._YES."</a> | <a href=\"admin.php?action=panels&delete=$panel_id&confirm=no\">"._NO."</a> ]"); |
|
| 96 |
+ } |
|
| 97 |
+} |
|
| 98 |
+else {
|
|
| 99 |
+ $output .= "<form name=\"list\" action=\"\"><div class='sectionheader'>"._PANELS." <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_PANELS."</span></A><br /> <select name=\"list\" onchange=\"if(this.selectedIndex.value != 'false') document.location = document.list.list.options[document.list.list.selectedIndex].value\">"; |
|
| 100 |
+ $output .= "<option value=\"admin.php?action=panels\">"._ALL."</option>"; |
|
| 101 |
+ $paneltypelist = dbquery("SELECT DISTINCT panel_type FROM ".TABLEPREFIX."fanfiction_panels ORDER BY panel_type");
|
|
| 102 |
+ while($t = dbrow($paneltypelist)) {
|
|
| 103 |
+ $output .= "<option value='admin.php?action=panels&type=$t[0]'".($type == $t[0] ? " selected" : "").">$t[0] - ".$paneltypes[$t[0]]."</option>"; |
|
| 104 |
+ } |
|
| 105 |
+ $output .= "</select>"; |
|
| 106 |
+ if($type == "A") {
|
|
| 107 |
+ $output .= " "._LEVEL." <select name=\"list2\" onchange=\"if(this.selectedIndex.value != 'false') document.location = document.list.list2.options[document.list.list2.selectedIndex].value\"> |
|
| 108 |
+ <option value=\"admin.php?action=panels&type=A\">"._ALL."</option>"; |
|
| 109 |
+ for($x = 1; $x < 4; $x++) {
|
|
| 110 |
+ $output .= "<option value='admin.php?action=panels&type=A&level=$x'".(isset($_GET['level']) && $_GET['level'] == $x ? " selected" : "")."> $x </option>"; |
|
| 111 |
+ } |
|
| 112 |
+ $output .= "</select>"; |
|
| 113 |
+ } |
|
| 114 |
+ $output .= "</div></form>"; |
|
| 115 |
+ $list = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels".($type ? " WHERE panel_type = '$type'".($type == "A" && !empty($_GET['level']) ? " AND panel_level = '".$_GET['level']."'" : "") : "")." ORDER BY panel_type, panel_hidden DESC, ".($type == "A" ? "panel_level DESC, " : "")."panel_order ASC");
|
|
| 116 |
+ $num = dbnumrows($list); |
|
| 117 |
+ if($num > 0) $output .= "<table class='tblborder' style='margin: 0 auto;'><tr><th class='tblborder'>"._NAME."</th>".(!$type || ($type == "A" && empty($_GET['level'])) ? "<th class='tblborder'>"._TYPE."</th>" : "<th class='tblborder'>"._ORDER."</th>")."<th class='tblborder'>"._OPTIONS."</th></tr><tr><td class='tblborder' colspan='3' align='center'><a href='admin.php?action=panels&edit=new'>"._ADDNEWPANEL."</a></td></tr>"; |
|
| 118 |
+ $count = 0; |
|
| 119 |
+ while($panel = dbassoc($list)) {
|
|
| 120 |
+ if(!$panel['panel_hidden']) $count++; |
|
| 121 |
+ else $num--; |
|
| 122 |
+ $output .= "<tr><td class='tblborder'>".$panel['panel_title']."</td><td class='tblborder'>"; |
|
| 123 |
+ if(!$type) $output .= $panel['panel_type']." - ".$paneltypes[$panel['panel_type']]; |
|
| 124 |
+ else if($type == "A" && empty($_GET['level'])) $output .= $panel['panel_hidden'] ? _HIDDEN : _LEVEL." ".$panel['panel_level']; |
|
| 125 |
+ else {
|
|
| 126 |
+ if($panel['panel_hidden']) $output .= _HIDDEN; |
|
| 127 |
+ else {
|
|
| 128 |
+ $output .= $count > 1 ? "<a href='admin.php?action=panels&type=$type&go=up&panel=".$panel['panel_id'].(!empty($_GET['level']) ? "&level=".$_GET['level'] : "")."&order=".$panel['panel_order']."'>$up</a>" : ""; |
|
| 129 |
+ $output .= $count < $num ? "<a href='admin.php?action=panels&type=$type&go=down&panel=".$panel['panel_id'].(!empty($_GET['level']) ? "&level=".$_GET['level'] : "")."&order=".$panel['panel_order']."'>$down</a>" : ""; |
|
| 130 |
+ } |
|
| 131 |
+ } |
|
| 132 |
+ $output .= "</td><td class='tblborder'><a href='admin.php?action=panels&edit=".$panel['panel_id']."'>"._EDIT."</a> | <a href='admin.php?action=panels&delete=".$panel['panel_id']."'>"._DELETE."</a></td></tr>"; |
|
| 133 |
+ } |
|
| 134 |
+ $output .= "</table>"; |
|
| 135 |
+} |
|
| 136 |
+?> |