Файл: modules/askworld/view.php
Строк: 110
<?php
require_once '../../incfiles/core.php';
require_once '../../incfiles/func.php';
require_once '../../incfiles/auth.php';
require_once '../../incfiles/user.php';
//require_once 'handler/del_video.php';
if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
$id = abs(intval($_GET['id']));
$result = mysql_query("SELECT * FROM `askworld_msg` WHERE `id` = '".$id."' LIMIT 1");
if (mysql_num_rows($result) == true)
{
$arr_post = mysql_fetch_array(mysql_query("SELECT * FROM `askworld_msg` WHERE `id` = '".$id."' LIMIT 1"));
$arr_user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$arr_post['user_id']."' LIMIT 1"));
$count_view = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `video_view` WHERE `v_id` = '".$id."'"),0);
// Антифлуд
/* $i=30;
$fl =(time()-$i);
if (mysql_result(mysql_query("SELECT COUNT(`id`) FROM `video_view` WHERE `v_id` = '".$id."' AND `time` > '".$fl."'"),0) == true) $flood = true;
if($flood == false)mysql_query("INSERT INTO `video_view` SET `v_id` = '".$id."', `user_id` = '".$user_id."', `time` = '".time()."'");*/
}
else
{
go(URL.'/');
}
}
else
{
go(URL.'/');
}
$title = lang('Обсудить тему :"'.$arr_post['text'].'"','Обговорити тему :"'.$arr_post['text'].'"');
require_once '../../incfiles/head.php';
echo '<div class="title">'. $title.' </div>';
echo '<div class="main_block">';
$query = mysql_query("SELECT * FROM `askworld_msg` WHERE `id` = '".$id."' ORDER by `time` DESC LIMIT 1");
while ($arr_post = mysql_fetch_array($query))
{
echo '<div class="status"><p><H2>'.text_view(convert_clickable_links($arr_post['text'])).'</H2></p></div>';
echo '<div class="status-q">'.text_view(convert_clickable_links($arr_post['text2'])).'</div>';
echo '<div class="right">'.user_name($arr_post['user_id']).''.vtime($arr_post['time']).'</div><div class="clear"></div>';
if (!empty($user_id))
{
if ($site_version == 'default')
{
?>
<script type="text/javascript">
$(function(){
$('#form').on('submit', function(e){
e.preventDefault();
var $that = $(this),
formData = new FormData($that.get(0));
$.ajax({
url: $that.attr('action'),
type: $that.attr('method'),
contentType: false,
processData: false,
data: formData,
success: function(response){
if(response){
$('#content_comm').load($that.attr('action')+ '#content_comm .comm');
$('#textarea').val('');
}
}
});
});
});
$(function(){
$('#form_re_comm').on('submit', function(e){
e.preventDefault();
var $that = $(this),
formData = new FormData($that.get(0));
$.ajax({
url: $that.attr('action'),
type: $that.attr('method'),
contentType: false,
processData: false,
data: formData,
success: function(response){
if(response){
Page.Go($that.attr('action'));
}
}
});
});
});
</script>
<?
}
require_once 'handler/del_comm.php';
require_once 'handler/comm.php';
echo '<div class="block2">
<form id="form" method="post" action="'.URL.'/modules/askworld/view.php?id='.$id.'">
<textarea id="textarea" class="input" name="comm" rows="4"></textarea>
<input class="button2" type="submit" value="'.lang('Написать','Написати').'"/>
<a class="button3" href="'.URL.'/ajax/smiles.php" onclick="FormContent.Smiles(this.href); return false"><img src="'.URL.'/design/img/smile.png"/></a>
</form>
</div>
<div id="form_content"></div>';
}
echo '<div class="title">'.lang('Ответы','Відповіді').' </div>';
echo '<div id="content_comm"><div class="comm">';
$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `askworld_comm` WHERE `fid` = '".$arr_post['id']."' LIMIT 1"),0);
if ($all == true)
{
$cp = ceil($all/10);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*10-10;
$arr_comm = mysql_query("SELECT * FROM `askworld_comm` WHERE `fid` = '".$arr_post['id']."' ORDER by `time` DESC LIMIT $start,10");
while ($arr = mysql_fetch_array($arr_comm))
{
echo '<div class="block">';
if (!empty($user_id) && $user_id == $arr_user['id'] or !empty($user_id) && $user_id == $arr['user_id']) echo '<div class="right"><a href="'.URL.'/modules/askworld/view.php?id='.$id.'&p='.$p.'&del_comm='.$arr['id'].'" onclick="Form.delPost(this.href); return false"><img src="'.URL.'/design/img/closed.png"/></a></div>';
echo user_name($arr['user_id']).'<br/>'.vtime($arr['time']).'<ul>';
if (!empty($arr['quote_id'])) echo '<div class="quote">'.user_name($arr['quote_id']).' '.lang('пишет','пише').':<ul>'.smiles(text($arr['quote'])).'</ul></div>';
echo smiles(text($arr['text'])).'</ul>';
if (!empty($user_id) && $user_id != $arr['user_id'])
{
echo '<ul><a class="link_re_comm" id="link_re_comm_'.$arr['id'].'" href="" onclick="Form.reComm('.$arr['id'].'); return false">'.lang('Ответить','Відповісти').'</a></ul>
<div class="re_comm" id="re_comm_'.$arr['id'].'">
<form id="form_re_comm" method="post" action="'.URL.'/modules/askworld/view.php?id='.$id.'">
<textarea class="input" name="re_comm" rows="4"></textarea>
<input type="hidden" name="re_id" value="'.$arr['id'].'"/>
<input class="button2" type="submit" value="'.lang('Написать','Написати').'"/>
</form>
</div>';
}
echo '</div>';
}
navi($p,$cp,''.URL.'/modules/askworld/view.php?id='.$id.'&');
}
echo '</div></div>';
}
require_once '../../incfiles/foot.php';
?>