Lynx
Пользователь
По-другому не работает.Lynx, Оригинальное решение
По-другому не работает.Lynx, Оригинальное решение
if (bf($to_userdata['user_opt'], 'user_opt', 'notify_pm'))
function thank() {
global $userdata, $lang;
$mode = (string) $this->request['m'];
$attach_id = (int) $this->request['a'];
if(is_numeric($attach_id)) {
$result = array('attach_id' => $attach_id, 'error' => false);
// Thank!
if($mode == 'thank') {
$sql = "INSERT INTO ". BB_ATTACHMENTS_RATING ." (attach_id,user_id,thanked) VALUES ("
. $attach_id .",". $userdata['user_id'] .",1)on duplicate key update thanked=1";
if( DB()->sql_query($sql) ) {
$sql = "select sum(thanked) as c from ". BB_ATTACHMENTS_RATING ." where attach_id=". $attach_id;
if( $res = DB()->sql_query($sql) ) {
if ($row = DB()->sql_fetchrow($res)) {
$result['thanked'] = $row['c'];
$result['mode'] = $mode;
$result['list_button']=' (<span id="VL'.$attach_id.'"><a href="#torrent" onClick="thank(\'list\','.$attach_id.');">'. $lang['THANK_LIST'] .'</a></span>)';
$sql = "UPDATE ". BB_ATTACHMENTS_DESC ." SET thanks=". $row['c'] ." where attach_id=". $attach_id;
DB()->sql_query($sql);
}
else {
$result['error'] = true;
}
}
else {
$result['error'] = true;
}
}
else {
$result['error'] = true;
}
}
// Thanks list
elseif($mode == 'list')
{
$sql = DB()->fetch_rowset("SELECT u.user_id, u.username, u.user_rank FROM ". BB_ATTACHMENTS_RATING ." r join ". BB_USERS ." u on u.user_id=r.user_id where r.thanked=1 and r.attach_id=". $attach_id);
$html = '';
foreach ($sql as $row)
{
if( $html ) $html .= ', ';
$html .= profile_url($row);
}
$result['list'] = $html;
$result['mode'] = $mode;
}
else {
$result['error'] = true;
}
}
else {
$result['error'] = true;
}
$this->response['message'] = $result;
}
if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['points_poll'])
{
DB()->query("
UPDATE ". BB_USERS ." SET user_points = user_points + ". $bb_cfg['seed_bonus_per_release_price'] ."
");
}