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.

OrderSteps/OrderStep_SendAdminNotification.php (1 issue)

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
 * @authors: Nicolaas [at] Sunny Side Up .co.nz
6
 * @package: ecommerce
7
 * @sub-package: model
8
 * @inspiration: Silverstripe Ltd, Jeremy
9
 **/
10
class OrderStep_SendAdminNotification extends OrderStep implements OrderStepInterface
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $emailClassName = 'Order_ReceiptEmail';
16
17
    private static $defaults = array(
18
        'CustomerCanEdit' => 0,
19
        'CustomerCanCancel' => 0,
20
        'CustomerCanPay' => 1,
21
        'Name' => 'Send Admin Notification',
22
        'Code' => 'ADMINNOTIFIED',
23
        'ShowAsInProcessOrder' => 1,
24
    );
25
26
    /**
27
     * can run step once order has been submitted.
28
     *
29
     * @param Order object
30
     *
31
     * @return bool - true if the current step is ready to be run...
32
     **/
33
    public function initStep(Order $order)
34
    {
35
        if ($order->IsSubmitted()) {
36
            return true;
37
        }
38
39
        return false;
40
    }
41
42
    /**
43
     * send invoice to customer
44
     * or in case this is not selected, it will send a message to the shop admin only
45
     * The latter is useful in case the payment does not go through (and no receipt is received).
46
     *
47
     * @param DataObject $order Order
48
     *
49
     * @return bool
50
     **/
51
    public function doStep(Order $order)
52
    {
53
        return $this->sendEmailForStep(
54
            $order,
55
            $subject = $this->EmailSubject,
0 ignored issues
show
The property EmailSubject does not exist on object<OrderStep_SendAdminNotification>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
56
            $message = '',
57
            $resend = false,
58
            $adminOnlyOrToEmail = true,
59
            $this->getEmailClassName()
60
        );
61
    }
62
63
    /**
64
     * can do next step once the admin notification has been sent
65
     *
66
     * @param Order $order
67
     *
68
     * @return OrderStep | Null (next step OrderStep object)
69
     **/
70
    public function nextStep(Order $order)
71
    {
72
        if ($this->hasBeenSent($order)) {
73
            return parent::nextStep($order);
74
        }
75
76
        return;
77
    }
78
79
    /**
80
     * Allows the opportunity for the Order Step to add any fields to Order::getCMSFields.
81
     *
82
     *@param FieldList $fields
83
     *@param Order $order
84
     *
85
     *@return FieldList
86
     **/
87
    public function addOrderStepFields(FieldList $fields, Order $order)
88
    {
89
        $fields = parent::addOrderStepFields($fields, $order);
90
        $title = _t('OrderStep.CANADDGENERALLOG', ' ... if you want to make some notes about this step then do this here...');
91
        $fields->addFieldToTab('Root.Next', $order->getOrderStatusLogsTableField('OrderStatusLog', $title), 'ActionNextStepManually');
92
93
        return $fields;
94
    }
95
96
    /**
97
     * For some ordersteps this returns true...
98
     *
99
     * @return bool
100
     **/
101
    protected function hasCustomerMessage()
102
    {
103
        return false;
104
    }
105
106
    /**
107
     * Explains the current order step.
108
     *
109
     * @return string
110
     */
111
    protected function myDescription()
112
    {
113
        return _t(
114
            'OrderStep.SENDADMIN_NOTIFICATION',
115
            'Admin notification to admin about order.'
116
        );
117
    }
118
}
119