Issues (1369)

affilates.php (6 issues)

1
<?php
2
3
/**
4
 * affilates.php
5
 *
6
 * v2 (c) copyright 2010 by Gorlum for http://supernova.ws
7
 *  [~] Complies with PCG1
8
 * v1 (c) copyright 2010 by Gorlum for http://supernova.ws
9
 */
10
11
include('common.' . substr(strrchr(__FILE__, '.'), 1));
12
13
lng_include('affilates');
14
15
$template = SnTemplate::gettemplate('affilates', true);
0 ignored issues
show
true of type true is incompatible with the type null|template expected by parameter $template of SnTemplate::gettemplate(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

15
$template = SnTemplate::gettemplate('affilates', /** @scrutinizer ignore-type */ true);
Loading history...
16
17
$rpg_bonus_minimum = SN::$config->rpg_bonus_minimum;
0 ignored issues
show
Bug Best Practice introduced by
The property rpg_bonus_minimum does not exist on classConfig. Since you implemented __get, consider adding a @property annotation.
Loading history...
18
$rpg_bonus_divisor = SN::$config->rpg_bonus_divisor ? SN::$config->rpg_bonus_divisor : 10;
0 ignored issues
show
Bug Best Practice introduced by
The property rpg_bonus_divisor does not exist on classConfig. Since you implemented __get, consider adding a @property annotation.
Loading history...
19
20
$affilates = db_referrals_list_by_id($user['id']);
21
while ($affilate = db_fetch($affilates))
0 ignored issues
show
Deprecated Code introduced by
The function db_fetch() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

21
while ($affilate = /** @scrutinizer ignore-deprecated */ db_fetch($affilates))
Loading history...
22
{
23
  $affilate_gain = $affilate['dark_matter'] >= $rpg_bonus_minimum ? floor($affilate['dark_matter'] / $rpg_bonus_divisor) : 0;
24
25
  $template->assign_block_vars('affilates', array(
26
    'REGISTERED'  => date(FMT_DATE_TIME, $affilate['register_time']),
27
    'USERNAME'    => $affilate['username'],
28
    'DARK_MATTER' => $affilate['dark_matter'],
29
    'GAINED'      => $affilate_gain,
30
  ));
31
32
  $gained += $affilate_gain;
33
}
34
35
$bannerURL  = SN_ROOT_VIRTUAL_PARENT . SN::$config->int_banner_URL;
0 ignored issues
show
Bug Best Practice introduced by
The property int_banner_URL does not exist on classConfig. Since you implemented __get, consider adding a @property annotation.
Loading history...
36
$bannerURL .= strpos($bannerURL, '?') ? '&' : '?';
37
$bannerURL .= "id={$user['id']}";
38
39
$userbarURL  = SN_ROOT_VIRTUAL_PARENT . SN::$config->int_userbar_URL;
0 ignored issues
show
Bug Best Practice introduced by
The property int_userbar_URL does not exist on classConfig. Since you implemented __get, consider adding a @property annotation.
Loading history...
40
$userbarURL .= strpos($userbarURL, '?') ? '&' : '?';
41
$userbarURL .= "id={$user['id']}";
42
43
$template->assign_vars(array(
44
  'GAINED'     => $gained,
45
  'user_id'    => $user['id'],
46
  'bannerURL'  => $bannerURL,
47
  'userbarURL' => $userbarURL,
48
));
49
50
SnTemplate::display($template, $lang['aff_title']);
51