Browse code

fixed blocks for PHP 8.1

Jimmi08 authored on 2023/02/19 13:27:16
Showing 13 changed files
... ...
@@ -1,98 +1,102 @@
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
-function save_blocks( $blocks ) {
28
-	
29
-	foreach($blocks as $block =>$value) {
30
-		unset($blockvars);
31
-		if((isset($_GET['admin']) && $_GET['admin'] != $block) || (isset($_GET['init']) && $_GET['init'] != $block)) continue;
32
-		foreach($value as $var=>$val) {
33
-			if($var != "name" && $var != "title" && $var != "file" && $var != "status") $blockvars[$var] = $val;
34
-		}
35
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_blocks SET block_name = '$block', block_title = '".escapestring($value['title'])."', block_file = '".$value['file']."', block_status = '".$value['status']."', block_variables =  '".(isset($blockvars) ? addslashes(serialize($blockvars)) : "")."' WHERE block_name = '$block'");
36
-	}
37
-}
38
-if(isset($_GET['admin'])) $admin = $_GET['admin'];
39
-else $admin = false;
40
-$content = "";
41
-
42
-	if($admin) {
43
-		$output .= "<div id='pagetitle'>"._ADMIN." - ".(isset($blocks[$_GET['admin']]['title']) ? $blocks[$_GET['admin']]['title'] : "")."</div>";
44
-		include("blocks/".$_GET['admin']."/admin.php");
45
-		save_blocks( $blocks );
46
-	}
47
-	if(isset($_GET['init'])) {
48
-		if(file_exists("blocks/".$_GET['init']."/init.php")) include("blocks/".$_GET['init']."/init.php");
49
-		else return _ERROR;
50
-		save_blocks( $blocks );
51
-	}
52
-	if(isset($_POST['submit']) && empty($admin)) {
53
-		$x = 1;
54
-		while(isset($_POST[$x])) {
55
-			// activate inactive blocks.
56
-			if(isset($blocks[$_POST[$x]])) {
57
-				$blocks[$_POST[$x]]['title'] = descript($_POST[$x."_title"]);
58
-				$blocks[$_POST[$x]]["status"] = $_POST[$x."_status"];
59
-			}
60
-			$x++;	
61
-		}
62
-		save_blocks( $blocks );
63
-		$output .= write_message(_ACTIONSUCCESSFUL);
64
-	}
65
-// In case the skin has already overridden the block settings or we've just changed the settings.
66
-$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks");
67
-while($block = dbassoc($blockquery)) {
68
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
69
-	$blocks[$block['block_name']]['title'] = $block['block_title'];
70
-	 $blocks[$block['block_name']]['file'] = $block['block_file'];
71
-	$blocks[$block['block_name']]['status'] = $block['block_status'];
72
-}
73
-	unset($content);
74
-
75
-if(empty($admin)) {
76
-	$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks\"><center><table class=\"tblborder\" cellpadding=\"3\"><tr><th>"._NAME."</th><th>"._TITLE."</th><th>"._STATUS."</th><th>"._ADMIN."</th></tr>";
77
-	$x = 1;
78
-	$directory = opendir("blocks");
79
-	while($filename = readdir($directory)) {
80
-			if($filename=="." || $filename==".." || !is_dir("blocks/".$filename)) continue;
81
-			$output .= "<tr><td class=\"tblborder\"><input type=\"hidden\" name=\"$x\" value=\"$filename\">$filename</td>";
82
-			if(isset($blocks[$filename]['file'])) $output .= "<td class=\"tblborder\"><input name=\"{$x}_title\" type=\"text\" class=\"textbox\" value=\"".stripslashes($blocks[$filename]['title'])."\"><input name=\"{$x}_file\" type=\"hidden\" value=\"".$blocks[$filename]['file']."\"></td>
83
-				<td class=\"tblborder\"><select name=\"{$x}_status\">
84
-					<option value=\"0\"".(!$blocks[$filename]['status'] ? " selected" : "").">"._INACTIVE."</option>
85
-					<option value=\"1\"".($blocks[$filename]['status'] == 1? " selected" : "").">"._ACTIVE."</option>
86
-					<option value=\"2\"".($blocks[$filename]['status'] == 2 ? " selected" : "").">"._INDEXONLY."</option>
87
-					</select></td>
88
-				<td class=\"tblborder\">".(file_exists("blocks/$filename/admin.php") ? "<a href=\"admin.php?action=blocks&admin=$filename\">"._OPTIONS."</a>" :  _NONE);
89
-			else $output .= "<td class=\"tblborder\" colspan=\"3\" align=\"center\"><a href=\"admin.php?action=blocks&init=$filename\">"._INITIALIZE."</a>";
90
-			$output .= "</td></tr>";
91
-			$x++;
92
-	}
93
-	closedir($directory);
94
-	$output .= "</table><br /><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form>";
95
-}
96
-// Now load the skin settings back in.
97
-	if(file_exists("$skindir/variables.php")) include("$skindir/variables.php"); 
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
+function save_blocks( $blocks ) {
28
+	
29
+	foreach($blocks as $block =>$value) {
30
+		unset($blockvars);
31
+		if((isset($_GET['admin']) && $_GET['admin'] != $block) || (isset($_GET['init']) && $_GET['init'] != $block)) continue;
32
+		foreach($value as $var=>$val) {
33
+			if($var != "name" && $var != "title" && $var != "file" && $var != "status") $blockvars[$var] = $val;
34
+		}
35
+		dbquery("UPDATE ".TABLEPREFIX."fanfiction_blocks SET block_name = '$block', block_title = '".escapestring($value['title'])."', block_file = '".$value['file']."', block_status = '".$value['status']."', block_variables =  '".(isset($blockvars) ? addslashes(serialize($blockvars)) : "")."' WHERE block_name = '$block'");
36
+	}
37
+}
38
+if(isset($_GET['admin'])) $admin = $_GET['admin'];
39
+else $admin = false;
40
+$content = "";
41
+
42
+	if($admin) {
43
+		$output .= "<div id='pagetitle'>"._ADMIN." - ".(isset($blocks[$_GET['admin']]['title']) ? $blocks[$_GET['admin']]['title'] : "")."</div>";
44
+		include("blocks/".$_GET['admin']."/admin.php");
45
+		save_blocks( $blocks );
46
+	}
47
+	if(isset($_GET['init'])) {
48
+		if(file_exists("blocks/".$_GET['init']."/init.php")) include("blocks/".$_GET['init']."/init.php");
49
+		else return _ERROR;
50
+		save_blocks( $blocks );
51
+	}
52
+	if(isset($_POST['submit']) && empty($admin)) {
53
+		$x = 1;
54
+		while(isset($_POST[$x])) {
55
+			// activate inactive blocks.
56
+			if(isset($blocks[$_POST[$x]])) {
57
+				$blocks[$_POST[$x]]['title'] = descript($_POST[$x."_title"]);
58
+				$blocks[$_POST[$x]]["status"] = $_POST[$x."_status"];
59
+			}
60
+			$x++;	
61
+		}
62
+		save_blocks( $blocks );
63
+		$output .= write_message(_ACTIONSUCCESSFUL);
64
+	}
65
+// In case the skin has already overridden the block settings or we've just changed the settings.
66
+$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks");
67
+while($block = dbassoc($blockquery)) {
68
+
69
+	if($block['block_variables']) {
70
+		$blocks[$block['block_name']] = unserialize($block['block_variables']);
71
+	}
72
+	
73
+	$blocks[$block['block_name']]['title'] = $block['block_title'];
74
+	$blocks[$block['block_name']]['file'] = $block['block_file'];
75
+	$blocks[$block['block_name']]['status'] = $block['block_status'];
76
+}
77
+	unset($content);
78
+
79
+if(empty($admin)) {
80
+	$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks\"><center><table class=\"tblborder\" cellpadding=\"3\"><tr><th>"._NAME."</th><th>"._TITLE."</th><th>"._STATUS."</th><th>"._ADMIN."</th></tr>";
81
+	$x = 1;
82
+	$directory = opendir("blocks");
83
+	while($filename = readdir($directory)) {
84
+			if($filename=="." || $filename==".." || !is_dir("blocks/".$filename)) continue;
85
+			$output .= "<tr><td class=\"tblborder\"><input type=\"hidden\" name=\"$x\" value=\"$filename\">$filename</td>";
86
+			if(isset($blocks[$filename]['file'])) $output .= "<td class=\"tblborder\"><input name=\"{$x}_title\" type=\"text\" class=\"textbox\" value=\"".stripslashes($blocks[$filename]['title'])."\"><input name=\"{$x}_file\" type=\"hidden\" value=\"".$blocks[$filename]['file']."\"></td>
87
+				<td class=\"tblborder\"><select name=\"{$x}_status\">
88
+					<option value=\"0\"".(!$blocks[$filename]['status'] ? " selected" : "").">"._INACTIVE."</option>
89
+					<option value=\"1\"".($blocks[$filename]['status'] == 1? " selected" : "").">"._ACTIVE."</option>
90
+					<option value=\"2\"".($blocks[$filename]['status'] == 2 ? " selected" : "").">"._INDEXONLY."</option>
91
+					</select></td>
92
+				<td class=\"tblborder\">".(file_exists("blocks/$filename/admin.php") ? "<a href=\"admin.php?action=blocks&admin=$filename\">"._OPTIONS."</a>" :  _NONE);
93
+			else $output .= "<td class=\"tblborder\" colspan=\"3\" align=\"center\"><a href=\"admin.php?action=blocks&init=$filename\">"._INITIALIZE."</a>";
94
+			$output .= "</td></tr>";
95
+			$x++;
96
+	}
97
+	closedir($directory);
98
+	$output .= "</table><br /><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form>";
99
+}
100
+// Now load the skin settings back in.
101
+	if(file_exists("$skindir/variables.php")) include("$skindir/variables.php"); 
98 102
 ?>
