Issues (32)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

acp/paypal_module.php (20 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
*
4
* @package phpBB Extension - tas2580 Paypal
5
* @copyright (c) 2015 tas2580 (https://tas2580.net)
6
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
*
8
*/
9
10
namespace tas2580\paypal\acp;
11
12
class paypal_module
13
{
14
	var $u_action;
0 ignored issues
show
The visibility should be declared for property $u_action.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
15
16
	/** @var \phpbb\user */
17
	protected $user;
18
19
	public function main($id, $mode)
20
	{
21
		global $config, $db, $user, $template, $table_prefix, $request, $phpbb_root_path, $phpEx;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
22
23
		$this->user = $user;
24
		$this->phpbb_root_path = $phpbb_root_path;
0 ignored issues
show
The property phpbb_root_path does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
25
		$this->php_ext = $phpEx;
0 ignored issues
show
The property php_ext does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
26
27
		$user->add_lang_ext('tas2580/paypal', 'common');
28
29
		$sql = 'SELECT *
30
			FROM ' . $table_prefix . 'paypal_config';
31
		$result = $db->sql_query($sql);
32
		$paypal_config = $db->sql_fetchrow($result);
33
34
		switch ($mode)
35
		{
36
			case 'settings':
37
				$this->tpl_name = 'acp_paypal_body';
0 ignored issues
show
The property tpl_name does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
38
				$this->page_title = $user->lang('ACP_PAYPAL_TITLE');
0 ignored issues
show
The property page_title does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
39
40
				add_form_key('acp_paypal');
41
42
				// delete amount
43 View Code Duplication
				if ($request->is_set('delete'))
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
44
				{
45
					$id = $request->variable('delete', 0);
46
					if (confirm_box(true))
47
					{
48
						$sql = 'DELETE FROM ' . $table_prefix . 'paypal_amount WHERE amount_id = ' . (int) $id;
49
						$result = $db->sql_query($sql);
50
						trigger_error($user->lang['AMOUNT_DELETED'] . adm_back_link($this->u_action));
51
					}
52
					else
53
					{
54
						confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
55
							'action'	=> 'delete',
56
							'id'		=> $id))
57
						);
58
					}
59
				}
60
61
				$error = array();
62
				// Form is submitted
63
				if ($request->is_set_post('submit'))
64
				{
65 View Code Duplication
					if (!check_form_key('acp_paypal'))
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
66
					{
67
						trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
68
					}
69
70
					$data['paypal_email'] = $request->variable('paypal_email', '', true);
0 ignored issues
show
Coding Style Comprehensibility introduced by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
71
					$data['paypal_sandbox'] = $request->variable('paypal_sandbox', 0);
72
					$data['paypal_currency'] = $request->variable('paypal_currency', '');
73
					$data['paypal_title'] = $request->variable('paypal_title', '', true);
74
					$data['paypal_text'] = $request->variable('paypal_text', '', true);
75
76
					// Validate user input
77
					$validate_array = array(
78
						'paypal_email'				=> array('email'),
79
						'paypal_title'				=> array('string', true, 0, 255),
80
					);
81
82
					if (!function_exists('validate_data'))
83
					{
84
						include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
85
					}
86
					$error = validate_data($data, $validate_array);
87
88
					if (!sizeof($error))
89
					{
90
						$bbcode_options = 7;
91
						generate_text_for_storage($data['paypal_text'], $bbcode_uid, $bbcode_bitfield, $bbcode_options, true, true, true);
0 ignored issues
show
The variable $bbcode_uid does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
The variable $bbcode_bitfield does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
92
93
						$sql_data = array(
94
							'paypal_email'				=> $data['paypal_email'],
95
							'paypal_title'				=> $data['paypal_title'],
96
							'paypal_currency'			=> $data['paypal_currency'],
97
							'paypal_text'				=> $data['paypal_text'],
98
							'bbcode_uid'				=> $bbcode_uid,
99
							'bbcode_bitfield'			=> $bbcode_bitfield,
100
							'paypal_sandbox'			=> $data['paypal_sandbox'],
101
						);
102
						$sql = 'UPDATE ' . $table_prefix . 'paypal_config SET
103
							' . $db->sql_build_array('UPDATE', $sql_data);
104
105
						$db->sql_query($sql);
106
						trigger_error($user->lang('ACP_SAVED') . adm_back_link($this->u_action));
107
					}
108
					else
109
					{
110
						$template->assign_vars(array(
111
							'ERROR'						=> implode('<br />', $error),
112
							'U_ACTION'					=> $this->u_action,
113
							'PAYPAL_EMAIL'				=> $data['paypal_email'],
114
							'PAYPAL_TITLE'				=> $data['paypal_title'],
115
							'PAYPAL_SANDBOX'			=> $data['paypal_sandbox'],
116
							'PAYPAL_TEXT'				=> $data['paypal_text'],
117
							'CURRENCY_CODE'				=> $this->currency_code_select($data['paypal_currency']),
118
						));
119
					}
120
				}
121
122
				// Form is submitted
123
				if ($request->is_set_post('submit_amount'))
124
				{
125
					$add_amount = $request->variable('add_amount', 0);
126
					$sql_data = array(
127
						'amount_value'			=> $add_amount,
128
					);
129
					$sql = 'INSERT INTO ' . $table_prefix . 'paypal_amount
130
						' . $db->sql_build_array('INSERT', $sql_data);
131
					$db->sql_query($sql);
132
					trigger_error($user->lang('ACP_SAVED') . adm_back_link($this->u_action));
133
				}
134
135
				$sql = 'SELECT *
136
					FROM ' . $table_prefix . 'paypal_amount
137
					ORDER BY amount_value';
138
				$result = $db->sql_query($sql);
139
				while ($row = $db->sql_fetchrow($result))
140
				{
141
					$template->assign_block_vars('amounts', array(
142
						'AMOUNT'		=> number_format($row['amount_value'] / 100, 2),
143
						'U_DELETE'	=> $this->u_action . '&delete=' . $row['amount_id'],
144
					));
145
				}
146
147
				if (!sizeof($error))
148
				{
149
					$paypal_text = generate_text_for_edit($paypal_config['paypal_text'], $paypal_config['bbcode_uid'], $paypal_config['bbcode_bitfield']);
150
151
					$template->assign_vars(array(
152
						'U_ACTION'					=> $this->u_action,
153
						'PAYPAL_EMAIL'				=> $paypal_config['paypal_email'],
154
						'PAYPAL_TITLE'				=> $paypal_config['paypal_title'],
155
						'PAYPAL_SANDBOX'			=> $paypal_config['paypal_sandbox'],
156
						'PAYPAL_TEXT'				=> $paypal_text['text'],
157
						'CURRENCY_CODE'				=> $this->currency_code_select($paypal_config['paypal_currency']),
158
					));
159
				}
160
161
				break;
162
163
			case 'items':
164
				$this->tpl_name = 'acp_paypal_items_body';
165
				$this->page_title = $user->lang('ACP_PAYPAL_ITEMS');
166
167
				$item_id = $request->variable('item_id', 0);
168
				$action    = $request->variable('action', '');
169
				switch ($action)
170
				{
171
					case 'add':
172
						add_form_key('acp_paypal');
173
						$template->assign_vars(array(
174
							'ITEM_FORM_NAME'		=> $this->user->lang('ACP_ADD_ITEM'),
175
							'U_ACTION'				=> $this->u_action . '&amp;action=add',
176
							'S_FORM'				=> true,
177
							'ITEM_NAME'				=> $request->variable('item_name', '', true),
178
						));
179
						break;
180
181
					case 'edit':
182
						add_form_key('acp_paypal');
183
						$sql = 'SELECT *
184
							FROM ' . $table_prefix . 'paypal_items
185
							WHERE item_id = ' . (int) $item_id;
186
						$result = $db->sql_query($sql);
187
						$data = $db->sql_fetchrow($result);
188
189
						$item_text = generate_text_for_edit($data['item_text'], $data['bbcode_uid'], $data['bbcode_bitfield']);
190
191
						$template->assign_vars(array(
192
							'ITEM_FORM_NAME'		=> $this->user->lang('ACP_EDIT_ITEM'),
193
							'U_ACTION'				=> $this->u_action . '&amp;action=edit&amp;item_id=' . $data['item_id'],
194
							'S_FORM'				=> true,
195
							'ITEM_NAME'				=> $data['item_name'],
196
							'ITEM_TEXT'				=> $item_text['text'],
197
						));
198
						break;
199
200
					case 'delete':
0 ignored issues
show
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
201
202
						if (confirm_box(true))
203
						{
204
							$sql = 'DELETE FROM ' . $table_prefix . 'paypal_items WHERE item_id = ' . (int) $item_id;
205
							$result = $db->sql_query($sql);
206
							trigger_error($user->lang['ITEM_DELETED'] . adm_back_link($this->u_action));
207
						}
208
						else
209
						{
210
							confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
211
								'action'		=> 'delete',
212
								'i'				=> $id,
213
								'item_id'		=> $item_id))
214
							);
215
						}
