Browse code

fixed blocks for PHP 8.1

Jimmi08 authored on 2023/02/19 13:27:16
Showing 1 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
Browse code

Initial uplad w/ php7 fixes

Rainer Volkrodt authored on 2016/03/12 15:54:02
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,98 @@
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"); 
98
+?>
0 99
\ No newline at end of file