if ($sql_usSex) { $count = $db->super_query("SELECT COUNT(*) AS cnt FROM `" . PREFIX . "_friends` tb1, `" . PREFIX . "_users` tb2 WHERE tb1.user_id = '{$user_id}' AND tb1.friend_id = tb2.user_id AND tb1.subscriptions = 0 AND tb2.user_sex = '{$sql_usSex}'"); if ($count['cnt']) { $sql_ = $db->super_query("SELECT SQL_CALC_FOUND_ROWS tb1.friend_id, tb2.user_photo, user_search_pref FROM `" . PREFIX . "_friends` tb1, `" . PREFIX . "_users` tb2 WHERE tb1.user_id = '{$user_id}' AND tb1.friend_id = tb2.user_id AND tb1.subscriptions = 0 AND tb2.user_sex = '{$sql_usSex}' ORDER by `views` DESC LIMIT {$limit_page}, {$gcount}", 1); $tpl->load_template('friends/box_friend.tpl'); foreach ($sql_ as $row) { $tpl->set('{user-id}', $row['friend_id']); $tpl->set('{name}', $row['user_search_pref']); if ($row['user_photo']) { $tpl->set('{ava}', $config['home_url'] . 'uploads/users/' . $row['friend_id'] . '/50_' . $row['user_photo']); } else { $tpl->set('{ava}', '{theme}/images/100_no_ava.png'); } $tpl->compile('content'); } box_navigation($gcount, $count['cnt'], "''", 'sp.openfriends', ''); } else { msgbox('', '<div class="clear" style="margin-top:140px"></div>' . $lang['no_requests'], 'info_2'); } } else { msgbox('', '<div class="clear" style="margin-top:140px"></div>' . $lang['no_requests'], 'info_2'); } AjaxTpl(); die; break; default: //################### Просмотр всех друзей ###################// $get_user_id = intval($_GET['user_id']); if (!$get_user_id) { $get_user_id = $user_info['user_id']; }
if ($row['photo']) { $tpl->set('{ava}', '/uploads/groups/' . $row['id'] . '/50_' . $row['photo']); } else { $tpl->set('{ava}', '{theme}/images/no_ava_50.png'); } $tpl->set('{name}', stripslashes($row['title'])); $tpl->set('{public-id}', $row['id']); $tpl->set('{num}', '<span id="traf">' . $row['traf'] . ' ' . gram_record($row['traf'], 'subscribers')); if ($row['adres']) { $tpl->set('{adres}', $row['adres']); } else { $tpl->set('{adres}', 'public' . $row['id']); } $tpl->compile('content'); } box_navigation($gcount, $subscr_num, $for_user_id, 'groups.all_groups_user', $subscr_num); } AjaxTpl(); die; break; default: //################### Вывод всех сообществ ###################// $owner = $db->super_query("SELECT user_public_num FROM `" . PREFIX . "_users` WHERE user_id = '{$user_id}'"); if ($act == 'admin') { $tpl->load_template('groups/head_admin.tpl'); $sql_sort = "SELECT SQL_CALC_FOUND_ROWS id, title, photo, traf, adres FROM `" . PREFIX . "_communities` WHERE admin regexp '[[:<:]](u{$user_id})[[:>:]]' ORDER by `traf` DESC LIMIT {$limit_page}, {$gcount}"; $sql_count = $db->super_query("SELECT COUNT(*) AS cnt FROM `" . PREFIX . "_communities` WHERE admin regexp '[[:<:]](u{$user_id})[[:>:]]'"); $owner['user_public_num'] = $sql_count['cnt']; } else { $sql_sort = "SELECT SQL_CALC_FOUND_ROWS tb1.friend_id, tb2.id, title, photo, traf, adres FROM `" . PREFIX . "_friends` tb1, `" . PREFIX . "_communities` tb2 WHERE tb1.user_id = '{$user_id}' AND tb1.friend_id = tb2.id AND tb1.subscriptions = 2 ORDER by `traf` DESC LIMIT {$limit_page}, {$gcount}"; $tpl->load_template('groups/head.tpl');
$tpl->set('[owner]', ''); $tpl->set('[/owner]', ''); } else { $tpl->set_block("'\\[owner\\](.*?)\\[/owner\\]'si", ""); } if ($row['pm_read'] == 'no') { $tpl->set('[new]', ''); $tpl->set('[/new]', ''); } else { $tpl->set_block("'\\[new\\](.*?)\\[/new\\]'si", ""); } $tpl->compile('content'); } $msg_count = $db->super_query("SELECT COUNT(id) AS cnt FROM `" . PREFIX . "_messages` WHERE for_user_id = '{$user_id}' AND from_user_id = '{$for_user_id}'"); if ($msg_count['cnt'] >= $gcount) { box_navigation($gcount, $msg_count['cnt'], $for_user_id, 'messages.history', ''); } AjaxTpl(); } die; break; //################### Просмотр сообщения ###################// //################### Просмотр сообщения ###################// case "review": $metatags['title'] = $lang['msg_view']; $user_speedbar = $lang['msg_view']; $mid = intval($_GET['mid']); if ($mid) { //SQL Запрос за вывод сообщения $row = $db->super_query("SELECT tb1.id, theme, text, from_user_id, history_user_id, date, pm_read, folder, attach, tell_uid, tell_date, public, tell_comm, tb2.user_search_pref, user_photo, user_last_visit FROM `" . PREFIX . "_messages` tb1, `" . PREFIX . "_users` tb2 WHERE tb1.id = '{$mid}' AND tb1.from_user_id = tb2.user_id AND tb1.for_user_id = '{$user_id}'"); $folder = $row['folder'];
$tpl->compile('content'); //Выводим циклом фотографии if (!$notes) { $tpl->load_template('albums_all_photos.tpl'); } else { $tpl->load_template('albums_box_all_photos_notes.tpl'); } while ($row = $db->get_row($sql_)) { $tpl->set('{photo}', '/uploads/users/' . $user_id . '/albums/' . $row['album_id'] . '/c_' . $row['photo_name']); $tpl->set('{photo-name}', $row['photo_name']); $tpl->set('{user-id}', $user_id); $tpl->set('{photo-id}', $row['id']); $tpl->set('{aid}', $row['album_id']); $tpl->compile('content'); } box_navigation($gcount, $row_album['photo_num'], $page, 'wall.attach_addphoto', $notes); $tpl->load_template('albums_editcover.tpl'); $tpl->set('[bottom]', ''); $tpl->set('[/bottom]', ''); $tpl->set_block("'\\[top\\](.*?)\\[/top\\]'si", ""); $tpl->compile('content'); AjaxTpl(); } else { if ($notes) { $scrpt_insert = "response[1] = response[1].replace('/c_', '/');wysiwyg.boxPhoto(response[1], 0, 0);"; } else { $scrpt_insert = "var imgname = response[1].split('/');wall.attach_insert('photo', response[1], 'attach|'+imgname[6].replace('c_', ''), response[2]);"; } echo <<<HTML <script type="text/javascript"> \$(document).ready(function(){
$tpl->set_block("'\\[bottom\\](.*?)\\[/bottom\\]'si", ""); $tpl->compile('content'); //Выводим циклом видео if (!$notes) { $tpl->load_template('videos/box_all_video.tpl'); } else { $tpl->load_template('videos/box_all_video_notes.tpl'); } foreach ($sql_ as $row) { $tpl->set('{photo}', $row['photo']); $tpl->set('{title}', stripslashes($row['title'])); $tpl->set('{video-id}', $row['id']); $tpl->set('{user-id}', $user_id); $tpl->compile('content'); } box_navigation($gcount, $count['user_videos_num'], $page, 'wall.attach_addvideo', $notes); $tpl->load_template('albums_editcover.tpl'); $tpl->set('[bottom]', ''); $tpl->set('[/bottom]', ''); $tpl->set_block("'\\[top\\](.*?)\\[/top\\]'si", ""); $tpl->compile('content'); } else { if ($notes) { echo $lang['videos_box_none'] . '<div class="button_div_gray fl_l" style="margin-left:210px;margin-top:20px"><button onClick="videos.add(1)">Добавить новый видеоролик</button></div>'; } else { echo $lang['videos_box_none']; } } AjaxTpl(); die; break;
$tpl->compile('content'); $tpl->result['content'] = str_replace('Всего', '', $tpl->result['content']); $tpl->load_template('profile_friends.tpl'); foreach ($sql_ as $row) { if ($row['user_photo']) { $tpl->set('{ava}', $config['home_url'] . 'uploads/users/' . $row['user_id'] . '/50_' . $row['user_photo']); } else { $tpl->set('{ava}', '{theme}/images/no_ava_50.png'); } $friend_info_online = explode(' ', $row['user_search_pref']); $tpl->set('{user-id}', $row['user_id']); $tpl->set('{name}', $friend_info_online[0]); $tpl->set('{last-name}', $friend_info_online[1]); $tpl->compile('content'); } box_navigation($gcount, $liked_num, $rid, 'wall.all_liked_users', $liked_num); AjaxTpl(); } } die; break; //################### Показ всех комментариев к записи ###################// //################### Показ всех комментариев к записи ###################// case "all_comm": NoAjaxQuery(); $fast_comm_id = intval($_POST['fast_comm_id']); $for_user_id = intval($_POST['for_user_id']); if ($fast_comm_id and $for_user_id) { //Подгружаем и объявляем класс для стены include ENGINE_DIR . '/classes/wall.php'; $wall = new wall();
$tpl->set('{url}', $row['url']); $tpl->set('{artist}', stripslashes($row['artist'])); $tpl->set('{name}', stripslashes($row['name'])); if ($get_user_id == $user_id) { $tpl->set('[owner]', ''); $tpl->set('[/owner]', ''); $tpl->set('{uid}', $get_user_id); $tpl->set_block("'\\[not-owner\\](.*?)\\[/not-owner\\]'si", ""); } else { $tpl->set('[not-owner]', ''); $tpl->set('[/not-owner]', ''); $tpl->set_block("'\\[owner\\](.*?)\\[/owner\\]'si", ""); } $tpl->compile('content'); } box_navigation($gcount, $count['user_audio'], $page, 'wall.attach_addaudio', ''); $tpl->load_template('albums_editcover.tpl'); $tpl->set('[bottom]', ''); $tpl->set('[/bottom]', ''); $tpl->set_block("'\\[top\\](.*?)\\[/top\\]'si", ""); $tpl->compile('content'); AjaxTpl(); } else { echo $lang['audio_box_none']; } die; break; //################### Загрузка с компьютера ###################// //################### Загрузка с компьютера ###################// case "upload": NoAjaxQuery();
$sql_ = $db->super_query("SELECT SQL_CALC_FOUND_ROWS tb1.friend_id, tb2.user_search_pref, user_photo, user_country_city_name, user_status FROM `" . PREFIX . "_friends` tb1, `" . PREFIX . "_users` tb2 WHERE tb1.user_id = '{$for_user_id}' AND tb1.friend_id = tb2.user_id AND tb1.subscriptions = 1 ORDER by `friends_date` DESC LIMIT {$limit_page}, {$gcount}", 1); if ($sql_) { $tpl->load_template('profile_subscription_box_top.tpl'); $tpl->set('[top]', ''); $tpl->set('[/top]', ''); $tpl->set('{subcr-num}', $subscr_num . ' ' . gram_record($subscr_num, 'subscr')); $tpl->set_block("'\\[bottom\\](.*?)\\[/bottom\\]'si", ""); $tpl->compile('content'); $tpl->load_template('profile_friends.tpl'); foreach ($sql_ as $row) { if ($row['user_photo']) { $tpl->set('{ava}', $config['home_url'] . 'uploads/users/' . $row['friend_id'] . '/50_' . $row['user_photo']); } else { $tpl->set('{ava}', '{theme}/images/no_ava_50.png'); } $friend_info_online = explode(' ', $row['user_search_pref']); $tpl->set('{user-id}', $row['friend_id']); $tpl->set('{name}', $friend_info_online[0]); $tpl->set('{last-name}', $friend_info_online[1]); $tpl->compile('content'); } box_navigation($gcount, $subscr_num, $for_user_id, 'subscriptions.all', $subscr_num); } AjaxTpl(); } $tpl->clear(); $db->free(); } else { echo 'no_log'; } die;