File size: 3.43Kb
<?php
require_once('../wu_init.php');
if (!wu_token()) { exit('wu-error'); }
if (!USER_LOGGED) { exit('wu-error'); }
require('../wu-functions/wu_functions.php');
require('../wu-functions/bbdecoder/Parser.php');
if(isset($_POST['id']) && isset($_POST['last'])){
$id = intval($_POST['id']);
$isticet = mysqli_num_rows(mysqli_query($connect_db, "SELECT id FROM `".DB_PREFIX."_tickets_main` WHERE id='$id' AND usr='$u_id' LIMIT 1"));
if ($isticet == 0) { exit('wu-error'); }
//Создание аватаров
$ava_link_thumb_u = '/wu-static/img/avatar_default_adm.png'; $ava_link_full_u = '/wu-static/img/avatar_default_adm.png';
if (empty($nowuser['av'])) { $ava_link_thumb_my = '/wu-static/img/avatar_default.png'; $ava_link_full_my = '/wu-static/img/avatar_default.png'; } else { $ava_link_thumb_my = '/wu-uploads/avatars/thumbs/'.$nowuser['av']; $ava_link_full_my = '/wu-uploads/avatars/full/'.$nowuser['av']; }
//Запуск парсера
$parser = new JBBCode\Parser();
$parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet());
//Вывод сообщений
$last = $_POST['last'];
$last = str_replace('m_', '', $last);
$last = intval($last);
$qm = mysqli_query($connect_db, "SELECT * from (SELECT id,msg,files,frm,bb,sm,dt FROM `".DB_PREFIX."_tickets_msg` WHERE tid = '$id' AND id > '$last' ORDER BY id DESC) AS te ORDER BY te.id ASC");
$qh = mysqli_num_rows($qm);
if ($qh > 0) {
mysqli_query($connect_db, "UPDATE `".DB_PREFIX."_tickets_main` SET new_u = '0' WHERE id='$id' AND usr='$u_id' AND new_u = '1'");
while($row = mysqli_fetch_assoc($qm)) {
//Вывод прикреплений
if (!empty($row['files'])) {
$images = array('gif','jpg', 'png', 'jpeg');
$files_e = '';
$files = explode('|', $row['files']);
foreach ($files as $file) {
$expl = explode(':', $file);
$ifile = $expl[0];
$iname = $expl[1];
$exp = explode('.', $ifile);
$exp_e = strtolower($exp[1]);
if (!empty($file)){
if (in_array($exp_e, $images)) {
$files_e .= '<div class="border-thumbnail-preview tip lightgallerys" data-placement="bottom" title="'.$iname.'"><a href="/wu-uploads/attach/full/'.$ifile.'"><img class="img-thumbnail-preview" src="/wu-uploads/attach/thumbs/'.$ifile.'" alt="'.$iname.'" /></a></div>';
} else {
if ($row['frm'] == 0) { $txti = ''; } else { $txti = ' text-info'; }
$files_e .= '<a href="/wu-engine/wu-actions/attach_download/'.strrev(base64_encode($ifile.'|'.$iname)).'" class="icon-thumbnail-preview tip" data-placement="bottom" title="'.$iname.'"><i class="icon-file6'.$txti.'"></i></a>';
}
}
}
} else { $files_e = ''; }
?>
<div class="mc_<?php echo $row['id']; ?> message<?php if ($row['frm'] == 1) { echo ' reversed'; } ?>" id="m_<?php echo $row['id']; ?>">
<div class="lightgallerys <?php if ($row['frm'] == 0) { echo 'flleft'; } else { echo 'flright'; } ?>">
<a href="<?php if ($row['frm'] == 0) { echo $ava_link_full_my; } else { echo $ava_link_full_u; } ?>"><img src="<?php if ($row['frm'] == 0) { echo $ava_link_thumb_my; } else { echo $ava_link_thumb_u; } ?>" class="media-object" /></a>
</div>
<div class="message-body<?php if ($row['frm'] == 0) { echo ' msg-link'; } ?>">
<?php
$parser->parse(htmlentities($row['msg']));
$parsered = $parser->getAsHtml();
echo wu_smile(nl2br($parsered));
if (!empty($row['files'])) {
if (!empty($row['msg'])) { echo '<br />'; }
echo '<div>Прикреплённые файлы:<br />'.$files_e.'</div>';
}
?>
<span class="attribution"><?php echo wudatenorm($row['dt']); ?></span>
</div>
</div>
<?php
}
}
} else { exit('wu-error'); }
?>