Файл: 2/3020.ru/modules/photos/content/show.php
Строк: 60
<?php
$photo = DB::GET_STRING("SELECT * FROM `PHOTOS` WHERE `ID` = '".INTVAL(GET('photo_id'))."' LIMIT 1");
$account = DB::GET_STRING("SELECT * FROM `USERS` WHERE `ID` = '".$photo['USER_ID']."' LIMIT 1");
IF (!$photo['ID']){
ERROR('Неверная директива', 'session');
REDIRECT('/modules/?path=photos');
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `PHOTOS_DIR` WHERE `ID` = '".$photo['ID_DIR']."' AND `USER_ID` = '".$account['ID']."' LIMIT 1") == 1){
$dir = DB::GET_STRING("SELECT * FROM `PHOTOS_DIR` WHERE `USER_ID` = '".$account['ID']."' AND `ID` = '".$photo['ID_DIR']."' LIMIT 1");
$id_dir = $dir['ID'];
$nav = "<a href='/modules/?path=photos§ion=users&id=".$account['ID']."'>".LG('Фотоальбомы')."</a>".ICONS('angle-right', 20, 'fa-fw')."<a href='/modules/?path=photos§ion=users&id=".$account['ID']."&dir=".$dir['ID']."'>".TEXT_ABSOLUTE($dir['NAME'])."</a>".ICONS('angle-right', 20, 'fa-fw')."".TEXT_ABSOLUTE($photo['NAME'])."";
}ELSE{
$id_dir = 0;
$nav = "<a href='/modules/?path=photos§ion=users&id=".$account['ID']."'>".LG('Фотоальбомы')."</a>".ICONS('angle-right', 20, 'fa-fw')."".TEXT_ABSOLUTE($photo['NAME'])."";
}
/*
-------------
Список лайков
-------------
*/
IF (GET('get') == "like_list"){
REQUIRE (ROOT.'/modules/photos/plugins/like_list.php');
}
/*
-------------------
Редактирование фото
-------------------
*/
IF (GET('get') == "photo_edit"){
IF (ACCESS('photos_edit', NULL, 1) || MANAGEMENT == 1 || $account['ID'] == $user['ID']){
REQUIRE (ROOT.'/modules/photos/plugins/edit_photo.php');
}
}
/*
-------------
Удаление фото
-------------
*/
IF (GET('get') == "photo_delete_ok"){
IF (ACCESS('photos_delete', NULL, 1) || MANAGEMENT == 1 || $account['ID'] == $user['ID']){
REQUIRE (ROOT.'/modules/photos/plugins/delete_photo.php');
}
}
//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/id".$account['ID']."'>".$account['LOGIN']."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO $nav;
ECHO "</div>";
//Редактировать комментарий
IF ($photo['USER_ID'] == $user['ID'] || MANAGEMENT == 1 || ACCESS('photos_comments_edit_and_delete', NULL, 1)){
REQUIRE (ROOT.'/modules/photos/plugins/comments_edit_get.php');
}
IF (GET('get') == "photo_delete"){
IF ($account['ID'] == $user['ID'] || ACCESS('photos_delete', NULL, 1) || MANAGEMENT == 1){
ECHO "<div class='list'>";
ECHO "".LG('Вы действительно хотите удалить фото')." <b>".TEXT_ABSOLUTE($photo['NAME'])."</b>?<br /><br />";
ECHO "<a href='/modules/?path=photos§ion=show&photo_id=".$photo['ID']."&get=photo_delete_ok' class='btn'>".ICONS('trash', 15, 'fa-fw')."".LG('Удалить')."</a>";
ECHO "<a href='/modules/?path=photos§ion=show&photo_id=".$photo['ID']."' class='btn-o'>".LG('Отменить')."</a>";
ECHO "</div>";
}
}
IF ($id_dir > 0){
IF (MANAGEMENT == 0){
IF (ACCESS('photos_private_show', NULL, 1) == FALSE){
REQUIRE (ROOT.'/modules/photos/plugins/private_dir.php');
}
}
}
ECHO "<div class='list'>";
//Информация о фото
REQUIRE (ROOT.'/modules/photos/plugins/photo_info.php');
IF (ACCESS('photos_edit', NULL, 1) || MANAGEMENT == 1 || $account['ID'] == $user['ID']){
ECHO "<a href='/modules/?path=photos§ion=show&photo_id=".$photo['ID']."&get=photo_edit' class='btn'>".ICONS('pencil', 15, 'fa-fw')."".LG('Редактировать')."</a>";
}
IF (ACCESS('photos_delete', NULL, 1) || MANAGEMENT == 1 || $account['ID'] == $user['ID']){
ECHO "<a href='/modules/?path=photos§ion=show&photo_id=".$photo['ID']."&get=photo_delete' class='btn'>".ICONS('trash', 15, 'fa-fw')."".LG('Удалить')."</a>";
}
ECHO "</div>";
ECHO "<div class='list-body' style='position: relative; z-index: 0;'>";
$result = SCANDIR(ROOT.'/modules/photos/plugins/photo/', SCANDIR_SORT_ASCENDING);
FOR ($i = 0; $i < COUNT($result); $i++){
IF (PREG_MATCH('#.php$#i',$result[$i])){
REQUIRE (ROOT.'/modules/photos/plugins/photo/'.$result[$i]);
}
}
ECHO "</div>";
//Комментарии
REQUIRE (ROOT.'/modules/photos/plugins/comments.php');
//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/id".$account['ID']."'>".$account['LOGIN']."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO $nav;
ECHO "</div>";
?>