Browse code

admin/links.php: formatting changes

Clarissa Walker authored on 2026/09/12 17:22:27
Showing 1 changed files
... ...
@@ -82,7 +82,7 @@ if(isset($_GET['edit']) || isset($_GET["new"])) {
82 82
 		$access = 0;
83 83
 		$accesskey = "";
84 84
 	}
85
-	$output .= "<form method=\"POST\" id=\"settingsform\" enctype=\"multipart/form-data\" action=\"admin.php?action=links".($edit ? "&amp;edit=$edit" : "")."\">
85
+	$output .= "<form method=\"POST\" id=\"settingsform\" style=\"width: 35em; margin-right: -2%;\" enctype=\"multipart/form-data\" action=\"admin.php?action=links".($edit ? "&amp;edit=$edit" : "")."\">
86 86
 	<p><label for=\"link_name\">"._NAME.":</label> <input type=\"text\" class=\"textbox\" name=\"link_name\" value=\"$name\"> <br />
87 87
 	<label for=\"link_text\">"._LINKTEXT.":</label> <input type=\"text\" class=\"textbox\" name=\"link_text\" value=\"$text\"><br />
88 88
 	<label for=\"link_key\">"._LINKKEY.":</label> <input type=\"text\" class=\"textbox\" name=\"link_key\" value=\"$accesskey\" size=\"1\"><br />
... ...
@@ -96,7 +96,7 @@ if(isset($_GET['edit']) || isset($_GET["new"])) {
96 96
 		<option value=\"1\"".($access == 1 ? " selected" : "").">"._MEMBERS."</option>
97 97
 		<option value=\"2\"".($access == 2 ? " selected" : "").">"._ADMINS."</option>
98 98
 	</select><br />
99
-	<INPUT type=\"submit\" class=\"button\" name=\"submit\" id=\"submit\" value=\""._SUBMIT."\"></form>";
99
+	<INPUT type=\"submit\" class=\"button\" style=\"margin-left: 31.8%; margin-top: 0.3em;\" name=\"submit\" id=\"submit\" value=\""._SUBMIT."\"></form>";
100 100
 	$output .= write_message(_NAMECONVENTIONS);
101 101
 }
