Issues (315)

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.

src/Networks/VerticalAds.php (7 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
namespace Padosoft\AffiliateNetwork\Networks;
4
5
use Padosoft\AffiliateNetwork\Transaction;
6
use Padosoft\AffiliateNetwork\DealsResultset;
7
use Padosoft\AffiliateNetwork\Merchant;
8
use Padosoft\AffiliateNetwork\Stat;
9
use Padosoft\AffiliateNetwork\Deal;
10
use Padosoft\AffiliateNetwork\AbstractNetwork;
11
use Padosoft\AffiliateNetwork\NetworkInterface;
12
use Padosoft\AffiliateNetwork\ProductsResultset;
13
14
/**
15
 * Class VerticalAds
16
 * @package Padosoft\AffiliateNetwork\Networks
17
 */
18 View Code Duplication
class VerticalAds extends AbstractNetwork implements NetworkInterface
0 ignored issues
show
This class seems to be duplicated in 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...
19
{
20
    /**
21
     * @var object
22
     */
23
    private $_network = null;
24
    private $_username = '';
25
    private $_password = '';
26
    protected $_tracking_parameter = 'subid';
27
    private $_idSite = '';
28
29
    /**
30
     * @method __construct
31
     */
32
    public function __construct(string $username, string $password, string $idSite = '')
33
    {
34
        $this->_network = new \Oara\Network\Publisher\VerticalAds;
35
        $this->_username = $username;
36
        $this->_password = $password;
37
        $this->_idSite = $idSite;
38
39
        $this->login($this->_username, $this->_password, $this->_idSite);
40
    }
41
42
    public function login(string $username, string $password, string $idSite = ''): bool
43
    {
44
        $this->_logged = false;
0 ignored issues
show
The property _logged 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...
45
        if (isNullOrEmpty($username) || isNullOrEmpty($password)) {
46
47
            return false;
48
        }
49
        $this->_username = $username;
50
        $this->_password = $password;
51
        $this->_idSite = $idSite;
52
        $credentials = array();
53
        $credentials["user"] = $this->_username;
54
        $credentials["password"] = $this->_password;
55
        $credentials["idSite"] = $this->_idSite;
56
        $this->_network->login($credentials);
57
        if ($this->_network->checkConnection()) {
58
            $this->_logged = true;
59
        }
60
61
        return $this->_logged;
62
    }
63
64
    /**
65
     * @return bool
66
     */
67
    public function checkLogin(): bool
68
    {
69
        return $this->_logged;
70
    }
71
72
    /**
73
     * @return array of Merchants
74
     * @throws \Exception
75
     */
76
    public function getMerchants(): array
77
    {
78
        throw new \Exception("Not implemented yet");
79
    }
80
81
    /**
82
     * @param null $merchantID
83
     * @param int $page
84
     * @param int $items_per_page
85
     * @return DealsResultset  array of Deal
86
     * @throws \Exception
87
     */
88
    public function getDeals($merchantID = NULL, int $page = 0, int $items_per_page = 100): DealsResultset
89
    {
90
        throw new \Exception("Not implemented yet");
91
92
    }
93
94
    /**
95
     * @param \DateTime $dateFrom
96
     * @param \DateTime $dateTo
97
     * @param array $arrMerchantID
98
     * @return array of Transaction
99
     * @throws \Exception
100
     */
101
    public function getSales(\DateTime $dateFrom, \DateTime $dateTo, array $arrMerchantID = array()): array
102
    {
103
        $arrResult = array();
104
        try {
105
            $transactionList = $this->_network->getTransactionList($arrMerchantID, $dateFrom, $dateTo);
106
            foreach ($transactionList as $transaction) {
107
                $Transaction = Transaction::createInstance();
108
                if (isset($transaction['currency']) && !empty($transaction['currency'])) {
109
                    $Transaction->currency = $transaction['currency'];
110
                } else {
111
                    $Transaction->currency = "EUR";
112
                }
113
                $Transaction->status = $transaction['status'];
114
                $Transaction->action = $transaction['action'];
0 ignored issues
show
The property action does not seem to exist. Did you mean transaction_ID?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
115
                $Transaction->amount = $transaction['amount'];
116
                array_key_exists_safe($transaction, 'custom_id') ? $Transaction->custom_ID = $transaction['custom_id'] : $Transaction->custom_ID = '';
117
                $Transaction->title = $transaction['title'];
118
                $Transaction->unique_ID = $transaction['unique_id'];
119
                $Transaction->commission = $transaction['commission'];
120
                $date = new \DateTime($transaction['date']);
121
                $Transaction->date = $date;
0 ignored issues
show
Documentation Bug introduced by
It seems like $date of type object<DateTime> is incompatible with the declared type string of property $date.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
122
                // Future use - Only few providers returns these dates values - <PN> - 2017-06-29
123
                if (isset($transaction['click_date']) && !empty($transaction['click_date'])) {
124
                    $Transaction->click_date = new \DateTime($transaction['click_date']);
0 ignored issues
show
Documentation Bug introduced by
It seems like new \DateTime($transaction['click_date']) of type object<DateTime> is incompatible with the declared type string of property $click_date.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
125
                }
126
                if (isset($transaction['update_date']) && !empty($transaction['update_date'])) {
127
                    $Transaction->update_date = new \DateTime($transaction['update_date']);
0 ignored issues
show
Documentation Bug introduced by
It seems like new \DateTime($transaction['update_date']) of type object<DateTime> is incompatible with the declared type string of property $update_date.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
128
                }
129
                $Transaction->merchant_ID = $transaction['merchantId'];
130
                $Transaction->campaign_name = $transaction['merchantName'];
131
                $Transaction->approved = false;
132
                if ($Transaction->status == \Oara\Utilities::STATUS_CONFIRMED) {
133
                    $Transaction->approved = true;
134
                }
135
                $arrResult[] = $Transaction;
136
            }
137
138
        } catch (\Exception $e) {
139
            echo "[VerticalAds][getSales][Exception] " . $e->getMessage() . PHP_EOL;
140
            var_dump($e->getTraceAsString());
0 ignored issues
show
Security Debugging Code introduced by
var_dump($e->getTraceAsString()); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
141
            throw new \Exception($e);
142
        }
143
144
        return $arrResult;
145
146
    }
147
148
    /**
149
     * @param \DateTime $dateFrom
150
     * @param \DateTime $dateTo
151
     * @param int $merchantID
152
     * @return array of Stat
153
     */
154
    public function getStats(\DateTime $dateFrom, \DateTime $dateTo, int $merchantID = 0): array
155
    {
156
        // TODO
157
        return array();
158
    }
159
160
161
    /**
162
     * @param array $params
163
     * @return ProductsResultset
164
     * @throws \Exception
165
     */
166
    public function getProducts(array $params = []): ProductsResultset
167
    {
168
        // TODO: Implement getProducts() method.
169
        throw new \Exception("Not implemented yet");
170
    }
171
172
    public function getTrackingParameter()
173
    {
174
        return $this->_tracking_parameter;
175
    }
176
177
178
}
179