Browse code

fixed blocks for PHP 8.1

Jimmi08 authored on 2023/02/19 13:27:16
Showing 1 changed files
... ...
@@ -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
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,84 @@
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
+	}
84
+?>
0 85
\ No newline at end of file