report.php
1 <?php 2 3 // where is report_get_style i can't find it anywhere? 4 function report_get_style_new( $group ) 5 { 6 $style = ( $group == 'nws_style' ) ? 'yotsubanew' : 'yotsubluenew'; 7 8 return '//s.4cdn.org/css/' . $style . '.' . CSS_VERSION . '.css'; 9 } 10 11 function report_head( $no, $success = 0, $altCaptcha = false ) 12 { 13 $defaultcss = DEFAULT_BURICHAN ? 'yotsubluenew' : 'yotsubanew'; 14 15 if (TEST_BOARD) { 16 $cssVersion = CSS_VERSION_TEST; 17 $core_js = 'test/core-8psvqAqszI.' . JS_VERSION_TEST; 18 } 19 else { 20 $cssVersion = CSS_VERSION; 21 $core_js = 'core.min.' . JS_VERSION_CORE; 22 } 23 24 $sg = style_group(); 25 26 $styles = array( 27 'Yotsuba New' => "yotsubanew.$cssVersion.css", 28 'Yotsuba B New' => "yotsubluenew.$cssVersion.css", 29 'Futaba New' => "futabanew.$cssVersion.css", 30 'Burichan New' => "burichannew.$cssVersion.css", 31 'Photon' => "photon.$cssVersion.css", 32 'Tomorrow' => "tomorrow.$cssVersion.css" 33 ); 34 35 if( !$no ) $no = $_GET['no']; 36 37 $no = (int)$no; 38 39 $css = ''; 40 41 if( isset( $_COOKIE[$sg] ) ) { 42 if( isset( $styles[$_COOKIE[$sg]] ) ) { 43 $css = '<link rel="stylesheet" title="switch" href="' . STATIC_SERVER . 'css/' . $styles[$_COOKIE[$sg]] . '">'; 44 } 45 } else { 46 $dcssl = $defaultcss . '.' . $cssVersion . '.css'; 47 $css = '<link rel="stylesheet" title="switch" href="' . STATIC_SERVER . 'css/' . $dcssl . '">'; 48 } 49 50 ?> 51 <!DOCTYPE html> 52 <html> 53 <head> 54 <title>Report Post No.<?=$no ? $no : ""?></title> 55 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 56 <meta name="viewport" content="width=device-width,initial-scale=1"> 57 <?=$css?> 58 <style> 59 fieldset, #pass, button, .rules { margin-bottom: 10px; } 60 fieldset { width: 320px; } 61 fieldset legend { font-size: 11pt; font-weight: bold; } 62 .pass-msg { font-size: smaller; } 63 #cat-sel { width: 280px; } 64 .rules { font-size: 10pt; } 65 .tw:before { 66 border-bottom: 1px solid; 67 border-left: 1px solid; 68 content: " "; 69 display: inline-block; 70 height: 8px; 71 margin-bottom: 3px; 72 margin-right: 3px; 73 width: 8px; 74 } 75 .tw:before { 76 margin-left: 5px; 77 } 78 .tw { 79 margin-left: 5px; 80 margin-top: 2px; 81 margin-bottom: 12px; 82 } 83 </style> 84 <script>var style_group = "<?=style_group()?>";</script> 85 <script type="text/javascript" src="<?=STATIC_SERVER?>js/<?php echo $core_js ?>.js"></script> 86 <script type="text/javascript"> 87 function get_cookie(name) { 88 var nameEQ = name + "="; 89 var ca = document.cookie.split(';'); 90 for (var i = 0; i < ca.length; i++) { 91 var c = ca[i]; 92 while (c.charAt(0) == ' ') c = c.substring(1, c.length); 93 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 94 } 95 return null; 96 } 97 98 function onReportKeyDown(e) { 99 if (e.keyCode == 27 && !e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey) { 100 self.close(); 101 } 102 } 103 104 function onCatChange(e) { 105 document.getElementById('cat-sel').disabled = !document.getElementById('cat1').checked; 106 } 107 108 function onDOMReady(e) { 109 var el; 110 111 if (el = document.getElementById('cat1')) { 112 el.addEventListener('change', onCatChange, false); 113 document.getElementById('cat2').addEventListener('change', onCatChange, false); 114 115 onCatChange(); 116 } 117 118 119 if (readCookie('pass_enabled') == 1 && (el = document.getElementById('pass'))) { 120 el.innerHTML = '<strong>You are using a 4chan Pass.</strong>'; 121 } 122 123 <?php if( $success ): ?> 124 if (window.opener) { 125 window.opener.postMessage('done-report-<?=$no?>-<?php echo BOARD_DIR ?>', '*'); 126 } 127 <?php endif; ?> 128 } 129 130 document.addEventListener('DOMContentLoaded', onDOMReady, false); 131 132 document.addEventListener('keydown', onReportKeyDown, false); 133 134 function postBack() { 135 if (window.opener) { 136 window.opener.postMessage('done-report', '*'); 137 } 138 139 self.close(); 140 } 141 </script> 142 </head> 143 <? 144 } 145 146 function fancydie($err, $success = 0) { 147 report_head( 0, $success ); 148 149 $needs_back_button = in_array($err, array(S_NOCAPTCHA, S_BADCAPTCHA, S_CAPTCHATIMEOUT)); 150 151 $err = "<body><h3><font color='#FF0000'>$err</font></h3>"; 152 153 if ($needs_back_button) { 154 $err .= "<br>[<a href=''>Back</a>]</body></html>"; 155 } 156 else { 157 if ($success) { 158 $err .= "<script language=\"JavaScript\">setTimeout(\"self.close()\", 3000);</script>"; 159 } 160 $err .= "<br>[<a href='javascript:postBack()'>Close</a>]</body></html>"; 161 } 162 163 die($err); 164 } 165 166 167 function form_report($board, $no, $no_captcha = false) { 168 report_head($no, 0); 169 $cats = get_report_categories($board, $no, DEFAULT_BURICHAN == 1); 170 ?> 171 <body> 172 <form action='' method="POST"> 173 <fieldset id="reportTypes" style="padding: 3px;"> 174 <legend>Report type</legend> 175 <input type="radio" name="cat" id="cat1" value="" checked> <label for="cat1">This post violates a <a href='//www.<?php echo L::d(BOARD_DIR) ?>/rules#<?php echo $board?>' target="_blank">rule</a>.</label><div class="tw"><select name="cat_id" id="cat-sel"><option value=""></option><?php foreach ($cats['rule'] as $cat_id => $cat): ?> 176 <option value="<?php echo $cat_id ?>"><?php echo $cat['title'] ?></option><?php endforeach ?></select></div> 177 <input type="radio" name="cat" id="cat2" value="<?php echo $cats['illegal']['id'] ?>"> <label for="cat2"><?php echo $cats['illegal']['title'] ?></label><br/> 178 </fieldset> 179 <div id="pass"> 180 <?php 181 if (!$no_captcha && !isset($_COOKIE['4chan_auser']) && !isset($_COOKIE['pass_enabled'])) { 182 $style_group = style_group(); 183 184 $dark = isset($_COOKIE[$style_group]) && $_COOKIE[$style_group] === 'Tomorrow'; 185 186 if (CAPTCHA_TWISTER) { 187 echo twister_captcha_form(); 188 echo "<script>document.addEventListener('DOMContentLoaded', function() { TCaptcha.init(document.getElementById('t-root'), '" . BOARD_DIR . "', 1); }, false);</script>"; 189 } 190 else { 191 echo captcha_form(true, null, $dark); 192 } 193 ?> 194 <span class="pass-msg">4chan Pass users can bypass this CAPTCHA. [<a href="https://www.<?php echo L::d(BOARD_DIR) ?>/pass" target="_blank">More Info</a>]</span> 195 <?php 196 } 197 ?> 198 </div> 199 <div class="rules">Submitting <b>false</b> or <b>misclassified</b> reports will result in a ban.</div> 200 <button type="submit">Submit</button> 201 <input type="hidden" name="board" value="<?php echo htmlspecialchars($board) ?>"> 202 <input type="hidden" name="no" value="<?php echo((int)$no) ?>"> 203 </form> 204 <?php 205 }