function talkform($section, $talkline, $limit = 10, $schema = false) { require_once "lib/forms.php"; global $REQUEST_URI, $session, $translation_namespace; if ($schema === false) { $schema = $translation_namespace; } tlschema("commentary"); $jump = false; if (isset($session['user']['prefs']['nojump']) && $session['user']['prefs']['nojump'] == true) { $jump = true; } $counttoday = 0; if (substr($section, 0, 5) != "clan-") { $sql = "SELECT author FROM " . db_prefix("commentary") . " WHERE section='{$section}' AND postdate>'" . date("Y-m-d 00:00:00") . "' ORDER BY commentid DESC LIMIT {$limit}"; $result = db_query($sql); while ($row = db_fetch_assoc($result)) { if ($row['author'] == $session['user']['acctid']) { $counttoday++; } } if (round($limit / 2, 0) - $counttoday <= 0 && getsetting('postinglimit', 1)) { if ($session['user']['superuser'] & ~SU_DOESNT_GIVE_GROTTO) { output("`n`)(You'd be out of posts if you weren't a superuser or moderator.)`n"); } else { output("`n`)(You are out of posts for the time being. Once some of your existing posts have moved out of the comment area, you'll be allowed to post again.)`n"); return false; } } } if (translate_inline($talkline, $schema) != "says") { $tll = strlen(translate_inline($talkline, $schema)) + 11; } else { $tll = 0; } $req = comscroll_sanitize($REQUEST_URI) . "&comment=1"; $req = str_replace("?&", "?", $req); if (!strpos($req, "?")) { $req = str_replace("&", "?", $req); } if ($jump) { $req .= "#{$section}"; } addnav("", $req); // *** AJAX CHAT MOD START *** //output_notl("<form action=\"$req\" method='POST' autocomplete='false'>",true); $args1 = array("formline" => "<form action=\"{$req}\" id='commentaryform' method='post' autocomplete='false'", "section" => $section, "talkline" => $talkline, "schema" => $schema); $args1 = modulehook("commentarytalkline", $args1); rawoutput('<div id="commentaryformcontainer">'); output_notl($args1['formline'] . ">", true); // *** AJAX CHAT MOD END *** previewfield("insertcommentary", $session['user']['name'], $talkline, true, array("size" => "40", "maxlength" => 200 - $tll)); rawoutput("<input type='hidden' name='talkline' value='{$talkline}'>"); rawoutput("<input type='hidden' name='schema' value='{$schema}'>"); rawoutput("<input type='hidden' name='counter' value='{$session['counter']}'>"); $session['commentcounter'] = $session['counter']; if ($section == "X") { $vname = getsetting("villagename", LOCATION_FIELDS); $iname = getsetting("innname", LOCATION_INN); $sections = commentarylocs(); reset($sections); output_notl("<select name='section'>", true); while (list($key, $val) = each($sections)) { output_notl("<option value='{$key}'>{$val}</option>", true); } output_notl("</select>", true); } else { output_notl("<input type='hidden' name='section' value='{$section}'>", true); } $add = htmlentities(translate_inline("Add"), ENT_QUOTES, getsetting("charset", "ISO-8859-1")); // *** DRAGONBG.COM CORE PATCH START*** output_notl("<input type='submit' class='button' value='{$add}'>\t", true); modulehook("commentarytrail", array()); // *** DRAGONBG.COM CORE PATCH END*** // *** AJAX CHAT MOD START *** //if (round($limit/2,0)-$counttoday < 3 && getsetting('postinglimit',1)){ // output("`)(You have %s posts left today)`n`0",(round($limit/2,0)-$counttoday)); //} rawoutput("<div id='previewtext'></div></form>"); rawoutput('</div>'); // *** AJAX CHAT MOD END *** tlschema(); }
} rawoutput("<script type='text/javascript'>var superusers = new Array();"); foreach ($superusers as $val) { rawoutput(" superusers['" . addslashes($val) . "'] = true;"); } rawoutput("</script>"); output("`@`bSubject:`b`0"); if ($replyTo == '') { output("<input name='subject' value='%s' autofocus><br>", htmlent($subject), true); } else { output("<input name='subject' value='%s'><br>", htmlent($subject), true); } rawoutput("<div id='warning' style='visibility: hidden; display: none;'>"); output("`@`bNotice:`b `^{$superusermessage}`0`n"); rawoutput("</div>"); output("`@`bBody:`b`0`n"); require_once 'lib/forms.php'; previewfield('body', '`^', false, false, ['type' => 'textarea', 'class' => 'input', 'cols' => 60, 'rows' => 9, 'onKeyDown' => 'sizeCount(this);'], htmlent($body) . htmlent(stripslashes(httpget('body')))); $send = translate_inline('Send'); rawoutput("<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n <tr>\n <td>\n <input type='submit' class='button' value='{$send}'>\n </td>\n <td align='right'>\n <div id='sizemsg'></div>\n </td>\n </tr>\n </table>"); rawoutput("</form>"); $sizeLimit = getsetting('mailsizelimit', 1024); $sizeMsg = sprintf_translate(["`#Max message size is `@%s`#, you have `^XX`# characters left.", $sizeLimit]); $sizeMsgOver = sprintf_translate(["`\$Max message size is `@%s`\$, you are over by `^XX`\$ characters!", $sizeLimit]); $sizeMsg = explode('XX', $sizeMsg); $sizeMsgOver = explode('XX', $sizeMsgOver); $uSize1 = addslashes("<span>" . appoencode($sizeMsg[0]) . "</span>"); $uSize2 = addslashes("<span>" . appoencode($sizeMsg[1]) . "</span>"); $oSize1 = addslashes("<span>" . appoencode($sizeMsgOver[0]) . "</span>"); $oSize2 = addslashes("<span>" . appoencode($sizeMsgOver[1]) . "</span>"); rawoutput("<script type='text/javascript'>\n var maxlen = {$sizeLimit};\n function sizeCount(box)\n {\n if (box == null) {\n return;\n }\n var len = box.value.length;\n var msg = '';\n if (len <= maxlen) {\n msg = '{$usize1}' + (maxlen - len) + '{$usize2}';\n }\n else {\n msg = '{$osize1}' + (len - maxlen) + '{$osize2}';\n }\n document.getElementById('sizemsg').innerHTML = msg;\n }\n sizeCount(document.getElementById('inputbody'));\n function check_su_warning()\n {\n var to = document.getElementById('to');\n var warning = document.getElementById('warning');\n if (superusers[to.value]) {\n warning.style.visibility = 'visible';\n warning.style.display = 'inline';\n }\n else {\n warning.style.visibility = 'hidden';\n warning.style.display = 'none';\n }\n }\n check_su_warning();\n </script>");
output_notl("</select>`n", true); } } rawoutput("<script type='text/javascript'>var superusers = new Array();"); foreach ($superusers as $val) { rawoutput("\tsuperusers['" . addslashes($val) . "'] = true;"); } rawoutput("</script>"); output("`2Subject:"); rawoutput("<input name='subject' value=\"" . htmlentities($subject) . htmlentities(stripslashes(httpget('subject')), ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\"><br>"); rawoutput("<div id='warning' style='visibility: hidden; display: none;'>"); output("`2Notice: `^{$superusermessage}`n"); rawoutput("</div>"); output("`2Body:`n"); require_once "lib/forms.php"; previewfield("body", "`^", false, false, array("type" => "textarea", "class" => "input", "cols" => "60", "rows" => "9", "onKeyDown" => "sizeCount(this);"), htmlentities($body, ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . htmlentities(stripslashes(httpget('body')), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))); //rawoutput("<textarea name='body' id='textarea' class='input' cols='60' rows='9' onKeyUp='sizeCount(this);'>".htmlentities($body, ENT_COMPAT, getsetting("charset", "ISO-8859-1")).htmlentities(stripslashes(httpget('body')), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</textarea><br>"); $send = translate_inline("Send"); rawoutput("<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td><input type='submit' class='button' value='{$send}'></td><td align='right'><div id='sizemsg'></div></td></tr></table>"); rawoutput("</form>"); $sizemsg = "`3Max message size is `@%s`3, you have `^XX`3 characters left."; $sizemsg = translate_inline($sizemsg); $sizemsg = sprintf($sizemsg, getsetting("mailsizelimit", 1024)); $sizemsgover = "`\$Max message size is `@%s`\$, you are over by `^XX`\$ characters!"; $sizemsgover = translate_inline($sizemsgover); $sizemsgover = sprintf($sizemsgover, getsetting("mailsizelimit", 1024)); $sizemsg = explode("XX", $sizemsg); $sizemsgover = explode("XX", $sizemsgover); $usize1 = addslashes("<span>" . appoencode($sizemsg[0]) . "</span>"); $usize2 = addslashes("<span>" . appoencode($sizemsg[1]) . "</span>"); $osize1 = addslashes("<span>" . appoencode($sizemsgover[0]) . "</span>");
function talkform($section, $talkline, $limit = 10, $schema = false) { require_once "lib/forms.php"; global $REQUEST_URI, $session, $translation_namespace, $chatsonpage; if ($schema === false) { $schema = $translation_namespace; } tlschema("commentary"); $jump = true; if (isset($session['user']['prefs']['nojump']) && $session['user']['prefs']['nojump'] == true) { $jump = false; } if ($jump && httpget('comment') && httppost('focus') == $section) { $focus = true; } else { $focus = false; } if (!isset($session['user']['prefs']['ucol'])) { $session['user']['prefs']['ucol'] = false; } if (translate_inline($talkline, $schema) != "says") { $tll = strlen(translate_inline($talkline, $schema)) + 11; } else { $tll = 0; } $req = buildcommentarylink("&comment=1"); if ($jump) { $req .= "#commentaryjump_" . $section; } addnav("", $req); // *** AJAX CHAT MOD START *** output_notl("<form action=\"{$req}\" method='POST' autocomplete='false'>", true); $args1 = array("formline" => "<form action=\"{$req}\" id='commentaryform' method='post' autocomplete='false'", "section" => $section, "talkline" => $talkline, "schema" => $schema); // $args1 = modulehook("commentarytalkline",$args1); //rawoutput('<div id="commentaryformcontainer">'); output_notl($args1['formline'] . ">", true); // *** AJAX CHAT MOD END *** global $fiveminuteload; if ($session['user']['prefs']['commentary_auto_update'] && !httpget('comscroll') && $fiveminuteload < 8) { $jsec = strtolower($section); $jsec = str_replace("_", "", $jsec); $jsec = str_replace("-", "", $jsec); $jsec = str_replace(",", "0", $jsec); //debug($jsec); previewfield("insertcommentary", $session['user']['name'], $talkline, true, array("size" => "30", "maxlength" => 255 - $tll), false, $jsec, $session['user']['prefs']['ucol'], $focus); rawoutput("<script type=\"text/javascript\">\r\n\t\t\tvar typetimelimit" . $jsec . " = 0;\r\n\t\t\tvar timebetween" . $jsec . " = 1500;\r\n\t\t\tvar oldchars" . $jsec . " = 'xxxxx';\r\n\t\t\tvar newchars" . $jsec . " = 'xxxxx';\r\n\t\t\tvar newchars" . $jsec . " = document.getElementById('input" . $jsec . "').value;\r\n\t\t\tvar oldchars" . $jsec . " = newchars" . $jsec . ";\r\n\t\t\tfunction typedisplay" . $jsec . "() {\r\n\t\t\t\ttypetimelimit" . $jsec . " ++;\r\n\t\t\t\tnewchars" . $jsec . " = document.getElementById('input" . $jsec . "').value;\r\n\t\t\t\t\r\n\t\t\t\tif (window.XMLHttpRequest){\r\n\t\t\t\t\t// code for IE7+, Firefox, Chrome, Opera, Safari\r\n\t\t\t\t\ttxmlhttp" . $jsec . "=new XMLHttpRequest();\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// code for IE6, IE5\r\n\t\t\t\t\ttxmlhttp" . $jsec . "=new ActiveXObject(\"Microsoft.XMLHTTP\");\r\n\t\t\t\t}\r\n\t\t\t\ttxmlhttp" . $jsec . ".onreadystatechange=function(){\r\n\t\t\t\t\tif (txmlhttp" . $jsec . ".readyState==4 && txmlhttp" . $jsec . ".status==200 && typetimelimit" . $jsec . " < 600){\r\n\t\t\t\t\t\tdocument.getElementById(\"typedisplay" . $jsec . "\").innerHTML = txmlhttp" . $jsec . ".responseText;\r\n\t\t\t\t\t\tttimer" . $jsec . "=setTimeout(\"typedisplay" . $jsec . "()\",timebetween" . $jsec . ");\r\n\t\t\t\t\t\tttimeopen" . $jsec . " = typetimelimit" . $jsec . " * 2;\r\n\t\t\t\t\t\tttimeleft" . $jsec . " = 600 - ttimeopen" . $jsec . ";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (oldchars" . $jsec . ".length!=newchars" . $jsec . ".length){\r\n\t\t\t\t\ttxmlhttp" . $jsec . ".open(\"GET\",\"whostyping.php?section=" . $section . "&updateplayer=1\",true);\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttxmlhttp" . $jsec . ".open(\"GET\",\"whostyping.php?section=" . $section . "&updateplayer=0\",true);\r\n\t\t\t\t}\r\n\t\t\t\ttxmlhttp" . $jsec . ".send();\r\n\t\t\t\toldchars" . $jsec . " = newchars" . $jsec . ";\r\n\t\t\t}\r\n\t\t\ttypedisplay" . $jsec . "();\r\n\t\t</script>"); } else { if ($fiveminuteload >= 8) { output("Server load is currently too high for auto-update chat. This will hopefully balance out in a few minutes.`n"); } previewfield("insertcommentary", $session['user']['name'], $talkline, true, array("size" => "30", "maxlength" => 255 - $tll), false, false, $session['user']['prefs']['ucol']); //debug("System load too high at ".$fiveminuteload); } rawoutput("<input type='hidden' name='talkline' value='{$talkline}'>"); rawoutput("<input type='hidden' name='schema' value='{$schema}'>"); rawoutput("<input type='hidden' name='focus' value='{$section}'>"); rawoutput("<input type='hidden' name='counter' value='{$session['counter']}'>"); $session['commentcounter'] = $session['counter']; if ($section == "X") { $vname = getsetting("villagename", LOCATION_FIELDS); $iname = getsetting("innname", LOCATION_INN); $sections = commentarylocs(); reset($sections); output_notl("<select name='section'>", true); while (list($key, $val) = each($sections)) { output_notl("<option value='{$key}'>{$val}</option>", true); } output_notl("</select>", true); } else { output_notl("<input type='hidden' name='section' value='{$section}'>", true); } $add = htmlentities(translate_inline("Add"), ENT_QUOTES, getsetting("charset", "ISO-8859-1")); // *** DRAGONBG.COM CORE PATCH START*** output_notl("<input type='submit' class='button' value='{$add}'>\t", true); // *** DRAGONBG.COM CORE PATCH END*** rawoutput("</form>"); tlschema(); }