Browse code

Merge branch 'eFiction:master' into master

Jimako authored on 2023/02/20 03:57:10 • GitHub committed on 2023/02/20 03:57:10
Showing 1 changed files
... ...
@@ -4,7 +4,8 @@ if(!defined("_CHARSET")) exit( );
4 4
 if(file_exists(_BASEDIR."blocks/shoutbox/{$language}.php")) include_once(_BASEDIR."blocks/shoutbox/{$language}.php");
5 5
 else include_once(_BASEDIR."blocks/shoutbox/en.php");
6 6
 $content = "";
7
-if(isset($_POST['shout']) && (isMEMBER || !empty($blocks['shoutbox']['guestshouts']))) {
7
+if(isset($_POST['shouthidden']) && (isMEMBER || !empty($blocks['shoutbox']['guestshouts']))) {
8
+	http_response_code(202);
8 9
 	if(isMEMBER) $shout_name = USERUID;
9 10
 	else {
10 11
 		$shout_name = trim(descript($_POST['shoutname']));
... ...
@@ -24,7 +25,23 @@ if(isset($_POST['shout']) && (isMEMBER || !empty($blocks['shoutbox']['guestshout
24 25
 
25 26
 }
26 27
 if(isMEMBER || !empty($blocks['shoutbox']['guestshouts'])) {
27
-	$content = "<script language=\"javascript\" type=\"text/javascript\">
28
+	$content = "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js\"></script>
29
+	<script language=\"javascript\" type=\"text/javascript\">
30
+	$(document).ready(function() {
31
+		$(function () {
32
+		  $('#shout').click( function () {
33
+			$.ajax({
34
+			  type: 'post',
35
+			  url: $('#shoutbox').attr('action'),
36
+			  data: $('#shoutbox').serialize(),
37
+			  success: function () {
38
+				location.reload();
39
+				$('#shout_message').val(\"\");
40
+			  }
41
+			});
42
+		  });
43
+		});
44
+	});
28 45
 var shoutend = '"._SHOUTEND."';
29 46
 function ismaxlength(obj){
30 47
 var mlength = 200
... ...
@@ -40,7 +57,8 @@ if (document.shoutbox.shout_message.value.length >= mlength) {
40 57
 	if(!isMEMBER) $content .= "<div><label for='shoutname'>"._NAME.":</label> <input type='text' name='shoutname' value='' style='display: block; width: 90%; margin: 0 auto;' maxlength='30'></div>";
41 58
 	else $content .= "<div><span class='label'>"._NAME.":</span> ".USERPENNAME."</div>";
42 59
 	if(!isMEMBER && $captcha) $content .= "<div><label for='userdigit'>"._CAPTCHANOTE."</label><input MAXLENGTH=5 SIZE=5 name=\"userdigit\" type=\"text\" value=\"\"><div style='text-align: center;'><img width=120 height=40 src=\""._BASEDIR."includes/button.php\" style=\"border: 1px solid #111;\"></div></div>";
43
-	$content .= "<div><label for='shout_MESSAGE'>"._SHOUT.":</label> <textarea name='shout_message' class='mceNoEditor' id='shout_message' rows='4' cols='15' maxlength='200' style='display: block; width: 90%; margin: 0 auto;' onkeyDown='return ismaxlength(this)'></textarea></div> <input type='submit' name='shout' id='shout' value='"._SHOUT."'> <input size='1' class='small' type='text' id='counter' value='200'></form></div>";
60
+	$content .= "<div><label for='shout_MESSAGE'>"._SHOUT.":</label> <textarea name='shout_message' class='mceNoEditor' id='shout_message' rows='4' cols='15' maxlength='200' style='display: block; width: 90%; margin: 0 auto;' onkeyDown='return ismaxlength(this)'></textarea></div> <input type='button' name='shout' id='shout' value='"._SHOUT."'> <input size='1' class='small' type='text' id='counter' value='200'> <input type='hidden' name='shouthidden' id='shouthidden' value='"._SHOUT."'>
61
+	</form></div>";
44 62
 }
45 63
 if(isset($blocks['shoutbox']['shoutlimit'])) $shoutlimit = $blocks['shoutbox']['shoutlimit'];
46 64
 else $shoutlimit = 10;
... ...
@@ -63,4 +81,4 @@ if(dbnumrows($shouts) != 0) {
63 81
 else $content .= write_message(_NOSHOUTS);
64 82
 $content .= "</div>";
65 83
 if($totalshouts > $shoutlimit) $content .= write_message("<a href='"._BASEDIR."blocks/shoutbox/archive.php'>"._SHOUTARCHIVE."</a>");
66
-?>
67 84
\ No newline at end of file
85
+?>