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