if ($_POST['mood']) { $moodSelects[(int) $_POST['mood']] = "selected=\"selected\" "; } $moodOptions = "<option " . $moodSelects[0] . "value=\"0\">" . __("[Default avatar]") . "</option>\n"; $rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $loguserid); while ($mood = Fetch($rMoods)) { $moodOptions .= format("\n\t<option {0} value=\"{1}\">{2}</option>\n", $moodSelects[$mood['mid']], $mood['mid'], htmlspecialchars($mood['name'])); } $ninja = FetchResult("select id from {posts} where thread={0} order by date desc limit 0, 1", $tid); $mod_lock = ''; if (HasPermission('mod.closethreads', $fid)) { if (!$thread['closed']) { $mod_lock = "<label><input type=\"checkbox\" " . getCheck("lock") . " name=\"lock\"> " . __("Close thread", 1) . "</label>\n"; } else { $mod_lock = "<label><input type=\"checkbox\" " . getCheck("unlock") . " name=\"unlock\"> " . __("Open thread", 1) . "</label>\n"; } } $mod_stick = ''; if (HasPermission('mod.stickthreads', $fid)) { if (!$thread['sticky']) { $mod_stick = "<label><input type=\"checkbox\" " . getCheck("stick") . " name=\"stick\"> " . __("Sticky", 1) . "</label>\n"; } else { $mod_stick = "<label><input type=\"checkbox\" " . getCheck("unstick") . " name=\"unstick\"> " . __("Unstick", 1) . "</label>\n"; } } $fields = array('text' => "<textarea id=\"text\" name=\"text\" rows=\"16\">\n{$prefill}</textarea>", 'mood' => "<select size=1 name=\"mood\">" . $moodOptions . "</select>", 'nopl' => "<label><input type=\"checkbox\" " . getCheck('nopl') . " name=\"nopl\"> " . __("Disable post layout", 1) . "</label>", 'nosm' => "<label><input type=\"checkbox\" " . getCheck('nosm') . " name=\"nosm\"> " . __("Disable smilies", 1) . "</label>", 'lock' => $mod_lock, 'stick' => $mod_stick, 'btnPost' => "<input type=\"submit\" name=\"actionpost\" value=\"" . __("Post") . "\">", 'btnPreview' => "<input type=\"submit\" name=\"actionpreview\" value=\"" . __("Preview") . "\">"); echo "\n\t<form name=\"postform\" action=\"" . htmlentities(actionLink("newreply", $tid)) . "\" method=\"post\" enctype=\"multipart/form-data\">\n\t\t<input type=\"hidden\" name=\"ninja\" value=\"{$ninja}\">"; RenderTemplate('form_newreply', array('fields' => $fields)); PostAttachForm($attachs); echo "\n\t\t</form>\n\t<script type=\"text/javascript\">\n\t\tdocument.postform.text.focus();\n\t</script>\n"; doThreadPreview($tid);
return "checked=\"checked\""; } else { return ""; } } if ($_POST['mood']) { $moodSelects[(int) $_POST['mood']] = "selected=\"selected\" "; } $moodOptions = "<option " . $moodSelects[0] . "value=\"0\">" . __("[Default avatar]") . "</option>\n"; $rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $loguserid); while ($mood = Fetch($rMoods)) { $moodOptions .= format("\n\t<option {0} value=\"{1}\">{2}</option>\n", $moodSelects[$mood['mid']], $mood['mid'], htmlspecialchars($mood['name'])); } $ninja = FetchResult("select id from {posts} where thread={0} order by date desc limit 0, 1", $tid); if (CanMod($loguserid, $fid)) { $mod = "\n\n<!-- Mod options -->\n"; if (!$thread['closed']) { $mod .= "<label><input type=\"checkbox\" " . getCheck("lock") . " name=\"lock\"> " . __("Close thread", 1) . "</label>\n"; } else { $mod .= "<label><input type=\"checkbox\" " . getCheck("unlock") . " name=\"unlock\"> " . __("Open thread", 1) . "</label>\n"; } if (!$thread['sticky']) { $mod .= "<label><input type=\"checkbox\" " . getCheck("stick") . " name=\"stick\"> " . __("Sticky", 1) . "</label>\n"; } else { $mod .= "<label><input type=\"checkbox\" " . getCheck("unstick") . " name=\"unstick\"> " . __("Unstick", 1) . "</label>\n"; } $mod .= "\n\n"; } $form = "\n\t\t<form name=\"postform\" action=\"" . actionLink("newreply", $tid) . "\" method=\"post\">\n\t\t\t<input type=\"hidden\" name=\"ninja\" value=\"{$ninja}\" />\n\t\t\t<table class=\"outline margin width100\">\n\t\t\t\t<tr class=\"header1\">\n\t\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\t\t" . __("New reply") . "\n\t\t\t\t\t</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"cell0\">\n\t\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t\t<textarea id=\"text\" name=\"text\" rows=\"16\" style=\"width: 98%;\">{$prefill}</textarea>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"cell2\">\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<input type=\"submit\" name=\"actionpost\" value=\"" . __("Post") . "\" />\n\t\t\t\t\t\t<input type=\"submit\" name=\"actionpreview\" value=\"" . __("Preview") . "\" />\n\t\t\t\t\t\t<select size=\"1\" name=\"mood\">\n\t\t\t\t\t\t\t{$moodOptions}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"nopl\" " . getCheck("nopl") . " /> " . __("Disable post layout", 1) . "\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"nosm\" " . getCheck("nosm") . " /> " . __("Disable smilies", 1) . "\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$tid}\" />\n\t\t\t\t\t\t{$mod}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</form>"; doPostForm($form); doThreadPreview($tid);
<input type="text" name="pollOption[' . $i . ']" value="' . $opttext . '" size=48 maxlength=40> Color: <input type="text" name="pollColor[' . $i . ']" value="' . $color . '" size=10 maxlength=7 class="color {hash:true,required:false,pickerFaceColor:\'black\',pickerFace:3,pickerBorder:0,pickerInsetColor:\'black\',pickerPosition:\'left\',pickerMode:\'HVS\'}"> <input type="submit" name="pollRemove[' . $i . ']" value="×" onclick="removeOption(this.parentNode);return false;"> </div>'; } } $pollSettings .= '</div>'; $pollSettings .= '<input type="submit" name="pollAdd" value="' . __('Add option') . '" onclick="addOption();return false;">'; $moodSelects = array(); if ($_POST['mood']) { $moodSelects[(int) $_POST['mood']] = "selected=\"selected\" "; } $moodOptions = "<option " . $moodSelects[0] . "value=\"0\">" . __("[Default avatar]") . "</option>\n"; $rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $loguserid); while ($mood = Fetch($rMoods)) { $moodOptions .= format("\n\t<option {0} value=\"{1}\">{2}</option>\n", $moodSelects[$mood['mid']], $mood['mid'], htmlspecialchars($mood['name'])); } $mod_lock = ''; $mod_stick = ''; if (HasPermission('mod.closethreads', $forum['id'])) { $mod_lock = "<label><input type=\"checkbox\" " . getCheck("lock") . " name=\"lock\"> " . __("Close thread", 1) . "</label>\n"; } if (HasPermission('mod.stickthreads', $forum['id'])) { $mod_stick = "<label><input type=\"checkbox\" " . getCheck("stick") . " name=\"stick\"> " . __("Sticky", 1) . "</label>\n"; } $fields = array('title' => "<input type=\"text\" name=\"title\" size=80 maxlength=\"60\" value=\"{$trefill}\">", 'icon' => $iconSettings, 'pollQuestion' => "<input type=\"text\" name=\"pollQuestion\" value=\"" . htmlspecialchars($_POST['pollQuestion']) . "\" size=80 maxlength=\"100\">", 'pollOptions' => $pollSettings, 'pollMultivote' => "<label><input type=\"checkbox\" " . ($_POST['multivote'] ? "checked=\"checked\"" : "") . " name=\"multivote\"> " . __("Multivote", 1) . "</label>", 'text' => "<textarea id=\"text\" name=\"text\" rows=\"16\">\n{$prefill}</textarea>", 'mood' => "<select size=1 name=\"mood\">" . $moodOptions . "</select>", 'nopl' => "<label><input type=\"checkbox\" " . getCheck('nopl') . " name=\"nopl\"> " . __("Disable post layout", 1) . "</label>", 'nosm' => "<label><input type=\"checkbox\" " . getCheck('nosm') . " name=\"nosm\"> " . __("Disable smilies", 1) . "</label>", 'lock' => $mod_lock, 'stick' => $mod_stick, 'btnPost' => "<input type=\"submit\" name=\"actionpost\" value=\"" . __("Post") . "\">", 'btnPreview' => "<input type=\"submit\" name=\"actionpreview\" value=\"" . __("Preview") . "\">", 'btnAddPoll' => "<input type=\"submit\" name=\"addpoll\" value=\"" . __("Add poll") . "\" onclick=\"addPoll();return false;\">", 'btnRemovePoll' => "<input type=\"submit\" name=\"deletepoll\" value=\"" . __("Remove poll") . "\" onclick=\"removePoll();return false;\">"); echo "\n\t<script src=\"" . resourceLink("js/threadtagging.js") . "\"></script>\n\t<script src=\"" . resourceLink('js/polleditor.js') . "\"></script>\n\t<form name=\"postform\" action=\"" . htmlentities(actionLink("newthread", $fid)) . "\" method=\"post\" enctype=\"multipart/form-data\">"; RenderTemplate('form_newthread', array('fields' => $fields, 'pollMode' => (int) $_POST['poll'])); PostAttachForm($attachs); echo "\n\t\t<input type=\"hidden\" name=\"poll\" id=\"pollModeVal\" value=\"" . (int) $_POST['poll'] . "\">\n\t</form>\n\t<script type=\"text/javascript\">\n\t\tdocument.postform.text.focus();\n\t</script>\n"; LoadPostToolbar();
$fixed = htmlspecialchars($_POST['pollOption' . $pops]); $pollOptions .= format("\n\t\t\t\t\t\t<tr class=\"cell{0}\">\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label for=\"p{1}\">" . __("Option {2}") . "</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" id=\"p{1}\" name=\"pollOption{1}\" value=\"{3}\" style=\"width: 50%;\" maxlength=\"40\" > \n\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t" . __("Color", 1) . " \n\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"pollColor{1}\" value=\"{4}\" size=\"10\" maxlength=\"7\" class=\"color {hash:true,required:false,pickerFaceColor:'black',pickerFace:3,pickerBorder:0,pickerInsetColor:'black',pickerPosition:'left',pickerMode:'HVS'}\" />\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t{5}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n", $cellClass, $pops, $pops + 1, $fixed, filterPollColors($_POST['pollColor' . $pops]), $first ? " (#rrggbb)" : ""); $first = false; } $multivote = "<label><input type=\"checkbox\" " . ($_POST['multivote'] ? "checked=\"checked\"" : "") . " name=\"multivote\" /> " . __("Multivote", 1) . "</label>"; $pollSettings = "\n\t\t<tr class=\"cell0\">\n\t\t\t<td>\n\t\t\t\t<label for=\"pq\">\n\t\t\t\t\t" . __("Poll question") . "\n\t\t\t\t</label>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" id=\"pq\" name=\"pollQuestion\" value=\"" . htmlspecialchars($_POST['pollQuestion']) . "\" style=\"width: 98%;\" maxlength=\"100\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell1\">\n\t\t\t<td>\n\t\t\t\t<label for=\"pn\">\n\t\t\t\t\t" . __("Number of options") . "\n\t\t\t\t</label>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" id=\"pn\" name=\"pollOptions\" value=\"" . htmlspecialchars($_POST['pollOptions']) . "\" size=\"2\" maxlength=\"2\" />\n\t\t\t\t<input type=\"submit\" name=\"actionsetpoll\" value=\"" . __("Set") . "\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell0\">\n\t\t\t<td>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{$multivote}\n\t\t\t</td>\n\t\t</tr>\n\t\t{$pollOptions}"; $pollSettings .= "<tr class=\"cell1\"><td></td><td><input type=\"submit\" name=\"deletepoll\" value=\"" . __("Delete poll") . "\" /></td></tr>"; } else { $pollSettings = "<tr class=\"cell1\"><td></td><td><input type=\"submit\" name=\"addpoll\" value=\"" . __("Add poll") . "\" /></td></tr>"; } $pollSettings = "\n\t<tr class=\"cell0\"><td colspan=\"2\"></td></tr>\n\t{$pollSettings}\n\t<tr class=\"cell0\"><td colspan=\"2\"></td></tr>"; if ($_POST['mood']) { $moodSelects[(int) $_POST['mood']] = "selected=\"selected\" "; } $moodOptions = "<option " . $moodSelects[0] . "value=\"0\">" . __("[Default avatar]") . "</option>\n"; $rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $loguserid); while ($mood = Fetch($rMoods)) { $moodOptions .= format("\n\t<option {0} value=\"{1}\">{2}</option>\n", $moodSelects[$mood['mid']], $mood['mid'], htmlspecialchars($mood['name'])); } if (CanMod($loguserid, $forum['id'])) { $mod = "\n\n<!-- Mod options -->\n"; $mod .= "<label><input type=\"checkbox\" " . getCheck("lock") . " name=\"lock\"> " . __("Close thread", 1) . "</label>\n"; $mod .= "<label><input type=\"checkbox\" " . getCheck("stick") . " name=\"stick\"> " . __("Sticky", 1) . "</label>\n"; } if (!$_POST['poll'] || $_POST['pollOptions']) { $postButton = "<input type=\"submit\" name=\"actionpost\" value=\"" . __("Post") . "\" /> "; } echo "<script src=\"" . resourceLink("js/threadtagging.js") . "\"></script>"; echo "\n\t<script type=\"text/javascript\">\n\t\t\twindow.addEventListener(\"load\", hookUpControls, false);\n\t</script>"; $form = "\n\t\t<form name=\"postform\" action=\"" . actionLink("newthread", $fid) . "\" method=\"post\">\n\t\t\t<table class=\"outline margin width100\">\n\t\t\t\t<tr class=\"header1\">\n\t\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\t\t" . __("New thread") . "\n\t\t\t\t\t</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"cell0\">\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<label for=\"tit\">\n\t\t\t\t\t\t\t" . __("Title") . "\n\t\t\t\t\t\t</label>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td id=\"threadTitleContainer\">\n\t\t\t\t\t\t<input type=\"text\" id=\"tit\" name=\"title\" style=\"width: 98%;\" maxlength=\"60\" value=\"{$trefill}\" />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"cell1\">\n\t\t\t\t\t<td>\n\t\t\t\t\t\t" . __("Icon") . "\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class=\"threadIcons\">\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<input type=\"radio\" {$iconNoneChecked} name=\"iconid\" value=\"0\" />\n\t\t\t\t\t\t\t<span>" . __("None") . "</span>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t{$icons}\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<input type=\"radio\" {$iconCustomChecked} name=\"iconid\" value=\"255\" />\n\t\t\t\t\t\t\t<span>" . __("Custom") . "</span>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<input type=\"text\" id=\"iconurl\" name=\"iconurl\" style=\"width: 50%;\" maxlength=\"100\" value=\"" . htmlspecialchars($_POST['iconurl']) . "\" />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t{$pollSettings}\n\t\t\t\t<tr class=\"cell0\">\n\t\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t\t<textarea id=\"text\" name=\"text\" rows=\"16\" style=\"width: 98%;\">{$prefill}</textarea>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"cell2\">\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{$postButton}\n\t\t\t\t\t\t<input type=\"submit\" name=\"actionpreview\" value=\"" . __("Preview") . "\" />\n\t\t\t\t\t\t<select size=\"1\" name=\"mood\">\n\t\t\t\t\t\t\t{$moodOptions}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"nopl\" " . getCheck("nopl") . " /> " . __("Disable post layout", 1) . "\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"nosm\" " . getCheck("nosm") . " /> " . __("Disable smilies", 1) . "\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$fid}\" />\n\t\t\t\t\t\t<input type=\"hidden\" name=\"poll\" value=\"" . htmlspecialchars($_POST['poll']) . "\" />\n\t\t\t\t\t\t{$mod}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</form>"; doPostForm($form);