PageRenderTime 57ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/post.php

https://github.com/Dratone/EveBB
PHP | 949 lines | 713 code | 146 blank | 90 comment | 233 complexity | 5d7700bae610a8f7e755ea0809e547d6 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * Copyright (C) 2008-2010 FluxBB
  4. * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
  5. * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  6. */
  7. define('PUN_ROOT', dirname(__FILE__).'/');
  8. require PUN_ROOT.'include/common.php';
  9. require PUN_ROOT.'include/poll.php';
  10. require PUN_ROOT.'include/attach/attach_incl.php'; //Attachment Mod row, loads variables, functions and lang file
  11. if ($pun_user['g_read_board'] == '0')
  12. message($lang_common['No view']);
  13. $tid = isset($_GET['tid']) ? intval($_GET['tid']) : 0;
  14. $fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0;
  15. if ($tid < 1 && $fid < 1 || $tid > 0 && $fid > 0) {
  16. message($lang_common['Bad request']);
  17. } //End if.
  18. //Let's quickly build their group list for the SQL.
  19. $group_list = '';
  20. if (!empty($pun_user['group_ids'])) {
  21. foreach ($pun_user['group_ids'] as $g) {
  22. $group_list .= ' OR fp.group_id='.$g;
  23. } //End foreach().
  24. } //End if.
  25. // Fetch some info about the topic and/or the forum
  26. $sql = '';
  27. if ($tid) {
  28. if ($pun_user['g_id'] == PUN_ADMIN) {
  29. $sql = '
  30. SELECT
  31. f.id,
  32. f.forum_name,
  33. f.moderators,
  34. f.redirect_url,
  35. t.subject,
  36. t.closed,
  37. s.user_id AS is_subscribed
  38. FROM
  39. '.$db->prefix.'topics AS t
  40. INNER JOIN
  41. '.$db->prefix.'forums AS f
  42. ON
  43. f.id=t.forum_id
  44. LEFT JOIN
  45. '.$db->prefix.'topic_subscriptions AS s
  46. ON
  47. (t.id=s.topic_id AND s.user_id='.$pun_user['id'].')
  48. WHERE
  49. t.id='.$tid;
  50. } else {
  51. $sql = '
  52. SELECT
  53. f.id,
  54. f.forum_name,
  55. f.moderators,
  56. f.redirect_url,
  57. t.subject,
  58. t.closed,
  59. s.user_id AS is_subscribed
  60. FROM
  61. '.$db->prefix.'topics AS t
  62. INNER JOIN
  63. '.$db->prefix.'forums AS f
  64. ON
  65. f.id=t.forum_id
  66. LEFT JOIN
  67. '.$db->prefix.'forum_perms AS fp
  68. ON
  69. (fp.forum_id=f.id AND (fp.group_id='.$pun_user['g_id'].' '.$group_list.'))
  70. LEFT JOIN
  71. '.$db->prefix.'topic_subscriptions AS s
  72. ON
  73. (t.id=s.topic_id AND s.user_id='.$pun_user['id'].')
  74. WHERE
  75. fp.read_forum=1
  76. AND
  77. t.id='.$tid;
  78. } //End if - else.
  79. $result = $db->query($sql) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
  80. } else {
  81. if ($pun_user['g_id'] == PUN_ADMIN) {
  82. $sql = '
  83. SELECT
  84. f.id,
  85. f.forum_name,
  86. f.moderators,
  87. f.redirect_url
  88. FROM
  89. '.$db->prefix.'forums AS f
  90. WHERE
  91. f.id='.$fid;
  92. } else {
  93. $sql = '
  94. SELECT
  95. f.id,
  96. f.forum_name,
  97. f.moderators,
  98. f.redirect_url,
  99. fp.post_replies,
  100. fp.post_topics
  101. FROM
  102. '.$db->prefix.'forums AS f
  103. LEFT JOIN
  104. '.$db->prefix.'forum_perms AS fp
  105. ON
  106. (fp.forum_id=f.id AND (fp.group_id='.$pun_user['g_id'].' '.$group_list.'))
  107. WHERE
  108. fp.read_forum=1 AND f.id='.$fid;
  109. } //End if.
  110. $result = $db->query($sql) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
  111. } //End if - else.
  112. if (!$db->num_rows($result)) {
  113. message($lang_common['Bad request']);
  114. } //End if.
  115. $cur_posting = $db->fetch_assoc($result);
  116. $is_subscribed = $tid && $cur_posting['is_subscribed'];
  117. // Is someone trying to post into a redirect forum?
  118. if ($cur_posting['redirect_url'] != '')
  119. message($lang_common['Bad request']);
  120. // Sort out who the moderators are and if we are currently a moderator (or an admin)
  121. $mods_array = ($cur_posting['moderators'] != '') ? unserialize($cur_posting['moderators']) : array();
  122. $is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
  123. if ($tid && $pun_config['o_censoring'] == '1')
  124. $cur_posting['subject'] = censor_words($cur_posting['subject']);
  125. // Do we have permission to post?
  126. if ((($tid && (($cur_posting['post_replies'] == '0' || $pun_user['g_post_replies'] == '0') || $cur_posting['post_replies'] == '0')) ||
  127. ($fid && (($cur_posting['post_topics'] == '0' || $pun_user['g_post_topics'] == '0') || $cur_posting['post_topics'] == '0')) ||
  128. (isset($cur_posting['closed']) && $cur_posting['closed'] == '1')) &&
  129. !$is_admmod)
  130. message($lang_common['No permission']);
  131. // Load the post.php language file
  132. require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php';
  133. // Start with a clean slate
  134. $errors = array();
  135. if (isset($_POST['preview']) && isset($_POST['as_xml'])) {
  136. if ($pun_user['is_guest']) {
  137. $error = '<?xml version=\'1.0\' encoding=\'UTF-8\'?>
  138. <result><error><![CDATA[Unable to access preview.]]></error></result>';
  139. } //End if.
  140. require_once PUN_ROOT.'include/parser.php';
  141. $preview = '<?xml version=\'1.0\' encoding=\'UTF-8\'?>
  142. <result><preview><![CDATA[
  143. <h2><span>'.$lang_post['Post preview'].'</span></h2>
  144. <div class="box">
  145. <div class="inbox">
  146. <div class="postbody">
  147. <div class="postright">
  148. <div class="postmsg">
  149. %s
  150. </div>
  151. </div>
  152. </div>
  153. </div>
  154. </div>
  155. ]]></preview></result>';
  156. echo sprintf($preview, parse_message(pun_linebreaks(pun_trim($_POST['req_message'])), isset($_POST['hide_smilies'])));
  157. exit;
  158. } //End if.
  159. // Did someone just hit "Submit" or "Preview"?
  160. if (isset($_POST['form_sent']))
  161. {
  162. // Make sure form_user is correct
  163. if (($pun_user['is_guest'] && $_POST['form_user'] != 'Guest') || (!$pun_user['is_guest'] && $_POST['form_user'] != $pun_user['username']))
  164. message($lang_common['Bad request']);
  165. // Flood protection
  166. if (!isset($_POST['preview']) && $pun_user['last_post'] != '' && (time() - $pun_user['last_post']) < $pun_user['g_post_flood'])
  167. $errors[] = $lang_post['Flood start'].' '.$pun_user['g_post_flood'].' '.$lang_post['flood end'];
  168. //See if they have a valid CAK type and are thus allowed to post.
  169. if ($pun_config['o_eve_req_cak'] == '1' && !$pun_user['is_guest']) {
  170. $sql = "SELECT * FROM ".$db->prefix."api_auth AS a INNER JOIN ".$db->prefix."api_selected_char AS s ON a.api_character_id=s.character_id WHERE s.user_id=".$pun_user['id'];
  171. if (!$result = $db->query($sql)) {
  172. $errors[] = "Failed to fetch information about you!".$sql;
  173. } else {
  174. if ($db->num_rows($result) != 1) {
  175. $errors[] = "Unable to fetch information about you!";
  176. } else {
  177. $result = $db->fetch_assoc($result);
  178. if ($pun_config['o_eve_cak_type'] > $result['cak_type']) {
  179. $errors[] = "You are unable to post until you update your API information.";
  180. } //End if.
  181. } //End if - else.
  182. } //End if - else.
  183. } //End if.
  184. // If it's a new topic
  185. if ($fid)
  186. {
  187. $subject = pun_trim($_POST['req_subject']);
  188. if ($pun_config['o_censoring'] == '1')
  189. $censored_subject = pun_trim(censor_words($subject));
  190. if ($subject == '')
  191. $errors[] = $lang_post['No subject'];
  192. else if ($pun_config['o_censoring'] == '1' && $censored_subject == '')
  193. $errors[] = $lang_post['No subject after censoring'];
  194. else if (pun_strlen($subject) > 70)
  195. $errors[] = $lang_post['Too long subject'];
  196. else if ($pun_config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$pun_user['is_admmod'])
  197. $errors[] = $lang_post['All caps subject'];
  198. }
  199. // If the user is logged in we get the username and email from $pun_user
  200. if (!$pun_user['is_guest'])
  201. {
  202. $username = $pun_user['username'];
  203. $email = $pun_user['email'];
  204. }
  205. // Otherwise it should be in $_POST
  206. else
  207. {
  208. $username = pun_trim($_POST['req_username']);
  209. $email = strtolower(trim(($pun_config['p_force_guest_email'] == '1') ? $_POST['req_email'] : $_POST['email']));
  210. // Load the register.php/profile.php language files
  211. require PUN_ROOT.'lang/'.$pun_user['language'].'/prof_reg.php';
  212. require PUN_ROOT.'lang/'.$pun_user['language'].'/register.php';
  213. // It's a guest, so we have to validate the username
  214. check_username($username);
  215. if ($pun_config['p_force_guest_email'] == '1' || $email != '')
  216. {
  217. require PUN_ROOT.'include/email.php';
  218. if (!is_valid_email($email))
  219. $errors[] = $lang_common['Invalid email'];
  220. // Check if it's a banned email address
  221. // we should only check guests because members addresses are already verified
  222. if ($pun_user['is_guest'] && is_banned_email($email))
  223. {
  224. if ($pun_config['p_allow_banned_email'] == '0')
  225. $errors[] = $lang_prof_reg['Banned email'];
  226. $banned_email = true; // Used later when we send an alert email
  227. }
  228. else
  229. $banned_email = false;
  230. }
  231. }
  232. // Clean up message from POST
  233. $orig_message = $message = pun_linebreaks(pun_trim($_POST['req_message']));
  234. // Here we use strlen() not pun_strlen() as we want to limit the post to PUN_MAX_POSTSIZE bytes, not characters
  235. if (strlen($message) > PUN_MAX_POSTSIZE)
  236. $errors[] = sprintf($lang_post['Too long message'], forum_number_format(PUN_MAX_POSTSIZE));
  237. else if ($pun_config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$pun_user['is_admmod'])
  238. $errors[] = $lang_post['All caps message'];
  239. // Validate BBCode syntax
  240. if ($pun_config['p_message_bbcode'] == '1')
  241. {
  242. require PUN_ROOT.'include/parser.php';
  243. $message = preparse_bbcode($message, $errors);
  244. }
  245. if (empty($errors))
  246. {
  247. if ($message == '')
  248. $errors[] = $lang_post['No message'];
  249. else if ($pun_config['o_censoring'] == '1')
  250. {
  251. // Censor message to see if that causes problems
  252. $censored_message = pun_trim(censor_words($message));
  253. if ($censored_message == '')
  254. $errors[] = $lang_post['No message after censoring'];
  255. }
  256. }
  257. $hide_smilies = isset($_POST['hide_smilies']) ? '1' : '0';
  258. $subscribe = isset($_POST['subscribe']) ? '1' : '0';
  259. $stick_topic = isset($_POST['stick_topic']) && $is_admmod ? '1' : '0';
  260. $now = time();
  261. poll_form_validate($tid, $errors);
  262. // Did everything go according to plan?
  263. if (empty($errors) && !isset($_POST['preview']))
  264. {
  265. require PUN_ROOT.'include/search_idx.php';
  266. // If it's a reply
  267. if ($tid)
  268. {
  269. if (!$pun_user['is_guest'])
  270. {
  271. $new_tid = $tid;
  272. // Insert the new post
  273. $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
  274. $new_pid = $db->insert_id();
  275. // To subscribe or not to subscribe, that ...
  276. if ($pun_config['o_topic_subscriptions'] == '1')
  277. {
  278. if ($subscribe && !$is_subscribed)
  279. $db->query('INSERT INTO '.$db->prefix.'topic_subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
  280. else if (!$subscribe && $is_subscribed)
  281. $db->query('DELETE FROM '.$db->prefix.'topic_subscriptions WHERE user_id='.$pun_user['id'].' AND topic_id='.$tid) or error('Unable to remove subscription', __FILE__, __LINE__, $db->error());
  282. }
  283. }
  284. else
  285. {
  286. // It's a guest. Insert the new post
  287. $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
  288. $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
  289. $new_pid = $db->insert_id();
  290. }
  291. // Count number of replies in the topic
  292. $result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'posts WHERE topic_id='.$tid) or error('Unable to fetch post count for topic', __FILE__, __LINE__, $db->error());
  293. $num_replies = $db->result($result, 0) - 1;
  294. // Update topic
  295. $db->query('UPDATE '.$db->prefix.'topics SET num_replies='.$num_replies.', last_post='.$now.', last_post_id='.$new_pid.', last_poster=\''.$db->escape($username).'\' WHERE id='.$tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
  296. update_search_index('post', $new_pid, $message);
  297. update_forum($cur_posting['id']);
  298. // Should we send out notifications?
  299. if ($pun_config['o_topic_subscriptions'] == '1')
  300. {
  301. // Get the post time for the previous post in this topic
  302. $result = $db->query('SELECT posted FROM '.$db->prefix.'posts WHERE topic_id='.$tid.' ORDER BY id DESC LIMIT 1, 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
  303. $previous_post_time = $db->result($result);
  304. // Get any subscribed users that should be notified (banned users are excluded)
  305. $result = $db->query('SELECT u.id, u.email, u.notify_with_post, u.language FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'topic_subscriptions AS s ON u.id=s.user_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id='.$cur_posting['id'].' AND fp.group_id=u.group_id) LEFT JOIN '.$db->prefix.'online AS o ON u.id=o.user_id LEFT JOIN '.$db->prefix.'bans AS b ON u.username=b.username WHERE b.username IS NULL AND COALESCE(o.logged, u.last_visit)>'.$previous_post_time.' AND (fp.read_forum IS NULL OR fp.read_forum=1) AND s.topic_id='.$tid.' AND u.id!='.$pun_user['id']) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
  306. if ($db->num_rows($result))
  307. {
  308. require_once PUN_ROOT.'include/email.php';
  309. $notification_emails = array();
  310. // Loop through subscribed users and send emails
  311. while ($cur_subscriber = $db->fetch_assoc($result))
  312. {
  313. // Is the subscription email for $cur_subscriber['language'] cached or not?
  314. if (!isset($notification_emails[$cur_subscriber['language']]))
  315. {
  316. if (file_exists(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl'))
  317. {
  318. // Load the "new reply" template
  319. $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl'));
  320. // Load the "new reply full" template (with post included)
  321. $mail_tpl_full = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply_full.tpl'));
  322. // The first row contains the subject (it also starts with "Subject:")
  323. $first_crlf = strpos($mail_tpl, "\n");
  324. $mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));
  325. $mail_message = trim(substr($mail_tpl, $first_crlf));
  326. $first_crlf = strpos($mail_tpl_full, "\n");
  327. $mail_subject_full = trim(substr($mail_tpl_full, 8, $first_crlf-8));
  328. $mail_message_full = trim(substr($mail_tpl_full, $first_crlf));
  329. $mail_subject = str_replace('<topic_subject>', $cur_posting['subject'], $mail_subject);
  330. $mail_message = str_replace('<topic_subject>', $cur_posting['subject'], $mail_message);
  331. $mail_message = str_replace('<replier>', $username, $mail_message);
  332. $mail_message = str_replace('<post_url>', get_base_url().'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $mail_message);
  333. $mail_message = str_replace('<unsubscribe_url>', get_base_url().'/misc.php?action=unsubscribe&tid='.$tid, $mail_message);
  334. $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message);
  335. $mail_subject_full = str_replace('<topic_subject>', $cur_posting['subject'], $mail_subject_full);
  336. $mail_message_full = str_replace('<topic_subject>', $cur_posting['subject'], $mail_message_full);
  337. $mail_message_full = str_replace('<replier>', $username, $mail_message_full);
  338. $mail_message_full = str_replace('<message>', $pun_config['o_censoring'] == '1' ? $censored_message : $message, $mail_message_full);
  339. $mail_message_full = str_replace('<post_url>', get_base_url().'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $mail_message_full);
  340. $mail_message_full = str_replace('<unsubscribe_url>', get_base_url().'/misc.php?action=unsubscribe&tid='.$tid, $mail_message_full);
  341. $mail_message_full = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message_full);
  342. $notification_emails[$cur_subscriber['language']][0] = $mail_subject;
  343. $notification_emails[$cur_subscriber['language']][1] = $mail_message;
  344. $notification_emails[$cur_subscriber['language']][2] = $mail_subject_full;
  345. $notification_emails[$cur_subscriber['language']][3] = $mail_message_full;
  346. $mail_subject = $mail_message = $mail_subject_full = $mail_message_full = null;
  347. }
  348. }
  349. // We have to double check here because the templates could be missing
  350. if (isset($notification_emails[$cur_subscriber['language']]))
  351. {
  352. if ($cur_subscriber['notify_with_post'] == '0')
  353. pun_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][0], $notification_emails[$cur_subscriber['language']][1]);
  354. else
  355. pun_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][2], $notification_emails[$cur_subscriber['language']][3]);
  356. }
  357. }
  358. }
  359. }
  360. }
  361. // If it's a new topic
  362. else if ($fid)
  363. {
  364. // Create the topic
  365. $db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, sticky, forum_id) VALUES(\''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$stick_topic.', '.$fid.')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
  366. $new_tid = $db->insert_id();
  367. if (!$pun_user['is_guest'])
  368. {
  369. // To subscribe or not to subscribe, that ...
  370. if ($pun_config['o_topic_subscriptions'] == '1' && $subscribe)
  371. $db->query('INSERT INTO '.$db->prefix.'topic_subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$new_tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
  372. // Create the post ("topic post")
  373. $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
  374. }
  375. else
  376. {
  377. // Create the post ("topic post")
  378. $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
  379. $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
  380. }
  381. $new_pid = $db->insert_id();
  382. // Update the topic with last_post_id
  383. $db->query('UPDATE '.$db->prefix.'topics SET last_post_id='.$new_pid.', first_post_id='.$new_pid.' WHERE id='.$new_tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
  384. update_search_index('post', $new_pid, $message, $subject);
  385. update_forum($fid);
  386. poll_save($new_tid);
  387. // Should we send out notifications?
  388. if ($pun_config['o_forum_subscriptions'] == '1')
  389. {
  390. // Get any subscribed users that should be notified (banned users are excluded)
  391. $result = $db->query('SELECT u.id, u.email, u.notify_with_post, u.language FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'forum_subscriptions AS s ON u.id=s.user_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id='.$cur_posting['id'].' AND fp.group_id=u.group_id) LEFT JOIN '.$db->prefix.'bans AS b ON u.username=b.username WHERE b.username IS NULL AND (fp.read_forum IS NULL OR fp.read_forum=1) AND s.forum_id='.$cur_posting['id'].' AND u.id!='.$pun_user['id']) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
  392. if ($db->num_rows($result))
  393. {
  394. require_once PUN_ROOT.'include/email.php';
  395. //
  396. $notification_emails = array();
  397. //
  398. // Loop through subscribed users and send emails
  399. while ($cur_subscriber = $db->fetch_assoc($result))
  400. {
  401. // Is the subscription email for $cur_subscriber['language'] cached or not?
  402. if (!isset($notification_emails[$cur_subscriber['language']]))
  403. {
  404. if (file_exists(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_topic.tpl'))
  405. {
  406. // Load the "new topic" template
  407. $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_topic.tpl'));
  408. // Load the "new topic full" template (with post included)
  409. $mail_tpl_full = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_topic_full.tpl'));
  410. // The first row contains the subject (it also starts with "Subject:")
  411. $first_crlf = strpos($mail_tpl, "\n");
  412. $mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));
  413. $mail_message = trim(substr($mail_tpl, $first_crlf));
  414. $first_crlf = strpos($mail_tpl_full, "\n");
  415. $mail_subject_full = trim(substr($mail_tpl_full, 8, $first_crlf-8));
  416. $mail_message_full = trim(substr($mail_tpl_full, $first_crlf));
  417. $mail_subject = str_replace('<forum_name>', $cur_posting['forum_name'], $mail_subject);
  418. $mail_message = str_replace('<topic_subject>', $pun_config['o_censoring'] == '1' ? $censored_subject : $subject, $mail_message);
  419. $mail_message = str_replace('<forum_name>', $cur_posting['forum_name'], $mail_message);
  420. $mail_message = str_replace('<poster>', $username, $mail_message);
  421. $mail_message = str_replace('<topic_url>', get_base_url().'/viewtopic.php?id='.$new_tid, $mail_message);
  422. $mail_message = str_replace('<unsubscribe_url>', get_base_url().'/misc.php?action=unsubscribe&fid='.$cur_posting['id'], $mail_message);
  423. $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message);
  424. $mail_subject_full = str_replace('<forum_name>', $cur_posting['forum_name'], $mail_subject_full);
  425. $mail_message_full = str_replace('<topic_subject>', $pun_config['o_censoring'] == '1' ? $censored_subject : $subject, $mail_message_full);
  426. $mail_message_full = str_replace('<forum_name>', $cur_posting['forum_name'], $mail_message_full);
  427. $mail_message_full = str_replace('<poster>', $username, $mail_message_full);
  428. $mail_message_full = str_replace('<message>', $pun_config['o_censoring'] == '1' ? $censored_message : $message, $mail_message_full);
  429. $mail_message_full = str_replace('<topic_url>', get_base_url().'/viewtopic.php?id='.$new_tid, $mail_message_full);
  430. $mail_message_full = str_replace('<unsubscribe_url>', get_base_url().'/misc.php?action=unsubscribe&fid='.$cur_posting['id'], $mail_message_full);
  431. $mail_message_full = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message_full);
  432. $notification_emails[$cur_subscriber['language']][0] = $mail_subject;
  433. $notification_emails[$cur_subscriber['language']][1] = $mail_message;
  434. $notification_emails[$cur_subscriber['language']][2] = $mail_subject_full;
  435. $notification_emails[$cur_subscriber['language']][3] = $mail_message_full;
  436. $mail_subject = $mail_message = $mail_subject_full = $mail_message_full = null;
  437. }
  438. }
  439. // We have to double check here because the templates could be missing
  440. if (isset($notification_emails[$cur_subscriber['language']]))
  441. {
  442. if ($cur_subscriber['notify_with_post'] == '0')
  443. pun_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][0], $notification_emails[$cur_subscriber['language']][1]);
  444. else
  445. pun_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][2], $notification_emails[$cur_subscriber['language']][3]);
  446. }
  447. }
  448. }
  449. }
  450. }
  451. // If we previously found out that the email was banned
  452. if ($pun_user['is_guest'] && $banned_email && $pun_config['o_mailing_list'] != '')
  453. {
  454. $mail_subject = $lang_common['Banned email notification'];
  455. $mail_message = sprintf($lang_common['Banned email post message'], $username, $email)."\n";
  456. $mail_message .= sprintf($lang_common['Post URL'], get_base_url().'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid)."\n";
  457. $mail_message .= "\n".'--'."\n".$lang_common['Email signature'];
  458. pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);
  459. }
  460. // Attachment Mod Block Start
  461. if (isset($_FILES['attached_file']['error']) && $_FILES['attached_file']['error'] != 0 && $_FILES['attached_file']['error'] != 4)
  462. error(file_upload_error_message($_FILES['attached_file']['error']), __FILE__, __LINE__);
  463. if (isset($_FILES['attached_file'])&&$_FILES['attached_file']['size']!=0&&is_uploaded_file($_FILES['attached_file']['tmp_name'])){
  464. //fetch the rules for this forum for this group
  465. $attach_result = $db->query('SELECT rules,size,file_ext FROM '.$db->prefix.'attach_2_rules WHERE group_id='.$pun_user['g_id'].' AND forum_id='.$cur_posting['id'].' LIMIT 1')or error('Unable to fetch attachment rules',__FILE__,__LINE__,$db->error());
  466. if($db->num_rows($attach_result)!=0||$pun_user['g_id']==PUN_ADMIN){
  467. $attach_rules=0; $attach_size=0; $attach_file_ext=''; // just some defaults to get the parser to stop nagging me if it's an admin :D
  468. if($db->num_rows($attach_result)!=0)
  469. list($attach_rules,$attach_size,$attach_file_ext)=$db->fetch_row($attach_result);
  470. //check so that the user is allowed to upload
  471. if(attach_allow_upload($attach_rules,$attach_size,$attach_file_ext,$_FILES['attached_file']['size'],$_FILES['attached_file']['name'])){
  472. // ok we're allowed to post ... time to fix everything...
  473. if(!attach_create_attachment($_FILES['attached_file']['name'],$_FILES['attached_file']['type'],$_FILES['attached_file']['size'],$_FILES['attached_file']['tmp_name'],$new_pid,count_chars($message))){
  474. error('Error creating attachment, inform the owner of this bulletin board of this problem. (Most likely something to do with rights on the filesystem)',__FILE__,__LINE__);
  475. }
  476. }else{
  477. // no output ... but if you want, enable this error (you really shouldn't need to as this will only happen if someone try to go around the restrictions
  478. // error($lang_attach['Not allowed to post attachments']);
  479. }
  480. }else{
  481. // no output ... but if you want, enable this error (you really shouldn't need to as this will only happen if someone try to go around the restrictions
  482. // error($lang_attach['Not allowed to post attachments']);
  483. }
  484. }
  485. // Attachment Mod Block End
  486. // If the posting user is logged in, increment his/her post count
  487. if (!$pun_user['is_guest'])
  488. {
  489. $db->query('UPDATE '.$db->prefix.'users SET num_posts=num_posts+1, last_post='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
  490. $tracked_topics = get_tracked_topics();
  491. $tracked_topics['topics'][$new_tid] = time();
  492. set_tracked_topics($tracked_topics);
  493. }
  494. else
  495. {
  496. $db->query('UPDATE '.$db->prefix.'online SET last_post='.$now.' WHERE ident=\''.$db->escape(get_remote_address()).'\'' ) or error('Unable to update user', __FILE__, __LINE__, $db->error());
  497. }
  498. redirect('viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $lang_post['Post redirect']);
  499. } //End if.
  500. } //End if.
  501. // If a topic ID was specified in the url (it's a reply)
  502. if ($tid)
  503. {
  504. $action = $lang_post['Post a reply'];
  505. $form = '<form id="post" method="post" enctype="multipart/form-data" action="post.php?action=post&amp;tid='.$tid.'" onsubmit="this.submit.disabled=true;if (previewPost()){this.submit.disabled=false;return false;} else {if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}}">'; //Attachment Mod has added enctype="multipart/form-data"
  506. // If a quote ID was specified in the url
  507. if (isset($_GET['qid']))
  508. {
  509. $qid = intval($_GET['qid']);
  510. if ($qid < 1)
  511. message($lang_common['Bad request']);
  512. $result = $db->query('SELECT poster, message FROM '.$db->prefix.'posts WHERE id='.$qid.' AND topic_id='.$tid) or error('Unable to fetch quote info', __FILE__, __LINE__, $db->error());
  513. if (!$db->num_rows($result))
  514. message($lang_common['Bad request']);
  515. list($q_poster, $q_message) = $db->fetch_row($result);
  516. // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched)
  517. if (strpos($q_message, '[code]') !== false && strpos($q_message, '[/code]') !== false)
  518. {
  519. $errors = array();
  520. list($inside, $outside) = split_text($q_message, '[code]', '[/code]', $errors);
  521. if (!empty($errors)) // Technically this shouldn't happen, since $q_message is an existing post it should only exist if it previously passed validation
  522. message($errors[0]);
  523. $q_message = implode("\1", $outside);
  524. }
  525. // Remove [img] tags from quoted message
  526. $q_message = preg_replace('%\[img(?:=(?:[^\[]*?))?\]((ht|f)tps?://)([^\s<"]*?)\[/img\]%U', '\1\3', $q_message);
  527. // If we split up the message before we have to concatenate it together again (code tags)
  528. if (isset($inside))
  529. {
  530. $outside = explode("\1", $q_message);
  531. $q_message = '';
  532. $num_tokens = count($outside);
  533. for ($i = 0; $i < $num_tokens; ++$i)
  534. {
  535. $q_message .= $outside[$i];
  536. if (isset($inside[$i]))
  537. $q_message .= '[code]'.$inside[$i].'[/code]';
  538. }
  539. unset($inside);
  540. }
  541. if ($pun_config['o_censoring'] == '1')
  542. $q_message = censor_words($q_message);
  543. $q_message = pun_htmlspecialchars($q_message);
  544. if ($pun_config['p_message_bbcode'] == '1')
  545. {
  546. // If username contains a square bracket, we add "" or '' around it (so we know when it starts and ends)
  547. if (strpos($q_poster, '[') !== false || strpos($q_poster, ']') !== false)
  548. {
  549. if (strpos($q_poster, '\'') !== false)
  550. $q_poster = '"'.$q_poster.'"';
  551. else
  552. $q_poster = '\''.$q_poster.'\'';
  553. }
  554. else
  555. {
  556. // Get the characters at the start and end of $q_poster
  557. $ends = substr($q_poster, 0, 1).substr($q_poster, -1, 1);
  558. // Deal with quoting "Username" or 'Username' (becomes '"Username"' or "'Username'")
  559. if ($ends == '\'\'')
  560. $q_poster = '"'.$q_poster.'"';
  561. else if ($ends == '""')
  562. $q_poster = '\''.$q_poster.'\'';
  563. }
  564. $quote = '[quote='.$q_poster.']'.$q_message.'[/quote]'."\n";
  565. }
  566. else
  567. $quote = '> '.$q_poster.' '.$lang_common['wrote']."\n\n".'> '.$q_message."\n";
  568. }
  569. }
  570. // If a forum ID was specified in the url (new topic)
  571. else if ($fid)
  572. {
  573. $action = $lang_post['Post new topic'];
  574. $form = '<form id="post" method="post" enctype="multipart/form-data" action="post.php?action=post&amp;fid='.$fid.'" onsubmit="this.submit.disabled=true;if (previewPost()){this.submit.disabled=false;return false;} else {if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}}">';
  575. }
  576. else
  577. message($lang_common['Bad request']);
  578. $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $action);
  579. $required_fields = array('req_email' => $lang_common['Email'], 'req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
  580. $focus_element = array('post');
  581. if (!$pun_user['is_guest'])
  582. $focus_element[] = ($fid) ? 'req_subject' : 'req_message';
  583. else
  584. {
  585. $required_fields['req_username'] = $lang_post['Guest name'];
  586. $focus_element[] = 'req_username';
  587. }
  588. //Attachment Mod Block Start
  589. //Fetch some stuff so we know if the user is allowed to attach files to the post ... oh and preview won't work... I'm not going to add shitload of stuff to get some temporary upload area ;)
  590. $attach_allowed = false;
  591. $attach_result = $db->query('SELECT rules,size FROM '.$db->prefix.'attach_2_rules WHERE group_id='.$pun_user['g_id'].' AND forum_id='.$cur_posting['id'].' LIMIT 1')or error('Unable to fetch attachment rules',__FILE__,__LINE__,$db->error());
  592. if($db->num_rows($attach_result)){
  593. list($attach_rules,$attach_size)=$db->fetch_row($attach_result);
  594. if(attach_rules($attach_rules,ATTACH_UPLOAD))
  595. $attach_allowed=true;
  596. }elseif($pun_user['g_id']==PUN_ADMIN){
  597. $attach_allowed=true;
  598. $attach_size=$pun_config['attach_max_size'];
  599. }
  600. //Attachment Mod Block End
  601. define('PUN_ACTIVE_PAGE', 'index');
  602. require PUN_ROOT.'header.php';
  603. ?>
  604. <div class="linkst">
  605. <div class="inbox">
  606. <ul class="crumbs">
  607. <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
  608. <li><span>»&#160;</span><a href="viewforum.php?id=<?php echo $cur_posting['id'] ?>"><?php echo pun_htmlspecialchars($cur_posting['forum_name']) ?></a></li>
  609. <?php if (isset($cur_posting['subject'])): ?> <li><span>»&#160;</span><a href="viewtopic.php?id=<?php echo $tid ?>"><?php echo pun_htmlspecialchars($cur_posting['subject']) ?></a></li>
  610. <?php endif; ?> <li><span>»&#160;</span><strong><?php echo $action ?></strong></li>
  611. </ul>
  612. </div>
  613. </div>
  614. <?php
  615. // If there are errors, we display them
  616. if (!empty($errors))
  617. {
  618. ?>
  619. <div id="posterror" class="block">
  620. <h2><span><?php echo $lang_post['Post errors'] ?></span></h2>
  621. <div class="box">
  622. <div class="inbox error-info">
  623. <p><?php echo $lang_post['Post errors info'] ?></p>
  624. <ul class="error-list">
  625. <?php
  626. foreach ($errors as $cur_error)
  627. echo "\t\t\t\t".'<li><strong>'.$cur_error.'</strong></li>'."\n";
  628. ?>
  629. </ul>
  630. </div>
  631. </div>
  632. </div>
  633. <?php
  634. }
  635. ?>
  636. <div id="postpreview" class="blockpost">
  637. <?php
  638. if (isset($_POST['preview']) && empty($errors))
  639. {
  640. require_once PUN_ROOT.'include/parser.php';
  641. $preview_message = parse_message($message, $hide_smilies);
  642. ?>
  643. <h2><span><?php echo $lang_post['Post preview'] ?></span></h2>
  644. <div class="box">
  645. <div class="inbox">
  646. <div class="postbody">
  647. <div class="postright">
  648. <div class="postmsg">
  649. <?php echo $preview_message."\n" ?>
  650. <?php if ($fid) poll_display_post($tid, $pun_user['id']); ?>
  651. </div>
  652. </div>
  653. </div>
  654. </div>
  655. </div>
  656. <?php
  657. }
  658. $cur_index = 1;
  659. ?>
  660. </div>
  661. <div id="postform" class="blockform">
  662. <h2><span><?php echo $action ?></span></h2>
  663. <div class="box">
  664. <?php echo $form."\n" ?>
  665. <div class="inform">
  666. <fieldset>
  667. <legend><?php echo $lang_common['Write message legend'] ?></legend>
  668. <div class="infldset txtarea">
  669. <input type="hidden" name="form_sent" value="1" />
  670. <input type="hidden" name="form_user" value="<?php echo (!$pun_user['is_guest']) ? pun_htmlspecialchars($pun_user['username']) : 'Guest'; ?>" />
  671. <?php
  672. if ($pun_user['is_guest'])
  673. {
  674. $email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['Email'].' <span>'.$lang_common['Required'].'</span></strong>' : $lang_common['Email'];
  675. $email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email';
  676. ?>
  677. <label class="conl required"><strong><?php echo $lang_post['Guest name'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input type="text" name="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="25" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
  678. <label class="conl<?php echo ($pun_config['p_force_guest_email'] == '1') ? ' required' : '' ?>"><?php echo $email_label ?><br /><input type="text" name="<?php echo $email_form_name ?>" value="<?php if (isset($_POST[$email_form_name])) echo pun_htmlspecialchars($email); ?>" size="50" maxlength="80" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
  679. <div class="clearer"></div>
  680. <?php
  681. }
  682. if ($fid): ?>
  683. <label class="required"><strong><?php echo $lang_common['Subject'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input class="longinput" type="text" name="req_subject" value="<?php if (isset($_POST['req_subject'])) echo pun_htmlspecialchars($subject); ?>" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
  684. <?php endif; ?> <label class="required"><strong><?php echo $lang_common['Message'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br />
  685. <textarea id="req_message" name="req_message" rows="20" cols="95" tabindex="<?php echo $cur_index++ ?>"><?php echo isset($_POST['req_message']) ? pun_htmlspecialchars($message) : (isset($quote) ? $quote : ''); ?></textarea><br /></label>
  686. <ul class="bblinks">
  687. <li><span><a href="help.php#bbcode"><?php echo $lang_common['BBCode'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
  688. <li><span><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1' && $pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
  689. <li><span><a href="help.php#smilies" ><?php echo $lang_common['Smilies'] ?></a> <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
  690. </ul>
  691. </div>
  692. </fieldset>
  693. <?php
  694. //Attachment Mod Block Start
  695. if($attach_allowed){
  696. ?>
  697. </div>
  698. <div class="inform">
  699. <fieldset>
  700. <legend><?php echo $lang_attach['Attachment'] ?></legend>
  701. <div class="infldset">
  702. <input type="hidden" name="MAX_FILE_SIZE" value="<?php print $attach_size; ?>" /><input type="file" name="attached_file" size="80" tabindex="<?php echo $cur_index++ ?>" /><br />
  703. <?php echo $lang_attach['Note'] ?>
  704. </div>
  705. </fieldset>
  706. <?php
  707. }
  708. //Attachment Mod Block End
  709. $checkboxes = array();
  710. if ($is_admmod)
  711. $checkboxes[] = '<label><input type="checkbox" name="stick_topic" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['stick_topic']) ? ' checked="checked"' : '').' />'.$lang_common['Stick topic'].'<br /></label>';
  712. if (!$pun_user['is_guest'])
  713. {
  714. if ($pun_config['o_smilies'] == '1')
  715. $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'].'<br /></label>';
  716. if ($pun_config['o_topic_subscriptions'] == '1')
  717. {
  718. $subscr_checked = false;
  719. // If it's a preview
  720. if (isset($_POST['preview']))
  721. $subscr_checked = isset($_POST['subscribe']) ? true : false;
  722. // If auto subscribed
  723. else if ($pun_user['auto_notify'])
  724. $subscr_checked = true;
  725. // If already subscribed to the topic
  726. else if ($is_subscribed)
  727. $subscr_checked = true;
  728. $checkboxes[] = '<label><input type="checkbox" name="subscribe" value="1" tabindex="'.($cur_index++).'"'.($subscr_checked ? ' checked="checked"' : '').' />'.($is_subscribed ? $lang_post['Stay subscribed'] : $lang_post['Subscribe']).'<br /></label>';
  729. }
  730. }
  731. else if ($pun_config['o_smilies'] == '1')
  732. $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'].'<br /></label>';
  733. if (!empty($checkboxes))
  734. {
  735. ?>
  736. </div>
  737. <div class="inform">
  738. <fieldset>
  739. <legend><?php echo $lang_common['Options'] ?></legend>
  740. <div class="infldset">
  741. <div class="rbox">
  742. <?php echo implode("\n\t\t\t\t\t\t\t", $checkboxes)."\n" ?>
  743. </div>
  744. </div>
  745. </fieldset>
  746. <?php
  747. }
  748. ?>
  749. </div>
  750. <?php poll_form_post($tid); ?>
  751. <p class="buttons"><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" onclick="is_preview(false)" /> <input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" onclick="is_preview(true)" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
  752. </form>
  753. </div>
  754. </div>
  755. <?php
  756. // Check to see if the topic review is to be displayed
  757. if ($tid && $pun_config['o_topic_review'] != '0')
  758. {
  759. require_once PUN_ROOT.'include/parser.php';
  760. $result = $db->query('SELECT poster_id, poster, message, hide_smilies, posted FROM '.$db->prefix.'posts WHERE topic_id='.$tid.' ORDER BY id DESC LIMIT '.$pun_config['o_topic_review']) or error('Unable to fetch topic review', __FILE__, __LINE__, $db->error());
  761. ?>
  762. <div id="postreview">
  763. <h2><span><?php echo $lang_post['Topic review'] ?></span></h2>
  764. <?php
  765. // Set background switching on
  766. $post_count = 0;
  767. while ($cur_post = $db->fetch_assoc($result))
  768. {
  769. $post_count++;
  770. $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
  771. $poster_name = pun_htmlspecialchars($cur_post['poster']);
  772. if ($pun_config['o_eve_use_iga'] == '1') {
  773. $char = fetch_selected_character($cur_post['poster_id']);
  774. $poster_name = $char['character_name'];
  775. } //End if.
  776. ?>
  777. <div class="blockpost">
  778. <div class="box<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?>">
  779. <div class="inbox">
  780. <div class="postbody">
  781. <div class="postleft">
  782. <dl>
  783. <dt><strong><?php echo $poster_name ?></strong></dt>
  784. <dd><span><?php echo format_time($cur_post['posted']) ?></span></dd>
  785. </dl>
  786. </div>
  787. <div class="postright">
  788. <div class="postmsg">
  789. <?php echo $cur_post['message']."\n" ?>
  790. </div>
  791. </div>
  792. </div>
  793. <div class="clearer"></div>
  794. </div>
  795. </div>
  796. </div>
  797. <?php
  798. }
  799. ?>
  800. </div>
  801. <?php
  802. }
  803. require PUN_ROOT.'footer.php';