Файл: wall/repost.php
Строк: 56
<?php
require_once '../incfiles/core.php';
require_once '../incfiles/func.php';
require_once '../incfiles/auth.php';
require_once '../incfiles/user.php';
if (empty($user_id)) go(URL);
if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
$id = abs(intval($_GET['id']));
$result = mysql_query("SELECT * FROM `wall` WHERE `id` = '".$id."' AND `user_id` != '".$user_id."' AND `wall_id` != '".$user_id."' LIMIT 1");
if (mysql_num_rows($result) == false) go(URL.'/wall/post.php?id='.$id);
$arr_post = mysql_fetch_array($result);
}
else go(URL);
if ($arr_post['type'] == 'repost') go(URL.'/wall/repost.php?id='.$arr_post['repost_id'].'&rid='.$id);
else if ($arr_post['type'] == 'group_repost') go(URL.'/groups/wall/repost.php?id='.$arr_post['repost_id'].'&rid='.$id);
if (!empty($_GET['rid']) && is_numeric($_GET['rid']))
{
$rid = abs(intval($_GET['rid']));
$result2 = mysql_query("SELECT * FROM `wall` WHERE `id` = '".$rid."' AND `repost_id` = '".$id."' AND `user_id` != '".$user_id."' AND `wall_id` != '".$user_id."' LIMIT 1");
if (mysql_num_rows($result2) == false) go(URL.'/wall/post.php?id='.$id);
$arr_repost = mysql_fetch_array($result2);
}
$title = lang('Поделиться','Поділитися');
require_once '../incfiles/head.php';
require_once 'handler/repost.php';
?>
<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){
Page.Go('<?echo URL.'/?id='.$user_id;?>');
}
}
});
});
});
</script>
<?
echo '<div class="title">'.$title.'</div>
<form id="form" method="post" action="'.URL.'/wall/repost.php?id='.$id.''.($rid?'&rid='.$rid:'').'">
<div class="block">
<textarea id="textarea" class="input" name="text" rows="4" placeholder="'.lang('Введите Ваш комментарий..','Введіть Ваш коментар..').'"></textarea>
<input type="hidden" name="form_repost" value="1"/>
</div><div class="block2">';
echo wall_post($arr_post,1);
echo ' </div><div class="block2">
<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>
</div>
</form>
<div id="form_content"></div>';
require_once '../incfiles/foot.php';
?>