<?php

if (!empty($_GET['del_photo']))
{
	$del = check($_GET['del_photo']);
	if (in_array($del, explode("||", substr($arr_post['photos'], 1, -1))))
	{
		$new_post_photos = str_replace("|".$del."|", "", $arr_post['photos']);
		mysql_query("UPDATE `groups_wall` SET `photos` = '".$new_post_photos."' WHERE `id` = '".$id."' LIMIT 1");
	}
		if ($ajax == 'yes') exit;
		else go(URL.'/groups/wall/edit_post.php?id='.$id);
}
else if (!empty($_GET['del_audio']))
{
	$del = abs(intval($_GET['del_audio']));
	if (in_array($del, explode("||", substr($arr_post['audio'], 1, -1))))
	{
		$new_post_audio = str_replace("|".$del."|", "", $arr_post['audio']);
		mysql_query("UPDATE `groups_wall` SET `audio` = '".$new_post_audio."' WHERE `id` = '".$id."' LIMIT 1");
	}
		if ($ajax == 'yes') exit;
		else go(URL.'/groups/wall/edit_post.php?id='.$id);
}

else if (!empty($_GET['del_video']))
{
	$del = abs(intval($_GET['del_video']));
	if (in_array($del, explode("||", substr($arr_post['video'], 1, -1))))
	{
		$new_post_video = str_replace("|".$del."|", "", $arr_post['video']);
		mysql_query("UPDATE `groups_wall` SET `video` = '".$new_post_video."' WHERE `id` = '".$id."' LIMIT 1");
	}
		if ($ajax == 'yes') exit;
		else go(URL.'/groups/wall/edit_post.php?id='.$id);
}

if (!empty($_POST['text']))
{
	$text = check($_POST['text']);
	$text = substr($text, 0, 10000);

	mysql_query("UPDATE `groups_wall` SET `text` = '".$text."', `photos` = '".$arr_post['photos']."', `audio` = '".$arr_post['audio'].", `video` = '".$arr_post['video']." ' WHERE `id` = '".$id."' LIMIT 1");
	if ($ajax == 'yes') exit;
	else go(URL.'/groups/wall/post.php?id='.$id);
}

?>