Файл: photos/wall_photos.php
Строк: 101
<?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);
$title = lang('Вложения','Вкладення');
require_once '../incfiles/head.php';
if (!empty($_GET['del']))
{
$del = abs(intval($_GET['del']));
$result = mysql_query("SELECT * FROM `wall_photos` WHERE `id` = '".$del."' AND `user_id` = '".$user_id."' LIMIT 1");
if (mysql_num_rows($result) == false) go(URL.'/photos/wall_photos.php');
else $arr_photo = mysql_fetch_array($result);
if (mysql_query("DELETE FROM `wall_photos` WHERE `id` = '".$del."' LIMIT 1") == true)
{
mysql_query("UPDATE `users` SET count_wall_photos=count_wall_photos-1 WHERE `id` = '".$user_id."' LIMIT 1");
if (file_exists(HOME .'/files/wall/'.$user_id.'/photos/'.$arr_photo['name'])) {@unlink(HOME .'/files/wall/'.$user_id.'/photos/'.$arr_photo['name']);}
if (file_exists(HOME .'/files/wall/'.$user_id.'/photos/icons/'.$arr_photo['name'])) {@unlink(HOME .'/files/wall/'.$user_id.'/photos/icons/'.$arr_photo['name']);}
if (file_exists(HOME .'/files/wall/'.$user_id.'/photos/mini/'.$arr_photo['name'])) {@unlink(HOME .'/files/wall/'.$user_id.'/photos/mini/'.$arr_photo['name']);}
if (file_exists(HOME .'/files/wall/'.$user_id.'/photos/preview/'.$arr_photo['name'])) {@unlink(HOME .'/files/wall/'.$user_id.'/photos/preview/'.$arr_photo['name']);}
}
go(URL.'/photos/wall_photos.php');
}
else if (!empty($_GET['n']) && is_numeric($_GET['n']))
{
echo '<div class="title">'.lang('Просмотр фотографии','Перегляд фотографії').'</div><div class="block">';
$n = ($_GET['n']>1 and $_GET['n']<=$user['count_wall_photos']) ? $_GET['n'] : 1;
$start = $n*1-1;
$result = mysql_query("SELECT * FROM `wall_photos` WHERE `user_id` = '".$user_id."' ORDER by `time` DESC LIMIT $start,1");
if (mysql_num_rows($result) == false) go(URL.'/photos/wall_photos.php');
while ($arr_photo = mysql_fetch_array($result))
{
echo '<center><img class="preview" src="'.URL.'/files/wall/'.$arr_photo['user_id'].'/photos/preview/'.$arr_photo['name'].'"/></center>';
echo '<p><center>';
p($n,$user['count_wall_photos'],URL.'/photos/wall_photos.php?');
echo ' | <b>'.$n.' '.lang('из','з').' '.$user['count_wall_photos'].'</b> |';
n($n,$user['count_wall_photos'],URL.'/photos/wall_photos.php?');
echo'</center></p>';
echo '</div><div class="block">
Фотоальбом: <a href="'.URL.'/photos/wall_photos.php" onclick="Page.Go(this.href); return false">'.lang('Фотографии на стене','Фотографій на стіні').'</a><br/>
'.lang('Добавлено','Додана').': '.vtime($arr_photo['time']).'</div>';
echo '<div class="title">
<a href="'.URL.'/photos/wall_photos.php?del='.$arr_photo['id'].'" onclick="Page.Go(this.href); return false">'.lang('Удалить фото','Видалити фото').'</a>
</div>';
}
}
else
{
if (!empty($_GET['target']) && !empty($_GET['from']) && is_numeric($_GET['from'])) $target = 'album=wall_photos&target='.check($_GET['target']).'&from='.abs(intval($_GET['from'])); else $target = '';
echo '<div class="title">
<a href="'.URL.'/?id='.$user_id.'" onclick="Page.Go(this.href); return false">'.$user['name'].' '.$user['surname'].'</a>
<a href="'.URL.'/photos/?id='.$user_id.''.$target.'" onclick="Page.Go(this.href); return false">'.lang('Фотоальбомы','Фотоальбоми').'</a>
<a class="title_a_hover" href="'.URL.'/photos/?id='.$user_id.'" onclick="Page.Go(this.href); return false">'.lang('Вложения','Вкладення').'</a>
</div>
<div class="block"><center>';
if ($user['count_wall_photos'] > 0)
{
$cp = ceil($user['count_wall_photos']/12);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*12-12;
$n = $start;
$res = mysql_query("SELECT * FROM `wall_photos` WHERE `user_id` = '".$user_id."' ORDER by `time` DESC LIMIT $start,12");
while ($arr = mysql_fetch_array($res))
{
$n++;
echo '<a href="'.URL.'/photos/'.(!empty($target)?'select.php?fid='.$arr['id'].'&'.$target:'wall_photos.php?n='.$n).'" onclick="Page.Go(this.href); return false;"><img class="preview_mini" src="'.URL.'/files/wall/'.$user_id.'/photos/mini/'.$arr['name'].'"></a>';
}
}
echo'</center></div>';
navi($p,$cp,'/photos/wall_photos.php?');
}
require_once '../incfiles/foot.php';
?>