| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,84 @@ |
| 1 |
+<?php |
|
| 2 |
+if(!defined("_CHARSET")) exit( );
|
|
| 3 |
+ |
|
| 4 |
+if(file_exists(_BASEDIR."blocks/shoutbox/{$language}.php")) include_once(_BASEDIR."blocks/shoutbox/{$language}.php");
|
|
| 5 |
+else include_once(_BASEDIR."blocks/shoutbox/en.php"); |
|
| 6 |
+$content = ""; |
|
| 7 |
+if(isset($_POST['shouthidden']) && (isMEMBER || !empty($blocks['shoutbox']['guestshouts']))) {
|
|
| 8 |
+ http_response_code(202); |
|
| 9 |
+ if(isMEMBER) $shout_name = USERUID; |
|
| 10 |
+ else {
|
|
| 11 |
+ $shout_name = trim(descript($_POST['shoutname'])); |
|
| 12 |
+ if(isNumber($shout_name)) $shout_name = _GUEST; |
|
| 13 |
+ if($captcha && !captcha_confirm()) $shout_name = false; |
|
| 14 |
+ } |
|
| 15 |
+ $shout_message = trim($_POST['shout_message']); |
|
| 16 |
+ $shout_message = preg_replace("/^(.{200}).*$/", "$1", $shout_message);
|
|
| 17 |
+ $shout_message = preg_replace("/[^\s]{25}/", "$1\n", $shout_message);
|
|
| 18 |
+ $search = array("\"", "'", "\\", '\"', "\'", "<", ">", " ", "\n");
|
|
| 19 |
+ $replace = array(""", "'", "\", """, "'", "<", ">", " ", " ");
|
|
| 20 |
+ $shout_message = str_replace($search, $replace, replace_naughty(trim($shout_message))); |
|
| 21 |
+ $shout_message = str_replace("\n", "<br />", $shout_message);
|
|
| 22 |
+ if(!empty($shout_name) && !empty($shout_message)) {
|
|
| 23 |
+ dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_shoutbox(`shout_name`, `shout_message`, `shout_datestamp`) VALUES('$shout_name', '$shout_message', '".time()."')");
|
|
| 24 |
+ } |
|
| 25 |
+ |
|
| 26 |
+} |
|
| 27 |
+if(isMEMBER || !empty($blocks['shoutbox']['guestshouts'])) {
|
|
| 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 |
+ }); |
|
| 45 |
+var shoutend = '"._SHOUTEND."'; |
|
| 46 |
+function ismaxlength(obj){
|
|
| 47 |
+var mlength = 200 |
|
| 48 |
+shout_messagelength = document.shoutbox.shout_message.value.length; |
|
| 49 |
+document.shoutbox.counter.value = 200 - shout_messagelength; |
|
| 50 |
+if (document.shoutbox.shout_message.value.length >= mlength) {
|
|
| 51 |
+ alert(shoutend); |
|
| 52 |
+ document.shoutbox.shout_message.value = document.shoutbox.shout_message.value.substr(0, mlength) |
|
| 53 |
+} |
|
| 54 |
+} |
|
| 55 |
+ |
|
| 56 |
+</script><div id='shoutbox_container' style='width: 100%;'>\n<form name='shoutbox' id='shoutbox' method='POST' action='".$_SERVER['SCRIPT_NAME'].($_SERVER['QUERY_STRING'] ? "?".$_SERVER['QUERY_STRING'] : "")."'>\n"; |
|
| 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>"; |
|
| 58 |
+ else $content .= "<div><span class='label'>"._NAME.":</span> ".USERPENNAME."</div>"; |
|
| 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>"; |
|
| 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>"; |
|
| 62 |
+} |
|
| 63 |
+if(isset($blocks['shoutbox']['shoutlimit'])) $shoutlimit = $blocks['shoutbox']['shoutlimit']; |
|
| 64 |
+else $shoutlimit = 10; |
|
| 65 |
+if(!empty($blocks['shoutbox']['shoutdate'])) $shoutdate = $blocks['shoutbox']['shoutdate']; |
|
| 66 |
+else $shoutdate = $dateformat." ".$timeformat; |
|
| 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");
|
|
| 68 |
+$totalshouts = dbnumrows($shouts); |
|
| 69 |
+$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 0, ".$shoutlimit);
|
|
| 70 |
+$content .= "<div id='shoutlist' style='height: 200px; overflow: auto;'>"; |
|
| 71 |
+if(dbnumrows($shouts) != 0) {
|
|
| 72 |
+ while($shout = dbassoc($shouts)) {
|
|
| 73 |
+ if(isNumber($shout['shout_name']) && isset($shout['penname'])) $shoutname = "<a href='"._BASEDIR."viewuser.php?uid=".$shout['shout_name']."'>".$shout['penname']."</a>"; |
|
| 74 |
+ else if(isset($shout['shout_name'])) $shoutname = $shout['shout_name']; |
|
| 75 |
+ else $shout = _GUEST; // Just in case. |
|
| 76 |
+ $content .= "<span class='sbname'>$shoutname</span><br /><span class='sbdatetime'>".date("$shoutdate", $shout['shout_datestamp']);
|
|
| 77 |
+ if(isADMIN) $content .= " [<a href='"._BASEDIR."admin.php?action=blocks&admin=shoutbox&shout_id=".$shout['shout_id']."' class='sbadmin'>"._EDIT."</a>]"; |
|
| 78 |
+ $content .= "</span><br />\n<span class='sbshout'>".stripslashes($shout['shout_message'])."</span><br />"; |
|
| 79 |
+ } |
|
| 80 |
+} |
|
| 81 |
+else $content .= write_message(_NOSHOUTS); |
|
| 82 |
+$content .= "</div>"; |
|
| 83 |
+if($totalshouts > $shoutlimit) $content .= write_message("<a href='"._BASEDIR."blocks/shoutbox/archive.php'>"._SHOUTARCHIVE."</a>");
|
|
| 84 |
+?> |