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