From ee0729e6c077f557e9f9d9fec78b8a8342b60272 Mon Sep 17 00:00:00 2001 From: Mark Schouten Date: Fri, 26 Sep 2014 13:05:04 +0200 Subject: [PATCH] Actually make it work --- includes/misc.inc.php | 2 +- includes/session.inc.php | 6 +++++- includes/wefactauth.inc.php | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/includes/misc.inc.php b/includes/misc.inc.php index b41d808..86d13f3 100644 --- a/includes/misc.inc.php +++ b/includes/misc.inc.php @@ -112,7 +112,7 @@ function jtable_respond($records, $method = 'multiple', $msg = 'Undefined errorm } else { if (isset($_GET['jtPageSize'])) { $jTableResult['TotalRecordCount'] = count($records); - $records = array_slice($records, $_GET['jtStartIndex'], $_GET['jtPageSize']); + $records = array_slice($records, $_GET['jtStartIndex']-1, $_GET['jtPageSize']); } $jTableResult['Result'] = "OK"; $jTableResult['Records'] = $records; diff --git a/includes/session.inc.php b/includes/session.inc.php index 86b4fdd..32ce442 100644 --- a/includes/session.inc.php +++ b/includes/session.inc.php @@ -2,6 +2,7 @@ include_once('config.inc.php'); include_once('misc.inc.php'); +include_once('wefactauth.inc.php'); session_start(); @@ -39,6 +40,9 @@ function logout() { } function try_login() { + global $wefactapiurl; + global $wefactapikey; + if (isset($_POST['username']) and isset($_POST['password'])) { if (valid_user($_POST['username']) === FALSE) { return FALSE; @@ -50,7 +54,7 @@ function try_login() { if ($wefact === FALSE) { return FALSE; } - if ($wefact != -1) { + if ($wefact !== -1) { $do_local_auth = 0; } } diff --git a/includes/wefactauth.inc.php b/includes/wefactauth.inc.php index aa7545e..517dcab 100644 --- a/includes/wefactauth.inc.php +++ b/includes/wefactauth.inc.php @@ -6,14 +6,15 @@ include_once('misc.inc.php'); /* This class is written by Wefact. See https://www.wefact.nl/wefact-hosting/apiv2/ */ -class WeFactAPI -{ +class WeFactAPI { private $url; private $responseType; private $apiKey; function __construct(){ + global $wefactapiurl; + global $wefactapikey; $this->url = $wefactapiurl; $this->api_key = $wefactapikey; }