216
217
						break;
218
				}
219
				switch ($action)
220
				{
221
					case 'add':
222
					case 'edit':
0 ignored issues
show
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
223
224
						// Form is submitted
225
						if ($request->is_set_post('submit'))
226
						{
227 View Code Duplication
							if (!check_form_key('acp_paypal'))
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
228
							{
229
								trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
230
							}
231
							$data['item_name'] = $request->variable('item_name', '', true);
0 ignored issues
show
The variable $data does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
232
							$data['item_text'] = $request->variable('item_text', '', true);
233
234
							// Validate user input
235
							$validate_array = array(
236
								'item_name'				=> array('string', false, 1, 255),
237
								'item_text'				=> array('string', false, 1, 99999),
238
							);
239
240
							if (!function_exists('validate_data'))
241
							{
242
								include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
243
							}
244
							$error = validate_data($data, $validate_array);
245
							if (!sizeof($error))
246
							{
247
								$bbcode_options = 7;
248
								generate_text_for_storage($data['item_text'], $bbcode_uid, $bbcode_bitfield, $bbcode_options, true, true, true);
249
								$sql_data = array(
250
									'item_name'			=> $data['item_name'],
251
									'item_text'			=> $data['item_text'],
252
									'bbcode_uid'		=> $bbcode_uid,
253
									'bbcode_bitfield'	=> $bbcode_bitfield,
254
								);
255
								if ($action == 'add')
256
								{
257
									$sql = 'INSERT INTO ' . $table_prefix . 'paypal_items
258
										' . $db->sql_build_array('INSERT', $sql_data);
259
									$db->sql_query($sql);
260
									trigger_error($user->lang('ACP_ITEM_ADD_SUCCESS') . adm_back_link($this->u_action));
261
								}
262
								else if ($action == 'edit')
263
								{
264
									$sql = 'UPDATE ' . $table_prefix . 'paypal_items SET
265
										' . $db->sql_build_array('UPDATE', $sql_data) .'
266
										WHERE item_id = ' . (int) $item_id;
267
									$db->sql_query($sql);
268
									trigger_error($user->lang('ACP_ITEM_EDIT_SUCCESS') . adm_back_link($this->u_action));
269
								}
270
							}
271
							else
272
							{
273
								$template->assign_vars(array(
274
									'ERROR'			=> implode('<br />', $error),
275
									'ITEM_NAME'		=> $data['item_name'],
276
									'ITEM_TEXT'		=> $data['item_text'],
277
								));
278
							}
279
						}
280
						break;
281
282
					default:
283
						$ammount = array();
284
						$sql = 'SELECT item_id, donation_amount
285
							FROM ' . $table_prefix . 'paypal_donations
286
							ORDER BY item_name';
287
						$result = $db->sql_query($sql);
288
						while ($row = $db->sql_fetchrow($result))
289
						{
290
							if (isset($ammount[$row['item_id']]))
291
							{
292
								$ammount[$row['item_id']] += $row['donation_amount'];
293
							}
294
							else
295
							{
296
								$ammount[$row['item_id']] = $row['donation_amount'];
297
							}
298
						}
299
300
						$sql = 'SELECT item_name, item_id
301
							FROM ' . $table_prefix . 'paypal_items
302
							ORDER BY item_name';
303
						$result = $db->sql_query($sql);
304
						while ($row = $db->sql_fetchrow($result))
305
						{
306
							$template->assign_block_vars('items', array(
307
								'ITEM'		=> $row['item_name'],
308
								'AMMOUNT'	=> (isset($ammount[$row['item_id']]) ? number_format($ammount[$row['item_id']], 2) : '0.00') . ' ' . $paypal_config['paypal_currency'],
309
								'U_EDIT'	=> $this->u_action . '&amp;action=edit&amp;item_id=' . $row['item_id'],
310
								'U_DELETE'	=> $this->u_action . '&amp;action=delete&amp;item_id=' . $row['item_id'],
311
							));
312
						}
313
						$template->assign_vars(array(
314
								'U_ACTION'					=> $this->u_action . '&amp;action=add',
315
						));
316
317
						break;
318
				}
