This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 | * PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify |
||
5 | * it under the terms of the GNU Lesser General Public License as published by |
||
6 | * the Free Software Foundation, either version 3 of the License, or |
||
7 | * (at your option) any later version. |
||
8 | * |
||
9 | * PAYONE Magento 2 Connector is distributed in the hope that it will be useful, |
||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
12 | * GNU Lesser General Public License for more details. |
||
13 | * |
||
14 | * You should have received a copy of the GNU Lesser General Public License |
||
15 | * along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>. |
||
16 | * |
||
17 | * PHP version 5 |
||
18 | * |
||
19 | * @category Payone |
||
20 | * @package Payone_Magento2_Plugin |
||
21 | * @author FATCHIP GmbH <[email protected]> |
||
22 | * @copyright 2003 - 2016 Payone GmbH |
||
23 | * @license <http://www.gnu.org/licenses/> GNU Lesser General Public License |
||
24 | * @link http://www.payone.de |
||
25 | */ |
||
26 | |||
27 | namespace Payone\Core\Helper; |
||
28 | |||
29 | /** |
||
30 | * Helper class for the config export |
||
31 | */ |
||
32 | class ConfigExport extends \Payone\Core\Helper\Base |
||
33 | { |
||
34 | /** |
||
35 | * PAYONE payment helper |
||
36 | * |
||
37 | * @var \Payone\Core\Helper\Payment |
||
38 | */ |
||
39 | protected $paymentHelper; |
||
40 | |||
41 | /** |
||
42 | * PAYONE database helper |
||
43 | * |
||
44 | * @var \Payone\Core\Helper\Database |
||
45 | */ |
||
46 | protected $databaseHelper; |
||
47 | |||
48 | /** |
||
49 | * PAYONE config helper |
||
50 | * |
||
51 | * @var \Payone\Core\Helper\Config |
||
52 | */ |
||
53 | protected $configHelper; |
||
54 | |||
55 | /** |
||
56 | * Constructor |
||
57 | * |
||
58 | * @param \Magento\Framework\App\Helper\Context $context |
||
59 | * @param \Magento\Store\Model\StoreManagerInterface $storeManager |
||
60 | * @param \Payone\Core\Helper\Shop $shopHelper |
||
61 | * @param \Payone\Core\Helper\Payment $paymentHelper |
||
62 | * @param \Payone\Core\Helper\Database $databaseHelper |
||
63 | * @param \Payone\Core\Helper\Config $configHelper |
||
64 | */ |
||
65 | public function __construct( |
||
66 | \Magento\Framework\App\Helper\Context $context, |
||
67 | \Magento\Store\Model\StoreManagerInterface $storeManager, |
||
68 | \Payone\Core\Helper\Shop $shopHelper, |
||
69 | \Payone\Core\Helper\Payment $paymentHelper, |
||
70 | \Payone\Core\Helper\Database $databaseHelper, |
||
71 | \Payone\Core\Helper\Config $configHelper |
||
72 | ) { |
||
73 | parent::__construct($context, $storeManager, $shopHelper); |
||
74 | $this->paymentHelper = $paymentHelper; |
||
75 | $this->databaseHelper = $databaseHelper; |
||
76 | $this->configHelper = $configHelper; |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * Format module info from db |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | public function getModuleInfo() |
||
85 | { |
||
86 | $aModules = []; |
||
87 | |||
88 | $aResult = $this->databaseHelper->getModuleInfo(); |
||
89 | if ($aResult) { |
||
0 ignored issues
–
show
|
|||
90 | foreach ($aResult as $aRow) { |
||
91 | $aModules[$aRow['module']] = $aRow['schema_version']; |
||
92 | } |
||
93 | } |
||
94 | return $aModules; |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * Get the configured status mappings for all payment types |
||
99 | * for the given store |
||
100 | * |
||
101 | * @param string $sStoreCode |
||
102 | * @return array |
||
103 | */ |
||
104 | public function getMappings($sStoreCode) |
||
105 | { |
||
106 | $aMappings = []; |
||
107 | |||
108 | $aPaymentTypes = $this->paymentHelper->getAvailablePaymentTypes(); |
||
109 | foreach ($aPaymentTypes as $sPaymentCode) { |
||
110 | $sPaymentMapping = $this->getConfigParam($sPaymentCode, 'statusmapping', 'payone_general', $sStoreCode); |
||
111 | $aPaymentMapping = false; |
||
112 | if (!empty($sPaymentMapping)) { |
||
113 | $aPaymentMapping = $this->unserialize($sPaymentMapping); |
||
114 | } |
||
115 | if (is_array($aPaymentMapping) && !empty($aPaymentMapping)) { |
||
116 | $aMap = []; |
||
117 | foreach ($aPaymentMapping as $aPayMap) { |
||
118 | $aMap[] = [ |
||
119 | 'from' => $aPayMap['txaction'], |
||
120 | 'to' => $aPayMap['state_status'], |
||
121 | ]; |
||
122 | } |
||
123 | $aMappings[$this->paymentHelper->getPaymentAbbreviation($sPaymentCode)] = $aMap; |
||
124 | } |
||
125 | } |
||
126 | return $aMappings; |
||
127 | } |
||
128 | |||
129 | /** |
||
130 | * Get all configured status forwardings for the given store |
||
131 | * |
||
132 | * @param string $sStoreCode |
||
133 | * @return array |
||
134 | */ |
||
135 | public function getForwardings($sStoreCode) |
||
136 | { |
||
137 | $aForwardingReturn = []; |
||
138 | $aForwarding = $this->configHelper->getForwardingUrls($sStoreCode); |
||
139 | foreach ($aForwarding as $aForwardEntry) { |
||
140 | if (isset($aForwardEntry['txaction']) && !empty($aForwardEntry['txaction'])) { |
||
141 | $aForwardingReturn[] = [ |
||
142 | 'status' => implode(',', $aForwardEntry['txaction']), |
||
143 | 'url' => $aForwardEntry['url'], |
||
144 | 'timeout' => (int)$aForwardEntry['timeout'], |
||
145 | ]; |
||
146 | } |
||
147 | } |
||
148 | return $aForwardingReturn; |
||
149 | } |
||
150 | |||
151 | /** |
||
152 | * Get config parameters of certain payment-types |
||
153 | * |
||
154 | * @param string $sParam |
||
155 | * @param string $sPaymentCode |
||
156 | * @param string $sStoreCode |
||
157 | * @param bool $blCheckGlobal |
||
158 | * @return string |
||
159 | */ |
||
160 | public function getPaymentConfig($sParam, $sPaymentCode, $sStoreCode, $blCheckGlobal = false) |
||
161 | { |
||
162 | $iPaymentUseGlobal = $this->getConfigParam('use_global', $sPaymentCode, 'payone_payment', $sStoreCode); |
||
163 | if (!$blCheckGlobal || ($blCheckGlobal && $iPaymentUseGlobal == '0')) { |
||
164 | return $this->getConfigParam($sParam, $sPaymentCode, 'payone_payment', $sStoreCode); |
||
165 | } |
||
166 | return $this->getConfigParam($sParam, 'global', 'payone_general', $sStoreCode); |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * Get the allowed countries for a given payment type |
||
171 | * or an empty string if all countries are allowed |
||
172 | * |
||
173 | * @param string $sPaymentCode |
||
174 | * @param string $sStoreCode |
||
175 | * @return string |
||
176 | */ |
||
177 | public function getCountries($sPaymentCode, $sStoreCode) |
||
178 | { |
||
179 | if ($this->getPaymentConfig('allowspecific', $sPaymentCode, $sStoreCode, true) == '1') { |
||
180 | return $this->getPaymentConfig('specificcountry', $sPaymentCode, $sStoreCode, true); |
||
181 | } |
||
182 | return ''; // empty return value if all countries are available |
||
183 | } |
||
184 | } |
||
185 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.