Файл: system/modules/frendon.php
Строк: 103
<?php
$user_id = $user_info['user_id'];
$id = intval($_GET['id']);
$cache_folder = 'user_'.$id;
$friend_id = intval($_GET['friend_id']);
//Читаем кеш
$row = unserialize(mozg_cache($cache_folder.'/profile_'.$id));
//Проверяем на наличие кеша, если нету то выводи из БД и создаём его
$row = $db->super_query("SELECT user_id, user_search_pref, user_country_city_name,user_cover, user_stik, user_birthday, user_xfields, user_xfields_all, user_city, user_country, user_photo, user_friends_num, user_notes_num, user_subscriptions_num, user_wall_num, user_albums_num, user_last_visit, user_videos_num, user_status, user_privacy, user_sp, user_sex, user_gifts, user_public_num, user_audio, user_delet, user_real, user_ban_date, xfields, user_doc_num, user_guests,user_delete_type FROM `".PREFIX."_users` WHERE user_id = '{$id}'");
if($user_id != $user_id)
//Проверка естьли запрашиваемый юзер в друзьях у юзера который смотрит стр
$check_friend = CheckFriends($row['user_id']);
//Кол-во друзей в онлайне
if($row['user_friends_num']){
$online_friends = $db->super_query("SELECT COUNT(*) AS cnt FROM `".PREFIX."_users` tb1, `".PREFIX."_friends` tb2 WHERE tb1.user_id = tb2.friend_id AND tb2.user_id = '{$user_id}' AND tb1.user_last_visit >= '{$online_time}' AND subscriptions = 0");
//Если друзья на сайте есть то идем дальше
if($online_friends['cnt']){
$sql_friends_online = $db->super_query("SELECT SQL_CALC_FOUND_ROWS tb1.user_id, user_last_visit, user_country_city_name, user_search_pref, user_birthday, user_photo FROM `".PREFIX."_users` tb1, `".PREFIX."_friends` tb2 WHERE tb1.user_id = tb2.friend_id AND tb2.user_id = '{$user_id}' AND tb1.user_last_visit >= '{$online_time}' AND subscriptions = 0 ORDER by rand() DESC LIMIT 0, 6", 1);
foreach($sql_friends_online as $row_friends_online){
$tpl->load_template('profile_friends2.tpl');
$friend_info_online = explode(' ', $row_friends_online['user_search_pref']);
$tpl->set('{user-id}', $row_friends_online['user_id']);
$tpl->set('{name}', $friend_info_online[0]);
$tpl->set('{last-name}', $friend_info_online[1]);
if($row_friends_online['user_last_visit'] >= $online_time)
$tpl->set('{online}', $lang['online']);
else {
$tpl->set('{online}', '');
}
if($row_friends_online['user_photo'])
$tpl->set('{ava}', $config['home_url'].'uploads/users/'.$row_friends_online['user_id'].'/'.$row_friends_online['user_photo']);
else
$tpl->set('{ava}', '{theme}/images/100_no_ava.png');
$tpl->compile('content');
}
}
}
?>