forked from supernova-ws/SuperNova
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaffilates.php
50 lines (38 loc) · 1.5 KB
/
affilates.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* affilates.php
*
* v2 (c) copyright 2010 by Gorlum for http://supernova.ws
* [~] Complies with PCG1
* v1 (c) copyright 2010 by Gorlum for http://supernova.ws
*/
include('common.' . substr(strrchr(__FILE__, '.'), 1));
lng_include('affilates');
$template = gettemplate('affilates', true);
$rpg_bonus_minimum = classSupernova::$config->rpg_bonus_minimum;
$rpg_bonus_divisor = classSupernova::$config->rpg_bonus_divisor ? classSupernova::$config->rpg_bonus_divisor : 10;
$affilates = db_referrals_list_by_id($user['id']);
while ($affilate = db_fetch($affilates))
{
$affilate_gain = $affilate['dark_matter'] >= $rpg_bonus_minimum ? floor($affilate['dark_matter'] / $rpg_bonus_divisor) : 0;
$template->assign_block_vars('affilates', array(
'REGISTERED' => date(FMT_DATE_TIME, $affilate['register_time']),
'USERNAME' => $affilate['username'],
'DARK_MATTER' => $affilate['dark_matter'],
'GAINED' => $affilate_gain,
));
$gained += $affilate_gain;
}
$bannerURL = SN_ROOT_VIRTUAL_PARENT . classSupernova::$config->int_banner_URL;
$bannerURL .= strpos($bannerURL, '?') ? '&' : '?';
$bannerURL .= "id={$user['id']}";
$userbarURL = SN_ROOT_VIRTUAL_PARENT . classSupernova::$config->int_userbar_URL;
$userbarURL .= strpos($userbarURL, '?') ? '&' : '?';
$userbarURL .= "id={$user['id']}";
$template->assign_vars(array(
'GAINED' => $gained,
'user_id' => $user['id'],
'bannerURL' => $bannerURL,
'userbarURL' => $userbarURL,
));
display($template, $lang['aff_title']);