$textl = $lng['mail']; require_once '../incfiles/head.php'; echo '<div class="phdr"><b>' . $lng_mail['input_messages'] . '</b></div>'; $total = mysql_result(mysql_query("SELECT COUNT(*)\n FROM (SELECT DISTINCT `cms_mail`.`user_id`\n FROM `cms_mail`\n LEFT JOIN `cms_contact` ON `cms_mail`.`user_id`=`cms_contact`.`from_id`\n WHERE `cms_mail`.`from_id`='{$user_id}'\n AND `cms_mail`.`delete`!='{$user_id}'\n AND `cms_mail`.`sys`='0'\n AND `cms_contact`.`ban`!='1') `tmp`"), 0); if ($total) { $req = mysql_query("SELECT `users`.*, MAX(`cms_mail`.`time`) AS `time`\n\t\tFROM `cms_mail`\n\t\tLEFT JOIN `users` ON `cms_mail`.`user_id`=`users`.`id`\n\t\tLEFT JOIN `cms_contact` ON `cms_mail`.`user_id`=`cms_contact`.`from_id` AND `cms_contact`.`user_id`='{$user_id}'\n\t\tWHERE `cms_mail`.`from_id`='{$user_id}'\n\t\tAND `cms_mail`.`delete`!='{$user_id}'\n\t\tAND `cms_mail`.`sys`='0'\n\t\tAND `cms_contact`.`ban`!='1'\n\t\tGROUP BY `cms_mail`.`user_id`\n\t\tORDER BY MAX(`cms_mail`.`time`) DESC\n\t\tLIMIT " . $start . "," . $kmess); for ($i = 0; $row = mysql_fetch_assoc($req); ++$i) { $count_message = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_mail`\n WHERE `user_id`='{$row['id']}'\n AND `from_id`='{$user_id}'\n AND `delete`!='{$user_id}'\n AND `sys`!='1'\n "), 0); $last_msg = mysql_fetch_assoc(mysql_query("SELECT *\n FROM `cms_mail`\n WHERE `from_id`='{$user_id}'\n AND `user_id` = '{$row['id']}'\n AND `delete` != '{$user_id}'\n ORDER BY `id` DESC\n LIMIT 1")); if (mb_strlen($last_msg['text']) > 500) { $text = mb_substr($last_msg['text'], 0, 500); $text = functions::checkout($text, 1, 1); if ($set_user['smileys']) { $text = functions::smileys($text, $res['rights'] ? 1 : 0); } $text = bbcode::notags($text); $text .= '...<a href="index.php?act=write&id=' . $row['id'] . '">' . $lng['continue'] . ' >></a>'; } else { // Или, обрабатываем тэги и выводим весь текст $text = functions::checkout($last_msg['text'], 1, 1); if ($set_user['smileys']) { $text = functions::smileys($text, $res['rights'] ? 1 : 0); } } $arg = array('header' => '<span class="gray">(' . functions::display_date($last_msg['time']) . ')</span>', 'body' => '<div style="font-size: small">' . $text . '</div>', 'sub' => '<p><a href="index.php?act=write&id=' . $row['id'] . '"><b>' . $lng_mail['correspondence'] . '</b></a> (' . $count_message . ') | <a href="index.php?act=ignor&id=' . $row['id'] . '&add">Игнор</a> | <a href="index.php?act=deluser&id=' . $row['id'] . '">' . $lng['delete'] . '</a></p>', 'iphide' => 1); if (!$last_msg['read']) { echo '<div class="gmenu">'; } else { echo $i % 2 ? '<div class="list1">' : '<div class="list2">'; } echo functions::display_user($row, $arg);
echo functions::display_error('Нельзя отвечать на свое же сообщение', '<a href="index.php?id=' . $th1['id'] . '">' . $lng['back'] . '</a>'); require '../incfiles/end.php'; exit; } $shift = (core::$system_set['timeshift'] + core::$user_set['timeshift']) * 3600; $vr = date("d.m.Y / H:i", $type1['time'] + $shift); $msg = isset($_POST['msg']) ? functions::checkin(trim($_POST['msg'])) : ''; $txt = isset($_POST['txt']) ? intval($_POST['txt']) : FALSE; if (isset($_POST['msgtrans'])) { $msg = functions::trans($msg); } $to = $type1['from']; if (!empty($_POST['citata'])) { // Если была цитата, форматируем ее и обрабатываем $citata = isset($_POST['citata']) ? trim($_POST['citata']) : ''; $citata = bbcode::notags($citata); $citata = preg_replace('#\\[c\\](.*?)\\[/c\\]#si', '', $citata); $citata = mb_substr($citata, 0, 200); $tp = date("d.m.Y H:i", $type1['time']); $msg = '[c]' . $to . ' ([time]' . $tp . "[/time])\r\n" . $citata . '[/c]' . $msg; } elseif (isset($_POST['txt'])) { // Если был ответ, обрабатываем реплику switch ($txt) { case 2: $repl = $type1['from'] . ', ' . $lng_forum['reply_1'] . ', '; break; case 3: $repl = $type1['from'] . ', ' . $lng_forum['reply_2'] . ' ([url=' . $set['homeurl'] . '/forum/index.php?act=post&id=' . $type1['id'] . ']' . $vr . '[/url]) ' . $lng_forum['reply_3'] . ', '; break; case 4: $repl = $type1['from'] . ', ' . $lng_forum['reply_4'] . ' ';
if ($datauser['journal_forum']) { echo '<div class="topmenu">Notifikasi Baru : ' . $datauser['journal_forum'] . '</div>'; mysql_query("UPDATE `users` SET `journal_forum`='0' WHERE `id` = '{$user_id}'"); } $total = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `id_user`='{$user_id}'" . ($rights >= 7 ? "" : " AND `close` != '1'")), 0); if ($total) { $req = mysql_query("SELECT `forum`.*, `users`.`sex`, `users`.`rights`, `users`.`lastdate`, `users`.`status`, `users`.`datereg`\n \tFROM `forum` LEFT JOIN `users` ON `forum`.`user_id` = `users`.`id`\n \tWHERE `forum`.`type` = 'm' AND `forum`.`id_user`='{$user_id}'" . ($rights >= 7 ? "" : " AND `forum`.`close` != '1'") . " ORDER BY `forum`.`id` DESC LIMIT {$start}, {$kmess}"); while (($res = mysql_fetch_assoc($req)) !== false) { if ($res['close']) { echo '<div class="rmenu">'; } else { echo $i % 2 ? '<div class="list2">' : '<div class="list1">'; } $theme = mysql_fetch_assoc(mysql_query("SELECT `text` FROM `forum` WHERE `id` = '" . $res['refid'] . "' ORDER BY `id` ASC LIMIT 1")); echo 'Nick / User <a href="profile.php?user='******'user_id'] . '"><b>' . $res['from'] . '</b></a> telah menjawab postingan anda pada Thread <a href="../forum/index.php?id=' . $res['refid'] . '">' . $theme['text'] . '</a>' . ' <span class="gray">(' . date("d.m.Y / H:i", $res['time'] + $set_user['sdvig'] * 3600) . ')</span><div class="menu"><small>' . '<a href="../forum/index.php?act=post&id=' . $res['id'] . '">Baca Jawaban</a> ' . '<a href="../forum/index.php?act=say&id=' . $res['id'] . '"> ' . $lng_forum['reply_btn'] . '</a> ' . '<a href="../forum/index.php?act=say&id=' . $res['id'] . '&cyt"> ' . $lng_forum['cytate_btn'] . '</a> </small></div><div class="menu"><small>'; $text = bbcode::notags(functions::checkout(mb_substr($res['text'], 0, 150), 1, 1)); if (mb_strlen($res['text']) > 300) { $text .= ' <span style="color:green;">...</span>'; } if ($res['kedit']) { $text .= '<br /><span class="gray"><small>' . $lng_forum['edited'] . ' <b>' . $res['edit'] . '</b> (' . date("d.m /H:i", $res['tedit'] + $set_user['sdvig'] * 3600) . ') <b>[' . $res['kedit'] . ']</b></small></span>'; } echo $text; $file_req = mysql_query("SELECT * FROM `cms_forum_files` WHERE `post` = '" . $res['id'] . "'"); if (mysql_num_rows($file_req) > 0) { $file_res = mysql_fetch_assoc($file_req); $file_ile_size = round(@filesize('../files/forum/attach/' . $file_res['filename']) / 1024, 2); echo '<br /><span class="gray">' . $lng_forum['attached_file'] . ':'; $att_ext = strtolower(functions::format('./files/forum/attach/' . $file_res['filename'])); $pic_ext = array('gif', 'jpg', 'jpeg', 'png'); if (in_array($att_ext, $pic_ext)) {
/** * Обработка текстов перед выводом на экран * * @param string $str * @param int $br Параметр обработки переносов строк * 0 - не обрабатывать (по умолчанию) * 1 - обрабатывать * 2 - вместо переносов строки вставляются пробелы * @param int $tags Параметр обработки тэгов * 0 - не обрабатывать (по умолчанию) * 1 - обрабатывать * 2 - вырезать тэги * * @return string */ public static function checkout($str, $br = 0, $tags = 0) { $str = htmlentities(trim($str), ENT_QUOTES, 'UTF-8'); if ($br == 1) { // Вставляем переносы строк $str = nl2br($str); } elseif ($br == 2) { $str = str_replace("\r\n", ' ', $str); } if ($tags == 1) { $str = bbcode::tags($str); } elseif ($tags == 2) { $str = bbcode::notags($str); } return trim($str); }
private function news() { global $lng; if ($this->settings['view'] > 0) { $reqtime = $this->settings['days'] ? time() - $this->settings['days'] * 86400 : 0; $req = mysql_query("SELECT * FROM `news` WHERE `time` > '{$reqtime}' ORDER BY `time` DESC LIMIT " . $this->settings['quantity']); if (mysql_num_rows($req) > 0) { $i = 0; $news = ''; while (($res = mysql_fetch_array($req)) !== false) { $text = $res['text']; // Если текст больше заданного предела, обрезаем if (mb_strlen($text) > $this->settings['size']) { $text = mb_substr($text, 0, $this->settings['size']); $text = htmlentities($text, ENT_QUOTES, 'UTF-8'); $text .= ' <a href="news/index.php">' . $lng['next'] . '...</a>'; } else { $text = htmlentities($text, ENT_QUOTES, 'UTF-8'); } // Если включены переносы, то обрабатываем if ($this->settings['breaks']) { $text = str_replace("\r\n", "<br/>", $text); } // Обрабатываем тэги if ($this->settings['tags']) { $text = bbcode::tags($text); } else { $text = bbcode::notags($text); } // Обрабатываем смайлы if ($this->settings['smileys']) { $text = functions::smileys($text); } // Определяем режим просмотра заголовка - текста $news .= '<div class="news"><div class ="textx">'; switch ($this->settings['view']) { case 2: $news .= '<a href="news/index.php">' . $res['name'] . '</a>'; break; case 3: $news .= $text; break; default: $news .= '<b>' . $res['name'] . '</b><br />' . $text; } // Ссылка на каменты if (!empty($res['kom']) && $this->settings['view'] != 2 && $this->settings['kom'] == 1) { $mes = mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 'm' AND `refid` = '" . $res['kom'] . "'"); $komm = mysql_result($mes, 0) - 1; if ($komm >= 0) { $news .= '<br /><a href="../forum/?id=' . $res['kom'] . '">' . $lng['discuss'] . '</a> (' . $komm . ')'; } } $news .= '</div></div>'; ++$i; } return $news; } else { return false; } } }
$cut = 3000; break; default: $cut = 500; } } if ($set_forum['postcut'] && mb_strlen($text) > $cut) { $text = mb_substr($text, 0, $cut); $text = functions::checkout($text, 1, 1); $text = preg_replace('#\\[c\\](.*?)\\[/c\\]#si', '<div class="quote">\\1</div>', $text); if ($set_user['smileys']) { $text = functions::smileys($text, $res['rights'] ? 1 : 0); } //seo //echo bbcode::notags($text) . '...<br /><a href="index.php?act=post&id=' . $res['id'] . '">' . $lng_forum['read_all'] . ' >></a>'; echo bbcode::notags($text) . '...<br /><a href="' . $home . '/forum/' . functions::seo($type1['text']) . '_p' . $res['id'] . '.html">' . $lng_forum['read_all'] . ' >></a>'; } else { // Или, обрабатываем тэги и выводим весь текст $text = functions::checkout($text, 1, 1); if ($set_user['smileys']) { $text = functions::smileys($text, $res['rights'] ? 1 : 0); } echo $text; } if ($res['kedit']) { // Если пост редактировался, показываем кем и когда echo '<br /><span class="gray"><small>' . $lng_forum['edited'] . ' <b>' . $res['edit'] . '</b> (' . functions::display_date($res['tedit']) . ') <b>[' . $res['kedit'] . ']</b></small></span>'; } // Если есть прикрепленный файл, выводим его описание $freq = mysql_query("SELECT * FROM `cms_forum_files` WHERE `post` = '" . $res['id'] . "'"); if (mysql_num_rows($freq) > 0) {