Skip to content

Commit

Permalink
Merge pull request osclass#1996 from conejoninja/htbridge
Browse files Browse the repository at this point in the history
Htbridge
  • Loading branch information
conejoninja committed Jan 18, 2016
2 parents db00b2d + e6a295a commit 4d2031d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
16 changes: 13 additions & 3 deletions oc-includes/osclass/classes/database/DBCommandClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,10 +629,16 @@ function orderBy($orderby, $direction = '')
*/
function limit($value, $offset = '')
{
$this->aLimit = $value;
if(is_numeric($value)) {
$this->aLimit = intval($value);
}

if( $offset != '' ) {
$this->aOffset = $offset;
if(is_numeric($offset)) {
$this->aOffset = intval($offset);
} else {
$this->aOffset = 0;
}
}

return $this;
Expand All @@ -648,7 +654,11 @@ function limit($value, $offset = '')
*/
function offset($offset)
{
$this->aOffset = $offset;
if(is_numeric($offset)) {
$this->aOffset = intval($offset);
} else {
$this->aOffset = 0;
}
return $this;
}

Expand Down
16 changes: 14 additions & 2 deletions oc-includes/osclass/controller/user-non-secure.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,20 @@ function doModel()
return;
}

$itemsPerPage = Params::getParam('itemsPerPage')!='' ? Params::getParam('itemsPerPage') : 10;
$page = Params::getParam('iPage') > 0 ? Params::getParam('iPage') -1 : 0;
$itemsPerPage = Params::getParam('itemsPerPage');
if(is_numeric($itemsPerPage) && intval($itemsPerPage)>0) {
$itemsPerPage = intval($itemsPerPage);
} else {
$itemsPerPage = 10;
}

$page = Params::getParam('iPage');
if(is_numeric($page) && intval($page)>0) {
$page = intval($page)-1;
} else {
$page = 0;
}

$total_items = Item::newInstance()->countItemTypesByUserID($user['pk_i_id'], 'active');

if($itemsPerPage == 'all') {
Expand Down

0 comments on commit 4d2031d

Please sign in to comment.