Файл: system/modules/requests.php
Строк: 75
<?php
/*
Appointment: Граффити
File: graffiti.php
Autorsite: MainTalk.ru
*/
if(!defined('MOZG'))
die("Hacking attempt!");
if($ajax == 'yes')
NoAjaxQuery();
if($logged){
$user_id = $user_info['user_id'];
$tpl->load_template('request/request.tpl');
//Выводим заявки в друзья если они есть
if($user_info['demands']){
$sql_ = $db->super_query("SELECT SQL_CALC_FOUND_ROWS tb1.from_user_id, demand_date, tb2.user_photo, user_search_pref, user_country_city_name, user_birthday FROM `".PREFIX."_friends_demands` tb1, `".PREFIX."_users` tb2 WHERE tb1.for_user_id = '{$user_id}' AND tb1.from_user_id = tb2.user_id ORDER by `demand_date` DESC LIMIT 0, 20", 1);
$tpl->load_template('request/request.tpl');
foreach($sql_ as $row){
$user_country_city_name = explode('|', $row['user_country_city_name']);
$tpl->set('{country}', $user_country_city_name[0]);
$tpl->set('{city}', ', '.$user_country_city_name[1]);
$tpl->set('{user-id}', $row['from_user_id']);
$tpl->set('{name}', $row['user_search_pref']);
if($row['user_photo'])
$tpl->set('{ava}', $config['home_url'].'uploads/users/'.$row['from_user_id'].'/100_'.$row['user_photo']);
else
$tpl->set('{ava}', '{theme}/images/100_no_ava.png');
//Возраст юзера
$user_birthday = explode('-', $row['user_birthday']);
$tpl->set('{age}', user_age($user_birthday[0], $user_birthday[1], $user_birthday[2]));
$tpl->compile('content');
}
navigation($gcount, $user_info['demands'], $config['home_url'].'friends/requests/page/');
$user_id = $user_info['user_id'];
if($user_info['user_id']){
$sql2 = $db->super_query("SELECT SQL_CALC_FOUND_ROWS user_id, groups_id, for_user_id FROM `".PREFIX."_communities_demands` WHERE for_user_id = '{$user_id}' ORDER by `date` DESC LIMIT 0, 5", 1);
$tpl->load_template('request/grequest.tpl');
foreach($sql2 as $row2){
$gid = $row2['groups_id'];
$uid = $row2['user_id'];
$rowg= $db->super_query("SELECT * FROM `".PREFIX."_communities` WHERE id = '{$gid}'");
$riwu = $db->super_query("SELECT user_id, user_search_pref FROM `".PREFIX."_users` WHERE user_id = '{$uid}'");
$tpl->set('{user-id}', $riwu['user_id']);
$tpl->set('{name}', $rowg['title']);
$tpl->set('{group-id}', $rowg['id']);
$tpl->set('{invname}', $riwu['user_search_pref']);
$tpl->set('{user_id}', $user_info['user_id']);
if($rowg['photo'])
$tpl->set('{ava}', $config['home_url'].'uploads/groups/'.$rowg['id'].'/100_'.$rowg['photo']);
else
$tpl->set('{ava}', '{theme}/images/100_no_ava.png');
$tpl->compile('content');
}
navigation($gcount, $user_info['demands'], $config['home_url'].'friends/requests/page/');
} else
msgbox('', 'У Вас нет приглашений в сообщество', 'info_2');
$sql3 = $db->super_query("SELECT SQL_CALC_FOUND_ROWS user_id, gift, for_user_id FROM `".PREFIX."_gift_demands` WHERE for_user_id = '{$user_id}' ORDER by `date` DESC LIMIT 0, 5", 1);
$tpl->load_template('request/prequest.tpl');
foreach($sql3 as $row3){
$rid = $row3['gift'];
$uid = $row3['user_id'];
$rowp= $db->super_query("SELECT * FROM `".PREFIX."_gifts` WHERE gift = '{$rid}'");
$ower = $db->super_query("SELECT user_id, user_search_pref, user_photo FROM `".PREFIX."_users` WHERE user_id = '{$uid}'");
$tpl->set('{user-id}', $ower['user_id']);
$tpl->set('{gift}', $row3['gift']);
$tpl->set('{invname}', $ower['user_search_pref']);
$tpl->set('{user_id}', $user_info['user_id']);
if($ower['user_photo'])
$tpl->set('{ava}', $config['home_url'].'uploads/users/'.$ower['user_id'].'/50_'.$ower['user_photo']);
else
$tpl->set('{ava}', '{theme}/images/50_no_ava.png');
$tpl->compile('content');
}
} else
msgbox('', 'Нет оповещений', 'info_2');
$tpl->clear();
$db->free();
} else {
$user_speedbar = $lang['no_infooo'];
msgbox('', $lang['not_logged'], 'info');
}
?>