|
|
@ -1,7 +1,5 @@ |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @file |
|
|
|
* @file |
|
|
|
* Connection Helper Class |
|
|
|
* Connection Helper Class |
|
|
@ -66,10 +64,10 @@ class ConnectionHelper { |
|
|
|
//with the appropriate entry for a username of anonymous password of anonymous |
|
|
|
//with the appropriate entry for a username of anonymous password of anonymous |
|
|
|
try { |
|
|
|
try { |
|
|
|
$client = new SoapClient($this->_fixURL($url, 'anonymous', 'anonymous'), array( |
|
|
|
$client = new SoapClient($this->_fixURL($url, 'anonymous', 'anonymous'), array( |
|
|
|
'login' => 'anonymous', |
|
|
|
'login' => 'anonymous', |
|
|
|
'password' => 'anonymous', |
|
|
|
'password' => 'anonymous', |
|
|
|
'exceptions' => $exceptions, |
|
|
|
'exceptions' => $exceptions, |
|
|
|
)); |
|
|
|
)); |
|
|
|
} catch (SoapFault $e) { |
|
|
|
} catch (SoapFault $e) { |
|
|
|
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage())))); |
|
|
|
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage())))); |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
@ -78,15 +76,32 @@ class ConnectionHelper { |
|
|
|
else { |
|
|
|
else { |
|
|
|
try { |
|
|
|
try { |
|
|
|
$client = new SoapClient($this->_fixURL($url, $user->name, $user->pass), array( |
|
|
|
$client = new SoapClient($this->_fixURL($url, $user->name, $user->pass), array( |
|
|
|
'login' => $user->name, |
|
|
|
'login' => $user->name, |
|
|
|
'password' => $user->pass, |
|
|
|
'password' => $user->pass, |
|
|
|
'exceptions' => TRUE, |
|
|
|
'exceptions' => TRUE, |
|
|
|
)); |
|
|
|
)); |
|
|
|
} catch (SoapFault $e) { |
|
|
|
} catch (SoapFault $e) { |
|
|
|
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage())))); |
|
|
|
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage())))); |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (isset($_SESSION['islandora_soapcookies'])) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// just set the cookies |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$client->_cookies = ($_SESSION['islandora_soapcookies']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
//we need to make a call to set the cookie this extra call would only happen once per session |
|
|
|
|
|
|
|
$client->__soapCall('describeRepository', array()); |
|
|
|
|
|
|
|
$_SESSION['islandora_soapcookies'] = $client->_cookies; |
|
|
|
|
|
|
|
} catch (exception $e) { |
|
|
|
|
|
|
|
//connection is tested elsewhere so eat this for now here we just want the cookie |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $client; |
|
|
|
return $client; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|