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,95 @@
1
+<?php
2
+if(!defined("_CHARSET")) exit( );
3
+$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'shoutbox'");
4
+while($block = dbassoc($blockquery)) {
5
+	$blocks[$block['block_name']] = unserialize($block['block_variables']);
6
+	$blocks[$block['block_name']]['title'] = $block['block_title'];
7
+	$blocks[$block['block_name']]['file'] = $block['block_file'];
8
+	$blocks[$block['block_name']]['status'] = $block['block_status'];
9
+}
10
+if(file_exists("blocks/shoutbox/{$language}.php")) include_once("blocks/shoutbox/{$language}.php");
11
+else include_once("blocks/shoutbox/en.php");
12
+	if(isset($_POST['deleteshouts'])) {
13
+		$range = time( ) - ($_POST['del_range'] * 86400);
14
+		$result = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_shoutbox WHERE shout_datestamp < $range");
15
+		if($result) $output .= write_message(_ACTIONSUCCESSFUL);
16
+	}
17
+	if(isset($_GET['delete']) && isNumber($_GET['delete'])) {
18
+		$delete = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_shoutbox WHERE shout_id = '$_GET[delete]' LIMIT 1");
19
+		if($delete) $output .= write_message(_ACTIONSUCCESSFUL);
20
+	}	
21
+	if(isset($_GET['shout_id'])) {
22
+		$output .= "<div class='sectionheader'>"._EDITSHOUT."</div>";
23
+		if(isset($_POST['submit'])) {
24
+			$shout_message = trim($_POST['shout_message']);
25
+			$shout_message = preg_replace("/^(.{200}).*$/", "$1", $shout_message);
26
+			$shout_message = preg_replace("/[^\s]{25}/", "$1\n", $shout_message);
27
+			$search = array("\"", "'", "\\", '\"', "\'", "<", ">", "&nbsp;", "\n");
28
+			$replace = array("&quot;", "&#39;", "&#92;", "&quot;", "&#39;", "&lt;", "&gt;", " ", " ");
29
+			$shout_message = str_replace($search, $replace, replace_naughty(trim($shout_message)));
30
+			$shout_message = str_replace("\n", "<br />", $shout_message);
31
+			$result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_shoutbox SET shout_message = '$shout_message' WHERE shout_id = '".$_GET['shout_id']."' LIMIT 1");
32
+			if($result) $output .= write_message(_ACTIONSUCCESSFUL);
33
+		}
34
+		$shoutquery = dbquery("SELECT shout_message FROM ".TABLEPREFIX."fanfiction_shoutbox WHERE shout_id = '".$_GET['shout_id']."' LIMIT 1");
35
+		$shout = dbassoc($shoutquery);
36
+		if($shout) {
37
+			$output .= "<div style='text-align: center;'>
38
+<form method=\"POST\"  enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=shoutbox&amp;shout_id=".$_GET['shout_id']."\">
39
+<div style='text=align: center; margin: 0 auto;'><textarea name='shout_message' id='shout_message' rows='4' class='mceNoEditor' cols='30'>".$shout['shout_message']."</textarea></div>
40
+<input type='submit' class='button' name='submit' id='submit' value='"._SUBMIT."'>
41
+</form></div>";
42
+		}
43
+		else {
44
+			$output .= write_error(_NORESULTS);
45
+		}
46
+	}
47
+	if(isset($_POST['submitopts'])) {
48
+		$blocks['shoutbox']['shoutdate'] = !empty($_POST['customshoutdate']) ? descript(strip_tags($_POST['customshoutdate'])) : descript(strip_tags($_POST['shoutdate']));
49
+		$blocks['shoutbox']['shoutlimit'] = isset($_POST['shoutlimit']) && isNumber($_POST['shoutlimit']) ? $_POST['shoutlimit'] : 10;
50
+		$blocks['shoutbox']['guestshouts'] = isset($_POST['guestshouts']) && $_POST['guestshouts'] == _YES ? 1 : 0;
51
+		save_blocks($blocks);
52
+	}
53
+	$defaults = array("m/d/y h:i a", "d/m/y G:i:s", "m-d-y h:i a", "d-m-y G:i:s", "m.d.y h:i a", "d.m.y G:i:s", "M j, Y h:i a", "M j, Y G:i:s", "d M, Y h:i a", "d M, Y G:i:s");
54
+	$output .= "<form name='shoutopts' method='POST' id='settingsform' action='admin.php?action=blocks&amp;admin=shoutbox'>\n
55
+<div><label for='shoutdate'>"._SHOUTDATE.":</label><select name='shoutdate' id='shoutdate'><option value=\"\">"._SELECTONE."</option>";
56
+		foreach($defaults as $d) {
57
+			$output .= "<option value='$d'".($blocks['shoutbox']['shoutdate'] == $d ? " selected" : "").">".date("$d")."</option>";
58
+		}
59
+		$output .= "</select> "._OR." <input type='text' name='customshoutdate' class='textbox' value='".(isset($blocks['shoutbox']['shoutdate']) && !in_array($blocks['shoutbox']['shoutdate'], $defaults) ? $blocks['shoutbox']['shoutdate'] : "")."'> <A HREF='#' class='pophelp'>[?]<span>"._HELP_SHOUTDATEFORMAT."</span></A></div>
60
+<div><label for='shoutlimit'>"._SHOUTLIMIT.":</label><input type='text' name='shoutlimit' size='1' value='".(isset($blocks['shoutbox']['shoutlimit']) ? $blocks['shoutbox']['shoutlimit'] : "")."'></div>
61
+<div class='fieldset'><span class='label'>"._GUESTSHOUTS.":</span>\n
62
+<input type='radio' name='guestshouts' id='guestshouts"._YES."' value='"._YES."'".(!empty($blocks['shoutbox']['guestshouts'])  ? " checked='checked'" : "")."> <label for='guestshouts"._YES."'>"._YES."</label>\n
63
+<input type='radio' name='guestshouts' id='guestshouts"._YES."' value='"._NO."'".(empty($blocks['shoutbox']['guestshouts'])  ? " checked='checked'" : "")."> <label for='guestshouts"._NO."'>"._NO."</label>\n</div>\n
64
+<input type='submit' class='button' name='submitopts' id='submit' value='"._SUBMIT."'></form>";
65
+$shouts = dbquery("SELECT shouts.*, "._PENNAMEFIELD." as penname FROM ".TABLEPREFIX."fanfiction_shoutbox as shouts LEFT JOIN "._AUTHORTABLE." ON "._UIDFIELD." = shouts.shout_name ORDER BY shout_datestamp DESC");
66
+$totalshouts = dbnumrows($shouts);
67
+$shouts = dbquery("SELECT shouts.*, "._PENNAMEFIELD." as penname FROM ".TABLEPREFIX."fanfiction_shoutbox as shouts LEFT JOIN "._AUTHORTABLE." ON "._UIDFIELD." = shouts.shout_name ORDER BY shout_datestamp DESC LIMIT $offset, $itemsperpage");
68
+if($totalshouts > 0) {
69
+	$output .= "<form name='deleteform' method='POST'action='admin.php?action=blocks&amp;admin=shoutbox'>\n
70
+<div style='text-align: center;'>"._DELETESHOUTS."<select name='del_range' class='textbox'>\n
71
+<option value='90'>90</option>\n
72
+<option value='60'>60</option>\n
73
+<option value='30'>30</option>\n
74
+<option value='20'>20</option>\n
75
+<option value='10'>10</option>\n
76
+</select>"._DAYS."<br />
77
+<input type='submit' name='deleteshouts' class='button' value='"._DELETE."'></div></form>";
78
+	$output .= "<div class='sectionheader'>"._SHOUTARCHIVE."</div><div style='width: 80%;margin: 0 auto;'>";
79
+	if(!empty($blocks['shoutbox']['shoutdate'])) $shoutdate = $blocks['shoutbox']['shoutdate'];
80
+	else $shoutdate = $dateformat." ".$timeformat;
81
+	while($shout = dbassoc($shouts)) {
82
+		if(isNumber($shout['shout_name']) && isset($shout['penname'])) $shoutname = "<a href='viewuser.php?uid=".$shout['shout_name']."'>".$shout['penname']."</a>";
83
+		else if(isset($shout['shout_name'])) $shoutname = $shout['shout_name'];
84
+		else $shout = _GUEST; // Just in case.
85
+		$output .= "
86
+<div class='tblborder'><span class='sbname'>$shoutname</span><br />\n
87
+<span class='sbshout'>".stripslashes($shout['shout_message'])."</span><br />\n
88
+<span class='sbdatetime'>".date("$shoutdate", $shout['shout_datestamp'])." [<a href='admin.php?action=blocks&amp;admin=shoutbox&amp;delete=".$shout['shout_id']."' class='sbadmin'>"._DELETE."</a>] [<a href='admin.php?action=blocks&amp;admin=shoutbox&amp;shout_id=".$shout['shout_id']."' class='sbadmin'>"._EDIT."</a>]</span></div>\n<br />";
89
+	}
90
+	$output .= "</div>";
91
+	if($totalshouts > $itemsperpage) $output .= build_pagelinks("admin.php?action=blocks&amp;admin=shoutbox&amp;", $totalshouts, $offset);
92
+}
93
+else $output .= write_message(_NOSHOUTS);
94
+
95
+?>
0 96
\ No newline at end of file