Browse code

fix Array to string conversion warning in PHP 8 - Technically a revert of a revert of coauthors, but better formatted

Clarissa Walker authored on 2026/09/08 19:03:17
Showing 1 changed files
... ...
@@ -63,15 +63,16 @@ function storyform($stories, $preview = 0){
63 63
 <div id='coauthorsDiv' name='coauthorsDiv' style='visibility: hidden;'></div>
64 64
 <iframe id='coauthorsshim' scr='' scrolling='no' frameborder='0' class='shim'></iframe>
65 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() ;
66
+	$couids = '';
67
+	$couidlist = array();
67 68
 	if(is_array($stories['coauthors']) && count($stories['coauthors'])) {
68 69
 		$coauths = dbquery("SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM "._AUTHORTABLE." WHERE FIND_IN_SET("._UIDFIELD.", '".implode(",", $stories['coauthors'])."') > 0");
69 70
 		while($c = dbassoc($coauths)) {
70 71
 			if($c['uid'] == $stories['uid']) continue;
71 72
 			$output .= "<option label='".$c['penname']."' value='".$c['uid']."'>".$c['penname']."</option>";
72
-			$couids[] = $c['uid'];
73
+			$couidlist[] = $c['uid'];
73 74
 		}
74
-		$couids = implode(",", $couids);
75
+		$couids = implode(",", $couidlist);
75 76
 	}
76 77
 	$output .= "</select></label>
77 78
 		<input type='hidden' name='coauthors' id='coauthors' value='$couids'></div>";
Browse code

More coauthors fixes

Clarissa Walker authored on 2026/09/05 13:44:38
Showing 1 changed files
... ...
@@ -63,16 +63,15 @@ function storyform($stories, $preview = 0){
63 63
 <div id='coauthorsDiv' name='coauthorsDiv' style='visibility: hidden;'></div>
64 64
 <iframe id='coauthorsshim' scr='' scrolling='no' frameborder='0' class='shim'></iframe>
65 65
 <div><label for='coauthorsSelected'>"._COAUTHORS.": <br /><select name='coauthorsSelected' id='coauthorsSelected' size='8' multiple='multiple' class='multiSelect' onclick='javascript: removeMember(\"coauthors\");'>";
66
-	$array_couids = array() ;
67
-	$couids = "";
66
+	$couids = array() ;
68 67
 	if(is_array($stories['coauthors']) && count($stories['coauthors'])) {
69 68
 		$coauths = dbquery("SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM "._AUTHORTABLE." WHERE FIND_IN_SET("._UIDFIELD.", '".implode(",", $stories['coauthors'])."') > 0");
70 69
 		while($c = dbassoc($coauths)) {
71 70
 			if($c['uid'] == $stories['uid']) continue;
72 71
 			$output .= "<option label='".$c['penname']."' value='".$c['uid']."'>".$c['penname']."</option>";
73
-			$array_couids[] = $c['uid'];
72
+			$couids[] = $c['uid'];
74 73
 		}
75
-		$couids = implode(",", $array_couids);
74
+		$couids = implode(",", $couids);
76 75
 	}
77 76
 	$output .= "</select></label>
78 77
 		<input type='hidden' name='coauthors' id='coauthors' value='$couids'></div>";
... ...
@@ -174,4 +173,4 @@ function chapterform($inorder, $notes, $endnotes, $storytext, $chaptertitle, $ui
174 173
 	return $output;
175 174
 }
176 175
 // end chapterform
177
-?>
178 176
\ No newline at end of file
177
+?>
Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,177 @@
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
+	$array_couids = array() ;
67
+	$couids = "";
68
+	if(is_array($stories['coauthors']) && count($stories['coauthors'])) {
69
+		$coauths = dbquery("SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM "._AUTHORTABLE." WHERE FIND_IN_SET("._UIDFIELD.", '".implode(",", $stories['coauthors'])."') > 0");
70
+		while($c = dbassoc($coauths)) {
71
+			if($c['uid'] == $stories['uid']) continue;
72
+			$output .= "<option label='".$c['penname']."' value='".$c['uid']."'>".$c['penname']."</option>";
73
+			$array_couids[] = $c['uid'];
74
+		}
75
+		$couids = implode(",", $array_couids);
76
+	}
77
+	$output .= "</select></label>
78
+		<input type='hidden' name='coauthors' id='coauthors' value='$couids'></div>";
79
+	}
80
+	$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>";
81
+	if($tinyMCE) 
82
+		$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('summary');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
83
+	$output .= "</p>
84
+		<p><label for=\"storynotes\">"._STORYNOTES.":</label> <br /><textarea class=\"textbox\" rows=\"6\" name=\"storynotes\" id=\"storynotes\" cols=\"58\">$storynotes</textarea></p>";
85
+	if($tinyMCE) 
86
+		$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('storynotes');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
87
+	if(!$multiplecats) $output .= "<input type=\"hidden\" name=\"catid\" id=\"catid\" value=\"1\">";
88
+	else {
89
+		include("includes/categories.php");
90
+		$output .= "<input type=\"hidden\" name=\"formname\" value=\"stories\">";
91
+	}
92
+	$output .= "<div style='float: left; width: 100%;'>";
93
+	$count = 0;
94
+	$result4 = dbquery("SELECT charname, catid, charid FROM ".TABLEPREFIX."fanfiction_characters ORDER BY charname");
95
+	if(dbnumrows($result4)) {
96
+		$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>";
97
+		while ($charresults = dbassoc($result4)) {
98
+			if((is_array($catid) && in_array($charresults['catid'], $catid)) || $charresults['catid'] == -1) {
99
+				$output .= "<option value=\"".$charresults['charid']."\"".($charid != "" && in_array(stripslashes($charresults['charid']), $charid) ? " selected" : "").">".stripslashes($charresults['charname'])."</option>";
100
+			}
101
+		}
102
+		$output .= "</select></div>";
103
+		$count++;
104
+	}
105
+	unset($result4);
106
+	$result = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classtypes ORDER BY classtype_name");
107
+	while($type = dbassoc($result)) {
108
+		$result2 = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classes WHERE class_type = '$type[classtype_id]' ORDER BY class_name");
109
+		$select = "";
110
+		while ($class = dbassoc($result2)) {
111
+				$select .= "<option value=\"$class[class_id]\"".(is_array($classes) && in_array($class['class_id'], $classes) ? " selected" : "").">$class[class_name]</option>";
112
+		}
113
+		$output .= "<div style=\"float: ".($count % 2 ? "right" : "left")."; width: 49%; margin-bottom: 1em;\"><label for=\"class_".$type['classtype_id']."\">$type[classtype_title]:</label><br />
114
+				 <select name=\"class_".$type['classtype_id']."[]\" id=\"class_".$type['classtype_id']."\"  style=\"width: 99%;\" multiple size=\"5\">$select</select></div>";
115
+		if($count % 2) $output .= "<div style=\"clear: both; height: 1px;\">&nbsp;</div>";
116
+		$count++;
117
+	}
118
+	$output .= "<div style=\"clear: both; height: 1px;\">&nbsp;</div></div>";
119
+	$result5 = dbquery("SELECT rid, rating FROM ".TABLEPREFIX."fanfiction_ratings");
120
+	$output .= "<label for=\"rid\">"._RATING.":</label>".(!$rid ? " <span style=\"font-weight: bold; color: red\">*</span>" : "")." <select size=\"1\" id=\"rid\" name=\"rid\">";
121
+	while ($r = dbassoc($result5)) {
122
+		$output .= "<option value=\"".$r['rid']."\"".($rid == $r['rid'] ? " selected" : "").">".$r['rating']."</option>";
123
+	} 
124
+	$output .= "</select>  <label for=\"complete\">"._COMPLETE.":</label> <input type=\"checkbox\" class=\"checkbox\" id=\"complete\" name=\"complete\" value=\"1\"".($complete == 1 ? " checked" : "") .">";
125
+	if($roundrobins) $output .= " <label for=\"rr\">  "._ROUNDROBIN.":</label>
126
+  			<input type=\"checkbox\" class=\"checkbox\" name=\"rr\" id=\"rr\"value=\"1\"".($rr == 1 ? "checked" : "").">";
127
+	 if(isADMIN && uLEVEL < 4) $output .= "<br /><label for=\"feature\">"._FEATURED.":</label> <select class=\"textbox\" id=\"feature\" name=\"feature\">
128
+				<option value=\"1\"".($feat == 1 ? " selected" : "").">"._ACTIVE."</option>
129
+				<option value=\"2\"".($feat == 2 ? " selected" : "").">"._RETIRED."</option>
130
+				<option value=\"0\"".(!$feat ? " selected" : "").">"._NO."</option>
131
+			</select> 
132
+			<label for=\"validated\">"._VALIDATED.":</label> <select class=\"textbox\" id=\"validated\" name=\"validated\">
133
+				<option value=\"2\"".($validated == 2? " selected" : "").">"._STORY."</option>
134
+				<option value=\"1\"".($validated  == 1? " selected" : "").">"._CHAPTER."</option>
135
+				<option value=\"0\"".(!$validated ? " selected" : "").">"._NO."</option>
136
+			</select>";
137
+	$codequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'storyform'");
138
+	while($code = dbassoc($codequery)) {
139
+		eval($code['code_text']);
140
+	}
141
+	return $output;
142
+}
143
+// end storyform
144
+
145
+// function to build chapter info section of the form.
146
+function chapterform($inorder, $notes, $endnotes, $storytext, $chaptertitle, $uid = 0) {
147
+	global $admin, $tinyMCE, $action, $preview;
148
+	$inorder++;
149
+	$default = _CHAPTER." ". $inorder;
150
+	if($chaptertitle != "") $default = $chaptertitle;
151
+	if($tinyMCE && strpos($storytext, "<br>") === false && strpos($storytext, "<p>") === false && strpos($storytext, "<br />") === false) $storytext = nl2br($storytext);
152
+	$output = "";
153
+	if($admin && ($action == "newchapter" || $action == "editchapter")) {
154
+		$authorquery = dbquery("SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM "._AUTHORTABLE." ORDER BY penname");
155
+		$output .= "<label for=\"uid\">"._AUTHOR.":</label> <select name=\"uid\" id=\"uid\">";
156
+			while($authorresult = dbassoc($authorquery)) {	
157
+				$output .= "<option value=\"$authorresult[uid]\"".($uid == $authorresult['uid']? " selected" : "").">$authorresult[penname]</option>";
158
+			}
159
+		$output .= "</select><br />";
160
+	}
161
+	$output .= "<p><label for=\"chaptertitle\">"._CHAPTERTITLE.":</label> <input type=\"text\" class=\"textbox\" id=\"chaptertitle\" maxlength=\"200\" name=\"chaptertitle\" size=\"50\" value=\"".htmlentities($default)."\"> </p>
162
+		<p>"._ALLOWEDTAGS."</p>
163
+		<div><label for=\"notes\">"._CHAPTERNOTES.":</label><br /><textarea class=\"textbox\" rows=\"5\" id=\"notes\" name=\"notes\" cols=\"58\">$notes</textarea></div>";
164
+	if($tinyMCE) 
165
+		$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('notes');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
166
+	$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>";
167
+	if($tinyMCE) 
168
+		$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('storytext');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
169
+	$output .= "<p><strong>"._OR."</strong> </p>
170
+		<p><label for=\"storyfile\">"._STORYTEXTFILE.":</label> <INPUT type=\"file\" id=\"storyfile\" class=\"textbox\" name=\"storyfile\" onClick=\"this.form.storytext.disabled=true\"> </p>
171
+		<div><label for=\"notes\">"._ENDNOTES.":</label><br><textarea class=\"textbox\" rows=\"5\" id=\"endnotes\" name=\"endnotes\" cols=\"58\">$endnotes</textarea></div>";
172
+	if($tinyMCE) 
173
+		$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('endnotes');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
174
+	return $output;
175
+}
176
+// end chapterform
177
+?>
0 178
\ No newline at end of file