319
320
				break;
321
322
			case 'donations':
323
				$this->tpl_name = 'acp_paypal_donations_body';
324
				$this->page_title = $user->lang('ACP_PAYPAL_DONATIONS');
325
326
				$action    = $request->variable('action', '');
327 View Code Duplication
				if ($action == 'delete')
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
328
				{
329
					$donation_id = $request->variable('donation_id', 0);
330
					if (confirm_box(true))
331
					{
332
						$sql = 'DELETE FROM ' . $table_prefix . 'paypal_donations WHERE donation_id = ' . (int) $donation_id;
333
						$result = $db->sql_query($sql);
0 ignored issues
show
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
334
						trigger_error($user->lang['DONATION_DELETED'] . adm_back_link($this->u_action));
335
					}
336
					else
337
					{
338
						confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
339
							'action'		=> 'delete',
340
							'i'				=> $id,
341
							'donation_id'	=> $donation_id))
342
						);
343
					}
344
				}
345
346
				$sql_array = array(
347
					'SELECT'		=> 'd.*, u.user_id, u.username, u.user_colour, i.item_name',
348
					'FROM'			=> array($table_prefix . 'paypal_donations' => 'd'),
349
					'LEFT_JOIN'		=> array(
350
						array(
351
							'FROM'		=> array(USERS_TABLE => 'u'),
352
							'ON'		=> 'u.user_id = d.user_id'
353
						),
354
						array(
355
							'FROM'		=> array($table_prefix . 'paypal_items' => 'i'),
356
							'ON'		=> 'i.item_id = d.item_id'
357
						)
358
					),
359
					'ORDER_BY'		=> 'd.donation_time DESC',
360
				);
