Issues (2002)

Security Analysis    not enabled

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.

code/control/EcommercePaymentController.php (4 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
/**
5
 * @description: Used to diplay the payment form.
6
 *
7
 * @authors: Nicolaas [at] Sunny Side Up .co.nz
8
 * @package: ecommerce
9
 * @sub-package: control
10
 **/
11
class EcommercePaymentController extends Controller
12
{
13
    private static $allowed_actions = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
14
        'thankyou',
15
        'index',
16
        'pay',
17
        'PaymentForm',
18
    );
19
20
    /**
21
     * @var Order
22
     */
23
    protected $currentOrder = null;
24
25
    /**
26
     * @var string
27
     */
28
    protected $errorMessage = '';
29
30
    /**
31
     * @var string
32
     */
33
    protected $goodMessage = '';
34
35
    /**
36
     * @param string | Int $orderID
37
     *
38
     * @return string (Link)
39
     */
40
    public static function make_payment_link($orderID)
41
    {
42
        $urlSegment = EcommerceConfig::get('EcommercePaymentController', 'url_segment');
43
        $link = Controller::join_links(
44
            Director::baseURL(),
45
            $urlSegment.'/pay/'.$orderID.'/'
46
        );
47
48
        return $link;
49
    }
50
51
    public function init()
52
    {
53
        parent::init();
54
        isset($project) ? $themeBaseFolder = $project : $themeBaseFolder = 'mysite';
0 ignored issues
show
The variable $project seems to never exist, and therefore isset should always return false. Did you maybe rename this variable?

This check looks for calls to isset(...) or empty() on variables that are yet undefined. These calls will always produce the same result and can be removed.

This is most likely caused by the renaming of a variable or the removal of a function/method parameter.

Loading history...
55
        Requirements::themedCSS('typography', $themeBaseFolder);
56
        Requirements::javascript(THIRDPARTY_DIR.'/jquery/jquery.js');
57
        //Requirements::block(THIRDPARTY_DIR."/jquery/jquery.js");
58
        //Requirements::javascript(Director::protocol()."ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js");
59
        $id = intval($this->request->param('ID'));
60
        if (!$id && isset($_REQUEST['OrderID'])) {
61
            $id = intval($_REQUEST['OrderID']);
62
        }
63
        if ($id) {
64
            $order = Order::get_by_id_if_can_view($id);
65
            if ($order) {
66
                $this->currentOrder = $order;
67
            }
68
        }
69
    }
70
71
    public function index()
72
    {
73
        return array();
74
    }
75
76
    public function pay()
77
    {
78
        return array();
79
    }
80
81
    /**
82
     * TO DO: TEST!!!
83
     */
84
    public function thankyou()
85
    {
86
        $this->goodMessage = _t('EcommercePaymentController.THANKYOU', 'Thank you for your payment.');
87
        $this->currentOrder = null;
88
89
        return array();
90
    }
91
92
    /**
93
     * @param string $action
0 ignored issues
show
Should the type for parameter $action not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
94
     *
95
     * @return string (Link)
96
     */
97
    public function Link($action = null)
98
    {
99
        $URLSegment = Config::inst()->get($this->class, 'url_segment');
100
        if (!$URLSegment) {
101
            $URLSegment = $this->class;
102
        }
103
104
        return Controller::join_links(
105
            Director::baseURL(),
106
            $URLSegment,
107
            $action
108
        );
109
    }
110
111
    /**
112
     * @return Form (OrderForm_Payment) | Array
0 ignored issues
show
Should the return type not be OrderForm_Payment|array?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
113
     **/
114
    public function PaymentForm()
115
    {
116
        if ($this->currentOrder) {
117
            if ($this->currentOrder->canPay()) {
118
                Requirements::javascript('ecommerce/javascript/EcomPayment.js');
119
120
                return OrderForm_Payment::create($this, 'PaymentForm', $this->currentOrder, $this->Link('thankyou'));
121
            } else {
122
                $this->errorMessage = _t('EcommercePaymentController.CANNOTMAKEPAYMENT', 'You can not make a payment for this order.');
123
            }
124
        } else {
125
            $this->errorMessage = _t('EcommercePaymentController.ORDERCANNOTBEFOUND', 'Order can not be found.');
126
        }
127
128
        return array();
129
    }
130
131
    public function ErrorMessage()
132
    {
133
        return $this->errorMessage;
134
    }
135
136
    public function GoodMessage()
137
    {
138
        return $this->goodMessage;
139
    }
140
}
141