99 103
\ No newline at end of file
... ...
@@ -1,241 +1,241 @@
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
-function featured( ) {
28
-	global $tableprefix;
29
-
30
-	if($_GET['retire'])
31
-		mysql_query("UPDATE ".$tableprefix."fanfiction_stories SET featured = 2 WHERE sid = ".$_GET['retire']);
32
-	if($_GET['feature'])
33
-		mysql_query("UPDATE ".$tableprefix."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']);
34
-	$fquery = "SELECT stories.*, stories.title as title, author.penname, DATE_FORMAT(stories.updated, '%Y.%m.%d') as updatesort, DATE_FORMAT(stories.date, '$datim') as date, DATE_FORMAT(stories.updated, '$datim') as updated FROM ".$tableprefix."fanfiction_authors as author, ".$tableprefix."fanfiction_stories as stories WHERE stories.featured > 0 AND stories.uid = author.uid ORDER BY stories.featured";
35
-	$fresult = mysql_query($fquery) or die(_FATALERROR."Query: ".$fquery."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
36
-	$output .= "<center><table class=\"tblborder\" cellpadding=\"5\"><tr><th colspan=\"2\" align=\"center\">"._FEATUREDSTORIES."</th></tr>";
37
-	if(!mysql_num_rows($fresult)) $output .= "<tr><td colspan=\"2\" align=\"center\">"._NOSTORIES."</td><tr>";
38
-	while($story = mysql_fetch_array($fresult)) {
39
-		$output .= "<tr><td class=\"tblborder\"><a href=\"viewstory.php?sid=".$story['sid']."\">$story[title]</a> "._BY." <a href=\"viewuser.php?uid=".$story['uid']."\">".$story['penname']."</a></td><td class=\"tblborder\" align=\"center\">".($story['featured'] == 1 ? "<a href=\"admin.php?action=featured&retire=".$story['sid']."\">"._CURRENT."</a>" : "<b>"._RETIRED."</b>")."</td></tr>";
40
-	}
41
-	$output .= "</table>"._FEATUREDNOTE;
42
-	return $output;
43
-}
44
-// end featured
45
-
46
-function submitted()
47
-{
48
-	global $tableprefix, $admincats, $allowed_tags;
49
-		$output .= "<center><h4>"._SUBMITTED."</h4></center>";
50
-		$query = "SELECT story.title as storytitle, chapter.uid, chapter.sid, story.catid, chapter.chapid, chapter.inorder, chapter.title, author.penname FROM (".$tableprefix."fanfiction_chapters as chapter, ".$tableprefix."fanfiction_authors as author) LEFT JOIN ".$tableprefix."fanfiction_stories as story ON story.sid = chapter.sid WHERE chapter.validated = '0' AND chapter.uid = author.uid ORDER BY story.title ASC, chapter.inorder ASC";
51
-		$result = mysql_query($query) or die(_FATALERROR."Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
52
-		$output .= "<table class=\"tblborder\" cellspacing=\"0\" cellpadding=\"3\" align=\"center\"><tr class=\"tblborder\"><th>"._TITLE."</th><th>"._AUTHOR."</th><th>"._CATEGORY."</th><th>"._OPTIONS."</th></tr>";
53
-		$array = explode(",", $admincats);
54
-		while ($story = mysql_fetch_assoc($result))
55
-		{
56
-			unset($catstring);
57
-			$result3 = mysql_query("SELECT catid, category FROM ".$tableprefix."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
58
-			while($cats = mysql_fetch_array($result3)) {
59
-				$catstring[] = "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>";
60
-			}
61
-			if(!$admincats || sizeof(array_intersect(explode(",", $story['catid']), explode(",", $admincats)))) {
62
-				$output .= "<tr class=\"tblborder\">";
63
-				$output .= "<td class=\"tblborder\"><a href=\"viewstory.php?sid=".$story['sid']."\">".$story['storytitle']."</a>";
64
-				if($story['title']) $output .= " <b>:</b> <a href=\"viewstory.php?sid=".$story['sid']."&amp;chapter=".$story['inorder']."\">".$story['title']."</a>";
65
-				$output .= "<td class=\"tblborder\"><a href=\"viewuser.php?uid=".$story['uid']."\">".$story['penname']."</a></td>";
66
-				$output .= "<td class=\"tblborder\">".(is_array($catstring) ? implode(", ", $catstring) : "")."</td>";
67
-			$output .= "<td class=\"tblborder\"><a href=\"admin.php?action=validate&amp;chapid=".$story['chapid']."\">"._VALIDATE."</a> | "._DELETE.": <a href=\"stories.php?action=delete&amp;chapid=".$story['chapid']."&amp;sid=".$story['sid']."&amp;admin=1&amp;uid=".$story['uid']."\">"._CHAPTER."</a> "._OR." <a href=\"stories.php?action=delete&amp;sid=".$story['sid']."&amp;admin=1\">"._STORY."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&uid=".$story['uid']."&chapid=".$story['chapid']."', 500, 400, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&uid=".$story['uid']."&chapid=".$story['chapid']."', 500, 400, 'yes')\">"._NOLETTER."</a></td></tr>";
68
-			}
69
-		}
70
-		$output .= "</table>";
71
-
72
-	return $output;
73
-}
74
-// end submitted function
75
-
76
-function validate( ) {
77
-	global $tableprefix, $level, $store, $storiespath, $allowed_tags, $admincats, $sitename, $siteemail, $url, $alertson;
78
-
79
-	$output .= "<center><h4>"._VIEWSUBMITTED."</h4></center>";
80
-	if($_GET['validate'] == "yes") {
81
-		$storyquery = mysql_query("SELECT story.validated, story.catid, story.sid, story.title, story.summary, story.uid, author.penname, chapter.inorder FROM ".$tableprefix."fanfiction_stories as story, ".$tableprefix."fanfiction_chapters  as chapter, ".$tableprefix."fanfiction_authors as author WHERE author.uid = story.uid AND chapter.sid = story.sid AND chapter.chapid ='".$_GET['chapid']."' LIMIT 1");
82
-		list($validated, $catid, $sid, $title, $summary, $authoruid, $author, $inorder) = mysql_fetch_array($storyquery);
83
-		if($admincats == "0" || sizeof(array_intersect(explode(",", $catid), explode(",", $admincats)))) {
84
-			include("includes/emailer.php");
85
-			if($validated != "1") {
86
-				mysql_query("UPDATE ".$tableprefix."fanfiction_stories SET validated = '1', updated = NOW() WHERE sid = '".$_GET['sid']."'");
87
-				$categories = explode(",", $catid);
88
-				include("functions.php");
89
-				foreach($categories as $cat) {
90
-					categoryitems($cat, 1);
91
-				}
92
-				if($alertson) {
93
-					$subject = _NEWSTORYAT;
94
-					$mailtext = sprintf(_AUTHORALERTNOTE, $title, $author, $summary, $sid);
95
-					$favorites = mysql_query("SELECT author.uid, email, penname FROM ".$tableprefix."fanfiction_favauth as fav, ".$tableprefix."fanfiction_authors as author WHERE fav.favuid = $authoruid AND fav.uid = author.uid");
96
-					while($favuser = mysql_fetch_array($favorites)) { 
97
-						sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
98
-					}				
99
-				}
100
-			}
101
-			else if($alertson) {
102
-				$subject = _STORYALERT;
103
-				$mailtext = sprintf(_STORYALERTNOTE, $title, $author, $sid, $inorder);
104
-				$favorites = mysql_query("SELECT author.uid, penname, email FROM ".$tableprefix."fanfiction_favstor as fav, ".$tableprefix."fanfiction_authors as author WHERE sid = '$sid' AND fav.uid = author.uid");
105
-				while($favuser = mysql_fetch_array($favorites)) { 
106
-					sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
107
-				}
108
-			}
109
-			mysql_query("UPDATE ".$tableprefix."fanfiction_chapters SET validated = '1' WHERE chapid = '".$_GET['chapid']."'");
110
-			mysql_query("UPDATE ".$tableprefix."fanfiction_stories SET updated = NOW( ) WHERE sid = '$sid'");
111
-			$output .= "<center><b>"._STORYVALIDATED."</b></center>";
112
-		}
113
-		else
114
-			$output .= "<br /><br /><center>"._NOTAUTHORIZEDADMIN."  "._TRYAGAIN."</center><br /><br />";
115
-	}
116
-	else {
117
-			$result = mysql_query("SELECT story.title as storytitle, story.sid, story.catid, story.rid, story.gid, story.charid, story.wid, story.summary as storysummary, chapter.chapid, chapter.title, chapter.storytext, author.penname, chapter.uid as uid FROM ".$tableprefix."fanfiction_authors as author, ".$tableprefix."fanfiction_stories as story, ".$tableprefix."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid AND chapter.uid = author.uid");
118
-			$story = mysql_fetch_array($result);
119
-			$output .= "<b>"._AUTHOR.":</b> ".$story['penname']."<br />";
120
-			$output .= "<b>"._TITLE.":</b> ".$story['storytitle'].": ".$story['title'];
121
-			$output .= "<br />";
122
-			$result3 = mysql_query("SELECT catid, category FROM ".$tableprefix."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
123
-			$catstring = "";
124
-			$count = 0;
125
-			while($cats = mysql_fetch_array($result3)) {
126
-				if($count > 0) $catstring .= ", ";
127
-				$catstring .= "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>";
128
-				$categories[] = $cats['catid'];
129
-				$count++;
130
-			}
131
-			$output .= "<b>"._CATEGORY.":</b> $catstring<br />";
132
-
133
-			$output .= "<b>"._GENRES.":</b> ".(isset($story['gid']) ? preg_replace("/,/", ", ", $story['gid']) : _NONE);
134
-			$output .= "<br />";
135
-			$output .= "<b>"._RATING.":</b> ".$story['rid']."<br />";
136
-			if($story['wid'] != "")
137
-			{
138
-				$output .= "<b>"._WARNINGS.":</b> ".(isset($story['wid']) ? preg_replace("/,/", ", ", $story['wid']) : _NONE);
139
-				$output .= "<br />";
140
-			}
141
-			$output .= "<b>"._CHARACTERS.":</b> ".$story['charid'];
142
-			$output .= "<br />";
143
-			$output .= "<b>"._SUMMARY.":</b> ".$story['storysummary']."<br />";
144
-			$output .= "<a href=\"admin.php?action=validate&amp;sid=".$story['sid']."&amp;chapid=".$story['chapid']."&amp;validate=yes\">"._VALIDATE."</a> | <a href=\"stories.php?action=editstory&amp;sid=$story[sid]&amp;admin=1\">"._EDIT." - "._STORY."</a> | <a href=\"stories.php?action=delete&amp;sid=$story[sid]\">"._DELETE." - "._STORY."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&amp;uid=$story[uid]&amp;chapid=$story[chapid]', 400, 300, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&amp;uid=$story[uid]&amp;chapid=$story[chapid]',400, 300, 'yes')\">"._NOLETTER."</a><br />";
145
-			if($store == "files")
146
-			{
147
-				$file = "$storiespath/".$story['uid']."/".$story['chapid'].".txt";
148
-				$log_file = fopen($file, "r");
149
-				$file_contents = fread($log_file, filesize($file));
150
-				$storytext .= $file_contents;
151
-				fclose($log_file);
152
-			}
153
-			else if($store == "mysql")
154
-			{
155
-				$storytext .= $story['storytext'];
156
-			}
157
-			if(strpos($story, "<br>") === false && strpos($story, "<p>") === false && strpos($story, "<br />") === false) $storytext = nl2br($storytext);
158
-			$storytext = format_story($storytext, $allowed_tags);
159
-			$output .= $storytext;
160
-			$output .= "<br /><br />";
161
-			$output .= "<a href=\"admin.php?action=validate&amp;sid=".$story['sid']."&amp;chapid=".$story['chapid']."&amp;validate=yes\">"._VALIDATE."</a> | <a href=\"stories.php?action=editchapter&amp;chapid=".$story['chapid']."&amp;admin=1\">"._EDIT." - "._CHAPTER."</a> | <a href=\"stories.php?action=delete&amp;chapid=".$story['chapid']."&amp;sid=".$story['sid']."&amp;admin=1&amp;uid=".$story['uid']."\">"._DELETE." - "._CHAPTER."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&amp;uid=".$story['uid']."&amp;chapid=".$story['chapid']."', 400, 300, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&amp;uid=".$story['uid']."&amp;chapid=".$story['chapid']."',400, 300, 'yes')\">"._NOLETTER."</a><br />";
162
-		}
163
-	return $output;
164
-}
165
-// end validate
166
-
167
-function yesletter( ) {
168
-	global $tableprefix, $level, $adminemail, $sitename, $siteemail, $allowed_tags;
169
-	
170
-	if($_POST['submit']) {
171
-
172
-		if($adminemail)
173
-			$ademail = $adminemail;
174
-		else 
175
-			$ademail = $siteemail;
176
-		$subject = stripinput($_POST['subject']);
177
-		$letter = nl2br(stripinput($_POST['letter']));
178
-			
179
-		include("includes/emailer.php");
180
-		$result = sendemail($_POST['email'], $_POST['email'], $adminname, $ademail, $subject, $letter, "html");
181
-
182
-		if($result) echo "<div style='text-align: center;'>"._EMAILSENT."</div>";
183
-		else echo "<div style='text-align: center;'>"._ERROR."</div>";
184
-	}
185
-	else {
186
-			$authorquery = mysql_query("SELECT email,penname FROM ".$tableprefix."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
187
-			$author = mysql_fetch_array($authorquery);
188
-			$storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".$tableprefix."fanfiction_stories as story, ".$tableprefix."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1");
189
-			$story = mysql_fetch_array($storyquery);
190
-			$letter = file_get_contents("messages/thankyou.txt");
191
-			echo "<body>";
192
-			echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>";
193
-			echo "<tr><td>"._BY.":</td><td>".$author['penname']."</td></tr>";
194
-			echo "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=yesletter\">
195
-				<tr><td>To:</td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"".$author['email']."\"></td></tr>
196
-				<tr><td>From:</td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"ademail\" value=\"$adminemail\"></td></tr>
197
-				<tr><td>Subject:</td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"subject\" value=\"Your Submission to $sitename\"></td></tr>
198
-				<tr><td colspan=\"2\"><textarea class=\"textbox\" name=\"letter\" cols=\"50\" rows=\"8\">$letter</TEXTAREA></td></tr><tr><td colspan=\"2\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></td></tr></table></body></html>";
199
-	}
200
-	exit( );
201
-}
202
-// end yesletter
203
-
204
-function noletter( ) {
205
-	global $tableprefix, $level, $adminemail, $sitename, $siteemail, $allowed_tags, $adminloggedin;
206
-	if($_POST['submit'])
207
-		{
208
-		if($adminemail)
209
-			$ademail = $adminemail;
210
-		else 
211
-			$ademail = $siteemail;
212
-		$subject = stripinput($_POST['subject']);
213
-		$letter = nl2br(stripinput($_POST['letter']));
214
-			
215
-		include("includes/emailer.php");
216
-		$result = sendemail($_POST['email'], $_POST['email'], $adminname, $ademail, $subject, $letter, "html");
217
-
218
-		if($result) echo "<div style='text-align: center;'>"._EMAILSENT."</div>";
219
-		else echo "<div style='text-align: center;'>"._ERROR."</div>";
220
-	}
221
-	else
222
-	{
223
-		$authorquery = mysql_query("SELECT email,penname FROM ".$tableprefix."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
224
-		$author = mysql_fetch_array($authorquery);
225
-		$storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".$tableprefix."fanfiction_stories as story, ".$tableprefix."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1");
226
-		$story = mysql_fetch_array($storyquery);
227
-		$letter = file_get_contents("messages/nothankyou.txt");
228
-		echo "<body>";
229
-		echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>";
230
-		echo "<tr><td>"._BY.":</td><td>".$author['penname']."</td></tr>";
231
-		echo "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=noletter\">
232
-			<tr><td>To:</td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"".$author[email]."\"></td></tr>
233
-			<tr><td>From:</td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"ademail\" value=\"$adminemail\"></td></tr>
234
-			<tr><td>Subject:</td><td><INPUT type=\"text\" class=\"textbox=\"  name=\"subject\" value=\"Your Submission to $sitename\"></td></tr>
235
-			<tr><td colspan=\"2\"><textarea class=\"textbox\" name=\"letter\" cols=\"50\" rows=\"8\">$letter</TEXTAREA></td></tr><tr><td colspan=\"2\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></td></tr></table></body></html>";
236
-	}
237
-	exit( );
238
-}
239
-// end noletter
240
-
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
+function featured( ) {
28
+	global $tableprefix;
29
+
30
+	if($_GET['retire'])
31
+		mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 2 WHERE sid = ".$_GET['retire']);
32
+	if($_GET['feature'])
33
+		mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']);
34
+	$fquery = "SELECT stories.*, stories.title as title, author.penname, DATE_FORMAT(stories.updated, '%Y.%m.%d') as updatesort, DATE_FORMAT(stories.date, '$datim') as date, DATE_FORMAT(stories.updated, '$datim') as updated FROM ".TABLEPREFIX."fanfiction_authors as author, ".TABLEPREFIX."fanfiction_stories as stories WHERE stories.featured > 0 AND stories.uid = author.uid ORDER BY stories.featured";
35
+	$fresult = mysql_query($fquery) or die(_FATALERROR."Query: ".$fquery."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
36
+	$output .= "<center><table class=\"tblborder\" cellpadding=\"5\"><tr><th colspan=\"2\" align=\"center\">"._FEATUREDSTORIES."</th></tr>";
37
+	if(!mysql_num_rows($fresult)) $output .= "<tr><td colspan=\"2\" align=\"center\">"._NOSTORIES."</td><tr>";
38
+	while($story = mysql_fetch_array($fresult)) {
39
+		$output .= "<tr><td class=\"tblborder\"><a href=\"viewstory.php?sid=".$story['sid']."\">$story[title]</a> "._BY." <a href=\"viewuser.php?uid=".$story['uid']."\">".$story['penname']."</a></td><td class=\"tblborder\" align=\"center\">".($story['featured'] == 1 ? "<a href=\"admin.php?action=featured&retire=".$story['sid']."\">"._CURRENT."</a>" : "<b>"._RETIRED."</b>")."</td></tr>";
40
+	}
41
+	$output .= "</table>"._FEATUREDNOTE;
42
+	return $output;
43
+}
44
+// end featured
45
+
46
+function submitted()
47
+{
48
+	global $tableprefix, $admincats, $allowed_tags;
49
+		$output .= "<center><h4>"._SUBMITTED."</h4></center>";
50
+		$query = "SELECT story.title as storytitle, chapter.uid, chapter.sid, story.catid, chapter.chapid, chapter.inorder, chapter.title, author.penname FROM (".TABLEPREFIX."fanfiction_chapters as chapter, ".TABLEPREFIX."fanfiction_authors as author) LEFT JOIN ".TABLEPREFIX."fanfiction_stories as story ON story.sid = chapter.sid WHERE chapter.validated = '0' AND chapter.uid = author.uid ORDER BY story.title ASC, chapter.inorder ASC";
51
+		$result = mysql_query($query) or die(_FATALERROR."Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
52
+		$output .= "<table class=\"tblborder\" cellspacing=\"0\" cellpadding=\"3\" align=\"center\"><tr class=\"tblborder\"><th>"._TITLE."</th><th>"._AUTHOR."</th><th>"._CATEGORY."</th><th>"._OPTIONS."</th></tr>";
53
+		$array = explode(",", $admincats);
54
+		while ($story = mysql_fetch_assoc($result))
55
+		{
56
+			unset($catstring);
57
+			$result3 = mysql_query("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
58
+			while($cats = mysql_fetch_array($result3)) {
59
+				$catstring[] = "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>";
60
+			}
61
+			if(!$admincats || sizeof(array_intersect(explode(",", $story['catid']), explode(",", $admincats)))) {
62
+				$output .= "<tr class=\"tblborder\">";
63
+				$output .= "<td class=\"tblborder\"><a href=\"viewstory.php?sid=".$story['sid']."\">".$story['storytitle']."</a>";
64
+				if($story['title']) $output .= " <b>:</b> <a href=\"viewstory.php?sid=".$story['sid']."&amp;chapter=".$story['inorder']."\">".$story['title']."</a>";
65
+				$output .= "<td class=\"tblborder\"><a href=\"viewuser.php?uid=".$story['uid']."\">".$story['penname']."</a></td>";
66
+				$output .= "<td class=\"tblborder\">".(is_array($catstring) ? implode(", ", $catstring) : "")."</td>";
67
+			$output .= "<td class=\"tblborder\"><a href=\"admin.php?action=validate&amp;chapid=".$story['chapid']."\">"._VALIDATE."</a> | "._DELETE.": <a href=\"stories.php?action=delete&amp;chapid=".$story['chapid']."&amp;sid=".$story['sid']."&amp;admin=1&amp;uid=".$story['uid']."\">"._CHAPTER."</a> "._OR." <a href=\"stories.php?action=delete&amp;sid=".$story['sid']."&amp;admin=1\">"._STORY."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&uid=".$story['uid']."&chapid=".$story['chapid']."', 500, 400, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&uid=".$story['uid']."&chapid=".$story['chapid']."', 500, 400, 'yes')\">"._NOLETTER."</a></td></tr>";
68
+			}
69
+		}
70
+		$output .= "</table>";
71
+
72
+	return $output;
73
+}
74
+// end submitted function
75
+
76
+function validate( ) {
77
+	global $tableprefix, $level, $store, $storiespath, $allowed_tags, $admincats, $sitename, $siteemail, $url, $alertson;
78
+
79
+	$output .= "<center><h4>"._VIEWSUBMITTED."</h4></center>";
80
+	if($_GET['validate'] == "yes") {
81
+		$storyquery = mysql_query("SELECT story.validated, story.catid, story.sid, story.title, story.summary, story.uid, author.penname, chapter.inorder FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters  as chapter, ".TABLEPREFIX."fanfiction_authors as author WHERE author.uid = story.uid AND chapter.sid = story.sid AND chapter.chapid ='".$_GET['chapid']."' LIMIT 1");
82
+		list($validated, $catid, $sid, $title, $summary, $authoruid, $author, $inorder) = mysql_fetch_array($storyquery);
83
+		if($admincats == "0" || sizeof(array_intersect(explode(",", $catid), explode(",", $admincats)))) {
84
+			include("includes/emailer.php");
85
+			if($validated != "1") {
86
+				mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET validated = '1', updated = NOW() WHERE sid = '".$_GET['sid']."'");
87
+				$categories = explode(",", $catid);
88
+				include("functions.php");
89
+				foreach($categories as $cat) {
90
+					categoryitems($cat, 1);
91
+				}
92
+				if($alertson) {
93
+					$subject = _NEWSTORYAT;
94
+					$mailtext = sprintf(_AUTHORALERTNOTE, $title, $author, $summary, $sid);
95
+					$favorites = mysql_query("SELECT author.uid, email, penname FROM ".TABLEPREFIX."fanfiction_favauth as fav, ".TABLEPREFIX."fanfiction_authors as author WHERE fav.favuid = $authoruid AND fav.uid = author.uid");
96
+					while($favuser = mysql_fetch_array($favorites)) { 
97
+						sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
98
+					}				
99
+				}
100
+			}
101
+			else if($alertson) {
102
+				$subject = _STORYALERT;
103
+				$mailtext = sprintf(_STORYALERTNOTE, $title, $author, $sid, $inorder);
104
+				$favorites = mysql_query("SELECT author.uid, penname, email FROM ".TABLEPREFIX."fanfiction_favstor as fav, ".TABLEPREFIX."fanfiction_authors as author WHERE sid = '$sid' AND fav.uid = author.uid");
105
+				while($favuser = mysql_fetch_array($favorites)) { 
106
+					sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
107
+				}
108
+			}
109
+			mysql_query("UPDATE ".TABLEPREFIX."fanfiction_chapters SET validated = '1' WHERE chapid = '".$_GET['chapid']."'");
110
+			mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET updated = NOW( ) WHERE sid = '$sid'");
111
+			$output .= "<center><b>"._STORYVALIDATED."</b></center>";
112
+		}
113
+		else
114
+			$output .= "<br /><br /><center>"._NOTAUTHORIZEDADMIN."  "._TRYAGAIN."</center><br /><br />";
115
+	}
116
+	else {
117
+			$result = mysql_query("SELECT story.title as storytitle, story.sid, story.catid, story.rid, story.gid, story.charid, story.wid, story.summary as storysummary, chapter.chapid, chapter.title, chapter.storytext, author.penname, chapter.uid as uid FROM ".TABLEPREFIX."fanfiction_authors as author, ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid AND chapter.uid = author.uid");
118
+			$story = mysql_fetch_array($result);
119
+			$output .= "<b>"._AUTHOR.":</b> ".$story['penname']."<br />";
120
+			$output .= "<b>"._TITLE.":</b> ".$story['storytitle'].": ".$story['title'];
121
+			$output .= "<br />";
122
+			$result3 = mysql_query("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
123
+			$catstring = "";
124
+			$count = 0;
125
+			while($cats = mysql_fetch_array($result3)) {
126
+				if($count > 0) $catstring .= ", ";
127
+				$catstring .= "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>";
128
+				$categories[] = $cats['catid'];
129
+				$count++;
130
+			}
131
+			$output .= "<b>"._CATEGORY.":</b> $catstring<br />";
132
+
133
+			$output .= "<b>"._GENRES.":</b> ".(isset($story['gid']) ? preg_replace("/,/", ", ", $story['gid']) : _NONE);
134
+			$output .= "<br />";
135
+			$output .= "<b>"._RATING.":</b> ".$story['rid']."<br />";
136
+			if($story['wid'] != "")
137
+			{
138
+				$output .= "<b>"._WARNINGS.":</b> ".(isset($story['wid']) ? preg_replace("/,/", ", ", $story['wid']) : _NONE);
139
+				$output .= "<br />";
140
+			}
141
+			$output .= "<b>"._CHARACTERS.":</b> ".$story['charid'];
142
+			$output .= "<br />";
143
+			$output .= "<b>"._SUMMARY.":</b> ".$story['storysummary']."<br />";
144
+			$output .= "<a href=\"admin.php?action=validate&amp;sid=".$story['sid']."&amp;chapid=".$story['chapid']."&amp;validate=yes\">"._VALIDATE."</a> | <a href=\"stories.php?action=editstory&amp;sid=$story[sid]&amp;admin=1\">"._EDIT." - "._STORY."</a> | <a href=\"stories.php?action=delete&amp;sid=$story[sid]\">"._DELETE." - "._STORY."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&amp;uid=$story[uid]&amp;chapid=$story[chapid]', 400, 300, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&amp;uid=$story[uid]&amp;chapid=$story[chapid]',400, 300, 'yes')\">"._NOLETTER."</a><br />";
145
+			if($store == "files")
146
+			{
147
+				$file = "$storiespath/".$story['uid']."/".$story['chapid'].".txt";
148
+				$log_file = fopen($file, "r");
149
+				$file_contents = fread($log_file, filesize($file));
150
+				$storytext .= $file_contents;
151
+				fclose($log_file);
152
+			}
153
+			else if($store == "mysql")
154
+			{
155
+				$storytext .= $story['storytext'];
156
+			}
157
+			if(strpos($story, "<br>") === false && strpos($story, "<p>") === false && strpos($story, "<br />") === false) $storytext = nl2br($storytext);
158
+			$storytext = format_story($storytext, $allowed_tags);
159
+			$output .= $storytext;
160
+			$output .= "<br /><br />";
161
+			$output .= "<a href=\"admin.php?action=validate&amp;sid=".$story['sid']."&amp;chapid=".$story['chapid']."&amp;validate=yes\">"._VALIDATE."</a> | <a href=\"stories.php?action=editchapter&amp;chapid=".$story['chapid']."&amp;admin=1\">"._EDIT." - "._CHAPTER."</a> | <a href=\"stories.php?action=delete&amp;chapid=".$story['chapid']."&amp;sid=".$story['sid']."&amp;admin=1&amp;uid=".$story['uid']."\">"._DELETE." - "._CHAPTER."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&amp;uid=".$story['uid']."&amp;chapid=".$story['chapid']."', 400, 300, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&amp;uid=".$story['uid']."&amp;chapid=".$story['chapid']."',400, 300, 'yes')\">"._NOLETTER."</a><br />";
162
+		}
163
+	return $output;
164
+}
165
+// end validate
166
+
167
+function yesletter( ) {
168
+	global $tableprefix, $level, $adminemail, $sitename, $siteemail, $allowed_tags;
169
+	
170
+	if($_POST['submit']) {
171
+
172
+		if($adminemail)
173
+			$ademail = $adminemail;
174
+		else 
175
+			$ademail = $siteemail;
176
+		$subject = stripinput($_POST['subject']);
177
+		$letter = nl2br(stripinput($_POST['letter']));
178
+			
179
+		include("includes/emailer.php");
180
+		$result = sendemail($_POST['email'], $_POST['email'], $adminname, $ademail, $subject, $letter, "html");
181
+
182
+		if($result) echo "<div style='text-align: center;'>"._EMAILSENT."</div>";
183
+		else echo "<div style='text-align: center;'>"._ERROR."</div>";
184
+	}
185
+	else {
186
+			$authorquery = mysql_query("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
187
+			$author = mysql_fetch_array($authorquery);
188
+			$storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1");
189
+			$story = mysql_fetch_array($storyquery);
190
+			$letter = file_get_contents("messages/thankyou.txt");
191
+			echo "<body>";
192
+			echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>";
193
+			echo "<tr><td>"._BY.":</td><td>".$author['penname']."</td></tr>";
194
+			echo "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=yesletter\">
195
+				<tr><td>To:</td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"".$author['email']."\"></td></tr>
196
+				<tr><td>From:</td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"ademail\" value=\"$adminemail\"></td></tr>
197
+				<tr><td>Subject:</td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"subject\" value=\"Your Submission to $sitename\"></td></tr>
198
+				<tr><td colspan=\"2\"><textarea class=\"textbox\" name=\"letter\" cols=\"50\" rows=\"8\">$letter</TEXTAREA></td></tr><tr><td colspan=\"2\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></td></tr></table></body></html>";
199
+	}
200
+	exit( );
201
+}
202
+// end yesletter
203
+
204
+function noletter( ) {
205
+	global $tableprefix, $level, $adminemail, $sitename, $siteemail, $allowed_tags, $adminloggedin;
206
+	if($_POST['submit'])
207
+		{
208
+		if($adminemail)
209
+			$ademail = $adminemail;
210
+		else 
211
+			$ademail = $siteemail;
212
+		$subject = stripinput($_POST['subject']);
213
+		$letter = nl2br(stripinput($_POST['letter']));
214
+			
215
+		include("includes/emailer.php");
216
+		$result = sendemail($_POST['email'], $_POST['email'], $adminname, $ademail, $subject, $letter, "html");
217
+
218
+		if($result) echo "<div style='text-align: center;'>"._EMAILSENT."</div>";
219
+		else echo "<div style='text-align: center;'>"._ERROR."</div>";
220
+	}
221
+	else
222
+	{
223
+		$authorquery = mysql_query("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
224
+		$author = mysql_fetch_array($authorquery);
225
+		$storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1");
226
+		$story = mysql_fetch_array($storyquery);
227
+		$letter = file_get_contents("messages/nothankyou.txt");
228
+		echo "<body>";
229
+		echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>";
230
+		echo "<tr><td>"._BY.":</td><td>".$author['penname']."</td></tr>";
231
+		echo "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=noletter\">
232
+			<tr><td>To:</td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"".$author[email]."\"></td></tr>
233
+			<tr><td>From:</td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"ademail\" value=\"$adminemail\"></td></tr>
234
+			<tr><td>Subject:</td><td><INPUT type=\"text\" class=\"textbox=\"  name=\"subject\" value=\"Your Submission to $sitename\"></td></tr>
235
+			<tr><td colspan=\"2\"><textarea class=\"textbox\" name=\"letter\" cols=\"50\" rows=\"8\">$letter</TEXTAREA></td></tr><tr><td colspan=\"2\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></td></tr></table></body></html>";
236
+	}
237
+	exit( );
238
+}
239
+// end noletter
240
+
241 241
 ?>
242 242
\ No newline at end of file
... ...
@@ -1,64 +1,67 @@
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
-global $language;
31
-$content = "";
32
-$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'categories'");
33
-while($block = dbassoc($blockquery)) {
34
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
35
-	$blocks[$block['block_name']]['title'] = $block['block_title'];
36
-	 $blocks[$block['block_name']]['file'] = $block['block_file'];
37
-	$blocks[$block['block_name']]['status'] = $block['block_status'];
38
-}
39
-if(empty($blocks['categories']['tpl'])) {
40
-	include("blocks/".$blocks['categories']['file']);
41
-	$tpl->gotoBlock("_ROOT");
42
-}
43
-if(file_exists("blocks/categories/{$language}.php")) include("blocks/categories/{$language}.php");
44
-else include("blocks/categories/en.php");
45
-	if(isset($_POST['submit'])) {
46
-		$blocks['categories']['columns'] = $_POST['columns'];
47
-		$blocks['categories']['template'] = $_POST['template'];
48
-		$output .= "<center>"._ACTIONSUCCESSFUL."</center>";
49
-		save_blocks( $blocks );
50
-	}
51
-	else  {
52
-		$template = (!empty($blocks['categories']['template']) ? $blocks['categories']['template'] : "{image} {link} [{count}] {description}"); 
53
-		if(empty($blocks['categories']['tpl'])) $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">$content</div><br /></div>";
54
-		$output .= "<div><form method=\"POST\" id=\"settingsform\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=categories\">
55
-			<textarea name=\"template\" id=\"template\" rows=\"5\" cols=\"40\">$template</textarea><br />";
56
-		if($tinyMCE) 
57
-			$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('template');\"><label for='toggle'>"._TINYMCETOGGLE."</label></div>";	
58
-		$output .= "<select name=\"columns\" class=\"textbox\" style='margin: 3px;'><option value=\"0\"".(empty($blocks['categories']['columns']) ? " selected" : "").">"._ONECOLUMN."</option>
59
-					<option value=\"1\"".(!empty($blocks['categories']['columns']) ? " selected" : "").">"._MULTICOLUMN."</option></select> 
60
-			<select name=\"tpl\" class=\"textbox\" style='margin: 3px;'><option value=\"0\"".(empty($blocks['categories']['tpl']) ? " selected" : "").">"._DEFAULT."</option>
61
-					<option value=\"1\"".(!empty($blocks['categories']['tpl']) ? " selected" : "").">"._USETPL."</option></select><br />
62
-			<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form><div style='clear: both;'>&nbsp;</div>".write_message(_CATBLOCKNOTE)."</div>";
63
-	}
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
+global $language;
31
+$content = "";
32
+$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'categories'");
33
+while($block = dbassoc($blockquery)) {
34
+	if ($block['block_variables'])
35
+	{
36
+		$blocks[$block['block_name']] = unserialize($block['block_variables']);
37
+	}
38
+	$blocks[$block['block_name']]['title'] = $block['block_title'];
39
+	 $blocks[$block['block_name']]['file'] = $block['block_file'];
40
+	$blocks[$block['block_name']]['status'] = $block['block_status'];
41
+}
42
+if(empty($blocks['categories']['tpl'])) {
43
+	include("blocks/".$blocks['categories']['file']);
44
+	$tpl->gotoBlock("_ROOT");
45
+}
46
+if(file_exists("blocks/categories/{$language}.php")) include("blocks/categories/{$language}.php");
47
+else include("blocks/categories/en.php");
48
+	if(isset($_POST['submit'])) {
49
+		$blocks['categories']['columns'] = $_POST['columns'];
50
+		$blocks['categories']['template'] = $_POST['template'];
51
+		$output .= "<center>"._ACTIONSUCCESSFUL."</center>";
52
+		save_blocks( $blocks );
53
+	}
54
+	else  {
55
+		$template = (!empty($blocks['categories']['template']) ? $blocks['categories']['template'] : "{image} {link} [{count}] {description}"); 
56
+		if(empty($blocks['categories']['tpl'])) $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">$content</div><br /></div>";
57
+		$output .= "<div><form method=\"POST\" id=\"settingsform\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=categories\">
58
+			<textarea name=\"template\" id=\"template\" rows=\"5\" cols=\"40\">$template</textarea><br />";
59
+		if($tinyMCE) 
60
+			$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('template');\"><label for='toggle'>"._TINYMCETOGGLE."</label></div>";	
61
+		$output .= "<select name=\"columns\" class=\"textbox\" style='margin: 3px;'><option value=\"0\"".(empty($blocks['categories']['columns']) ? " selected" : "").">"._ONECOLUMN."</option>
62
+					<option value=\"1\"".(!empty($blocks['categories']['columns']) ? " selected" : "").">"._MULTICOLUMN."</option></select> 
63
+			<select name=\"tpl\" class=\"textbox\" style='margin: 3px;'><option value=\"0\"".(empty($blocks['categories']['tpl']) ? " selected" : "").">"._DEFAULT."</option>
64
+					<option value=\"1\"".(!empty($blocks['categories']['tpl']) ? " selected" : "").">"._USETPL."</option></select><br />
65
+			<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form><div style='clear: both;'>&nbsp;</div>".write_message(_CATBLOCKNOTE)."</div>";
66
+	}
64 67
 ?>
65 68
\ No newline at end of file
... ...
@@ -1,31 +1,34 @@
1
-<?php
2
-if(!defined("_CHARSET")) exit( );
3
-
4
-global $language, $numupdated;
5
-$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'countdown'");
6
-while($block = dbassoc($blockquery)) {
7
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
8
-	$blocks[$block['block_name']]['title'] = $block['block_title'];
9
-	 $blocks[$block['block_name']]['file'] = $block['block_file'];
10
-	$blocks[$block['block_name']]['status'] = $block['block_status'];
11
-}
12
-include("blocks/countdown/block.php");
13
-	if(isset($_POST['submit'])) {
14
-		if(!empty($_POST['target'])) $blocks['countdown']['target'] = escapestring($_POST['target']);
15
-		else unset($blocks['countdown']['target']);
16
-		if(!empty($_POST['CDformat'])) $blocks['countdown']['CDformat'] = escapestring($_POST['CDformat']);
17
-		else unset($blocks['countdown']['CDformat']);
18
-		if(!empty($_POST['finish'])) $blocks['countdown']['CDfinal'] = escapestring($_POST['finish']);
19
-		else unset($blocks['countdown']['CDfinal']);
20
-		$output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>";
21
-		save_blocks( $blocks );
22
-	}
23
-	else  {
24
-		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">".$content."</div><br /></div>";
25
-		$output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&amp;admin=countdown\">
26
-			<div><label for=\"target\">"._TARGETDATE.":</label><input type=\"text\" class=\"textbox\" name=\"target\" id=\"target\" value=\"".(!empty($blocks['countdown']['target']) ? $blocks['countdown']['target'] : date("m/d/Y G:H"))."\"></div>
27
-			<div><label for=\"CDformat\">"._FORMATCOUNT.":</label><input type=\"text\" class=\"textbox\" name=\"CDformat\" id=\"CDformat\" size=\"40\" value=\"".(empty($blocks['countdown']['CDformat']) ? _COUNTDOWNFORMAT : $blocks['countdown']['CDformat'])."\"></div>
28
-			<div><label for=\"finish\">"._FINISHMESSAGE.":</label><input type=\"text\" class=\"textbox\" name=\"finish\" id=\"finish\" size=\"40\" value=\"".(empty($blocks['countdown']['finish']) ? _COUNTDOWNOVER : $blocks['countdown']['finish'])."\"></div>
29
-			<INPUT type=\"submit\" name=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._DATENOTE."</div>";
30
-	}
1
+<?php
2
+if(!defined("_CHARSET")) exit( );
3
+
4
+global $language, $numupdated;
5
+$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'countdown'");
6
+while($block = dbassoc($blockquery)) {
7
+	if ($block['block_variables'])
8
+	{
9
+		$blocks[$block['block_name']] = unserialize($block['block_variables']);
10
+	}
11
+	$blocks[$block['block_name']]['title'] = $block['block_title'];
12
+	 $blocks[$block['block_name']]['file'] = $block['block_file'];
13
+	$blocks[$block['block_name']]['status'] = $block['block_status'];
14
+}
15
+include("blocks/countdown/block.php");
16
+	if(isset($_POST['submit'])) {
17
+		if(!empty($_POST['target'])) $blocks['countdown']['target'] = escapestring($_POST['target']);
18
+		else unset($blocks['countdown']['target']);
19
+		if(!empty($_POST['CDformat'])) $blocks['countdown']['CDformat'] = escapestring($_POST['CDformat']);
20
+		else unset($blocks['countdown']['CDformat']);
21
+		if(!empty($_POST['finish'])) $blocks['countdown']['CDfinal'] = escapestring($_POST['finish']);
22
+		else unset($blocks['countdown']['CDfinal']);
23
+		$output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>";
24
+		save_blocks( $blocks );
25
+	}
26
+	else  {
27
+		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">".$content."</div><br /></div>";
28
+		$output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&amp;admin=countdown\">
29
+			<div><label for=\"target\">"._TARGETDATE.":</label><input type=\"text\" class=\"textbox\" name=\"target\" id=\"target\" value=\"".(!empty($blocks['countdown']['target']) ? $blocks['countdown']['target'] : date("m/d/Y G:H"))."\"></div>
30
+			<div><label for=\"CDformat\">"._FORMATCOUNT.":</label><input type=\"text\" class=\"textbox\" name=\"CDformat\" id=\"CDformat\" size=\"40\" value=\"".(empty($blocks['countdown']['CDformat']) ? _COUNTDOWNFORMAT : $blocks['countdown']['CDformat'])."\"></div>
31
+			<div><label for=\"finish\">"._FINISHMESSAGE.":</label><input type=\"text\" class=\"textbox\" name=\"finish\" id=\"finish\" size=\"40\" value=\"".(empty($blocks['countdown']['finish']) ? _COUNTDOWNOVER : $blocks['countdown']['finish'])."\"></div>
32
+			<INPUT type=\"submit\" name=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._DATENOTE."</div>";
33
+	}
31 34
 ?>
32 35
\ No newline at end of file
... ...
@@ -1,33 +1,36 @@
1
-<?php
2
-if(!defined("_CHARSET")) exit( );
3
-$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'featured'");
4
-while($block = dbassoc($blockquery)) {
5
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
6
-	$blocks[$block['block_name']]['title'] = $block['block_title'];
7
-	 $blocks[$block['block_name']]['file'] = $block['block_file'];
8
-	$blocks[$block['block_name']]['status'] = $block['block_status'];
9
-}
10
-include("blocks/".$blocks['featured']['file']);
11
-if($use_tpl) $tpl->gotoBlock("_ROOT");
12
-	if(isset($_POST['submit'])) {
13
-		if($_POST['tpl']) $blocks['featured']['tpl'] = 1;
14
-		else unset($blocks['featured']['tpl']);
15
-		if($_POST['allowtags']) $blocks['featured']['allowtags'] = 1;
16
-		else unset($blocks['featured']['allowtags']);
17
-		if($_POST['sumlength'] && isNumber($_POST['sumlength'])) $blocks['featured']['sumlength'] = $_POST['sumlength'];
18
-		else unset($blocks['featured']['sumlength']);
19
-		$output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>";
20
-		save_blocks( $blocks );
21
-		unset($admin);
22
-	}
23
-	else  {
24
-		$output .= "<div style='text-align: center;'><span class='label'>"._CURRENT.":</span><br /><div class=\"tblborder\" style=\"width: 80%; text-align: left; margin: 1ex auto;\">".($use_tpl ? _NATPL : $content)."</div><br /></div>";
25
-		$output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=featured\">
26
-			<label for=\"tpl\">"._FORMAT.":</label><select name=\"tpl\" class=\"textbox\" id=\"tpl\"><option value=\"0\"".(!isset($blocks['featured']['tpl']) || !$blocks['featured']['tpl'] ? " selected" : "").">"._DEFAULT."</option>
27
-					<option value=\"1\"".(isset($blocks['featured']['tpl']) && $blocks['featured']['tpl'] ? " selected" : "").">"._USETPL."</option></select><br />
28
-			<label for=\"allowtags\">"._TAGS.":</label><select class=\"textbox\" name=\"allowtags\" id=\"allowtags\"><option value=\"0\"".(!isset($blocks['featured']['allowtags']) || !$blocks['featured']['allowtags'] ? " selected" : "").">"._STRIPTAGS."</option>
29
-					<option value=\"1\"".(isset($blocks['featured']['allowtags']) && $blocks['featured']['allowtags'] ? " selected" : "").">"._ALLOWTAGS."</option></select><br />
30
-			<label for=\"sumlength\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"4\" value=\"".(isset($blocks['featured']['sumlength']) ? $blocks['featured']['sumlength'] : "")."\"><br />
31
-			<INPUT type=\"submit\" class=\"button\" name=\"submit\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._SUMNOTE."</div>";
32
-	}
1
+<?php
2
+if(!defined("_CHARSET")) exit( );
3
+$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'featured'");
4
+while($block = dbassoc($blockquery)) {
5
+	if ($block['block_variables'])
6
+	{
7
+		$blocks[$block['block_name']] = unserialize($block['block_variables']);
8
+	}
9
+	$blocks[$block['block_name']]['title'] = $block['block_title'];
10
+	 $blocks[$block['block_name']]['file'] = $block['block_file'];
11
+	$blocks[$block['block_name']]['status'] = $block['block_status'];
12
+}
13
+include("blocks/".$blocks['featured']['file']);
14
+if($use_tpl) $tpl->gotoBlock("_ROOT");
15
+	if(isset($_POST['submit'])) {
16
+		if($_POST['tpl']) $blocks['featured']['tpl'] = 1;
17
+		else unset($blocks['featured']['tpl']);
18
+		if($_POST['allowtags']) $blocks['featured']['allowtags'] = 1;
19
+		else unset($blocks['featured']['allowtags']);
20
+		if($_POST['sumlength'] && isNumber($_POST['sumlength'])) $blocks['featured']['sumlength'] = $_POST['sumlength'];
21
+		else unset($blocks['featured']['sumlength']);
22
+		$output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>";
23
+		save_blocks( $blocks );
24
+		unset($admin);
25
+	}
26
+	else  {
27
+		$output .= "<div style='text-align: center;'><span class='label'>"._CURRENT.":</span><br /><div class=\"tblborder\" style=\"width: 80%; text-align: left; margin: 1ex auto;\">".($use_tpl ? _NATPL : $content)."</div><br /></div>";
28
+		$output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=featured\">
29
+			<label for=\"tpl\">"._FORMAT.":</label><select name=\"tpl\" class=\"textbox\" id=\"tpl\"><option value=\"0\"".(!isset($blocks['featured']['tpl']) || !$blocks['featured']['tpl'] ? " selected" : "").">"._DEFAULT."</option>
30
+					<option value=\"1\"".(isset($blocks['featured']['tpl']) && $blocks['featured']['tpl'] ? " selected" : "").">"._USETPL."</option></select><br />
31
+			<label for=\"allowtags\">"._TAGS.":</label><select class=\"textbox\" name=\"allowtags\" id=\"allowtags\"><option value=\"0\"".(!isset($blocks['featured']['allowtags']) || !$blocks['featured']['allowtags'] ? " selected" : "").">"._STRIPTAGS."</option>
32
+					<option value=\"1\"".(isset($blocks['featured']['allowtags']) && $blocks['featured']['allowtags'] ? " selected" : "").">"._ALLOWTAGS."</option></select><br />
33
+			<label for=\"sumlength\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"4\" value=\"".(isset($blocks['featured']['sumlength']) ? $blocks['featured']['sumlength'] : "")."\"><br />
34
+			<INPUT type=\"submit\" class=\"button\" name=\"submit\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._SUMNOTE."</div>";
35
+	}
33 36
 ?>
34 37
\ No newline at end of file
... ...
@@ -1,35 +1,38 @@
1
-<?php
2
-if(!defined("_CHARSET")) exit( );
3
-
4
-global $language;
5
-$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'info'");
6
-while($block = dbassoc($blockquery)) {
7
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
8
-	$blocks[$block['block_name']]['title'] = $block['block_title'];
9
-	 $blocks[$block['block_name']]['file'] = $block['block_file'];
10
-	$blocks[$block['block_name']]['status'] = $block['block_status'];
11
-}
12
-include("blocks/info/info.php");
13
-if(file_exists("blocks/info/{$language}.php")) include_once("blocks/info/{$language}.php");
14
-else include_once("blocks/info/en.php");
15
-	if(isset($_POST['submit'])) {
16
-		$blocks['info']['style'] = !empty($_POST['style']) && isNumber($_POST['style']) ? $_POST['style'] : 0;
17
-		if($_POST['template'] != _NARTEXT) $blocks['info']['template'] = $_POST['template'];
18
-		$output .= "<center>"._ACTIONSUCCESSFUL."</center>";
19
-		save_blocks( $blocks );
20
-	}
21
-	else {
22
-		$style = isset($blocks['info']['style']) ? $blocks['info']['style'] : 0;
23
-		if(empty($blocks['info']['template']) && $style == 1) $template = _NARTEXT;
24
-		else if($style == 1) $template = $blocks['info']['template'];
25
-		else $template = "";
26
-		$output .= "<div style='margin: 1em auto; width: 80%;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"text-align: left; padding: 4px; margin: 0 auto;\">$content</div><br />";
27
-		$output .= "<form method='POST' enctype='multipart/form-data' name='blockadmin' action='admin.php?action=blocks&admin=info'>
28
-			<label for='template'>"._TEMPLATE.":</label><br /><textarea name='template' rows='5' cols='50' style='width: 100%;'>$template</textarea>";
29
-		if($tinyMCE) $output .= "<div style='display: block; margin: 0; padding: 0;'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('template');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
30
-		$output .= "<label for='style'>"._DISPLAY.": </label><select name='style'class='textbox' ><option value='0'".(!$style ? " selected" : "").">"._CHART."</option>
31
-				<option value='1'".($style == 1 ? " selected" : "").">"._NARRATIVE."</option>
32
-				<option value='2'".($style == 2 ? " selected" : "").">"._VARIABLES."</option></select><br />
33
-			<INPUT type='submit' class='button' name='submit' value='"._SUBMIT."'></form></div>";
34
-	}
1
+<?php
2
+if(!defined("_CHARSET")) exit( );
3
+
4
+global $language;
5
+$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'info'");
6
+while($block = dbassoc($blockquery)) {
7
+	if ($block['block_variables'])
8
+	{
9
+		$blocks[$block['block_name']] = unserialize($block['block_variables']);
10
+	}
11
+	$blocks[$block['block_name']]['title'] = $block['block_title'];
12
+	 $blocks[$block['block_name']]['file'] = $block['block_file'];
13
+	$blocks[$block['block_name']]['status'] = $block['block_status'];
14
+}
15
+include("blocks/info/info.php");
16
+if(file_exists("blocks/info/{$language}.php")) include_once("blocks/info/{$language}.php");
17
+else include_once("blocks/info/en.php");
18
+	if(isset($_POST['submit'])) {
19
+		$blocks['info']['style'] = !empty($_POST['style']) && isNumber($_POST['style']) ? $_POST['style'] : 0;
20
+		if($_POST['template'] != _NARTEXT) $blocks['info']['template'] = $_POST['template'];
21
+		$output .= "<center>"._ACTIONSUCCESSFUL."</center>";
22
+		save_blocks( $blocks );
23
+	}
24
+	else {
25
+		$style = isset($blocks['info']['style']) ? $blocks['info']['style'] : 0;
26
+		if(empty($blocks['info']['template']) && $style == 1) $template = _NARTEXT;
27
+		else if($style == 1) $template = $blocks['info']['template'];
28
+		else $template = "";
29
+		$output .= "<div style='margin: 1em auto; width: 80%;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"text-align: left; padding: 4px; margin: 0 auto;\">$content</div><br />";
30
+		$output .= "<form method='POST' enctype='multipart/form-data' name='blockadmin' action='admin.php?action=blocks&admin=info'>
31
+			<label for='template'>"._TEMPLATE.":</label><br /><textarea name='template' rows='5' cols='50' style='width: 100%;'>$template</textarea>";
32
+		if($tinyMCE) $output .= "<div style='display: block; margin: 0; padding: 0;'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('template');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
33
+		$output .= "<label for='style'>"._DISPLAY.": </label><select name='style'class='textbox' ><option value='0'".(!$style ? " selected" : "").">"._CHART."</option>
34
+				<option value='1'".($style == 1 ? " selected" : "").">"._NARRATIVE."</option>
35
+				<option value='2'".($style == 2 ? " selected" : "").">"._VARIABLES."</option></select><br />
36
+			<INPUT type='submit' class='button' name='submit' value='"._SUBMIT."'></form></div>";
37
+	}
35 38
 ?>
36 39
\ No newline at end of file
... ...
@@ -1,43 +1,46 @@
1
-<?php
2
-if(!defined("_CHARSET")) exit( );
3
-$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'login'");
4
-while($block = dbassoc($blockquery)) {
5
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
6
-	$blocks[$block['block_name']]['title'] = $block['block_title'];
7
-	 $blocks[$block['block_name']]['file'] = $block['block_file'];
8
-	$blocks[$block['block_name']]['status'] = $block['block_status'];
9
-}
10
-global $language;
11
-// Set $loggedin to 0 to see the block
12
-include("blocks/login/login.php");
13
-// Then set it back to 1. 
14
-if(file_exists("blocks/login/$language.php")) include("blocks/login/$language.php");
15
-else include("blocks/login/en.php");
16
-	if(isset($_POST['submit'])) {
17
-		$blocks['login']['acctlink'] = $_POST['acctlink'];
18
-		if(empty($_POST['form'])) unset($blocks['login']['form']);
19
-		else $blocks['login']['form'] = $_POST['form'];
20
-		$blocks['login']['template'] = addslashes(descript($_POST['template']));
21
-		save_blocks( $blocks );
22
-		unset($_GET['admin']);
23
-		$output .= write_message(_ACTIONSUCCESSFUL);
24
-	}
25
-	else {
26
-		if(empty($blocks['login']['template'])) $template = "";
27
-		else $template = $blocks['login']['template'];
28
-		$output .= "<div style='text-align: center;'><span class='label'>"._CURRENT.":</span><br /><div class=\"tblborder\" style=\"width: 80%; text-align: left; margin: 1ex auto;\">$content</div></div><br />";
29
-		$output .= _LOGINNOTE."<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=login\">
30
-			<div><label for=\"template\">"._TEMPLATE.":</label><span style='clear: left;'>&nbsp;</span></div>
31
-			<div class=\"shorttextarea\"><textarea name=\"template\" rows=\"5\" style=\"width: 100%;\" cols=\"40\">".stripslashes($template)."</textarea>";
32
-		if($tinyMCE) 
33
-			$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('template');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
34
-		$output .= "</div>
35
-			<label for=\"form\">"._DEFAULTOPTS.":</label> <select name=\"form\" id=\"form\" class=\"textbox\" ><option value=\"0\"".(empty($blocks['login']['form']) ? " selected" : "").">"._SHORT."</option>
36
-					<option value=\"1\"".(!empty($blocks['login']['form']) ? " selected" : "").">"._LONG."</option>
37
-			</select><br />
38
-			<label for=\"acctlink\">"._ACCTLINK."</label> <select name=\"acctlink\" id=\"acctlink\" class=\"textbox\" ><option value=\"0\"".(empty($blocks['login']['acctlink']) ? " selected" : "").">"._NO."</option>
39
-					<option value=\"1\"".(!empty($blocks['login']['acctlink']) ? " selected" : "").">"._YES."</option>
40
-			</select><br />
41
-			<INPUT type=\"submit\" class=\"button\" id=\"submit\" name=\"submit\" value=\""._SUBMIT."\"></form></div>";
42
-	}
1
+<?php
2
+if(!defined("_CHARSET")) exit( );
3
+$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'login'");
4
+while($block = dbassoc($blockquery)) {
5
+	if ($block['block_variables'])
6
+	{
7
+		$blocks[$block['block_name']] = unserialize($block['block_variables']);
8
+	}
9
+	$blocks[$block['block_name']]['title'] = $block['block_title'];
10
+	 $blocks[$block['block_name']]['file'] = $block['block_file'];
11
+	$blocks[$block['block_name']]['status'] = $block['block_status'];
12
+}
13
+global $language;
14
+// Set $loggedin to 0 to see the block
15
+include("blocks/login/login.php");
16
+// Then set it back to 1. 
17
+if(file_exists("blocks/login/$language.php")) include("blocks/login/$language.php");
18
+else include("blocks/login/en.php");
19
+	if(isset($_POST['submit'])) {
20
+		$blocks['login']['acctlink'] = $_POST['acctlink'];
21
+		if(empty($_POST['form'])) unset($blocks['login']['form']);
22
+		else $blocks['login']['form'] = $_POST['form'];
23
+		$blocks['login']['template'] = addslashes(descript($_POST['template']));
24
+		save_blocks( $blocks );
25
+		unset($_GET['admin']);
26
+		$output .= write_message(_ACTIONSUCCESSFUL);
27
+	}
28
+	else {
29
+		if(empty($blocks['login']['template'])) $template = "";
30
+		else $template = $blocks['login']['template'];
31
+		$output .= "<div style='text-align: center;'><span class='label'>"._CURRENT.":</span><br /><div class=\"tblborder\" style=\"width: 80%; text-align: left; margin: 1ex auto;\">$content</div></div><br />";
32
+		$output .= _LOGINNOTE."<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=login\">
33
+			<div><label for=\"template\">"._TEMPLATE.":</label><span style='clear: left;'>&nbsp;</span></div>
34
+			<div class=\"shorttextarea\"><textarea name=\"template\" rows=\"5\" style=\"width: 100%;\" cols=\"40\">".stripslashes($template)."</textarea>";
35
+		if($tinyMCE) 
36
+			$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('template');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
37
+		$output .= "</div>
38
+			<label for=\"form\">"._DEFAULTOPTS.":</label> <select name=\"form\" id=\"form\" class=\"textbox\" ><option value=\"0\"".(empty($blocks['login']['form']) ? " selected" : "").">"._SHORT."</option>
39
+					<option value=\"1\"".(!empty($blocks['login']['form']) ? " selected" : "").">"._LONG."</option>
40
+			</select><br />
41
+			<label for=\"acctlink\">"._ACCTLINK."</label> <select name=\"acctlink\" id=\"acctlink\" class=\"textbox\" ><option value=\"0\"".(empty($blocks['login']['acctlink']) ? " selected" : "").">"._NO."</option>
42
+					<option value=\"1\"".(!empty($blocks['login']['acctlink']) ? " selected" : "").">"._YES."</option>
43
+			</select><br />
44
+			<INPUT type=\"submit\" class=\"button\" id=\"submit\" name=\"submit\" value=\""._SUBMIT."\"></form></div>";
45
+	}
43 46
 ?>
44 47
\ No newline at end of file
... ...
@@ -1,84 +1,87 @@
1
-<?php
2
-if(!defined("_CHARSET")) exit( );
3
-
4
-global $language, $pagelinks;
5
-$linkquery = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_pagelinks ORDER BY link_access ASC");
6
-if(!isset($current)) $current = "";
7
-
8
-		$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = '$admin'");
9
-		while($block = dbassoc($blockquery)) {
10
-			$blocks[$block['block_name']] = unserialize($block['block_variables']);
11
-			$blocks[$block['block_name']]['title'] = $block['block_title'];
12
-			$blocks[$block['block_name']]['file'] = $block['block_file'];
13
-			$blocks[$block['block_name']]['status'] = $block['block_status'];
14
-		}
15
-		$content = isset($blocks[$admin]['content']) ? $blocks[$admin]['content'] : array();
16
-
17
-while($link = dbassoc($linkquery)) {
18
-	$tpl->assignGlobal($link['link_name'], "<a href=\""._BASEDIR.$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>");
19
-	$pagelinks[$link['link_name']] = array("id" => $link['link_id'], "text" => $link['link_text'], "url" => _BASEDIR.$link['link_url'], "link" => "<a href=\""._BASEDIR.$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>");
20
-}
21
-include("blocks/".$blocks[$admin]['file']);
22
-if(file_exists("blocks/menu/{$language}.php")) include("blocks/menu/{$language}.php");
23
-else include("blocks/menu/en.php");
24
-	if(isset($_GET['up'])) {
25
-		$pos = array_search($_GET['up'], $blocks[$admin]['content']);
26
-		if($pos >= 1) {
27
-			$blocks[$admin]['content'][$pos] = $blocks[$admin]['content'][$pos - 1];
28
-			$blocks[$admin]['content'][$pos - 1] = $_GET['up'];
29
-			$blocks[$admin]['content'] = $blocks[$admin]['content'];
30
-			save_blocks( $blocks );
31
-		}
32
-	}
33
-	if(isset($_GET['down'])) {
34
-		$pos = array_search($_GET['down'], $blocks[$admin]['content']);
35
-		if($pos <= count($blocks[$admin]['content'])) {
36
-			$blocks[$admin]['content'][$pos] = $blocks[$admin]['content'][$pos + 1];
37
-			$blocks[$admin]['content'][$pos + 1] = $_GET['down'];
38
-			$blocks[$admin]['content'] = $blocks[$admin]['content'];
39
-			save_blocks( $blocks );
40
-		}
41
-	}		
42
-	if(isset($_POST['submit'])) {
43
-		$newcontent = array( );
44
-		for($x = 0; $x <= count($pagelinks); $x++) {
45
-			if(isset($_POST["content_$x"])) $newcontent[] = $_POST["content_$x"];
46
-		}
47
-		$blocks[$admin]['content'] = $newcontent;
48
-		$blocks[$admin]['style'] = isset($_POST['style']) && !empty($_POST['style']) ? 1 : 0;
49
-		save_blocks( $blocks );
50
-	}
51
-	if($admin){
52
-		$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = '$admin'");
53
-		while($block = dbassoc($blockquery)) {
54
-			$blocks[$block['block_name']] = unserialize($block['block_variables']);
55
-			$blocks[$block['block_name']]['title'] = $block['block_title'];
56
-			$blocks[$block['block_name']]['file'] = $block['block_file'];
57
-			$blocks[$block['block_name']]['status'] = $block['block_status'];
58
-		}
59
-		$content = isset($blocks[$admin]['content']) ? $blocks[$admin]['content'] : array();
60
-		$output .= "<div style=\"width: 300px; margin: 0 auto;\"><form method=\"POST\" enctype=\"multipart/form-data\"action=\"admin.php?action=blocks&admin=$admin\">
61
-			<table class=\"tblborder\" width=\"100%\"><tr><th>"._TITLE."</th><th colspan=\"2\">"._MOVE."</th></tr>";
62
-		$count = 1;
63
-		if(is_array($content)) {
64
-			foreach($content as $link) {
65
-				$output .= "<tr><td class='tblborder'><input type=\"checkbox\" class=\"checkbox\" checked name=\"content_$count\" value=\"$link\">".$pagelinks["$link"]['link']."</td>
66
-					<td class='tblborder' width=\"15\">".($count > 1 ? "<a href=\"admin.php?action=blocks&admin=$admin&up=$link\"><img src=\"images/arrowup.gif\" width=\"13\" height=\"18\" alt=\""._UP."\" title=\""._UP."\" border=\"0\"></a>" : "")."</td>
67
-					<td class='tblborder' width=\"15\">".($count < sizeof($blocks[$admin]['content']) ? "<a href=\"admin.php?action=blocks&admin=$admin&down=$link\"><img src=\"images/arrowdown.gif\" width=\"13\" height=\"18\" alt=\""._DOWN."\" title=\""._DOWN."\" border=\"0\"></a>" : "")."</td></tr>";
68
-				$count++;
69
-			}
70
-		}
71
-		foreach($pagelinks as $page => $link) {
72
-			if(!is_array($content) || !in_array($page, $content)) {
73
-				$output .= "<tr><td class='tblborder'><input type=\"checkbox\" class=\"checkbox\" name=\"content_$count\" value=\"$page\">".$link['link']."</td>
74
-					<td class='tblborder' colspan=\"2\">&nbsp;</td></tr>";
75
-				$count++;
76
-			}
77
-		}
78
-		$output .= "</table><br /><div style=\"text-align: center;\">
79
-			<label for=\"style\">"._STYLE.":</label> <SELECT name=\"style\" id=\"style\">
80
-			<option value=\"1\"".(!empty($blocks["menu"]['style']) ? " selected" : "").">"._NOLIST."</option>
81
-			<option value=\"0\"".(empty($blocks['menu']['style']) ? " selected" : "").">"._LISTFORMAT."</option>
82
-			</select><br /><br /><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></div></form></div>";
83
-	}
1
+<?php
2
+if(!defined("_CHARSET")) exit( );
3
+
4
+global $language, $pagelinks;
5
+$linkquery = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_pagelinks ORDER BY link_access ASC");
6
+if(!isset($current)) $current = "";
7
+
8
+		$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = '$admin'");
9
+		while($block = dbassoc($blockquery)) {
10
+			if ($block['block_variables'])
11
+			{
12
+				$blocks[$block['block_name']] = unserialize($block['block_variables']);
13
+			}
14
+			$blocks[$block['block_name']]['title'] = $block['block_title'];
15
+			$blocks[$block['block_name']]['file'] = $block['block_file'];
16
+			$blocks[$block['block_name']]['status'] = $block['block_status'];
17
+		}
18
+		$content = isset($blocks[$admin]['content']) ? $blocks[$admin]['content'] : array();
19
+
20
+while($link = dbassoc($linkquery)) {
21
+	$tpl->assignGlobal($link['link_name'], "<a href=\""._BASEDIR.$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>");
22
+	$pagelinks[$link['link_name']] = array("id" => $link['link_id'], "text" => $link['link_text'], "url" => _BASEDIR.$link['link_url'], "link" => "<a href=\""._BASEDIR.$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>");
23
+}
24
+include("blocks/".$blocks[$admin]['file']);
25
+if(file_exists("blocks/menu/{$language}.php")) include("blocks/menu/{$language}.php");
26
+else include("blocks/menu/en.php");
27
+	if(isset($_GET['up'])) {
28
+		$pos = array_search($_GET['up'], $blocks[$admin]['content']);
29
+		if($pos >= 1) {
30
+			$blocks[$admin]['content'][$pos] = $blocks[$admin]['content'][$pos - 1];
31
+			$blocks[$admin]['content'][$pos - 1] = $_GET['up'];
32
+			$blocks[$admin]['content'] = $blocks[$admin]['content'];
33
+			save_blocks( $blocks );
34
+		}
35
+	}
36
+	if(isset($_GET['down'])) {
37
+		$pos = array_search($_GET['down'], $blocks[$admin]['content']);
38
+		if($pos <= count($blocks[$admin]['content'])) {
39
+			$blocks[$admin]['content'][$pos] = $blocks[$admin]['content'][$pos + 1];
40
+			$blocks[$admin]['content'][$pos + 1] = $_GET['down'];
41
+			$blocks[$admin]['content'] = $blocks[$admin]['content'];
42
+			save_blocks( $blocks );
43
+		}
44
+	}		
45
+	if(isset($_POST['submit'])) {
46
+		$newcontent = array( );
47
+		for($x = 0; $x <= count($pagelinks); $x++) {
48
+			if(isset($_POST["content_$x"])) $newcontent[] = $_POST["content_$x"];
49
+		}
50
+		$blocks[$admin]['content'] = $newcontent;
51
+		$blocks[$admin]['style'] = isset($_POST['style']) && !empty($_POST['style']) ? 1 : 0;
52
+		save_blocks( $blocks );
53
+	}
54
+	if($admin){
55
+		$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = '$admin'");
56
+		while($block = dbassoc($blockquery)) {
57
+			$blocks[$block['block_name']] = unserialize($block['block_variables']);
58
+			$blocks[$block['block_name']]['title'] = $block['block_title'];
59
+			$blocks[$block['block_name']]['file'] = $block['block_file'];
60
+			$blocks[$block['block_name']]['status'] = $block['block_status'];
61
+		}
62
+		$content = isset($blocks[$admin]['content']) ? $blocks[$admin]['content'] : array();
63
+		$output .= "<div style=\"width: 300px; margin: 0 auto;\"><form method=\"POST\" enctype=\"multipart/form-data\"action=\"admin.php?action=blocks&admin=$admin\">
64
+			<table class=\"tblborder\" width=\"100%\"><tr><th>"._TITLE."</th><th colspan=\"2\">"._MOVE."</th></tr>";
65
+		$count = 1;
66
+		if(is_array($content)) {
67
+			foreach($content as $link) {
68
+				$output .= "<tr><td class='tblborder'><input type=\"checkbox\" class=\"checkbox\" checked name=\"content_$count\" value=\"$link\">".$pagelinks["$link"]['link']."</td>
69
+					<td class='tblborder' width=\"15\">".($count > 1 ? "<a href=\"admin.php?action=blocks&admin=$admin&up=$link\"><img src=\"images/arrowup.gif\" width=\"13\" height=\"18\" alt=\""._UP."\" title=\""._UP."\" border=\"0\"></a>" : "")."</td>
70
+					<td class='tblborder' width=\"15\">".($count < sizeof($blocks[$admin]['content']) ? "<a href=\"admin.php?action=blocks&admin=$admin&down=$link\"><img src=\"images/arrowdown.gif\" width=\"13\" height=\"18\" alt=\""._DOWN."\" title=\""._DOWN."\" border=\"0\"></a>" : "")."</td></tr>";
71
+				$count++;
72
+			}
73
+		}
74
+		foreach($pagelinks as $page => $link) {
75
+			if(!is_array($content) || !in_array($page, $content)) {
76
+				$output .= "<tr><td class='tblborder'><input type=\"checkbox\" class=\"checkbox\" name=\"content_$count\" value=\"$page\">".$link['link']."</td>
77
+					<td class='tblborder' colspan=\"2\">&nbsp;</td></tr>";
78
+				$count++;
79
+			}
80
+		}
81
+		$output .= "</table><br /><div style=\"text-align: center;\">
82
+			<label for=\"style\">"._STYLE.":</label> <SELECT name=\"style\" id=\"style\">
83
+			<option value=\"1\"".(!empty($blocks["menu"]['style']) ? " selected" : "").">"._NOLIST."</option>
84
+			<option value=\"0\"".(empty($blocks['menu']['style']) ? " selected" : "").">"._LISTFORMAT."</option>
85
+			</select><br /><br /><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></div></form></div>";
86
+	}
84 87
 ?>
85 88
\ No newline at end of file
... ...
@@ -1,28 +1,31 @@
1
-<?php
2
-if(!defined("_CHARSET")) exit( );
3
-$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'news'");
4
-while($block = dbassoc($blockquery)) {
5
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
6
-	$blocks[$block['block_name']]['title'] = $block['block_title'];
7
-	 $blocks[$block['block_name']]['file'] = $block['block_file'];
8
-	$blocks[$block['block_name']]['status'] = $block['block_status'];
9
-}
10
-global $language, $numupdated;
11
-include("blocks/".$blocks['news']['file']);
12
-	if(isset($_POST['submit'])) {
13
-		if(isset($_POST['num']) && isNumber($_POST['num'])) $blocks['news']['num'] = $_POST['num'];
14
-		else $blocks['news']['num'] = 1;
15
-		if(isset($_POST['sumlength']) && isNumber($_POST['sumlength'])) $blocks['news']['sumlength'] = $_POST['sumlength'];
16
-		else unset($blocks['news']['sumlength']);
17
-		$output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>";
18
-		save_blocks( $blocks );
19
-	}
20
-	else  {
21
-		if(!isset($blocks['news']['sumlength'])) $blocks['news']['sumlength'] = "";
22
-		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">$content</div><br /></div>";
23
-		$output .= "<div><div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=news\">
24
-			<div><label for=\"num\">"._NUMNEWS.":</label><input type=\"text\" class=\"textbox\" name=\"num\" id=\"num\" size=\"4\" value=\"".$blocks['news']['num']."\"></div>
25
-		<div><label for=\"num\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"6\" value=\"".$blocks['news']['sumlength']."\"></div>
26
-			<INPUT type=\"submit\" name=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='clear: both;'></div></div>";
27
-	}
1
+<?php
2
+if(!defined("_CHARSET")) exit( );
3
+$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'news'");
4
+while($block = dbassoc($blockquery)) {
5
+	if ($block['block_variables'])
6
+	{
7
+		$blocks[$block['block_name']] = unserialize($block['block_variables']);
8
+	}
9
+	$blocks[$block['block_name']]['title'] = $block['block_title'];
10
+	 $blocks[$block['block_name']]['file'] = $block['block_file'];
11
+	$blocks[$block['block_name']]['status'] = $block['block_status'];
12
+}
13
+global $language, $numupdated;
14
+include("blocks/".$blocks['news']['file']);
15
+	if(isset($_POST['submit'])) {
16
+		if(isset($_POST['num']) && isNumber($_POST['num'])) $blocks['news']['num'] = $_POST['num'];
17
+		else $blocks['news']['num'] = 1;
18
+		if(isset($_POST['sumlength']) && isNumber($_POST['sumlength'])) $blocks['news']['sumlength'] = $_POST['sumlength'];
19
+		else unset($blocks['news']['sumlength']);
20
+		$output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>";
21
+		save_blocks( $blocks );
22
+	}
23
+	else  {
24
+		if(!isset($blocks['news']['sumlength'])) $blocks['news']['sumlength'] = "";
25
+		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">$content</div><br /></div>";
26
+		$output .= "<div><div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=news\">
27
+			<div><label for=\"num\">"._NUMNEWS.":</label><input type=\"text\" class=\"textbox\" name=\"num\" id=\"num\" size=\"4\" value=\"".$blocks['news']['num']."\"></div>
28
+		<div><label for=\"num\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"6\" value=\"".$blocks['news']['sumlength']."\"></div>
29
+			<INPUT type=\"submit\" name=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='clear: both;'></div></div>";
30
+	}
28 31
 ?>
29 32
\ No newline at end of file
... ...
@@ -1,61 +1,64 @@
1
-<?php
2
-if(!defined("_CHARSET")) exit( );
3
-
4
-global $language, $tinyMCE, $allowed_tags;
5
-$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'poll'");
6
-while($block = dbassoc($blockquery)) {
7
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
8
-	$blocks[$block['block_name']]['title'] = $block['block_title'];
9
-	 $blocks[$block['block_name']]['file'] = $block['block_file'];
10
-	$blocks[$block['block_name']]['status'] = $block['block_status'];
11
-}
12
-include("blocks/".$blocks['poll']['file']);
13
-	if(isset($_GET['delete']) && isNumber($_GET['delete'])) {
14
-		$delete = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_id = '$_GET[delete]' LIMIT 1");
15
-		if($delete) $output .= write_message(_ACTIONSUCCESSFUL);
16
-	}	
17
-	if(isset($_POST['close_current'])) {
18
-		$final = "";
19
-		foreach($pollopts as $num => $opt) {
20
-			if(strlen($final) > 0) $final .= "#";
21
-			$n = $num + 1;
22
-			$final .= (isset($results[$n]) ? $results[$n] : "0");
23
-		}
24
-		$closepoll =dbquery("UPDATE ".TABLEPREFIX."fanfiction_poll SET poll_results = '$final', poll_end = NOW( ) WHERE poll_id = '".$currentpoll['poll_id']."'");
25
-		if($closepoll) $emptyvotes = dbquery("TRUNCATE TABLE `".TABLEPREFIX."fanfiction_poll_votes`");
26
-		$output .= write_message(_ACTIONSUCCESSFUL);
27
-	}
28
-	if(isset($_POST['submit'])) {
29
-		$poll_question = escapestring(descript(stripslashes($_POST['poll_question'])));
30
-		$opts = explode("\r\n", ltrim(strip_tags(preg_replace( '!<p>!iU', "\r\n",  stripslashes(trim($_POST['poll_opts']))), preg_replace("!<p>!iu", "", $allowed_tags))));
31
-		$new_opts = array( );
32
-		foreach($opts as $opt) { 
33
-			if(strlen(trim(preg_replace("!&nbsp;!", " ", $opt))) > 0) $new_opts[] = $opt;
34
-		}
35
-		$new_opts = escapestring(implode("|#|", $new_opts));
36
-		$newpoll = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_poll(`poll_question`, `poll_opts`, `poll_start`) VALUES('$poll_question', '$new_opts', NOW( ))");
37
-		include("blocks/".$blocks['poll']['file']);
38
-		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 200px; margin: 0 auto; text-align: left;\">$content</div><br /></div>";
39
-	}
40
-	if($currentpoll && !isset($_POST['close_current'])) {
41
-		include("blocks/".$blocks['poll']['file']);
42
-		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 200px; margin: 0 auto; text-align: left;\">$content</div><br /></div>";
43
-		$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&amp;admin=poll\" style='text-align: center;'><INPUT type=\"submit\" class=\"button\" name=\"close_current\" value=\""._CLOSEPOLL."\"></form>";
44
-	}
45
-	else  {
46
-		$output .= "<div style='width: 400px; margin: 1em auto; text-align: center;'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=poll\">
47
-			<label for=\"poll_question\">"._POLLQUESTION."</label><textarea name='poll_question' cols='40' id='poll_question' rows='5'></textarea><br />";
48
-		if($tinyMCE) 
49
-			$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('poll_question');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
50
-		$output .= "<label for=\"poll_opts\">"._POLLOPTS."</label><textarea name='poll_opts' id='poll_opts' class='mceNoEditor' cols='40' rows='5'></textarea><br />";
51
-		$output .= "<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></div>";
52
-	}
53
-	$oldpolls = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_end != '0000-00-00 00:00:00' ORDER BY poll_id DESC");
54
-	if(dbnumrows($oldpolls)) {
55
-		$output .= "<table class='tblborder' style='width: 400px; margin: 1em auto; text-align: center;'><tr><th>"._POLLQUESTION."</th><th>"._OPTIONS."</th></tr>";
56
-		while($poll = dbassoc($oldpolls)) {
57
-			$output .= "<tr><td class='tblborder'>".stripslashes($poll['poll_question'])."</td><td class='tblborder'><a href='admin.php?action=blocks&amp;admin=poll&amp;delete=".$poll['poll_id']."'>"._DELETE."</a></td></tr>";
58
-		}
59
-		$output .= "</table><br />";
60
-	}
1
+<?php
2
+if(!defined("_CHARSET")) exit( );
3
+
4
+global $language, $tinyMCE, $allowed_tags;
5
+$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'poll'");
6
+while($block = dbassoc($blockquery)) {
7
+	if ($block['block_variables'])
8
+	{
9
+		$blocks[$block['block_name']] = unserialize($block['block_variables']);
10
+	}
11
+	$blocks[$block['block_name']]['title'] = $block['block_title'];
12
+	 $blocks[$block['block_name']]['file'] = $block['block_file'];
13
+	$blocks[$block['block_name']]['status'] = $block['block_status'];
14
+}
15
+include("blocks/".$blocks['poll']['file']);
16
+	if(isset($_GET['delete']) && isNumber($_GET['delete'])) {
17
+		$delete = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_id = '$_GET[delete]' LIMIT 1");
18
+		if($delete) $output .= write_message(_ACTIONSUCCESSFUL);
19
+	}	
20
+	if(isset($_POST['close_current'])) {
21
+		$final = "";
22
+		foreach($pollopts as $num => $opt) {
23
+			if(strlen($final) > 0) $final .= "#";
24
+			$n = $num + 1;
25
+			$final .= (isset($results[$n]) ? $results[$n] : "0");
26
+		}
27
+		$closepoll =dbquery("UPDATE ".TABLEPREFIX."fanfiction_poll SET poll_results = '$final', poll_end = NOW( ) WHERE poll_id = '".$currentpoll['poll_id']."'");
28
+		if($closepoll) $emptyvotes = dbquery("TRUNCATE TABLE `".TABLEPREFIX."fanfiction_poll_votes`");
29
+		$output .= write_message(_ACTIONSUCCESSFUL);
30
+	}
31
+	if(isset($_POST['submit'])) {
32
+		$poll_question = escapestring(descript(stripslashes($_POST['poll_question'])));
33
+		$opts = explode("\r\n", ltrim(strip_tags(preg_replace( '!<p>!iU', "\r\n",  stripslashes(trim($_POST['poll_opts']))), preg_replace("!<p>!iu", "", $allowed_tags))));
34
+		$new_opts = array( );
35
+		foreach($opts as $opt) { 
36
+			if(strlen(trim(preg_replace("!&nbsp;!", " ", $opt))) > 0) $new_opts[] = $opt;
37
+		}
38
+		$new_opts = escapestring(implode("|#|", $new_opts));
39
+		$newpoll = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_poll(`poll_question`, `poll_opts`, `poll_start`) VALUES('$poll_question', '$new_opts', NOW( ))");
40
+		include("blocks/".$blocks['poll']['file']);
41
+		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 200px; margin: 0 auto; text-align: left;\">$content</div><br /></div>";
42
+	}
43
+	if($currentpoll && !isset($_POST['close_current'])) {
44
+		include("blocks/".$blocks['poll']['file']);
45
+		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 200px; margin: 0 auto; text-align: left;\">$content</div><br /></div>";
46
+		$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&amp;admin=poll\" style='text-align: center;'><INPUT type=\"submit\" class=\"button\" name=\"close_current\" value=\""._CLOSEPOLL."\"></form>";
47
+	}
48
+	else  {
49
+		$output .= "<div style='width: 400px; margin: 1em auto; text-align: center;'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=poll\">
50
+			<label for=\"poll_question\">"._POLLQUESTION."</label><textarea name='poll_question' cols='40' id='poll_question' rows='5'></textarea><br />";
51
+		if($tinyMCE) 
52
+			$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('poll_question');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
53
+		$output .= "<label for=\"poll_opts\">"._POLLOPTS."</label><textarea name='poll_opts' id='poll_opts' class='mceNoEditor' cols='40' rows='5'></textarea><br />";
54
+		$output .= "<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></div>";
55
+	}
56
+	$oldpolls = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_end != '0000-00-00 00:00:00' ORDER BY poll_id DESC");
57
+	if(dbnumrows($oldpolls)) {
58
+		$output .= "<table class='tblborder' style='width: 400px; margin: 1em auto; text-align: center;'><tr><th>"._POLLQUESTION."</th><th>"._OPTIONS."</th></tr>";
59
+		while($poll = dbassoc($oldpolls)) {
60
+			$output .= "<tr><td class='tblborder'>".stripslashes($poll['poll_question'])."</td><td class='tblborder'><a href='admin.php?action=blocks&amp;admin=poll&amp;delete=".$poll['poll_id']."'>"._DELETE."</a></td></tr>";
61
+		}
62
+		$output .= "</table><br />";
63
+	}
61 64
 ?>
62 65
\ No newline at end of file
... ...
@@ -1,34 +1,37 @@
1
-<?php
2
-if(!defined("_CHARSET")) exit( );
3
-
4
-global $language;
5
-$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'random'");
6
-while($block = dbassoc($blockquery)) {
7
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
8
-	$blocks[$block['block_name']]['title'] = $block['block_title'];
9
-	 $blocks[$block['block_name']]['file'] = $block['block_file'];
10
-	$blocks[$block['block_name']]['status'] = $block['block_status'];
11
-}
12
-include("blocks/".$blocks['random']['file']);
13
-if(!empty($blocks['random']['tpl'])) $tpl->gotoBlock("_ROOT");
14
-	if(isset($_POST['submit'])) {
15
-		if($_POST['tpl']) $blocks['random']['tpl'] = 1;
16
-		else unset($blocks['random']['tpl']);
17
-		if($_POST['allowtags']) $blocks['random']['allowtags'] = 1;
18
-		else unset($blocks['random']['allowtags']);
19
-		if(isset($_POST['sumlength']) && isNumber($_POST['sumlength'])) $blocks['random']['sumlength'] = $_POST['sumlength'];
20
-		else unset($blocks['random']['sumlength']);
21
-		$output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>";
22
-		save_blocks( $blocks );
23
-	}
24
-	else  {
25
-		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 1ex auto; text-align: left;\">".(!empty($blocks['random']['tpl']) ? _NATPL : $content)."</div><br /></div>";
26
-		$output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=random\">
27
-			<label for=\"tpl\">"._BLOCKTYPE.":</label><select class=\"textbox\" name=\"tpl\" id=\"tpl\"><option value=\"0\"".(empty($blocks['random']['tpl']) ? " selected" : "").">"._DEFAULT."</option>
28
-					<option value=\"1\"".(!empty($blocks['random']['tpl']) ? " selected" : "").">"._USETPL."</option></select><br />
29
-			<label for=\"allowtags\">"._TAGS.":</label><select class=\"textbox\" name=\"allowtags\" id=\"allowtags\"><option value=\"0\"".(empty($blocks['random']['allowtags']) ? " selected" : "").">"._STRIPTAGS."</option>
30
-					<option value=\"1\"".(!empty($blocks['random']['allowtags']) ? " selected" : "").">"._ALLOWTAGS."</option></select><br />
31
-			<label for=\"sumlength\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"4\" value=\"".(!empty($blocks['random']['sumlength']) ? $blocks['random']['sumlength'] : "")."\"><br />
32
-			<INPUT type=\"submit\" name=\"submit\" id=\"submit\" class=\"button\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._SUMNOTE."</div>";
33
-	}
1
+<?php
2
+if(!defined("_CHARSET")) exit( );
3
+
4
+global $language;
5
+$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'random'");
6
+while($block = dbassoc($blockquery)) {
7
+	if ($block['block_variables'])
8
+	{
9
+		$blocks[$block['block_name']] = unserialize($block['block_variables']);
10
+	}
11
+	$blocks[$block['block_name']]['title'] = $block['block_title'];
12
+	 $blocks[$block['block_name']]['file'] = $block['block_file'];
13
+	$blocks[$block['block_name']]['status'] = $block['block_status'];
14
+}
15
+include("blocks/".$blocks['random']['file']);
16
+if(!empty($blocks['random']['tpl'])) $tpl->gotoBlock("_ROOT");
17
+	if(isset($_POST['submit'])) {
18
+		if($_POST['tpl']) $blocks['random']['tpl'] = 1;
19
+		else unset($blocks['random']['tpl']);
20
+		if($_POST['allowtags']) $blocks['random']['allowtags'] = 1;
21
+		else unset($blocks['random']['allowtags']);
22
+		if(isset($_POST['sumlength']) && isNumber($_POST['sumlength'])) $blocks['random']['sumlength'] = $_POST['sumlength'];
23
+		else unset($blocks['random']['sumlength']);
24
+		$output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>";
25
+		save_blocks( $blocks );
26
+	}
27
+	else  {
28
+		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 1ex auto; text-align: left;\">".(!empty($blocks['random']['tpl']) ? _NATPL : $content)."</div><br /></div>";
29
+		$output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=random\">
30
+			<label for=\"tpl\">"._BLOCKTYPE.":</label><select class=\"textbox\" name=\"tpl\" id=\"tpl\"><option value=\"0\"".(empty($blocks['random']['tpl']) ? " selected" : "").">"._DEFAULT."</option>
31
+					<option value=\"1\"".(!empty($blocks['random']['tpl']) ? " selected" : "").">"._USETPL."</option></select><br />
32
+			<label for=\"allowtags\">"._TAGS.":</label><select class=\"textbox\" name=\"allowtags\" id=\"allowtags\"><option value=\"0\"".(empty($blocks['random']['allowtags']) ? " selected" : "").">"._STRIPTAGS."</option>
33
+					<option value=\"1\"".(!empty($blocks['random']['allowtags']) ? " selected" : "").">"._ALLOWTAGS."</option></select><br />
34
+			<label for=\"sumlength\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"4\" value=\"".(!empty($blocks['random']['sumlength']) ? $blocks['random']['sumlength'] : "")."\"><br />
35
+			<INPUT type=\"submit\" name=\"submit\" id=\"submit\" class=\"button\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._SUMNOTE."</div>";
36
+	}
34 37
 ?>
35 38
\ No newline at end of file
... ...
@@ -1,38 +1,41 @@
1
-<?php
2
-if(!defined("_CHARSET")) exit( );
3
-
4
-global $language, $numupdated;
5
-$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'recent'");
6
-while($block = dbassoc($blockquery)) {
7
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
8
-	$blocks[$block['block_name']]['title'] = $block['block_title'];
9
-	 $blocks[$block['block_name']]['file'] = $block['block_file'];
10
-	$blocks[$block['block_name']]['status'] = $block['block_status'];
11
-}
12
-if(empty($blocks['recent']['tpl'])) include("blocks/".$blocks['recent']['file']);
13
-if(file_exists("blocks/recent/".$language.".php")) include("blocks/recent/".$language.".php");
14
-else include("blocks/recent/en.php");
15
-	if(isset($_POST['submit'])) {
16
-		if(!empty($_POST['tpl'])) $blocks['recent']['tpl'] = 1;
17
-		else unset($blocks['recent']['tpl']);
18
-		if(!empty($_POST['allowtags'])) $blocks['recent']['allowtags'] = 1;
19
-		else unset($blocks['recent']['allowtags']);
20
-		if(!empty($_POST['sumlength']) && isNumber($_POST['sumlength'])) $blocks['recent']['sumlength'] = $_POST['sumlength'];
21
-		else unset($blocks['recent']['sumlength']);
22
-		if(!empty($_POST['num']) && isNumber($_POST['num'])) $blocks['recent']['num'] = $_POST['num'];
23
-		else $blocks['recent']['num'] = 1;
24
-		$output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>";
25
-		save_blocks( $blocks );
26
-	}
27
-	else  {
28
-		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">".(!empty($blocks['recent']['tpl']) ? _NATPL : $content)."</div><br /></div>";
29
-		$output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&amp;admin=recent\">
30
-			<div><label for=\"tpl\">"._BLOCKTYPE.":</label><select name=\"tpl\" class=\"textbox\" id=\"tpl\"><option value=\"0\"".(empty($blocks['recent']['tpl']) ? " selected" : "").">"._DEFAULT."</option>
31
-					<option value=\"1\"".(!empty($blocks['recent']['tpl']) ? " selected" : "").">"._USETPL."</option></select></div>
32
-			<div><label for=\"allowtags\">"._TAGS.":</label><select name=\"allowtags\" class=\"textbox\" id=\"allowtags\"><option value=\"0\"".(empty($blocks['recent']['allowtags']) ? " selected" : "").">"._STRIPTAGS."</option>
33
-					<option value=\"1\"".(!empty($blocks['recent']['allowtags']) ? " selected" : "").">"._ALLOWTAGS."</option></select></div>
34
-			<div><label for=\"sumlength\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"4\" value=\"".(!empty($blocks['recent']['sumlength']) ? $blocks['recent']['sumlength'] : "")."\"></div>
35
-			<div><label for=\"num\">"._NUMUPDATED.":</label><input type=\"text\" class=\"textbox\" name=\"num\" id=\"num\" size=\"4\" value=\"".$blocks['recent']['num']."\"></div>
36
-			<INPUT type=\"submit\" name=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._SUMNOTE."</div>";
37
-	}
1
+<?php
2
+if(!defined("_CHARSET")) exit( );
3
+
4
+global $language, $numupdated;
5
+$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'recent'");
6
+while($block = dbassoc($blockquery)) {
7
+	if ($block['block_variables'])
8
+	{
9
+		$blocks[$block['block_name']] = unserialize($block['block_variables']);
10
+	}
11
+	$blocks[$block['block_name']]['title'] = $block['block_title'];
12
+	 $blocks[$block['block_name']]['file'] = $block['block_file'];
13
+	$blocks[$block['block_name']]['status'] = $block['block_status'];
14
+}
15
+if(empty($blocks['recent']['tpl'])) include("blocks/".$blocks['recent']['file']);
16
+if(file_exists("blocks/recent/".$language.".php")) include("blocks/recent/".$language.".php");
17
+else include("blocks/recent/en.php");
18
+	if(isset($_POST['submit'])) {
19
+		if(!empty($_POST['tpl'])) $blocks['recent']['tpl'] = 1;
20
+		else unset($blocks['recent']['tpl']);
21
+		if(!empty($_POST['allowtags'])) $blocks['recent']['allowtags'] = 1;
22
+		else unset($blocks['recent']['allowtags']);
23
+		if(!empty($_POST['sumlength']) && isNumber($_POST['sumlength'])) $blocks['recent']['sumlength'] = $_POST['sumlength'];
24
+		else unset($blocks['recent']['sumlength']);
25
+		if(!empty($_POST['num']) && isNumber($_POST['num'])) $blocks['recent']['num'] = $_POST['num'];
26
+		else $blocks['recent']['num'] = 1;
27
+		$output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>";
28
+		save_blocks( $blocks );
29
+	}
30
+	else  {
31
+		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">".(!empty($blocks['recent']['tpl']) ? _NATPL : $content)."</div><br /></div>";
32
+		$output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&amp;admin=recent\">
33
+			<div><label for=\"tpl\">"._BLOCKTYPE.":</label><select name=\"tpl\" class=\"textbox\" id=\"tpl\"><option value=\"0\"".(empty($blocks['recent']['tpl']) ? " selected" : "").">"._DEFAULT."</option>
34
+					<option value=\"1\"".(!empty($blocks['recent']['tpl']) ? " selected" : "").">"._USETPL."</option></select></div>
35
+			<div><label for=\"allowtags\">"._TAGS.":</label><select name=\"allowtags\" class=\"textbox\" id=\"allowtags\"><option value=\"0\"".(empty($blocks['recent']['allowtags']) ? " selected" : "").">"._STRIPTAGS."</option>
36
+					<option value=\"1\"".(!empty($blocks['recent']['allowtags']) ? " selected" : "").">"._ALLOWTAGS."</option></select></div>
37
+			<div><label for=\"sumlength\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"4\" value=\"".(!empty($blocks['recent']['sumlength']) ? $blocks['recent']['sumlength'] : "")."\"></div>
38
+			<div><label for=\"num\">"._NUMUPDATED.":</label><input type=\"text\" class=\"textbox\" name=\"num\" id=\"num\" size=\"4\" value=\"".$blocks['recent']['num']."\"></div>
39
+			<INPUT type=\"submit\" name=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._SUMNOTE."</div>";
40
+	}
38 41
 ?>
39 42
\ No newline at end of file
... ...
@@ -81,6 +81,7 @@ unset($settings['tableprefix']);
81 81
 define("STORIESPATH", $settings['storiespath']);
82 82
 unset($settings['storiespath']);
83 83
 foreach($settings as $var => $val) {
84
+	if (is_NULL($val)) $val = '';
84 85
 	$$var = stripslashes($val);
85 86
 	$settings[$var] = htmlspecialchars($val);
86 87
 }
... ...
@@ -158,7 +159,10 @@ if($maintenance && !isADMIN && basename($_SERVER['PHP_SELF']) != "maintenance.ph
158 159
 
159 160
 $blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks");
160 161
 while($block = dbassoc($blockquery)) {
161
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
162
+	if ($block['block_variables'])
163
+	{
164
+		$blocks[$block['block_name']] = unserialize($block['block_variables']);
165
+	}
162 166
 	$blocks[$block['block_name']]['title'] = $block['block_title'];
163 167
 	$blocks[$block['block_name']]['file'] = $block['block_file'];
164 168
 	$blocks[$block['block_name']]['status'] = $block['block_status'];
... ...
@@ -215,11 +219,7 @@ if(isset($metaDesc)) echo "<meta name='description' content='$metaDesc'>";
215 219
 echo "<title>$titleinfo</title>";
216 220
 
217 221
 // ---------- Favicon ---------
218
-if (file_exists($skindir."/images/favicon.ico")) 
219
-{
220
-	echo "<link rel='icon' href='".THEME_ABS."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='".THEME_ABS."favicon.ico' type='image/xicon' />\n";
221
-}
222
-elseif (file_exists(_BASEDIR."favicon.ico")) 
222
+if (file_exists(_BASEDIR."favicon.ico")) 
223 223
 {
224 224
 	echo "<link rel='icon' href='"._BASEDIR."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='"._BASEDIR."favicon.ico' type='image/xicon' />\n";
225 225
 }