function RenderBody() { global $currentUser; if (!get_login_id()) { require_once("box-login.php"); $box = new PouetBoxLogin(); $box->RenderBody(); } else { if (!$currentUser->CanPostInBBS()) return; echo "<form action='add.php' method='post'>\n"; $csrf = new CSRFProtect(); $csrf->PrintToken(); echo "<div class='content'>\n"; echo " <input type='hidden' name='type' value='bbs'>\n"; echo " <label for='topic'>topic:</label>\n"; echo " <input name='topic' id='topic'/>\n"; echo " <label for='category'>category:</label>\n"; echo " <select name='category' id='category'>\n"; foreach($this->categories as $v) printf("<option value='%s'>%s</option>",_html($v),_html($v)); echo " </select>\n"; echo " <label for='message'>message:</label>\n"; echo " <textarea name='message' id='message'></textarea>\n"; echo " <div><a href='faq.php#BB Code'><b>BB Code</b></a> is allowed here</div>\n"; echo "</div>\n"; echo "<div class='foot'>\n"; echo " <script language='JavaScript' type='text/javascript'>\n"; echo " <!--\n"; echo " document.observe('dom:loaded',function(){ AddPreviewButton($('submit')); });\n"; echo " //-->\n"; echo " </script>\n"; echo " <input type='submit' value='Submit' id='submit'>"; echo "</div>\n"; echo "</form>\n"; } }
function RenderBody() { global $currentUser; if (!$currentUser) { require_once("box-login.php"); $box = new PouetBoxLogin(); $box->RenderBody(); } else { if (!$currentUser->CanPostInProdComments()) return; echo "<form action='add.php' method='post' id='frmProdComment'>\n"; $csrf = new CSRFProtect(); $csrf->PrintToken(); echo "<div class='content'>\n"; echo " <input type='hidden' name='which' value='".(int)$this->prod."'>\n"; echo " <input type='hidden' name='type' value='comment'>\n"; if (!$this->myVote) { echo " <div id='prodvote'>\n"; echo " this prod\n"; echo " <input type='radio' name='rating' id='ratingrulez' value='rulez'/> <label for='ratingrulez'>rulez</label>\n"; echo " <input type='radio' name='rating' id='ratingpig' value='isok' checked='true'/> <label for='ratingpig'>is ok</label>\n"; echo " <input type='radio' name='rating' id='ratingsucks' value='sucks'/> <label for='ratingsucks'>sucks</label>\n"; echo " </div>\n"; } echo " <textarea name='comment' id='comment'></textarea>\n"; echo " <div><a href='faq.php#BB Code'><b>BB Code</b></a> is allowed here</div>\n"; echo "</div>\n"; echo "<div class='foot'>\n"; echo " <input type='submit' value='Submit' id='submit'>"; echo "</div>\n"; echo "</form>\n"; ?> <script language="JavaScript" type="text/javascript"> <!-- document.observe("dom:loaded",function(){ $$(".tools").each(function(item){ var cid = item.readAttribute("data-cid"); item.update("<a href='#'>quote</a> |"); item.down("a").observe("click",function(e){ e.stop(); new Ajax.Request("ajax_prodcomment.php",{ "method":"post", "parameters":$H({"id":cid}).toQueryString(), "onSuccess":function(transport){ $("comment").value += "[quote]" + transport.responseJSON.comment.strip() + "[/quote]"; try { $("comment").scrollTo(); } catch(ex) {} // needs try-catch because of some dumbass popup blockers } }); }); }); AddPreviewButton($('submit')); PreparePostForm( $$("#pouetbox_prodpost form").first() ); }); //--> </script> <? } }