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 | * m'Manager | Invoices Management System |
||
4 | * |
||
5 | * This content is released under the Proprietary License (Proprietary) |
||
6 | * |
||
7 | * Copyright (c) 2017, Eric Claver AKAFFOU - All Rights Reserved |
||
8 | * Unauthorized copying of this file, via any medium is strictly prohibited |
||
9 | * Proprietary and confidential |
||
10 | * |
||
11 | * @package m'Manager |
||
12 | * @author Eric Claver AKAFFOU |
||
13 | * @copyright Copyright (c) 2017, on'Eric Computing, Inc. (https://www.onericcomputing.com/) |
||
14 | * @license https://www.mmanager.fr Proprietary License |
||
15 | * @link https://codecanyon.net/item/mmanager-invoices-management-system/19866435?s_rank=1 |
||
16 | * @since Version 1.0.0 |
||
17 | * @filesource |
||
18 | */ |
||
19 | |||
20 | namespace Mmanager; |
||
21 | |||
22 | use Mmanager\Contract\HelperFunctionsInterface; |
||
23 | use Mmanager\Domain\Factory\InvoiceFactory; |
||
24 | |||
25 | class BootstrapTable { |
||
26 | protected $cache; |
||
27 | protected $total = 0; |
||
28 | protected $rows = []; |
||
29 | protected $functions; |
||
30 | protected $filter; |
||
31 | protected $order; |
||
32 | protected $offset; |
||
33 | protected $limit; |
||
34 | protected $sort; |
||
35 | protected $list; |
||
36 | |||
37 | public function __construct(HelperFunctionsInterface $functions) { |
||
38 | $this->functions = $functions; |
||
39 | } |
||
40 | final public function prepareList($entity, $serverSidePagination) |
||
41 | { |
||
42 | $return = []; |
||
43 | switch ($entity) { |
||
44 | case 'items': |
||
45 | $this->total = intval($this->functions->totalRows('oc_items')); |
||
46 | break; |
||
47 | case 'services': |
||
48 | $this->total = intval($this->functions->totalServices()); |
||
49 | break; |
||
50 | case 'orders': |
||
51 | $this->total = intval($this->functions->totalRows('oc_orders')); |
||
52 | break; |
||
53 | case 'customers': |
||
54 | $this->total = intval($this->functions->totalRows('oc_clients')); |
||
55 | break; |
||
56 | } |
||
57 | if ($serverSidePagination) { |
||
58 | $return = array( |
||
59 | 'total' => $this->total, |
||
60 | 'rows' => $this->rows |
||
61 | ); |
||
62 | } |
||
63 | return $return; |
||
64 | } |
||
65 | final public function fetchData($entity, $params) |
||
66 | { |
||
67 | $return = []; |
||
68 | if ( ! $params) { |
||
69 | return false; |
||
70 | } else { |
||
71 | foreach ($params as $key => &$value) { |
||
72 | $this->setParams($key, $value); |
||
73 | } |
||
74 | unset($value); |
||
75 | switch ($entity) { |
||
76 | case 'orders': |
||
77 | $return = $this->functions->getOrders($this->filter); |
||
78 | break; |
||
79 | case 'customers': |
||
80 | $return = $this->functions->getCustomers($this->filter); |
||
81 | break; |
||
82 | case 'items': |
||
83 | $return = $this->functions->getItems($this->filter); |
||
0 ignored issues
–
show
|
|||
84 | break; |
||
85 | case 'services': |
||
86 | $return = $this->functions->getServices($this->filter); |
||
87 | break; |
||
88 | } |
||
89 | return $return; |
||
90 | } |
||
91 | } |
||
92 | public function setParams($key, $val) { |
||
93 | $this->{$key} = $val; |
||
94 | } |
||
95 | public function listOrders($params) |
||
96 | { |
||
97 | $this->list = $this->prepareList('orders', false); |
||
98 | $orders = $this->fetchData('orders', $params); |
||
99 | |||
100 | $invoiceObj = new InvoiceFactory; |
||
101 | if ($orders) |
||
102 | { |
||
103 | foreach ($orders as &$order) { |
||
104 | if ($order->amount_paid > 0 AND $order->order_status == 'Refunded') |
||
105 | { |
||
106 | $number_prefix = null == get_option('credit_note_prefix') ? __('credit_note_prefix').sprintf("%04s", $order->order_number) : get_option('credit_note_prefix').sprintf("%04s", $order->order_number); |
||
107 | } |
||
108 | elseif ($order->order_status == 'Refunded') |
||
109 | { |
||
110 | $number_prefix = null == get_option('credit_note_prefix') ? __('credit_note_prefix').sprintf("%04s", $order->order_number) : get_option('credit_note_prefix').sprintf("%04s", $order->order_number); |
||
111 | } |
||
112 | elseif ($order->amount_paid > 0 AND $order->amount_due > 0 AND $order->order_status !== 'Paid') |
||
113 | { |
||
114 | $number_prefix = null == get_option('sale_order_prefix') ? __('sale_order_prefix_short').sprintf("%04s", $order->order_number) : get_option('sale_order_prefix').sprintf("%04s", $order->order_number); |
||
115 | } |
||
116 | elseif ($order->order_status == 'Expired' || $order->order_status == 'Open' || $order->order_status == 'Pending' || $order->order_status == 'Failed') |
||
117 | { |
||
118 | $number_prefix = null == get_option('sale_order_prefix') ? __('sale_order_prefix_short').sprintf("%04s", $order->order_number) : get_option('sale_order_prefix').sprintf("%04s", $order->order_number); |
||
119 | } |
||
120 | else |
||
121 | { |
||
122 | $number_prefix = null == get_option('sale_order_prefix') ? __('sale_order_prefix_short').sprintf("%04s", $order->order_number) : get_option('sale_order_prefix').sprintf("%04s", $order->order_number); |
||
123 | } |
||
124 | array_push($this->list, array( |
||
125 | 'id' => $order->id, |
||
126 | 'client_id' => _eID($order->client_id), |
||
127 | 'number_prefix' => $number_prefix, |
||
128 | 'order_number' => $order->order_number, |
||
129 | 'enc_order_number' => _eID($order->order_number), |
||
130 | 'name_company' => $invoiceObj->getCustomer($order->client_id, 'name_company'), |
||
131 | 'date' => _fdate(language_string_to_locale_notation(get_option('user_language', 'users_options')), $order->date), |
||
132 | 'due_date' => _fdate(language_string_to_locale_notation(get_option('user_language', 'users_options')), $order->due_date), |
||
133 | 'total' => format_number($order->total), |
||
134 | 'amount_due' => format_number($order->amount_due), |
||
135 | 'amount_paid' => format_number($order->amount_paid), |
||
136 | 'amount_refunded' => format_number($order->amount_refunded), |
||
137 | 'status' => order_status_str($order->order_status), |
||
138 | 'stbool' => order_status($order->order_number), |
||
139 | 'pay_type' => $order->pay_type, |
||
140 | 'has_picking_list' => $order->has_picking_list, |
||
141 | 'next_due_date' => $order->next_duedate |
||
142 | ) |
||
143 | ); |
||
144 | } |
||
145 | unset($order); |
||
146 | } |
||
147 | return $this->list; |
||
148 | } |
||
149 | public function listCustomers($params) |
||
150 | { |
||
151 | $this->list = $this->prepareList('customers', false); |
||
152 | $clients = $this->fetchData('customers', $params); |
||
153 | if ($clients) |
||
154 | { |
||
155 | foreach ($clients as &$client) { |
||
156 | if (isset($client->client_address1) && $client->client_postcode && $client->client_city && $client->client_country) |
||
157 | { |
||
158 | $address = $client->client_address1.' '.$client->client_postcode.' '.$client->client_city.' '.get_countries($client->client_country); |
||
159 | } |
||
160 | else |
||
161 | { |
||
162 | $address = false; |
||
163 | } |
||
164 | array_push($this->list, array( |
||
165 | 'client_id' => $client->client_id, |
||
166 | 'enc_client_id' => _eID($client->client_id), |
||
167 | 'name_company' => $client->name_company, |
||
168 | 'email' => $client->client_email, |
||
169 | 'client_phone' => $client->client_phone, |
||
170 | 'client_address' => $address, |
||
171 | 'client_status' => $client->client_status, |
||
172 | 'support_contract' => $client->support_contract * 60, |
||
173 | 'client_credit' => $client->client_credit, |
||
174 | 'client_tax_number' => isset($client->client_tax_number) ? $client->client_tax_number : "", |
||
175 | 'client_bank_number' => isset($client->client_bank_number) ? $client->client_bank_number : "", |
||
176 | 'client_status_str' => status_str($client->client_status), |
||
177 | 'client_date_created' => _fdate(language_string_to_locale_notation(get_option('user_language', 'users_options')), $client->client_date_created) |
||
178 | ) |
||
179 | ); |
||
180 | } |
||
181 | unset($client); |
||
182 | } |
||
183 | return $this->list; |
||
184 | } |
||
185 | public function listItems($params) |
||
186 | { |
||
187 | $this->list = $this->prepareList('items', false); |
||
188 | $items = $this->fetchData('items', $params); |
||
189 | if ($items) |
||
190 | { |
||
191 | foreach ($items as &$item) { |
||
192 | if (null !== $item->qrcode OR null !== $item->barcode) { |
||
193 | $hasqrbar = 1; |
||
194 | } else { |
||
195 | $hasqrbar = 0; |
||
196 | } |
||
197 | array_push($this->list, array( |
||
198 | 'item_id' => $item->item_id, |
||
199 | 'sku' => $item->sku, |
||
200 | 'name' => $item->name, |
||
201 | 'mpn' => $item->product_mpn, |
||
202 | 'group_name' => $item->group_name, |
||
203 | 'group_id' => $item->group_id, |
||
204 | 'price' => format_number($item->price), |
||
205 | 'tax_percent' => $item->tax_percent, |
||
206 | 'item_status' => $item->item_status, |
||
207 | 'qrcode' => $item->qrcode, |
||
208 | 'barcode' => $item->barcode, |
||
209 | 'hasqrbar' => $hasqrbar, |
||
210 | 'item_status_str' => '0.00' !== $item->current_stock ? $item->current_stock.' '.item_status_str($item->item_status) : ''.' '.item_status_str($item->item_status) |
||
211 | ) |
||
212 | ); |
||
213 | } |
||
214 | unset($item); |
||
215 | } |
||
216 | return $this->list; |
||
217 | } |
||
218 | public function listServices($params) |
||
219 | { |
||
220 | $this->list = $this->prepareList('services', false); |
||
221 | $items = $this->fetchData('services', $params); |
||
222 | if ($items) |
||
223 | { |
||
224 | foreach ($items as &$item) { |
||
225 | if (null !== $item->qrcode OR null !== $item->barcode) { |
||
226 | $hasqrbar = 1; |
||
0 ignored issues
–
show
$hasqrbar 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 ![]() |
|||
227 | } |
||
228 | array_push($this->list, array( |
||
229 | 'item_id' => $item->item_id, |
||
230 | 'sku' => $item->sku, |
||
231 | 'name' => $item->name, |
||
232 | 'group_name' => $item->group_name, |
||
233 | 'group_id' => $item->group_id, |
||
234 | 'price' =>format_number($item->price), |
||
235 | 'tax_percent' => $item->tax_percent, |
||
236 | 'item_status' => $item->item_status, |
||
237 | 'item_status_str' => '0.00' !== $item->current_stock ? $item->current_stock.' '.item_status_str($item->item_status) : ''.' '.item_status_str($item->item_status) |
||
238 | ) |
||
239 | ); |
||
240 | } |
||
241 | unset($item); |
||
242 | } |
||
243 | return $this->list; |
||
244 | } |
||
245 | } |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.