Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,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
+			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
+	}
87
+?>
0 88
\ No newline at end of file