Skip to content

Commit

Permalink
Force casting of types
Browse files Browse the repository at this point in the history
  • Loading branch information
Maks3w committed Dec 14, 2016
1 parent 8f9bb33 commit fae1d44
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions aplazame/controllers/front/Api/article.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public function __construct(Db $db)

public function articles(array $queryArguments)
{
$page = (isset($queryArguments['page'])) ? $queryArguments['page'] : 1;
$page_size = (isset($queryArguments['page_size'])) ? $queryArguments['page_size'] : 10;
$page = (isset($queryArguments['page'])) ? (int) $queryArguments['page'] : 1;
$page_size = (isset($queryArguments['page_size'])) ? (int) $queryArguments['page_size'] : 10;
$offset = ($page - 1) * $page_size;

$products = $this->db->executeS(
Expand Down
8 changes: 4 additions & 4 deletions aplazame/controllers/front/Api/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public function history(array $params, array $queryArguments)
return AplazameApiModuleFrontController::not_found();
}

$page = (isset($queryArguments['page'])) ? $queryArguments['page'] : 1;
$page_size = (isset($queryArguments['page_size'])) ? $queryArguments['page_size'] : 10;
$page = (isset($queryArguments['page'])) ? (int) $queryArguments['page'] : 1;
$page_size = (isset($queryArguments['page_size'])) ? (int) $queryArguments['page_size'] : 10;
$offset = ($page - 1) * $page_size;

$orders = $this->db->executeS(
'SELECT id_order FROM ' . _DB_PREFIX_ . 'orders'
. ' WHERE id_customer = ' . $order->id_customer
. ' LIMIT ' . $offset . ', ' . $page_size
. ' WHERE id_customer = ' . (int) $order->id_customer
. ' LIMIT ' . (int) $offset . ', ' . (int) $page_size
);

$historyOrders = array();
Expand Down
4 changes: 2 additions & 2 deletions aplazame/controllers/front/history.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ private function getCustomerHistory($customerId, $limit)
{
$orders = Db::getInstance()->executeS(
'SELECT * FROM ' . _DB_PREFIX_ . 'orders'
. ' WHERE id_customer = ' . $customerId
. ' ORDER BY id_order DESC LIMIT ' . $limit
. ' WHERE id_customer = ' . (int) $customerId
. ' ORDER BY id_order DESC LIMIT ' . (int) $limit
);

$historyOrders = array();
Expand Down

0 comments on commit fae1d44

Please sign in to comment.