キケッツ掲示板のリポジトリです. https://bbs.kekec.wiki
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

400 lines
17 KiB

  1. <?php
  2. require "${_SERVER['DOCUMENT_ROOT']}/database.php";
  3. if (isset ($_GET['page'])):
  4. $page = $_GET['page'];
  5. else:
  6. $page = 0;
  7. endif;
  8. if (isset ($_GET['thread'])):
  9. $thread = $_GET['thread'];
  10. else:
  11. $thread = -1;
  12. endif;
  13. if (isset ($_GET['sort'])):
  14. $sort = $_GET['sort'];
  15. if (!(in_array ($sort, array ('td', 'eg', 'ta', 'eb')))):
  16. $sort = 'td';
  17. endif;
  18. else:
  19. $sort = 'td';
  20. endif;
  21. // 画像のディレクトリを開く.
  22. $dir = 'image/';
  23. $handle = opendir ($dir);
  24. // MySQL 宣言
  25. $mysqli = set_mysql ('miteruzo_bbs');
  26. $mysqli -> set_charset ('utf8');
  27. if ($result = $mysqli -> query ("SELECT * FROM threads WHERE id = $thread")):
  28. $row = $result -> fetch_assoc ();
  29. $title = $row['title'];
  30. $explain = $row['explain'];
  31. $result -> close ();
  32. endif;
  33. if (isset ($_GET['id'])
  34. && isset ($_GET['evaluate'])
  35. && (($_GET['evaluate'] == 'good') || ($_GET['evaluate'] == 'bad'))):
  36. $mysqli -> query ("
  37. UPDATE
  38. responses
  39. SET
  40. {$_GET['evaluate']} = {$_GET['evaluate']} + 1
  41. WHERE
  42. (thread_id = $thread) AND (response_id = {$_GET['id']})");
  43. header ("Location: ./?thread=$thread&sort=$sort");
  44. endif;
  45. ?>
  46. <!DOCTYPE html>
  47. <html lang="ja">
  48. <head>
  49. <meta charset="UTF-8" />
  50. <meta name="robots" content="noindex" />
  51. <title><?= ($title == '') ? '' : ($title . ' - ') ?>キケッツチャンネル お絵描き掲示板</title>
  52. <link rel="stylesheet" href="https://jpafonts.osdn.jp/webfonts/jpafonts.css" />
  53. <link rel="stylesheet" type="text/css" href="/style.css" />
  54. <link rel="stylesheet" type="text/css" href="style.css" />
  55. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css" />
  56. <script defer src="https://use.fontawesome.com/releases/v5.15.4/js/all.js"></script>
  57. <script src="modules/colour-pad.js"></script>
  58. </head>
  59. <body>
  60. <!-- <div style="font-size: 500%">
  61. メンテ中
  62. </div> -->
  63. <div id="modal" class="modal">
  64. <div class="modal-content">
  65. <h3>Canvas のサイズを変更</h3>
  66. <form>
  67. <div style="margin-bottom: 16px">
  68. <div>
  69. <label for="width">幅:</label>
  70. <input type="number" id="change-width" name="width" value="480" min="32" max="640" />
  71. <label>(32 〜 640)</label>
  72. </div>
  73. <div>
  74. <label for="height">高さ:</label>
  75. <input type="number" id="change-height" name="height" value="480" min="24" max="480" />
  76. <label>(24 〜 480)</label>
  77. </div>
  78. </div>
  79. <button type="button" onclick="closeModal ()">取消</button>
  80. <button type="button" onclick="applyResolution ()">適用</button>
  81. </form>
  82. </div>
  83. </div>
  84. <h1><a href="."><img src="/img/kusobbs.gif" alt="クソ掲示板" style="width: 398px" /></a></h1>
  85. <div style="text-align: center"><a href="#" onclick="PauseMusic ()" id="mute">&emsp;</a></div>
  86. <?php
  87. if ($thread == -1):
  88. ?>
  89. <form action="make_thread.php" method="POST">
  90. スレ名:<input type="text" name="thread-name" /><br />
  91. スレ内容:<textarea name="thread-explain"></textarea><br />
  92. <input type="submit" value="スレ立て" />
  93. </form>
  94. <?php
  95. if ($result = $mysqli -> query ("SELECT * FROM threads WHERE id <> 1 ORDER BY latest DESC")):
  96. while ($row = $result -> fetch_assoc ()):
  97. ?>
  98. <table width="90%">
  99. <thead>
  100. <tr><td class="header"><a href="?thread=<?= $row['id'] ?>"><?= $row['title'] ?></a>&emsp;更新:1<?= $row['latest'] ?>&emsp;<?= $row['length'] ?> レス</td></tr>
  101. </thead>
  102. <?php
  103. if ($row['explain'] != '<p></p>'):
  104. ?>
  105. <tbody>
  106. <tr><td><?= $row['explain'] ?></td></tr>
  107. </tbody>
  108. </table>
  109. <?php
  110. endif; // end of ($row['explain'] != '<p></p>')
  111. endwhile; // end of ($row = $result -> fetch_assoc ())
  112. endif; // end of ($result = $mysqli -> query ("SELECT * FROM threads ORDER BY latest DESC"))
  113. else: // $thread != -1
  114. ?>
  115. <table width="90%">
  116. <thead>
  117. <tr><td class="header"><?= $title ?></td></tr>
  118. </thead>
  119. <?php
  120. if ($explain != '<p></p>'):
  121. ?>
  122. <tbody>
  123. <tr><td><?= $explain ?></td></tr>
  124. </tbody>
  125. <?php
  126. endif;
  127. ?>
  128. </table>
  129. <form id="message-form">
  130. <label>名前:</label><input type="text" id="user-name" name="name" /><br />
  131. <label>削除用パスワード:</label><input type="password" id="password" name="password" />
  132. <!-- <textarea id="message" name="message"></textarea> -->
  133. </form>
  134. <div id="paint">
  135. <div style="display: flex; justify-content: center">
  136. <div class="button-area" style="margin-right: 64px">
  137. <button id="new">新規作成</button>
  138. <button id="send">送信</button>
  139. <button id="save">ダウンロード</button>
  140. <button id="change-size">サイズ変更</button>
  141. </div>
  142. <div class="button-area" style="vertical-align: middle">
  143. <button id="undo">←</button>
  144. <button id="redo">→</button>
  145. </div>
  146. </div>
  147. <div style="display: flex; width: max-content; flex-direction: column">
  148. <div class="radio">
  149. <form id="mode">
  150. <label>モード:</label>
  151. <label><input type="radio" name="mode" value="pen" id="pen" checked />ペン</label>
  152. <label><input type="radio" name="mode" value="rubber" id="rubber" />消しゴム</label>
  153. <label><input type="radio" name="mode" value="bucket" id="bucket" />塗りつぶし</label>
  154. </form>
  155. </div>
  156. <div class="radio">
  157. <label>取込み:</label>
  158. <input id="load" type="file" onChange="LoadFile (this.files)" />
  159. </div>
  160. <div class="radio">
  161. <form id="colour">
  162. <label>色:</label>
  163. <!-- <input type="radio" name="colour" value="black" checked="checked" />黒
  164. <input type="radio" name="colour" value="blue" />ブルー
  165. <input type="radio" name="colour" value="red" />赤
  166. <input type="radio" name="colour" value="magenta" />マジェンタ
  167. <input type="radio" name="colour" value="lime" />ライム
  168. <input type="radio" name="colour" value="cyan" />青
  169. <input type="radio" name="colour" value="yellow" />イェロウ
  170. <input type="radio" name="colour" value="white" />白 -->
  171. <button id="colour-picker" type="button" onclick="cmanCP_JS_open(this)" cmanCPat="def_color:cns=#000000,rc_form:RGBA,rc_func:changeColour">選択</button>
  172. <label id="irorororo">黒</label>
  173. </form>
  174. </div>
  175. <div class="radio">
  176. <form id="size">
  177. <label>太さ:</label>
  178. <label><input type="radio" name="size" value="1" />1</label>
  179. <label><input type="radio" name="size" value="2" />2</label>
  180. <label><input type="radio" name="size" value="3" checked="checked" />3</label>
  181. <label><input type="radio" name="size" value="5" />5</label>
  182. <label><input type="radio" name="size" value="7" />7</label>
  183. <label><input type="radio" name="size" value="10" />10</label>
  184. <label><input type="radio" name="size" value="15" />15</label>
  185. <!-- <input type="range" name="size" min="1" max="57" value="3" /> -->
  186. <label><input type="radio" name="size" value="0" />指定:
  187. <input style="width: 2em" type="number" name="size" id="size-free" value="57" /></label>
  188. </form>
  189. </div>
  190. <div class="radio">
  191. <form id="layer">
  192. <label>レイア:</label>
  193. <label><input onclick="reDraw ()" type="radio" name="layer" value="0" checked="checked" />基底</label>
  194. <label><input onclick="reDraw ()" type="radio" name="layer" value="1" />1</label>
  195. <label><input onclick="reDraw ()" type="radio" name="layer" value="2" />2</label>
  196. <button type="button" name="del">削除</button>
  197. <button type="button" name="down">下へ</button>
  198. <button type="button" name="up">上へ</button>
  199. <button type="button" name="add">追加</button>
  200. <br />
  201. <label><input onclick="reDraw ()" type="checkbox" name="sep" />レイアを分けて表示</label>
  202. </form>
  203. </div>
  204. </div>
  205. <div class="canvas-area" id="canvas-area">
  206. <canvas id="canvas" width="480" height="480"></canvas>
  207. <!-- <canvas id="canvas1" width="480" height="480"></canvas> -->
  208. <!-- <canvas id="canvas2" width="480" height="480"></canvas> -->
  209. </div>
  210. </div>
  211. <form name="sort">
  212. <label>
  213. 並べ替え:
  214. <select id="sort" style="font-size: 24px">
  215. <option value="time-desc"<?= ($sort == 'td') ? ' selected="selected"' : '' ?>>投稿が新しい順</option>
  216. <option value="evaluate-good"<?= ($sort == 'eg') ? ' selected="selected"' : '' ?>>評価が高い順</option>
  217. <option value="time-asc"<?= ($sort == 'ta') ? ' selected="selected"' : '' ?>>投稿が古い順</option>
  218. <option value="evaluate-bad"<?= ($sort == 'eb') ? ' selected="selected"' : '' ?>>評価が低い順</option>
  219. </select>
  220. </label>
  221. </form>
  222. <div id="bbs">
  223. <?php
  224. // スレ内のレスをすべて取得
  225. if ($result = $mysqli -> query ("
  226. SELECT
  227. response_id as id, name, message, date, image, held, deleted, pass, good, bad, good - bad as evaluate
  228. FROM
  229. responses
  230. WHERE
  231. thread_id = $thread
  232. ORDER BY
  233. " . (($sort == 'td')
  234. ? 'id DESC'
  235. : (($sort == 'eg')
  236. ? 'evaluate DESC, id DESC'
  237. : (($sort == 'ta')
  238. ? 'id ASC'
  239. : (($sort == 'eb')
  240. ? 'evaluate ASC, id DESC'
  241. : 'id DESC')))))):
  242. while ($row = $result -> fetch_assoc ()):
  243. ?>
  244. <table width="90%" id="<?= $row['id'] ?>">
  245. <thead>
  246. <tr>
  247. <td class="header">
  248. <div style="margin: 0 8px">
  249. <div style="float: left"><?= $row['id'] ?>:
  250. <?= (($row['name'] == '')
  251. ? '名なしさん'
  252. : $row['name']) ?>
  253. </div>
  254. <div style="text-align: right">
  255. 1<?= date ('Y/m/d H:i:s', strtotime ($row['date'])) ?>
  256. </div>
  257. </div>
  258. <div style="display: grid;
  259. grid-template-columns: auto <?= ($row['good'] + $row['bad'] == 0) ? '.48fr' : ((.96 * $row['bad'] / ($row['good'] + $row['bad'])) . 'fr') ?> <?= ($row['good'] + $row['bad'] == 0) ? '.48fr' : ((.96 * $row['good'] / ($row['good'] + $row['bad'])) . 'fr') ?> auto;
  260. align-items: center;
  261. margin-top: 8px;
  262. margin-left: auto;
  263. margin-right: auto;
  264. width: 90%;
  265. font-size: 80%">
  266. <div style="grid-columns: 1; text-align: left;">
  267. <a style="color: blue; white-space: nowrap" title="低評価"
  268. href="?thread=<?= $thread ?>&sort=<?= $sort ?>&evaluate=bad&id=<?= $row['id'] ?>#<?= $row['id'] ?>">
  269. <i class="fas fa-thumbs-down"></i>&thinsp;<?= $row['bad'] ?>
  270. </a>
  271. </div>
  272. <div style="grid-columns: 2;
  273. background-color: blue;
  274. text-align: center;
  275. height: 40%">
  276. &nbsp;
  277. </div>
  278. <div style="grid-columns: 3;
  279. background-color: red;
  280. text-align: center;
  281. height: 40%">
  282. &nbsp;
  283. </div>
  284. <div style="grid-columns: 4; text-align: right">
  285. <a style="color: red" title="高評価" href="?thread=<?= $thread ?>&sort=<?= $sort ?>&evaluate=good&id=<?= $row['id'] ?>#<?= $row['id'] ?>">
  286. <?= $row['good'] ?>&thinsp;<i class="fas fa-thumbs-up"></i>
  287. </a>
  288. </div>
  289. </div>
  290. </td>
  291. </tr>
  292. </thead>
  293. <tbody>
  294. <?php
  295. // 特殊なメッシジ
  296. if ($row['deleted']): // 削除された場合
  297. ?>
  298. <tr><td><p>削除されました.</p></td></tr>
  299. <?php
  300. elseif ($row['held']): // 保留中の場合
  301. ?>
  302. <tr><td><p>確認中です.</p></td></tr>
  303. <?php
  304. else:
  305. ?>
  306. <tr><td class="illust" style="display: grid; grid-template-columns: .375fr auto .375fr; align-items: end"><div style="grid-columns: 1"></div><div style="grid-columns: 2; text-align: center"><img style="border: solid 1px"src="<?= $dir . $row['image'] ?>" /></div><div style="grid-columns: 3; justify-self: end; margin-right: 8px; margin-bottom: 8px; font-size: 80%"><a href="#del" onclick="deletePost (<?= $row['id'] ?>)">削除</a></div></td></tr>
  307. <?php
  308. endif;
  309. ?>
  310. </tbody>
  311. </table>
  312. <?php
  313. endwhile;
  314. // MySQL を閉ぢる.
  315. $result -> close ();
  316. endif;
  317. ?>
  318. </div>
  319. <h3 id="del">レス削除</h3>
  320. 削除したいレス番号と削除用パスワードを入力して &ldquo;削除&rdquo; を押してください.<br />
  321. <label>レス番号:</label><input type="text" id="del-id" /><br />
  322. <label>削除用パスワード:</label><input type="password" id="del-pass" /><br />
  323. <button id="delete" onclick="deletePostReally ()">削除</button>
  324. <?php
  325. endif;
  326. ?>
  327. <hr />
  328. <footer>
  329. <div class="attention">
  330. このサイトでは,<a href="https://moji.or.jp/ipafont/license/" target="_blank">IPA フォントライセンス v1.0</a> で公開されてゐる <a href="https://jpafonts.osdn.jp/" target="_blank">JPA フォント</a>を使用してゐます.
  331. </div>
  332. <div class="copyright">
  333. &copy; このペィジへの投稿は,すべて,パブリック・ドメインとします.
  334. </div>
  335. </footer>
  336. <canvas style="display: none" width="1" height="1" id="work"></canvas>
  337. <canvas style="display: none" width="480" height="480" id="canvas-perfect"></canvas>
  338. <script type="text/javascript" src="script.js"></script>
  339. <?php
  340. if ($thread != -1):
  341. ?>
  342. <script type="text/javascript" src="paint.js"></script>
  343. <?php
  344. endif;
  345. ?>
  346. </body>
  347. </html>