- call CheckSession as late as possible
- always try to get zip file so that we can have a cacheable uri
This commit is contained in:
@@ -13,7 +13,7 @@ use BSR\Lib\WebService;
|
||||
class NetBiblio extends WebService
|
||||
{
|
||||
/** @var string $version version number */
|
||||
public static $version = '1.0.3';
|
||||
public static $version = '1.0.4';
|
||||
|
||||
private $login = '';
|
||||
private $client = 'website';
|
||||
@@ -184,7 +184,7 @@ class NetBiblio extends WebService
|
||||
isset($b['files']) &&
|
||||
isset($b['files']['samples']) &&
|
||||
count($b['files']['samples']) == 2 && // we want two samples (mp3 and ogg)
|
||||
(strlen($this->login) == 0 || isset($b['files']['zip'])) // we want a zip file only for logged in people
|
||||
isset($b['files']['zip']) // we want a zip file
|
||||
);
|
||||
});
|
||||
|
||||
@@ -208,6 +208,9 @@ class NetBiblio extends WebService
|
||||
$this->SetFiles($files);
|
||||
}
|
||||
|
||||
// retrieve login information if they exists to generate the URL
|
||||
$this->CheckSession();
|
||||
|
||||
// add hash, client and login into zip file uri
|
||||
$books = array_map(function($b) {
|
||||
$b['files']['cacheable_uri'] = isset($b['files']['zip']['uri']) ? $b['files']['zip']['uri'] : false;
|
||||
@@ -502,7 +505,6 @@ class NetBiblio extends WebService
|
||||
*/
|
||||
public function FindBooks($codes)
|
||||
{
|
||||
$this->CheckSession();
|
||||
return array_values($this->AddBookData(BookSearch::GetBooks(json_decode($codes))));
|
||||
}
|
||||
|
||||
@@ -514,7 +516,6 @@ class NetBiblio extends WebService
|
||||
*/
|
||||
public function FindBook($code)
|
||||
{
|
||||
$this->CheckSession();
|
||||
$books = $this->AddBookData(BookSearch::GetBooks(array($code)));
|
||||
return reset($books);
|
||||
}
|
||||
@@ -622,6 +623,7 @@ class NetBiblio extends WebService
|
||||
*/
|
||||
public function NewSearch($values)
|
||||
{
|
||||
// we need the client to perform some query field replacement
|
||||
$this->CheckSession();
|
||||
|
||||
$queryArray = json_decode($values, true);
|
||||
@@ -807,8 +809,6 @@ class NetBiblio extends WebService
|
||||
*/
|
||||
public function LastBooksByType($genre, $number)
|
||||
{
|
||||
$this->CheckSession();
|
||||
|
||||
$s = new BookSearch();
|
||||
if($genre == 'Jeunesse') {
|
||||
$s->addQuery(1, 'jeunesse');
|
||||
|
||||
Reference in New Issue
Block a user