$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);
$nopl = "checked=\"checked\""; } if ($_POST['nosm']) { $nosm = "checked=\"checked\""; } } else { $prefill = $post['text']; if ($post['options'] & 1) { $nopl = "checked=\"checked\""; } if ($post['options'] & 2) { $nosm = "checked=\"checked\""; } $_POST['mood'] = $post['mood']; } $moodSelects = array(); if ($_POST['mood']) { $moodSelects[(int) $_POST['mood']] = "selected=\"selected\" "; } $moodOptions = Format("<option {0}value=\"0\">" . __("[Default avatar]") . "</option>\n", $moodSelects[0]); $rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $post['user']); while ($mood = Fetch($rMoods)) { $moodOptions .= Format("<option {0}value=\"{1}\">{2}</option>\n", $moodSelects[$mood['mid']], $mood['mid'], htmlspecialchars($mood['name'])); } $fields = array('text' => "<textarea id=\"text\" name=\"text\" rows=\"16\">\n" . htmlspecialchars($prefill) . "</textarea>", 'mood' => "<select size=1 name=\"mood\">" . $moodOptions . "</select>", 'nopl' => "<label><input type=\"checkbox\" {$nopl} name=\"nopl\"> " . __("Disable post layout", 1) . "</label>", 'nosm' => "<label><input type=\"checkbox\" {$nosm} name=\"nosm\"> " . __("Disable smilies", 1) . "</label>", 'btnPost' => "<input type=\"submit\" name=\"actionpost\" value=\"" . __("Save") . "\">", 'btnPreview' => "<input type=\"submit\" name=\"actionpreview\" value=\"" . __("Preview") . "\">"); echo "\n\t<form name=\"postform\" action=\"" . htmlentities(actionLink("editpost", $pid)) . "\" method=\"post\" enctype=\"multipart/form-data\">"; RenderTemplate('form_editpost', array('fields' => $fields)); PostAttachForm($attachs); echo "\n\t\t<input type=\"hidden\" name=\"key\" value=\"{$loguser['token']}\">\n\t</form>\n\t<script type=\"text/javascript\">\n\t\tdocument.postform.text.focus();\n\t</script>\n"; doThreadPreview($tid, $post['date']);