361
				$sql = $db->sql_build_query('SELECT', $sql_array);
362
				$result = $db->sql_query($sql);
363
				while ($row = $db->sql_fetchrow($result))
364
				{
365
					$template->assign_block_vars('donations', array(
366
						'USER'		=> get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
367
						'ITEM'		=> $row['item_name'],
368
						//'USER'		=> $row['item_name'],
0 ignored issues
show
Unused Code Comprehensibility introduced by
78% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
369
						'TIME'		=> $this->user->format_date($row['donation_time']),
370
						'AMOUNT'	=> number_format($row['donation_amount'], 2) . ' ' . $paypal_config['paypal_currency'],
371
						'U_DELETE'	=> $this->u_action . '&amp;action=delete&amp;donation_id=' . $row['donation_id'],
372
					));
373
				}
374
				$template->assign_vars(array(
375
					'S_CURL'					=> function_exists('curl_init'),
376
				));
377
				break;
378
		}
379
	}
380
381
	private function currency_code_select($sel)
382
	{
383
		global $user;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
384
		$codes = array(
385
			'AUD'	=> $user->lang('DONATION_AUD'),
386
			'CAD'	=> $user->lang('DONATION_CAD'),
387
			'CHF'		=> $user->lang('DONATION_CHF'),
388
			'CZK'		=> $user->lang('DONATION_CZK'),
389
			'DKK'		=> $user->lang('DONATION_DKK'),
390
			'EUR'		=> $user->lang('DONATION_EUR'),
391
			'GBP'	=> $user->lang('DONATION_GBP'),
392
			'HKD'	=> $user->lang('DONATION_HKD'),
393
			'HUF'		=> $user->lang('DONATION_HUF'),
394
			'ILS'		=> $user->lang('DONATION_ILS'),
395
			'JPY'		=> $user->lang('DONATION_JPY'),
396
			'MXN'	=> $user->lang('DONATION_MXN'),
397
			'NOK'	=> $user->lang('DONATION_NOK'),
398
			'NZD'	=> $user->lang('DONATION_NZD'),
399
			'PLN'		=> $user->lang('DONATION_PLN'),
400
			'SEK'		=> $user->lang('DONATION_SEK'),
401
			'SGD'	=> $user->lang('DONATION_SGD'),
402
			'USD'	=> $user->lang('DONATION_USD'),
403
		);
404
405
		$retrun = '';
406 View Code Duplication
		foreach ($codes as $value => $title)
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
407
		{
408
			$selected = ($value == $sel) ? ' selected="selected"' : '';
409
			$retrun .= '<option value="' . $value . '"' . $selected . '>' . $title . '</option>';
410
		}
411
		return $retrun;
412
	}
413
}
414