=') && extension_loaded('xsl')) { require_once($include_path.'/xslt-php4-to-php5.inc.php'); } class divercities extends oai { const DIVERCITIES_URL_DEFAULT = "https://export.divercities.eu/oai"; const DIVERCITIES_AUTHENTICATION_URL_PATTERN_DEFAULT = "https://accounts.divercities.eu/users/auth/pmb?service=!!SERVICE!!&dest=!!DEST!!&bibid=!!STATION_ID!!&uid=!!UID!!&token=!!TOKEN!!"; const DIVERCITIES_METADATAPREFIX_DEFAULT = 'oai1dtouch_dc'; const DIVERCITIES_XSL_TRANSFORM_DEFAULT = 'oai1dtouch_dc.xsl'; const DIVERCITIES_XSL_TRANSFORM_FILE_DEFAULT = __DIR__.'/xslt/oai1dtouch_dc.xsl'; public function __construct($connector_path='') { parent::__construct($connector_path); $this->timeout = 30; } public function get_id() { return "divercities"; } public function get_messages($connector_path) { global $lang; $oai_file_name = ''; if (is_readable($connector_path."/../oai/messages/".$lang.".xml")) { $oai_file_name=$connector_path."/../oai/messages/".$lang.".xml"; } else if (is_readable($connector_path."/../oai/messages/fr_FR.xml")) { $oai_file_name=$connector_path."/../oai/messages/fr_FR.xml"; } $file_name = ''; if (is_readable($connector_path."/messages/".$lang.".xml")) { $file_name=$connector_path."/messages/".$lang.".xml"; } else if (is_readable($connector_path."/messages/fr_FR.xml")) { $file_name=$connector_path."/messages/fr_FR.xml"; } if ($oai_file_name) { $xmllist = new XMLlist($oai_file_name); $xmllist->analyser(); $this->msg=$xmllist->table; } if ($file_name) { $xmllist=new XMLlist($file_name); $xmllist->analyser(); $this->msg+=$xmllist->table; } } public function source_get_property_form($source_id) { global $base_path, $charset; $url = ''; $clean_base_url = ''; $sets = []; $formats = ''; $xsl_transform = []; $del_deleted = 0; $clean_html = ''; $divercities_authentication_url_pattern = ''; $divercities_authentication_source_id = 0; $params = $this->unserialize_source_params($source_id); if (!empty($params["PARAMETERS"])) { foreach ($params["PARAMETERS"] as $key => $val) { ${$key} = $val; } } if(!$source_id) { $url = divercities::DIVERCITIES_URL_DEFAULT; $formats = divercities::DIVERCITIES_METADATAPREFIX_DEFAULT; $divercities_authentication_url_pattern = divercities::DIVERCITIES_AUTHENTICATION_URL_PATTERN_DEFAULT; if (is_readable(divercities::DIVERCITIES_XSL_TRANSFORM_FILE_DEFAULT)) { $xsl_transform = [ 'name' => divercities::DIVERCITIES_XSL_TRANSFORM_DEFAULT, 'code' => file_get_contents(divercities::DIVERCITIES_XSL_TRANSFORM_FILE_DEFAULT), ]; } } $form = "
"; if (empty($url)) { $form .= "

".$this->msg["rec_addr"]."

"; } else { //Interrogation du serveur $oai_p = new oai20($url, $charset, $params["TIMEOUT"]); if ($oai_p->error) { $form .= "

".sprintf($this->msg["error_contact_server"], $oai_p->error_message)."

"; } else { $form .= "

".$oai_p->repositoryName."

"; if (!empty($oai_p->description)) { $form .= "
".htmlentities($oai_p->description, ENT_QUOTES, $charset)."
"; } $form .= "
".formatdate($oai_p->earliestDatestamp)."
".$oai_p->adminEmail."
".($oai_p->granularity=="YYYY-MM-DD" ? $this->msg["oai_one_day"] : $this->msg["oai_minute"])."
"; if ($oai_p->has_feature("SETS")) { $form .= "
"; $elements = array(); foreach ($oai_p->sets as $code => $set) { if (array_search($code, $sets) !== false) { $elements[] = array('id' => $code, 'name' => $set['name'].($set['description'] ? " (".$set['description'].")" : "")); } } $form .= ""; templates::init_completion_attributes(array( array('name' => 'att_id_filter', 'value' => $source_id), array('name' => 'source_url', 'value' => urlencode($url)), array('name' => 'connector_path', 'value' => $this->get_id()), array('name' => 'connector_name', 'value' => $this->get_id()) )); templates::init_selection_attributes(array( array('name' => 'source_id', 'value' => $source_id), array('name' => 'source_url', 'value' => urlencode($url)), array('name' => 'connector_path', 'value' => $this->get_id()), array('name' => 'connector_name', 'value' => $this->get_id()) )); $form .= oai::get_syncronised_sets_template($elements, 'source_form', 'sets', 'set_id', 'connectors', true); $form .= "
"; } $form .= "
"; if (!empty($xsl_transform)) { $form .= "
".sprintf($this->msg["oai_xslt_file_linked"], $xsl_transform["name"])." :".$this->msg["oai_del_xslt_file"]." "; } $form .= "
"; $form .= "
"; if ($oai_p->deletedRecord == "persistent" || $oai_p->deletedRecord == "transient") { $form .= "
"; } } } $form.= "
"; $form.= "
"; $authentication_sources_selector = $this->get_authentication_sources_selector($divercities_authentication_source_id); if($authentication_sources_selector == '') { $form.= "
 

".$this->msg['divercities_authentication_source_error']."

"; } else { $form.= "
".$authentication_sources_selector."
"; } $form.= " "; return $form; } protected function get_authentication_sources_selector($divercities_authentication_source_id) { global $charset; $sources = $this->get_authentication_sources(); if(empty($sources)) { return ''; } $selector = "