Файл: system/modules/cover.php
Строк: 35
<?php
/*
Appointment: Подарки
File: gifts.php
Данный код защищен авторскими правами
*/
if(!defined('MOZG'))
die('Hacking attempt!');
if($ajax == 'yes')
NoAjaxQuery();
if($logged){
$act = $_GET['act'];
$user_id = $user_info['user_id'];
switch($act){
//################### Страница всех подарков ###################//
case "view":
NoAjaxQuery();
$for_user_id = intval($_POST['user_id']);
$sql_ = $db->super_query("SELECT SQL_CALC_FOUND_ROWS gid, gname, img, price FROM `".PREFIX."_cover_list` ORDER by `gid` DESC", 1);
foreach($sql_ as $cov){
echo "<a href="" class="gifts_onegif" onMouseOver="cov.showcov('{$cov['img']}')" onMouseOut="cov.showhide ('{$cov['img']}')" onClick="cov.select('{$cov['img']}', '{$for_user_id}','{$cov['gname']}' ); return false"><img src="/uploads/cover/{$cov['img']}.png" /><div class="gift_count no_display" id="cs{$cov['img']}">{$cov['gname']}</div></a>";
}
die();
break;
//################### Отправка подарка в БД ###################//
case "send":
NoAjaxQuery();
$for_user_id = intval($_POST['for_user_id']);
$cov = intval($_POST['cov']);
$privacy = intval($_POST['privacy']);
if($privacy < 0 OR $privacy > 3) $privacy = 1;
$msg = ajax_utf8(textFilter($_POST['msg']));
$covers = $db->super_query("SELECT price FROM `".PREFIX."_cover_list` WHERE img = '".$cov."'");
$str_date = time();
if($covers['price']){
$db->query("INSERT INTO `".PREFIX."_cover` SET uid = '{$for_user_id}', cov = '{$cov}', msg = '{$msg}', privacy = '{$privacy}', gdate = '{$str_date}', from_uid = '{$user_id}', status = 1");
$db->query("UPDATE `".PREFIX."_users` SET user_cover = '{$cov}.jpg' WHERE user_id = '{$for_user_id}'");
//Вставляем событие в моментальные оповещания
$row_owner = $db->super_query("SELECT user_last_visit FROM `".PREFIX."_users` WHERE user_id = '{$get_user_id}'");
$update_time = $server_time - 70;
if($row_owner['user_last_visit'] >= $update_time){
$action_update_text = 'Сейчас играет '.stripslashes($row['artist']).'-'.stripslashes($row['name']).'';
$db->query("INSERT INTO `".PREFIX."_updates` SET for_user_id = '{$get_user_id}', from_user_id = '{$user_info['user_id']}', type = '13', date = '{$str_date}', text = '{$action_update_text}', user_search_pref = '{$user_info['user_search_pref']}'");
mozg_create_cache("user_{$for_user_id}/updates", 1);
}
}
die();
break;
default:
}
$tpl->clear();
$db->free();
} else {
$user_speedbar = $lang['no_infooo'];
msgbox('', $lang['not_logged'], 'info');
}
?>