JohnCMSKhông post đc nội dung ra diễn đàn

10 bài đăng
12.03.2017 / 17:44
HackerPro
Bài đăng: 220
Member
123baylenuocmo's

Thằng share code này chơi xỏ ý mà :yao:

Ai sửa giúp mình code đăng bài viết dùm nhá :troll2:

Phiền mọi người tí ... :troll:

PHP
  1. <?php
  2.  
  3. /**
  4.  * @package JohnCMS
  5.  * @link http://johncms.com
  6.  * @copyright Copyright (C) 2008-2011 JohnCMS Community
  7.  * @license LICENSE.txt (see attached file)
  8.  * @version VERSION.txt (see attached file)
  9.  * @author http://johncms.com/about
  10.  */
  11.  
  12. define('_IN_JOHNCMS', 1);
  13.  
  14. require('../incfiles/core.php');
  15. $lng_forum = core::load_lng('forum');
  16. if (isset($_SESSION['ref']))
  17. unset($_SESSION['ref']);
  18.  
  19. /*
  20. -----------------------------------------------------------------
  21. ÐаÑтройки форума
  22. -----------------------------------------------------------------
  23. */
  24. $set_forum = $user_id && !empty($datauser['set_forum']) ? unserialize($datauser['set_forum']) : array(
  25. 'farea' => 0,
  26. 'upfp' => 0,
  27. 'preview' => 1,
  28. 'postclip' => 1,
  29. 'postcut' => 2
  30. );
  31. // mod
  32. $error = '';
  33. if (!$set['mod_forum'] && $rights < 7)
  34. $error = $lng_forum['forum_closed'];
  35. elseif ($set['mod_forum'] == 1 && !$user_id)
  36. $error = $lng['access_guest_forbidden'];
  37. if ($error) {
  38. require('../incfiles/head.php');
  39. echo '<div class="rmenu"><p>' . $error . '</p></div>';
  40. require('../incfiles/end.php');
  41. exit;
  42. }
  43.  
  44. $headmod = $id ? 'forum,' . $id : 'forum';
  45.  
  46. // Заголовки Ñтраниц форума
  47. if (empty($id)) {
  48. $textl = '' . $lng['forum'] . '';
  49. } else {
  50. $req = mysql_query("SELECT `text` FROM `forum` WHERE `id`= '" . $id . "'");
  51. $res = mysql_fetch_assoc($req);
  52. $textl = $res['text'];
  53. }
  54.  
  55. // Переключаем режимы работы
  56. $mods = array(
  57. 'addvote',
  58. 'close',
  59. 'deltema',
  60. 'delvote',
  61. 'editpost',
  62. 'editvote',
  63. 'loadtem',
  64. 'massdel',
  65. 'new',
  66. 'nt',
  67. 'per',
  68. 'post',
  69. 'ren',
  70. 'restore',
  71. 'say',
  72. 'tema',
  73. 'users',
  74. 'vip',
  75. 'vote',
  76. 'who',
  77. 'curators'
  78. );
  79. if ($act && ($key = array_search($act, $mods)) !== false && file_exists('includes/' . $mods[$key] . '.php')) {
  80. require('includes/' . $mods[$key] . '.php');
  81. } else {
  82. require('../incfiles/head.php');
  83.  
  84. // ЕÑли форум закрыт, то Ð´Ð»Ñ Ðдминов выводим напоминание
  85. if (!$set['mod_forum']) echo '<div class="alarm">' . $lng_forum['forum_closed'] . '</div>';
  86. elseif ($set['mod_forum'] == 3) echo '<div class="rmenu">' . $lng['read_only'] . '</div>';
  87. if (!$user_id) {
  88. if (isset($_GET['newup']))
  89. $_SESSION['uppost'] = 1;
  90. if (isset($_GET['newdown']))
  91. $_SESSION['uppost'] = 0;
  92. }
  93. if ($id) {
  94. // ОпределÑем тип запроÑа (каталог, или тема)
  95. $type = mysql_query("SELECT * FROM `forum` WHERE `id`= '$id'");
  96. if (!mysql_num_rows($type)) {
  97. // ЕÑли темы не ÑущеÑтвует, показываем ошибку
  98. echo functions::display_error($lng_forum['error_topic_deleted'], '<a href="index.php">' . $lng['to_forum'] . '</a>');
  99. require('../incfiles/end.php');
  100. exit;
  101. }
  102. $type1 = mysql_fetch_assoc($type);
  103.  
  104. // ФикÑÐ°Ñ†Ð¸Ñ Ñ„Ð°ÐºÑ‚Ð° Ð¿Ñ€Ð¾Ñ‡Ñ‚ÐµÐ½Ð¸Ñ Ð¢Ð¾Ð¿Ð¸ÐºÐ°
  105. if ($user_id && $type1['type'] == 't') {
  106. $req_r = mysql_query("SELECT * FROM `cms_forum_rdm` WHERE `topic_id` = '$id' AND `user_id` = '$user_id' LIMIT 1");
  107. if (mysql_num_rows($req_r)) {
  108. $res_r = mysql_fetch_assoc($req_r);
  109. if ($type1['time'] > $res_r['time'])
  110. mysql_query("UPDATE `cms_forum_rdm` SET `time` = '" . time() . "' WHERE `topic_id` = '$id' AND `user_id` = '$user_id' LIMIT 1");
  111. } else {
  112. mysql_query("INSERT INTO `cms_forum_rdm` SET `topic_id` = '$id', `user_id` = '$user_id', `time` = '" . time() . "'");
  113. }
  114. }
  115.  
  116. // Получаем Ñтруктуру форума
  117. $res = true;
  118. $allow = 0;
  119. $parent = $type1['refid'];
  120. while ($parent != '0' && $res != false) {
  121. $req = mysql_query("SELECT * FROM `forum` WHERE `id` = '$parent' LIMIT 1");
  122. $res = mysql_fetch_assoc($req);
  123. if ($res['type'] == 'f' || $res['type'] == 'r') {
  124. $tree[] = '<li><span><a href="index.php?id=' . $parent . '">' . $res['text'] . '</a></span></li>';
  125.  
  126.  
  127. if ($res['type'] == 'r' && !empty($res['edit'])) {
  128. $allow = intval($res['edit']);
  129. }
  130. }
  131.  
  132. $parent = $res['refid'];
  133.  
  134. }
  135. krsort($tree);
  136.  
  137. if ($type1['type'] != 't' && $type1['type'] != 'm')
  138.  
  139. $tree[] =' ' . $type1['text'] . '';
  140. // Выводим верхнюю панель навигации
  141.  
  142. echo '<ul class="breadcrumb" xmlns:v="http://rdf.data-vocabulary.org/#">' . functions::display_menu($tree) . '</ul>';
  143. switch ($type1['type']) {
  144. case 'f':
  145. ////////////////////////////////////////////////////////////
  146. // СпиÑок разделов форума //
  147. ////////////////////////////////////////////////////////////
  148. $req = mysql_query("SELECT `id`, `text`, `soft`, `edit` FROM `forum` WHERE `type`='r' AND `refid`='$id' ORDER BY `realid`");
  149.  
  150. $total = mysql_num_rows($req);
  151. if ($total) {
  152. $i = 0;
  153. while (($res = mysql_fetch_assoc($req)) !== false) {
  154. echo '<div class="list-login" style="padding:6px 3px;line-height:1.9;">';
  155. $coltem = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 't' AND `refid` = '" . $res['id'] . "'"), 0);
  156.  
  157. echo '<a href="?id=' . $res['id'] . '">' . $res['text'] . '</a>';
  158. if ($coltem)
  159. echo " [$coltem]";
  160. if (!empty($res['soft']))
  161. echo '<span class="menu">' . $res['soft'] . '</span>';
  162. echo '</div>';
  163. ++$i;
  164. }
  165. unset($_SESSION['fsort_id']);
  166. unset($_SESSION['fsort_users']);
  167. } else {
  168. echo '<div class="phdr"><p><span class="fa fa-comments"></i> ' . $lng_forum['section_list_empty'] . '</p></div>';
  169. }
  170. echo '<div class="menu"><small>Tất cả: ' . $total . '</small></div>';
  171. break;
  172.  
  173. case 'r':
  174. ////////////////////////////////////////////////////////////
  175. // СпиÑок топиков //
  176. ////////////////////////////////////////////////////////////
  177. $total = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='t' AND `refid`='$id'" . ($rights >= 7 ? '' : " AND `close`!='1'")), 0);
  178. if (($user_id && !isset($ban['1']) && !isset($ban['11']) && $set['mod_forum'] != 4) || core::$user_rights) {
  179. // Кнопка ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ Ð½Ð¾Ð²Ð¾Ð¹ темы
  180. echo '<div class="menu"><form action="index.php?act=nt&amp;id=' . $id . '" method="post"><input type="submit" value="' . $lng_forum['new_topic'] . '" /></form></div>';
  181. }
  182. if ($total) {
  183. $req = mysql_query("SELECT * FROM `forum` WHERE `type`='t'" . ($rights >= 7 ? '' : " AND `close`!='1'") . " AND `refid`='$id' ORDER BY `vip` DESC, `time` DESC LIMIT $start, $kmess");
  184. $i = 0;
  185. while (($res = mysql_fetch_assoc($req)) !== false) {
  186. if ($res['close'])
  187. echo '<div class="menu">';
  188. else
  189. echo '<div class="list-login" style="padding:6px 3px;line-height:1.9;">';
  190. $nikuser = mysql_query("SELECT `from` FROM `forum` WHERE `type` = 'm' AND `close` != '1' AND `refid` = '" . $res['id'] . "' ORDER BY `time` DESC LIMIT 1");
  191. $nam = mysql_fetch_assoc($nikuser);
  192. $colmes = mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='m' AND `refid`='" . $res['id'] . "'" . ($rights >= 7 ? '' : " AND `close` != '1'"));
  193. $colmes1 = mysql_result($colmes, 0);
  194. $cpg = ceil($colmes1 / $kmess);
  195. echo '<a href="index.php?id=' . $res['id'] . '"><i class="fa fa-bookmark"></i> ' . $res['text'] . '</a> ';
  196. if ($cpg > 1) {
  197. echo '<a href="' . $home . '/'.rw($res['text']).'_p' . $cpg . '.html#' . $colmes1 . '">&#160;&gt;&gt;</a>';
  198. }
  199. echo'</p><small>';
  200. echo $res['from'];
  201. if (!empty($nam['from'])) {
  202.  
  203. echo '&#160;/&#160;' . $nam['from'];
  204. echo '</small>';
  205. }
  206. echo ' <span class="gray"><small>('.timepost($res['time']).')</small></span></div>';
  207. ++$i;
  208. }
  209. unset($_SESSION['fsort_id']);
  210. unset($_SESSION['fsort_users']);
  211. } else {
  212. echo '<div class="menu"><p>' . $lng_forum['topic_list_empty'] . '</p></div>';
  213. }
  214. echo '<div class="phdr"> Tổng: ' . $total . '</div>';
  215. if ($total > $kmess) {
  216. echo '<div class="topmenu">' . functions::display_pagination('index.php?id=' . $id . '&amp;', $start, $total, $kmess) . '</div>';
  217. }
  218. break;
  219.  
  220. case 't':
  221. ////////////////////////////////////////////////////////////
  222. // Показываем тему Ñ Ð¿Ð¾Ñтами //
  223. ////////////////////////////////////////////////////////////
  224. $filter = isset($_SESSION['fsort_id']) && $_SESSION['fsort_id'] == $id ? 1 : 0;
  225. $sql = '';
  226. if ($filter && !empty($_SESSION['fsort_users'])) {
  227. // Подготавливаем Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð½Ð° фильтрацию юзеров
  228. $sw = 0;
  229. $sql = ' AND (';
  230. $fsort_users = unserialize($_SESSION['fsort_users']);
  231. foreach ($fsort_users as $val) {
  232. if ($sw)
  233. $sql .= ' OR ';
  234. $sortid = intval($val);
  235. $sql .= "`forum`.`user_id` = '$sortid'";
  236. $sw = 1;
  237. }
  238. $sql .= ')';
  239. }
  240.  
  241. // ЕÑли тема помечена Ð´Ð»Ñ ÑƒÐ´Ð°Ð»ÐµÐ½Ð¸Ñ, разрешаем доÑтуп только админиÑтрации
  242. if ($rights < 6 && $type1['close'] == 1) {
  243. echo '<div class="rmenu"><p>' . $lng_forum['topic_deleted'] . '<br/><a href="' . $home . '/'.rw($type1['text']).'_' . $type1['refid'] . '.html">' . $lng_forum['to_section'] . '</a></p></div>';
  244. require('../incfiles/end.php');
  245. exit;
  246. }
  247. ///////// Mod thank cho forum ////////
  248. ///Thanks submit đê
  249. $checkthankdau = mysql_query('SELECT COUNT(*) FROM `forum_thank` WHERE `userthank` = "' . $user_id . '" and `topic` = "' . $_GET['thanks'] . '" and `user` = "' . $_GET['user'] . '"');
  250. if ($user_id && $user_id != $_GET['user'] && (mysql_result($checkthankdau, 0) < 1)) {
  251. if ((isset($_GET['thank'])) && (isset($_GET['user'])) && (isset($_GET['thanks'])))
  252. ////mod thong bao like
  253. $tong=mysql_result(mysql_query("select count(*) from forum where refid = '{$_GET['id']}' and type='m' order by time desc"),0);
  254. $sotrang=ceil($tong/$kmess);
  255. mysql_query("INSERT INTO `thongbao` SET
  256. `id_from`='".$user_id."',
  257. `id_to` = '".$_GET['user']."',
  258. `hanhdong`='1',
  259. `id_forum`='".$_GET['id']."',
  260. `text` = '".$sotrang."|".$_GET['thanks']."',
  261. `type`='f',
  262. `time` = '" . time() . "'
  263. ");
  264. /////ket thuc thong bao like
  265. {
  266. mysql_query("INSERT INTO `forum_thank` SET
  267. `user` = '" . trim($_GET['user']) . "',
  268. `topic` = '" . trim($_GET['thanks']) . "' ,
  269. `time` = '$realtime',
  270. `userthank` = '$user_id',
  271. `chude` = '" . $_GET["id"] . "'
  272. ");
  273. $congcamon = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . trim($_GET['user']) . '"'));
  274. mysql_query("UPDATE `users` SET `thank_duoc`='" . ($congcamon['thank_duoc'] + 1) . "' WHERE `id` = '" . trim($_GET['user']) . "'");
  275. mysql_query("UPDATE `users` SET `thank_di`='" . ($datauser['thank_di'] + 1) . "' WHERE `id` = '" . $user_id . "'");
  276. }
  277. }
  278.  
  279. // Bá» thÃch
  280. if ((isset($_GET['unthank'])) && (isset($_GET['user'])) && (isset($_GET['unthanks']))) {
  281. $checkthank = mysql_query('SELECT COUNT(*) FROM `forum_thank` WHERE `userthank` = "' . $user_id . '" and `topic` = "' . $_GET['unthanks'] . '" and `user` = "' . $_GET['user'] . '"');
  282. $thankcheck = mysql_result($checkthank, 0);
  283. if ($thankcheck > 0 && $user_id != $_GET['user']) {
  284. mysql_query("DELETE FROM `forum_thank` WHERE `user` = '" . trim($_GET['user']) . "' AND `userthank` = '$user_id' AND `topic` = '" . trim($_GET['unthanks']) . "'");
  285. mysql_query("OPTIMIZE TABLE `forum_thank`");
  286. $datathankuser = functions::get_user(trim($_GET['user']));
  287. mysql_query("UPDATE `users` SET `thank_duoc`='" . ($datathankuser['thank_duoc'] - 1) . "' WHERE `id` = '" . trim($_GET['user']) . "'");
  288. mysql_query("UPDATE `users` SET `thank_di`='" . ($datauser['thank_di'] - 1) . "' WHERE `id` = '" . $user_id . "'");
  289. }
  290. }
  291.  
  292. ///////// kết thúc like ////////
  293.  
  294.  
  295. // Счетчик поÑтов темы
  296. $colmes = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='m'$sql AND `refid`='$id'" . ($rights >= 7 ? '' : " AND `close` != '1'")), 0);
  297. if ($start >= $colmes) {
  298. // ИÑправлÑем Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð½Ð° неÑущеÑтвующую Ñтраницу
  299. $start = max(0, $colmes - (($colmes % $kmess) == 0 ? $kmess : ($colmes % $kmess)));
  300. }
  301.  
  302. // Выводим название топика
  303. echo '<div class="menu" style="line-height:1.9;"><big><b><font color="black">' . $type1['text'] . '</font></b> </big>- ' . $colmes . ' view</div>';
  304. // Метка ÑƒÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Ñ‚ÐµÐ¼Ñ‹
  305. if ($type1['close']) {
  306. echo '<div class="rmenu">' . $lng_forum['topic_delete_who'] . ': <b>' . $type1['close_who'] . '</b></div>';
  307. } elseif (!empty($type1['close_who']) && $rights >= 7) {
  308. echo '<div class="gmenu"><small>' . $lng_forum['topic_delete_whocancel'] . ': <b>' . $type1['close_who'] . '</b></small></div>';
  309. }
  310.  
  311. // Метка Ð·Ð°ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ñ‚ÐµÐ¼Ñ‹
  312. if ($type1['edit']) {
  313. echo '<div class="rmenu">' . $lng_forum['topic_closed'] . '</div>';
  314. }
  315.  
  316. // Блок голоÑований
  317. if ($type1['realid']) {
  318. $clip_forum = isset($_GET['clip']) ? '&amp;clip' : '';
  319. $vote_user = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_forum_vote_users` WHERE `user`='$user_id' AND `topic`='$id'"), 0);
  320. $topic_vote = mysql_fetch_assoc(mysql_query("SELECT `name`, `time`, `count` FROM `cms_forum_vote` WHERE `type`='1' AND `topic`='$id' LIMIT 1"));
  321. echo '<div class="gmenu"><b>' . functions::checkout($topic_vote['name']) . '</b><br />';
  322. $vote_result = mysql_query("SELECT `id`, `name`, `count` FROM `cms_forum_vote` WHERE `type`='2' AND `topic`='" . $id . "' ORDER BY `id` ASC");
  323. if (!$type1['edit'] && !isset($_GET['vote_result']) && $user_id && $vote_user == 0) {
  324. // Выводим форму Ñ Ð¾Ð¿Ñ€Ð¾Ñами
  325. echo '<form action="index.php?act=vote&amp;id=' . $id . '" method="post">';
  326. while (($vote = mysql_fetch_assoc($vote_result)) !== false) {
  327. echo '<input type="radio" value="' . $vote['id'] . '" name="vote"/> ' . functions::checkout($vote['name'], 0, 1) . '<br />';
  328. }
  329. echo '<p><input type="submit" name="submit" value="' . $lng['vote'] . '"/><br /><a href="index.php?id=' . $id . '&amp;start=' . $start . '&amp;vote_result' . $clip_forum .
  330. '">' . $lng_forum['results'] . '</a></p></form></div>';
  331. } else {
  332. // Выводим результаты голоÑованиÑ
  333. echo '<small>';
  334. while (($vote = mysql_fetch_assoc($vote_result)) !== false) {
  335. $count_vote = $topic_vote['count'] ? round(100 / $topic_vote['count'] * $vote['count']) : 0;
  336. echo functions::checkout($vote['name'], 0, 1) . ' [' . $vote['count'] . ']<br />';
  337. echo '<img src="vote_img.php?img=' . $count_vote . '" alt="' . $lng_forum['rating'] . ': ' . $count_vote . '%" /><br />';
  338. }
  339. echo '</small></div><div class="bmenu">' . $lng_forum['total_votes'] . ': ';
  340. if (core::$user_rights > 6)
  341. echo '<a href="index.php?act=users&amp;id=' . $id . '">' . $topic_vote['count'] . '</a>';
  342. else
  343. echo $topic_vote['count'];
  344. echo '</div>';
  345. if ($user_id && $vote_user == 0)
  346. echo '<div class="bmenu"><a href="index.php?id=' . $id . '&amp;start=' . $start . $clip_forum . '">' . $lng['vote'] . '</a></div>';
  347. }
  348. }
  349.  
  350. // Получаем данные о кураторах темы
  351. $curators = !empty($type1['curators']) ? unserialize($type1['curators']) : array();
  352. $curator = false;
  353. if ($rights < 6 && $rights != 3 && $user_id) {
  354. if (array_key_exists($user_id, $curators)) $curator = true;
  355. }
  356.  
  357. // ФикÑÐ°Ñ†Ð¸Ñ Ð¿ÐµÑ€Ð²Ð¾Ð³Ð¾ поÑта в теме
  358. if (($set_forum['postclip'] == 2 && ($set_forum['upfp'] ? $start < (ceil($colmes - $kmess)) : $start > 0)) || isset($_GET['clip'])) {
  359. $postreq = mysql_query("SELECT `forum`.*, `users`.`sex`, `users`.`rights`, `users`.`lastdate`, `users`.`status`, `users`.`status`, `users`.`datereg`
  360. FROM `forum` LEFT JOIN `users` ON `forum`.`user_id` = `users`.`id`
  361. WHERE `forum`.`type` = 'm' AND `forum`.`refid` = '$id'" . ($rights >= 7 ? "" : " AND `forum`.`close` != '1'") . "
  362. ORDER BY `forum`.`id` LIMIT 1");
  363. $postres = mysql_fetch_assoc($postreq);
  364. echo '<div class="topmenu"><p>';
  365. if ($postres['sex'])
  366. echo '<img src="../theme/' . $set_user['skin'] . '/images/' . ($postres['sex'] == 'm' ? 'm' : 'w') . ($postres['datereg'] > time() - 86400 ? '_new.png" width="14"' : '.png" width="10"') . ' height="10"/>&#160;';
  367. else
  368. echo '<img src="../images/del.png" width="10" height="10" alt=""/>&#160;';
  369. if ($user_id && $user_id != $postres['user_id']) {
  370. echo '<a href="../users/profile.php?user=' . $postres['user_id'] . '&amp;fid=' . $postres['id'] . '"><b>' . $postres['from'] . '</b></a> ' .
  371. '<a href="index.php?act=say&amp;id=' . $postres['id'] . '&amp;start=' . $start . '"> ' . $lng_forum['reply_btn'] . '</a> ' .
  372. '<a href="index.php?act=say&amp;id=' . $postres['id'] . '&amp;start=' . $start . '&amp;cyt"> ' . $lng_forum['cytate_btn'] . '</a> ';
  373. } else {
  374. echo '<b>' . $postres['from'] . '</b> ';
  375. }
  376. $user_rights = array(
  377. 3 => '(FMod)',
  378. 6 => '(Smd)',
  379. 7 => '(Adm)',
  380. 9 => '(SV!)'
  381. );
  382. echo @$user_rights[$postres['rights']];
  383. echo(time() > $postres['lastdate'] + 300 ? '<span class="red"> [Off]</span>' : '<span class="green"> [ON]</span>');
  384. echo ' <span class="gray">(' . functions::display_date($postres['time']) . ')</span><br/>';
  385. if ($postres['close']) {
  386. echo '<span class="red">' . $lng_forum['post_deleted'] . '</span><br/>';
  387. }
  388. echo functions::checkout(mb_substr($postres['text'], 0, 500), 0, 2);
  389. if (mb_strlen($postres['text']) > 500)
  390. echo '...<a href="index.php?act=post&amp;id=' . $postres['id'] . '">' . $lng_forum['read_all'] . '</a>';
  391. echo '</p></div>';
  392. }
  393.  
  394. // ПамÑтка, что включен фильтр
  395. if ($filter) {
  396. echo '<div class="rmenu">' . $lng_forum['filter_on'] . '</div>';
  397. }
  398.  
  399. // Задаем правила Ñортировки (новые внизу / вверху)
  400. if ($user_id) {
  401. $order = $set_forum['upfp'] ? 'DESC' : 'ASC';
  402. } else {
  403. $order = ((empty($_SESSION['uppost'])) || ($_SESSION['uppost'] == 0)) ? 'ASC' : 'DESC';
  404. }
  405.  
  406. ////////////////////////////////////////////////////////////
  407. // ОÑновной Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð² базу, получаем ÑпиÑок поÑтов темы //
  408. ////////////////////////////////////////////////////////////
  409. $req = mysql_query("
  410. SELECT `forum`.*, `users`.`sex`, `users`.`rights`, `users`.`lastdate`, `users`.`status`, `users`.`danhhieu`, `users`.`datereg` , `users`.`datereg`
  411. FROM `forum` LEFT JOIN `users` ON `forum`.`user_id` = `users`.`id`
  412. WHERE `forum`.`type` = 'm' AND `forum`.`refid` = '$id'"
  413. . ($rights >= 7 ? "" : " AND `forum`.`close` != '1'") . "$sql
  414. ORDER BY `forum`.`id` $order LIMIT $start, $kmess
  415. ");
  416.  
  417. // Верхнее поле "ÐапиÑать"
  418. if (($user_id && !$type1['edit'] && $set_forum['upfp'] && $set['mod_forum'] != 3 && $allow != 4) || ($rights >= 7 && $set_forum['upfp'])) {
  419. echo '<div class="gmenu"><form name="form1" action="index.php?act=say&amp;id=' . $id . '" method="post">';
  420. if ($set_forum['farea']) {
  421. $token = mt_rand(1000, 100000);
  422. $_SESSION['token'] = $token;
  423. echo '<p>' .
  424. bbcode::auto_bb('form1', 'msg') .
  425. '<textarea rows="' . $set_user['field_h'] . '" name="msg"></textarea></p>' .
  426. '<p><input type="checkbox" name="addfiles" value="1" /> ' . $lng_forum['add_file'] .
  427. ($set_user['translit'] ? '<br /><input type="checkbox" name="msgtrans" value="1" /> ' . $lng['translit'] : '') .
  428. '</p><p><input type="submit" name="submit" value="' . $lng['write'] . '" style="width: 107px; cursor: pointer;"/> ' .
  429. (isset($set_forum['preview']) && $set_forum['preview'] ? '<input type="submit" value="' . $lng['preview'] . '" style="width: 107px; cursor: pointer;"/>' : '') .
  430. '<input type="hidden" name="token" value="' . $token . '"/>' .
  431. '</p></form></div>';
  432. } else {
  433. echo '<p><input type="submit" name="submit" value="' . $lng['write'] . '"/></p></form></div>';
  434. }
  435. }
  436. $i = 1;
  437. ////////////////////////////////////////////////////////////
  438. // ОÑновной ÑпиÑок поÑтов //
  439. ////////////////////////////////////////////////////////////
  440. while (($res = mysql_fetch_assoc($req)) !== false) {
  441. // Фон поÑта
  442. if ($res['close']) {
  443. echo '<div class="rmenu">';
  444. } else {
  445. echo '<div class="box_info_cmt" style="line-height:1.9;">';
  446. }
  447. // ПользовательÑкий аватар
  448. if ($set_user['avatar']) {
  449. echo '<table cellpadding="0" cellspacing="0"><tr><td>';
  450.  
  451. if (file_exists(('../files/users/avatar/' . $res['user_id'] . '.png')))
  452. echo '<img class="avatar" style="border:1px solid #D7EDFC" src="../files/users/avatar/' . $res['user_id'] . '.png" width="60" height="60" alt="' . $res['from'] . '" />&#160;';
  453. else
  454. echo '<img src="../images/empty.png" width="50" height="50" alt="' . $res['from'] . '" />&#160;';
  455. echo '</td><td>';
  456. }
  457. // Ðик юзера и ÑÑылка на его анкету
  458. echo(time() > $res['lastdate'] + 300 ? '<font color="gray"><i class="fa fa-mobile"></i></font> ' : '<font color="green"><i class="fa fa-mobile"></i></font> ');
  459. if ($user_id) {
  460. echo '<a href="../users/profile.php?user=' . $res['user_id'] . '"><b>'.nick($res['user_id']).'</b></a> ';
  461. } else {
  462. echo '<b>'.nick($res['user_id']).'</b> ';
  463.  
  464.  
  465.  
  466. }
  467. // Метка должноÑти
  468. $user_rights = array(
  469. 3 => '(FMod)',
  470. 6 => '(Smd)',
  471. 7 => '(Adm)',
  472. 9 => '(SV!)'
  473. );
  474. echo(isset($user_rights[$res['rights']]) ? $user_rights[$res['rights']] : '');
  475. // Закрываем таблицу Ñ Ð°Ð²Ð°Ñ‚Ð°Ñ€Ð¾Ð¼
  476.  
  477. $like = $res['thank_duoc']*1;
  478. if ($like >= 0 && $like <50)
  479. {
  480. $thank = '♥';
  481. }
  482. if ($like >= 50 && $like <100)
  483. {
  484. $thank = '♥♥';
  485. }
  486. if ($like >= 100 && $like <200)
  487. {
  488. $thank = '♥♥♥';
  489. }
  490. if ($like >= 200 && $like <500)
  491. {
  492. $thank = '♥♥♥♥';
  493. }
  494. if ($like >= 500 && $like <1000)
  495. {
  496. $thank = '♥♥♥♥♥';
  497. }
  498. if ($like >= 1000 && $like <1700)
  499. {
  500. $thank = '♥♥♥♥♥♥';
  501. }
  502. if ($like >= 1500)
  503. {
  504. $thank = '<b>[VIP]</b>';
  505. }
  506.  
  507. include ('lv.php');
  508. echo '<br />&#160;'.$chucdanh.' <font color="red"><b>' . $thank . '</b></font>';
  509. if (!empty($res['danhhieu'])) {
  510. echo '<div class="status"><b style="color:#860086;"><i class="fa fa-heart"></i> ' . $res['danhhieu'] . '</b></div>'; }
  511. if (!empty($res['status'])) {
  512. echo '<b style="color:#cd853f;"><div class="status"><small><b><i class="fa fa-star"></i> ' . $res['status'] . '</b></small></div>'; }
  513. if ($set_user['avatar']) {
  514. echo '</td></tr></table>';
  515. }
  516. echo '<div class="text_cmt""><small><div style="margin-bottom:5px;color:#BBBBBB;"><i class="fa fa-clock-o"></i> '.timepost($res['time']).'</small>';
  517. //hiện #
  518. echo'<small>';
  519. if($i == 1) {
  520. echo '<div style="float:right;">#1</div>';
  521. } else {
  522. echo '<div style="float:right;"># '.($i).'</div>';
  523. }
  524. echo '</small></div></div>';
  525. ////////////////////////////////////////////////////////////
  526. // Вывод текÑта поÑта //
  527. ////////////////////////////////////////////////////////////
  528. echo'<font color="black">';
  529. $text = $res['text'];
  530. $text = functions::checkout($text, 1, 1);
  531. if ($set_user['smileys']) {
  532. $text = functions::smileys($text, $res['rights'] ? 1 : 0);
  533. }
  534. echo $text;
  535. echo'</font>';
  536. if ($user_id && $user_id != $res['user_id']) {
  537. echo '<br/><a href="index.php?act=say&amp;id=' . $res['id'] . '&amp;start=' . $start . '"></a>&#160;' .
  538. '<div class="right"><a href="index.php?act=say&amp;id=' . $res['id'] . '&amp;start=' . $start . '&amp;cyt"><i class="fa fa-reply"></i> Trả lá»i</a></div>';
  539.  
  540. //--------Nut Likes------//
  541. $demthank = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_thank` WHERE `topic`='" . $res["id"] . "'"), 0);
  542. if ($user_id && $user_id != $res['user_id']) {
  543.  
  544. $checkthank = mysql_query('SELECT COUNT(*) FROM `forum_thank` WHERE `userthank` = "' . $user_id . '" and `topic` = "' . $res['id'] . '" and `user` = "' . $res['user_id'] . '"');
  545. echo (mysql_result($checkthank, 0) == 1 ? '<a class="button-like" href="index.php?id=' . $id . '&amp;unthanks=' . $res['id'] . '&amp;user=' . $res['user_id'] . '&amp;start=' . $start . '&amp;unthank#' . $res['id'] . '">Bá» ThÃch</a>&#160;&#160' : ' '); // Bá» thÃch
  546. if (mysql_result($checkthank, 0) < 1) {
  547. echo '<a class="button-like" href="index.php?id=' . $id . '&amp;thanks=' . $res['id'] . '&amp;user=' . $res['user_id'] . '&amp;start=' . $start . '&amp;page=' . $page . '&amp;thank#' . $res['id'] . '">ThÃch</a>'; // ThÃch
  548.  
  549. }
  550. }
  551. }
  552.  
  553.  
  554. // ЕÑли поÑÑ‚ редактировалÑÑ, показываем кем и когда
  555. if ($res['kedit']) {
  556. echo '<br /><span class="gray"><small><i class="fa fa-pencil-square-o"></i> ' . $res['edit'] . ' đã sá»a (' . $res['kedit'] . ') - <i class="fa fa-calendar"></i> '.timepost($res['tedit']).'</small></span>';
  557. }
  558. // СÑылки на редактирование / удаление поÑтов
  559.  
  560.  
  561.  
  562. if (
  563. (($rights2 == 3 || $rights2 >= 6 || $rights == 3 || $rights >= 6 || $curator) && $rights >= $res['rights'])
  564. || ($res['user_id'] == $user_id && !$set_forum['upfp'] && $res['time'] > time() - 5000)
  565. || ($res['user_id'] == $user_id && $set_forum['upfp'] && $start == 0 && $i == 1 && $res['time'] > time() - 5000)
  566. || ($i == 1 && $allow == 2 && $res['user_id'] == $user_id)
  567. ) {
  568. // СÑылки на редактирование / удаление поÑтов
  569. echo '<br />';
  570. $menu = array('<a href="index.php?act=editpost&amp;id=' . $res['id'] . '"><small>Sá»a</small></a>','<a href="index.php?act=addfile&amp;id='.$res['id'].'"><small>Upload</small></a>',
  571. ($rights >= 7 && $res['close'] == 1 ? '<a href="index.php?act=editpost&amp;do=restore&amp;id=' . $res['id'] . '">' . $lng_forum['restore'] . '</a>' : ''),
  572. ($res['close'] == 1 ? '' : '<a href="index.php?act=editpost&amp;do=del&amp;id=' . $res['id'] . '"><small>Xoá</small></a>')
  573. );
  574. echo '</small>';
  575. echo functions::display_menu($menu);
  576.  
  577.  
  578.  
  579. // Показываем, кто удалил поÑÑ‚
  580. if ($res['close']) {
  581. echo '<div class="red">' . $lng_forum['who_delete_post'] . ': <b>' . $res['close_who'] . '</b></div>';
  582. } elseif (!empty($res['close_who'])) {
  583. echo '<div class="green">' . $lng_forum['who_restore_post'] . ': <b>' . $res['close_who'] . '</b></div>';
  584. }
  585. }
  586.  
  587.  
  588. // Thong Ke So Nguoi Thank
  589. $thongkethank = mysql_query("SELECT COUNT(*) from `forum_thank` where `topic`='" . $res["id"] . "'");
  590. $thongkethanks = mysql_result($thongkethank, 0);
  591. // $thongkethanks=mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_thank` WHERE `topic` = "' . $res['id'] . '"')), 0);
  592. $thongkea= @mysql_query("select * from `forum_thank` where `topic` = '" . $res['id'] . "'");
  593. $thongke=mysql_fetch_array($thongkea);
  594. $idthongke=trim($_GET['idthongke']);
  595. if($thongkethanks>0&&(empty($_GET['idthongke'])))
  596. {
  597. echo'<div class="like"><div id="'.$idthongke.'"><button class="button_like" type="button"><i class="fa fa-heart"></i> '.$thongkethanks.'</button> ';
  598. $thongkeaa = @mysql_query("select * from `forum_thank` where `topic` = '" . $res['id'] . "'");while ($thongkea = mysql_fetch_array($thongkeaa))
  599.  
  600. {
  601. {
  602. $dentv=mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$thongkea['userthank'].'"'));
  603. $mkingly = mysql_query('select `rights` from `users` where id="'.$thongkea['userthank'].'"');
  604. echo ' <a href="'.$home.'/users/profile.php?user='.$thongkea['userthank'].'">'.nick($thongkea['userthank']).'</a>, ';
  605. }
  606. ++$f;
  607. }
  608. echo ' thÃch Ä‘iá»u này!</div></div>'; }
  609.  
  610. echo '</div>';
  611. ++$i;
  612. }
  613.  
  614.  
  615. // Ðижнее поле "ÐапиÑать"
  616.  
  617. echo '</p>';
  618.  
  619. if (($user_id && !$type1['edit'] && !$set_forum['upfp'] && $set['mod_forum'] != 3 && $allow != 4) || ($rights >= 7 && !$set_forum['upfp'])) {
  620. echo '<div class="menu"><form name="form2" action="index.php?act=say&amp;id=' . $id . '" method="post">';
  621. if ($set_forum['farea']) {
  622. $token = mt_rand(1000, 100000);
  623. $_SESSION['token'] = $token;
  624. echo '<p>';
  625. echo bbcode::auto_bb('form2', 'msg');
  626. echo '<textarea rows="' . $set_user['field_h'] . '" name="msg"></textarea><br/></p>' .
  627. '<p><input type="checkbox" name="addfiles" value="1" /> ' . $lng_forum['add_file'];
  628. if ($set_user['translit'])
  629. echo '<br /><input type="checkbox" name="msgtrans" value="1" /> ' . $lng['translit'];
  630. echo '</p><p><input type="submit" name="submit" value="' . $lng['write'] . '" style="width: 107px; cursor: pointer;"/> ' .
  631. (isset($set_forum['preview']) && $set_forum['preview'] ? '<input type="submit" value="' . $lng['preview'] . '" style="width: 107px; cursor: pointer;"/>' : '') .
  632. '<input type="hidden" name="token" value="' . $token . '"/>' .
  633. '</p></form></div>';
  634. } else {
  635. if ($user_id) {
  636. echo '<div style="border:1px solid #D7EDFC"><form name="form2" action="index.php?act=say&amp;id=' . $id . '&amp;page=' . $page . '" method="post" onsubmit="showLoading();">';
  637. $token = mt_rand(1000, 100000);
  638. $_SESSION['token'] = $token;
  639. echo bbcode::auto_bb('form2', 'msg');
  640. echo '<textarea rows="' . $set_user['field_h'] . '" name="msg" style="max-width:96%;margin-left:4px;margin-bottom:4px;"></textarea>';
  641. echo '<p>
  642. <button type="submit" name="submit" id="btnSubmit1"; " type="submit" name="submit" id="btnSubmit1" ; "<span type="button" class="button comment"/> Trả lá»i</button>
  643.  
  644.  
  645. </p></div></form></div>';
  646. }
  647. }
  648. }
  649.  
  650.  
  651. // ПоÑÑ‚Ñ€Ð°Ð½Ð¸Ñ‡Ð½Ð°Ñ Ð½Ð°Ð²Ð¸Ð³Ð°Ñ†Ð¸Ñ
  652. if ($colmes > $kmess) {
  653. echo '<div class="topmenu">' . functions::display_pagination('index.php?id=' . $id . '&amp;', $start, $colmes, $kmess) . '</div>';
  654. }
  655. if ($rights >= 3) {
  656. echo '<div class="phdr"><i class="fa fa-cogs"></i> Сông Ñụ</div>';
  657. }
  658. // СпиÑок кураторов
  659. // Сông Ñụ
  660. if ($rights == 3 || $rights >= 6) {
  661. echo '</p>';
  662.  
  663. echo isset($topic_vote) && $topic_vote > 0
  664. ? '<div class="list-login"><a href="index.php?act=editvote&amp;id=' . $id . '">' . $lng_forum['edit_vote'] . '</a></div><div class="menu"><a href="index.php?act=delvote&amp;id=' . $id . '">' . $lng_forum['delete_vote'] . '</a></div>'
  665. : '<div class="list-login"><a href="index.php?act=addvote&amp;id=' . $id . '">' . $lng_forum['add_vote'] . '</a></div>';
  666. echo '<div class="list-login"><a href="index.php?act=ren&amp;id=' . $id . '">' . $lng_forum['topic_rename'] . '</a></div>';
  667. // Закрыть - открыть тему
  668. if ($type1['edit'] == 1)
  669. echo '<div class="list-login"><a href="index.php?act=close&amp;id=' . $id . '">' . $lng_forum['topic_open'] . '</a></div>';
  670. else
  671. echo '<div class="list-login"><a href="index.php?act=close&amp;id=' . $id . '&amp;closed">' . $lng_forum['topic_close'] . '</a></div>';
  672. // Удалить - воÑÑтановить тему
  673. if ($type1['close'] == 1)
  674. echo '<div class="list-login"><a href="index.php?act=restore&amp;id=' . $id . '">' . $lng_forum['topic_restore'] . '</a></div>';
  675. echo '<div class="list-login"><a href="index.php?act=deltema&amp;id=' . $id . '">' . $lng_forum['topic_delete'] . '</a></div>';
  676. if ($type1['vip'] == 1)
  677. echo '<div class="list-login"><a href="index.php?act=vip&amp;id=' . $id . '">' . $lng_forum['topic_unfix'] . '</a></div>';
  678. else
  679. echo '<div class="list-login"><a href="index.php?act=vip&amp;id=' . $id . '&amp;vip">' . $lng_forum['topic_fix'] . '</a></div>';
  680. echo '<div class="list-login"><a href="index.php?act=per&amp;id=' . $id . '">' . $lng_forum['topic_move'] . '</a></div>';
  681. }
  682. break;
  683.  
  684. default:
  685. // ЕÑли неверные данные, показываем ошибку
  686. echo functions::display_error($lng['error_wrong_data']);
  687. break;
  688. }
  689. } else {
  690. ////////////////////////////////////////////////////////////
  691. // СпиÑок Категорий форума //
  692. ////////////////////////////////////////////////////////////
  693. $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_forum_files`" . ($rights >= 7 ? '' : " WHERE `del` != '1'")), 0);
  694. echo
  695. '<div class="phdr"><b>' . $lng['forum'] . '</b><a href="search.php" style="float:right;"><i class="fa fa-search"></i>' . $lng['search'] . '</a></div>';
  696. $req = mysql_query("SELECT `id`, `text`, `soft` FROM `forum` WHERE `type`='f' ORDER BY `realid`");
  697. $i = 0;
  698. while (($res = mysql_fetch_array($req)) !== false) {
  699. echo '<div class="list-login">';
  700. $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='r' and `refid`='" . $res['id'] . "'"), 0);
  701. echo '<a href="index.php?id=' . $res['id'] . '">' . $res['text'] . '</a> [' . $count . ']';
  702. if (!empty($res['soft']))
  703. echo '<div class="sub"><span class="gray">' . $res['soft'] . '</span></div>';
  704. echo '</div>';
  705. ++$i;
  706. }
  707. unset($_SESSION['fsort_id']);
  708. unset($_SESSION['fsort_users']);
  709. }
  710. }
  711. require_once('../incfiles/end.php');
12.03.2017 / 17:58
MrKen
Bài đăng: 2653
Trùm!
Vẫn là A N H

không liên quan đến file này

12.03.2017 / 18:58
HackerPro
Bài đăng: 220
Member
123baylenuocmo's
MrKen đã viết

không liên quan đến file này

có phải là forum/includes/new.php

12.03.2017 / 19:27
MrKen
Bài đăng: 2653
Trùm!
Vẫn là A N H

không tạo được chủ đề thì nt.php

không đăng được bài thì say.php

13.03.2017 / 13:05
HackerPro
Bài đăng: 220
Member
123baylenuocmo's
MrKen đã viết

không tạo được chủ đề thì nt.php

không đăng được bài thì say.php

chỉ bị lỗi không post đc chủ đề thôi :) xem hộ có lỗi không?? :))

PHP
  1. <?php
  2.  
  3. /**
  4.  * @package JohnCMS
  5.  * @link http://johncms.com
  6.  * @copyright Copyright (C) 2008-2011 JohnCMS Community
  7.  * @license LICENSE.txt (see attached file)
  8.  * @version VERSION.txt (see attached file)
  9.  * @author http://johncms.com/about
  10.  */
  11.  
  12. defined('_IN_JOHNCMS') or die('Error: restricted access');
  13.  
  14. /*
  15. -----------------------------------------------------------------
  16. Закрываем доÑтуп Ð´Ð»Ñ Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð½Ñ‹Ñ… Ñитуаций
  17. -----------------------------------------------------------------
  18. */
  19. if (!$id || !$user_id || isset($ban['1']) || isset($ban['11']) || (!core::$user_rights && $set['mod_forum'] == 3)) {
  20. require('../incfiles/head.php');
  21. echo functions::display_error($lng['access_forbidden']);
  22. require('../incfiles/end.php');
  23. exit;
  24. }
  25.  
  26. /*
  27. -----------------------------------------------------------------
  28. Ð’ÑÐ¿Ð¾Ð¼Ð¾Ð³Ð°Ñ‚ÐµÐ»ÑŒÐ½Ð°Ñ Ð¤ÑƒÐ½ÐºÑ†Ð¸Ñ Ð¾Ð±Ñ€Ð°Ð±Ð¾Ñ‚ÐºÐ¸ ÑÑылок форума
  29. -----------------------------------------------------------------
  30. */
  31. function forum_link($m)
  32. {
  33. global $set;
  34. if (!isset($m[3])) {
  35. return '[url=' . $m[1] . ']' . $m[2] . '[/url]';
  36. } else {
  37. $p = parse_url($m[3]);
  38. if ('http://' . $p['host'] . (isset($p['path']) ? $p['path'] : '') . '?id=' == $set['homeurl'] . '/forum/index.php?id=') {
  39. $thid = abs(intval(preg_replace('/(.*?)id=/si', '', $m[3])));
  40. $req = mysql_query("SELECT `text` FROM `forum` WHERE `id`= '$thid' AND `type` = 't' AND `close` != '1'");
  41. if (mysql_num_rows($req) > 0) {
  42. $res = mysql_fetch_array($req);
  43. $name = strtr($res['text'], array(
  44. '&quot;' => '',
  45. '&amp;' => '',
  46. '&lt;' => '',
  47. '&gt;' => '',
  48. '&#039;' => '',
  49. '[' => '',
  50. ']' => ''
  51. ));
  52. if (mb_strlen($name) > 40)
  53. $name = mb_substr($name, 0, 40) . '...';
  54.  
  55. return '[url=' . $m[3] . ']' . $name . '[/url]';
  56. } else {
  57. return $m[3];
  58. }
  59. } else
  60. return $m[3];
  61. }
  62. }
  63.  
  64. // Проверка на флуд
  65. $flood = functions::antiflood();
  66. if ($flood) {
  67. require('../incfiles/head.php');
  68. echo functions::display_error($lng['error_flood'] . ' ' . $flood . $lng['sec'] . ', <a href="index.php?id=' . $id . '&amp;start=' . $start . '">' . $lng['back'] . '</a>');
  69. require('../incfiles/end.php');
  70. exit;
  71. }
  72.  
  73. $req_r = mysql_query("SELECT * FROM `forum` WHERE `id` = '$id' AND `type` = 'r' LIMIT 1");
  74. if (!mysql_num_rows($req_r)) {
  75. require('../incfiles/head.php');
  76. echo functions::display_error($lng['error_wrong_data']);
  77. require('../incfiles/end.php');
  78. exit;
  79. }
  80. $res_r = mysql_fetch_assoc($req_r);
  81.  
  82. $th = isset($_POST['th']) ? functions::check(mb_substr(trim($_POST['th']), 0, 100)) : '';
  83. $msg = isset($_POST['msg']) ? functions::checkin(trim($_POST['msg'])) : '';
  84. if (isset($_POST['msgtrans'])) {
  85. $th = functions::trans($th);
  86. $msg = functions::trans($msg);
  87. }
  88. $msg = preg_replace_callback('~\\[url=(http://.+?)\\](.+?)\\[/url\\]|(http://(www.)?[0-9a-zA-Z\.-]+\.[0-9a-zA-Z]{2,6}[0-9a-zA-Z/\?\.\~&amp;_=/%-:#]*)~', 'forum_link', $msg);
  89. if (isset($_POST['submit'])
  90. && isset($_POST['token'])
  91. && isset($_SESSION['token'])
  92. && $_POST['token'] == $_SESSION['token']
  93. ) {
  94. $error = array();
  95. if (empty($th))
  96. $error[] = $lng_forum['error_topic_name'];
  97. if (mb_strlen($th) < 2)
  98. $error[] = $lng_forum['error_topic_name_lenght'];
  99. if (empty($msg))
  100. $error[] = $lng['error_empty_message'];
  101. if (mb_strlen($msg) < 4)
  102. $error[] = $lng['error_message_short'];
  103. if (!$error) {
  104. $msg = preg_replace_callback('~\\[url=(http://.+?)\\](.+?)\\[/url\\]|(http://(www.)?[0-9a-zA-Z\.-]+\.[0-9a-zA-Z]{2,6}[0-9a-zA-Z/\?\.\~&amp;_=/%-:#]*)~', 'forum_link', $msg);
  105. // ПрверÑем, еÑть ли уже Ñ‚Ð°ÐºÐ°Ñ Ñ‚ÐµÐ¼Ð° в текущем разделе?
  106. if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 't' AND `refid` = '$id' AND `text` = '$th'"), 0) > 0)
  107. $error[] = $lng_forum['error_topic_exists'];
  108. // ПроверÑем, не повторÑетÑÑ Ð»Ð¸ Ñообщение?
  109. $req = mysql_query("SELECT * FROM `forum` WHERE `user_id` = '$user_id' AND `type` = 'm' ORDER BY `time` DESC");
  110. if (mysql_num_rows($req) > 0) {
  111. $res = mysql_fetch_array($req);
  112. if ($msg == $res['text'])
  113. $error[] = $lng['error_message_exists'];
  114. }
  115. }
  116. if (!$error) {
  117. unset($_SESSION['token']);
  118.  
  119. // ЕÑли задано в наÑтройках, то назначаем топикÑтартера куратором
  120. $curator = $res_r['edit'] == 1 ? serialize(array($user_id => $login)) : '';
  121.  
  122. // ДобавлÑем тему
  123. mysql_query("INSERT INTO `forum` SET
  124. `refid` = '$id',
  125. `type` = 't',
  126. `time` = '" . time() . "',
  127. `user_id` = '$user_id',
  128. `from` = '$login',
  129. `text` = '$th',
  130. `soft` = '',
  131. `edit` = '',
  132. `curators` = '$curator'
  133. ");
  134. $rid = mysql_insert_id();
  135.  
  136. // ДобавлÑем текÑÑ‚ поÑта
  137. mysql_query("INSERT INTO `forum` SET
  138. `refid` = '$rid',
  139. `type` = 'm',
  140. `time` = '" . time() . "',
  141. `user_id` = '$user_id',
  142. `from` = '$login',
  143. `ip` = '" . core::$ip . "',
  144. `ip_via_proxy` = '" . core::$ip_via_proxy . "',
  145. `soft` = '" . mysql_real_escape_string($agn) . "',
  146. `text` = '" . mysql_real_escape_string($msg) . "',
  147. `edit` = '',
  148. `curators` = ''
  149. ");
  150.  
  151. $postid = mysql_insert_id();
  152.  
  153. // ЗапиÑываем Ñчетчик поÑтов юзера
  154. $fpst = $datauser['postforum'] + 1;
  155. mysql_query("UPDATE `users` SET
  156. `postforum` = '$fpst',
  157. `lastpost` = '" . time() . "'
  158. WHERE `id` = '$user_id'
  159. ");
  160.  
  161. // Ставим метку о прочтении
  162. mysql_query("INSERT INTO `cms_forum_rdm` SET
  163. `topic_id`='$rid',
  164. `user_id`='$user_id',
  165. `time`='" . time() . "'
  166. ");
  167.  
  168. if ($_POST['addfiles'] == 1) {
  169. header("Location: index.php?id=$postid&act=addfile");
  170. } else {
  171. header("Location: index.php?id=$rid");
  172. }
  173. } else {
  174. // Выводим Ñообщение об ошибке
  175. require('../incfiles/head.php');
  176. echo functions::display_error($error, '<a href="index.php?act=nt&amp;id=' . $id . '">' . $lng['repeat'] . '</a>');
  177. require('../incfiles/end.php');
  178. exit;
  179. }
  180. } else {
  181. $req_c = mysql_query("SELECT * FROM `forum` WHERE `id` = '" . $res_r['refid'] . "'");
  182. $res_c = mysql_fetch_assoc($req_c);
  183. require('../incfiles/head.php');
  184. if ($datauser['postforum'] == 0) {
  185. if (!isset($_GET['yes'])) {
  186. $lng_faq = core::load_lng('faq');
  187. echo '<p>' . $lng_faq['forum_rules_text'] . '</p>';
  188. echo '<p><a href="index.php?act=nt&amp;id=' . $id . '&amp;yes">' . $lng_forum['agree'] . '</a> | <a href="index.php?id=' . $id . '">' . $lng_forum['not_agree'] . '</a></p>';
  189. require('../incfiles/end.php');
  190. exit;
  191. }
  192. }
  193. $msg_pre = functions::checkout($msg, 1, 1);
  194. if ($set_user['smileys'])
  195. $msg_pre = functions::smileys($msg_pre, $datauser['rights'] ? 1 : 0);
  196. $msg_pre = preg_replace('#\[c\](.*?)\[/c\]#si', '<div class="quote">\1</div>', $msg_pre);
  197. echo '<div class="phdr"><a href="index.php?id=' . $id . '"><b>' . $lng['forum'] . '</b></a> | ' . $lng_forum['new_topic'] . '</div>';
  198. if ($msg && $th && !isset($_POST['submit']))
  199. echo '<div class="list1">' . functions::image('op.gif') . '<span style="font-weight: bold">' . $th . '</span></div>' .
  200. '<div class="list2">' . functions::display_user($datauser, array('iphide' => 1, 'header' => '<span class="gray">(' . functions::display_date(time()) . ')</span>', 'body' => $msg_pre)) . '</div>';
  201. echo '<form name="form" action="index.php?act=nt&amp;id=' . $id . '" method="post">' .
  202. '<div class="gmenu">' .
  203. '<p><h3>' . $lng['section'] . '</h3>' .
  204. '<a href="index.php?id=' . $res_c['id'] . '">' . $res_c['text'] . '</a> | <a href="index.php?id=' . $res_r['id'] . '">' . $res_r['text'] . '</a></p>' .
  205. '<p><h3>' . $lng_forum['new_topic_name'] . '</h3>' .
  206. '<input type="text" size="20" maxlength="100" name="th" value="' . $th . '"/></p>' .
  207. '<p><h3>' . $lng_forum['post'] . '</h3>';
  208. echo '</p><p>' . bbcode::auto_bb('form', 'msg');
  209. echo '<textarea rows="' . $set_user['field_h'] . '" name="msg">' . (isset($_POST['msg']) ? functions::checkout($_POST['msg']) : '') . '</textarea></p>' .
  210. '<p><input type="checkbox" name="addfiles" value="1" ' . (isset($_POST['addfiles']) ? 'checked="checked" ' : '') . '/> ' . $lng_forum['add_file'];
  211. if ($set_user['translit']) {
  212. echo '<br /><input type="checkbox" name="msgtrans" value="1" ' . (isset($_POST['msgtrans']) ? 'checked="checked" ' : '') . '/> ' . $lng['translit'];
  213. }
  214. $token = mt_rand(1000, 100000);
  215. $_SESSION['token'] = $token;
  216. echo '</p><p><input type="submit" name="submit" value="' . $lng['save'] . '" style="width: 107px; cursor: pointer;"/> ' .
  217. ($set_forum['preview'] ? '<input type="submit" value="' . $lng['preview'] . '" style="width: 107px; cursor: pointer;"/>' : '') .
  218. '<input type="hidden" name="token" value="' . $token . '"/>' .
  219. '</p></div></form>' .
  220. '<div class="phdr"><a href="../pages/faq.php?act=trans">' . $lng['translit'] . '</a> | ' .
  221. '<a href="../pages/faq.php?act=smileys">' . $lng['smileys'] . '</a></div>' .
  222. '<p><a href="index.php?id=' . $id . '">' . $lng['back'] . '</a></p>';
  223. }
Đã chỉnh sửa. HackerPro (13.03.2017 / 13:09)
13.03.2017 / 16:47
MrKen
Bài đăng: 2653
Trùm!
Vẫn là A N H

file này nhìn qua thấy y như bản gốc rồi. chắc lỗi do chỗ khác

13.03.2017 / 20:29
HackerPro
Bài đăng: 220
Member
123baylenuocmo's
MrKen đã viết

file này nhìn qua thấy y như bản gốc rồi. chắc lỗi do chỗ khác

chắc bị lỗi ở chỗ nào đó :20:

14.03.2017 / 13:16
HackerPro
Bài đăng: 220
Member
123baylenuocmo's

không ai giúp à :yao1:

14.03.2017 / 14:38
hanhphucao
Bài đăng: 2470
Admin
Admin là người tận tâm và luôn hành xử đúng mực.

Khi post có báo lỗi gì không :)

14.03.2017 / 17:55
HackerPro
Bài đăng: 220
Member
123baylenuocmo's
hanhphucao đã viết

Khi post có báo lỗi gì không :)

nó không báo lỗi gì, nhưng nó vẫn ở trang post chủ đề :yao1: