Файл: system/modules/likan.php
Строк: 97
<?php
/*
Author: LIKAN
File: likan.php
*/
if(!defined('MOZG'))
die('Hacking attempt!');
if($ajax == 'yes')
NoAjaxQuery();
if($logged){
$act = $_GET['act'];
$id = intval($_GET['id']);
$alias = $db->safesql($_GET['adres']);
$user_id = $user_info['user_id'];
switch($act){
//################### Выход ###################//
case "iesire":
$row = $db->super_query("SELECT user_id, user_name, user_lastname, user_photo FROM `".PREFIX."_users` WHERE user_id = '{$user_id}'");
$tpl->load_template('profile/logout.tpl');
$tpl->set('{name}', $row['user_name']);
$tpl->set('{lastname}', $row['user_lastname']);
if($row['user_photo'])
$tpl->set('{ava}', '/uploads/users/'.$row['user_id'].'/50_'.$row['user_photo']);
else
$tpl->set('{ava}', '/images/no_ava_50.png');
$tpl->compile('content');
AjaxTpl();
die();
$tpl->clear();
$db->free();
break;
//################### Новое окно загрузки фото ###################//
case "newphoto":
$tpl->load_template('likan/newphoto.tpl');
$tpl->compile('content');
AjaxTpl();
die();
$tpl->clear();
$db->free();
break;
//################### Альбомы и фотографии в ajax ###################//
case "photo":
if(!$row){
$row = $db->super_query("SELECT user_id, user_albums_num, user_name FROM `".PREFIX."_users` WHERE user_id = '{$id}'");
$tpl->set('{name}', gramatikName($row['user_name']));
}
$tpl->load_template('likan/album_photo.tpl');
//Показ скрытых текста только для владельца страницы
if($user_info['user_id'] == $row['user_id']){
$tpl->set('[owner]', '');
$tpl->set('[/owner]', '');
$tpl->set_block("'\[not-owner\](.*?)\[/not-owner\]'si","");
} else {
$tpl->set('[not-owner]', '');
$tpl->set('[/not-owner]', '');
$tpl->set_block("'\[owner\](.*?)\[/owner\]'si","");
}
//################### Альбомы ###################//
if($user_id == $id){
$albums_privacy = false;
$albums_count['cnt'] = $row['user_albums_num'];
} else if($check_friend){
$albums_privacy = "AND SUBSTRING(privacy, 1, 1) regexp '[[:<:]](1|2)[[:>:]]'";
$albums_count = $db->super_query("SELECT COUNT(*) AS cnt FROM `".PREFIX."_albums` WHERE user_id = '{$id}' {$albums_privacy}", false, "user_{$id}/albums_cnt_friends");
$cache_pref = "_friends";
} else {
$albums_privacy = "AND SUBSTRING(privacy, 1, 1) = 1";
$albums_count = $db->super_query("SELECT COUNT(*) AS cnt FROM `".PREFIX."_albums` WHERE user_id = '{$id}' {$albums_privacy}", false, "user_{$id}/albums_cnt_all");
$cache_pref = "_all";
}
$sql_albums = $db->super_query("SELECT aid, name, adate, photo_num, cover FROM `".PREFIX."_albums` WHERE user_id = '{$id}' {$albums_privacy} ORDER by `position` ASC LIMIT 0, 4", 1, "user_{$id}/albums{$cache_pref}");
if($sql_albums){
foreach($sql_albums as $row_albums){
$row_albums['name'] = stripslashes($row_albums['name']);
$album_date = megaDateNoTpl(strtotime($row_albums['adate']));
$albums_photonums = gram_record($row_albums['photo_num'], 'photos');
if($row_albums['cover'])
$album_cover = "<img class="pva_img" src="/uploads/users/{$id}/albums/{$row_albums['aid']}/{$row_albums['cover']}">";
else
$album_cover = '<img class="pva_no_photos" src="{theme}/images/no_cover.png">';
$albums .= "<div class="pva_row"><div class="cont"><a href="/albums/view/{$row_albums['aid']}" onClick="Page.Go(this.href); " style="text-decoration:none" class="pva_link">{$album_cover}<div class="pva_title"><div class="clear_fix"><div class="pva_title_text fl_l" title="{$row_albums['name']}">{$row_albums['name']}</div><div class="pva_camera fl_r">{$row_albums['photo_num']}</div></div><div class="pva_desc"></div></div></a></div></div>";
}
}
$tpl->set('{albums}', $albums);
$tpl->set('{albums-num}', $albums_count['cnt']);
if($albums_count['cnt'] AND $config['album_mod'] == 'yes'){
$tpl->set('[albums]', '');
$tpl->set('[/albums]', '');
} else
$tpl->set_block("'\[albums\](.*?)\[/albums\]'si","");
//################### фотографии ###################//
$photo_cnt = $db->super_query("SELECT COUNT(*) AS cnt FROM `".PREFIX."_photos` WHERE user_id = '{$id}' ", false);
if ($photo_cnt['cnt']){
$vaphoto2 = $db->super_query("SELECT * FROM `".PREFIX."_photos` WHERE user_id = '{$id}' ORDER BY id DESC LIMIT 102",1);
if($vaphoto2){
foreach($vaphoto2 as $row_view_photos)
{
$photos_view_albums .= "<div class="pva_photo"><a href="/photo{$row_view_photos['user_id']}_{$row_view_photos['id']}_{$row_view_photos['album_id']}" onclick="Photo.Show(this.href); return false" class="pva_photo_link"><img class="pva_photo_img" src="/uploads/users/{$row_view_photos['user_id']}/albums/{$row_view_photos['album_id']}/c_{$row_view_photos['photo_name']}"></a></div>";
}
} else {
$photos_view_albums = '<br><div class="info_center">Нет загруженных фотографий.</div>';
}
$tpl->set('{photos_view_albums}', $photos_view_albums);
$tpl->set('{photos_num}', $photo_cnt['cnt']);
}
$tpl->compile('content');
AjaxTpl();
die();
$tpl->clear();
$db->free();
break;
}
$tpl->clear();
$db->free();
} else {
$user_speedbar = $lang['no_infooo'];
msgbox('', $lang['not_logged'], 'info');
}
?>