| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,176 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+// ---------------------------------------------------------------------- |
|
| 4 |
+// eFiction 3.2 |
|
| 5 |
+// Copyright (c) 2007 by Tammy Keefer |
|
| 6 |
+// Valid HTML 4.01 Transitional |
|
| 7 |
+// Based on eFiction 1.1 |
|
| 8 |
+// Copyright (C) 2003 by Rebecca Smallwood. |
|
| 9 |
+// http://efiction.sourceforge.net/ |
|
| 10 |
+// ---------------------------------------------------------------------- |
|
| 11 |
+// LICENSE |
|
| 12 |
+// |
|
| 13 |
+// This program is free software; you can redistribute it and/or |
|
| 14 |
+// modify it under the terms of the GNU General Public License (GPL) |
|
| 15 |
+// as published by the Free Software Foundation; either version 2 |
|
| 16 |
+// of the License, or (at your option) any later version. |
|
| 17 |
+// |
|
| 18 |
+// This program is distributed in the hope that it will be useful, |
|
| 19 |
+// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 20 |
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 21 |
+// GNU General Public License for more details. |
|
| 22 |
+// |
|
| 23 |
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html |
|
| 24 |
+// ---------------------------------------------------------------------- |
|
| 25 |
+ |
|
| 26 |
+if(!defined("_CHARSET")) exit( );
|
|
| 27 |
+ |
|
| 28 |
+ |
|
| 29 |
+ |
|
| 30 |
+//function to build story data section of the form. |
|
| 31 |
+function storyform($stories, $preview = 0){
|
|
| 32 |
+ |
|
| 33 |
+ global $admin, $allowed_tags, $multiplecats, $roundrobins, $catlist, $coauthallowed, $tinyMCE, $action, $sid; |
|
| 34 |
+ |
|
| 35 |
+ $classes = explode(",", $stories['classes']);
|
|
| 36 |
+ $charid = explode(",", $stories['charid']);
|
|
| 37 |
+ $catid = explode(",", $stories['catid']);
|
|
| 38 |
+ $title = $stories['title']; |
|
| 39 |
+ $summary = $stories['summary']; |
|
| 40 |
+ $storynotes = $stories['storynotes']; |
|
| 41 |
+ $rr = $stories['rr']; |
|
| 42 |
+ $feat = $stories['featured']; |
|
| 43 |
+ $rid = $stories['rid']; |
|
| 44 |
+ $complete = $stories['completed']; |
|
| 45 |
+ $validated = $stories['validated']; |
|
| 46 |
+ $uid = $stories['uid']; |
|
| 47 |
+ |
|
| 48 |
+ $output = "<br /><label for=\"storytitle\">"._TITLE.":</label> ".(!$title ? "<span style=\"font-weight: bold; color: red\">*</span>" : "")."<input type=\"text\" class=\"textbox\" name=\"title\" size=\"50\"".($title? " value=\"".htmlentities($title)."\"" : "")." maxlength=\"200\" id=\"storytitle\"><br />"; |
|
| 49 |
+ $authorquery = dbquery("SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM "._AUTHORTABLE." ORDER BY "._PENNAMEFIELD);
|
|
| 50 |
+ if($admin) {
|
|
| 51 |
+ if(!isset($authors)) {
|
|
| 52 |
+ $authors = ""; |
|
| 53 |
+ while($authorresult = dbassoc($authorquery)) {
|
|
| 54 |
+ $authors .= "<option value=\"$authorresult[uid]\"".($uid == $authorresult['uid'] ? " selected" : "").">$authorresult[penname]</option>"; |
|
| 55 |
+ } |
|
| 56 |
+ } |
|
| 57 |
+ $output .= "<br /><label for=\"uid\">"._AUTHOR.":</label> <select name=\"uid\" id=\"uid\">$authors</select><br /><br />"; |
|
| 58 |
+ } |
|
| 59 |
+ if($coauthallowed) {
|
|
| 60 |
+ $output .= "<script language=\"javascript\" type=\"text/javascript\" src=\""._BASEDIR."includes/userselect.js\"></script> |
|
| 61 |
+ <script language=\"javascript\" type=\"text/javascript\" src=\""._BASEDIR."includes/xmlhttp.js\"></script><div style=\"text-align: center;\">"._COAUTHORSEARCH."</div>"; |
|
| 62 |
+ $output .= "<label for='coauthorsSelect'>"._SEARCH.": <input name='coauthorsSelect' id='coauthorsSelect' size='20' type='text' class='userSelect' onkeyup='setUserSearch(\"coauthors\");' autocomplete='off'></label><br /> |
|
| 63 |
+<div id='coauthorsDiv' name='coauthorsDiv' style='visibility: hidden;'></div> |
|
| 64 |
+<iframe id='coauthorsshim' scr='' scrolling='no' frameborder='0' class='shim'></iframe> |
|
| 65 |
+<div><label for='coauthorsSelected'>"._COAUTHORS.": <br /><select name='coauthorsSelected' id='coauthorsSelected' size='8' multiple='multiple' class='multiSelect' onclick='javascript: removeMember(\"coauthors\");'>"; |
|
| 66 |
+ $couids = array() ; |
|
| 67 |
+ if(is_array($stories['coauthors']) && count($stories['coauthors'])) {
|
|
| 68 |
+ $coauths = dbquery("SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM "._AUTHORTABLE." WHERE FIND_IN_SET("._UIDFIELD.", '".implode(",", $stories['coauthors'])."') > 0");
|
|
| 69 |
+ while($c = dbassoc($coauths)) {
|
|
| 70 |
+ if($c['uid'] == $stories['uid']) continue; |
|
| 71 |
+ $output .= "<option label='".$c['penname']."' value='".$c['uid']."'>".$c['penname']."</option>"; |
|
| 72 |
+ $couids[] = $c['uid']; |
|
| 73 |
+ } |
|
| 74 |
+ $couids = implode(",", $couids);
|
|
| 75 |
+ } |
|
| 76 |
+ $output .= "</select></label> |
|
| 77 |
+ <input type='hidden' name='coauthors' id='coauthors' value='$couids'></div>"; |
|
| 78 |
+ } |
|
| 79 |
+ $output .= "<p><label for=\"summary\">"._SUMMARY.":</label> ".(!$summary ? "<span style=\"font-weight: bold; color: red\">*</span>" : "")."<br><textarea class=\"textbox\" rows=\"6\" name=\"summary\" id=\"summary\" cols=\"58\">$summary</textarea>"; |
|
| 80 |
+ if($tinyMCE) |
|
| 81 |
+ $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('summary');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
|
|
| 82 |
+ $output .= "</p> |
|
| 83 |
+ <p><label for=\"storynotes\">"._STORYNOTES.":</label> <br /><textarea class=\"textbox\" rows=\"6\" name=\"storynotes\" id=\"storynotes\" cols=\"58\">$storynotes</textarea></p>"; |
|
| 84 |
+ if($tinyMCE) |
|
| 85 |
+ $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('storynotes');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
|
|
| 86 |
+ if(!$multiplecats) $output .= "<input type=\"hidden\" name=\"catid\" id=\"catid\" value=\"1\">"; |
|
| 87 |
+ else {
|
|
| 88 |
+ include("includes/categories.php");
|
|
| 89 |
+ $output .= "<input type=\"hidden\" name=\"formname\" value=\"stories\">"; |
|
| 90 |
+ } |
|
| 91 |
+ $output .= "<div style='float: left; width: 100%;'>"; |
|
| 92 |
+ $count = 0; |
|
| 93 |
+ $result4 = dbquery("SELECT charname, catid, charid FROM ".TABLEPREFIX."fanfiction_characters ORDER BY charname");
|
|
| 94 |
+ if(dbnumrows($result4)) {
|
|
| 95 |
+ $output .= "<div style=\"float: left; width: 49%;\"><label for=\"charid\">"._CHARACTERS.":</label><br><select size=\"5\" style=\"width: 99%;\" id=\"charid\" name=\"charid[]\" multiple><option value=\"\">"._NONE."</option>"; |
|
| 96 |
+ while ($charresults = dbassoc($result4)) {
|
|
| 97 |
+ if((is_array($catid) && in_array($charresults['catid'], $catid)) || $charresults['catid'] == -1) {
|
|
| 98 |
+ $output .= "<option value=\"".$charresults['charid']."\"".($charid != "" && in_array(stripslashes($charresults['charid']), $charid) ? " selected" : "").">".stripslashes($charresults['charname'])."</option>"; |
|
| 99 |
+ } |
|
| 100 |
+ } |
|
| 101 |
+ $output .= "</select></div>"; |
|
| 102 |
+ $count++; |
|
| 103 |
+ } |
|
| 104 |
+ unset($result4); |
|
| 105 |
+ $result = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classtypes ORDER BY classtype_name");
|
|
| 106 |
+ while($type = dbassoc($result)) {
|
|
| 107 |
+ $result2 = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classes WHERE class_type = '$type[classtype_id]' ORDER BY class_name");
|
|
| 108 |
+ $select = ""; |
|
| 109 |
+ while ($class = dbassoc($result2)) {
|
|
| 110 |
+ $select .= "<option value=\"$class[class_id]\"".(is_array($classes) && in_array($class['class_id'], $classes) ? " selected" : "").">$class[class_name]</option>"; |
|
| 111 |
+ } |
|
| 112 |
+ $output .= "<div style=\"float: ".($count % 2 ? "right" : "left")."; width: 49%; margin-bottom: 1em;\"><label for=\"class_".$type['classtype_id']."\">$type[classtype_title]:</label><br /> |
|
| 113 |
+ <select name=\"class_".$type['classtype_id']."[]\" id=\"class_".$type['classtype_id']."\" style=\"width: 99%;\" multiple size=\"5\">$select</select></div>"; |
|
| 114 |
+ if($count % 2) $output .= "<div style=\"clear: both; height: 1px;\"> </div>"; |
|
| 115 |
+ $count++; |
|
| 116 |
+ } |
|
| 117 |
+ $output .= "<div style=\"clear: both; height: 1px;\"> </div></div>"; |
|
| 118 |
+ $result5 = dbquery("SELECT rid, rating FROM ".TABLEPREFIX."fanfiction_ratings");
|
|
| 119 |
+ $output .= "<label for=\"rid\">"._RATING.":</label>".(!$rid ? " <span style=\"font-weight: bold; color: red\">*</span>" : "")." <select size=\"1\" id=\"rid\" name=\"rid\">"; |
|
| 120 |
+ while ($r = dbassoc($result5)) {
|
|
| 121 |
+ $output .= "<option value=\"".$r['rid']."\"".($rid == $r['rid'] ? " selected" : "").">".$r['rating']."</option>"; |
|
| 122 |
+ } |
|
| 123 |
+ $output .= "</select> <label for=\"complete\">"._COMPLETE.":</label> <input type=\"checkbox\" class=\"checkbox\" id=\"complete\" name=\"complete\" value=\"1\"".($complete == 1 ? " checked" : "") .">"; |
|
| 124 |
+ if($roundrobins) $output .= " <label for=\"rr\"> "._ROUNDROBIN.":</label> |
|
| 125 |
+ <input type=\"checkbox\" class=\"checkbox\" name=\"rr\" id=\"rr\"value=\"1\"".($rr == 1 ? "checked" : "").">"; |
|
| 126 |
+ if(isADMIN && uLEVEL < 4) $output .= "<br /><label for=\"feature\">"._FEATURED.":</label> <select class=\"textbox\" id=\"feature\" name=\"feature\"> |
|
| 127 |
+ <option value=\"1\"".($feat == 1 ? " selected" : "").">"._ACTIVE."</option> |
|
| 128 |
+ <option value=\"2\"".($feat == 2 ? " selected" : "").">"._RETIRED."</option> |
|
| 129 |
+ <option value=\"0\"".(!$feat ? " selected" : "").">"._NO."</option> |
|
| 130 |
+ </select> |
|
| 131 |
+ <label for=\"validated\">"._VALIDATED.":</label> <select class=\"textbox\" id=\"validated\" name=\"validated\"> |
|
| 132 |
+ <option value=\"2\"".($validated == 2? " selected" : "").">"._STORY."</option> |
|
| 133 |
+ <option value=\"1\"".($validated == 1? " selected" : "").">"._CHAPTER."</option> |
|
| 134 |
+ <option value=\"0\"".(!$validated ? " selected" : "").">"._NO."</option> |
|
| 135 |
+ </select>"; |
|
| 136 |
+ $codequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'storyform'");
|
|
| 137 |
+ while($code = dbassoc($codequery)) {
|
|
| 138 |
+ eval($code['code_text']); |
|
| 139 |
+ } |
|
| 140 |
+ return $output; |
|
| 141 |
+} |
|
| 142 |
+// end storyform |
|
| 143 |
+ |
|
| 144 |
+// function to build chapter info section of the form. |
|
| 145 |
+function chapterform($inorder, $notes, $endnotes, $storytext, $chaptertitle, $uid = 0) {
|
|
| 146 |
+ global $admin, $tinyMCE, $action, $preview; |
|
| 147 |
+ $inorder++; |
|
| 148 |
+ $default = _CHAPTER." ". $inorder; |
|
| 149 |
+ if($chaptertitle != "") $default = $chaptertitle; |
|
| 150 |
+ if($tinyMCE && strpos($storytext, "<br>") === false && strpos($storytext, "<p>") === false && strpos($storytext, "<br />") === false) $storytext = nl2br($storytext); |
|
| 151 |
+ $output = ""; |
|
| 152 |
+ if($admin && ($action == "newchapter" || $action == "editchapter")) {
|
|
| 153 |
+ $authorquery = dbquery("SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM "._AUTHORTABLE." ORDER BY penname");
|
|
| 154 |
+ $output .= "<label for=\"uid\">"._AUTHOR.":</label> <select name=\"uid\" id=\"uid\">"; |
|
| 155 |
+ while($authorresult = dbassoc($authorquery)) {
|
|
| 156 |
+ $output .= "<option value=\"$authorresult[uid]\"".($uid == $authorresult['uid']? " selected" : "").">$authorresult[penname]</option>"; |
|
| 157 |
+ } |
|
| 158 |
+ $output .= "</select><br />"; |
|
| 159 |
+ } |
|
| 160 |
+ $output .= "<p><label for=\"chaptertitle\">"._CHAPTERTITLE.":</label> <input type=\"text\" class=\"textbox\" id=\"chaptertitle\" maxlength=\"200\" name=\"chaptertitle\" size=\"50\" value=\"".htmlentities($default)."\"> </p> |
|
| 161 |
+ <p>"._ALLOWEDTAGS."</p> |
|
| 162 |
+ <div><label for=\"notes\">"._CHAPTERNOTES.":</label><br /><textarea class=\"textbox\" rows=\"5\" id=\"notes\" name=\"notes\" cols=\"58\">$notes</textarea></div>"; |
|
| 163 |
+ if($tinyMCE) |
|
| 164 |
+ $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('notes');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
|
|
| 165 |
+ $output .= "<div><label for=\"storytext\">"._STORYTEXTTEXT.":</label>".(!$storytext ? "<span style=\"font-weight: bold; color: red\">*</span>" : "")."<br><textarea class=\"textbox\" rows=\"15\" id=\"storytext\" name=\"storytext\" cols=\"58\">".$storytext."</textarea></div>"; |
|
| 166 |
+ if($tinyMCE) |
|
| 167 |
+ $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('storytext');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
|
|
| 168 |
+ $output .= "<p><strong>"._OR."</strong> </p> |
|
| 169 |
+ <p><label for=\"storyfile\">"._STORYTEXTFILE.":</label> <INPUT type=\"file\" id=\"storyfile\" class=\"textbox\" name=\"storyfile\" onClick=\"this.form.storytext.disabled=true\"> </p> |
|
| 170 |
+ <div><label for=\"notes\">"._ENDNOTES.":</label><br><textarea class=\"textbox\" rows=\"5\" id=\"endnotes\" name=\"endnotes\" cols=\"58\">$endnotes</textarea></div>"; |
|
| 171 |
+ if($tinyMCE) |
|
| 172 |
+ $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('endnotes');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
|
|
| 173 |
+ return $output; |
|
| 174 |
+} |
|
| 175 |
+// end chapterform |
|
| 176 |
+?> |
|
| 0 | 177 |
\ No newline at end of file |