|
|
|
@ -214,9 +214,9 @@ class EBSCOConnector {
|
|
|
|
|
$this->autoComplete = $config['autocomplete']; |
|
|
|
|
$this->orgId = $config['organization']; |
|
|
|
|
$this->local_ip_address = $config['local_ip_address']; |
|
|
|
|
$this->isGuest = (\Drupal::currentUser()->isAuthenticated() || $this->isGuestIPAddress($_SERVER["REMOTE_ADDR"])) ? 'n' : 'y'; |
|
|
|
|
$this->isGuest = 'n'; |
|
|
|
|
$this->logAPIRequests = ($config['log'] == 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -381,12 +381,12 @@ class EBSCOConnector {
|
|
|
|
|
public function requestCitationStyles($params, $headers) { |
|
|
|
|
$url = self::$end_point . '/CitationStyles'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$responseCitation = $this->request($url, $params, $headers); |
|
|
|
|
$response = $responseCitation->Citations; |
|
|
|
|
|
|
|
|
|
return $response; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -405,7 +405,7 @@ class EBSCOConnector {
|
|
|
|
|
public function requestInfo($params, $headers) { |
|
|
|
|
$url = self::$end_point . '/Info'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$response = $this->request($url, $params, $headers); |
|
|
|
|
return $response; |
|
|
|
|
} |
|
|
|
@ -441,34 +441,34 @@ class EBSCOConnector {
|
|
|
|
|
$data=$params; |
|
|
|
|
// Send the request. |
|
|
|
|
$response=null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
$curl = curl_init(); |
|
|
|
|
curl_setopt($curl, CURLOPT_URL, $url); |
|
|
|
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |
|
|
|
|
curl_setopt($curl, CURLOPT_MAXREDIRS, 10 ); |
|
|
|
|
curl_setopt($curl, CURLOPT_MAXREDIRS, 10 ); |
|
|
|
|
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); |
|
|
|
|
curl_setopt($curl, CURLOPT_TIMEOUT, 10); |
|
|
|
|
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); |
|
|
|
|
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch ($method) |
|
|
|
|
{ |
|
|
|
|
case 'GET': |
|
|
|
|
if ($data) { $url = sprintf('%s?%s', $url, http_build_query($data)); } |
|
|
|
|
curl_setopt($curl, CURLOPT_URL, $url); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'POST': |
|
|
|
|
if ($data) { |
|
|
|
|
if ($data) { |
|
|
|
|
curl_setopt($curl,CURLOPT_POST, 1); |
|
|
|
|
curl_setopt($curl,CURLOPT_POSTFIELDS, $data); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'DELETE': |
|
|
|
|
if ($data) { |
|
|
|
|
if ($data) { |
|
|
|
|
if (count($headers)>0) { |
|
|
|
|
curl_setopt($curl,CURLOPT_HTTPHEADER, $headers); |
|
|
|
|
} |
|
|
|
@ -476,12 +476,12 @@ class EBSCOConnector {
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$response = curl_exec($curl); |
|
|
|
|
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE); |
|
|
|
|
curl_close($curl); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch ($code) { |
|
|
|
|
case self::HTTP_OK: |
|
|
|
|
|
|
|
|
|