102 102
 else {
... ...
@@ -119,4 +119,4 @@ while($link = dbassoc($linkquery)) {
119 119
 	$output .= "<tr><td class=\"tblborder\" colspan=\"2\" align=\"center\"><a href=\"admin.php?action=links&amp;new=1\">"._ADDNEWLINK."</a></td></tr>";
120 120
 	$output .= "</table>";
121 121
 }
122
-?>
123 122
\ No newline at end of file
123
+?>
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,122 @@
1
+<?php
2
+// ----------------------------------------------------------------------
3
+// Copyright (c) 2007 by Tammy Keefer
4
+// Based on eFiction 1.1
5
+// Copyright (C) 2003 by Rebecca Smallwood.
6
+// http://efiction.sourceforge.net/
7
+// ----------------------------------------------------------------------
8
+// LICENSE
9
+//
10
+// This program is free software; you can redistribute it and/or
11
+// modify it under the terms of the GNU General Public License (GPL)
12
+// as published by the Free Software Foundation; either version 2
13
+// of the License, or (at your option) any later version.
14
+//
15
+// This program is distributed in the hope that it will be useful,
16
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
+// GNU General Public License for more details.
19
+//
20
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
21
+// ----------------------------------------------------------------------
22
+
23
+if(!defined("_CHARSET")) exit( );
24
+
25
+	$output .= "<div id=\"pagetitle\">"._LINKS."</div>";
26
+if(isset($_GET['delete']) && isNumber($_GET['delete'])) {
27
+	$result = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_pagelinks WHERE link_id = $_GET[delete] LIMIT 1");
28
+	if($result) $output .= write_message(_ACTIONSUCCESSFUL);
29
+	else $output .= write_error(_ERROR);
30
+}
31
+if(isset($_POST['submit'])) {
32
+	if(!preg_match("!^[a-z0-9_]{3,30}$!i", $_POST['link_name'])) $output .= write_error(_BADVARNAME);
33
+	else {
34
+		if(isNumber($_POST['link_access'])) $link_access = $_POST['link_access'];
35
+		else $link_access = 0;
36
+		$link_name = descript($_POST['link_name']);
37
+		$link_text = descript($_POST['link_text']);
38
+		$link_url = descript(strip_tags($_POST['link_url']));
39
+		$link_target = descript($_POST['link_target']);
40
+		$link_key = strlen($_POST['link_key']) > 1 ? substr($_POST['link_key'], 0, 1) : $_POST['link_key']; // only one letter please.
41
+		if(isset($_GET['edit']) && isNumber($_GET['edit'])) 
42
+			$result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_pagelinks SET link_name = '".escapestring($link_name)."', link_text = '".escapestring($link_text)."', link_key = '$link_key', link_url = '".escapestring($link_url)."', link_target = '$link_target', link_access = '$link_access' WHERE link_id = $_GET[edit] LIMIT 1");
43
+		else $result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_pagelinks(`link_name`, `link_text`, `link_key`, `link_url`, `link_target`, `link_access`) VALUES('".escapestring($link_name)."', '".escapestring($link_text)."', '".escapestring($link_key)."', '".escapestring($link_url)."', '$link_target', '$link_access')");
44
+		if($result) {
45
+			$output .= write_message(_ACTIONSUCCESSFUL);
46
+			$linkquery = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_pagelinks ORDER BY link_access ASC");
47
+			if(!isset($current)) $current = "";
48
+
49
+			while($link = dbassoc($linkquery)) {
50
+				if($link['link_access'] && !isMEMBER) continue;
51
+				if($link['link_access'] == 2 && !isADMIN) continue;
52
+				$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>");
53
+				$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>");
54
+			}
55
+		}
56
+		else $output .= write_error(_ERROR);
57
+		unset($_GET['edit']);
58
+	}
59
+}
60
+if(isset($_GET['edit']) || isset($_GET["new"])) {
61
+	if(isset($_GET['edit'])) {
62
+		$pagequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_pagelinks WHERE link_id = ".$_GET['edit']." LIMIT 1");
63
+		$link =  dbassoc($pagequery);
64
+		$id = $link['link_id'];
65
+		$name = $link['link_name'];
66
+		$text = $link['link_text'];
67
+		$url = $link['link_url'];
68
+		$target = $link['link_target'];
69
+		$access = $link['link_access'];
70
+		$edit = $_GET['edit'];
71
+		$accesskey = $link['link_key'];
72
+	}
73
+	else {
74
+		$link = "";
75
+		$id = "";
76
+		$name = "";
77
+		$text = "";
78
+		$url = "";
79
+		$target = "";
80
+		$link = "";
81
+		$edit = "";
82
+		$access = 0;
83
+		$accesskey = "";
84
+	}
85
+	$output .= "<form method=\"POST\" id=\"settingsform\" enctype=\"multipart/form-data\" action=\"admin.php?action=links".($edit ? "&amp;edit=$edit" : "")."\">
86
+	<p><label for=\"link_name\">"._NAME.":</label> <input type=\"text\" class=\"textbox\" name=\"link_name\" value=\"$name\"> <br />
87
+	<label for=\"link_text\">"._LINKTEXT.":</label> <input type=\"text\" class=\"textbox\" name=\"link_text\" value=\"$text\"><br />
88
+	<label for=\"link_key\">"._LINKKEY.":</label> <input type=\"text\" class=\"textbox\" name=\"link_key\" value=\"$accesskey\" size=\"1\"><br />
89
+	<label for=\"link_url\">"._URL.":</label> <input type=\"text\" class=\"textbox\" name=\"link_url\" value=\"$url\"><br />
90
+	<label for=\"link_target\">"._TARGET.":</label> <select name=\"link_target\" class=\"textbox\">
91
+		<option value=\"0\"".($target ? "" : " selected").">"._SAMEWINDOW."</option>
92
+		<option value=\"1\"".($target ? " selected" : "").">"._NEWWINDOW."</option>
93
+	</select><br />
94
+	<label for=\"link_access\">"._LINKACCESS.":</label> <select name=\"link_access\" class=\"textbox\">
95
+		<option value=\"0\"".($access ? "" : " selected").">"._ALL."</option>
96
+		<option value=\"1\"".($access == 1 ? " selected" : "").">"._MEMBERS."</option>
97
+		<option value=\"2\"".($access == 2 ? " selected" : "").">"._ADMINS."</option>
98
+	</select><br />
99
+	<INPUT type=\"submit\" class=\"button\" name=\"submit\" id=\"submit\" value=\""._SUBMIT."\"></form>";
100
+	$output .= write_message(_NAMECONVENTIONS);
101
+}
102
+else {
103
+// Re-populate the list of links to reflect any changes we just made.
104
+$linkquery = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_pagelinks ORDER BY link_access ASC");
105
+if(!isset($current)) $current = "";
106
+unset($pagelinks);
107
+	$output .= "<table class=\"tblborder\" style=\"margin: 0 auto;\"><tr><th class=\"tblborder\">"._LINKS."</th><th class=\"tblborder\">"._OPTIONS."</th></tr>";
108
+while($link = dbassoc($linkquery)) {
109
+	if($link['link_access'] && !isMEMBER) continue;
110
+	if($link['link_access'] == 2 && !isADMIN) continue;
111
+	$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>");
112
+	$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>");
113
+	$output .= "<tr><td class=\"tblborder\"><a href=\""._BASEDIR.$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").">".$link['link_text']."</a></td></td>
114
+		<td class=\"tblborder\"><a href=\"admin.php?action=links&amp;edit=".$link['link_id']."\">"._EDIT."</a> | 
115
+		<a href=\"admin.php?action=links&amp;delete=".$link['link_id']."\">"._DELETE."</a></td></tr>";
116
+}
117
+
118
+	if(!dbnumrows($linkquery)) $output .= "<tr><td class=\"tblborder\" colspan=\"2\" align=\"center\">"._NORESULTS."</td></tr>";
119
+	$output .= "<tr><td class=\"tblborder\" colspan=\"2\" align=\"center\"><a href=\"admin.php?action=links&amp;new=1\">"._ADDNEWLINK."</a></td></tr>";
120
+	$output .= "</table>";
121
+}
122
+?>
0 123
\ No newline at end of file