Файл: groups/wall/handler/repost.php
Строк: 22
<?php
if (!empty($_POST['form_repost']))
{
$text = check($_POST['text']);
$text = substr($text, 0, 10000);
if (mysql_query("INSERT INTO `wall` SET
`user_id` = '".$user_id."',
`wall_id` = '".$user_id."',
`repost_id` = '".$arr_post['id']."',
`text` = '".$text."',
`type` = 'group_repost',
`time` = '".time()."'
") == true)
{
if (!in_array($user_id, explode("||", substr($arr_post['urepost'], 1, -1)))) mysql_query("UPDATE `groups_wall` SET `urepost` = '|".$user_id."|".$arr_post['urepost']."', `crepost` = '".($arr_post['crepost']+1)."' WHERE `id` = '".$arr_post['id']."' LIMIT 1");
if (!in_array($user_id, explode("||", substr($arr_post['ulike'], 1, -1)))) mysql_query("UPDATE `groups_wall` SET `ulike` = '|".$user_id."|".$arr_post['ulike']."', `clike` = '".($arr_post['clike']+1)."' WHERE `id` = '".$arr_post['id']."' LIMIT 1");
if ($arr_post['type'] == 'update_avatar')
{
$arr_ava = mysql_fetch_array(mysql_query("SELECT * FROM `groups_avatars` WHERE `name` = '".$arr_post['photos']."' AND `group_id` = '".$arr_post['wall_id']."' LIMIT 1"));
if (!in_array($user_id, explode("||", substr($arr_ava['ulike'], 1, -1)))) mysql_query("UPDATE `groups_avatars` SET `ulike` = '|".$user_id."|".$arr_ava['ulike']."', `clike` = '".($arr_ava['clike']+1)."' WHERE `id` = '".$arr_ava['id']."' LIMIT 1");
}
if (!empty($rid))
{
if (!in_array($user_id, explode("||", substr($arr_repost['urepost'], 1, -1)))) mysql_query("UPDATE `wall` SET `urepost` = '|".$user_id."|".$arr_repost['urepost']."', `crepost` = '".($arr_repost['crepost']+1)."' WHERE `id` = '".$rid."' LIMIT 1");
if (!in_array($user_id, explode("||", substr($arr_repost['ulike'], 1, -1)))) mysql_query("UPDATE `wall` SET `ulike` = '|".$user_id."|".$arr_repost['ulike']."', `clike` = '".($arr_repost['clike']+1)."' WHERE `id` = '".$rid."' LIMIT 1");
$id = $arr_repost['id'];
$arr_post['from_group'] = 0;
$arr_post['user_id'] = $arr_repost['user_id'];
$arr_post['urepost'] = $arr_repost['urepost'];
}
if ($user_id != $arr_post['user_id'] && $arr_post['from_group']==0 && !in_array($user_id, explode("||", substr($arr_post['urepost'], 1, -1))) && mysql_query("INSERT INTO `notifications` SET
`from_id` = '".$user_id."',
`sex` = '".$user['sex']."',
`for_id` = '".$arr_post['user_id']."',
`mod` = 'group_wall',
`type` = 'repost',
`refid` = '".$id."',
`time` = '".time()."',
`count` = 1,
`new` = 1
") == true) mysql_query("UPDATE `users` SET `notifications` = 1, notifications_journal=notifications_journal+1 WHERE `id` = '".$arr_post['user_id']."'");
mysql_query("UPDATE `users` SET `count_wall` = '".($user['count_wall']+1)."' WHERE `id` = '".$user_id."'");
}
go(URL.'/?id='.$user_id);
}
?>